Commit 36abb4b8 authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent bfc87a31
......@@ -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);
......
......@@ -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)
{
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment