got rid of compile time xidx, grabbing the mouse pointer instead, falling back to screen 0 if no pointer available
This commit is contained in:
		
							
								
								
									
										5
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								config.h
									
									
									
									
									
								
							@@ -6,9 +6,4 @@ static const char *normbgcolor = "#cccccc";
 | 
				
			|||||||
static const char *normfgcolor = "#000000";
 | 
					static const char *normfgcolor = "#000000";
 | 
				
			||||||
static const char *selbgcolor  = "#0066ff";
 | 
					static const char *selbgcolor  = "#0066ff";
 | 
				
			||||||
static const char *selfgcolor  = "#ffffff";
 | 
					static const char *selfgcolor  = "#ffffff";
 | 
				
			||||||
 | 
					 | 
				
			||||||
static unsigned int spaceitem  = 30; /* px between menu items */
 | 
					static unsigned int spaceitem  = 30; /* px between menu items */
 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef XINERAMA
 | 
					 | 
				
			||||||
static unsigned int xidx       = 0;  /* Xinerama screen index to use */
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								dmenu.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								dmenu.c
									
									
									
									
									
								
							@@ -16,7 +16,8 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* macros */
 | 
					/* macros */
 | 
				
			||||||
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
 | 
					#define CLEANMASK(mask)         (mask & ~(numlockmask | LockMask))
 | 
				
			||||||
 | 
					#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* enums */
 | 
					/* enums */
 | 
				
			||||||
enum { ColFG, ColBG, ColLast };
 | 
					enum { ColFG, ColBG, ColLast };
 | 
				
			||||||
@@ -585,7 +586,7 @@ run(void) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
setup(Bool topbar) {
 | 
					setup(Bool topbar) {
 | 
				
			||||||
	int i, j, x, y;
 | 
						int i, j, n, x, y;
 | 
				
			||||||
	XModifierKeymap *modmap;
 | 
						XModifierKeymap *modmap;
 | 
				
			||||||
	XSetWindowAttributes wa;
 | 
						XSetWindowAttributes wa;
 | 
				
			||||||
#if XINERAMA
 | 
					#if XINERAMA
 | 
				
			||||||
@@ -618,10 +619,20 @@ setup(Bool topbar) {
 | 
				
			|||||||
	mh = dc.font.height + 2;
 | 
						mh = dc.font.height + 2;
 | 
				
			||||||
#if XINERAMA
 | 
					#if XINERAMA
 | 
				
			||||||
	if(XineramaIsActive(dpy)) {
 | 
						if(XineramaIsActive(dpy)) {
 | 
				
			||||||
		info = XineramaQueryScreens(dpy, &i);
 | 
							i = 0;
 | 
				
			||||||
		x = info[xidx].x_org;
 | 
							info = XineramaQueryScreens(dpy, &n);
 | 
				
			||||||
		y = topbar ? info[xidx].y_org : info[xidx].y_org + info[xidx].height - mh;
 | 
							if(n > 1) {
 | 
				
			||||||
		mw = info[xidx].width;
 | 
								int di;
 | 
				
			||||||
 | 
								unsigned int dui;
 | 
				
			||||||
 | 
								Window dummy;
 | 
				
			||||||
 | 
								if(XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui))
 | 
				
			||||||
 | 
									for(i = 0; i < n; i++)
 | 
				
			||||||
 | 
										if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height))
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							x = info[i].x_org;
 | 
				
			||||||
 | 
							y = topbar ? info[i].y_org : info[i].y_org + info[i].height - mh;
 | 
				
			||||||
 | 
							mw = info[i].width;
 | 
				
			||||||
		XFree(info);
 | 
							XFree(info);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user