mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 00:50:42 -05:00
window: use input event helper functions on notify_focus()
This commit is contained in:
parent
e6d09c9d0b
commit
3b0aa9f881
@ -6483,6 +6483,9 @@ gboolean
|
||||
meta_window_notify_focus (MetaWindow *window,
|
||||
XEvent *event)
|
||||
{
|
||||
guint evtype, mode, detail;
|
||||
Window xwindow;
|
||||
|
||||
/* note the event can be on either the window or the frame,
|
||||
* we focus the frame for shaded windows
|
||||
*/
|
||||
@ -6501,23 +6504,36 @@ meta_window_notify_focus (MetaWindow *window,
|
||||
* the MRU list gets confused from what the user expects once a
|
||||
* keybinding is used.
|
||||
*/
|
||||
if (meta_input_event_get_type (window->display, event, &evtype))
|
||||
{
|
||||
meta_input_event_get_crossing_details (window->display, event,
|
||||
&mode, &detail);
|
||||
xwindow = meta_input_event_get_window (window->display, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
xwindow = event->xany.window;
|
||||
evtype = event->type;
|
||||
mode = detail = 0;
|
||||
}
|
||||
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focus %s event received on %s 0x%lx (%s) "
|
||||
"mode %s detail %s\n",
|
||||
event->type == FocusIn ? "in" :
|
||||
event->type == FocusOut ? "out" :
|
||||
event->type == UnmapNotify ? "unmap" :
|
||||
evtype == FocusIn ? "in" :
|
||||
evtype == FocusOut ? "out" :
|
||||
evtype == UnmapNotify ? "unmap" :
|
||||
"???",
|
||||
window->desc, event->xany.window,
|
||||
event->xany.window == window->xwindow ?
|
||||
window->desc, xwindow,
|
||||
xwindow == window->xwindow ?
|
||||
"client window" :
|
||||
(window->frame && event->xany.window == window->frame->xwindow) ?
|
||||
"frame window" :
|
||||
"unknown window",
|
||||
event->type != UnmapNotify ?
|
||||
meta_event_mode_to_string (event->xfocus.mode) : "n/a",
|
||||
event->type != UnmapNotify ?
|
||||
meta_event_detail_to_string (event->xfocus.detail) : "n/a");
|
||||
evtype != UnmapNotify ?
|
||||
meta_event_mode_to_string (mode) : "n/a",
|
||||
evtype != UnmapNotify ?
|
||||
meta_event_detail_to_string (detail) : "n/a");
|
||||
|
||||
/* FIXME our pointer tracking is broken; see how
|
||||
* gtk+/gdk/x11/gdkevents-x11.c or XFree86/xc/programs/xterm/misc.c
|
||||
@ -6538,19 +6554,19 @@ meta_window_notify_focus (MetaWindow *window,
|
||||
* http://bugzilla.gnome.org/show_bug.cgi?id=90382
|
||||
*/
|
||||
|
||||
if ((event->type == FocusIn ||
|
||||
event->type == FocusOut) &&
|
||||
(event->xfocus.mode == NotifyGrab ||
|
||||
event->xfocus.mode == NotifyUngrab ||
|
||||
if ((evtype == FocusIn ||
|
||||
evtype == FocusOut) &&
|
||||
(mode == NotifyGrab ||
|
||||
mode == NotifyUngrab ||
|
||||
/* From WindowMaker, ignore all funky pointer root events */
|
||||
event->xfocus.detail > NotifyNonlinearVirtual))
|
||||
detail > NotifyNonlinearVirtual))
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Ignoring focus event generated by a grab or other weirdness\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (event->type == FocusIn)
|
||||
if (evtype == FocusIn)
|
||||
{
|
||||
if (window->override_redirect)
|
||||
{
|
||||
@ -6633,11 +6649,11 @@ meta_window_notify_focus (MetaWindow *window,
|
||||
meta_window_propagate_focus_appearance (window, TRUE);
|
||||
}
|
||||
}
|
||||
else if (event->type == FocusOut ||
|
||||
event->type == UnmapNotify)
|
||||
else if (evtype == FocusOut ||
|
||||
evtype == UnmapNotify)
|
||||
{
|
||||
if (event->type == FocusOut &&
|
||||
event->xfocus.detail == NotifyInferior)
|
||||
if (evtype == FocusOut &&
|
||||
detail == NotifyInferior)
|
||||
{
|
||||
/* This event means the client moved focus to a subwindow */
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
|
Loading…
Reference in New Issue
Block a user