dwm-steam-6.2.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-steam-6.2.diff (1891B)
       ---
            1 From 2550931c66e10e667ce56a6761cbadd12b331c52 Mon Sep 17 00:00:00 2001
            2 From: bakkeby <bakkeby@gmail.com>
            3 Date: Mon, 10 Aug 2020 16:45:00 +0200
            4 Subject: [PATCH] Steam patch
            5 
            6 Steam, and steam windows (games), trigger a ConfigureNotify request every time the window
            7 gets focus. More so, the configure event passed along from Steam tends to have the wrong
            8 x and y coordinates which can make the window, if floating, jump around the screen.
            9 
           10 This patch works around this age-old issue by ignoring the x and y co-ordinates for
           11 ConfigureNotify requests relating to Steam windows.
           12 ---
           13  dwm.c | 20 +++++++++++++-------
           14  1 file changed, 13 insertions(+), 7 deletions(-)
           15 
           16 diff --git a/dwm.c b/dwm.c
           17 index 4465af1..598d36d 100644
           18 --- a/dwm.c
           19 +++ b/dwm.c
           20 @@ -93,6 +93,7 @@ struct Client {
           21          int bw, oldbw;
           22          unsigned int tags;
           23          int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
           24 +        int issteam;
           25          Client *next;
           26          Client *snext;
           27          Monitor *mon;
           28 @@ -291,6 +292,9 @@ applyrules(Client *c)
           29          class    = ch.res_class ? ch.res_class : broken;
           30          instance = ch.res_name  ? ch.res_name  : broken;
           31 
           32 +        if (strstr(class, "Steam") || strstr(class, "steam_app_"))
           33 +                c->issteam = 1;
           34 +
           35          for (i = 0; i < LENGTH(rules); i++) {
           36                  r = &rules[i];
           37                  if ((!r->title || strstr(c->name, r->title))
           38 @@ -588,13 +592,15 @@ configurerequest(XEvent *e)
           39                          c->bw = ev->border_width;
           40                  else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) {
           41                          m = c->mon;
           42 -                        if (ev->value_mask & CWX) {
           43 -                                c->oldx = c->x;
           44 -                                c->x = m->mx + ev->x;
           45 -                        }
           46 -                        if (ev->value_mask & CWY) {
           47 -                                c->oldy = c->y;
           48 -                                c->y = m->my + ev->y;
           49 +                        if (!c->issteam) {
           50 +                                if (ev->value_mask & CWX) {
           51 +                                        c->oldx = c->x;
           52 +                                        c->x = m->mx + ev->x;
           53 +                                }
           54 +                                if (ev->value_mask & CWY) {
           55 +                                        c->oldy = c->y;
           56 +                                        c->y = m->my + ev->y;
           57 +                                }
           58                          }
           59                          if (ev->value_mask & CWWidth) {
           60                                  c->oldw = c->w;
           61 --
           62 2.19.1
           63