diff options
author | uint23 <https://uint23.xyz/> | 2025-04-20 08:26:06 +0100 |
---|---|---|
committer | uint23 <https://uint23.xyz/> | 2025-04-20 08:26:06 +0100 |
commit | 7c1e852e66768bfd6ba418348e8a1253d01787b7 (patch) | |
tree | 82aa6bf7fc9ca26811648e931edf4d753a1553ca | |
parent | aedc92cc401cd28c737c3ca11b3629ec11d1abfd (diff) |
fixed, fixed windows and unresizeable shennagins
-rw-r--r-- | src/defs.h | 1 | ||||
-rw-r--r-- | src/sxwm.c | 33 |
2 files changed, 23 insertions, 11 deletions
@@ -89,6 +89,7 @@ typedef struct Client{ Window win; uint x, y, h, w; uint orig_x, orig_y, orig_w, orig_h; + Bool fixed; Bool floating; Bool fullscreen; struct Client *next; @@ -135,6 +135,7 @@ add_client(Window w) c->y = wa.y; c->w = wa.width; c->h = wa.height; + c->fixed = False; c->floating = False; c->fullscreen = False; @@ -265,6 +266,9 @@ hdl_button(XEvent *xev) if (!c->floating) return; + if (c->fixed && e->button == Button3) + return; + Cursor cur = (e->button == Button1) ? c_move : c_resize; XGrabPointer(dpy, root, True, ButtonReleaseMask|PointerMotionMask, @@ -322,17 +326,20 @@ hdl_config_req(XEvent *xev) for (c = workspaces[ws]; c; c = c->next) if (c->win == e->window) break; + if (!c || c->floating || c->fullscreen) { - XWindowChanges wc = { - .x = e->x, .y = e->y, - .width = e->width, - .height = e->height, - .border_width = e->border_width, - .sibling = e->above, - .stack_mode = e->detail - }; + /* allow the client to configure itself */ + XWindowChanges wc = { .x = e->x, .y = e->y, + .width = e->width, .height = e->height, + .border_width = e->border_width, + .sibling = e->above, .stack_mode = e->detail }; XConfigureWindow(dpy, e->window, e->value_mask, &wc); + return; } + + /* managed and tiling – ignore size hints unless it’s fixed */ + if (c->fixed) + return; } static void @@ -478,13 +485,17 @@ hdl_map_req(XEvent *xev) if (XGetTransientForHint(dpy, c->win, &trans)) c->floating = True; - XSizeHints sh; - long supplied; + XSizeHints sh; long supplied; if (XGetWMNormalHints(dpy, c->win, &sh, &supplied) && (sh.flags & PMinSize) && (sh.flags & PMaxSize) && - sh.min_width == sh.max_width && + sh.min_width == sh.max_width && sh.min_height == sh.max_height) { c->floating = True; + c->fixed = True; + + XSetWindowBorderWidth(dpy, c->win, BORDER_WIDTH); + XSetWindowBorder (dpy, c->win, + (c == focused ? border_foc_col : border_ufoc_col)); } { |