display: separate input/non-input events handling in the event callback
In order to make the XI2 handling easier on us in the future, we now split input events from non-input events. This will allow one code path to use XIEvent, and the other to use XEvent in the future. This commit has involved plenty of indenting changes, so it's better seen with git diff -b or &ignorews=1 https://bugzilla.gnome.org/show_bug.cgi?id=688779
This commit is contained in:
parent
8bf8f3ea55
commit
129c729c50
@ -1796,6 +1796,27 @@ handle_net_restack_window (MetaDisplay* display,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static XEvent *
|
||||||
|
get_input_event (MetaDisplay *display,
|
||||||
|
XEvent *event)
|
||||||
|
{
|
||||||
|
switch (event->type) {
|
||||||
|
case MotionNotify:
|
||||||
|
case ButtonPress:
|
||||||
|
case ButtonRelease:
|
||||||
|
case KeyPress:
|
||||||
|
case KeyRelease:
|
||||||
|
case FocusIn:
|
||||||
|
case FocusOut:
|
||||||
|
case EnterNotify:
|
||||||
|
case LeaveNotify:
|
||||||
|
return event;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_callback:
|
* event_callback:
|
||||||
* @event: The event that just happened
|
* @event: The event that just happened
|
||||||
@ -1821,6 +1842,7 @@ event_callback (XEvent *event,
|
|||||||
gboolean frame_was_receiver;
|
gboolean frame_was_receiver;
|
||||||
gboolean bypass_compositor;
|
gboolean bypass_compositor;
|
||||||
gboolean filter_out_event;
|
gboolean filter_out_event;
|
||||||
|
XEvent *input_event;
|
||||||
|
|
||||||
display = data;
|
display = data;
|
||||||
|
|
||||||
@ -1840,6 +1862,8 @@ event_callback (XEvent *event,
|
|||||||
|
|
||||||
modified = event_get_modified_window (display, event);
|
modified = event_get_modified_window (display, event);
|
||||||
|
|
||||||
|
input_event = get_input_event (display, event);
|
||||||
|
|
||||||
if (event->type == UnmapNotify)
|
if (event->type == UnmapNotify)
|
||||||
{
|
{
|
||||||
if (meta_ui_window_should_not_cause_focus (display->xdisplay,
|
if (meta_ui_window_should_not_cause_focus (display->xdisplay,
|
||||||
@ -1851,8 +1875,9 @@ event_callback (XEvent *event,
|
|||||||
event->xany.serial);
|
event->xany.serial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event->type == LeaveNotify &&
|
else if (input_event &&
|
||||||
event->xcrossing.mode == NotifyUngrab &&
|
input_event->type == LeaveNotify &&
|
||||||
|
input_event->xcrossing.mode == NotifyUngrab &&
|
||||||
modified == display->ungrab_should_not_cause_focus_window)
|
modified == display->ungrab_should_not_cause_focus_window)
|
||||||
{
|
{
|
||||||
meta_display_add_ignored_crossing_serial (display, event->xany.serial);
|
meta_display_add_ignored_crossing_serial (display, event->xany.serial);
|
||||||
@ -1954,8 +1979,10 @@ event_callback (XEvent *event,
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_SHAPE */
|
#endif /* HAVE_SHAPE */
|
||||||
|
|
||||||
|
if (input_event != NULL)
|
||||||
|
{
|
||||||
if (window && !window->override_redirect &&
|
if (window && !window->override_redirect &&
|
||||||
((event->type == KeyPress) || (event->type == ButtonPress)))
|
((input_event->type == KeyPress) || (input_event->type == ButtonPress)))
|
||||||
{
|
{
|
||||||
if (CurrentTime == display->current_time)
|
if (CurrentTime == display->current_time)
|
||||||
{
|
{
|
||||||
@ -1974,10 +2001,11 @@ event_callback (XEvent *event,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event->type)
|
switch (input_event->type)
|
||||||
{
|
{
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
|
|
||||||
/* For key events, it's important to enforce single-handling, or
|
/* For key events, it's important to enforce single-handling, or
|
||||||
* we can get into a confused state. So if a keybinding is
|
* we can get into a confused state. So if a keybinding is
|
||||||
* handled (because it's one of our hot-keys, or because we are
|
* handled (because it's one of our hot-keys, or because we are
|
||||||
@ -2301,8 +2329,8 @@ event_callback (XEvent *event,
|
|||||||
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 "
|
||||||
"mode %s detail %s\n",
|
"mode %s detail %s\n",
|
||||||
event->type == FocusIn ? "in" :
|
input_event->type == FocusIn ? "in" :
|
||||||
event->type == FocusOut ? "out" :
|
input_event->type == FocusOut ? "out" :
|
||||||
"???",
|
"???",
|
||||||
event->xany.window,
|
event->xany.window,
|
||||||
meta_event_mode_to_string (event->xfocus.mode),
|
meta_event_mode_to_string (event->xfocus.mode),
|
||||||
@ -2319,14 +2347,14 @@ event_callback (XEvent *event,
|
|||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
"Focus %s event received on root window 0x%lx "
|
"Focus %s event received on root window 0x%lx "
|
||||||
"mode %s detail %s\n",
|
"mode %s detail %s\n",
|
||||||
event->type == FocusIn ? "in" :
|
input_event->type == FocusIn ? "in" :
|
||||||
event->type == FocusOut ? "out" :
|
input_event->type == FocusOut ? "out" :
|
||||||
"???",
|
"???",
|
||||||
event->xany.window,
|
event->xany.window,
|
||||||
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));
|
||||||
|
|
||||||
if (event->type == FocusIn &&
|
if (input_event->type == FocusIn &&
|
||||||
event->xfocus.detail == NotifyDetailNone)
|
event->xfocus.detail == NotifyDetailNone)
|
||||||
{
|
{
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
@ -2337,7 +2365,7 @@ event_callback (XEvent *event,
|
|||||||
NULL,
|
NULL,
|
||||||
meta_display_get_current_time_roundtrip (display));
|
meta_display_get_current_time_roundtrip (display));
|
||||||
}
|
}
|
||||||
else if (event->type == FocusIn &&
|
else if (input_event->type == FocusIn &&
|
||||||
event->xfocus.mode == NotifyNormal &&
|
event->xfocus.mode == NotifyNormal &&
|
||||||
event->xfocus.detail == NotifyInferior)
|
event->xfocus.detail == NotifyInferior)
|
||||||
{
|
{
|
||||||
@ -2352,6 +2380,12 @@ event_callback (XEvent *event,
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
case KeymapNotify:
|
case KeymapNotify:
|
||||||
break;
|
break;
|
||||||
case Expose:
|
case Expose:
|
||||||
@ -2838,6 +2872,7 @@ event_callback (XEvent *event,
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (display->compositor && !bypass_compositor)
|
if (display->compositor && !bypass_compositor)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user