dwm.c
changeset 1517 1ed1e75c9c2e
parent 1515 60ea8fed13ab
child 1519 72272822ddf2
equal deleted inserted replaced
1516:621ae8a17c07 1517:1ed1e75c9c2e
    55 #define TEXTW(X)                (textnw(X, strlen(X)) + dc.font.height)
    55 #define TEXTW(X)                (textnw(X, strlen(X)) + dc.font.height)
    56 
    56 
    57 /* enums */
    57 /* enums */
    58 enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
    58 enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
    59 enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
    59 enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
    60 enum { NetSupported, NetWMName, NetWMState,
    60 enum { NetSupported, NetWMName, NetWMState, NetLast };  /* EWMH atoms */
    61        NetWMFullscreen, NetLast };                      /* EWMH atoms */
       
    62 enum { WMProtocols, WMDelete, WMState, WMLast };        /* default atoms */
    61 enum { WMProtocols, WMDelete, WMState, WMLast };        /* default atoms */
    63 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
    62 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
    64        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
    63        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
    65 
    64 
    66 typedef union {
    65 typedef union {
   160 static void buttonpress(XEvent *e);
   159 static void buttonpress(XEvent *e);
   161 static void checkotherwm(void);
   160 static void checkotherwm(void);
   162 static void cleanup(void);
   161 static void cleanup(void);
   163 static void cleanupmon(Monitor *mon);
   162 static void cleanupmon(Monitor *mon);
   164 static void clearurgent(Client *c);
   163 static void clearurgent(Client *c);
   165 static void clientmessage(XEvent *e);
       
   166 static void configure(Client *c);
   164 static void configure(Client *c);
   167 static void configurenotify(XEvent *e);
   165 static void configurenotify(XEvent *e);
   168 static void configurerequest(XEvent *e);
   166 static void configurerequest(XEvent *e);
   169 static Monitor *createmon(void);
   167 static Monitor *createmon(void);
   170 static void destroynotify(XEvent *e);
   168 static void destroynotify(XEvent *e);
   249 static int bh, blw = 0;      /* bar geometry */
   247 static int bh, blw = 0;      /* bar geometry */
   250 static int (*xerrorxlib)(Display *, XErrorEvent *);
   248 static int (*xerrorxlib)(Display *, XErrorEvent *);
   251 static unsigned int numlockmask = 0;
   249 static unsigned int numlockmask = 0;
   252 static void (*handler[LASTEvent]) (XEvent *) = {
   250 static void (*handler[LASTEvent]) (XEvent *) = {
   253 	[ButtonPress] = buttonpress,
   251 	[ButtonPress] = buttonpress,
   254 	[ClientMessage] = clientmessage,
       
   255 	[ConfigureRequest] = configurerequest,
   252 	[ConfigureRequest] = configurerequest,
   256 	[ConfigureNotify] = configurenotify,
   253 	[ConfigureNotify] = configurenotify,
   257 	[DestroyNotify] = destroynotify,
   254 	[DestroyNotify] = destroynotify,
   258 	[EnterNotify] = enternotify,
   255 	[EnterNotify] = enternotify,
   259 	[Expose] = expose,
   256 	[Expose] = expose,
  1293 		}
  1290 		}
  1294 	}
  1291 	}
  1295 }
  1292 }
  1296 
  1293 
  1297 void
  1294 void
  1298 clientmessage(XEvent *e) {
       
  1299 	XClientMessageEvent *cme = &e->xclient;
       
  1300 
       
  1301 	if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) {
       
  1302 		if(cme->data.l[0])
       
  1303 			XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
       
  1304 			                PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
       
  1305 		else
       
  1306 			XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
       
  1307 			                PropModeReplace, (unsigned char*)0, 0);
       
  1308 	}
       
  1309 }
       
  1310 
       
  1311 void
       
  1312 quit(const Arg *arg) {
  1295 quit(const Arg *arg) {
  1313 	running = False;
  1296 	running = False;
  1314 }
  1297 }
  1315 
  1298 
  1316 void
  1299 void
  1510 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  1493 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  1511 	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
  1494 	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
  1512 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
  1495 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
  1513 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
  1496 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
  1514 	netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
  1497 	netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
  1515 	netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
       
  1516 	/* init cursors */
  1498 	/* init cursors */
  1517 	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
  1499 	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
  1518 	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
  1500 	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
  1519 	cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
  1501 	cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
  1520 	/* init appearance */
  1502 	/* init appearance */