Work toward turning GdkDisplayManager into a backend singleton
This commit hides the GdkDisplayManager instance and class structs, adds vfuncs for listing displays, opening displays, and getting and setting the default display. The X11 backend has a derived GdkDisplayManagerX11. The gdk_display_manager_get() function is responsible for deciding on which of the compiled in backends to use. Currently, it consults the GDK_BACKEND environment variable and falls back to x11.
This commit is contained in:
@ -272,8 +272,6 @@ gdk_display_opened (GdkDisplay *display)
|
||||
static void
|
||||
gdk_display_init (GdkDisplay *display)
|
||||
{
|
||||
_gdk_displays = g_slist_prepend (_gdk_displays, display);
|
||||
|
||||
display->double_click_time = 250;
|
||||
display->double_click_distance = 5;
|
||||
|
||||
@ -306,18 +304,6 @@ gdk_display_dispose (GObject *object)
|
||||
display->queued_events = NULL;
|
||||
display->queued_tail = NULL;
|
||||
|
||||
_gdk_displays = g_slist_remove (_gdk_displays, object);
|
||||
|
||||
if (gdk_display_get_default () == display)
|
||||
{
|
||||
if (_gdk_displays)
|
||||
gdk_display_manager_set_default_display (gdk_display_manager_get(),
|
||||
_gdk_displays->data);
|
||||
else
|
||||
gdk_display_manager_set_default_display (gdk_display_manager_get(),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (device_manager)
|
||||
{
|
||||
/* this is to make it drop devices which may require using the X
|
||||
@ -609,6 +595,29 @@ gdk_beep (void)
|
||||
gdk_display_beep (gdk_display_get_default ());
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_flush:
|
||||
*
|
||||
* Flushes the output buffers of all display connections and waits
|
||||
* until all requests have been processed.
|
||||
* This is rarely needed by applications.
|
||||
*/
|
||||
void
|
||||
gdk_flush (void)
|
||||
{
|
||||
GSList *list, *l;
|
||||
|
||||
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
GdkDisplay *display = l->data;
|
||||
|
||||
GDK_DISPLAY_GET_CLASS (display)->sync (display);
|
||||
}
|
||||
|
||||
g_slist_free (list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_send_client_message:
|
||||
* @event: the #GdkEvent to send, which should be a #GdkEventClient.
|
||||
@ -2264,3 +2273,26 @@ gdk_drag_get_protocol_for_display (GdkDisplay *display,
|
||||
{
|
||||
return GDK_DISPLAY_GET_CLASS (display)->get_drag_protocol (display, xid, protocol, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_open:
|
||||
* @display_name: the name of the display to open
|
||||
*
|
||||
* Opens a display.
|
||||
*
|
||||
* Return value: (transfer none): a #GdkDisplay, or %NULL if the display
|
||||
* could not be opened.
|
||||
*
|
||||
* Since: 2.2
|
||||
*/
|
||||
GdkDisplay *
|
||||
gdk_display_open (const gchar *display_name)
|
||||
{
|
||||
return gdk_display_manager_open_display (gdk_display_manager_get (), display_name);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
return GDK_DISPLAY_GET_CLASS (display)->has_pending (display);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user