FLTK logo

[master] 02754e4 - Fix Fl_Window::decorated_w() in some X11 situations.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 02754e4 - Fix Fl_Window::decorated_w() in some X11 situations. "ManoloFLTK" Nov 17, 2021  
 
commit 02754e43ceb2d1d7a20b706c90d5aa9b2f6a95ad
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Wed Nov 17 14:58:45 2021 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed Nov 17 15:00:21 2021 +0100

    Fix Fl_Window::decorated_w() in some X11 situations.

 src/drivers/X11/Fl_X11_Window_Driver.cxx | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git src/drivers/X11/Fl_X11_Window_Driver.cxx src/drivers/X11/Fl_X11_Window_Driver.cxx
index ab15f27..5dea0fb 100644
--- src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ 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;
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.