Compare commits
No commits in common. "83ef248a30756217ac6df850c26bf4db1fb971c9" and "17f64ff03d740c11f37652a4df5c9fafd1b00783" have entirely different histories.
83ef248a30
...
17f64ff03d
7 changed files with 8 additions and 133 deletions
BIN
drw.o
Normal file
BIN
drw.o
Normal file
Binary file not shown.
BIN
dwm
Executable file
BIN
dwm
Executable file
Binary file not shown.
|
@ -1,63 +0,0 @@
|
||||||
From 2550931c66e10e667ce56a6761cbadd12b331c52 Mon Sep 17 00:00:00 2001
|
|
||||||
From: bakkeby <bakkeby@gmail.com>
|
|
||||||
Date: Mon, 10 Aug 2020 16:45:00 +0200
|
|
||||||
Subject: [PATCH] Steam patch
|
|
||||||
|
|
||||||
Steam, and steam windows (games), trigger a ConfigureNotify request every time the window
|
|
||||||
gets focus. More so, the configure event passed along from Steam tends to have the wrong
|
|
||||||
x and y coordinates which can make the window, if floating, jump around the screen.
|
|
||||||
|
|
||||||
This patch works around this age-old issue by ignoring the x and y co-ordinates for
|
|
||||||
ConfigureNotify requests relating to Steam windows.
|
|
||||||
---
|
|
||||||
dwm.c | 20 +++++++++++++-------
|
|
||||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
|
||||||
index 4465af1..598d36d 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -93,6 +93,7 @@ struct Client {
|
|
||||||
int bw, oldbw;
|
|
||||||
unsigned int tags;
|
|
||||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
|
||||||
+ int issteam;
|
|
||||||
Client *next;
|
|
||||||
Client *snext;
|
|
||||||
Monitor *mon;
|
|
||||||
@@ -291,6 +292,9 @@ applyrules(Client *c)
|
|
||||||
class = ch.res_class ? ch.res_class : broken;
|
|
||||||
instance = ch.res_name ? ch.res_name : broken;
|
|
||||||
|
|
||||||
+ if (strstr(class, "Steam") || strstr(class, "steam_app_"))
|
|
||||||
+ c->issteam = 1;
|
|
||||||
+
|
|
||||||
for (i = 0; i < LENGTH(rules); i++) {
|
|
||||||
r = &rules[i];
|
|
||||||
if ((!r->title || strstr(c->name, r->title))
|
|
||||||
@@ -588,13 +592,15 @@ configurerequest(XEvent *e)
|
|
||||||
c->bw = ev->border_width;
|
|
||||||
else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) {
|
|
||||||
m = c->mon;
|
|
||||||
- if (ev->value_mask & CWX) {
|
|
||||||
- c->oldx = c->x;
|
|
||||||
- c->x = m->mx + ev->x;
|
|
||||||
- }
|
|
||||||
- if (ev->value_mask & CWY) {
|
|
||||||
- c->oldy = c->y;
|
|
||||||
- c->y = m->my + ev->y;
|
|
||||||
+ if (!c->issteam) {
|
|
||||||
+ if (ev->value_mask & CWX) {
|
|
||||||
+ c->oldx = c->x;
|
|
||||||
+ c->x = m->mx + ev->x;
|
|
||||||
+ }
|
|
||||||
+ if (ev->value_mask & CWY) {
|
|
||||||
+ c->oldy = c->y;
|
|
||||||
+ c->y = m->my + ev->y;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
if (ev->value_mask & CWWidth) {
|
|
||||||
c->oldw = c->w;
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
6
dwm.c
6
dwm.c
|
@ -93,7 +93,6 @@ struct Client {
|
||||||
int bw, oldbw;
|
int bw, oldbw;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
int issteam;
|
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *snext;
|
Client *snext;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
|
@ -323,9 +322,6 @@ applyrules(Client *c)
|
||||||
class = ch.res_class ? ch.res_class : broken;
|
class = ch.res_class ? ch.res_class : broken;
|
||||||
instance = ch.res_name ? ch.res_name : broken;
|
instance = ch.res_name ? ch.res_name : broken;
|
||||||
|
|
||||||
if (strstr(class, "Steam") || strstr(class, "steam_app_"))
|
|
||||||
c->issteam = 1;
|
|
||||||
|
|
||||||
for (i = 0; i < LENGTH(rules); i++) {
|
for (i = 0; i < LENGTH(rules); i++) {
|
||||||
r = &rules[i];
|
r = &rules[i];
|
||||||
if ((!r->title || strstr(c->name, r->title))
|
if ((!r->title || strstr(c->name, r->title))
|
||||||
|
@ -623,7 +619,6 @@ configurerequest(XEvent *e)
|
||||||
c->bw = ev->border_width;
|
c->bw = ev->border_width;
|
||||||
else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) {
|
else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) {
|
||||||
m = c->mon;
|
m = c->mon;
|
||||||
if (!c->issteam) {
|
|
||||||
if (ev->value_mask & CWX) {
|
if (ev->value_mask & CWX) {
|
||||||
c->oldx = c->x;
|
c->oldx = c->x;
|
||||||
c->x = m->mx + ev->x;
|
c->x = m->mx + ev->x;
|
||||||
|
@ -632,7 +627,6 @@ configurerequest(XEvent *e)
|
||||||
c->oldy = c->y;
|
c->oldy = c->y;
|
||||||
c->y = m->my + ev->y;
|
c->y = m->my + ev->y;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (ev->value_mask & CWWidth) {
|
if (ev->value_mask & CWWidth) {
|
||||||
c->oldw = c->w;
|
c->oldw = c->w;
|
||||||
c->w = ev->width;
|
c->w = ev->width;
|
||||||
|
|
58
dwm.c.orig
58
dwm.c.orig
|
@ -235,7 +235,6 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
static void autostart_exec(void);
|
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
static const char broken[] = "broken";
|
static const char broken[] = "broken";
|
||||||
|
@ -277,34 +276,6 @@ static Window root, wmcheckwin;
|
||||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||||
|
|
||||||
/* dwm will keep pid's of processes from autostart array and kill them at quit */
|
|
||||||
static pid_t *autostart_pids;
|
|
||||||
static size_t autostart_len;
|
|
||||||
|
|
||||||
/* execute command from autostart array */
|
|
||||||
static void
|
|
||||||
autostart_exec() {
|
|
||||||
const char *const *p;
|
|
||||||
size_t i = 0;
|
|
||||||
|
|
||||||
/* count entries */
|
|
||||||
for (p = autostart; *p; autostart_len++, p++)
|
|
||||||
while (*++p);
|
|
||||||
|
|
||||||
autostart_pids = malloc(autostart_len * sizeof(pid_t));
|
|
||||||
for (p = autostart; *p; i++, p++) {
|
|
||||||
if ((autostart_pids[i] = fork()) == 0) {
|
|
||||||
setsid();
|
|
||||||
execvp(*p, (char *const *)p);
|
|
||||||
fprintf(stderr, "dwm: execvp %s\n", *p);
|
|
||||||
perror(" failed");
|
|
||||||
_exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
/* skip arguments */
|
|
||||||
while (*++p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* function implementations */
|
/* function implementations */
|
||||||
void
|
void
|
||||||
applyrules(Client *c)
|
applyrules(Client *c)
|
||||||
|
@ -1306,16 +1277,6 @@ propertynotify(XEvent *e)
|
||||||
void
|
void
|
||||||
quit(const Arg *arg)
|
quit(const Arg *arg)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* kill child processes */
|
|
||||||
for (i = 0; i < autostart_len; i++) {
|
|
||||||
if (0 < autostart_pids[i]) {
|
|
||||||
kill(autostart_pids[i], SIGTERM);
|
|
||||||
waitpid(autostart_pids[i], NULL, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
running = 0;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1709,25 +1670,9 @@ showhide(Client *c)
|
||||||
void
|
void
|
||||||
sigchld(int unused)
|
sigchld(int unused)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||||
die("can't install SIGCHLD handler:");
|
die("can't install SIGCHLD handler:");
|
||||||
while (0 < (pid = waitpid(-1, NULL, WNOHANG))) {
|
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||||
pid_t *p, *lim;
|
|
||||||
|
|
||||||
if (!(p = autostart_pids))
|
|
||||||
continue;
|
|
||||||
lim = &p[autostart_len];
|
|
||||||
|
|
||||||
for (; p < lim; p++) {
|
|
||||||
if (*p == pid) {
|
|
||||||
*p = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2230,7 +2175,6 @@ main(int argc, char *argv[])
|
||||||
if (!(dpy = XOpenDisplay(NULL)))
|
if (!(dpy = XOpenDisplay(NULL)))
|
||||||
die("dwm: cannot open display");
|
die("dwm: cannot open display");
|
||||||
checkotherwm();
|
checkotherwm();
|
||||||
autostart_exec();
|
|
||||||
setup();
|
setup();
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||||
|
|
BIN
dwm.o
Normal file
BIN
dwm.o
Normal file
Binary file not shown.
BIN
util.o
Normal file
BIN
util.o
Normal file
Binary file not shown.
Loading…
Reference in a new issue