mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 09:00:42 -05:00
display: Use helper functions for getting window/root in input events
This commit is contained in:
parent
dc4ecdd0d2
commit
1b7a6ce912
@ -1719,6 +1719,8 @@ event_callback (XEvent *event,
|
|||||||
|
|
||||||
if (meta_input_event_get_type (display, event, &evtype))
|
if (meta_input_event_get_type (display, event, &evtype))
|
||||||
{
|
{
|
||||||
|
Window xwindow = meta_input_event_get_window (display, event);
|
||||||
|
|
||||||
if (window && !window->override_redirect &&
|
if (window && !window->override_redirect &&
|
||||||
((evtype == KeyPress) || (evtype == ButtonPress)))
|
((evtype == KeyPress) || (evtype == ButtonPress)))
|
||||||
{
|
{
|
||||||
@ -1781,7 +1783,7 @@ event_callback (XEvent *event,
|
|||||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||||
"Syncing to old stack positions.\n");
|
"Syncing to old stack positions.\n");
|
||||||
screen =
|
screen =
|
||||||
meta_display_screen_for_root (display, event->xany.window);
|
meta_display_screen_for_root (display, xwindow);
|
||||||
|
|
||||||
if (screen!=NULL)
|
if (screen!=NULL)
|
||||||
meta_stack_set_positions (screen->stack,
|
meta_stack_set_positions (screen->stack,
|
||||||
@ -1984,8 +1986,9 @@ event_callback (XEvent *event,
|
|||||||
* actually appear on the right screen.
|
* actually appear on the right screen.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
Window xroot = meta_input_event_get_root_window (display, event);
|
||||||
MetaScreen *new_screen =
|
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)
|
if (new_screen != NULL && display->active_screen != new_screen)
|
||||||
meta_workspace_focus_default_window (new_screen->active_workspace,
|
meta_workspace_focus_default_window (new_screen->active_workspace,
|
||||||
@ -2085,8 +2088,7 @@ event_callback (XEvent *event,
|
|||||||
{
|
{
|
||||||
meta_window_notify_focus (window, event);
|
meta_window_notify_focus (window, event);
|
||||||
}
|
}
|
||||||
else if (meta_display_xwindow_is_a_no_focus_window (display,
|
else if (meta_display_xwindow_is_a_no_focus_window (display, xwindow))
|
||||||
event->xany.window))
|
|
||||||
{
|
{
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
"Focus %s event received on no_focus_window 0x%lx "
|
"Focus %s event received on no_focus_window 0x%lx "
|
||||||
@ -2094,15 +2096,15 @@ event_callback (XEvent *event,
|
|||||||
evtype == FocusIn ? "in" :
|
evtype == FocusIn ? "in" :
|
||||||
evtype == FocusOut ? "out" :
|
evtype == FocusOut ? "out" :
|
||||||
"???",
|
"???",
|
||||||
event->xany.window,
|
xwindow,
|
||||||
meta_event_mode_to_string (event->xfocus.mode),
|
meta_event_mode_to_string (event->xfocus.mode),
|
||||||
meta_event_detail_to_string (event->xfocus.detail));
|
meta_event_detail_to_string (event->xfocus.detail));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MetaScreen *screen =
|
MetaScreen *screen =
|
||||||
meta_display_screen_for_root(display,
|
meta_display_screen_for_root(display, xwindow);
|
||||||
event->xany.window);
|
|
||||||
if (screen == NULL)
|
if (screen == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2112,7 +2114,7 @@ event_callback (XEvent *event,
|
|||||||
evtype == FocusIn ? "in" :
|
evtype == FocusIn ? "in" :
|
||||||
evtype == FocusOut ? "out" :
|
evtype == FocusOut ? "out" :
|
||||||
"???",
|
"???",
|
||||||
event->xany.window,
|
xwindow,
|
||||||
meta_event_mode_to_string (event->xfocus.mode),
|
meta_event_mode_to_string (event->xfocus.mode),
|
||||||
meta_event_detail_to_string (event->xfocus.detail));
|
meta_event_detail_to_string (event->xfocus.detail));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user