diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-01-12 21:01:43 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-01-12 22:25:19 -0500 |
commit | 2232430a5afca69cf9403af851ed4fe55558da79 (patch) | |
tree | 5e524a5d256eaf87ea2509df6c034a56ab7ced71 /gtk/gtkmenushell.c | |
parent | f940a60fd514dacee9194f142e05bedd651bcd7e (diff) | |
download | gtk+-2232430a5afca69cf9403af851ed4fe55558da79.tar.gz |
Redo csd window-dragging
The window-dragging code had a number of issues: The code was
starting a drag on every button press, never bothering to cancel
them. This leads to the odd hand cursor occurring between the two
clicks to maximize. We relied on GDK's multi-click detection, which
gives us triple-clicks when we really want sequences of double-clicks.
Lastly, we didn't propery restrict double-click handling to the primary
button, so e.g. if you had a window on an empty workspace, double-right
click on the titlebar would maximize it, which is not intended.
This commit solves all three problem by a doing our own double-click
detection, and only starting a drag when the pointer goes out of
'double-click range'. We change the way dragging is implemented for
menubars and toolbars to just letting events bubble up, so they
get the same behaviour as the titlebar. To make this work, we
have to select for pointer motion events in a few more places.
Diffstat (limited to 'gtk/gtkmenushell.c')
-rw-r--r-- | gtk/gtkmenushell.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index 3bbceeeb52..18386950c2 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -605,6 +605,7 @@ gtk_menu_shell_realize (GtkWidget *widget) attributes.event_mask |= (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); @@ -648,9 +649,6 @@ gtk_menu_shell_button_press (GtkWidget *widget, GtkWidget *menu_item; GtkWidget *parent; - if (event->type == GDK_2BUTTON_PRESS) - return _gtk_window_handle_button_press_for_widget (widget, event); - if (event->type != GDK_BUTTON_PRESS) return FALSE; @@ -706,8 +704,8 @@ gtk_menu_shell_button_press (GtkWidget *widget, { if (!initially_active) { - if (_gtk_window_handle_button_press_for_widget (widget, event)) - gtk_menu_shell_deactivate (menu_shell); + gtk_menu_shell_deactivate (menu_shell); + return FALSE; } } } |