]> git.mdlowis.com Git - proto/anvil.git/commitdiff
Added reading and partial handling of transient_for hint. These are dialogs that...
authorMike Lowis <mike.lowis@gentex.com>
Wed, 7 Aug 2024 20:31:11 +0000 (16:31 -0400)
committerMike Lowis <mike.lowis@gentex.com>
Wed, 7 Aug 2024 20:31:11 +0000 (16:31 -0400)
anvil.h
client.c

diff --git a/anvil.h b/anvil.h
index a020dd9a6f8cc855449ee1bee67483464e72cbd0..e086b8f59577887ea1984ce09d50d41e290b6dc0 100644 (file)
--- a/anvil.h
+++ b/anvil.h
@@ -81,7 +81,7 @@ typedef struct Client {
     struct Client* col_next;
     struct Client* col_prev;
     char* name;
-    Window frame, win;
+    Window frame, win, transient_for;
     int state, flags, wspace, x, y, w, h, rel_x, rel_y;
     long hint_flags, wm_flags;
     XWMHints hints;
index b4b7e01ecfb8c3e968019725c779e49929fbf224..4139f7b2b6d161437981489a50cee089319d59a6 100644 (file)
--- a/client.c
+++ b/client.c
@@ -333,7 +333,8 @@ static void ReadProps(Client* c)
     // TODO: Read the class and instance of the window
 
     /* WM_TRANSIENT_FOR - marks the window as a pop-up for another window */
-    // TODO: read the transient_for property and use ti to handle pop-ups better
+    c->transient_for = None;
+    XGetTransientForHint(X.disp, c->win, &(c->transient_for));
 
     /* WM_CLIENT_MACHINE - */
     // TODO: read client machine property
@@ -341,7 +342,7 @@ static void ReadProps(Client* c)
     /* check if the window is a dialog */
     XGetWindowProperty(
         X.disp, c->win, _NET_WM_WINDOW_TYPE, 0L, -1, False, XA_ATOM, &actual_type, &format, &n, &extra, (unsigned char **)&wintype);
-    if (wintype && *wintype == _NET_WM_WINDOW_TYPE_DIALOG)
+    if ((wintype && *wintype == _NET_WM_WINDOW_TYPE_DIALOG) || (c->transient_for != None))
     {
         c->flags |= F_DIALOG|F_FLOATING;
     }
@@ -442,7 +443,6 @@ static int MonitorOverlap(Monitor* mon, Client* c)
     int top   = max(ctop, mon->y);
     int bot   = min(cbot, mon->y + mon->h);
 
-
     /* return the overlapped area */
     int area = 0;
     if (left < right && top < bot)