From 1b9dc5f6d24d28f9b356a6798b438d2456ec3de4 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 12 Jan 2012 14:49:27 +0000 Subject: wayland: Add a cogl_wayland_onscreen_resize function This function will call into the Wayland EGL platform API and resize the surface that the window is using and update the internal dimensions for framebuffer and viewport to reflect the change. --- cogl/cogl-onscreen.h | 7 +++++++ cogl/winsys/cogl-winsys-egl-wayland.c | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h index 9bcc7693..12995ea8 100644 --- a/cogl/cogl-onscreen.h +++ b/cogl/cogl-onscreen.h @@ -133,6 +133,13 @@ struct wl_surface * cogl_wayland_onscreen_get_surface (CoglOnscreen *onscreen); struct wl_shell_surface * cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen); + +void +cogl_wayland_onscreen_resize (CoglOnscreen *onscreen, + gint width, + gint height, + gint offset_x, + gint offset_y); #endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */ #define cogl_onscreen_set_swap_throttled cogl_onscreen_set_swap_throttled_EXP diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c index 0b7ff260..eecacec6 100644 --- a/cogl/winsys/cogl-winsys-egl-wayland.c +++ b/cogl/winsys/cogl-winsys-egl-wayland.c @@ -499,6 +499,30 @@ cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen) return NULL; } +void +cogl_wayland_onscreen_resize (CoglOnscreen *onscreen, + gint width, + gint height, + gint offset_x, + gint offset_y) +{ + CoglFramebuffer *fb; + + fb = COGL_FRAMEBUFFER (onscreen); + if (fb->allocated) + { + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + + wl_egl_window_resize (wayland_onscreen->wayland_egl_native_window, + width, + height, + offset_x, + offset_y); + _cogl_framebuffer_winsys_update_size (fb, width, height); + } +} + static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable = { -- cgit v1.2.1