]> git.mdlowis.com Git - proto/anvil.git/commitdiff
added flag enums to atoms.h
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 13 Aug 2024 03:46:51 +0000 (23:46 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 13 Aug 2024 03:46:51 +0000 (23:46 -0400)
anvil.h
atoms.h
client.c
ewmh.c
genatoms.rb

diff --git a/anvil.h b/anvil.h
index e41d6753b3af52ede6a6eed92b344ec3992d61b4..b482b9b5676d2d4df4a8bdd765fe17ee5c70a4a3 100644 (file)
--- a/anvil.h
+++ b/anvil.h
@@ -73,18 +73,18 @@ enum {
     F_SHADED      = (1 << 4),
     F_NO_FRAME    = (1 << 5),
 
-    F_STATE_MODAL             = (1 << 0),
-    F_STATE_STICKY            = (1 << 1),
-    F_STATE_MAXIMIZED_VERT    = (1 << 2),
-    F_STATE_MAXIMIZED_HORZ    = (1 << 3),
-    F_STATE_SHADED            = (1 << 4),
-    F_STATE_SKIP_TASKBAR      = (1 << 5),
-    F_STATE_SKIP_PAGER        = (1 << 6),
-    F_STATE_HIDDEN            = (1 << 7),
-    F_STATE_FULLSCREEN        = (1 << 8),
-    F_STATE_ABOVE             = (1 << 9),
-    F_STATE_BELOW             = (1 << 10),
-    F_STATE_DEMANDS_ATTENTION = (1 << 11),
+//    F_STATE_MODAL             = (1 << 0),
+//    F_STATE_STICKY            = (1 << 1),
+//    F_STATE_MAXIMIZED_VERT    = (1 << 2),
+//    F_STATE_MAXIMIZED_HORZ    = (1 << 3),
+//    F_STATE_SHADED            = (1 << 4),
+//    F_STATE_SKIP_TASKBAR      = (1 << 5),
+//    F_STATE_SKIP_PAGER        = (1 << 6),
+//    F_STATE_HIDDEN            = (1 << 7),
+//    F_STATE_FULLSCREEN        = (1 << 8),
+//    F_STATE_ABOVE             = (1 << 9),
+//    F_STATE_BELOW             = (1 << 10),
+//    F_STATE_DEMANDS_ATTENTION = (1 << 11),
 };
 
 typedef struct Node {
@@ -97,10 +97,13 @@ typedef struct Client {
     struct Client* col_prev;
     char* name;
     Window frame, win, transient_for;
-    int wm_types;
-    int wm_state;
 
-    int state, flags, wspace, x, y, w, h, rel_x, rel_y;
+    int client_state;   // ICCM Client State Flag
+    int wm_types;       // EWMH Window Type Flags
+    int wm_state;       // EWMH Window State Flags
+    int wm_protos;      // ICCM/EWMH Protocols
+
+    int flags, wspace, x, y, w, h, rel_x, rel_y;
     long hint_flags, wm_flags;
     XWMHints hints;
     XSizeHints size_hints;
diff --git a/atoms.h b/atoms.h
index 93b1eba9b2f4143ba84e03fafa4e7197e8968570..f3693da705c286b747190c94071922e584cfaf02 100644 (file)
--- a/atoms.h
+++ b/atoms.h
@@ -35,6 +35,34 @@ extern Atom _NET_WM_STATE_BELOW;
 extern Atom _NET_WM_STATE_DEMANDS_ATTENTION;
 
 extern Atom WindowType[8];
+
+enum WindowType {
+    F_NET_WM_WINDOW_TYPE_DESKTOP = (1 << 0),
+    F_NET_WM_WINDOW_TYPE_DOCK = (1 << 1),
+    F_NET_WM_WINDOW_TYPE_TOOLBAR = (1 << 2),
+    F_NET_WM_WINDOW_TYPE_MENU = (1 << 3),
+    F_NET_WM_WINDOW_TYPE_UTILITY = (1 << 4),
+    F_NET_WM_WINDOW_TYPE_SPLASH = (1 << 5),
+    F_NET_WM_WINDOW_TYPE_DIALOG = (1 << 6),
+    F_NET_WM_WINDOW_TYPE_NORMAL = (1 << 7),
+};
+
 extern Atom WindowState[12];
 
+enum WindowState {
+    F_NET_WM_STATE_MODAL = (1 << 0),
+    F_NET_WM_STATE_STICKY = (1 << 1),
+    F_NET_WM_STATE_MAXIMIZED_VERT = (1 << 2),
+    F_NET_WM_STATE_MAXIMIZED_HORZ = (1 << 3),
+    F_NET_WM_STATE_SHADED = (1 << 4),
+    F_NET_WM_STATE_SKIP_TASKBAR = (1 << 5),
+    F_NET_WM_STATE_SKIP_PAGER = (1 << 6),
+    F_NET_WM_STATE_HIDDEN = (1 << 7),
+    F_NET_WM_STATE_FULLSCREEN = (1 << 8),
+    F_NET_WM_STATE_ABOVE = (1 << 9),
+    F_NET_WM_STATE_BELOW = (1 << 10),
+    F_NET_WM_STATE_DEMANDS_ATTENTION = (1 << 11),
+};
+
+
 void Atoms_Init(void);
index 081137b7dacd13e573ec5a6f8cb1c77bf2b75e8f..4c2ebe70c376cd6c186d2ce222b6f3ed3c0b566d 100644 (file)
--- a/client.c
+++ b/client.c
@@ -265,7 +265,7 @@ void Client_UpdateAll(void)
         int wspace_active = ((wspace_mask & (1 << c->wspace)) != 0);
         printf("(0x%x & 0x%x) != 0 == %d\n", wspace_mask, (1 << c->wspace), wspace_active);
 
-        if (wspace_active && (c->state != WithdrawnState))
+        if (wspace_active && (c->client_state != WithdrawnState))
         {
             printf("Show 0x%lx\n", c->win);
             Client_Show(c);
@@ -490,7 +490,7 @@ static void SendMessage(Window win, Atom proto, Atom type)
 static void SetWMState(Client *c, int state)
 {
     CARD32 data[2] = {state, None};
-    c->state = state;
+    c->client_state = state;
     XChangeProperty(X.disp, c->win, WM_STATE, WM_STATE, 32, PropModeReplace, (unsigned char *)data, 2);
 }
 
diff --git a/ewmh.c b/ewmh.c
index 3e0b9aed955c2d65483d337588baefa5e7cd7ace..1d63ddbe5f9793dc29e65a3fcee8b05afeed384e 100644 (file)
--- a/ewmh.c
+++ b/ewmh.c
 //    NetWMWindowTypeDialog,
 //    NetClientList,
 
-//static Atom* WindowTypes[] = {
-//    &_NET_WM_WINDOW_TYPE,
-//    &_NET_WM_WINDOW_TYPE_DESKTOP,
-//    &_NET_WM_WINDOW_TYPE_DOCK,
-//    &_NET_WM_WINDOW_TYPE_TOOLBAR,
-//    &_NET_WM_WINDOW_TYPE_MENU,
-//    &_NET_WM_WINDOW_TYPE_UTILITY,
-//    &_NET_WM_WINDOW_TYPE_SPLASH,
-//    &_NET_WM_WINDOW_TYPE_DIALOG,
-//    &_NET_WM_WINDOW_TYPE_NORMAL,
-//};
-
-//static Atom* WindowStates[] = {
-//    &_NET_WM_STATE_MODAL,
-//    &_NET_WM_STATE_STICKY,
-//    &_NET_WM_STATE_MAXIMIZED_VERT,
-//    &_NET_WM_STATE_MAXIMIZED_HORZ,
-//    &_NET_WM_STATE_SHADED,
-//    &_NET_WM_STATE_SKIP_TASKBAR,
-//    &_NET_WM_STATE_SKIP_PAGER,
-//    &_NET_WM_STATE_HIDDEN,
-//    &_NET_WM_STATE_FULLSCREEN,
-//    &_NET_WM_STATE_ABOVE,
-//    &_NET_WM_STATE_BELOW,
-//    &_NET_WM_STATE_DEMANDS_ATTENTION,
-//};
-
 static void ReplaceProp(Window w, Atom prop, Atom type, void* elems, int nelems, int format)
 {
     XChangeProperty(
@@ -96,14 +69,6 @@ static void WriteFlagHint(Window w, Atom hint, Atom* known, unsigned long nknown
     }
 }
 
-/*
-    We might not use these properties?
-
-    _NET_VIRTUAL_ROOTS
-    _NET_DESKTOP_LAYOUT
-    _NET_SHOWING_DESKTOP
-*/
-
 /*
     Client messages to root we may need to listen for
 
@@ -111,31 +76,14 @@ static void WriteFlagHint(Window w, Atom hint, Atom* known, unsigned long nknown
 
 */
 
-/*
-    Protocols we do not intend to support...
-
-    _NET_WM_PING
-    _NET_WM_SYNC_REQUEST
-*/
-
-
 void EWMH_Init(void)
 {
     // Write _NET_SUPPORTED - array of all hints we support...
-    // Write _NET_NUMBER_OF_DESKTOPS - total number of workspaces (10)
-    // Write _NET_DESKTOP_NAMES - names of workspaces...
-    // Write _NET_DESKTOP_VIEWPORT - always 0,0. write it here
-
-    // _NET_SUPPORTING_WM_CHECK
-        // Set this to the id of a window we create and own
-        // Set _NET_WM_NAME on said window to name of WM
-        // Tells clients we are alive and kicking...
 }
 
 void EWMH_SetClientList(void)
 {
     // Write _NET_CLIENT_LIST - initial mapping order
-    // Write _NET_CLIENT_LIST_Stacking - bottom-to-top order
 }
 
 void EWMH_SetActiveWindow(Window w)
index d5783a89f39cece59f0df8e0300070debaa7751e..1495c7dad8e430c2c32c408981e0b5abb99a2d25 100755 (executable)
@@ -25,6 +25,10 @@ end
 HDR.puts ""
 $cats.each do |cat, vals|
   HDR.puts "extern Atom #{cat}[#{vals.length}];"
+  HDR.puts "\nenum #{cat} {"
+  vals.each_with_index {|e,i| HDR.puts "    F#{e} = (1 << #{i})," }
+  HDR.puts "};\n\n"
+
   SRC.puts "Atom #{cat}[#{vals.length}];"
 end
 SRC.puts ""
@@ -46,10 +50,3 @@ $atoms.each do |atom,val|
 end
 
 SRC.puts "}"
-
-
-SRC
-
-
-pp $atoms
-pp $cats