[PATCH weston v2 2/5] cairo-util: return theme location from frame_touch_down

Derek Foreman derekf at osg.samsung.com
Fri Nov 6 13:56:07 PST 2015


I'll be using this in a follow up patch that adds touch input to weston's
wayland backend.

Reviewed-by: Daniel Stone <daniels at collabora.com>
Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
Just a re-post to keep the series together

 shared/cairo-util.h |  2 +-
 shared/frame.c      | 17 +++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/shared/cairo-util.h b/shared/cairo-util.h
index 019424e..4fee087 100644
--- a/shared/cairo-util.h
+++ b/shared/cairo-util.h
@@ -210,7 +210,7 @@ enum theme_location
 frame_pointer_button(struct frame *frame, void *pointer,
 		     uint32_t button, enum frame_button_state state);
 
-void
+enum theme_location
 frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y);
 
 void
diff --git a/shared/frame.c b/shared/frame.c
index 4179b0a..1b67eb1 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -786,27 +786,27 @@ frame_pointer_button(struct frame *frame, void *data,
 	return location;
 }
 
-void
+enum theme_location
 frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y)
 {
 	struct frame_touch *touch = frame_touch_get(frame, data);
 	struct frame_button *button = frame_find_button(frame, x, y);
 	enum theme_location location;
 
+	location = theme_get_location(frame->theme, x, y,
+				      frame->width, frame->height,
+				      frame->flags & FRAME_FLAG_MAXIMIZED ?
+				      THEME_FRAME_MAXIMIZED : 0);
+
 	if (id > 0)
-		return;
+		return location;
 
 	if (touch && button) {
 		touch->button = button;
 		frame_button_press(touch->button);
-		return;
+		return location;
 	}
 
-	location = theme_get_location(frame->theme, x, y,
-				      frame->width, frame->height,
-				      frame->flags & FRAME_FLAG_MAXIMIZED ?
-				      THEME_FRAME_MAXIMIZED : 0);
-
 	switch (location) {
 	case THEME_LOCATION_TITLEBAR:
 		frame->status |= FRAME_STATUS_MOVE;
@@ -824,6 +824,7 @@ frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y)
 	default:
 		break;
 	}
+	return location;
 }
 
 void
-- 
2.6.1



More information about the wayland-devel mailing list