[hackers] [dmenu] fixed -m bug (thanks Rob) || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Wed, 11 May 2011 13:26:47 +0200 (CEST)

changeset: 390:3a1b03d344e3
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Wed May 11 12:25:50 2011 +0100
files: dmenu.c draw.c
description:
fixed -m bug (thanks Rob)

diff -r d0f5c7885a5a -r 3a1b03d344e3 dmenu.c
--- a/dmenu.c Sun May 08 15:15:24 2011 +0100
+++ b/dmenu.c Wed May 11 12:25:50 2011 +0100
@@ -76,10 +76,10 @@
                 }
                 else if(!strcmp(argv[i], "-b"))
                         topbar = False;
+ else if(!strcmp(argv[i], "-f"))
+ fast = True;
                 else if(!strcmp(argv[i], "-i"))
                         fstrncmp = strncasecmp;
- else if(!strcmp(argv[i], "-f"))
- fast = True;
                 else if(i == argc-1)
                         goto usage;
                 /* double flags */
@@ -506,18 +506,18 @@
         mh = (lines + 1) * bh;
 #ifdef XINERAMA
         if((info = XineramaQueryScreens(dc->dpy, &n))) {
- int i, di;
+ int i, m, di;
                 unsigned int du;
                 Window dw;
 
                 XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du);
- for(i = 0; i < n; i++)
+ for(i = 0, m = -1; i < n; i++)
                         if((monitor == info[i].screen_number)
- || (monitor < 0 && INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)))
- break;
- x = info[i].x_org;
- y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
- mw = info[i].width;
+ || (m < 0 && INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)))
+ m = i;
+ x = info[m].x_org;
+ y = info[m].y_org + (topbar ? 0 : info[m].height - mh);
+ mw = info[m].width;
                 XFree(info);
         }
         else
diff -r d0f5c7885a5a -r 3a1b03d344e3 draw.c
--- a/draw.c Sun May 08 15:15:24 2011 +0100
+++ b/draw.c Wed May 11 12:25:50 2011 +0100
@@ -7,9 +7,9 @@
 #include <X11/Xlib.h>
 #include "draw.h"
 
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#define DEFFONT "fixed"
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define DEFFONT "fixed"
 
 static Bool loadfont(DC *dc, const char *fontstr);
 
Received on Wed May 11 2011 - 13:26:47 CEST

This archive was generated by hypermail 2.2.0 : Wed May 11 2011 - 13:36:07 CEST