From 0aadcf56d9911db9488756adcbbff21e920f0dd7 Mon Sep 17 00:00:00 2001 From: Joseph <119084558+DerjenigeUberMensch@users.noreply.github.com> Date: Tue, 4 Jun 2024 01:49:12 +0000 Subject: [PATCH] Add files via upload --- dwm.c | 424 +++++++++++++++++++++++++--------------------------------- dwm.h | 27 ++-- 2 files changed, 192 insertions(+), 259 deletions(-) diff --git a/dwm.c b/dwm.c index ccf3b6b..60be1f6 100644 --- a/dwm.c +++ b/dwm.c @@ -53,7 +53,6 @@ int ISALWAYSONTOP(Client *c) { return c->wstateflags & _STATE_ABOVE; } int ISALWAYSONBOTTOM(Client *c) { return c->wstateflags & _STATE_BELOW; } int WASFLOATING(Client *c) { return c->flags & _FSTATE_WASFLOATING; } int ISFLOATING(Client *c) { return c->flags & _FSTATE_FLOATING; } -/* used in __cmp calculation when restacking */ int ISFAKEFLOATING(Client *c) { return c->flags & _FSTATE_FLOATING || c->desktop->layout == Floating; } int WASDOCKEDVERT(Client *c) { const i16 wy = c->desktop->mon->wy; @@ -139,7 +138,7 @@ int HASWMTAKEFOCUS(Client *c) { return c->wstateflags & _STATE_SUPPORTED_WM_TA int HASWMSAVEYOURSELF(Client *c){ return c->wstateflags & _STATE_SUPPORTED_WM_SAVE_YOURSELF; } int HASWMDELETEWINDOW(Client *c){ return c->wstateflags & _STATE_SUPPORTED_WM_DELETE_WINDOW; } -enum BarSides GETBARSIDE(Monitor *m, Bar *bar) +enum BarSides GETBARSIDE(Monitor *m, Client *bar) { const u8 sidebar = bar->w < bar->h; const u8 left = bar->x + bar->w / 2 <= m->mx + m->mw / 2; @@ -399,13 +398,17 @@ arrangeq(Desktop *desk) workingdesk = desk; } arrangedesktop(desk); - reorder(desk); } void arrange(Desktop *desk) { + /* bar stuff */ + updatebargeom(desk->mon); + updatebarpos(desk->mon); + arrangeq(desk); + reorder(desk); restack(desk); } @@ -449,6 +452,31 @@ arrangedesktop(Desktop *desk) /* prevent circular linked list */ \ STRUCT->PREV = NULL; \ } while(0) +#define __attach_after(START, AFTER, NEXT, PREV, HEAD, LAST) do \ + { \ + AFTER->NEXT = START->NEXT; \ + AFTER->PREV = START; \ + if(!START->NEXT) \ + { LAST = START; \ + } \ + else \ + { START->NEXT->PREV = AFTER; \ + } \ + START->NEXT = AFTER; \ + } while(0) +#define __attach_before(START, BEFORE, NEXT, PREV, HEAD, LAST, ATTACH) do \ + { \ + if(!START->PREV) \ + { ATTACH(BEFORE); \ + } \ + else \ + { \ + BEFORE->PREV = START->PREV; \ + BEFORE->NEXT = START; \ + START->PREV->NEXT = BEFORE; \ + START->PREV = BEFORE; \ + } \ + } while(0) /* Too hard to implement */ /* @@ -472,32 +500,6 @@ arrangedesktop(Desktop *desk) STRUCT->PREV = NULL; \ } while(0) */ - -#define __attach_after(START, AFTER, NEXT, PREV, HEAD, LAST) do \ - { \ - AFTER->NEXT = START->NEXT; \ - AFTER->PREV = START; \ - if(!START->NEXT) \ - { LAST = START; \ - } \ - else \ - { START->NEXT->PREV = AFTER; \ - } \ - START->NEXT = AFTER; \ - } while(0) -#define __attach_before(START, BEFORE, NEXT, PREV, HEAD, ATTACH) do \ - { \ - if(!START->PREV) \ - { ATTACH(BEFORE); \ - } \ - else \ - { \ - BEFORE->PREV = START->PREV; \ - BEFORE->NEXT = START; \ - START->PREV->NEXT = BEFORE; \ - START->PREV = BEFORE; \ - } \ - } while(0) void attach(Client *c) { @@ -542,6 +544,11 @@ attachrestack(Client *c) __attach_helper(c, desktop->rstack, rnext, rprev, desktop->rlast); } +void +attachfocus(Client *c) +{ + __attach_helper(c, desktop->focus, fnext, fprev, desktop->flast); +} void attachfocusafter(Client *start, Client *after) @@ -556,13 +563,7 @@ attachfocusbefore(Client *start, Client *after) { Desktop *desk = start->desktop; detachfocus(after); - __attach_before(start, after, fnext, fprev, desk->focus, attachfocus); -} - -void -attachfocus(Client *c) -{ - __attach_helper(c, desktop->focus, fnext, fprev, desktop->flast); + __attach_before(start, after, fnext, fprev, desk->focus, desk->slast, attachfocus); } void @@ -873,7 +874,6 @@ cleanupmon(Monitor *m) desk = desknext; } HASH_CLEAR(hh, m->__hash); - free(m->bar); free(m); m = NULL; } @@ -1015,26 +1015,6 @@ createclient(void) return c; } -Bar * -createbar(void) -{ - Bar *bar = ecalloc(1, sizeof(Bar)); - - if(!bar) - { /* bar is not important enough to stop operation. */ - DEBUG0("Failed to init bar."); - return NULL; - } - - bar->x = 0; - bar->y = 0; - bar->h = 0; - bar->w = 0; - bar->win = 0; - bar->flags = 0; - return bar; -} - Desktop * createdesktop(void) { @@ -1079,14 +1059,8 @@ createmon(void) m->deskcount = 1; setdesktopcount(m, 10); m->desksel = m->desktops; - m->bar = calloc(1, sizeof(Bar )); + m->bar = NULL; m->__hash = NULL; - if(!m->bar) - { - DEBUG0("(OutOfMemory) Failed to create bar."); - cleanupmon(m); - return NULL; - } return m; } @@ -1504,7 +1478,7 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT]) return NULL; } /* barwin checks */ - u8 checkbar = !_wm.selmon->bar->win; + u8 checkbar = !_wm.selmon->bar; const u16 bw = 0; const u32 bcol = 0; @@ -1581,18 +1555,6 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT]) getnamefromreply(netwmnamereply, &netwmname); getnamefromreply(wmnamereply, &wmname); - if(checkbar && COULDBEBAR(c, strutp || strut)) - { - Bar *bar = managebar(_wm.selmon, win); - if(bar) - { resizebar(bar, c->x, c->y, c->w, c->h); - } - free(c); - c = NULL; - DEBUG("Found a bar: [%d]", win); - goto CLEANUP; - } - /* Custom stuff */ setclientpid(c, pid); setborderwidth(c, bw); @@ -1619,25 +1581,30 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT]) updateclientlist(win, ClientListAdd); setclientstate(c, XCB_WINDOW_NORMAL_STATE); - if(c->desktop == _wm.selmon->desksel) - { unfocus(_wm.selmon->desksel->sel, 0); + if(c->desktop) + { HASH_ADD_INT(c->desktop->mon->__hash, win, c); } - if(!ISFLOATING(c)) - { - if(trans || DOCKED(c)) - { setfloating(c, 1); - } + if(checkbar && COULDBEBAR(c, strutp || strut)) + { + detachcompletely(c); + setborderwidth(c, 0); + configure(c); + c->desktop->mon->bar = c; + c = NULL; + DEBUG("Found a bar: [%d]", win); + goto CLEANUP; + } + + if(trans || DOCKED(c)) + { setfloating(c, 1); } /* inherit previous client state */ if(c->desktop && c->desktop->sel) { setfullscreen(c, ISFULLSCREEN(c->desktop->sel) || ISFULLSCREEN(c)); } - if(c->desktop) - { HASH_ADD_INT(c->desktop->mon->__hash, win, c); - } /* propagates border_width, if size doesn't change */ - configure(c); + configure(c); goto CLEANUP; FAILURE: free(c); @@ -1661,34 +1628,6 @@ managereply(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT]) return c; } -Bar * -managebar(Monitor *m, XCBWindow win) -{ - const u32 inputmask = XCB_EVENT_MASK_ENTER_WINDOW|XCB_EVENT_MASK_FOCUS_CHANGE|XCB_EVENT_MASK_PROPERTY_CHANGE|XCB_EVENT_MASK_STRUCTURE_NOTIFY; - - if(!win) - { return NULL; - } - if(!m->bar) - { m->bar = createbar(); - DEBUG0("No bar alloced this should not be possible"); - } - if(!m->bar) - { return NULL; - } - m->bar->win = win; - - DEBUG("New bar: [%d]", win); - setshowbar(m->bar, 1); - updatebargeom(_wm.selmon); - updatebarpos(_wm.selmon); - arrangemon(m); - XCBSelectInput(_wm.dpy, win, inputmask); - updateclientlist(win, ClientListAdd); - XCBMapWindow(_wm.dpy, win); - return m->bar; -} - void maximize(Client *c) { @@ -2182,11 +2121,18 @@ restoremonsession(char *buff, u16 len) } if(pullm) { - Bar *b = wintobar(BarId, 0); + Client *b = wintoclient(BarId); if(b) - { - unmanagebar(b); - managebar(pullm, BarId); + { + if(pullm->bar) + { + XCBWindow win = pullm->bar->win; + unmanage(pullm->bar, 0); + XCBCookie cookies[MANAGE_CLIENT_COOKIE_COUNT]; + managerequest(win, cookies); + managereply(win, cookies); + } + pullm->bar = b; } /* TODO */ setdesktopcount(pullm, DeskCount); @@ -2269,19 +2215,18 @@ resizeclient(Client *c, int16_t x, int16_t y, uint16_t width, uint16_t height) configure(c); } -static int __cmp(Client *c1, Client *c2); void restack(Desktop *desk) { Client *c; - u8 inrestack = 0; u8 config = 0; + u8 instack = 0; XCBWindowChanges wc; wc.stack_mode = XCB_STACK_MODE_BELOW; - if(desk->mon->bar->win && SHOWBAR(desk->mon->bar)) + if(desk->mon->bar && !ISHIDDEN(desk->mon->bar)) { wc.sibling = desk->mon->bar->win; } else @@ -2292,16 +2237,16 @@ restack(Desktop *desk) /* The following works good enough at most ussually 1-5 windows but we could probably bring it down a bit */ for(c = desk->stack; c; c = nextstack(c)) { - /* unattached clients (AKA new clients) have both set to NULL */ - inrestack = c->rprev || c->rnext; + instack = c->rprev || c->rnext; /* Client holds both lists so we just check if the next's are the same if not configure it */ - config = c->rnext != c->snext || !inrestack; - + config = c->rnext != c->snext || !instack; if(config) - { XCBConfigureWindow(_wm.dpy, c->win, XCB_CONFIG_WINDOW_SIBLING|XCB_CONFIG_WINDOW_STACK_MODE, &wc); + { + XCBConfigureWindow(_wm.dpy, c->win, XCB_CONFIG_WINDOW_SIBLING|XCB_CONFIG_WINDOW_STACK_MODE, &wc); DEBUG("Configured window: %s", c->netwmname); } wc.sibling = c->win; + DEBUG("%d", c->rstacknum); } /* TODO find a better way todo this without causing infinite loop issues FIXME */ while(desk->rstack) @@ -2312,72 +2257,11 @@ restack(Desktop *desk) } } -static i32 -__cmp_helper(int32_t x1, int32_t x2) -{ - return x1 < x2; -} - -static int -__cmp(Client *c1, Client *c2) -{ - /* how to return. - * reference point is c1. - * so if c1 has higher priority return 1. - * - * RETURN 1 on higher priority - * RETURN -1 on lesser priority - * RETURN 0 on lesser priority. - */ - /* XOR basically just skips if they both have it and only success if one of them has it AKA compare */ - - const u32 dock1 = ISDOCK(c1); - const u32 dock2 = ISDOCK(c2); - - const u32 above1 = ISALWAYSONTOP(c1); - const u32 above2 = ISALWAYSONTOP(c2); - - const u32 float1 = ISFAKEFLOATING(c1); - const u32 float2 = ISFAKEFLOATING(c2); - - const u32 below1 = ISBELOW(c1); - const u32 below2 = ISBELOW(c2); - - const u32 hidden1 = ISHIDDEN(c1); - const u32 hidden2 = ISHIDDEN(c2); - - if(dock1 ^ dock2) - { return __cmp_helper(dock1, dock2); - } - else if(above1 ^ above2) - { return __cmp_helper(above1, above2); - } - else if(float1 ^ float2) - { return __cmp_helper(float1, float2); - } - else if(below1 ^ below2) - { return __cmp_helper(below1, below2); - } - else if(hidden1 ^ hidden2) - { return __cmp_helper(hidden1, hidden2); - } - - return __cmp_helper(c1->rstacknum, c2->rstacknum); -} - void reorder(Desktop *desk) { - Client *c; - u16 i = 0; - for(c = desk->flast; c; c = prevfocus(c)) - { - c->rstacknum = ++i; - if(ISFLOATING(c) && DOCKED(c)) - { setfloating(c, 0); - } - } - MERGE_SORT_LINKED_LIST(Client, __cmp, desk->stack, desk->slast, snext, sprev, 1, 0); + updatestackpriorityfocus(desk); + MERGE_SORT_LINKED_LIST(Client, stackpriority, desk->stack, desk->slast, snext, sprev, 1, 0); } void @@ -2522,7 +2406,7 @@ savemonsession(FILE *fw, Monitor *m) , IDENTIFIER, m->mx, m->my, m->mw, m->mh, - m->bar->win, + m->bar ? m->bar->win : 0, m->deskcount, m->desksel->num ); @@ -2762,8 +2646,9 @@ setdesktopcount(Monitor *m, uint16_t desktops) if(desk && prevdesktop(desk)) { for(c = desk->clients; c; c = nextclient(c)) - { setclientdesktop(c, prevdesktop(desk)); - } + { + setclientdesktop(c, prevdesktop(desk)); + } tmp = prevdesktop(desk); detachdesktop(m, desk); cleanupdesktop(desk); @@ -2962,8 +2847,7 @@ setfullscreen(Client *c, u8 state) Monitor *m = c->desktop->mon; if(state && !ISFULLSCREEN(c)) { - XCBChangeProperty(_wm.dpy, c->win, netatom[NetWMState], XCB_ATOM_ATOM, 32, - XCB_PROP_MODE_REPLACE, (unsigned char *)&netatom[NetWMStateFullscreen], 1); + XCBChangeProperty(_wm.dpy, c->win, netatom[NetWMState], XCB_ATOM_ATOM, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)&netatom[NetWMStateFullscreen], 1); setborderwidth(c, c->bw); setborderwidth(c, 0); resizeclient(c, m->mx, m->wy, m->mw, m->mh); @@ -2971,8 +2855,7 @@ setfullscreen(Client *c, u8 state) } else if(!state && ISFULLSCREEN(c)) { - XCBChangeProperty(_wm.dpy, c->win, netatom[NetWMState], XCB_ATOM_ATOM, 32, - XCB_PROP_MODE_REPLACE, (unsigned char *)0, 0); + XCBChangeProperty(_wm.dpy, c->win, netatom[NetWMState], XCB_ATOM_ATOM, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)0, 0); setborderwidth(c, c->oldbw); resizeclient(c, c->oldx, c->oldy, c->oldw, c->oldh); } @@ -3156,7 +3039,7 @@ setupcfgdefaults(void) const u16 maxcc = 256; const float mfact = 0.55f; const u16 bw = _wm.selmon->ww; - const u16 bh = _wm.selmon->wh / 10; /* div 10 is roughly the same as the WSWM old default bar height */ + const u16 bh = MAX(_wm.selmon->wh / 30, 15); const i16 bx = _wm.selmon->wx; const i16 by = _wm.selmon->wy + _wm.selmon->wh - bh; /* because a window is a rectangle calculations start at the top left corner, so we need to add the height */ @@ -3201,34 +3084,28 @@ seturgent(Client *c, uint8_t state) void updatedesktop(void) { - i32 data[1] = { _wm.selmon->desksel->num }; - XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetCurrentDesktop], XCB_ATOM_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)data, 1); + u32 data = _wm.selmon->desksel->num; + XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetCurrentDesktop], XCB_ATOM_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)&data, 1); } void updatedesktopnames(void) { - char names[_wm.selmon->deskcount]; - u16 i; - for(i = 0; i < _wm.selmon->deskcount; ++i) - { names[i] = i; - } - XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetDesktopNames], XCB_ATOM_STRING, 8, XCB_PROP_MODE_REPLACE, names, _wm.selmon->deskcount); + XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetDesktopNames], XCB_ATOM_STRING, 8, XCB_PROP_MODE_REPLACE, "~0", _wm.selmon->deskcount); } void updatedesktopnum(void) { - i32 data[1] = { _wm.selmon->deskcount }; - XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetNumberOfDesktops], XCB_ATOM_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)data, 1); + i32 data = _wm.selmon->deskcount; + XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetNumberOfDesktops], XCB_ATOM_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)&data, 1); } void updateviewport(void) { i32 data[2] = { 0, 0 }; - XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetDesktopViewport], - XCB_ATOM_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)data, 2); + XCBChangeProperty(_wm.dpy, _wm.root, netatom[NetDesktopViewport], XCB_ATOM_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (unsigned char *)data, 2); } @@ -3385,6 +3262,69 @@ specialconds(int argc, char *argv[]) } } +/* how to return. + * reference point is c1. + * so if c1 has higher priority return 1. + * + * so return 1 if x1 > x2; + * return 0 if x1 <= x2 + * sort order is 1,2,3,4,5,6 + */ +static int +__stack_priority_helper(int32_t x1, int32_t x2) +{ + return x1 < x2; +} + +int +stackpriority(Client *c1, Client *c2) +{ + const unsigned int dock1 = ISDOCK(c1); + const unsigned int dock2 = ISDOCK(c2); + + const unsigned int above1 = ISALWAYSONTOP(c1); + const unsigned int above2 = ISALWAYSONTOP(c2); + + const unsigned int float1 = ISFAKEFLOATING(c1); + const unsigned int float2 = ISFAKEFLOATING(c2); + + const unsigned int below1 = ISBELOW(c1); + const unsigned int below2 = ISBELOW(c2); + + const unsigned int hidden1 = ISHIDDEN(c1); + const unsigned int hidden2 = ISHIDDEN(c2); + + if(dock1 ^ dock2) + { + DEBUG0("DOCK"); + return __stack_priority_helper(dock1, dock2); + } + else if(above1 ^ above2) + { + DEBUG0("ABOVE"); + return __stack_priority_helper(above1, above2); + } + else if(float1 ^ float2) + { + DEBUG0("FLOAT"); + return __stack_priority_helper(float1, float2); + } + else if(below1 ^ below2) + { + DEBUG0("BELOW"); + return __stack_priority_helper(below1, below2); + } + else if(hidden1 ^ hidden2) + { + DEBUG0("HIDDEN"); + return __stack_priority_helper(hidden1, hidden2); + } + + DEBUG0("FOCUS"); + /* focus is forward order so, we must calculate reversely */ + return __stack_priority_helper(c2->rstacknum, c1->rstacknum); +} + void startup(void) { @@ -3663,6 +3603,9 @@ unmanage(Client *c, uint8_t destroyed) Desktop *desk = c->desktop; const XCBWindow win = c->win; + if(desk->mon->bar == c) + { desk->mon->bar = NULL; + } if(!destroyed) { /* TODO causes alot of errors for some reason even if its not "destroyed" */ @@ -3681,26 +3624,6 @@ unmanage(Client *c, uint8_t destroyed) DEBUG("Unmanaged: [%u]", win); } -void -unmanagebar(Bar *bar) -{ - Monitor *m = wintobar(bar->win, 1); - if(bar) - { - memset(bar, 0, sizeof(Bar)); - setshowbar(bar, 0); - } - if(m) - { - updatebarpos(m); - arrangemon(m); - } - else - { DEBUG0("Could not find mon"); - } - DEBUG0("Unmanaged bar."); -} - void unmaximize(Client *c) { @@ -3761,12 +3684,12 @@ updatebarpos(Monitor *m) m->wh = m->mh; m->wx = m->mx; m->wy = m->wy; - Bar *bar = m->bar; - if(!bar || !bar->win) + Client *bar = m->bar; + if(!bar) { return; } enum BarSides side = GETBARSIDE(m, bar); - if(SHOWBAR(bar)) + if(!ISHIDDEN(bar)) { switch(side) { @@ -3819,19 +3742,24 @@ updatebarpos(Monitor *m) break; } } - resizebar(bar, bar->x, bar->y, bar->w, bar->h); + resize(bar, bar->x, bar->y, bar->w, bar->h, 0); } void updatebargeom(Monitor *m) { UserSettings *settings = &_cfg; - Bar *b = m->bar; - const u16 bx = USGetBarX(settings); - const u16 by = USGetBarY(settings); - const u16 bw = USGetBarWidth(settings); - const u16 bh = USGetBarHeight(settings); - resizebar(b, bx, by, bw, bh); + Client *bar = m->bar; + + if(bar) + { + const u16 bx = USGetBarX(settings); + const u16 by = USGetBarY(settings); + const u16 bw = USGetBarWidth(settings); + const u16 bh = USGetBarHeight(settings); + resize(bar, bx, by, bw, bh, 0); + DEBUG("%u %u", bw, bh); + } } void @@ -4014,6 +3942,20 @@ updatesizehints(Client *c, XCBSizeHints *size) c->incw = incw; } +void +updatestackpriorityfocus(Desktop *desk) +{ + Client *c; + int i = 0; + for(c = desk->focus; c; c = nextfocus(c)) + { + c->rstacknum = ++i; + if(ISFLOATING(c) && DOCKED(c)) + { setfloating(c, 0); + } + } +} + void updatetitle(Client *c, char *netwmname, char *wmname) { diff --git a/dwm.h b/dwm.h index 2d36ecb..86ae219 100644 --- a/dwm.h +++ b/dwm.h @@ -6,7 +6,6 @@ #include #include "uthash.h" -#include "bar.h" #include "settings.h" #include "pannel.h" #include "XCB-TRL/xcb_trl.h" @@ -269,7 +268,7 @@ struct Monitor Desktop *desklast; /* Last Desktop */ Desktop *desksel; /* Selected Desktop */ Monitor *next; /* Next Monitor */ - Bar *bar; /* The Associated Task-Bar */ + Client *bar; /* The Associated Task-Bar */ Client *__hash; /* Hashed clients */ uint16_t deskcount; /* Desktop Counter */ @@ -442,11 +441,6 @@ void configure(Client *c); * RETURN: NULL on Failure. */ Client *createclient(void); -/* Allocates a bar and bar properties with all data set to 0 or to the adress of any newly allocated data. - * RETURN: Bar * on Success. - * RETURN: NULL on Failure. -*/ -Bar *createbar(void); /* Allocates a desktop and desktop properties with all data set to 0 or to the adress of any newly allocated data. * RETURN: Desktop * on Success. * RETURN: NULL on Failure. @@ -518,11 +512,6 @@ void managerequest(XCBWindow win, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT] * RETURN: NULL on Failure. */ Client *managereply(XCBWindow window, XCBCookie requests[MANAGE_CLIENT_COOKIE_COUNT]); -/* Sets the window to the specified bar, if the bar doesnt exist it creates it. - * RETURN: Bar * on Success. - * RETURN: NULL on Failure. - */ -Bar *managebar(Monitor *m, XCBWindow win); /* Maximizes a client if unmaxed, Sets flag. */ void maximize(Client *c); @@ -741,8 +730,6 @@ void setmodal(Client *c, uint8_t state); void setmondesktop(Monitor *m, Desktop *desk); /* Replaces the Clients state with the sticky state, and sets IS sticky Flag. */ void setsticky(Client *c, uint8_t state); -/* Sets the title bar to be on top. */ -void settopbar(Client *c, uint8_t state); /* Vital checks and data setup before any other action is performed. */ void startup(void); /* Sets up Variables, Checks, WM specific data, etc.. */ @@ -771,6 +758,12 @@ void sigterm(int signo); * NOTE: This is only checked when the program is about to exit. */ void specialconds(int argc, char *argcv[]); +/* reference point is c1. + * so if c1 has higher priority return 1. + * RETURN: 1 on higher priority. + * RETURN: 0 on lesser priority. + */ +int stackpriority(Client *c1, Client *c2); /* Setups most vital data for the context. * Calls exit(1) on Failure. */ @@ -815,6 +808,7 @@ void updatenumlockmask(void); * Doesnt require any data from client, AKA modular. still requires "size" though. */ void updatesizehints(Client *c, XCBSizeHints *size); +void updatestackpriorityfocus(Desktop *desk); /* Updates Client tile if we find one; * if none found default to dwm.h BROKEN */ @@ -859,9 +853,6 @@ Monitor *wintomon(XCBWindow win); * 0 -> skip checks (window already destroyed) */ void unmanage(Client *c, uint8_t destroyed); -/* memsets the specified bar to all 0's thus unmanaging the bar - */ -void unmanagebar(Bar *bar); /* unmaximizes a client if maxed, Sets flag. */ void unmaximize(Client *c); /* unmaximizes a client horizontally if maxed horz, Sets flag. */ @@ -930,7 +921,7 @@ int HASWMTAKEFOCUS(Client *c); int HASWMSAVEYOURSELF(Client *c); int HASWMDELETEWINDOW(Client *c); -enum BarSides GETBARSIDE(Monitor *m, Bar *bar); +enum BarSides GETBARSIDE(Monitor *m, Client *bar); uint16_t OLDWIDTH(Client *c); uint16_t OLDHEIGHT(Client *c);