gtkmain: Let windows handle WM-related events before delivering to the grab_widget

This makes it possible to move/resize client-side decorated windows that are
otherwise obscured by a GTK+ grab somewhere else, either a popover within the
window itself or a modal dialog above the window.
This commit is contained in:
Carlos Garnacho 2014-01-07 17:49:31 +01:00
parent bfc87a315d
commit 36abb4b829
3 changed files with 29 additions and 0 deletions

View File

@ -1568,6 +1568,12 @@ gtk_main_do_event (GdkEvent *event)
event_widget = gtk_get_event_widget (event);
}
if (GTK_IS_WINDOW (event_widget))
{
if (_gtk_window_check_handle_wm_event (event))
return;
}
window_group = gtk_main_get_window_group (event_widget);
device = gdk_event_get_device (event);

View File

@ -7704,6 +7704,27 @@ gtk_window_button_press_event (GtkWidget *widget,
return FALSE;
}
gboolean
_gtk_window_check_handle_wm_event (GdkEvent *event)
{
GtkWidget *widget;
widget = gtk_get_event_widget (event);
if (!GTK_IS_WINDOW (widget))
return FALSE;
if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_2BUTTON_PRESS)
return gtk_window_button_press_event (widget, &event->button);
else if (event->type == GDK_BUTTON_RELEASE)
gtk_window_button_release_event (widget, &event->button);
else if (event->type == GDK_MOTION_NOTIFY)
return gtk_window_motion_notify_event (widget, &event->motion);
else
return FALSE;
}
static void
gtk_window_real_activate_default (GtkWindow *window)
{

View File

@ -75,6 +75,8 @@ void _gtk_window_keys_foreach (GtkWindow *window,
GtkWindowKeysForeachFunc func,
gpointer func_data);
gboolean _gtk_window_check_handle_wm_event (GdkEvent *event);
/* --- internal (GtkAcceleratable) --- */
gboolean _gtk_window_query_nonaccels (GtkWindow *window,
guint accel_key,