128
130
plugin_class->kill_window_effects = gnome_shell_plugin_kill_window_effects;
129
131
plugin_class->kill_switch_workspace = gnome_shell_plugin_kill_switch_workspace;
131
plugin_class->xevent_filter = gnome_shell_plugin_xevent_filter;
132
plugin_class->plugin_info = gnome_shell_plugin_plugin_info;
133
plugin_class->xevent_filter = gnome_shell_plugin_xevent_filter;
134
plugin_class->keybinding_filter = gnome_shell_plugin_keybinding_filter;
135
plugin_class->plugin_info = gnome_shell_plugin_plugin_info;
141
gnome_shell_plugin_start (MetaPlugin *plugin)
144
gnome_shell_plugin_has_swap_event (GnomeShellPlugin *shell_plugin)
143
GnomeShellPlugin *shell_plugin = GNOME_SHELL_PLUGIN (plugin);
146
MetaPlugin *plugin = META_PLUGIN (shell_plugin);
147
CoglDisplay *cogl_display =
148
cogl_context_get_display (shell_plugin->cogl_context);
149
CoglRenderer *renderer = cogl_display_get_renderer (cogl_display);
150
const char * (* query_extensions_string) (Display *dpy, int screen);
151
Bool (* query_extension) (Display *dpy, int *error, int *event);
145
152
MetaScreen *screen;
146
153
MetaDisplay *display;
147
154
Display *xdisplay;
148
155
const char *glx_extensions;
157
/* We will only get swap events if Cogl is using GLX */
158
if (cogl_renderer_get_winsys_id (renderer) != COGL_WINSYS_ID_GLX)
161
screen = meta_plugin_get_screen (plugin);
162
display = meta_screen_get_display (screen);
164
xdisplay = meta_display_get_xdisplay (display);
166
query_extensions_string =
167
(void *) cogl_get_proc_address ("glXQueryExtensionsString");
169
(void *) cogl_get_proc_address ("glXQueryExtension");
171
query_extension (xdisplay,
172
&shell_plugin->glx_error_base,
173
&shell_plugin->glx_event_base);
176
query_extensions_string (xdisplay,
177
meta_screen_get_screen_number (screen));
179
return strstr (glx_extensions, "GLX_INTEL_swap_event") != NULL;
183
gnome_shell_plugin_start (MetaPlugin *plugin)
185
GnomeShellPlugin *shell_plugin = GNOME_SHELL_PLUGIN (plugin);
150
186
GError *error = NULL;
152
188
GjsContext *gjs_context;
155
screen = meta_plugin_get_screen (plugin);
156
display = meta_screen_get_display (screen);
158
xdisplay = meta_display_get_xdisplay (display);
160
glXQueryExtension (xdisplay,
161
&shell_plugin->glx_error_base,
162
&shell_plugin->glx_event_base);
164
glx_extensions = glXQueryExtensionsString (xdisplay,
165
meta_screen_get_screen_number (screen));
166
shell_plugin->have_swap_event = strstr (glx_extensions, "GLX_INTEL_swap_event") != NULL;
168
shell_plugin->have_swap_event = 0;
189
ClutterBackend *backend;
191
backend = clutter_get_default_backend ();
192
shell_plugin->cogl_context = clutter_backend_get_cogl_context (backend);
194
shell_plugin->have_swap_event =
195
gnome_shell_plugin_has_swap_event (shell_plugin);
171
197
shell_perf_log_define_event (shell_perf_log_get_default (),
172
198
"glx.swapComplete",
318
ignore_crossing_event (MetaPlugin *plugin,
319
XIEnterEvent *enter_event)
321
MetaScreen *screen = meta_plugin_get_screen (plugin);
322
ClutterStage *stage = CLUTTER_STAGE (meta_get_stage_for_screen (screen));
324
if (enter_event->event == clutter_x11_get_stage_window (stage))
326
/* If the pointer enters a child of the stage window (eg, a
327
* trayicon), we want to consider it to still be in the stage,
328
* so don't let Clutter see the event.
330
if (enter_event->detail == XINotifyInferior)
333
/* If the pointer is grabbed by a window it is not currently in,
334
* filter that out as well. In particular, if a trayicon grabs
335
* the pointer after a click on its label, we don't want to hide
336
* the message tray. Filtering out this event will leave Clutter
337
* out of sync, but that happens fairly often with grabs, and we
338
* can work around it. (Eg, shell_global_sync_pointer().)
340
if (enter_event->mode == XINotifyGrab &&
341
(enter_event->detail == XINotifyNonlinear ||
342
enter_event->detail == XINotifyNonlinearVirtual))
292
350
gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
295
353
MetaScreen *screen = meta_plugin_get_screen (plugin);
296
ClutterStage *stage = CLUTTER_STAGE (meta_get_stage_for_screen (screen));
354
MetaDisplay *display = meta_screen_get_display (screen);
298
356
GnomeShellPlugin *shell_plugin = GNOME_SHELL_PLUGIN (plugin);
299
357
#ifdef GLX_INTEL_swap_event
316
if ((xev->xany.type == EnterNotify || xev->xany.type == LeaveNotify)
317
&& xev->xcrossing.window == clutter_x11_get_stage_window (stage))
374
/* Make sure that Clutter doesn't see certain focus change events,
375
* so that when we're moving into something like a tray icon, we
376
* don't unfocus the container. */
377
if (xev->type == GenericEvent &&
378
xev->xcookie.extension == meta_display_get_xinput_opcode (display))
319
/* If the pointer enters a child of the stage window (eg, a
320
* trayicon), we want to consider it to still be in the stage,
321
* so don't let Clutter see the event.
323
if (xev->xcrossing.detail == NotifyInferior)
326
/* If the pointer is grabbed by a window it is not currently in,
327
* filter that out as well. In particular, if a trayicon grabs
328
* the pointer after a click on its label, we don't want to hide
329
* the message tray. Filtering out this event will leave Clutter
330
* out of sync, but that happens fairly often with grabs, and we
331
* can work around it. (Eg, shell_global_sync_pointer().)
333
if (xev->xcrossing.mode == NotifyGrab &&
334
(xev->xcrossing.detail == NotifyNonlinear ||
335
xev->xcrossing.detail == NotifyNonlinearVirtual))
380
XIEvent *input_event = (XIEvent *) xev->xcookie.data;
381
if ((input_event->evtype == XI_Enter || input_event->evtype == XI_Leave) &&
382
ignore_crossing_event (plugin, (XIEnterEvent *) input_event))