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, NetLast }; /* EWMH atoms */ |
60 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
61 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
61 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
62 enum { ClkLtSymbol = 64, ClkStatusText, ClkWinTitle, |
62 enum { ClkLtSymbol = 64, ClkStatusText, ClkWinTitle, |
63 ClkClientWin, ClkLast }; /* clicks */ |
63 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
64 |
64 |
65 /* typedefs */ |
65 /* typedefs */ |
66 typedef unsigned int uint; |
66 typedef unsigned int uint; |
67 typedef unsigned long ulong; |
67 typedef unsigned long ulong; |
68 |
68 |
82 } Button; |
82 } Button; |
83 |
83 |
84 typedef struct Client Client; |
84 typedef struct Client Client; |
85 struct Client { |
85 struct Client { |
86 char name[256]; |
86 char name[256]; |
|
87 float mina, maxa; |
87 int x, y, w, h; |
88 int x, y, w, h; |
88 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
89 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
89 float mina, maxa; |
|
90 int bw, oldbw; |
90 int bw, oldbw; |
|
91 uint tags; |
91 Bool isbanned, isfixed, isfloating, ismoved, isurgent; |
92 Bool isbanned, isfixed, isfloating, ismoved, isurgent; |
92 uint tags; |
|
93 Client *next; |
93 Client *next; |
94 Client *snext; |
94 Client *snext; |
95 Window win; |
95 Window win; |
96 }; |
96 }; |
97 |
97 |
325 else if(ev->x > wx + ww - TEXTW(stext)) |
325 else if(ev->x > wx + ww - TEXTW(stext)) |
326 click = ClkStatusText; |
326 click = ClkStatusText; |
327 else |
327 else |
328 click = ClkWinTitle; |
328 click = ClkWinTitle; |
329 } |
329 } |
330 else if((c = getclient(ev->window))) |
330 else if((c = getclient(ev->window))) { |
|
331 focus(c); |
331 click = ClkClientWin; |
332 click = ClkClientWin; |
|
333 } |
332 |
334 |
333 for(i = 0; i < LENGTH(buttons); i++) |
335 for(i = 0; i < LENGTH(buttons); i++) |
334 if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button |
336 if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button |
335 && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) |
337 && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) |
336 buttons[i].func(&buttons[i].arg); |
338 buttons[i].func(&buttons[i].arg); |
1372 /* EWMH support per view */ |
1374 /* EWMH support per view */ |
1373 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
1375 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
1374 PropModeReplace, (unsigned char *) netatom, NetLast); |
1376 PropModeReplace, (unsigned char *) netatom, NetLast); |
1375 |
1377 |
1376 /* select for events */ |
1378 /* select for events */ |
1377 wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask |
1379 wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask |
1378 |EnterWindowMask|LeaveWindowMask|StructureNotifyMask; |
1380 |EnterWindowMask|LeaveWindowMask|StructureNotifyMask; |
1379 XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); |
1381 XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); |
1380 XSelectInput(dpy, root, wa.event_mask); |
1382 XSelectInput(dpy, root, wa.event_mask); |
1381 |
1383 |
1382 |
1384 |