2008-09-18 11:09:11 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2008 Intel Corp.
|
|
|
|
*
|
|
|
|
* Author: Tomas Frydrych <tf@linux.intel.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
#ifndef META_PLUGIN_H_
|
|
|
|
#define META_PLUGIN_H_
|
2008-09-18 11:09:11 -04:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
#include "compositor.h"
|
2008-10-16 07:50:01 -04:00
|
|
|
#include "compositor-mutter.h"
|
2008-09-18 11:09:11 -04:00
|
|
|
|
|
|
|
#include <clutter/clutter.h>
|
2008-10-29 09:03:03 -04:00
|
|
|
#include <X11/extensions/Xfixes.h>
|
2008-11-20 06:51:56 -05:00
|
|
|
#include <gmodule.h>
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
#define META_TYPE_PLUGIN (meta_plugin_get_type ())
|
|
|
|
#define META_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_PLUGIN, MetaPlugin))
|
|
|
|
#define META_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_PLUGIN, MetaPluginClass))
|
|
|
|
#define META_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_PLUGIN))
|
|
|
|
#define META_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_PLUGIN))
|
|
|
|
#define META_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_PLUGIN, MetaPluginClass))
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* MetaPlugin: (skip)
|
2010-09-01 15:39:53 -04:00
|
|
|
*
|
|
|
|
*/
|
2010-10-18 13:27:14 -04:00
|
|
|
typedef struct _MetaPlugin MetaPlugin;
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* MetaPluginClass: (skip)
|
2010-09-01 15:39:53 -04:00
|
|
|
*
|
|
|
|
*/
|
2010-10-18 13:27:14 -04:00
|
|
|
typedef struct _MetaPluginClass MetaPluginClass;
|
|
|
|
typedef struct _MetaPluginVersion MetaPluginVersion;
|
|
|
|
typedef struct _MetaPluginInfo MetaPluginInfo;
|
|
|
|
typedef struct _MetaPluginPrivate MetaPluginPrivate;
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
struct _MetaPlugin
|
2008-12-17 04:33:56 -05:00
|
|
|
{
|
|
|
|
GObject parent;
|
2008-10-16 18:02:34 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaPluginPrivate *priv;
|
2008-12-17 04:33:56 -05:00
|
|
|
};
|
2008-10-13 07:23:47 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
struct _MetaPluginClass
|
2008-12-17 04:33:56 -05:00
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*start) (MetaPlugin *plugin);
|
2010-04-12 17:34:49 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*minimize) (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*maximize) (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor,
|
2008-09-18 11:09:11 -04:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*unmaximize) (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor,
|
2008-09-18 11:09:11 -04:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*map) (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*destroy) (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*switch_workspace) (MetaPlugin *plugin,
|
2008-09-18 11:09:11 -04:00
|
|
|
gint from,
|
2008-10-09 12:57:12 -04:00
|
|
|
gint to,
|
|
|
|
MetaMotionDirection direction);
|
2008-09-18 11:09:11 -04:00
|
|
|
|
|
|
|
/*
|
2010-06-16 17:15:56 -04:00
|
|
|
* Called if an effects should be killed prematurely; the plugin must
|
2008-09-18 11:09:11 -04:00
|
|
|
* call the completed() callback as if the effect terminated naturally.
|
|
|
|
*/
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*kill_window_effects) (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2010-06-16 17:15:56 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
void (*kill_switch_workspace) (MetaPlugin *plugin);
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
/* General XEvent filter. This is fired *before* meta itself handles
|
2008-10-07 11:29:03 -04:00
|
|
|
* an event. Return TRUE to block any further processing.
|
2008-10-13 07:23:47 -04:00
|
|
|
*/
|
2010-10-18 13:27:14 -04:00
|
|
|
gboolean (*xevent_filter) (MetaPlugin *plugin,
|
|
|
|
XEvent *event);
|
2008-12-17 04:33:56 -05:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
const MetaPluginInfo * (*plugin_info) (MetaPlugin *plugin);
|
2008-12-17 04:33:56 -05:00
|
|
|
};
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
struct _MetaPluginInfo
|
2008-12-17 04:33:56 -05:00
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
const gchar *version;
|
|
|
|
const gchar *author;
|
|
|
|
const gchar *license;
|
|
|
|
const gchar *description;
|
|
|
|
};
|
2008-10-02 07:16:15 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
GType meta_plugin_get_type (void);
|
2008-10-16 18:02:34 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
gulong meta_plugin_features (MetaPlugin *plugin);
|
|
|
|
gboolean meta_plugin_disabled (MetaPlugin *plugin);
|
|
|
|
gboolean meta_plugin_running (MetaPlugin *plugin);
|
|
|
|
gboolean meta_plugin_debug_mode (MetaPlugin *plugin);
|
2008-12-17 04:33:56 -05:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin);
|
|
|
|
|
|
|
|
struct _MetaPluginVersion
|
2008-12-17 04:33:56 -05:00
|
|
|
{
|
|
|
|
/*
|
2010-10-18 13:27:14 -04:00
|
|
|
* Version information; the first three numbers match the Meta version
|
2008-12-17 04:33:56 -05:00
|
|
|
* with which the plugin was compiled (see clutter-plugins/simple.c for sample
|
|
|
|
* code).
|
|
|
|
*/
|
|
|
|
guint version_major;
|
|
|
|
guint version_minor;
|
|
|
|
guint version_micro;
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2008-12-17 04:33:56 -05:00
|
|
|
/*
|
|
|
|
* 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;
|
2008-09-18 11:09:11 -04:00
|
|
|
};
|
|
|
|
|
2008-12-17 04:33:56 -05:00
|
|
|
/*
|
|
|
|
* Convenience macro to set up the plugin type. Based on GEdit.
|
|
|
|
*/
|
2010-10-18 13:27:14 -04:00
|
|
|
#define META_PLUGIN_DECLARE(ObjectName, object_name) \
|
|
|
|
G_MODULE_EXPORT MetaPluginVersion meta_plugin_version = \
|
2008-12-17 04:33:56 -05:00
|
|
|
{ \
|
2010-10-18 13:27:14 -04:00
|
|
|
MUTTER_MAJOR_VERSION, \
|
|
|
|
MUTTER_MINOR_VERSION, \
|
|
|
|
MUTTER_MICRO_VERSION, \
|
|
|
|
MUTTER_PLUGIN_API_VERSION \
|
2008-12-17 04:33:56 -05:00
|
|
|
}; \
|
|
|
|
\
|
|
|
|
static GType g_define_type_id = 0; \
|
|
|
|
\
|
|
|
|
/* Prototypes */ \
|
|
|
|
G_MODULE_EXPORT \
|
|
|
|
GType object_name##_get_type (void); \
|
|
|
|
\
|
|
|
|
G_MODULE_EXPORT \
|
|
|
|
GType object_name##_register_type (GTypeModule *type_module); \
|
|
|
|
\
|
|
|
|
G_MODULE_EXPORT \
|
2010-10-18 13:27:14 -04:00
|
|
|
GType meta_plugin_register_type (GTypeModule *type_module); \
|
2008-12-17 04:33:56 -05:00
|
|
|
\
|
|
|
|
GType \
|
|
|
|
object_name##_get_type () \
|
|
|
|
{ \
|
|
|
|
return g_define_type_id; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static void object_name##_init (ObjectName *self); \
|
|
|
|
static void object_name##_class_init (ObjectName##Class *klass); \
|
|
|
|
static gpointer object_name##_parent_class = NULL; \
|
|
|
|
static void object_name##_class_intern_init (gpointer klass) \
|
|
|
|
{ \
|
|
|
|
object_name##_parent_class = g_type_class_peek_parent (klass); \
|
|
|
|
object_name##_class_init ((ObjectName##Class *) klass); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
GType \
|
|
|
|
object_name##_register_type (GTypeModule *type_module) \
|
|
|
|
{ \
|
|
|
|
static const GTypeInfo our_info = \
|
|
|
|
{ \
|
|
|
|
sizeof (ObjectName##Class), \
|
|
|
|
NULL, /* base_init */ \
|
|
|
|
NULL, /* base_finalize */ \
|
|
|
|
(GClassInitFunc) object_name##_class_intern_init, \
|
|
|
|
NULL, \
|
|
|
|
NULL, /* class_data */ \
|
|
|
|
sizeof (ObjectName), \
|
|
|
|
0, /* n_preallocs */ \
|
|
|
|
(GInstanceInitFunc) object_name##_init \
|
|
|
|
}; \
|
|
|
|
\
|
|
|
|
g_define_type_id = g_type_module_register_type (type_module, \
|
2010-10-18 13:27:14 -04:00
|
|
|
META_TYPE_PLUGIN, \
|
2008-12-17 04:33:56 -05:00
|
|
|
#ObjectName, \
|
|
|
|
&our_info, \
|
|
|
|
0); \
|
|
|
|
\
|
|
|
|
\
|
|
|
|
return g_define_type_id; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
G_MODULE_EXPORT GType \
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_register_type (GTypeModule *type_module) \
|
2008-12-17 04:33:56 -05:00
|
|
|
{ \
|
|
|
|
return object_name##_register_type (type_module); \
|
|
|
|
} \
|
2008-10-27 06:34:32 -04:00
|
|
|
|
2011-03-05 16:16:26 -05:00
|
|
|
void
|
|
|
|
meta_plugin_type_register (GType plugin_type);
|
|
|
|
|
2008-10-08 11:01:04 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_switch_workspace_completed (MetaPlugin *plugin);
|
2010-06-16 17:15:56 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_minimize_completed (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2010-06-16 17:15:56 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_maximize_completed (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2010-06-16 17:15:56 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_unmaximize_completed (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2010-06-16 17:15:56 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_map_completed (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2010-06-16 17:15:56 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_destroy_completed (MetaPlugin *plugin,
|
|
|
|
MetaWindowActor *actor);
|
2008-10-16 18:02:34 -04:00
|
|
|
|
|
|
|
ClutterActor *
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_get_overlay_group (MetaPlugin *plugin);
|
2008-10-16 18:02:34 -04:00
|
|
|
|
2008-10-28 07:30:29 -04:00
|
|
|
ClutterActor *
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_get_window_group (MetaPlugin *plugin);
|
2008-10-28 07:30:29 -04:00
|
|
|
|
2010-11-14 12:37:17 -05:00
|
|
|
ClutterActor *
|
|
|
|
meta_plugin_get_background_actor (MetaPlugin *plugin);
|
|
|
|
|
2008-10-16 18:02:34 -04:00
|
|
|
ClutterActor *
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_get_stage (MetaPlugin *plugin);
|
2008-10-16 18:02:34 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_query_screen_size (MetaPlugin *plugin,
|
|
|
|
int *width,
|
|
|
|
int *height);
|
2008-10-08 11:01:04 -04:00
|
|
|
|
2008-10-16 18:02:34 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_set_stage_reactive (MetaPlugin *plugin,
|
|
|
|
gboolean reactive);
|
2008-10-13 07:23:47 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_set_stage_input_area (MetaPlugin *plugin,
|
|
|
|
gint x, gint y, gint width, gint height);
|
2008-10-13 07:23:47 -04:00
|
|
|
|
2008-10-29 09:03:03 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_set_stage_input_region (MetaPlugin *plugin,
|
|
|
|
XserverRegion region);
|
2008-10-29 09:03:03 -04:00
|
|
|
|
2009-08-12 00:12:52 -04:00
|
|
|
/**
|
|
|
|
* MetaModalOptions:
|
|
|
|
* @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.
|
|
|
|
*
|
2010-10-18 13:27:14 -04:00
|
|
|
* Options that can be provided when calling meta_plugin_begin_modal().
|
2009-08-12 00:12:52 -04:00
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
META_MODAL_POINTER_ALREADY_GRABBED = 1 << 0,
|
|
|
|
META_MODAL_KEYBOARD_ALREADY_GRABBED = 1 << 1
|
|
|
|
} MetaModalOptions;
|
|
|
|
|
|
|
|
gboolean
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_begin_modal (MetaPlugin *plugin,
|
|
|
|
Window grab_window,
|
|
|
|
Cursor cursor,
|
|
|
|
MetaModalOptions options,
|
|
|
|
guint32 timestamp);
|
2009-08-12 00:12:52 -04:00
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_plugin_end_modal (MetaPlugin *plugin,
|
|
|
|
guint32 timestamp);
|
2008-10-29 09:27:35 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
GList * meta_plugin_get_window_actors (MetaPlugin *plugin);
|
|
|
|
Display * meta_plugin_get_xdisplay (MetaPlugin *plugin);
|
|
|
|
MetaScreen *meta_plugin_get_screen (MetaPlugin *plugin);
|
2008-11-03 05:07:12 -05:00
|
|
|
|
2008-12-22 16:53:10 -05:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
_meta_plugin_effect_started (MetaPlugin *plugin);
|
2008-12-22 16:53:10 -05:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
#endif /* META_PLUGIN_H_ */
|