FLTK logo

[master] 50184f9 - Fix "Callback or event on minimize of the main window" for X11 platform (#1288)

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

[master] 50184f9 - Fix "Callback or event on minimize of the main window" for X11 platform (#1288) "ManoloFLTK" Aug 03, 2025  
 
commit 50184f994699a19185a2c3e73861bb13f5579d23
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Sun Aug 3 09:03:12 2025 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Sun Aug 3 09:03:12 2025 +0200

    Fix "Callback or event on minimize of the main window" for X11 platform (#1288)

 src/Fl_x.cxx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git src/Fl_x.cxx src/Fl_x.cxx
index 81a6916..fed46a6 100644
--- src/Fl_x.cxx
+++ src/Fl_x.cxx
@@ -202,6 +202,7 @@ static Atom fl_NET_WM_STATE;
 static Atom fl_NET_WM_STATE_FULLSCREEN;
 static Atom fl_NET_WM_STATE_MAXIMIZED_VERT;
 static Atom fl_NET_WM_STATE_MAXIMIZED_HORZ;
+static Atom fl_NET_WM_STATE_HIDDEN;
 static Atom fl_NET_WM_FULLSCREEN_MONITORS;
 Atom fl_NET_WORKAREA;
 static Atom fl_NET_WM_ICON;
@@ -602,6 +603,7 @@ void open_display_i(Display* d) {
   fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0);
   fl_NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(d, "_NET_WM_STATE_MAXIMIZED_VERT", 0);
   fl_NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(d, "_NET_WM_STATE_MAXIMIZED_HORZ", 0);
+  fl_NET_WM_STATE_HIDDEN = XInternAtom(d, "_NET_WM_STATE_HIDDEN",  0);
   fl_NET_WM_FULLSCREEN_MONITORS = XInternAtom(d, "_NET_WM_FULLSCREEN_MONITORS", 0);
   fl_NET_WORKAREA       = XInternAtom(d, "_NET_WORKAREA",       0);
   fl_NET_WM_ICON        = XInternAtom(d, "_NET_WM_ICON",        0);
@@ -2125,6 +2127,7 @@ int fl_handle(const XEvent& thisevent)
     if (xevent.xproperty.atom == fl_NET_WM_STATE) {
       int fullscreen_state = 0;
       int maximize_state = 0;
+      int minimize_state = 0;
       if (xevent.xproperty.state != PropertyDelete) {
         unsigned long nitems;
         unsigned long *words = 0;
@@ -2136,6 +2139,9 @@ int fl_handle(const XEvent& thisevent)
             if (words[item] == fl_NET_WM_STATE_MAXIMIZED_HORZ) {
               maximize_state = 1;
             }
+            if (words[item] == fl_NET_WM_STATE_HIDDEN) {
+              minimize_state = 1;
+            }
           }
         }
         if ( words ) { XFree(words); words = 0; }
@@ -2149,6 +2155,13 @@ int fl_handle(const XEvent& thisevent)
         window->_set_fullscreen();
         event = FL_FULLSCREEN;
       }
+      if (!event) {
+        if (minimize_state) {
+          event = FL_HIDE;
+        } else if (!window->visible()) {
+          event = FL_SHOW;
+        }
+      }
     }
     break;
 
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

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