summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruint23 <[email protected]>2025-04-17 17:19:39 +0100
committeruint23 <[email protected]>2025-04-17 17:19:39 +0100
commit57477a4dd0726153e759562ec5c7969a6d0147c7 (patch)
tree4c2caab15ef7636c46d0fa3e502a723b94605f12
parenta8dce8bdcd9c2445e186253b8e5206ac1eb5bf61 (diff)
optimisations, can resize from tiled mode
-rw-r--r--Makefile2
-rw-r--r--src/sxwm.c26
2 files changed, 4 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index aa93403..64b0b60 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -Wall -Wextra -O3 -g -Isrc
+CFLAGS = -Wall -Wextra -O3 -g -Isrc -march=native -flto -s
LDFLAGS = -lX11
SRC_DIR = src
diff --git a/src/sxwm.c b/src/sxwm.c
index 2f0d0e6..01d0cb8 100644
--- a/src/sxwm.c
+++ b/src/sxwm.c
@@ -120,28 +120,7 @@ close_focused(void)
if (!clients)
return;
- // ICCCM first ;)
Window w = focused->win;
- Atom *protocols;
- int n;
- if (XGetWMProtocols(dpy, w, &protocols, &n)) {
- Atom del = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
- for (int i = 0; i < n; ++i) {
- if (protocols[i] == del) {
- XEvent ev = { 0 };
- ev.xclient.type = ClientMessage;
- ev.xclient.window = w;
- ev.xclient.message_type = XInternAtom(dpy, "WM_PROTOCOLS", False);
- ev.xclient.format = 32;
- ev.xclient.data.l[0] = del;
- ev.xclient.data.l[1] = CurrentTime;
- XSendEvent(dpy, w, False, NoEventMask, &ev);
- XFree(protocols);
- return;
- }
- }
- XFree(protocols);
- }
XKillClient(dpy, w);
}
@@ -221,7 +200,8 @@ hdl_button(XEvent *xev)
if (c->win != w)
continue;
- if ((e->state & MOD) && e->button == Button1 && !c->floating) {
+ if (((e->state & MOD) && e->button == Button1 && !c->floating) ||
+ ((e->state & MOD) && e->button == Button3 && !c->floating)) {
focused = c;
toggle_floating();
}
@@ -485,6 +465,7 @@ setup(void)
XGrabButton(dpy, Button3, MOD, root,
True, ButtonPressMask|ButtonReleaseMask|PointerMotionMask,
GrabModeAsync, GrabModeAsync, None, None);
+ XSync(dpy, False);
for (int i = 0; i < LASTEvent; ++i)
evtable[i] = hdl_dummy;
@@ -631,7 +612,6 @@ update_borders(void)
XSetWindowBorder(dpy, c->win,
(c == focused ? border_foc_col : border_ufoc_col));
}
- XSync(dpy, False);
}
static int