mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Mostly revert cfcdfb7be9
.
This was causing window changes to completely break, resulting in broken decorations and bizarre frame timing, I don't know what exactly it's doing but it's not good. Kept the libdecor_frame_is_floating logic, at least.
This commit is contained in:
parent
8803589fc3
commit
754aa2d321
@ -290,18 +290,12 @@ decoration_frame_configure(struct libdecor_frame *frame,
|
|||||||
enum libdecor_window_state window_state;
|
enum libdecor_window_state window_state;
|
||||||
struct libdecor_state *state;
|
struct libdecor_state *state;
|
||||||
|
|
||||||
SDL_bool fullscreen = SDL_FALSE;
|
|
||||||
SDL_bool maximized = SDL_FALSE;
|
|
||||||
|
|
||||||
/* window size */
|
/* window size */
|
||||||
if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {
|
if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {
|
||||||
width = wind->floating_width;
|
width = window->w;
|
||||||
height = wind->floating_height;
|
height = window->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = (width == 0) ? window->w : width;
|
|
||||||
height = (height == 0) ? window->h : height;
|
|
||||||
|
|
||||||
Wayland_HandleResize(window, width, height, wind->scale_factor);
|
Wayland_HandleResize(window, width, height, wind->scale_factor);
|
||||||
wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE;
|
wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE;
|
||||||
|
|
||||||
@ -310,51 +304,33 @@ decoration_frame_configure(struct libdecor_frame *frame,
|
|||||||
window_state = LIBDECOR_WINDOW_STATE_NONE;
|
window_state = LIBDECOR_WINDOW_STATE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translate libdecor to SDL states */
|
/* Always send maximized/restored/focus events; if the event is redundant it will
|
||||||
switch (window_state) {
|
* automatically be discarded (see src/events/SDL_windowevents.c).
|
||||||
case LIBDECOR_WINDOW_STATE_FULLSCREEN:
|
*
|
||||||
fullscreen = SDL_TRUE;
|
* No, we do not get minimize events from libdecor.
|
||||||
break;
|
*/
|
||||||
case LIBDECOR_WINDOW_STATE_MAXIMIZED:
|
if (window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN) {
|
||||||
maximized = SDL_TRUE;
|
window->flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
break;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
if (!fullscreen) {
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
/* We might need to re-enter fullscreen after being restored from minimized */
|
/* We might need to re-enter fullscreen after being restored from minimized */
|
||||||
SDL_WaylandOutputData *driverdata = (SDL_WaylandOutputData *) SDL_GetDisplayForWindow(window)->driverdata;
|
SDL_WaylandOutputData *driverdata = (SDL_WaylandOutputData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||||
SetFullscreen(window, driverdata->output);
|
SetFullscreen(window, driverdata->output);
|
||||||
fullscreen = SDL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width == 0 || height == 0) {
|
|
||||||
width = wind->floating_width;
|
|
||||||
height = wind->floating_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_RESIZABLE)) {
|
|
||||||
if (window->max_w > 0) {
|
|
||||||
width = SDL_min(width, window->max_w);
|
|
||||||
}
|
|
||||||
width = SDL_max(width, window->min_w);
|
|
||||||
|
|
||||||
if (window->max_h > 0) {
|
|
||||||
height = SDL_min(height, window->max_h);
|
|
||||||
}
|
|
||||||
height = SDL_max(height, window->min_h);
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
SDL_SendWindowEvent(window,
|
||||||
|
(window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) ?
|
||||||
|
SDL_WINDOWEVENT_MAXIMIZED :
|
||||||
|
SDL_WINDOWEVENT_RESTORED,
|
||||||
|
0, 0);
|
||||||
}
|
}
|
||||||
|
window->flags &= ~SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fullscreen) {
|
SDL_SendWindowEvent(window,
|
||||||
SDL_SendWindowEvent(window,
|
(window_state & LIBDECOR_WINDOW_STATE_ACTIVE) ?
|
||||||
maximized ?
|
SDL_WINDOWEVENT_FOCUS_GAINED :
|
||||||
SDL_WINDOWEVENT_MAXIMIZED :
|
SDL_WINDOWEVENT_FOCUS_LOST,
|
||||||
SDL_WINDOWEVENT_RESTORED,
|
0, 0);
|
||||||
0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* commit frame state */
|
/* commit frame state */
|
||||||
state = libdecor_state_new(width, height);
|
state = libdecor_state_new(width, height);
|
||||||
|
Loading…
Reference in New Issue
Block a user