summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-08-10 15:55:18 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-08-10 15:55:18 +0000
commit4c3a20c3f2ebf5b709ed43098cfedce3171fc381 (patch)
tree0a64f1197ed6d26cf1daa75f3777c213136ccb5b
parentb78ad2e12dfa89bb524a7cc5672143f4f56232a7 (diff)
downloadmetacity-4c3a20c3f2ebf5b709ed43098cfedce3171fc381.tar.gz
filter out key events that happen on popup menus etc.
2002-08-10 Havoc Pennington <hp@pobox.com> * src/keybindings.c (meta_display_process_key_event): filter out key events that happen on popup menus etc. * src/ui.c (meta_ui_window_is_widget): new function to check whether a window belongs to a GtkWidget such as the popup menu * src/prefs.c (change_notify): put in a no-op line for AIX compiler, #84252
-rw-r--r--ChangeLog11
-rw-r--r--src/keybindings.c7
-rw-r--r--src/prefs.c1
-rw-r--r--src/ui.c19
-rw-r--r--src/ui.h3
5 files changed, 40 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 43097724..1cfaa68f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2002-08-10 Havoc Pennington <hp@pobox.com>
+ * src/keybindings.c (meta_display_process_key_event): filter out
+ key events that happen on popup menus etc.
+
+ * src/ui.c (meta_ui_window_is_widget): new function to check
+ whether a window belongs to a GtkWidget such as the popup menu
+
+ * src/prefs.c (change_notify): put in a no-op line for AIX
+ compiler, #84252
+
+2002-08-10 Havoc Pennington <hp@pobox.com>
+
* src/window.c (update_resize): track time to avoid sending a
deluge of move/resize requests, suggestion from
xavier.bestel@free.fr bug #86830. Not really sure if this will
diff --git a/src/keybindings.c b/src/keybindings.c
index aecb448d..b128fdce 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -1276,8 +1276,13 @@ meta_display_process_key_event (MetaDisplay *display,
if (screen == NULL)
return; /* event window is destroyed */
+
+ /* ignore key events on popup menus and such. */
+ if (window == NULL &&
+ meta_ui_window_is_widget (screen->ui, event->xany.window))
+ return;
- /* window may be NULL */
+ /* window may be NULL */
keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0);
diff --git a/src/prefs.c b/src/prefs.c
index 770accd1..9a9b59f2 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -542,6 +542,7 @@ change_notify (GConfClient *client,
out:
/* nothing */
+ return; /* AIX compiler wants something after a label like out: */
}
static gboolean
diff --git a/src/ui.c b/src/ui.c
index 0d95af0f..3e3e6196 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -662,3 +662,22 @@ meta_ui_parse_accelerator (const char *accel,
return TRUE;
}
+
+gboolean
+meta_ui_window_is_widget (MetaUI *ui,
+ Window xwindow)
+{
+ GdkWindow *window;
+
+ window = gdk_xid_table_lookup (xwindow);
+
+ if (window &&
+ gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN)
+ {
+ void *user_data = NULL;
+ gdk_window_get_user_data (window, &user_data);
+ return user_data != NULL;
+ }
+ else
+ return FALSE;
+}
diff --git a/src/ui.h b/src/ui.h
index 1296338b..d671f21b 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -157,6 +157,9 @@ gboolean meta_ui_parse_accelerator (const char *accel,
unsigned int *keysym,
MetaVirtualModifier *mask);
+gboolean meta_ui_window_is_widget (MetaUI *ui,
+ Window xwindow);
+
#include "tabpopup.h"
#endif