MetaPlugin

MetaPlugin — Entry point for plugins

Synopsis

struct              MetaPlugin;
struct              MetaPluginClass;
struct              MetaPluginInfo;
gboolean            meta_plugin_running                 (MetaPlugin *plugin);
gboolean            meta_plugin_debug_mode              (MetaPlugin *plugin);
const MetaPluginInfo * meta_plugin_get_info             (MetaPlugin *plugin);
struct              MetaPluginVersion;
#define             META_PLUGIN_DECLARE                 (ObjectName,
                                                         object_name)
void                meta_plugin_switch_workspace_completed
                                                        (MetaPlugin *plugin);
void                meta_plugin_minimize_completed      (MetaPlugin *plugin,
                                                         MetaWindowActor *actor);
void                meta_plugin_maximize_completed      (MetaPlugin *plugin,
                                                         MetaWindowActor *actor);
void                meta_plugin_unmaximize_completed    (MetaPlugin *plugin,
                                                         MetaWindowActor *actor);
void                meta_plugin_tile_completed          (MetaPlugin *plugin,
                                                         MetaWindowActor *actor);
void                meta_plugin_map_completed           (MetaPlugin *plugin,
                                                         MetaWindowActor *actor);
void                meta_plugin_destroy_completed       (MetaPlugin *plugin,
                                                         MetaWindowActor *actor);
enum                MetaModalOptions;
gboolean            meta_plugin_begin_modal             (MetaPlugin *plugin,
                                                         Window grab_window,
                                                         Cursor cursor,
                                                         MetaModalOptions options,
                                                         guint32 timestamp);
void                meta_plugin_end_modal               (MetaPlugin *plugin,
                                                         guint32 timestamp);
MetaScreen *        meta_plugin_get_screen              (MetaPlugin *plugin);
void                meta_plugin_manager_set_plugin_type (GType gtype);

Object Hierarchy

  GObject
   +----MetaPlugin

Properties

  "debug-mode"               gboolean              : Read
  "screen"                   MetaScreen*           : Read / Write

Description

Details

struct MetaPlugin

struct MetaPlugin;

struct MetaPluginClass

struct MetaPluginClass {
  GObjectClass parent_class;

  void (*start)            (MetaPlugin         *plugin);

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

  void (*maximize)         (MetaPlugin         *plugin,
                            MetaWindowActor    *actor,
                            gint                x,
                            gint                y,
                            gint                width,
                            gint                height);

  void (*unmaximize)       (MetaPlugin         *plugin,
                            MetaWindowActor    *actor,
                            gint                x,
                            gint                y,
                            gint                width,
                            gint                height);

  void (*tile)             (MetaPlugin         *plugin,
                            MetaWindowActor    *actor,
                            gint                x,
                            gint                y,
                            gint                width,
                            gint                height);

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

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

  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,
                             guint              snap_queued);

  void (*hide_tile_preview) (MetaPlugin         *plugin);

  void (*show_hud_preview) (MetaPlugin          *plugin,
                            guint               current_proximity_zone,
                            MetaRectangle       *work_area,
                            guint               snap_queued);

  void (*hide_hud_preview) (MetaPlugin         *plugin);

  /*
   * Called if an effects should be killed prematurely; the plugin must
   * call the completed() callback as if the effect terminated naturally.
   */
  void (*kill_window_effects)      (MetaPlugin      *plugin,
                                    MetaWindowActor *actor);

  /* General XEvent filter. This is fired *before* meta itself handles
   * an event. Return TRUE to block any further processing.
   */
  gboolean (*xevent_filter) (MetaPlugin       *plugin,
                             XEvent           *event);

  const MetaPluginInfo * (*plugin_info) (MetaPlugin *plugin);
};

struct MetaPluginInfo

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

meta_plugin_running ()

gboolean            meta_plugin_running                 (MetaPlugin *plugin);

meta_plugin_debug_mode ()

gboolean            meta_plugin_debug_mode              (MetaPlugin *plugin);

meta_plugin_get_info ()

const MetaPluginInfo * meta_plugin_get_info             (MetaPlugin *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;
};

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_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_tile_completed ()

void                meta_plugin_tile_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);

enum MetaModalOptions

typedef enum {
  META_MODAL_POINTER_ALREADY_GRABBED = 1 << 0,
  META_MODAL_KEYBOARD_ALREADY_GRABBED = 1 << 1
} MetaModalOptions;

Options that can be provided when calling meta_plugin_begin_modal().

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.

meta_plugin_begin_modal ()

gboolean            meta_plugin_begin_modal             (MetaPlugin *plugin,
                                                         Window grab_window,
                                                         Cursor cursor,
                                                         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.

plugin :

a MetaPlugin

grab_window :

the X window to grab the keyboard and mouse on

cursor :

the cursor to use for the pointer grab, or None, to use the normal cursor for the grab window and its descendants.

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.

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. Each plugin instance is associated with exactly one screen; if Metacity is managing multiple screens, multiple plugin instances will be created.

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);

Property Details

The "debug-mode" property

  "debug-mode"               gboolean              : Read

Debug Mode.

Default value: FALSE


The "screen" property

  "screen"                   MetaScreen*           : Read / Write

MetaScreen.