applied Sylvain Laurent's EWMH fullscreen state patch, simplified his patch a bit
This commit is contained in:
		
							parent
							
								
									1973ab0643
								
							
						
					
					
						commit
						c6180949a7
					
				| @ -1,7 +1,7 @@ | |||||||
| /* See LICENSE file for copyright and license details. */ | /* See LICENSE file for copyright and license details. */ | ||||||
| 
 | 
 | ||||||
| /* appearance */ | /* appearance */ | ||||||
| static const char font[]            = "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*"; | static const char font[]            = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*"; | ||||||
| static const char normbordercolor[] = "#cccccc"; | static const char normbordercolor[] = "#cccccc"; | ||||||
| static const char normbgcolor[]     = "#cccccc"; | static const char normbgcolor[]     = "#cccccc"; | ||||||
| static const char normfgcolor[]     = "#000000"; | static const char normfgcolor[]     = "#000000"; | ||||||
|  | |||||||
							
								
								
									
										24
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								dwm.c
									
									
									
									
									
								
							| @ -41,7 +41,6 @@ | |||||||
| #endif /* XINERAMA */ | #endif /* XINERAMA */ | ||||||
| 
 | 
 | ||||||
| /* macros */ | /* macros */ | ||||||
| #define D                       if(1) |  | ||||||
| #define BUTTONMASK              (ButtonPressMask|ButtonReleaseMask) | #define BUTTONMASK              (ButtonPressMask|ButtonReleaseMask) | ||||||
| #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)) | #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) | ||||||
| @ -58,7 +57,8 @@ | |||||||
| /* enums */ | /* enums */ | ||||||
| enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */ | enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */ | ||||||
| enum { ColBorder, ColFG, ColBG, ColLast };              /* color */ | enum { ColBorder, ColFG, ColBG, ColLast };              /* color */ | ||||||
| enum { NetSupported, NetWMName, NetLast };              /* EWMH atoms */ | enum { NetSupported, NetWMName, NetWMState, | ||||||
|  |        NetWMFullscreen, NetLast };                      /* EWMH atoms */ | ||||||
| enum { WMProtocols, WMDelete, WMState, WMLast };        /* default atoms */ | enum { WMProtocols, WMDelete, WMState, WMLast };        /* default atoms */ | ||||||
| enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, | ||||||
|        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */ |        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */ | ||||||
| @ -162,6 +162,7 @@ static void checkotherwm(void); | |||||||
| static void cleanup(void); | static void cleanup(void); | ||||||
| static void cleanupmon(Monitor *mon); | static void cleanupmon(Monitor *mon); | ||||||
| static void clearurgent(Client *c); | static void clearurgent(Client *c); | ||||||
|  | static void clientmessage(XEvent *e); | ||||||
| static void configure(Client *c); | static void configure(Client *c); | ||||||
| static void configurenotify(XEvent *e); | static void configurenotify(XEvent *e); | ||||||
| static void configurerequest(XEvent *e); | static void configurerequest(XEvent *e); | ||||||
| @ -250,6 +251,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *); | |||||||
| static unsigned int numlockmask = 0; | static unsigned int numlockmask = 0; | ||||||
| static void (*handler[LASTEvent]) (XEvent *) = { | static void (*handler[LASTEvent]) (XEvent *) = { | ||||||
| 	[ButtonPress] = buttonpress, | 	[ButtonPress] = buttonpress, | ||||||
|  | 	[ClientMessage] = clientmessage, | ||||||
| 	[ConfigureRequest] = configurerequest, | 	[ConfigureRequest] = configurerequest, | ||||||
| 	[ConfigureNotify] = configurenotify, | 	[ConfigureNotify] = configurenotify, | ||||||
| 	[DestroyNotify] = destroynotify, | 	[DestroyNotify] = destroynotify, | ||||||
| @ -1292,6 +1294,20 @@ propertynotify(XEvent *e) { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void | ||||||
|  | clientmessage(XEvent *e) { | ||||||
|  | 	XClientMessageEvent *cme = &e->xclient; | ||||||
|  | 
 | ||||||
|  | 	if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) { | ||||||
|  | 		if(cme->data.l[0]) | ||||||
|  | 			XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, | ||||||
|  | 			                PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); | ||||||
|  | 		else | ||||||
|  | 			XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, | ||||||
|  | 			                PropModeReplace, (unsigned char*)0, 0); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void | void | ||||||
| quit(const Arg *arg) { | quit(const Arg *arg) { | ||||||
| 	running = False; | 	running = False; | ||||||
| @ -1392,6 +1408,7 @@ run(void) { | |||||||
| 	XEvent ev; | 	XEvent ev; | ||||||
| 	static const char *evname[LASTEvent] = { | 	static const char *evname[LASTEvent] = { | ||||||
| 		[ButtonPress] = "buttonpress", | 		[ButtonPress] = "buttonpress", | ||||||
|  | 		[ClientMessage] = "clientmessage", | ||||||
| 		[ConfigureRequest] = "configurerequest", | 		[ConfigureRequest] = "configurerequest", | ||||||
| 		[ConfigureNotify] = "configurenotify", | 		[ConfigureNotify] = "configurenotify", | ||||||
| 		[DestroyNotify] = "destroynotify", | 		[DestroyNotify] = "destroynotify", | ||||||
| @ -1407,7 +1424,6 @@ run(void) { | |||||||
| 	/* main event loop */ | 	/* main event loop */ | ||||||
| 	XSync(dpy, False); | 	XSync(dpy, False); | ||||||
| 	while(running && !XNextEvent(dpy, &ev)) { | 	while(running && !XNextEvent(dpy, &ev)) { | ||||||
| 		D fprintf(stderr, "run event %s %ld\n", evname[ev.type], ev.xany.window); |  | ||||||
| 		if(handler[ev.type]) | 		if(handler[ev.type]) | ||||||
| 			handler[ev.type](&ev); /* call handler */ | 			handler[ev.type](&ev); /* call handler */ | ||||||
| 	} | 	} | ||||||
| @ -1510,6 +1526,8 @@ setup(void) { | |||||||
| 	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); | 	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); | ||||||
| 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); | 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); | ||||||
| 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); | 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); | ||||||
|  | 	netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); | ||||||
|  | 	netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); | ||||||
| 	/* init cursors */ | 	/* init cursors */ | ||||||
| 	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); | 	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); | ||||||
| 	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); | 	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user