forked from AuroraMiddleware/gtk
wayland: Update to recent API changes
This commit is contained in:
parent
f9c24e8f03
commit
0dd1f7edbc
@ -168,7 +168,6 @@ static GdkCursor *
|
|||||||
create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
|
create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
|
||||||
{
|
{
|
||||||
GdkWaylandCursor *cursor;
|
GdkWaylandCursor *cursor;
|
||||||
struct wl_visual *visual;
|
|
||||||
int stride, fd;
|
int stride, fd;
|
||||||
char *filename;
|
char *filename;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -224,12 +223,11 @@ create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
|
|||||||
else
|
else
|
||||||
memset (cursor->map, 0, 4);
|
memset (cursor->map, 0, 4);
|
||||||
|
|
||||||
visual = display->premultiplied_argb_visual;
|
|
||||||
cursor->buffer = wl_shm_create_buffer(display->shm,
|
cursor->buffer = wl_shm_create_buffer(display->shm,
|
||||||
fd,
|
fd,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
stride, visual);
|
stride, WL_SHM_FORMAT_ARGB32);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
@ -143,31 +143,6 @@ display_handle_mode(void *data,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = {
|
static const struct wl_output_listener output_listener = {
|
||||||
output_handle_geometry,
|
output_handle_geometry,
|
||||||
display_handle_mode
|
display_handle_mode
|
||||||
@ -182,21 +157,21 @@ gdk_display_handle_global(struct wl_display *display, uint32_t id,
|
|||||||
struct wl_input_device *input;
|
struct wl_input_device *input;
|
||||||
|
|
||||||
if (strcmp(interface, "wl_compositor") == 0) {
|
if (strcmp(interface, "wl_compositor") == 0) {
|
||||||
display_wayland->compositor = wl_compositor_create(display, id, 1);
|
display_wayland->compositor =
|
||||||
wl_compositor_add_listener(display_wayland->compositor,
|
wl_display_bind(display, id, &wl_compositor_interface);
|
||||||
&compositor_listener, display_wayland);
|
|
||||||
} else if (strcmp(interface, "wl_shm") == 0) {
|
} else if (strcmp(interface, "wl_shm") == 0) {
|
||||||
display_wayland->shm = wl_shm_create(display, id, 1);
|
display_wayland->shm = wl_display_bind(display, id, &wl_shm_interface);
|
||||||
} else if (strcmp(interface, "wl_shell") == 0) {
|
} else if (strcmp(interface, "wl_shell") == 0) {
|
||||||
display_wayland->shell = wl_shell_create(display, id, 1);
|
display_wayland->shell = wl_display_bind(display, id, &wl_shell_interface);
|
||||||
wl_shell_add_listener(display_wayland->shell,
|
wl_shell_add_listener(display_wayland->shell,
|
||||||
&shell_listener, display_wayland);
|
&shell_listener, display_wayland);
|
||||||
} else if (strcmp(interface, "wl_output") == 0) {
|
} else if (strcmp(interface, "wl_output") == 0) {
|
||||||
display_wayland->output = wl_output_create(display, id, 1);
|
display_wayland->output =
|
||||||
|
wl_display_bind(display, id, &wl_output_interface);
|
||||||
wl_output_add_listener(display_wayland->output,
|
wl_output_add_listener(display_wayland->output,
|
||||||
&output_listener, display_wayland);
|
&output_listener, display_wayland);
|
||||||
} else if (strcmp(interface, "wl_input_device") == 0) {
|
} else if (strcmp(interface, "wl_input_device") == 0) {
|
||||||
input = wl_input_device_create(display, id, 1);
|
input = wl_display_bind(display, id, &wl_input_device_interface);
|
||||||
_gdk_wayland_device_manager_add_device (gdk_display->device_manager,
|
_gdk_wayland_device_manager_add_device (gdk_display->device_manager,
|
||||||
input);
|
input);
|
||||||
}
|
}
|
||||||
@ -375,28 +350,16 @@ gdk_wayland_display_beep (GdkDisplay *display)
|
|||||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
sync_callback(void *data)
|
|
||||||
{
|
|
||||||
gboolean *done = data;
|
|
||||||
|
|
||||||
*done = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_display_sync (GdkDisplay *display)
|
gdk_wayland_display_sync (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
GdkDisplayWayland *display_wayland;
|
GdkDisplayWayland *display_wayland;
|
||||||
gboolean done;
|
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||||
|
|
||||||
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
||||||
|
|
||||||
wl_display_sync_callback(display_wayland->wl_display, sync_callback, &done);
|
wl_display_roundtrip(display_wayland->wl_display);
|
||||||
wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_WRITABLE);
|
|
||||||
while (!done)
|
|
||||||
wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_READABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -71,7 +71,6 @@ struct _GdkDisplayWayland
|
|||||||
|
|
||||||
/* Wayland fields below */
|
/* Wayland fields below */
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual;
|
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
struct wl_shell *shell;
|
struct wl_shell *shell;
|
||||||
|
@ -53,9 +53,7 @@ struct _GdkScreenWayland
|
|||||||
int width_mm, height_mm;
|
int width_mm, height_mm;
|
||||||
|
|
||||||
/* Visual Part */
|
/* Visual Part */
|
||||||
GdkVisual *argb_visual;
|
GdkVisual *visual;
|
||||||
GdkVisual *premultiplied_argb_visual;
|
|
||||||
GdkVisual *rgb_visual;
|
|
||||||
|
|
||||||
/* Xinerama/RandR 1.2 */
|
/* Xinerama/RandR 1.2 */
|
||||||
gint n_monitors;
|
gint n_monitors;
|
||||||
@ -155,10 +153,7 @@ gdk_wayland_screen_finalize (GObject *object)
|
|||||||
if (screen_wayland->root_window)
|
if (screen_wayland->root_window)
|
||||||
g_object_unref (screen_wayland->root_window);
|
g_object_unref (screen_wayland->root_window);
|
||||||
|
|
||||||
/* Visual Part */
|
g_object_unref (screen_wayland->visual);
|
||||||
g_object_unref (screen_wayland->argb_visual);
|
|
||||||
g_object_unref (screen_wayland->premultiplied_argb_visual);
|
|
||||||
g_object_unref (screen_wayland->rgb_visual);
|
|
||||||
|
|
||||||
deinit_multihead (GDK_SCREEN (object));
|
deinit_multihead (GDK_SCREEN (object));
|
||||||
|
|
||||||
@ -294,13 +289,13 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
|
|||||||
static GdkVisual *
|
static GdkVisual *
|
||||||
gdk_wayland_screen_get_system_visual (GdkScreen * screen)
|
gdk_wayland_screen_get_system_visual (GdkScreen * screen)
|
||||||
{
|
{
|
||||||
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkVisual *
|
static GdkVisual *
|
||||||
gdk_wayland_screen_get_rgba_visual (GdkScreen *screen)
|
gdk_wayland_screen_get_rgba_visual (GdkScreen *screen)
|
||||||
{
|
{
|
||||||
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -349,7 +344,6 @@ typedef struct _GdkWaylandVisualClass GdkWaylandVisualClass;
|
|||||||
struct _GdkWaylandVisual
|
struct _GdkWaylandVisual
|
||||||
{
|
{
|
||||||
GdkVisual visual;
|
GdkVisual visual;
|
||||||
struct wl_visual *wl_visual;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkWaylandVisualClass
|
struct _GdkWaylandVisualClass
|
||||||
@ -384,21 +378,21 @@ gdk_wayland_screen_visual_get_best_type (GdkScreen *screen)
|
|||||||
static GdkVisual*
|
static GdkVisual*
|
||||||
gdk_wayland_screen_visual_get_best (GdkScreen *screen)
|
gdk_wayland_screen_visual_get_best (GdkScreen *screen)
|
||||||
{
|
{
|
||||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkVisual*
|
static GdkVisual*
|
||||||
gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
|
gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
|
||||||
gint depth)
|
gint depth)
|
||||||
{
|
{
|
||||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkVisual*
|
static GdkVisual*
|
||||||
gdk_wayland_screen_visual_get_best_with_type (GdkScreen *screen,
|
gdk_wayland_screen_visual_get_best_with_type (GdkScreen *screen,
|
||||||
GdkVisualType visual_type)
|
GdkVisualType visual_type)
|
||||||
{
|
{
|
||||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkVisual*
|
static GdkVisual*
|
||||||
@ -406,7 +400,7 @@ gdk_wayland_screen_visual_get_best_with_both (GdkScreen *screen,
|
|||||||
gint depth,
|
gint depth,
|
||||||
GdkVisualType visual_type)
|
GdkVisualType visual_type)
|
||||||
{
|
{
|
||||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -440,9 +434,7 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
|
|||||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||||
screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
||||||
|
|
||||||
list = g_list_append (NULL, screen_wayland->argb_visual);
|
list = g_list_append (NULL, screen_wayland->visual);
|
||||||
list = g_list_append (NULL, screen_wayland->premultiplied_argb_visual);
|
|
||||||
list = g_list_append (NULL, screen_wayland->rgb_visual);
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -451,7 +443,7 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
|
|||||||
#define GDK_WAYLAND_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_VISUAL, GdkWaylandVisual))
|
#define GDK_WAYLAND_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_VISUAL, GdkWaylandVisual))
|
||||||
|
|
||||||
static GdkVisual *
|
static GdkVisual *
|
||||||
gdk_wayland_visual_new (GdkScreen *screen, struct wl_visual *wl_visual)
|
gdk_wayland_visual_new (GdkScreen *screen)
|
||||||
{
|
{
|
||||||
GdkVisual *visual;
|
GdkVisual *visual;
|
||||||
|
|
||||||
@ -460,8 +452,6 @@ gdk_wayland_visual_new (GdkScreen *screen, struct wl_visual *wl_visual)
|
|||||||
visual->type = GDK_VISUAL_TRUE_COLOR;
|
visual->type = GDK_VISUAL_TRUE_COLOR;
|
||||||
visual->depth = 32;
|
visual->depth = 32;
|
||||||
|
|
||||||
GDK_WAYLAND_VISUAL (visual)->wl_visual = wl_visual;
|
|
||||||
|
|
||||||
return visual;
|
return visual;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,10 +460,6 @@ _gdk_wayland_screen_new (GdkDisplay *display)
|
|||||||
{
|
{
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
GdkScreenWayland *screen_wayland;
|
GdkScreenWayland *screen_wayland;
|
||||||
GdkDisplayWayland *display_wayland;
|
|
||||||
struct wl_visual *visual;
|
|
||||||
|
|
||||||
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
|
||||||
|
|
||||||
screen = g_object_new (GDK_TYPE_SCREEN_WAYLAND, NULL);
|
screen = g_object_new (GDK_TYPE_SCREEN_WAYLAND, NULL);
|
||||||
|
|
||||||
@ -482,15 +468,7 @@ _gdk_wayland_screen_new (GdkDisplay *display)
|
|||||||
screen_wayland->width = 8192;
|
screen_wayland->width = 8192;
|
||||||
screen_wayland->height = 8192;
|
screen_wayland->height = 8192;
|
||||||
|
|
||||||
visual = display_wayland->argb_visual;
|
screen_wayland->visual = gdk_wayland_visual_new (screen);
|
||||||
screen_wayland->argb_visual = gdk_wayland_visual_new (screen, visual);
|
|
||||||
|
|
||||||
visual = display_wayland->premultiplied_argb_visual;
|
|
||||||
screen_wayland->premultiplied_argb_visual =
|
|
||||||
gdk_wayland_visual_new (screen, visual);
|
|
||||||
|
|
||||||
visual = display_wayland->rgb_visual;
|
|
||||||
screen_wayland->rgb_visual = gdk_wayland_visual_new (screen, visual);
|
|
||||||
|
|
||||||
screen_wayland->root_window =
|
screen_wayland->root_window =
|
||||||
_gdk_wayland_screen_create_root_window (screen,
|
_gdk_wayland_screen_create_root_window (screen,
|
||||||
|
@ -387,15 +387,13 @@ gdk_wayland_create_cairo_surface (GdkDisplayWayland *display,
|
|||||||
{
|
{
|
||||||
GdkWaylandCairoSurfaceData *data;
|
GdkWaylandCairoSurfaceData *data;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
struct wl_visual *visual;
|
|
||||||
|
|
||||||
data = g_new (GdkWaylandCairoSurfaceData, 1);
|
data = g_new (GdkWaylandCairoSurfaceData, 1);
|
||||||
data->display = display;
|
data->display = display;
|
||||||
data->buffer = NULL;
|
data->buffer = NULL;
|
||||||
visual = display->premultiplied_argb_visual;
|
|
||||||
data->width = width;
|
data->width = width;
|
||||||
data->height = height;
|
data->height = height;
|
||||||
data->pixmap = wl_egl_pixmap_create(width, height, visual, 0);
|
data->pixmap = wl_egl_pixmap_create(width, height, 0);
|
||||||
data->image =
|
data->image =
|
||||||
display->create_image(display->egl_display, NULL, EGL_NATIVE_PIXMAP_KHR,
|
display->create_image(display->egl_display, NULL, EGL_NATIVE_PIXMAP_KHR,
|
||||||
(EGLClientBuffer) data->pixmap, NULL);
|
(EGLClientBuffer) data->pixmap, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user