From e92757ac8b186cd1cce57ee0bb529347888eeb30 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 8 Jun 2011 10:55:08 +0200 Subject: [PATCH] display: Use helper functions for getting window/root in input events --- src/core/display.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index 5cf778fe6..05099e21b 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1728,6 +1728,8 @@ event_callback (XEvent *event, if (meta_input_event_get_type (display, event, &evtype)) { + Window xwindow = meta_input_event_get_window (display, event); + if (window && !window->override_redirect && ((evtype == KeyPress) || (evtype == ButtonPress))) { @@ -1790,7 +1792,7 @@ event_callback (XEvent *event, meta_topic (META_DEBUG_WINDOW_OPS, "Syncing to old stack positions.\n"); screen = - meta_display_screen_for_root (display, event->xany.window); + meta_display_screen_for_root (display, xwindow); if (screen!=NULL) meta_stack_set_positions (screen->stack, @@ -1993,8 +1995,9 @@ event_callback (XEvent *event, * actually appear on the right screen. */ { + Window xroot = meta_input_event_get_root_window (display, event); MetaScreen *new_screen = - meta_display_screen_for_root (display, event->xcrossing.root); + meta_display_screen_for_root (display, xroot); if (new_screen != NULL && display->active_screen != new_screen) meta_workspace_focus_default_window (new_screen->active_workspace, @@ -2094,8 +2097,7 @@ event_callback (XEvent *event, { meta_window_notify_focus (window, event); } - else if (meta_display_xwindow_is_a_no_focus_window (display, - event->xany.window)) + else if (meta_display_xwindow_is_a_no_focus_window (display, xwindow)) { meta_topic (META_DEBUG_FOCUS, "Focus %s event received on no_focus_window 0x%lx " @@ -2103,15 +2105,15 @@ event_callback (XEvent *event, evtype == FocusIn ? "in" : evtype == FocusOut ? "out" : "???", - event->xany.window, + xwindow, meta_event_mode_to_string (event->xfocus.mode), meta_event_detail_to_string (event->xfocus.detail)); } else { MetaScreen *screen = - meta_display_screen_for_root(display, - event->xany.window); + meta_display_screen_for_root(display, xwindow); + if (screen == NULL) break; @@ -2121,7 +2123,7 @@ event_callback (XEvent *event, evtype == FocusIn ? "in" : evtype == FocusOut ? "out" : "???", - event->xany.window, + xwindow, meta_event_mode_to_string (event->xfocus.mode), meta_event_detail_to_string (event->xfocus.detail));