Skip to content

Commit

Permalink
wayland: Refactor toplevel mapping, implement HideWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo authored and icculus committed Apr 21, 2021
1 parent 0838f53 commit 8e3ec34
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 95 deletions.
34 changes: 28 additions & 6 deletions src/video/wayland/SDL_waylandevents.c
Expand Up @@ -331,11 +331,21 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial)
switch (rc) {
case SDL_HITTEST_DRAGGABLE:
if (input->display->shell.xdg) {
xdg_toplevel_move(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, serial);
if (window_data->shell_surface.xdg.roleobj.toplevel) {
xdg_toplevel_move(window_data->shell_surface.xdg.roleobj.toplevel,
input->seat,
serial);
}
} else if (input->display->shell.zxdg) {
zxdg_toplevel_v6_move(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial);
if (window_data->shell_surface.zxdg.roleobj.toplevel) {
zxdg_toplevel_v6_move(window_data->shell_surface.zxdg.roleobj.toplevel,
input->seat,
serial);
}
} else {
wl_shell_surface_move(window_data->shell_surface.wl, input->seat, serial);
if (window_data->shell_surface.wl) {
wl_shell_surface_move(window_data->shell_surface.wl, input->seat, serial);
}
}
return SDL_TRUE;

Expand All @@ -348,11 +358,23 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial)
case SDL_HITTEST_RESIZE_BOTTOMLEFT:
case SDL_HITTEST_RESIZE_LEFT:
if (input->display->shell.xdg) {
xdg_toplevel_resize(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
if (window_data->shell_surface.xdg.roleobj.toplevel) {
xdg_toplevel_resize(window_data->shell_surface.xdg.roleobj.toplevel,
input->seat,
serial,
directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
}
} else if (input->display->shell.zxdg) {
zxdg_toplevel_v6_resize(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
if (window_data->shell_surface.zxdg.roleobj.toplevel) {
zxdg_toplevel_v6_resize(window_data->shell_surface.zxdg.roleobj.toplevel,
input->seat,
serial,
directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
}
} else {
wl_shell_surface_resize(window_data->shell_surface.wl, input->seat, serial, directions_wl[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
if (window_data->shell_surface.wl) {
wl_shell_surface_resize(window_data->shell_surface.wl, input->seat, serial, directions_wl[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
}
}
return SDL_TRUE;

Expand Down
1 change: 1 addition & 0 deletions src/video/wayland/SDL_waylandvideo.c
Expand Up @@ -198,6 +198,7 @@ Wayland_CreateDevice(int devindex)

device->CreateSDLWindow = Wayland_CreateWindow;
device->ShowWindow = Wayland_ShowWindow;
device->HideWindow = Wayland_HideWindow;
device->SetWindowFullscreen = Wayland_SetWindowFullscreen;
device->MaximizeWindow = Wayland_MaximizeWindow;
device->MinimizeWindow = Wayland_MinimizeWindow;
Expand Down

0 comments on commit 8e3ec34

Please sign in to comment.