gnome-shell-plugin: Port event filter to XInput2
Otherwise, we'll see issues with tray icons. https://bugzilla.gnome.org/show_bug.cgi?id=690590
This commit is contained in:
parent
5faf7cb59e
commit
9f9518c872
@ -286,18 +286,18 @@ gnome_shell_plugin_kill_switch_workspace (MetaPlugin *plugin)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ignore_crossing_event (MetaPlugin *plugin,
|
ignore_crossing_event (MetaPlugin *plugin,
|
||||||
XEvent *xev)
|
XIEnterEvent *enter_event)
|
||||||
{
|
{
|
||||||
MetaScreen *screen = meta_plugin_get_screen (plugin);
|
MetaScreen *screen = meta_plugin_get_screen (plugin);
|
||||||
ClutterStage *stage = CLUTTER_STAGE (meta_get_stage_for_screen (screen));
|
ClutterStage *stage = CLUTTER_STAGE (meta_get_stage_for_screen (screen));
|
||||||
|
|
||||||
if (xev->xcrossing.window == clutter_x11_get_stage_window (stage))
|
if (enter_event->event == clutter_x11_get_stage_window (stage))
|
||||||
{
|
{
|
||||||
/* If the pointer enters a child of the stage window (eg, a
|
/* If the pointer enters a child of the stage window (eg, a
|
||||||
* trayicon), we want to consider it to still be in the stage,
|
* trayicon), we want to consider it to still be in the stage,
|
||||||
* so don't let Clutter see the event.
|
* so don't let Clutter see the event.
|
||||||
*/
|
*/
|
||||||
if (xev->xcrossing.detail == NotifyInferior)
|
if (enter_event->detail == XINotifyInferior)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* If the pointer is grabbed by a window it is not currently in,
|
/* If the pointer is grabbed by a window it is not currently in,
|
||||||
@ -307,9 +307,9 @@ ignore_crossing_event (MetaPlugin *plugin,
|
|||||||
* out of sync, but that happens fairly often with grabs, and we
|
* out of sync, but that happens fairly often with grabs, and we
|
||||||
* can work around it. (Eg, shell_global_sync_pointer().)
|
* can work around it. (Eg, shell_global_sync_pointer().)
|
||||||
*/
|
*/
|
||||||
if (xev->xcrossing.mode == NotifyGrab &&
|
if (enter_event->mode == XINotifyGrab &&
|
||||||
(xev->xcrossing.detail == NotifyNonlinear ||
|
(enter_event->detail == XINotifyNonlinear ||
|
||||||
xev->xcrossing.detail == NotifyNonlinearVirtual))
|
enter_event->detail == XINotifyNonlinearVirtual))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,6 +320,9 @@ static gboolean
|
|||||||
gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
|
gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
|
||||||
XEvent *xev)
|
XEvent *xev)
|
||||||
{
|
{
|
||||||
|
MetaScreen *screen = meta_plugin_get_screen (plugin);
|
||||||
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
|
|
||||||
GnomeShellPlugin *shell_plugin = GNOME_SHELL_PLUGIN (plugin);
|
GnomeShellPlugin *shell_plugin = GNOME_SHELL_PLUGIN (plugin);
|
||||||
#ifdef GLX_INTEL_swap_event
|
#ifdef GLX_INTEL_swap_event
|
||||||
if (shell_plugin->have_swap_event &&
|
if (shell_plugin->have_swap_event &&
|
||||||
@ -341,9 +344,14 @@ gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
|
|||||||
/* Make sure that Clutter doesn't see certain focus change events,
|
/* Make sure that Clutter doesn't see certain focus change events,
|
||||||
* so that when we're moving into something like a tray icon, we
|
* so that when we're moving into something like a tray icon, we
|
||||||
* don't unfocus the container. */
|
* don't unfocus the container. */
|
||||||
if ((xev->xany.type == EnterNotify || xev->xany.type == LeaveNotify) &&
|
if (xev->type == GenericEvent &&
|
||||||
ignore_crossing_event (plugin, xev))
|
xev->xcookie.extension == meta_display_get_xinput_opcode (display))
|
||||||
return TRUE;
|
{
|
||||||
|
XIEvent *input_event = (XIEvent *) xev->xcookie.data;
|
||||||
|
if ((input_event->evtype == XI_Enter || input_event->evtype == XI_Leave) &&
|
||||||
|
ignore_crossing_event (plugin, (XIEnterEvent *) input_event))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pass the event to shell-global
|
* Pass the event to shell-global
|
||||||
|
Loading…
x
Reference in New Issue
Block a user