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