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/clutter-marshal.list:
* clutter/glx/Makefile.am: * clutter/glx/Makefile.am:

View File

@ -103,19 +103,27 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
{ {
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
if (clutter_display_name) /*
* Only open connection if not already set by prior call to
* clutter_x11_set_display()
*/
if (!backend_x11->xdpy)
{ {
CLUTTER_NOTE (BACKEND, "XOpenDisplay on `%s'", clutter_display_name); if (clutter_display_name)
backend_x11->xdpy = XOpenDisplay (clutter_display_name); {
} CLUTTER_NOTE (BACKEND, "XOpenDisplay on `%s'",
else clutter_display_name);
{ backend_x11->xdpy = XOpenDisplay (clutter_display_name);
g_set_error (error, CLUTTER_INIT_ERROR, }
CLUTTER_INIT_ERROR_BACKEND, else
"Unable to open display. You have to set the DISPLAY " {
"environment variable, or use the --display command " g_set_error (error, CLUTTER_INIT_ERROR,
"line argument"); CLUTTER_INIT_ERROR_BACKEND,
return FALSE; "Unable to open display. You have to set the DISPLAY "
"environment variable, or use the --display command "
"line argument");
return FALSE;
}
} }
if (backend_x11->xdpy) if (backend_x11->xdpy)
@ -385,6 +393,44 @@ clutter_x11_get_default_display (void)
return backend_singleton->xdpy; 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: * 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); Display *clutter_x11_get_default_display (void);
int clutter_x11_get_default_screen (void); int clutter_x11_get_default_screen (void);
Window clutter_x11_get_root_window (void); Window clutter_x11_get_root_window (void);
void clutter_x11_set_display (Display * xdpy);
Window clutter_x11_get_stage_window (ClutterStage *stage); Window clutter_x11_get_stage_window (ClutterStage *stage);
XVisualInfo *clutter_x11_get_stage_visual (ClutterStage *stage); XVisualInfo *clutter_x11_get_stage_visual (ClutterStage *stage);