Mutter Reference Manual: MetaPlugin

## MetaPlugin MetaPlugin — Entry point for plugins |

## Functions

const MetaPluginInfo * | meta_plugin_get_info ()
#define | META_PLUGIN_DECLARE()
void | meta_plugin_switch_workspace_completed ()
void | meta_plugin_minimize_completed ()
void | meta_plugin_unminimize_completed ()
void | meta_plugin_maximize_completed ()
void | meta_plugin_unmaximize_completed ()
void | meta_plugin_map_completed ()
void | meta_plugin_destroy_completed ()
gboolean | meta_plugin_begin_modal ()
void | meta_plugin_end_modal ()
MetaScreen * | meta_plugin_get_screen ()
void | meta_plugin_manager_set_plugin_type ()

## Types and Values

struct | MetaPlugin
struct | MetaPluginClass
struct | MetaPluginInfo
struct | MetaPluginVersion
enum | MetaModalOptions

## Object Hierarchy

        GObject
        ╰── MetaPlugin

## Description

## Functions

### meta_plugin_get_info ()

    const MetaPluginInfo *
    meta_plugin_get_info (MetaPlugin *plugin);

### META_PLUGIN_DECLARE()

    #define             META_PLUGIN_DECLARE(ObjectName, object_name)

### meta_plugin_switch_workspace_completed ()

    void
    meta_plugin_switch_workspace_completed
                                   (MetaPlugin *plugin);

### meta_plugin_minimize_completed ()

    void
    meta_plugin_minimize_completed (MetaPlugin *plugin,
                                    MetaWindowActor *actor);

### meta_plugin_unminimize_completed ()

    void
    meta_plugin_unminimize_completed (MetaPlugin *plugin,
                                      MetaWindowActor *actor);

### meta_plugin_maximize_completed ()

    void
    meta_plugin_maximize_completed (MetaPlugin *plugin,
                                    MetaWindowActor *actor);

### meta_plugin_unmaximize_completed ()

    void
    meta_plugin_unmaximize_completed (MetaPlugin *plugin,
                                      MetaWindowActor *actor);

### meta_plugin_map_completed ()

    void
    meta_plugin_map_completed (MetaPlugin *plugin,
                               MetaWindowActor *actor);

### meta_plugin_destroy_completed ()

    void
    meta_plugin_destroy_completed (MetaPlugin *plugin,
                                   MetaWindowActor *actor);

### meta_plugin_begin_modal ()

    gboolean
    meta_plugin_begin_modal (MetaPlugin *plugin,
                             MetaModalOptions options,
                             guint32 timestamp);

This function is used to grab the keyboard and mouse for the exclusive use of the plugin. Correct operation requires that both the keyboard and mouse are grabbed, or thing will break. (In particular, other passive X grabs in Meta can trigger but not be handled by the normal keybinding handling code.) However, the plugin can establish the keyboard and/or mouse grabs ahead of time and pass in the `META_MODAL_POINTER_ALREADY_GRABBED` and/or `META_MODAL_KEYBOARD_ALREADY_GRABBED` options. This facility is provided for two reasons: first to allow using this function to establish modality after a passive grab, and second to allow using obscure features of `XGrabPointer()` and `XGrabKeyboard()` without having to add them to this API.

#### Parameters

plugin | a MetaPlugin |
options | flags that modify the behavior of the modal grab |
timestamp | the timestamp used for establishing grabs |

#### Returns

whether we successfully grabbed the keyboard and mouse and made the plugin modal.

### meta_plugin_end_modal ()

    void
    meta_plugin_end_modal (MetaPlugin *plugin,
                           guint32 timestamp);

Ends the modal operation begun with `meta_plugin_begin_modal()`. This ungrabs both the mouse and keyboard even when `META_MODAL_POINTER_ALREADY_GRABBED` or `META_MODAL_KEYBOARD_ALREADY_GRABBED` were provided as options when beginnning the modal operation.

#### Parameters

plugin | a MetaPlugin |
timestamp | the time used for releasing grabs |

### meta_plugin_get_screen ()

    MetaScreen *
    meta_plugin_get_screen (MetaPlugin *plugin);

Gets the MetaScreen corresponding to a plugin.

#### Parameters

plugin | a MetaPlugin |

#### Returns

the MetaScreen for the plugin.

[transfer none]

### meta_plugin_manager_set_plugin_type ()

    void
    meta_plugin_manager_set_plugin_type (GType gtype);

## Types and Values

### struct MetaPlugin

    struct MetaPlugin;

### struct MetaPluginClass

    struct MetaPluginClass {
      /**
       * MetaPluginClass::start:
       *
       * Virtual function called when the compositor starts managing a screen
       */
      void (*start)            (MetaPlugin         *plugin);

      /**
       * MetaPluginClass::minimize:
       * @actor: a #MetaWindowActor
       *
       * Virtual function called when the window represented by @actor is minimized.
       */
      void (*minimize)         (MetaPlugin         *plugin,
                                MetaWindowActor    *actor);

      /**
       * MetaPluginClass::unminimize:
       * @actor: a #MetaWindowActor
       *
       * Virtual function called when the window represented by @actor is unminimized.
       */
      void (*unminimize)       (MetaPlugin         *plugin,
                                MetaWindowActor    *actor);

      /**
       * MetaPluginClass::maximize:
       * @actor: a #MetaWindowActor
       * @x: target X coordinate
       * @y: target Y coordinate
       * @width: target width
       * @height: target height
       *
       * Virtual function called when the window represented by @actor is maximized.
       */
      void (*maximize)         (MetaPlugin         *plugin,
                                MetaWindowActor    *actor,
                                gint                x,
                                gint                y,
                                gint                width,
                                gint                height);

      /**
       * MetaPluginClass::unmaximize:
       * @actor: a #MetaWindowActor
       * @x: target X coordinate
       * @y: target Y coordinate
       * @width: target width
       * @height: target height
       *
       * Virtual function called when the window represented by @actor is unmaximized.
       */
      void (*unmaximize)       (MetaPlugin         *plugin,
                                MetaWindowActor    *actor,
                                gint                x,
                                gint                y,
                                gint                width,
                                gint                height);

      /**
       * MetaPluginClass::map:
       * @actor: a #MetaWindowActor
       *
       * Virtual function called when the window represented by @actor is mapped.
       */
      void (*map)              (MetaPlugin         *plugin,
                                MetaWindowActor    *actor);

      /**
       * MetaPluginClass::destroy:
       * @actor: a #MetaWindowActor
       *
       * Virtual function called when the window represented by @actor is destroyed.
       */
      void (*destroy)          (MetaPlugin         *plugin,
                                MetaWindowActor    *actor);

      /**
       * MetaPluginClass::switch_workspace:
       * @from: origin workspace
       * @to: destination workspace
       * @direction: a #MetaMotionDirection
       *
       * Virtual function called when the window represented by @actor is destroyed.
       */
      void (*switch_workspace) (MetaPlugin         *plugin,
                                gint                from,
                                gint                to,
                                MetaMotionDirection direction);

      void (*show_tile_preview) (MetaPlugin      *plugin,
                                 MetaWindow      *window,
                                 MetaRectangle   *tile_rect,
                                 int              tile_monitor_number);
      void (*hide_tile_preview) (MetaPlugin      *plugin);

      void (*show_window_menu)  (MetaPlugin         *plugin,
                                 MetaWindow         *window,
                                 MetaWindowMenuType  menu,
                                 int                 x,
                                 int                 y);

      void (*show_window_menu_for_rect)  (MetaPlugin         *plugin,
    		                      MetaWindow         *window,
    				      MetaWindowMenuType  menu,
    				      MetaRectangle      *rect);

      /**
       * MetaPluginClass::kill_window_effects:
       * @actor: a #MetaWindowActor
       *
       * Virtual function called when the effects on @actor need to be killed
       * prematurely; the plugin must call the completed() callback as if the effect
       * terminated naturally.
       */
      void (*kill_window_effects)      (MetaPlugin      *plugin,
                                        MetaWindowActor *actor);

      /**
       * MetaPluginClass::kill_switch_workspace:
       *
       * Virtual function called when the workspace-switching effect needs to be
       * killed prematurely.
       */
      void (*kill_switch_workspace)    (MetaPlugin     *plugin);

      /**
       * MetaPluginClass::xevent_filter:
       * @event: (type xlib.XEvent):
       *
       * Virtual function called when handling each event.
       *
       * Returns: %TRUE if the plugin handled the event type (i.e., if the return
       * value is %FALSE, there will be no subsequent call to the manager
       * completed() callback, and the compositor must ensure that any appropriate
       * post-effect cleanup is carried out.
       */
      gboolean (*xevent_filter) (MetaPlugin       *plugin,
                                 XEvent           *event);

      /**
       * MetaPluginClass::keybinding_filter:
       * @binding: a #MetaKeyBinding
       *
       * Virtual function called when handling each keybinding.
       *
       * Returns: %TRUE if the plugin handled the keybinding.
       */
      gboolean (*keybinding_filter) (MetaPlugin     *plugin,
                                     MetaKeyBinding *binding);

      /**
       * MetaPluginClass::confirm_display_config:
       * @plugin: a #MetaPlugin
       *
       * Virtual function called when the display configuration changes.
       * The common way to implement this function is to show some form
       * of modal dialog that should ask the user if everything was ok.
       *
       * When confirmed by the user, the plugin must call meta_plugin_complete_display_change()
       * to make the configuration permanent. If that function is not
       * called within the timeout, the previous configuration will be
       * reapplied.
       */
      void (*confirm_display_change) (MetaPlugin *plugin);

      /**
       * MetaPluginClass::plugin_info:
       * @plugin: a #MetaPlugin
       *
       * Virtual function that returns information about the #MetaPlugin.
       *
       * Returns: a #MetaPluginInfo.
       */
      const MetaPluginInfo * (*plugin_info) (MetaPlugin *plugin);
    };

#### Members

`start` () | virtual function called when the compositor starts managing a screen |
`minimize` () | virtual function called when a window is minimized |
`unminimize` () |  |
`maximize` () | virtual function called when a window is maximized |
`unmaximize` () | virtual function called when a window is unmaximized |
`map` () | virtual function called when a window is mapped |
`destroy` () | virtual function called when a window is destroyed |
`switch_workspace` () | virtual function called when the user switches to another workspace |
`show_tile_preview` () |  |
`hide_tile_preview` () |  |
`show_window_menu` () |  |
`show_window_menu_for_rect` () |  |
`kill_window_effects` () | virtual function called when the effects on a window need to be killed prematurely; the plugin must call the `completed()` callback as if the effect terminated naturally |
`kill_switch_workspace` () | virtual function called when the workspace-switching effect needs to be killed prematurely |
`xevent_filter` () | virtual function called when handling each event |
`keybinding_filter` () | virtual function called when handling each keybinding |
`confirm_display_change` () |  |
`plugin_info` () | virtual function that returns information about the MetaPlugin |

### struct MetaPluginInfo

    struct MetaPluginInfo {
      const gchar *name;
      const gchar *version;
      const gchar *author;
      const gchar *license;
      const gchar *description;
    };

#### Members

const gchar *`name`; | name of the plugin |
const gchar *`version`; | version of the plugin |
const gchar *`author`; | author of the plugin |
const gchar *`license`; | license of the plugin |
const gchar *`description`; | description of the plugin |

### struct MetaPluginVersion

    struct MetaPluginVersion {
      /*
       * Version information; the first three numbers match the Meta version
       * with which the plugin was compiled (see clutter-plugins/simple.c for sample
       * code).
       */
      guint version_major;
      guint version_minor;
      guint version_micro;

      /*
       * Version of the plugin API; this is unrelated to the matacity version
       * per se. The API version is checked by the plugin manager and must match
       * the one used by it (see clutter-plugins/default.c for sample code).
       */
      guint version_api;
    };

#### Members

guint `version_major`; | major component of the version number of Meta with which the plugin was compiled |
guint `version_minor`; | minor component of the version number of Meta with which the plugin was compiled |
guint `version_micro`; | micro component of the version number of Meta with which the plugin was compiled |
guint `version_api`; | version of the plugin API |

### enum MetaModalOptions

Options that can be provided when calling `meta_plugin_begin_modal()`.

#### Members

META_MODAL_POINTER_ALREADY_GRABBED | if set the pointer is already grabbed by the plugin and should not be grabbed again. |
META_MODAL_KEYBOARD_ALREADY_GRABBED | if set the keyboard is already grabbed by the plugin and should not be grabbed again. |