comparison event.c @ 13:5cc5e55a132d

added protocol killing stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 16:14:22 +0200
parents ea9c08ec4b48
children 359b6e563b95
comparison
equal deleted inserted replaced
12:a2b399582afe 13:5cc5e55a132d
5 5
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <X11/keysym.h> 9 #include <X11/keysym.h>
10 #include <X11/Xatom.h>
10 11
11 #include "wm.h" 12 #include "wm.h"
12 13
13 /* local functions */ 14 /* local functions */
14 static void configurerequest(XEvent *e); 15 static void configurerequest(XEvent *e);
33 [PropertyNotify] = propertynotify, 34 [PropertyNotify] = propertynotify,
34 [UnmapNotify] = unmapnotify 35 [UnmapNotify] = unmapnotify
35 }; 36 };
36 37
37 unsigned int 38 unsigned int
38 flush_masked_events(long even_mask) 39 flush_events(long even_mask)
39 { 40 {
40 XEvent ev; 41 XEvent ev;
41 unsigned int n = 0; 42 unsigned int n = 0;
42 while(XCheckMaskEvent(dpy, even_mask, &ev)) n++; 43 while(XCheckMaskEvent(dpy, even_mask, &ev)) n++;
43 return n; 44 return n;
89 } 90 }
90 91
91 static void 92 static void
92 enternotify(XEvent *e) 93 enternotify(XEvent *e)
93 { 94 {
94 #if 0
95 XCrossingEvent *ev = &e->xcrossing; 95 XCrossingEvent *ev = &e->xcrossing;
96 Client *c; 96 Client *c;
97 97
98 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) 98 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
99 return; 99 return;
100 100
101 if((c = client_of_win(ev->window))) { 101 if((c = getclient(ev->window)))
102 Frame *f = c->sel; 102 focus(c);
103 Area *a = f->area;
104 if(a->mode == Colmax)
105 c = a->sel->client;
106 focus(c, False);
107 }
108 else if(ev->window == root) { 103 else if(ev->window == root) {
109 sel_screen = True; 104 sel_screen = True;
110 draw_frames(); 105 /*draw_frames();*/
111 } 106 }
112 #endif
113 } 107 }
114 108
115 static void 109 static void
116 leavenotify(XEvent *e) 110 leavenotify(XEvent *e)
117 { 111 {
135 } 129 }
136 130
137 static void 131 static void
138 keymapnotify(XEvent *e) 132 keymapnotify(XEvent *e)
139 { 133 {
140 #if 0
141 update_keys(); 134 update_keys();
142 #endif
143 } 135 }
144 136
145 static void 137 static void
146 maprequest(XEvent *e) 138 maprequest(XEvent *e)
147 { 139 {
162 } 154 }
163 155
164 static void 156 static void
165 propertynotify(XEvent *e) 157 propertynotify(XEvent *e)
166 { 158 {
167 #if 0
168 XPropertyEvent *ev = &e->xproperty; 159 XPropertyEvent *ev = &e->xproperty;
160 long msize;
169 Client *c; 161 Client *c;
170 162
171 if(ev->state == PropertyDelete) 163 if(ev->state == PropertyDelete)
172 return; /* ignore */ 164 return; /* ignore */
173 165
174 if((c = client_of_win(ev->window))) 166 if(ev->atom == wm_atom[WMProtocols]) {
175 prop_client(c, ev); 167 c->proto = win_proto(c->win);
176 #endif 168 return;
169 }
170 if((c = getclient(ev->window))) {
171 switch (ev->atom) {
172 default: break;
173 case XA_WM_TRANSIENT_FOR:
174 XGetTransientForHint(dpy, c->win, &c->trans);
175 break;
176 case XA_WM_NORMAL_HINTS:
177 if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize)
178 || !c->size.flags)
179 c->size.flags = PSize;
180 if(c->size.flags & PMinSize && c->size.flags & PMaxSize
181 && c->size.min_width == c->size.max_width
182 && c->size.min_height == c->size.max_height)
183 c->fixedsize = True;
184 else
185 c->fixedsize = False;
186 break;
187 }
188 if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
189 update_name(c);
190 /*draw_frame(c->sel);*/
191 }
192 }
177 } 193 }
178 194
179 static void 195 static void
180 unmapnotify(XEvent *e) 196 unmapnotify(XEvent *e)
181 { 197 {