summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruint23 <[email protected]>2025-04-16 12:21:40 +0100
committeruint23 <[email protected]>2025-04-16 12:21:40 +0100
commite59188201b7e6eeaba95b196a21ba2ec1a374923 (patch)
treec19dbd73f66727d849ff5dfd5dbf9078400ee737 /src
parentdc3b91874677ebb2b0f6ec517b2dce661a92f2fe (diff)
added mask cleaning to accept all types of inputs
Diffstat (limited to 'src')
-rw-r--r--src/defs.h3
-rw-r--r--src/sxwm.c21
-rw-r--r--src/usercfg.h2
3 files changed, 18 insertions, 8 deletions
diff --git a/src/defs.h b/src/defs.h
index a09ba13..2046bc3 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -31,13 +31,14 @@ typedef struct {
int is_func;
} Binding;
-typedef struct {
+typedef struct Client{
Window id;
int x, y;
unsigned int w, h;
unsigned int bw;
Bool isfocused;
Bool isfloating;
+ struct Client *next;
} Client;
#endif
diff --git a/src/sxwm.c b/src/sxwm.c
index 491d6b7..142697f 100644
--- a/src/sxwm.c
+++ b/src/sxwm.c
@@ -13,6 +13,7 @@
#include <err.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -23,6 +24,7 @@
typedef void (*EventHandler)(XEvent *);
+static unsigned int clean_mask(unsigned int mask);
static void hdl_dummy(XEvent *xev);
static void hdl_config_req(XEvent *xev);
static void hdl_destroy_ntf(XEvent *xev);
@@ -46,10 +48,17 @@ static Window root;
static unsigned long border_foc_col;
static unsigned long border_ufoc_col;
-
+static unsigned int scr_width;
+static unsigned int scr_height;
#include "usercfg.h"
+static unsigned int
+clean_mask(unsigned int mask)
+{
+ return mask & ~(LockMask | Mod2Mask | Mod3Mask);
+}
+
static void
hdl_dummy(XEvent *xev)
{}
@@ -86,12 +95,12 @@ hdl_keypress(XEvent *xev)
XKeyEvent *ev = &xev->xkey;
unsigned int modifiers;
- modifiers = ev->state;
keysym = XkbKeycodeToKeysym(dpy, ev->keycode, 0, 0);
+ modifiers = clean_mask(ev->state);
int lenbindings = sizeof(binds) / sizeof(binds[0]);
for (int i = 0; i < lenbindings; ++i) {
- if (keysym == binds[i].keysym && modifiers == binds[i].mods) {
+ if (keysym == binds[i].keysym && modifiers == clean_mask(binds[i].mods)) {
if (binds[i].is_func)
binds[i].action.fn();
else
@@ -188,8 +197,7 @@ setup(void)
root = XDefaultRootWindow(dpy);
other_wm();
XSelectInput(dpy, root,
- SubstructureRedirectMask | KeyPressMask | KeyReleaseMask
- );
+ SubstructureRedirectMask | SubstructureNotifyMask | KeyPressMask);
for (int i = 0; i < LASTEvent; ++i)
evtable[i] = hdl_dummy;
@@ -202,7 +210,8 @@ setup(void)
border_foc_col = parse_col(BORDER_FOC_COL);
border_ufoc_col = parse_col(BORDER_UFOC_COL);
-}
+ scr_width = XDisplayWidth(dpy, DefaultScreen(dpy));
+ scr_height = XDisplayHeight(dpy, DefaultScreen(dpy)); }
static void
spawn(const char **cmd)
diff --git a/src/usercfg.h b/src/usercfg.h
index ea39c8e..457bc17 100644
--- a/src/usercfg.h
+++ b/src/usercfg.h
@@ -4,7 +4,7 @@
#include <X11/keysym.h>
#include "defs.h"
-#define BORDER_WIDTH 2
+#define BORDER_WIDTH 10
#define BORDER_FOC_COL "#00FF00"
#define BORDER_UFOC_COL "#FF0000"