diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-04-26 15:10:59 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-02-28 08:31:49 +0100 |
commit | 7e31b614c6ce73f13b7300ca9f532290293f6b02 (patch) | |
tree | c27f5ff6be8df4c66c373f714eccf97d47512bb9 | |
parent | 05e340da8140bf74f4a2c6106472e50baea94f25 (diff) |
wayland: Fullscreen support
-rw-r--r-- | src/video/wayland/SDL_waylandvideo.c | 35 | ||||
-rw-r--r-- | src/video/wayland/SDL_waylandwindow.c | 6 |
2 files changed, 36 insertions, 5 deletions
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 4ecaadcd..f88a0c1d 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -38,9 +38,16 @@ #define WAYLANDVID_DRIVER_NAME "wayland" /* Initialization/Query functions */ -static int Wayland_VideoInit(_THIS); -static int Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); -static void Wayland_VideoQuit(_THIS); +static int +Wayland_VideoInit(_THIS); + +static void +Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display); +static int +Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); + +static void +Wayland_VideoQuit(_THIS); /* Wayland driver bootstrap functions */ @@ -81,6 +88,7 @@ Wayland_CreateDevice(int devindex) device->VideoInit = Wayland_VideoInit; device->VideoQuit = Wayland_VideoQuit; device->SetDisplayMode = Wayland_SetDisplayMode; + device->GetDisplayModes = Wayland_GetDisplayModes; device->PumpEvents = Wayland_PumpEvents; @@ -208,7 +216,7 @@ Wayland_VideoInit(_THIS) /* Use a fake 32-bpp desktop mode */ mode.format = SDL_PIXELFORMAT_RGB888; mode.w = data->screen_allocation.width; - mode.h = data->screen_allocation.width; + mode.h = data->screen_allocation.height; mode.refresh_rate = 0; mode.driverdata = NULL; SDL_zero(display); @@ -222,6 +230,25 @@ Wayland_VideoInit(_THIS) return 0; } +static void +Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) +{ + SDL_WaylandData *data = _this->driverdata; + SDL_DisplayMode mode; + + Wayland_PumpEvents(_this); + + mode.w = data->screen_allocation.width; + mode.h = data->screen_allocation.height; + mode.refresh_rate = 0; + mode.driverdata = NULL; + + mode.format = SDL_PIXELFORMAT_RGB888; + SDL_AddDisplayMode(sdl_display, &mode); + mode.format = SDL_PIXELFORMAT_RGBA8888; + SDL_AddDisplayMode(sdl_display, &mode); +} + static int Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) { diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index c27a7050..a9e71f08 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -31,7 +31,11 @@ void Wayland_ShowWindow(_THIS, SDL_Window * window) { SDL_WaylandWindow *wind = (SDL_WaylandWindow*) window->driverdata; - wl_surface_map_toplevel(wind->surface); + printf("sow window: %d,%d\n", window->w, window->h); + if (window->flags & SDL_WINDOW_FULLSCREEN) + wl_surface_map_fullscreen(wind->surface); + else + wl_surface_map_toplevel(wind->surface); /* wl_surface_map(wind->surface, window->x, window->y, |