forked from AuroraMiddleware/gtk
Revert "wayland: Cache the discovery connection and reuse if possible"
This reverts commit 524ce7f88e
.
This commit is contained in:
parent
cadfa58801
commit
edfaeba32b
@ -214,13 +214,18 @@ log_handler(const char *format, va_list args)
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
_gdk_wayland_display_open (struct wl_display *wl_display)
|
||||
_gdk_wayland_display_open (const gchar *display_name)
|
||||
{
|
||||
struct wl_display *wl_display;
|
||||
GdkDisplay *display;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
wl_log_set_handler_client(log_handler);
|
||||
|
||||
wl_display = wl_display_connect(display_name);
|
||||
if (!wl_display)
|
||||
return NULL;
|
||||
|
||||
display = g_object_new (GDK_TYPE_WAYLAND_DISPLAY, NULL);
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
|
@ -34,10 +34,6 @@ struct _GdkWaylandDisplayManager
|
||||
GSList *displays;
|
||||
|
||||
gboolean init_failed;
|
||||
struct {
|
||||
struct wl_display *wl_display;
|
||||
gchar *name;
|
||||
} cached_display;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDisplayManagerClass
|
||||
@ -55,7 +51,6 @@ gdk_wayland_display_manager_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (initable);
|
||||
struct wl_display *wl_display;
|
||||
|
||||
/* Set by the compositor when launching a special client - and it gets reset
|
||||
@ -69,12 +64,12 @@ gdk_wayland_display_manager_initable_init (GInitable *initable,
|
||||
|
||||
if (!wl_display)
|
||||
{
|
||||
manager->init_failed = TRUE;
|
||||
GDK_WAYLAND_DISPLAY_MANAGER (initable)->init_failed = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
manager->cached_display.name = g_strdup (gdk_get_display_arg_name ());
|
||||
manager->cached_display.wl_display = wl_display;
|
||||
wl_display_disconnect (wl_display);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -94,35 +89,10 @@ gdk_wayland_display_manager_finalize (GObject *object)
|
||||
}
|
||||
|
||||
static GdkDisplay *
|
||||
gdk_wayland_display_manager_open_display (GdkDisplayManager *display_manager,
|
||||
gdk_wayland_display_manager_open_display (GdkDisplayManager *manager,
|
||||
const gchar *name)
|
||||
{
|
||||
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (display_manager);
|
||||
struct wl_display *wl_display;
|
||||
|
||||
if (name == manager->cached_display.name ||
|
||||
g_strcmp0 (name, manager->cached_display.name))
|
||||
{
|
||||
/* Cache hit */
|
||||
wl_display = manager->cached_display.wl_display;
|
||||
}
|
||||
|
||||
if (!wl_display)
|
||||
{
|
||||
/* Cache miss */
|
||||
if (manager->cached_display.wl_display)
|
||||
wl_display_disconnect (manager->cached_display.wl_display);
|
||||
wl_display = wl_display_connect (name);
|
||||
}
|
||||
|
||||
/* Use the cache at most once */
|
||||
g_free (manager->cached_display.name);
|
||||
manager->cached_display.wl_display = NULL;
|
||||
|
||||
if (!wl_display)
|
||||
return NULL;
|
||||
|
||||
return _gdk_wayland_display_open (wl_display);
|
||||
return _gdk_wayland_display_open (name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -152,7 +152,7 @@ void _gdk_wayland_display_queue_events (GdkDisplay *display);
|
||||
|
||||
GdkAppLaunchContext *_gdk_wayland_display_get_app_launch_context (GdkDisplay *display);
|
||||
|
||||
GdkDisplay *_gdk_wayland_display_open (struct wl_display *display);
|
||||
GdkDisplay *_gdk_wayland_display_open (const gchar *display_name);
|
||||
|
||||
GdkWindow *_gdk_wayland_screen_create_root_window (GdkScreen *screen,
|
||||
int width,
|
||||
|
Loading…
Reference in New Issue
Block a user