diff options
author | Xiong Zhang <xiong.y.zhang@intel.com> | 2014-06-12 11:06:26 +0800 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-09-22 10:19:44 +0300 |
commit | 382de46a2fc769d7cd6871399558d31d3836bbc1 (patch) | |
tree | baac6266c1e0c6ccacf6399b46dbb9acd0e2bbbd /shared | |
parent | d1be3128d0d6b6dc6d301bb2bd674697bd64dafc (diff) | |
download | weston-382de46a2fc769d7cd6871399558d31d3836bbc1.tar.gz |
clients: Maximize window when double touch on title bar
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Diffstat (limited to 'shared')
-rw-r--r-- | shared/cairo-util.h | 7 | ||||
-rw-r--r-- | shared/frame.c | 49 |
2 files changed, 56 insertions, 0 deletions
diff --git a/shared/cairo-util.h b/shared/cairo-util.h index 99c77363..11d11d1d 100644 --- a/shared/cairo-util.h +++ b/shared/cairo-util.h @@ -218,6 +218,13 @@ frame_double_click(struct frame *frame, void *pointer, uint32_t button, enum frame_button_state state); void +frame_double_touch_down(struct frame *frame, void *data, int32_t id, + int x, int y); + +void +frame_double_touch_up(struct frame *frame, void *data, int32_t id); + +void frame_repaint(struct frame *frame, cairo_t *cr); #endif diff --git a/shared/frame.c b/shared/frame.c index a983d845..0bf4af35 100644 --- a/shared/frame.c +++ b/shared/frame.c @@ -869,6 +869,55 @@ frame_double_click(struct frame *frame, void *data, } void +frame_double_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; + + if (touch && button) { + touch->button = button; + frame_button_press(touch->button); + return; + } + + 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_MAXIMIZE; + break; + case THEME_LOCATION_RESIZING_TOP: + case THEME_LOCATION_RESIZING_BOTTOM: + case THEME_LOCATION_RESIZING_LEFT: + case THEME_LOCATION_RESIZING_RIGHT: + case THEME_LOCATION_RESIZING_TOP_LEFT: + case THEME_LOCATION_RESIZING_TOP_RIGHT: + case THEME_LOCATION_RESIZING_BOTTOM_LEFT: + case THEME_LOCATION_RESIZING_BOTTOM_RIGHT: + frame->status |= FRAME_STATUS_RESIZE; + break; + default: + break; + } +} + +void +frame_double_touch_up(struct frame *frame, void *data, int32_t id) +{ + struct frame_touch *touch = frame_touch_get(frame, data); + + if (touch && touch->button) { + frame_button_release(touch->button); + frame_touch_destroy(touch); + } +} + +void frame_repaint(struct frame *frame, cairo_t *cr) { struct frame_button *button; |