[wiki] [sites] fix issue causing broken systray icons || Jan Christoph Ebersbach

From: <git_AT_suckless.org>
Date: Wed, 30 Apr 2014 19:48:57 +0200

commit 343292039daac70631d4c33dd6f21a040de0ae81
Author: Jan Christoph Ebersbach <jceb_AT_e-jc.de>
Date: Wed Apr 30 19:47:44 2014 +0200

    fix issue causing broken systray icons

diff --git a/dwm.suckless.org/patches/dwm-6.1-systray.diff b/dwm.suckless.org/patches/dwm-6.1-systray.diff
index 4e6c3fc..013e761 100644
--- a/dwm.suckless.org/patches/dwm-6.1-systray.diff
+++ b/dwm.suckless.org/patches/dwm-6.1-systray.diff
_AT_@ -8,9 +8,9 @@ Contributors:
 
 Index: dwm/config.def.h
 ===================================================================
---- dwm/config.def.h.orig 2014-02-09 15:24:27.348117387 +0100
-+++ dwm/config.def.h 2014-02-09 15:24:27.340117386 +0100
-_AT_@ -10,6 +10,10 @@
+--- dwm/config.def.h.orig
++++ dwm/config.def.h
+_AT_@ -10,6 +10,10 @@ static const char selbgcolor[] = "#
  static const char selfgcolor[] = "#eeeeee";
  static const unsigned int borderpx = 1; /* border pixel of windows */
  static const unsigned int snap = 32; /* snap pixel */
_AT_@ -23,8 +23,8 @@ Index: dwm/config.def.h
  
 Index: dwm/dwm.c
 ===================================================================
---- dwm/dwm.c.orig 2014-02-09 15:24:27.348117387 +0100
-+++ dwm/dwm.c 2014-02-09 15:24:27.340117386 +0100
+--- dwm/dwm.c.orig
++++ dwm/dwm.c
 _AT_@ -56,12 +56,30 @@
  #define TAGMASK ((1 << LENGTH(tags)) - 1)
  #define TEXTW(X) (drw_font_getexts_width(drw->font, X, strlen(X)) + drw->font->h)
_AT_@ -59,7 +59,7 @@ Index: dwm/dwm.c
  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
  enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
         ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
-_AT_@ -140,6 +158,12 @@
+_AT_@ -140,6 +158,12 @@ typedef struct {
          int monitor;
  } Rule;
  
_AT_@ -72,7 +72,7 @@ Index: dwm/dwm.c
  /* function declarations */
  static void applyrules(Client *c);
  static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
-_AT_@ -169,8 +193,10 @@
+_AT_@ -169,8 +193,10 @@ static void focus(Client *c);
  static void focusin(XEvent *e);
  static void focusmon(const Arg *arg);
  static void focusstack(const Arg *arg);
_AT_@ -83,7 +83,7 @@ Index: dwm/dwm.c
  static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
  static void grabbuttons(Client *c, Bool focused);
  static void grabkeys(void);
-_AT_@ -188,13 +214,15 @@
+_AT_@ -188,13 +214,16 @@ static void pop(Client *);
  static void propertynotify(XEvent *e);
  static void quit(const Arg *arg);
  static Monitor *recttomon(int x, int y, int w, int h);
_AT_@ -92,6 +92,7 @@ Index: dwm/dwm.c
 +static void resizebarwin(Monitor *m);
  static void resizeclient(Client *c, int x, int y, int w, int h);
  static void resizemouse(const Arg *arg);
++static void resizerequest(XEvent *e);
  static void restack(Monitor *m);
  static void run(void);
  static void scan(void);
_AT_@ -100,7 +101,7 @@ Index: dwm/dwm.c
  static void sendmon(Client *c, Monitor *m);
  static void setclientstate(Client *c, long state);
  static void setfocus(Client *c);
-_AT_@ -205,6 +233,7 @@
+_AT_@ -205,6 +234,7 @@ static void setup(void);
  static void showhide(Client *c);
  static void sigchld(int unused);
  static void spawn(const Arg *arg);
_AT_@ -108,7 +109,7 @@ Index: dwm/dwm.c
  static void tag(const Arg *arg);
  static void tagmon(const Arg *arg);
  static void tile(Monitor *);
-_AT_@ -222,18 +251,24 @@
+_AT_@ -222,18 +252,24 @@ static void updateclientlist(void);
  static void updatenumlockmask(void);
  static void updatesizehints(Client *c);
  static void updatestatus(void);
_AT_@ -133,8 +134,11 @@ Index: dwm/dwm.c
  static const char broken[] = "broken";
  static char stext[256];
  static int screen;
-_AT_@ -257,7 +292,7 @@
+_AT_@ -255,9 +291,10 @@ static void (*handler[LASTEvent]) (XEven
+ [MapRequest] = maprequest,
+ [MotionNotify] = motionnotify,
          [PropertyNotify] = propertynotify,
++ [ResizeRequest] = resizerequest,
          [UnmapNotify] = unmapnotify
  };
 -static Atom wmatom[WMLast], netatom[NetLast];
_AT_@ -142,7 +146,7 @@ Index: dwm/dwm.c
  static Bool running = True;
  static Cur *cursor[CurLast];
  static ClrScheme scheme[SchemeLast];
-_AT_@ -471,6 +506,11 @@
+_AT_@ -471,6 +508,11 @@ cleanup(void) {
          XUngrabKey(dpy, AnyKey, AnyModifier, root);
          while(mons)
                  cleanupmon(mons);
_AT_@ -154,7 +158,7 @@ Index: dwm/dwm.c
          drw_cur_free(drw, cursor[CurNormal]);
          drw_cur_free(drw, cursor[CurResize]);
          drw_cur_free(drw, cursor[CurMove]);
-_AT_@ -516,9 +556,49 @@
+_AT_@ -516,9 +558,49 @@ clearurgent(Client *c) {
  
  void
  clientmessage(XEvent *e) {
_AT_@ -204,7 +208,7 @@ Index: dwm/dwm.c
          if(!c)
                  return;
          if(cme->message_type == netatom[NetWMState]) {
-_AT_@ -568,7 +648,7 @@
+_AT_@ -568,7 +650,7 @@ configurenotify(XEvent *e) {
                          drw_resize(drw, sw, bh);
                          updatebars();
                          for(m = mons; m; m = m->next)
_AT_@ -213,7 +217,7 @@ Index: dwm/dwm.c
                          focus(NULL);
                          arrange(NULL);
                  }
-_AT_@ -652,6 +732,11 @@
+_AT_@ -652,6 +734,11 @@ destroynotify(XEvent *e) {
  
          if((c = wintoclient(ev->window)))
                  unmanage(c, True);
_AT_@ -225,7 +229,7 @@ Index: dwm/dwm.c
  }
  
  void
-_AT_@ -696,6 +781,7 @@
+_AT_@ -696,6 +783,7 @@ drawbar(Monitor *m) {
          unsigned int i, occ = 0, urg = 0;
          Client *c;
  
_AT_@ -233,17 +237,17 @@ Index: dwm/dwm.c
          for(c = m->clients; c; c = c->next) {
                  occ |= c->tags;
                  if(c->isurgent)
-_AT_@ -718,6 +804,9 @@
- if(m == selmon) { /* status is only drawn on selected monitor */
- w = TEXTW(stext);
- x = m->ww - w;
-+ if(showsystray && m == systraytomon(m)) {
-+ x -= getsystraywidth();
-+ }
- if(x < xx) {
- x = xx;
- w = m->ww - xx;
-_AT_@ -747,6 +836,7 @@
+_AT_@ -726,6 +814,9 @@ drawbar(Monitor *m) {
+ }
+ else
+ x = m->ww;
++ if(showsystray && m == systraytomon(m)) {
++ x -= getsystraywidth();
++ }
+ if((w = x - xx) > bh) {
+ x = xx;
+ if(m->sel) {
+_AT_@ -747,6 +838,7 @@ drawbars(void) {
  
          for(m = mons; m; m = m->next)
                  drawbar(m);
_AT_@ -251,7 +255,7 @@ Index: dwm/dwm.c
  }
  
  void
-_AT_@ -773,8 +863,11 @@
+_AT_@ -773,8 +865,11 @@ expose(XEvent *e) {
          Monitor *m;
          XExposeEvent *ev = &e->xexpose;
  
_AT_@ -264,7 +268,7 @@ Index: dwm/dwm.c
  }
  
  void
-_AT_@ -857,10 +950,17 @@
+_AT_@ -857,10 +952,17 @@ getatomprop(Client *c, Atom prop) {
          unsigned long dl;
          unsigned char *p = NULL;
          Atom da, atom = None;
_AT_@ -283,7 +287,7 @@ Index: dwm/dwm.c
                  XFree(p);
          }
          return atom;
-_AT_@ -892,6 +992,15 @@
+_AT_@ -892,6 +994,15 @@ getstate(Window w) {
          return result;
  }
  
_AT_@ -299,7 +303,7 @@ Index: dwm/dwm.c
  Bool
  gettextprop(Window w, Atom atom, char *text, unsigned int size) {
          char **list = NULL;
-_AT_@ -992,7 +1101,7 @@
+_AT_@ -992,7 +1103,7 @@ void
  killclient(const Arg *arg) {
          if(!selmon->sel)
                  return;
_AT_@ -308,7 +312,7 @@ Index: dwm/dwm.c
                  XGrabServer(dpy);
                  XSetErrorHandler(xerrordummy);
                  XSetCloseDownMode(dpy, DestroyAll);
-_AT_@ -1078,6 +1187,12 @@
+_AT_@ -1078,6 +1189,12 @@ void
  maprequest(XEvent *e) {
          static XWindowAttributes wa;
          XMapRequestEvent *ev = &e->xmaprequest;
_AT_@ -321,7 +325,7 @@ Index: dwm/dwm.c
  
          if(!XGetWindowAttributes(dpy, ev->window, &wa))
                  return;
-_AT_@ -1194,6 +1309,16 @@
+_AT_@ -1194,6 +1311,16 @@ propertynotify(XEvent *e) {
          Window trans;
          XPropertyEvent *ev = &e->xproperty;
  
_AT_@ -338,7 +342,7 @@ Index: dwm/dwm.c
          if((ev->window == root) && (ev->atom == XA_WM_NAME))
                  updatestatus();
          else if(ev->state == PropertyDelete)
-_AT_@ -1243,12 +1368,33 @@
+_AT_@ -1243,12 +1370,33 @@ recttomon(int x, int y, int w, int h) {
  }
  
  void
_AT_@ -372,7 +376,26 @@ Index: dwm/dwm.c
  resizeclient(Client *c, int x, int y, int w, int h) {
          XWindowChanges wc;
  
-_AT_@ -1398,25 +1544,35 @@
+_AT_@ -1315,6 +1463,18 @@ resizemouse(const Arg *arg) {
+ }
+
+ void
++resizerequest(XEvent *e) {
++ XResizeRequestEvent *ev = &e->xresizerequest;
++ Client *i;
++
++ if((i = wintosystrayicon(ev->window))) {
++ updatesystrayicongeom(i, ev->width, ev->height);
++ resizebarwin(selmon);
++ updatesystray();
++ }
++}
++
++void
+ restack(Monitor *m) {
+ Client *c;
+ XEvent ev;
+_AT_@ -1398,25 +1558,35 @@ setclientstate(Client *c, long state) {
  }
  
  Bool
_AT_@ -419,7 +442,7 @@ Index: dwm/dwm.c
          }
          return exists;
  }
-_AT_@ -1429,7 +1585,7 @@
+_AT_@ -1429,7 +1599,7 @@ setfocus(Client *c) {
                                   XA_WINDOW, 32, PropModeReplace,
                                   (unsigned char *) &(c->win), 1);
          }
_AT_@ -428,7 +451,7 @@ Index: dwm/dwm.c
  }
  
  void
-_AT_@ -1511,12 +1667,18 @@
+_AT_@ -1511,12 +1681,18 @@ setup(void) {
          wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
          netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
          netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
_AT_@ -447,7 +470,7 @@ Index: dwm/dwm.c
          /* init cursors */
          cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
          cursor[CurResize] = drw_cur_create(drw, XC_sizing);
-_AT_@ -1528,6 +1690,8 @@
+_AT_@ -1528,6 +1704,8 @@ setup(void) {
          scheme[SchemeSel].border = drw_clr_create(drw, selbordercolor);
          scheme[SchemeSel].bg = drw_clr_create(drw, selbgcolor);
          scheme[SchemeSel].fg = drw_clr_create(drw, selfgcolor);
_AT_@ -456,7 +479,7 @@ Index: dwm/dwm.c
          /* init bars */
          updatebars();
          updatestatus();
-_AT_@ -1583,6 +1747,22 @@
+_AT_@ -1583,6 +1761,22 @@ spawn(const Arg *arg) {
          }
  }
  
_AT_@ -479,7 +502,7 @@ Index: dwm/dwm.c
  void
  tag(const Arg *arg) {
          if(selmon->sel && arg->ui & TAGMASK) {
-_AT_@ -1629,7 +1809,18 @@
+_AT_@ -1629,7 +1823,18 @@ void
  togglebar(const Arg *arg) {
          selmon->showbar = !selmon->showbar;
          updatebarpos(selmon);
_AT_@ -499,7 +522,7 @@ Index: dwm/dwm.c
          arrange(selmon);
  }
  
-_AT_@ -1719,11 +1910,18 @@
+_AT_@ -1719,11 +1924,18 @@ unmapnotify(XEvent *e) {
                  else
                          unmanage(c, False);
          }
_AT_@ -518,7 +541,7 @@ Index: dwm/dwm.c
          XSetWindowAttributes wa = {
                  .override_redirect = True,
                  .background_pixmap = ParentRelative,
-_AT_@ -1732,10 +1930,15 @@
+_AT_@ -1732,10 +1944,15 @@ updatebars(void) {
          for(m = mons; m; m = m->next) {
                  if (m->barwin)
                          continue;
_AT_@ -535,7 +558,7 @@ Index: dwm/dwm.c
                  XMapRaised(dpy, m->barwin);
          }
  }
-_AT_@ -1929,6 +2132,114 @@
+_AT_@ -1929,6 +2146,117 @@ updatestatus(void) {
  }
  
  void
_AT_@ -627,14 +650,17 @@ Index: dwm/dwm.c
 + /* make sure the background color stays the same */
 + wa.background_pixel = scheme[SchemeNorm].bg->rgb;
 + XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
++ XMapRaised(dpy, i->win);
 + w += systrayspacing;
-+ XMoveResizeWindow(dpy, i->win, (i->x = w), 0, i->w, i->h);
++ i->x = w;
++ XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
 + w += i->w;
 + if(i->mon != m)
 + i->mon = m;
 + }
 + w = w ? w + systrayspacing : 1;
 + x -= w;
++ XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh);
 + wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh;
 + wc.stack_mode = Above; wc.sibling = m->barwin;
 + XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
_AT_@ -650,7 +676,7 @@ Index: dwm/dwm.c
  updatewindowtype(Client *c) {
          Atom state = getatomprop(c, netatom[NetWMState]);
          Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
-_AT_@ -1997,6 +2308,16 @@
+_AT_@ -1997,6 +2325,16 @@ wintomon(Window w) {
          return selmon;
  }
  
Received on Wed Apr 30 2014 - 19:48:57 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:38:43 CEST