2008-02-20 Tomas Frydrych <tf@openedhand.com>

* clutter/x11/clutter-x11.h:
	* clutter/x11/clutter-backend-x11.c:
	(clutter_x11_set_display):
	Function to set X display connection prior to calling
	clutter_init(); stripped loads of trailing space.
This commit is contained in:
Tomas Frydrych 2008-02-20 14:16:54 +00:00
parent 0864743fd1
commit 9aba9710c1
4 changed files with 123 additions and 68 deletions

View File

@ -1,4 +1,12 @@
2008-02-20 Emmanuele Bassi <ebassi@openedhand.com>
2008-02-20 Tomas Frydrych <tf@openedhand.com>
* clutter/x11/clutter-x11.h:
* clutter/x11/clutter-backend-x11.c:
(clutter_x11_set_display):
Function to set X display connection prior to calling
clutter_init(); stripped loads of trailing space.
2008-02-20 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-marshal.list:
* clutter/glx/Makefile.am:

View File

@ -103,9 +103,16 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
{
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
/*
* Only open connection if not already set by prior call to
* clutter_x11_set_display()
*/
if (!backend_x11->xdpy)
{
if (clutter_display_name)
{
CLUTTER_NOTE (BACKEND, "XOpenDisplay on `%s'", clutter_display_name);
CLUTTER_NOTE (BACKEND, "XOpenDisplay on `%s'",
clutter_display_name);
backend_x11->xdpy = XOpenDisplay (clutter_display_name);
}
else
@ -117,6 +124,7 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
"line argument");
return FALSE;
}
}
if (backend_x11->xdpy)
{
@ -385,6 +393,44 @@ clutter_x11_get_default_display (void)
return backend_singleton->xdpy;
}
/**
* clutter_x11_set_display:
* @xdpy: pointer to a X display connection.
* Sets the display connection clutter should use; must be called
* before clutter_init().
*
* Since: 0.8
*/
void
clutter_x11_set_display (Display *xdpy)
{
if (!xdpy)
return;
if (!backend_singleton)
{
/*
* This creates the singleton objects
*/
clutter_context_get_default ();
if (!backend_singleton)
{
g_critical ("X11 backend could not be initialised.");
return;
}
}
if (backend_singleton->xdpy)
{
g_critical ("Display connection already exists. You can only call "
"clutter_x11_set_display() once before clutter_init()\n");
return;
}
backend_singleton->xdpy = xdpy;
}
/**
* clutter_x11_get_default_screen:
*

View File

@ -85,6 +85,7 @@ gint clutter_x11_untrap_x_errors (void);
Display *clutter_x11_get_default_display (void);
int clutter_x11_get_default_screen (void);
Window clutter_x11_get_root_window (void);
void clutter_x11_set_display (Display * xdpy);
Window clutter_x11_get_stage_window (ClutterStage *stage);
XVisualInfo *clutter_x11_get_stage_visual (ClutterStage *stage);