diff options
author | Stefano Karapetsas <[email protected]> | 2014-02-08 18:42:52 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-02-08 18:42:52 +0100 |
commit | 5391f9c530081f52974dbea2ae2b057587538b7d (patch) | |
tree | d4e4c18823dbaea3c5b2f7cd4fb050637adcb2ab | |
parent | 21d81e6b1b6a9c060adb608a8eccfa201c320314 (diff) | |
download | mate-settings-daemon-5391f9c530081f52974dbea2ae2b057587538b7d.tar.bz2 mate-settings-daemon-5391f9c530081f52974dbea2ae2b057587538b7d.tar.xz |
keyboard: Fix GTK3 support
-rw-r--r-- | plugins/keyboard/delayed-dialog.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/keyboard/delayed-dialog.c b/plugins/keyboard/delayed-dialog.c index bfa63ae..b83b623 100644 --- a/plugins/keyboard/delayed-dialog.c +++ b/plugins/keyboard/delayed-dialog.c @@ -46,7 +46,9 @@ msd_delayed_show_dialog (GtkWidget *dialog) GdkDisplay *display = gtk_widget_get_display (dialog); Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); GdkScreen *screen = gtk_widget_get_screen (dialog); +#if !GTK_CHECK_VERSION (3, 0, 0) GdkAtom manager_atom; +#endif char selection_name[10]; Atom selection_atom; @@ -64,9 +66,13 @@ msd_delayed_show_dialog (GtkWidget *dialog) dialogs = g_slist_prepend (dialogs, dialog); +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_add_filter (NULL, message_filter, NULL); +#ele manager_atom = gdk_atom_intern ("MANAGER", FALSE); gdk_display_add_client_message_filter (display, manager_atom, message_filter, NULL); +#endif g_timeout_add (5000, delayed_show_timeout, NULL); } @@ -89,13 +95,30 @@ delayed_show_timeout (gpointer data) static GdkFilterReturn message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) { +#if GTK_CHECK_VERSION (3, 0, 0) + XClientMessageEvent *evt; + char *selection_name; +#else XClientMessageEvent *evt = (XClientMessageEvent *)xevent; char *selection_name = XGetAtomName (evt->display, evt->data.l[1]); +#endif int screen; GSList *l, *next; +#if GTK_CHECK_VERSION (3, 0, 0) + if (((XEvent *)xevent)->type != ClientMessage) + return GDK_FILTER_CONTINUE; + + evt = (XClientMessageEvent *)xevent; + + if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE)) + return GDK_FILTER_CONTINUE; + + selection_name = XGetAtomName (evt->display, evt->data.l[1]); +#else if (!dialogs) return GDK_FILTER_CONTINUE; +#endif if (strncmp (selection_name, "WM_S", 4) != 0) { XFree (selection_name); @@ -115,8 +138,16 @@ message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) } if (!dialogs) { +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_remove_filter (NULL, message_filter, NULL); +#else /* FIXME: There's no gdk_display_remove_client_message_filter */ +#endif } +#if GTK_CHECK_VERSION (3, 0, 0) + XFree (selection_name); +#endif + return GDK_FILTER_CONTINUE; } |