Пример #1
0
/**
 * meta_compositor_process_event: (skip)
 * @compositor:
 * @event:
 * @window:
 *
 */
gboolean
meta_compositor_process_event (MetaCompositor *compositor,
                               XEvent         *event,
                               MetaWindow     *window)
{
  if (!meta_is_wayland_compositor () &&
      event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
    {
      /* Core code doesn't handle damage events, so we need to extract the MetaWindow
       * ourselves
       */
      if (window == NULL)
        {
          Window xwin = ((XDamageNotifyEvent *) event)->drawable;
          window = meta_display_lookup_x_window (compositor->display, xwin);
        }

      if (window)
        process_damage (compositor, (XDamageNotifyEvent *) event, window);
    }

  if (compositor->have_x11_sync_object)
    meta_sync_ring_handle_event (event);

  /* Clutter needs to know about MapNotify events otherwise it will
     think the stage is invisible */
  if (!meta_is_wayland_compositor () && event->type == MapNotify)
    clutter_x11_handle_event (event);

  /* The above handling is basically just "observing" the events, so we return
   * FALSE to indicate that the event should not be filtered out; if we have
   * GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for example.
   */
  return FALSE;
}
Пример #2
0
/**
 * meta_compositor_process_event: (skip)
 *
 */
gboolean
meta_compositor_process_event (MetaCompositor *compositor,
                               XEvent         *event,
                               MetaWindow     *window)
{
    if (compositor->modal_plugin && is_grabbed_event (event))
    {
        MetaPluginClass *klass = META_PLUGIN_GET_CLASS (compositor->modal_plugin);

        if (klass->xevent_filter)
            klass->xevent_filter (compositor->modal_plugin, event);

        /* We always consume events even if the plugin says it didn't handle them;
         * exclusive is exclusive */
        return TRUE;
    }

    if (window)
    {
        MetaCompScreen *info;
        MetaScreen     *screen;

        screen = meta_window_get_screen (window);
        info = meta_screen_get_compositor_data (screen);

        if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
        {
            DEBUG_TRACE ("meta_compositor_process_event (filtered,window==NULL)\n");
            return TRUE;
        }
    }
    else
    {
        GSList *l;

        l = meta_display_get_screens (compositor->display);

        while (l)
        {
            MetaScreen     *screen = l->data;
            MetaCompScreen *info;

            info = meta_screen_get_compositor_data (screen);

            if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
            {
                DEBUG_TRACE ("meta_compositor_process_event (filtered,window==NULL)\n");
                return TRUE;
            }

            l = l->next;
        }
    }

    switch (event->type)
    {
    case PropertyNotify:
        process_property_notify (compositor, (XPropertyEvent *) event, window);
        break;

    default:
        if (event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
        {
            /* Core code doesn't handle damage events, so we need to extract the MetaWindow
             * ourselves
             */
            if (window == NULL)
            {
                Window xwin = ((XDamageNotifyEvent *) event)->drawable;
                window = meta_display_lookup_x_window (compositor->display, xwin);
            }

            DEBUG_TRACE ("meta_compositor_process_event (process_damage)\n");
            process_damage (compositor, (XDamageNotifyEvent *) event, window);
        }
        break;
    }

    /* Clutter needs to know about MapNotify events otherwise it will
       think the stage is invisible */
    if (event->type == MapNotify)
        clutter_x11_handle_event (event);

    /* The above handling is basically just "observing" the events, so we return
     * FALSE to indicate that the event should not be filtered out; if we have
     * GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for example.
     */
    return FALSE;
}