diff options
author | Xiong Zhang <panda0626@gmail.com> | 2014-06-12 11:06:25 +0800 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-09-04 17:11:22 +0300 |
commit | bfb4ade1a0f2faa4dd38c542ff72909eaa1c7be3 (patch) | |
tree | df995acd938ef2228edf672fbf747e01cf172317 /clients | |
parent | b9f863ca57e16b0b630be93af9998bb5d4c598fe (diff) |
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 'clients')
-rw-r--r-- | clients/window.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/clients/window.c b/clients/window.c index 85c25f7e..e0981c6a 100644 --- a/clients/window.c +++ b/clients/window.c @@ -365,6 +365,9 @@ struct window_frame { struct widget *widget; struct widget *child; struct frame *frame; + + uint32_t last_time; + uint32_t did_double, double_click; }; struct menu { @@ -2340,6 +2343,7 @@ frame_handle_status(struct window_frame *frame, struct input *input, } } +#define DOUBLE_CLICK_PERIOD 250 static void frame_button_handler(struct widget *widget, struct input *input, uint32_t time, @@ -2350,7 +2354,27 @@ frame_button_handler(struct widget *widget, struct window_frame *frame = data; enum theme_location location; - location = frame_pointer_button(frame->frame, input, button, state); + frame->double_click = 0; + if (state == WL_POINTER_BUTTON_STATE_PRESSED) { + if (time - frame->last_time <= DOUBLE_CLICK_PERIOD) { + frame->double_click = 1; + frame->did_double = 1; + } else + frame->did_double = 0; + + frame->last_time = time; + } else if (frame->did_double == 1) { + frame->double_click = 1; + frame->did_double = 0; + } + + if (frame->double_click) + location = frame_double_click(frame->frame, input, + button, state); + else + location = frame_pointer_button(frame->frame, input, + button, state); + frame_handle_status(frame, input, time, location); } |