inputw: improve correctness and startup performance, by NRK
Always use ~30% of the monitor width for the input in horizontal mode. Patch adapted from NRK patches. This also does not calculate inputw when using vertical mode anymore (because the code is removed).main
							parent
							
								
									af8fbc7a90
								
							
						
					
					
						commit
						a5a24f475f
					
				
							
								
								
									
										10
									
								
								dmenu.c
								
								
								
								
							
							
						
						
									
										10
									
								
								dmenu.c
								
								
								
								
							| 
						 | 
					@ -698,13 +698,12 @@ static void
 | 
				
			||||||
setup(void)
 | 
					setup(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int x, y, i, j;
 | 
						int x, y, i, j;
 | 
				
			||||||
	unsigned int du, tmp;
 | 
						unsigned int du;
 | 
				
			||||||
	XSetWindowAttributes swa;
 | 
						XSetWindowAttributes swa;
 | 
				
			||||||
	XIM xim;
 | 
						XIM xim;
 | 
				
			||||||
	Window w, dw, *dws;
 | 
						Window w, dw, *dws;
 | 
				
			||||||
	XWindowAttributes wa;
 | 
						XWindowAttributes wa;
 | 
				
			||||||
	XClassHint ch = {"dmenu", "dmenu"};
 | 
						XClassHint ch = {"dmenu", "dmenu"};
 | 
				
			||||||
	struct item *item;
 | 
					 | 
				
			||||||
#ifdef XINERAMA
 | 
					#ifdef XINERAMA
 | 
				
			||||||
	XineramaScreenInfo *info;
 | 
						XineramaScreenInfo *info;
 | 
				
			||||||
	Window pw;
 | 
						Window pw;
 | 
				
			||||||
| 
						 | 
					@ -762,12 +761,7 @@ setup(void)
 | 
				
			||||||
		mw = wa.width;
 | 
							mw = wa.width;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
 | 
						promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
 | 
				
			||||||
	for (item = items; item && item->text; ++item) {
 | 
						inputw = mw / 3; /* input width: ~30% of monitor width */
 | 
				
			||||||
		if ((tmp = textw_clamp(item->text, mw/3)) > inputw) {
 | 
					 | 
				
			||||||
			if ((inputw = tmp) == mw/3)
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	match();
 | 
						match();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* create menu window */
 | 
						/* create menu window */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue