[gtk+: 27/54] gtkmain: Let windows handle WM-related events before delivering to the grab_widget
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+: 27/54] gtkmain: Let windows handle WM-related events before delivering to the grab_widget
- Date: Wed, 22 Jan 2014 17:47:05 +0000 (UTC)
commit 36abb4b829259a190c1660dd2e1d66e466865c0c
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 7 17:49:31 2014 +0100
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.
gtk/gtkmain.c | 6 ++++++
gtk/gtkwindow.c | 21 +++++++++++++++++++++
gtk/gtkwindowprivate.h | 2 ++
3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 40f0b05..c1b08cf 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6f7ce0f..260f57a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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)
{
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index d9f9f4d..5395eb0 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]