diff options
-rw-r--r-- | gdk/wayland/gdkcursor-wayland.c | 2 | ||||
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.c | 42 | ||||
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.h | 1 | ||||
-rw-r--r-- | gdk/wayland/gdkscreen-wayland.c | 7 | ||||
-rw-r--r-- | gdk/wayland/gdkwindow-wayland.c | 8 |
5 files changed, 50 insertions, 10 deletions
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c index e93abc8bb4..21b3bf5efd 100644 --- a/gdk/wayland/gdkcursor-wayland.c +++ b/gdk/wayland/gdkcursor-wayland.c @@ -224,7 +224,7 @@ create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y) else memset (cursor->map, 0, 4); - visual = wl_display_get_premultiplied_argb_visual(display->wl_display); + visual = display->premultiplied_argb_visual; cursor->buffer = wl_shm_create_buffer(display->shm, fd, cursor->width, diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 5cd7be2bb7..8481e8b598 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -124,17 +124,53 @@ static const struct wl_shell_listener shell_listener = { static void output_handle_geometry(void *data, - struct wl_output *output, - int32_t x, int32_t y, int32_t width, int32_t height) + struct wl_output *wl_output, + int x, int y, int physical_width, int physical_height, + int subpixel, const char *make, const char *model) { /* g_signal_emit_by_name (screen, "monitors-changed"); g_signal_emit_by_name (screen, "size-changed"); */ } +static void +display_handle_mode(void *data, + struct wl_output *wl_output, + uint32_t flags, + int width, + int height, + int refresh) +{ +} + +static void +compositor_handle_visual(void *data, + struct wl_compositor *compositor, + uint32_t id, uint32_t token) +{ + GdkDisplayWayland *d = data; + + switch (token) { + case WL_COMPOSITOR_VISUAL_ARGB32: + d->argb_visual = wl_visual_create(d->wl_display, id, 1); + break; + case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32: + d->premultiplied_argb_visual = + wl_visual_create(d->wl_display, id, 1); + break; + case WL_COMPOSITOR_VISUAL_XRGB32: + d->rgb_visual = wl_visual_create(d->wl_display, id, 1); + break; + } +} + +static const struct wl_compositor_listener compositor_listener = { + compositor_handle_visual, +}; static const struct wl_output_listener output_listener = { output_handle_geometry, + display_handle_mode }; static void @@ -147,6 +183,8 @@ gdk_display_handle_global(struct wl_display *display, uint32_t id, if (strcmp(interface, "wl_compositor") == 0) { display_wayland->compositor = wl_compositor_create(display, id, 1); + wl_compositor_add_listener(display_wayland->compositor, + &compositor_listener, display_wayland); } else if (strcmp(interface, "wl_shm") == 0) { display_wayland->shm = wl_shm_create(display, id, 1); } else if (strcmp(interface, "wl_shell") == 0) { diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h index 88756afbb2..787de8c28a 100644 --- a/gdk/wayland/gdkdisplay-wayland.h +++ b/gdk/wayland/gdkdisplay-wayland.h @@ -71,6 +71,7 @@ struct _GdkDisplayWayland /* Wayland fields below */ struct wl_display *wl_display; + struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual; struct wl_compositor *compositor; struct wl_shm *shm; struct wl_shell *shell; diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c index b1cb479179..26f426de7a 100644 --- a/gdk/wayland/gdkscreen-wayland.c +++ b/gdk/wayland/gdkscreen-wayland.c @@ -482,15 +482,14 @@ _gdk_wayland_screen_new (GdkDisplay *display) screen_wayland->width = 8192; screen_wayland->height = 8192; - visual = wl_display_get_argb_visual(display_wayland->wl_display); + visual = display_wayland->argb_visual; screen_wayland->argb_visual = gdk_wayland_visual_new (screen, visual); - visual = - wl_display_get_premultiplied_argb_visual(display_wayland->wl_display); + visual = display_wayland->premultiplied_argb_visual; screen_wayland->premultiplied_argb_visual = gdk_wayland_visual_new (screen, visual); - visual = wl_display_get_rgb_visual(display_wayland->wl_display); + visual = display_wayland->rgb_visual; screen_wayland->rgb_visual = gdk_wayland_visual_new (screen, visual); screen_wayland->root_window = diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index c19b3c5556..194d7633e5 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -392,7 +392,7 @@ gdk_wayland_create_cairo_surface (GdkDisplayWayland *display, data = g_new (GdkWaylandCairoSurfaceData, 1); data->display = display; data->buffer = NULL; - visual = wl_display_get_premultiplied_argb_visual(display->wl_display); + visual = display->premultiplied_argb_visual; data->width = width; data->height = height; data->pixmap = wl_egl_pixmap_create(width, height, visual, 0); @@ -450,6 +450,8 @@ gdk_wayland_window_map (GdkWindow *window) { GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *parent; + GdkDisplayWayland *display_wayland = + GDK_DISPLAY_WAYLAND (gdk_window_get_display (impl->wrapper)); if (!impl->mapped) { @@ -462,11 +464,11 @@ gdk_wayland_window_map (GdkWindow *window) window->y); parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl); - wl_surface_map_transient (impl->surface, parent->surface, + wl_shell_set_transient (display_wayland->shell, impl->surface, parent->surface, window->x, window->y, 0); } else - wl_surface_map_toplevel (impl->surface); + wl_shell_set_toplevel (display_wayland->shell, impl->surface); impl->mapped = TRUE; } } |