| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | |
| | | #if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL |
| | | |
| | | #include "../SDL_sysvideo.h" |
| | | #include "../../events/SDL_windowevents_c.h" |
| | | #include "SDL_waylandvideo.h" |
| | | #include "SDL_waylandopengles.h" |
| | | #include "SDL_waylandwindow.h" |
| | | #include "SDL_waylandevents_c.h" |
| | | #include "SDL_waylanddyn.h" |
| | | |
| | | #include "xdg-shell-client-protocol.h" |
| | | #include "xdg-shell-unstable-v6-client-protocol.h" |
| | | |
| | | /* EGL implementation of SDL OpenGL ES support */ |
| | | |
| | |
| | | int |
| | | Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) |
| | | { |
| | | if (SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface) < 0) { |
| | | SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
| | | |
| | | if (SDL_EGL_SwapBuffers(_this, data->egl_surface) < 0) { |
| | | return -1; |
| | | } |
| | | WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); |
| | | |
| | | // Wayland-EGL forbids drawing calls in-between SwapBuffers and wl_egl_window_resize |
| | | Wayland_HandlePendingResize(window); |
| | | |
| | | WAYLAND_wl_display_flush( data->waylandData->display ); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | |
| | | return ret; |
| | | } |
| | | |
| | | void |
| | | Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) |
| | | { |
| | | SDL_WindowData *data; |
| | | if (window->driverdata) { |
| | | data = (SDL_WindowData *) window->driverdata; |
| | | |
| | | if (w) { |
| | | *w = window->w * data->scale_factor; |
| | | } |
| | | |
| | | if (h) { |
| | | *h = window->h * data->scale_factor; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context) |
| | | { |