summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorXiong Zhang <panda0626@gmail.com>2014-06-12 11:06:25 +0800
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-04 17:11:22 +0300
commitbfb4ade1a0f2faa4dd38c542ff72909eaa1c7be3 (patch)
treedf995acd938ef2228edf672fbf747e01cf172317 /shared
parentb9f863ca57e16b0b630be93af9998bb5d4c598fe (diff)
downloadweston-bfb4ade1a0f2faa4dd38c542ff72909eaa1c7be3.tar.gz
weston-bfb4ade1a0f2faa4dd38c542ff72909eaa1c7be3.tar.bz2
weston-bfb4ade1a0f2faa4dd38c542ff72909eaa1c7be3.zip
clients: Maximize window when double click on title bar
Signed-off-by: Xiong Zhang <panda0626@gmail.com> Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'shared')
-rw-r--r--shared/cairo-util.h4
-rw-r--r--shared/frame.c31
2 files changed, 35 insertions, 0 deletions
diff --git a/shared/cairo-util.h b/shared/cairo-util.h
index fb25c341..99c77363 100644
--- a/shared/cairo-util.h
+++ b/shared/cairo-util.h
@@ -213,6 +213,10 @@ frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y);
void
frame_touch_up(struct frame *frame, void *data, int32_t id);
+enum theme_location
+frame_double_click(struct frame *frame, void *pointer,
+ uint32_t button, enum frame_button_state state);
+
void
frame_repaint(struct frame *frame, cairo_t *cr);
diff --git a/shared/frame.c b/shared/frame.c
index 5ea0e120..a983d845 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -837,6 +837,37 @@ frame_touch_up(struct frame *frame, void *data, int32_t id)
}
}
+enum theme_location
+frame_double_click(struct frame *frame, void *data,
+ uint32_t btn, enum frame_button_state state)
+{
+ struct frame_pointer *pointer = frame_pointer_get(frame, data);
+ struct frame_button *button;
+ enum theme_location location = THEME_LOCATION_EXTERIOR;
+
+ location = theme_get_location(frame->theme, pointer->x, pointer->y,
+ frame->width, frame->height,
+ frame->flags & FRAME_FLAG_MAXIMIZED ?
+ THEME_FRAME_MAXIMIZED : 0);
+
+ button = frame_find_button(frame, pointer->x, pointer->y);
+
+ if (location != THEME_LOCATION_TITLEBAR || btn != BTN_LEFT)
+ return location;
+
+ if (state == FRAME_BUTTON_PRESSED) {
+ if (button)
+ frame_button_press(button);
+ else
+ frame->status |= FRAME_STATUS_MAXIMIZE;
+ } else if (state == FRAME_BUTTON_RELEASED) {
+ if (button)
+ frame_button_release(button);
+ }
+
+ return location;
+}
+
void
frame_repaint(struct frame *frame, cairo_t *cr)
{