From: Michael D. Lowis Date: Tue, 13 Aug 2024 03:46:51 +0000 (-0400) Subject: added flag enums to atoms.h X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=68979365306085148c0f79e2966ca21c696f0602;p=proto%2Fanvil.git added flag enums to atoms.h --- diff --git a/anvil.h b/anvil.h index e41d675..b482b9b 100644 --- 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 93b1eba..f3693da 100644 --- 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); diff --git a/client.c b/client.c index 081137b..4c2ebe7 100644 --- 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 3e0b9ae..1d63ddb 100644 --- a/ewmh.c +++ b/ewmh.c @@ -11,33 +11,6 @@ // 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) diff --git a/genatoms.rb b/genatoms.rb index d5783a8..1495c7d 100755 --- a/genatoms.rb +++ b/genatoms.rb @@ -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