Mercurial > audlegacy-plugins
changeset 2339:b2a2ca9fceda
Hotkey: Setup event filter on all screens as well to grab all key events. Should fix bug #119 now.
author | Sascha Hlusiak <contact@saschahlusiak.de> |
---|---|
date | Fri, 25 Jan 2008 11:34:10 +0100 |
parents | a9f52daf13ba |
children | 47d7a45b26a0 |
files | src/hotkey/grab.c |
diffstat | 1 files changed, 30 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotkey/grab.c Thu Jan 24 18:57:40 2008 +0100 +++ b/src/hotkey/grab.c Fri Jan 25 11:34:10 2008 +0100 @@ -191,16 +191,13 @@ void grab_keys ( ) { - GdkDisplay* display; Display* xdisplay; - GdkWindow *root_window; - int i; + int screen; PluginConfig* plugin_cfg = get_config(); HotkeyConfiguration *hotkey; XErrorHandler old_handler = 0; - display = gdk_display_get_default(); - xdisplay = GDK_DISPLAY_XDISPLAY(display); + xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); if (grabbed) return; @@ -212,10 +209,9 @@ hotkey = &(plugin_cfg->first); while (hotkey) { - for (i=0;i<gdk_display_get_n_screens(display);i++) + for (screen=0;screen<ScreenCount(xdisplay);screen++) { - root_window = gdk_screen_get_root_window(gdk_display_get_screen(display, i)); - grab_key(hotkey, xdisplay, GDK_WINDOW_XID(root_window)); + grab_key(hotkey, xdisplay, RootWindow(xdisplay, screen)); } hotkey = hotkey->next; } @@ -295,16 +291,13 @@ void ungrab_keys ( ) { - GdkDisplay* display; Display* xdisplay; - GdkWindow *root_window; - int i; + int screen; PluginConfig* plugin_cfg = get_config(); HotkeyConfiguration *hotkey; XErrorHandler old_handler = 0; - display = gdk_display_get_default(); - xdisplay = GDK_DISPLAY_XDISPLAY(display); + xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); if (!grabbed) return; if (!xdisplay) return; @@ -317,10 +310,9 @@ hotkey = &(plugin_cfg->first); while (hotkey) { - for (i=0;i<gdk_display_get_n_screens(display);i++) + for (screen=0;screen<ScreenCount(xdisplay);screen++) { - root_window = gdk_screen_get_root_window(gdk_display_get_screen(display, i)); - ungrab_key(hotkey, xdisplay, GDK_WINDOW_XID(root_window)); + ungrab_key(hotkey, xdisplay, RootWindow(xdisplay, screen)); } hotkey = hotkey->next; } @@ -387,16 +379,32 @@ gboolean setup_filter() { - gdk_window_add_filter(gdk_get_default_root_window(), - gdk_filter, - NULL); + GdkDisplay *display; + int screen; + + display = gdk_display_get_default(); + + for (screen = 0; screen<gdk_display_get_n_screens(display); screen++) + { + gdk_window_add_filter(gdk_screen_get_root_window(gdk_display_get_screen(display, screen)), + gdk_filter, + NULL); + } return TRUE; } void release_filter() { - gdk_window_remove_filter(gdk_get_default_root_window(), - gdk_filter, - NULL); + GdkDisplay *display; + int screen; + + display = gdk_display_get_default(); + + for (screen = 0; screen<gdk_display_get_n_screens(display); screen++) + { + gdk_window_remove_filter(gdk_screen_get_root_window(gdk_display_get_screen(display, screen)), + gdk_filter, + NULL); + } }