Skip to content

Commit 68d2d9f

Browse files
Kontrabantslouken
authored andcommitted
wayland: Implement popup windows
1 parent e987c4a commit 68d2d9f

File tree

7 files changed

+228
-78
lines changed

7 files changed

+228
-78
lines changed

src/video/wayland/SDL_waylanddyn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
160160
#define libdecor_frame_set_parent (*WAYLAND_libdecor_frame_set_parent)
161161
#define libdecor_frame_get_xdg_surface (*WAYLAND_libdecor_frame_get_xdg_surface)
162162
#define libdecor_frame_get_xdg_toplevel (*WAYLAND_libdecor_frame_get_xdg_toplevel)
163+
#define libdecor_frame_translate_coordinate (*WAYLAND_libdecor_frame_translate_coordinate)
163164
#define libdecor_frame_map (*WAYLAND_libdecor_frame_map)
164165
#define libdecor_state_new (*WAYLAND_libdecor_state_new)
165166
#define libdecor_state_free (*WAYLAND_libdecor_state_free)

src/video/wayland/SDL_waylandevents.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,9 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
13551355
if (window) {
13561356
input->keyboard_focus = window;
13571357
window->keyboard_device = input;
1358-
SDL_SetKeyboardFocus(window->sdlwindow);
1358+
1359+
/* Restore the keyboard focus to the child popup that was holding it */
1360+
SDL_SetKeyboardFocus(window->keyboard_focus ? window->keyboard_focus : window->sdlwindow);
13591361
}
13601362
#ifdef SDL_USE_IME
13611363
if (!input->text_input) {

src/video/wayland/SDL_waylandopengles.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
115115
* FIXME: Request EGL_WAYLAND_swap_buffers_with_timeout.
116116
* -flibit
117117
*/
118-
if (window->flags & SDL_WINDOW_HIDDEN) {
118+
if (data->surface_status != WAYLAND_SURFACE_STATUS_SHOWN &&
119+
data->surface_status != WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME) {
119120
return 0;
120121
}
121122

src/video/wayland/SDL_waylandsym.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ SDL_WAYLAND_SYM(void, libdecor_frame_set_parent, (struct libdecor_frame *,\
206206
struct libdecor_frame *))
207207
SDL_WAYLAND_SYM(struct xdg_surface *, libdecor_frame_get_xdg_surface, (struct libdecor_frame *))
208208
SDL_WAYLAND_SYM(struct xdg_toplevel *, libdecor_frame_get_xdg_toplevel, (struct libdecor_frame *))
209+
SDL_WAYLAND_SYM(void, libdecor_frame_translate_coordinate, (struct libdecor_frame *, int, int, int *, int *))
209210
SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
210211
SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
211212
SDL_WAYLAND_SYM(void, libdecor_state_free, (struct libdecor_state *))

src/video/wayland/SDL_waylandvideo.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
239239
device->RestoreWindow = Wayland_RestoreWindow;
240240
device->SetWindowBordered = Wayland_SetWindowBordered;
241241
device->SetWindowResizable = Wayland_SetWindowResizable;
242+
device->SetWindowPosition = Wayland_SetWindowPosition;
242243
device->SetWindowSize = Wayland_SetWindowSize;
243244
device->SetWindowMinimumSize = Wayland_SetWindowMinimumSize;
244245
device->SetWindowMaximumSize = Wayland_SetWindowMaximumSize;
@@ -275,7 +276,8 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
275276
device->free = Wayland_DeleteDevice;
276277

277278
device->quirk_flags = VIDEO_DEVICE_QUIRK_MODE_SWITCHING_EMULATED |
278-
VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE;
279+
VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE |
280+
VIDEO_DEVICE_QUIRK_HAS_POPUP_WINDOW_SUPPORT;
279281

280282
return device;
281283
}

0 commit comments

Comments
 (0)