2007-05-31 Matthew Allum <mallum@openedhand.com>
* clutter/glx/clutter-backend-glx.c: * clutter/glx/clutter-backend-glx.h: * clutter/glx/clutter-event-glx.c: * clutter/glx/clutter-glx.h: * clutter/glx/clutter-stage-glx.c: * clutter/glx/clutter-stage-glx.h: Change type nameing from Glx -> GLX. Add basic event filtering functionality
This commit is contained in:
parent
7ada1c0ae0
commit
a0c1a9b66d
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2007-05-31 Matthew Allum <mallum@openedhand.com>
|
||||||
|
|
||||||
|
|
||||||
|
* clutter/glx/clutter-backend-glx.c:
|
||||||
|
* clutter/glx/clutter-backend-glx.h:
|
||||||
|
* clutter/glx/clutter-event-glx.c:
|
||||||
|
* clutter/glx/clutter-glx.h:
|
||||||
|
* clutter/glx/clutter-stage-glx.c:
|
||||||
|
* clutter/glx/clutter-stage-glx.h:
|
||||||
|
Change type nameing from Glx -> GLX.
|
||||||
|
Add basic event filtering functionality
|
||||||
|
|
||||||
2007-05-31 Tomas Frydrych <tf@openedhand.com>
|
2007-05-31 Tomas Frydrych <tf@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-behaviour-ellipse.c:
|
* clutter/clutter-behaviour-ellipse.c:
|
||||||
|
@ -50,12 +50,12 @@
|
|||||||
|
|
||||||
#include "cogl.h"
|
#include "cogl.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterBackendGlx, clutter_backend_glx, CLUTTER_TYPE_BACKEND);
|
G_DEFINE_TYPE (ClutterBackendGLX, clutter_backend_glx, CLUTTER_TYPE_BACKEND);
|
||||||
|
|
||||||
typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName);
|
typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName);
|
||||||
|
|
||||||
/* singleton object */
|
/* singleton object */
|
||||||
static ClutterBackendGlx *backend_singleton = NULL;
|
static ClutterBackendGLX *backend_singleton = NULL;
|
||||||
|
|
||||||
/* options */
|
/* options */
|
||||||
static gchar *clutter_display_name = NULL;
|
static gchar *clutter_display_name = NULL;
|
||||||
@ -145,7 +145,7 @@ static gboolean
|
|||||||
clutter_backend_glx_post_parse (ClutterBackend *backend,
|
clutter_backend_glx_post_parse (ClutterBackend *backend,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
|
|
||||||
if (clutter_display_name)
|
if (clutter_display_name)
|
||||||
{
|
{
|
||||||
@ -221,11 +221,11 @@ static gboolean
|
|||||||
clutter_backend_glx_init_stage (ClutterBackend *backend,
|
clutter_backend_glx_init_stage (ClutterBackend *backend,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
|
|
||||||
if (!backend_glx->stage)
|
if (!backend_glx->stage)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx;
|
ClutterStageGLX *stage_glx;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
|
|
||||||
stage = g_object_new (CLUTTER_TYPE_STAGE_GLX, NULL);
|
stage = g_object_new (CLUTTER_TYPE_STAGE_GLX, NULL);
|
||||||
@ -270,7 +270,7 @@ clutter_backend_glx_init_events (ClutterBackend *backend)
|
|||||||
static ClutterActor*
|
static ClutterActor*
|
||||||
clutter_backend_glx_get_stage (ClutterBackend *backend)
|
clutter_backend_glx_get_stage (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
|
|
||||||
return backend_glx->stage;
|
return backend_glx->stage;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ clutter_backend_glx_add_options (ClutterBackend *backend,
|
|||||||
static void
|
static void
|
||||||
clutter_backend_glx_finalize (GObject *gobject)
|
clutter_backend_glx_finalize (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (gobject);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (gobject);
|
||||||
|
|
||||||
g_free (backend_glx->display_name);
|
g_free (backend_glx->display_name);
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ clutter_backend_glx_finalize (GObject *gobject)
|
|||||||
static void
|
static void
|
||||||
clutter_backend_glx_dispose (GObject *gobject)
|
clutter_backend_glx_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (gobject);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (gobject);
|
||||||
|
|
||||||
_clutter_backend_glx_events_uninit (CLUTTER_BACKEND(backend_glx));
|
_clutter_backend_glx_events_uninit (CLUTTER_BACKEND(backend_glx));
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ get_proc_address (const gchar* name)
|
|||||||
static ClutterFeatureFlags
|
static ClutterFeatureFlags
|
||||||
clutter_backend_glx_get_features (ClutterBackend *backend)
|
clutter_backend_glx_get_features (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
const gchar *glx_extensions = NULL;
|
const gchar *glx_extensions = NULL;
|
||||||
ClutterFeatureFlags flags = 0;
|
ClutterFeatureFlags flags = 0;
|
||||||
|
|
||||||
@ -471,8 +471,8 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
|
|||||||
static void
|
static void
|
||||||
clutter_backend_glx_redraw (ClutterBackend *backend)
|
clutter_backend_glx_redraw (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
ClutterStageGlx *stage_glx;
|
ClutterStageGLX *stage_glx;
|
||||||
|
|
||||||
stage_glx = CLUTTER_STAGE_GLX(backend_glx->stage);
|
stage_glx = CLUTTER_STAGE_GLX(backend_glx->stage);
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ clutter_backend_glx_redraw (ClutterBackend *backend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_glx_class_init (ClutterBackendGlxClass *klass)
|
clutter_backend_glx_class_init (ClutterBackendGLXClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||||
@ -516,7 +516,7 @@ clutter_backend_glx_class_init (ClutterBackendGlxClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_glx_init (ClutterBackendGlx *backend_glx)
|
clutter_backend_glx_init (ClutterBackendGLX *backend_glx)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = CLUTTER_BACKEND (backend_glx);
|
ClutterBackend *backend = CLUTTER_BACKEND (backend_glx);
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ error_handler(Display *xdpy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_backend_glx_wait_for_vblank (ClutterBackendGlx *backend_glx)
|
clutter_backend_glx_wait_for_vblank (ClutterBackendGLX *backend_glx)
|
||||||
{
|
{
|
||||||
switch (backend_glx->vblank_type)
|
switch (backend_glx->vblank_type)
|
||||||
{
|
{
|
||||||
@ -665,3 +665,73 @@ clutter_glx_get_root_window (void)
|
|||||||
|
|
||||||
return backend_singleton->xwin_root;
|
return backend_singleton->xwin_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_glx_add_filter:
|
||||||
|
*
|
||||||
|
* FIXME
|
||||||
|
*
|
||||||
|
* Return value: FIXME
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_glx_add_filter (ClutterGLXFilterFunc func, gpointer data)
|
||||||
|
{
|
||||||
|
ClutterGLXEventFilter *filter;
|
||||||
|
|
||||||
|
g_return_if_fail (func != NULL);
|
||||||
|
|
||||||
|
if (!backend_singleton)
|
||||||
|
{
|
||||||
|
g_critical ("GLX backend has not been initialised");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filter = g_new0(ClutterGLXEventFilter, 1);
|
||||||
|
filter->func = func;
|
||||||
|
filter->data = data;
|
||||||
|
|
||||||
|
backend_singleton->event_filters
|
||||||
|
= g_slist_append (backend_singleton->event_filters, filter);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_glx_remove_filter:
|
||||||
|
*
|
||||||
|
* FIXME
|
||||||
|
*
|
||||||
|
* Return value: FIXME
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_glx_remove_filter (ClutterGLXFilterFunc func, gpointer data)
|
||||||
|
{
|
||||||
|
GSList *tmp_list, *this;
|
||||||
|
ClutterGLXEventFilter *filter;
|
||||||
|
|
||||||
|
g_return_if_fail (func == NULL);
|
||||||
|
|
||||||
|
tmp_list = backend_singleton->event_filters;
|
||||||
|
|
||||||
|
while (tmp_list)
|
||||||
|
{
|
||||||
|
filter = (ClutterGLXEventFilter *)tmp_list->data;
|
||||||
|
this = tmp_list;
|
||||||
|
tmp_list = tmp_list->next;
|
||||||
|
|
||||||
|
if (filter->func == func && filter->data == data)
|
||||||
|
{
|
||||||
|
backend_singleton->event_filters
|
||||||
|
= g_slist_remove_link (backend_singleton->event_filters, this);
|
||||||
|
|
||||||
|
g_slist_free_1 (this);
|
||||||
|
g_free (filter);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -30,17 +30,19 @@
|
|||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
|
#include "clutter-glx.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_BACKEND_GLX (clutter_backend_glx_get_type ())
|
#define CLUTTER_TYPE_BACKEND_GLX (clutter_backend_glx_get_type ())
|
||||||
#define CLUTTER_BACKEND_GLX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_GLX, ClutterBackendGlx))
|
#define CLUTTER_BACKEND_GLX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_GLX, ClutterBackendGLX))
|
||||||
#define CLUTTER_IS_BACKEND_GLX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_GLX))
|
#define CLUTTER_IS_BACKEND_GLX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_GLX))
|
||||||
#define CLUTTER_BACKEND_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_GLX, ClutterBackendGlxClass))
|
#define CLUTTER_BACKEND_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_GLX, ClutterBackendGLXClass))
|
||||||
#define CLUTTER_IS_BACKEND_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_GLX))
|
#define CLUTTER_IS_BACKEND_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_GLX))
|
||||||
#define CLUTTER_BACKEND_GLX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_GLX, ClutterBackendGlxClass))
|
#define CLUTTER_BACKEND_GLX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_GLX, ClutterBackendGLXClass))
|
||||||
|
|
||||||
typedef struct _ClutterBackendGlx ClutterBackendGlx;
|
typedef struct _ClutterBackendGLX ClutterBackendGLX;
|
||||||
typedef struct _ClutterBackendGlxClass ClutterBackendGlxClass;
|
typedef struct _ClutterBackendGLXClass ClutterBackendGLXClass;
|
||||||
|
|
||||||
typedef enum ClutterGLXVBlankType
|
typedef enum ClutterGLXVBlankType
|
||||||
{
|
{
|
||||||
@ -55,7 +57,14 @@ typedef int (*WaitVideoSyncProc) (int divisor,
|
|||||||
int remainder,
|
int remainder,
|
||||||
unsigned int *count);
|
unsigned int *count);
|
||||||
|
|
||||||
struct _ClutterBackendGlx
|
typedef struct _ClutterGLXEventFilter
|
||||||
|
{
|
||||||
|
ClutterGLXFilterFunc func;
|
||||||
|
gpointer data;
|
||||||
|
|
||||||
|
} ClutterGLXEventFilter;
|
||||||
|
|
||||||
|
struct _ClutterBackendGLX
|
||||||
{
|
{
|
||||||
ClutterBackend parent_instance;
|
ClutterBackend parent_instance;
|
||||||
|
|
||||||
@ -70,6 +79,7 @@ struct _ClutterBackendGlx
|
|||||||
|
|
||||||
/* event source */
|
/* event source */
|
||||||
GSource *event_source;
|
GSource *event_source;
|
||||||
|
GSList *event_filters;
|
||||||
|
|
||||||
/* Vblank stuff */
|
/* Vblank stuff */
|
||||||
GetVideoSyncProc get_video_sync;
|
GetVideoSyncProc get_video_sync;
|
||||||
@ -78,7 +88,7 @@ struct _ClutterBackendGlx
|
|||||||
ClutterGLXVBlankType vblank_type;
|
ClutterGLXVBlankType vblank_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterBackendGlxClass
|
struct _ClutterBackendGLXClass
|
||||||
{
|
{
|
||||||
ClutterBackendClass parent_class;
|
ClutterBackendClass parent_class;
|
||||||
};
|
};
|
||||||
@ -86,7 +96,7 @@ struct _ClutterBackendGlxClass
|
|||||||
void _clutter_backend_glx_events_init (ClutterBackend *backend);
|
void _clutter_backend_glx_events_init (ClutterBackend *backend);
|
||||||
void _clutter_backend_glx_events_uninit (ClutterBackend *backend);
|
void _clutter_backend_glx_events_uninit (ClutterBackend *backend);
|
||||||
|
|
||||||
void clutter_backend_glx_wait_for_vblank (ClutterBackendGlx *backend_glx);
|
void clutter_backend_glx_wait_for_vblank (ClutterBackendGLX *backend_glx);
|
||||||
|
|
||||||
GType clutter_backend_glx_get_type (void) G_GNUC_CONST;
|
GType clutter_backend_glx_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ _clutter_backend_glx_events_init (ClutterBackend *backend)
|
|||||||
{
|
{
|
||||||
GSource *source;
|
GSource *source;
|
||||||
ClutterEventSource *event_source;
|
ClutterEventSource *event_source;
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
int connection_number;
|
int connection_number;
|
||||||
|
|
||||||
connection_number = ConnectionNumber (backend_glx->xdpy);
|
connection_number = ConnectionNumber (backend_glx->xdpy);
|
||||||
@ -197,7 +197,7 @@ _clutter_backend_glx_events_init (ClutterBackend *backend)
|
|||||||
void
|
void
|
||||||
_clutter_backend_glx_events_uninit (ClutterBackend *backend)
|
_clutter_backend_glx_events_uninit (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
|
|
||||||
if (backend_glx->event_source)
|
if (backend_glx->event_source)
|
||||||
{
|
{
|
||||||
@ -250,7 +250,7 @@ translate_key_event (ClutterBackend *backend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_wm_protocols_event (ClutterBackendGlx *backend_glx,
|
handle_wm_protocols_event (ClutterBackendGLX *backend_glx,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
Atom atom = (Atom) xevent->xclient.data.l[0];
|
Atom atom = (Atom) xevent->xclient.data.l[0];
|
||||||
@ -301,7 +301,7 @@ handle_wm_protocols_event (ClutterBackendGlx *backend_glx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_xembed_event (ClutterBackendGlx *backend_glx,
|
handle_xembed_event (ClutterBackendGLX *backend_glx,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
@ -350,7 +350,7 @@ event_translate (ClutterBackend *backend,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx;
|
ClutterBackendGLX *backend_glx;
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
Window xwindow, stage_xwindow;
|
Window xwindow, stage_xwindow;
|
||||||
@ -363,6 +363,32 @@ event_translate (ClutterBackend *backend,
|
|||||||
if (xwindow == None)
|
if (xwindow == None)
|
||||||
xwindow = stage_xwindow;
|
xwindow = stage_xwindow;
|
||||||
|
|
||||||
|
if (backend_glx->event_filters)
|
||||||
|
{
|
||||||
|
GSList *node;
|
||||||
|
ClutterGLXEventFilter *filter;
|
||||||
|
|
||||||
|
node = backend_glx->event_filters;
|
||||||
|
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
filter = (ClutterGLXEventFilter *)node->data;
|
||||||
|
|
||||||
|
switch (filter->func(xevent, event, filter->data))
|
||||||
|
{
|
||||||
|
case CLUTTER_GLX_FILTER_CONTINUE:
|
||||||
|
break;
|
||||||
|
case CLUTTER_GLX_FILTER_TRANSLATE:
|
||||||
|
return TRUE;
|
||||||
|
case CLUTTER_GLX_FILTER_REMOVE:
|
||||||
|
return FALSE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
|
|
||||||
switch (xevent->type)
|
switch (xevent->type)
|
||||||
@ -486,7 +512,7 @@ event_translate (ClutterBackend *backend,
|
|||||||
static void
|
static void
|
||||||
events_queue (ClutterBackend *backend)
|
events_queue (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterBackendGlx *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
Display *xdisplay = backend_glx->xdpy;
|
Display *xdisplay = backend_glx->xdpy;
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
|
@ -33,6 +33,18 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CLUTTER_GLX_FILTER_CONTINUE, /* Event not handled, continue processesing */
|
||||||
|
CLUTTER_GLX_FILTER_TRANSLATE, /* Native event translated into a Clutter
|
||||||
|
event and stored in the "event" structure
|
||||||
|
that was passed in */
|
||||||
|
CLUTTER_GLX_FILTER_REMOVE /* Terminate processing, removing event */
|
||||||
|
} ClutterGLXFilterReturn;
|
||||||
|
|
||||||
|
typedef ClutterGLXFilterReturn (*ClutterGLXFilterFunc) (XEvent *xev,
|
||||||
|
ClutterEvent *cev,
|
||||||
|
gpointer *data);
|
||||||
|
|
||||||
void clutter_glx_trap_x_errors (void);
|
void clutter_glx_trap_x_errors (void);
|
||||||
gint clutter_glx_untrap_x_errors (void);
|
gint clutter_glx_untrap_x_errors (void);
|
||||||
|
|
||||||
|
@ -48,12 +48,12 @@
|
|||||||
|
|
||||||
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h>
|
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h>
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterStageGlx, clutter_stage_glx, CLUTTER_TYPE_STAGE);
|
G_DEFINE_TYPE (ClutterStageGLX, clutter_stage_glx, CLUTTER_TYPE_STAGE);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_glx_show (ClutterActor *actor)
|
clutter_stage_glx_show (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (actor);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor);
|
||||||
|
|
||||||
if (stage_glx->xwin)
|
if (stage_glx->xwin)
|
||||||
XMapWindow (stage_glx->xdpy, stage_glx->xwin);
|
XMapWindow (stage_glx->xdpy, stage_glx->xwin);
|
||||||
@ -62,7 +62,7 @@ clutter_stage_glx_show (ClutterActor *actor)
|
|||||||
static void
|
static void
|
||||||
clutter_stage_glx_hide (ClutterActor *actor)
|
clutter_stage_glx_hide (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (actor);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor);
|
||||||
|
|
||||||
if (stage_glx->xwin)
|
if (stage_glx->xwin)
|
||||||
XUnmapWindow (stage_glx->xdpy, stage_glx->xwin);
|
XUnmapWindow (stage_glx->xdpy, stage_glx->xwin);
|
||||||
@ -71,7 +71,7 @@ clutter_stage_glx_hide (ClutterActor *actor)
|
|||||||
static void
|
static void
|
||||||
clutter_stage_glx_unrealize (ClutterActor *actor)
|
clutter_stage_glx_unrealize (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (actor);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor);
|
||||||
gboolean was_offscreen;
|
gboolean was_offscreen;
|
||||||
|
|
||||||
CLUTTER_MARK();
|
CLUTTER_MARK();
|
||||||
@ -127,7 +127,7 @@ set_wm_protocols (Display *xdisplay,
|
|||||||
static void
|
static void
|
||||||
clutter_stage_glx_realize (ClutterActor *actor)
|
clutter_stage_glx_realize (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (actor);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor);
|
||||||
gboolean is_offscreen;
|
gboolean is_offscreen;
|
||||||
|
|
||||||
CLUTTER_NOTE (MISC, "Realizing main stage");
|
CLUTTER_NOTE (MISC, "Realizing main stage");
|
||||||
@ -309,7 +309,7 @@ static void
|
|||||||
clutter_stage_glx_allocate_coords (ClutterActor *self,
|
clutter_stage_glx_allocate_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (self);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (self);
|
||||||
|
|
||||||
box->x1 = box->y1 = 0;
|
box->x1 = box->y1 = 0;
|
||||||
box->x2 = box->x1 + CLUTTER_UNITS_FROM_INT (stage_glx->xwin_width);
|
box->x2 = box->x1 + CLUTTER_UNITS_FROM_INT (stage_glx->xwin_width);
|
||||||
@ -320,7 +320,7 @@ static void
|
|||||||
clutter_stage_glx_request_coords (ClutterActor *self,
|
clutter_stage_glx_request_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (self);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (self);
|
||||||
gint new_width, new_height;
|
gint new_width, new_height;
|
||||||
|
|
||||||
new_width = ABS (CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
|
new_width = ABS (CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
|
||||||
@ -359,7 +359,7 @@ static void
|
|||||||
clutter_stage_glx_set_fullscreen (ClutterStage *stage,
|
clutter_stage_glx_set_fullscreen (ClutterStage *stage,
|
||||||
gboolean fullscreen)
|
gboolean fullscreen)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (stage);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage);
|
||||||
Atom atom_WM_STATE, atom_WM_STATE_FULLSCREEN;
|
Atom atom_WM_STATE, atom_WM_STATE_FULLSCREEN;
|
||||||
|
|
||||||
atom_WM_STATE = XInternAtom (stage_glx->xdpy, "_NET_WM_STATE", False);
|
atom_WM_STATE = XInternAtom (stage_glx->xdpy, "_NET_WM_STATE", False);
|
||||||
@ -396,7 +396,7 @@ static void
|
|||||||
clutter_stage_glx_set_cursor_visible (ClutterStage *stage,
|
clutter_stage_glx_set_cursor_visible (ClutterStage *stage,
|
||||||
gboolean show_cursor)
|
gboolean show_cursor)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (stage);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage);
|
||||||
|
|
||||||
if (stage_glx->xwin == None)
|
if (stage_glx->xwin == None)
|
||||||
return;
|
return;
|
||||||
@ -459,7 +459,7 @@ clutter_stage_glx_draw_to_pixbuf (ClutterStage *stage,
|
|||||||
guchar *data;
|
guchar *data;
|
||||||
GdkPixbuf *pixb;
|
GdkPixbuf *pixb;
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
ClutterStageGlx *stage_glx;
|
ClutterStageGLX *stage_glx;
|
||||||
gboolean is_offscreen = FALSE;
|
gboolean is_offscreen = FALSE;
|
||||||
|
|
||||||
stage_glx = CLUTTER_STAGE_GLX (stage);
|
stage_glx = CLUTTER_STAGE_GLX (stage);
|
||||||
@ -513,7 +513,7 @@ clutter_stage_glx_draw_to_pixbuf (ClutterStage *stage,
|
|||||||
static void
|
static void
|
||||||
clutter_stage_glx_dispose (GObject *gobject)
|
clutter_stage_glx_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (gobject);
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (gobject);
|
||||||
|
|
||||||
if (stage_glx->xwin)
|
if (stage_glx->xwin)
|
||||||
clutter_actor_unrealize (CLUTTER_ACTOR (stage_glx));
|
clutter_actor_unrealize (CLUTTER_ACTOR (stage_glx));
|
||||||
@ -522,7 +522,7 @@ clutter_stage_glx_dispose (GObject *gobject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_glx_class_init (ClutterStageGlxClass *klass)
|
clutter_stage_glx_class_init (ClutterStageGLXClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||||
@ -544,7 +544,7 @@ clutter_stage_glx_class_init (ClutterStageGlxClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_glx_init (ClutterStageGlx *stage)
|
clutter_stage_glx_init (ClutterStageGLX *stage)
|
||||||
{
|
{
|
||||||
stage->xdpy = NULL;
|
stage->xdpy = NULL;
|
||||||
stage->xwin_root = None;
|
stage->xwin_root = None;
|
||||||
@ -611,7 +611,7 @@ gboolean
|
|||||||
clutter_glx_set_stage_foreign (ClutterStage *stage,
|
clutter_glx_set_stage_foreign (ClutterStage *stage,
|
||||||
Window xwindow)
|
Window xwindow)
|
||||||
{
|
{
|
||||||
ClutterStageGlx *stage_glx;
|
ClutterStageGLX *stage_glx;
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
guint width, height, border, depth;
|
guint width, height, border, depth;
|
||||||
|
@ -34,16 +34,16 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_STAGE_GLX (clutter_stage_glx_get_type ())
|
#define CLUTTER_TYPE_STAGE_GLX (clutter_stage_glx_get_type ())
|
||||||
#define CLUTTER_STAGE_GLX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_GLX, ClutterStageGlx))
|
#define CLUTTER_STAGE_GLX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_GLX, ClutterStageGLX))
|
||||||
#define CLUTTER_IS_STAGE_GLX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_GLX))
|
#define CLUTTER_IS_STAGE_GLX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_GLX))
|
||||||
#define CLUTTER_STAGE_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_GLX, ClutterStageGlxClass))
|
#define CLUTTER_STAGE_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_GLX, ClutterStageGLXClass))
|
||||||
#define CLUTTER_IS_STAGE_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_GLX))
|
#define CLUTTER_IS_STAGE_GLX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_GLX))
|
||||||
#define CLUTTER_STAGE_GLX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_GLX, ClutterStageGlxClass))
|
#define CLUTTER_STAGE_GLX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_GLX, ClutterStageGLXClass))
|
||||||
|
|
||||||
typedef struct _ClutterStageGlx ClutterStageGlx;
|
typedef struct _ClutterStageGLX ClutterStageGLX;
|
||||||
typedef struct _ClutterStageGlxClass ClutterStageGlxClass;
|
typedef struct _ClutterStageGLXClass ClutterStageGLXClass;
|
||||||
|
|
||||||
struct _ClutterStageGlx
|
struct _ClutterStageGLX
|
||||||
{
|
{
|
||||||
ClutterStage parent_instance;
|
ClutterStage parent_instance;
|
||||||
|
|
||||||
@ -63,11 +63,11 @@ struct _ClutterStageGlx
|
|||||||
|
|
||||||
guint is_foreign_xwin : 1;
|
guint is_foreign_xwin : 1;
|
||||||
|
|
||||||
ClutterBackendGlx *backend;
|
ClutterBackendGLX *backend;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterStageGlxClass
|
struct _ClutterStageGLXClass
|
||||||
{
|
{
|
||||||
ClutterStageClass parent_class;
|
ClutterStageClass parent_class;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user