st-swapmouse-0.8.4.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-swapmouse-0.8.4.diff (1041B)
       ---
            1 diff -up st-0.8.4-ori/x.c st-0.8.4/x.c
            2 --- st-0.8.4-ori/x.c        2020-06-19 14:59:45.000000000 +0530
            3 +++ st-0.8.4/x.c        2020-07-20 03:39:56.260922736 +0530
            4 @@ -254,6 +254,9 @@ static char *opt_title = NULL;
            5  
            6  static int oldbutton = 3; /* button event on startup: 3 = release */
            7  
            8 +static Cursor cursor;
            9 +static XColor xmousefg, xmousebg;
           10 +
           11  void
           12  clipcopy(const Arg *dummy)
           13  {
           14 @@ -1099,10 +1102,8 @@ void
           15  xinit(int cols, int rows)
           16  {
           17          XGCValues gcvalues;
           18 -        Cursor cursor;
           19          Window parent;
           20          pid_t thispid = getpid();
           21 -        XColor xmousefg, xmousebg;
           22  
           23          if (!(xw.dpy = XOpenDisplay(NULL)))
           24                  die("can't open display\n");
           25 @@ -1683,6 +1684,12 @@ xsetmode(int set, unsigned int flags)
           26  {
           27          int mode = win.mode;
           28          MODBIT(win.mode, set, flags);
           29 +        if (flags & MODE_MOUSE) {
           30 +                if (win.mode & MODE_MOUSE)
           31 +                        XUndefineCursor(xw.dpy, xw.win);
           32 +                else
           33 +                        XDefineCursor(xw.dpy, xw.win, cursor);
           34 +        }
           35          if ((win.mode & MODE_REVERSE) != (mode & MODE_REVERSE))
           36                  redraw();
           37  }