mirror of https://github.com/encounter/SDL.git
wayland: libdecor support for SetWindowModalFor
This commit is contained in:
parent
93976ade3b
commit
ad310d3900
|
@ -138,6 +138,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
|
||||||
#define libdecor_frame_set_visibility (*WAYLAND_libdecor_frame_set_visibility)
|
#define libdecor_frame_set_visibility (*WAYLAND_libdecor_frame_set_visibility)
|
||||||
#define libdecor_frame_is_visible (*WAYLAND_libdecor_frame_is_visible)
|
#define libdecor_frame_is_visible (*WAYLAND_libdecor_frame_is_visible)
|
||||||
#define libdecor_frame_is_floating (*WAYLAND_libdecor_frame_is_floating)
|
#define libdecor_frame_is_floating (*WAYLAND_libdecor_frame_is_floating)
|
||||||
|
#define libdecor_frame_set_parent (*WAYLAND_libdecor_frame_set_parent)
|
||||||
#define libdecor_frame_get_xdg_surface (*WAYLAND_libdecor_frame_get_xdg_surface)
|
#define libdecor_frame_get_xdg_surface (*WAYLAND_libdecor_frame_get_xdg_surface)
|
||||||
#define libdecor_frame_map (*WAYLAND_libdecor_frame_map)
|
#define libdecor_frame_map (*WAYLAND_libdecor_frame_map)
|
||||||
#define libdecor_state_new (*WAYLAND_libdecor_state_new)
|
#define libdecor_state_new (*WAYLAND_libdecor_state_new)
|
||||||
|
|
|
@ -179,6 +179,8 @@ SDL_WAYLAND_SYM(bool, libdecor_frame_has_capability, (struct libdecor_frame *, \
|
||||||
SDL_WAYLAND_SYM(void, libdecor_frame_set_visibility, (struct libdecor_frame *, bool))
|
SDL_WAYLAND_SYM(void, libdecor_frame_set_visibility, (struct libdecor_frame *, bool))
|
||||||
SDL_WAYLAND_SYM(bool, libdecor_frame_is_visible, (struct libdecor_frame *))
|
SDL_WAYLAND_SYM(bool, libdecor_frame_is_visible, (struct libdecor_frame *))
|
||||||
SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
|
SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
|
||||||
|
SDL_WAYLAND_SYM(void, libdecor_frame_set_parent, (struct libdecor_frame *,\
|
||||||
|
struct libdecor_frame *))
|
||||||
SDL_WAYLAND_SYM(struct xdg_surface *, libdecor_frame_get_xdg_surface, (struct libdecor_frame *))
|
SDL_WAYLAND_SYM(struct xdg_surface *, libdecor_frame_get_xdg_surface, (struct libdecor_frame *))
|
||||||
SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
|
SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
|
||||||
SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
|
SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
|
||||||
|
|
|
@ -595,6 +595,18 @@ Wayland_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_wi
|
||||||
SDL_WindowData *modal_data = modal_window->driverdata;
|
SDL_WindowData *modal_data = modal_window->driverdata;
|
||||||
SDL_WindowData *parent_data = parent_window->driverdata;
|
SDL_WindowData *parent_data = parent_window->driverdata;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBDECOR_H
|
||||||
|
if (viddata->shell.libdecor) {
|
||||||
|
if (modal_data->shell_surface.libdecor.frame == NULL) {
|
||||||
|
return SDL_SetError("Modal window was hidden");
|
||||||
|
}
|
||||||
|
if (parent_data->shell_surface.libdecor.frame == NULL) {
|
||||||
|
return SDL_SetError("Parent window was hidden");
|
||||||
|
}
|
||||||
|
libdecor_frame_set_parent(modal_data->shell_surface.libdecor.frame,
|
||||||
|
parent_data->shell_surface.libdecor.frame);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
if (viddata->shell.xdg) {
|
if (viddata->shell.xdg) {
|
||||||
if (modal_data->shell_surface.xdg.roleobj.toplevel == NULL) {
|
if (modal_data->shell_surface.xdg.roleobj.toplevel == NULL) {
|
||||||
return SDL_SetError("Modal window was hidden");
|
return SDL_SetError("Modal window was hidden");
|
||||||
|
@ -604,6 +616,8 @@ Wayland_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_wi
|
||||||
}
|
}
|
||||||
xdg_toplevel_set_parent(modal_data->shell_surface.xdg.roleobj.toplevel,
|
xdg_toplevel_set_parent(modal_data->shell_surface.xdg.roleobj.toplevel,
|
||||||
parent_data->shell_surface.xdg.roleobj.toplevel);
|
parent_data->shell_surface.xdg.roleobj.toplevel);
|
||||||
|
} else {
|
||||||
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
WAYLAND_wl_display_flush(viddata->display);
|
WAYLAND_wl_display_flush(viddata->display);
|
||||||
|
|
Loading…
Reference in New Issue