Xinqi Bao's Git
projects
/
dmenu.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
updated copyright notices in LICENSE and dmenu.c file
[dmenu.git]
/
dmenu.c
diff --git
a/dmenu.c
b/dmenu.c
index
5e0a19c
..
dd2c128
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-54,6
+54,7
@@
static Item *matches, *matchend;
static Item *prev, *curr, *next, *sel;
static Window win;
static XIC xic;
static Item *prev, *curr, *next, *sel;
static Window win;
static XIC xic;
+static int mon = -1;
#include "config.h"
#include "config.h"
@@
-68,7
+69,7
@@
main(int argc, char *argv[]) {
for(i = 1; i < argc; i++)
/* these options take no arguments */
if(!strcmp(argv[i], "-v")) { /* prints version information */
for(i = 1; i < argc; i++)
/* these options take no arguments */
if(!strcmp(argv[i], "-v")) { /* prints version information */
- puts("dmenu-"VERSION", © 2006-201
2
dmenu engineers, see LICENSE for details");
+ puts("dmenu-"VERSION", © 2006-201
4
dmenu engineers, see LICENSE for details");
exit(EXIT_SUCCESS);
}
else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
exit(EXIT_SUCCESS);
}
else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
@@
-84,6
+85,8
@@
main(int argc, char *argv[]) {
/* these options take one argument */
else if(!strcmp(argv[i], "-l")) /* number of lines in vertical list */
lines = atoi(argv[++i]);
/* these options take one argument */
else if(!strcmp(argv[i], "-l")) /* number of lines in vertical list */
lines = atoi(argv[++i]);
+ else if(!strcmp(argv[i], "-m"))
+ mon = atoi(argv[++i]);
else if(!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
prompt = argv[++i];
else if(!strcmp(argv[i], "-fn")) /* font or font set */
else if(!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
prompt = argv[++i];
else if(!strcmp(argv[i], "-fn")) /* font or font set */
@@
-557,7
+560,9
@@
setup(void) {
XWindowAttributes wa;
XGetInputFocus(dc->dpy, &w, &di);
XWindowAttributes wa;
XGetInputFocus(dc->dpy, &w, &di);
- if(w != root && w != PointerRoot && w != None) {
+ if(mon != -1 && mon < n)
+ i = mon;
+ if(!i && w != root && w != PointerRoot && w != None) {
/* find top-level window containing current input focus */
do {
if(XQueryTree(dc->dpy, (pw = w), &dw, &w, &dws, &du) && dws)
/* find top-level window containing current input focus */
do {
if(XQueryTree(dc->dpy, (pw = w), &dw, &w, &dws, &du) && dws)
@@
-572,7
+577,7
@@
setup(void) {
}
}
/* no focused window is on screen, so use pointer location instead */
}
}
/* no focused window is on screen, so use pointer location instead */
- if(!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
+ if(
mon == -1 &&
!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
for(i = 0; i < n; i++)
if(INTERSECT(x, y, 1, 1, info[i]))
break;
for(i = 0; i < n; i++)
if(INTERSECT(x, y, 1, 1, info[i]))
break;
@@
-614,7
+619,7
@@
setup(void) {
void
usage(void) {
void
usage(void) {
- fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font]\n"
+ fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font]
[-m monitor]
\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
exit(EXIT_FAILURE);
}
" [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
exit(EXIT_FAILURE);
}