Revert "Fix #113059: file selector shrinks on each display under KDE"
This reverts commit 85e2dd66a0
.
Remove the hack in favor of a different fix.
This commit is contained in:
parent
d304ba7906
commit
aba3fad33c
|
@ -1133,9 +1133,6 @@ struct GWL_Display {
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
GWL_LibDecor_System *libdecor = nullptr;
|
GWL_LibDecor_System *libdecor = nullptr;
|
||||||
bool libdecor_required = false;
|
bool libdecor_required = false;
|
||||||
#endif
|
|
||||||
#ifdef USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
bool xdg_decor_ignore_initial_window_size = false;
|
|
||||||
#endif
|
#endif
|
||||||
GWL_XDG_Decor_System *xdg_decor = nullptr;
|
GWL_XDG_Decor_System *xdg_decor = nullptr;
|
||||||
|
|
||||||
|
@ -6031,18 +6028,11 @@ static void global_handle_add(void *data,
|
||||||
else {
|
else {
|
||||||
/* Not found. */
|
/* Not found. */
|
||||||
#ifdef USE_GNOME_NEEDS_LIBDECOR_HACK
|
#ifdef USE_GNOME_NEEDS_LIBDECOR_HACK
|
||||||
/* `gtk_shell1` at time of writing. */
|
if (STRPREFIX(interface, "gtk_shell")) { /* `gtk_shell1` at time of writing. */
|
||||||
if (STRPREFIX(interface, "gtk_shell")) {
|
|
||||||
/* Only require `libdecor` when built with X11 support,
|
/* Only require `libdecor` when built with X11 support,
|
||||||
* otherwise there is nothing to fall back on. */
|
* otherwise there is nothing to fall back on. */
|
||||||
display->libdecor_required = true;
|
display->libdecor_required = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
/* `org_kde_plasma_shell` at time of writing. */
|
|
||||||
if (STRPREFIX(interface, "org_kde_plasma_shell")) {
|
|
||||||
display->xdg_decor_ignore_initial_window_size = true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7674,13 +7664,6 @@ zxdg_decoration_manager_v1 *GHOST_SystemWayland::xdg_decor_manager_get()
|
||||||
return display_->xdg_decor->manager;
|
return display_->xdg_decor->manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
bool GHOST_SystemWayland::xdg_decor_needs_window_size_hack() const
|
|
||||||
{
|
|
||||||
return display_->xdg_decor_ignore_initial_window_size;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* End `xdg_decor`. */
|
/* End `xdg_decor`. */
|
||||||
|
|
||||||
const std::vector<GWL_Output *> &GHOST_SystemWayland::outputs_get() const
|
const std::vector<GWL_Output *> &GHOST_SystemWayland::outputs_get() const
|
||||||
|
@ -7688,20 +7671,6 @@ const std::vector<GWL_Output *> &GHOST_SystemWayland::outputs_get() const
|
||||||
return display_->outputs;
|
return display_->outputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GWL_Output *GHOST_SystemWayland::outputs_get_max_native_size() const
|
|
||||||
{
|
|
||||||
uint64_t area_best = 0;
|
|
||||||
const GWL_Output *output_best = nullptr;
|
|
||||||
for (const GWL_Output *output : display_->outputs) {
|
|
||||||
const uint64_t area_test = (uint64_t)output->size_native[0] * (uint64_t)output->size_native[1];
|
|
||||||
if (output_best == nullptr || area_best < area_test) {
|
|
||||||
output_best = output;
|
|
||||||
area_best = area_test;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return output_best;
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_shm *GHOST_SystemWayland::wl_shm_get() const
|
wl_shm *GHOST_SystemWayland::wl_shm_get() const
|
||||||
{
|
{
|
||||||
return display_->wl.shm;
|
return display_->wl.shm;
|
||||||
|
|
|
@ -230,14 +230,9 @@ class GHOST_SystemWayland : public GHOST_System {
|
||||||
#endif
|
#endif
|
||||||
struct xdg_wm_base *xdg_decor_shell_get();
|
struct xdg_wm_base *xdg_decor_shell_get();
|
||||||
struct zxdg_decoration_manager_v1 *xdg_decor_manager_get();
|
struct zxdg_decoration_manager_v1 *xdg_decor_manager_get();
|
||||||
#ifdef USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
bool xdg_decor_needs_window_size_hack() const;
|
|
||||||
#endif
|
|
||||||
/* End `xdg_decor`. */
|
/* End `xdg_decor`. */
|
||||||
|
|
||||||
const std::vector<GWL_Output *> &outputs_get() const;
|
const std::vector<GWL_Output *> &outputs_get() const;
|
||||||
/** Return the output with the largest pixel-area. */
|
|
||||||
const GWL_Output *outputs_get_max_native_size() const;
|
|
||||||
|
|
||||||
struct wl_shm *wl_shm_get() const;
|
struct wl_shm *wl_shm_get() const;
|
||||||
|
|
||||||
|
|
|
@ -103,9 +103,6 @@ struct WGL_XDG_Decor_Window {
|
||||||
|
|
||||||
/** The window has been configured (see #xdg_surface_ack_configure). */
|
/** The window has been configured (see #xdg_surface_ack_configure). */
|
||||||
bool initial_configure_seen = false;
|
bool initial_configure_seen = false;
|
||||||
#ifdef USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
bool initial_configure_seen_with_size = false;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gwl_xdg_decor_window_destroy(WGL_XDG_Decor_Window *decor)
|
static void gwl_xdg_decor_window_destroy(WGL_XDG_Decor_Window *decor)
|
||||||
|
@ -991,8 +988,11 @@ static int outputs_uniform_scale_or_default(const std::vector<GWL_Output *> &out
|
||||||
static CLG_LogRef LOG_WL_XDG_TOPLEVEL = {"ghost.wl.handle.xdg_toplevel"};
|
static CLG_LogRef LOG_WL_XDG_TOPLEVEL = {"ghost.wl.handle.xdg_toplevel"};
|
||||||
#define LOG (&LOG_WL_XDG_TOPLEVEL)
|
#define LOG (&LOG_WL_XDG_TOPLEVEL)
|
||||||
|
|
||||||
static void xdg_toplevel_handle_configure(
|
static void xdg_toplevel_handle_configure(void *data,
|
||||||
void *data, xdg_toplevel * /*xdg_toplevel*/, int32_t width, int32_t height, wl_array *states)
|
xdg_toplevel * /*xdg_toplevel*/,
|
||||||
|
const int32_t width,
|
||||||
|
const int32_t height,
|
||||||
|
wl_array *states)
|
||||||
{
|
{
|
||||||
/* TODO: log `states`, not urgent. */
|
/* TODO: log `states`, not urgent. */
|
||||||
CLOG_INFO(LOG, 2, "configure (size=[%d, %d])", width, height);
|
CLOG_INFO(LOG, 2, "configure (size=[%d, %d])", width, height);
|
||||||
|
@ -1003,6 +1003,17 @@ static void xdg_toplevel_handle_configure(
|
||||||
std::lock_guard lock_frame_guard{win->frame_pending_mutex};
|
std::lock_guard lock_frame_guard{win->frame_pending_mutex};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const int32_t size[2] = {width, height};
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
if (size[i] == 0) {
|
||||||
|
/* Values may be zero, in this case the client should choose. */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
win->frame_pending.size[i] = win->frame.fractional_scale ?
|
||||||
|
gwl_window_fractional_to_viewport_round(win->frame, size[i]) :
|
||||||
|
(size[i] * win->frame.buffer_scale);
|
||||||
|
}
|
||||||
|
|
||||||
win->frame_pending.is_maximised = false;
|
win->frame_pending.is_maximised = false;
|
||||||
win->frame_pending.is_fullscreen = false;
|
win->frame_pending.is_fullscreen = false;
|
||||||
win->frame_pending.is_active = false;
|
win->frame_pending.is_active = false;
|
||||||
|
@ -1023,46 +1034,6 @@ static void xdg_toplevel_handle_configure(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
if (width || height) {
|
|
||||||
WGL_XDG_Decor_Window &decor = *win->xdg_decor;
|
|
||||||
if (decor.initial_configure_seen_with_size == false) {
|
|
||||||
if (win->ghost_system->xdg_decor_needs_window_size_hack() &&
|
|
||||||
(decor.mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) &&
|
|
||||||
(win->frame_pending.is_maximised == false &&
|
|
||||||
win->frame_pending.is_fullscreen == false) &&
|
|
||||||
/* Account for the initial size being smaller. */
|
|
||||||
((width <= win->frame.size[0]) && (height <= win->frame.size[1])))
|
|
||||||
{
|
|
||||||
/* Fail safe, check the window is *not* larger than all available outputs
|
|
||||||
* as this could cause files saved on other peoples systems to create
|
|
||||||
* unreasonably large windows. */
|
|
||||||
const GWL_Output *output_big = win->ghost_system->outputs_get_max_native_size();
|
|
||||||
if (output_big &&
|
|
||||||
((output_big->size_native[0] < width) || (output_big->size_native[1] < height))) {
|
|
||||||
/* Pass, the window exceeds the size of the largest output, ignore initial size. */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
width = win->frame.size[0];
|
|
||||||
height = win->frame.size[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
decor.initial_configure_seen_with_size = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* USE_XDG_INIT_WINDOW_SIZE_HACK */
|
|
||||||
|
|
||||||
const int32_t size[2] = {width, height};
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
if (size[i] == 0) {
|
|
||||||
/* Values may be zero, in this case the client should choose. */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
win->frame_pending.size[i] = win->frame.fractional_scale ?
|
|
||||||
gwl_window_fractional_to_viewport_round(win->frame, size[i]) :
|
|
||||||
(size[i] * win->frame.buffer_scale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_toplevel_handle_close(void *data, xdg_toplevel * /*xdg_toplevel*/)
|
static void xdg_toplevel_handle_close(void *data, xdg_toplevel * /*xdg_toplevel*/)
|
||||||
|
|
|
@ -54,14 +54,6 @@
|
||||||
*/
|
*/
|
||||||
#define USE_EVENT_BACKGROUND_THREAD
|
#define USE_EVENT_BACKGROUND_THREAD
|
||||||
|
|
||||||
/**
|
|
||||||
* Hack for KDE where the initial window size includes window decorations (title-bar, borders etc),
|
|
||||||
* making the usable region smaller than requested. As the size of decorations is unknown:
|
|
||||||
* account for this by ignoring the initial size and using the size requested from GHOST instead
|
|
||||||
* (with some exceptions & sanity checks for overly large windows), see: #113059.
|
|
||||||
*/
|
|
||||||
#define USE_XDG_INIT_WINDOW_SIZE_HACK
|
|
||||||
|
|
||||||
class GHOST_SystemWayland;
|
class GHOST_SystemWayland;
|
||||||
|
|
||||||
struct GWL_Output;
|
struct GWL_Output;
|
||||||
|
|
Loading…
Reference in New Issue