fakefullscreen: prevent focus from drifting away from client when going from fullscreen to fake fullscreen
This commit is contained in:
		
							
								
								
									
										15
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								dwm.c
									
									
									
									
									
								
							| @@ -2494,7 +2494,13 @@ resizeclient(Client *c, int x, int y, int w, int h) | ||||
| 		#if MONOCLE_LAYOUT | ||||
| 	    || &monocle == c->mon->lt[c->mon->sellt]->arrange | ||||
| 	    #endif // MONOCLE_LAYOUT | ||||
| 	    ) && !c->isfullscreen && !c->isfloating | ||||
| 	    ) | ||||
| 	    #if FAKEFULLSCREEN_CLIENT_PATCH | ||||
| 	    && (c->fakefullscreen == 1 || !c->isfullscreen) && c->fakefullscreen | ||||
| 	    #else | ||||
| 	    && !c->isfullscreen | ||||
| 	    #endif // FAKEFULLSCREEN_CLIENT_PATCH | ||||
| 	    && !c->isfloating | ||||
| 	    && c->mon->lt[c->mon->sellt]->arrange) { | ||||
| 		c->w = wc.width += c->bw * 2; | ||||
| 		c->h = wc.height += c->bw * 2; | ||||
| @@ -2503,7 +2509,14 @@ resizeclient(Client *c, int x, int y, int w, int h) | ||||
| 	#endif // NOBORDER_PATCH | ||||
| 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); | ||||
| 	configure(c); | ||||
| 	#if FAKEFULLSCREEN_CLIENT_PATCH | ||||
| 	if (c->fakefullscreen == 1) | ||||
| 		XSync(dpy, True); | ||||
| 	else | ||||
| 		XSync(dpy, False); | ||||
| 	#else | ||||
| 	XSync(dpy, False); | ||||
| 	#endif // FAKEFULLSCREEN_CLIENT_PATCH | ||||
| } | ||||
|  | ||||
| void | ||||
|   | ||||
| @@ -6,11 +6,20 @@ togglefakefullscreen(const Arg *arg) | ||||
| 		return; | ||||
|  | ||||
| 	if (c->fakefullscreen) { | ||||
|         if (c->isfullscreen) | ||||
| 		if (c->isfullscreen) { | ||||
| 			if (c->isfloating && c->fakefullscreen == 1) { | ||||
| 				c->oldstate = c->isfloating; | ||||
| 				c->oldx = c->x; | ||||
| 				c->oldy = c->y; | ||||
| 				c->oldw = c->w; | ||||
| 				c->oldh = c->h; | ||||
| 			} | ||||
| 			c->fakefullscreen = 0; | ||||
| 		} | ||||
| 		else | ||||
| 			c->isfullscreen = 0; | ||||
| 	} else { | ||||
| 		c->fakefullscreen = 1; | ||||
| 		if (c->isfullscreen) { | ||||
| 			c->isfloating = c->oldstate; | ||||
| 			c->bw = c->oldbw; | ||||
| @@ -20,7 +29,6 @@ togglefakefullscreen(const Arg *arg) | ||||
| 			c->h = c->oldh; | ||||
| 			resizeclient(c, c->x, c->y, c->w, c->h); | ||||
| 		} | ||||
|         c->fakefullscreen = 1; | ||||
| 		c->isfullscreen = 0; | ||||
| 	} | ||||
| 	setfullscreen(c, !c->isfullscreen); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user