summaryrefslogtreecommitdiff
path: root/src/drivers/X11/Fl_X11_Window_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-11-17 14:58:45 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-11-17 15:00:21 +0100
commit02754e43ceb2d1d7a20b706c90d5aa9b2f6a95ad (patch)
treefde5946f69f32e33ce587f5dac9ac5250ed485c8 /src/drivers/X11/Fl_X11_Window_Driver.cxx
parent55f3df268c0f6e2fabc055bef51c195e51dd8716 (diff)
Fix Fl_Window::decorated_w() in some X11 situations.
Diffstat (limited to 'src/drivers/X11/Fl_X11_Window_Driver.cxx')
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index ab15f275c..5dea0fb29 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -159,6 +159,15 @@ void Fl_X11_Window_Driver::decorated_win_size(int &w, int &h)
if (status == 0 || root == parent) return;
XWindowAttributes attributes;
XGetWindowAttributes(fl_display, parent, &attributes);
+ // sometimes, very wide window borders are reported
+ // ignore them all:
+ XWindowAttributes w_attributes;
+ XGetWindowAttributes(fl_display, Fl_X::i(win)->xid, &w_attributes);
+ if (attributes.width - w_attributes.width >= 20) {
+ attributes.height -= (attributes.width - w_attributes.width);
+ attributes.width = w_attributes.width;
+ }
+
int nscreen = screen_num();
float s = Fl::screen_driver()->scale(nscreen);
w = attributes.width / s;