summaryrefslogtreecommitdiff
path: root/gdk/wayland
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-03-26 22:16:15 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-03-26 22:16:15 -0400
commit28c865b4e257755b2acf709986358052743e9705 (patch)
tree79bfdcf7408f24b047166e0c9845982b7d7e640c /gdk/wayland
parentca09a600c39ffc867460b079b8f0852d4c3fb5b7 (diff)
downloadgtk+-28c865b4e257755b2acf709986358052743e9705.tar.gz
wayland: Make monitor removal work
The global_removal argument is the _name_ of the object. We were comparing it to the _object id_ of the object. To fix this, store the name at the time the object is bound.
Diffstat (limited to 'gdk/wayland')
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c4
-rw-r--r--gdk/wayland/gdkprivate-wayland.h3
-rw-r--r--gdk/wayland/gdkscreen-wayland.c7
3 files changed, 10 insertions, 4 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 99707524b3..bf220146e1 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -113,7 +113,7 @@ gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id
} else if (strcmp(interface, "wl_output") == 0) {
output =
wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, 1);
- _gdk_wayland_screen_add_output(display_wayland->screen, output);
+ _gdk_wayland_screen_add_output(display_wayland->screen, id, output);
/* We need to roundtrip until we've received the modes and
* geometry events for the output, which gives us the physical
* properties and available modes on the output. */
@@ -142,6 +142,8 @@ gdk_registry_handle_global_remove(void *data,
/* We don't know what this item is - try as an output */
_gdk_wayland_screen_remove_output_by_id (display_wayland->screen, id);
+
+ /* FIXME: the object needs to be destroyed here, we're leaking */
}
static const struct wl_registry_listener registry_listener = {
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 9c958e4470..0bdba52c61 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -151,7 +151,8 @@ GdkWindow *_gdk_wayland_screen_create_root_window (GdkScreen *screen,
int height);
GdkScreen *_gdk_wayland_screen_new (GdkDisplay *display);
-void _gdk_wayland_screen_add_output (GdkScreen *scren,
+void _gdk_wayland_screen_add_output (GdkScreen *screen,
+ guint32 id,
struct wl_output *output);
void _gdk_wayland_screen_remove_output_by_id (GdkScreen *screen,
guint32 id);
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 845ae141a0..c357121a73 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -80,6 +80,7 @@ struct _GdkWaylandScreenClass
struct _GdkWaylandMonitor
{
GdkWaylandScreen *screen;
+ guint32 id;
struct wl_output *output;
GdkRectangle geometry;
int width_mm;
@@ -935,12 +936,14 @@ static const struct wl_output_listener output_listener =
};
void
-_gdk_wayland_screen_add_output (GdkScreen *screen,
+_gdk_wayland_screen_add_output (GdkScreen *screen,
+ guint32 id,
struct wl_output *output)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_new0(GdkWaylandMonitor, 1);
+ monitor->id = id;
monitor->output = output;
monitor->screen = screen_wayland;
g_ptr_array_add(screen_wayland->monitors, monitor);
@@ -959,7 +962,7 @@ _gdk_wayland_screen_remove_output_by_id (GdkScreen *screen,
{
GdkWaylandMonitor *monitor = screen_wayland->monitors->pdata[i];
- if (wl_proxy_get_id ((struct wl_proxy *)monitor->output) == id)
+ if (monitor->id == id)
{
g_ptr_array_remove (screen_wayland->monitors, monitor);