Cleanup: remove libdecor workaround for fractional scale
Since the preferred fractional scale callback runs, remove a workaround that guessed the fractional scale from the output. While it could be kept, it added unnecessary complexity.
This commit is contained in:
@@ -77,12 +77,6 @@ struct GWL_LibDecor_Window {
|
||||
int32_t size[2] = {0, 0};
|
||||
} applied;
|
||||
|
||||
/**
|
||||
* Used at startup to set the initial window size
|
||||
* (before fractional scale information is available).
|
||||
*/
|
||||
int scale_fractional_from_output = 0;
|
||||
|
||||
/** The window has been configured (see #xdg_surface_ack_configure). */
|
||||
bool initial_configure_seen = false;
|
||||
/** The window size has been configured. */
|
||||
@@ -1190,9 +1184,7 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
|
||||
|
||||
{
|
||||
GWL_Window *win = static_cast<GWL_Window *>(data);
|
||||
const int fractional_scale = win->frame.fractional_scale ?
|
||||
win->frame.fractional_scale :
|
||||
win->libdecor->scale_fractional_from_output;
|
||||
const int fractional_scale = win->frame.fractional_scale;
|
||||
/* It's important `fractional_scale` has a fractional component or rounding up will fail
|
||||
* to produce the correct whole-number scale. */
|
||||
GHOST_ASSERT((fractional_scale == 0) ||
|
||||
@@ -1206,7 +1198,7 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
|
||||
const int scale_as_fractional = scale * FRACTIONAL_DENOMINATOR;
|
||||
if (libdecor_configuration_get_content_size(
|
||||
configuration, frame, &size_next[0], &size_next[1])) {
|
||||
if (win->frame.fractional_scale) {
|
||||
if (fractional_scale) {
|
||||
win->frame_pending.size[0] = gwl_window_fractional_to_viewport_round(win->frame,
|
||||
size_next[0]);
|
||||
win->frame_pending.size[1] = gwl_window_fractional_to_viewport_round(win->frame,
|
||||
@@ -1304,10 +1296,6 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
|
||||
libdecor_state_free(state);
|
||||
}
|
||||
|
||||
/* Only ever use this once, after initial creation:
|
||||
* #wp_fractional_scale_v1_listener::preferred_scale provides fractional scaling values. */
|
||||
decor.scale_fractional_from_output = 0;
|
||||
|
||||
if (decor.initial_configure_seen == false) {
|
||||
decor.initial_configure_seen = true;
|
||||
}
|
||||
@@ -1619,12 +1607,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
||||
/* Causes a glitch with `libdecor` for some reason. */
|
||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||
if (use_libdecor) {
|
||||
GWL_LibDecor_Window &decor = *window_->libdecor;
|
||||
if (fractional_scale_manager &&
|
||||
(gwl_round_int_test(scale_fractional_from_output, FRACTIONAL_DENOMINATOR) == false))
|
||||
{
|
||||
decor.scale_fractional_from_output = scale_fractional_from_output;
|
||||
}
|
||||
/* Pass. */
|
||||
}
|
||||
else
|
||||
#endif /* WITH_GHOST_WAYLAND_LIBDECOR */
|
||||
@@ -1780,7 +1763,6 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
||||
else
|
||||
#endif /* WITH_GHOST_WAYLAND_LIBDECOR */
|
||||
{
|
||||
GWL_XDG_Decor_Window &decor = *window_->xdg_decor;
|
||||
gwl_window_state_set(window_, state);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user