comparison event.c @ 9:d567f430a81d

fixed several stuff (gridwm gets better and better)
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 12:52:57 +0200
parents e0cefb3981c8
children 703255003abb
comparison
equal deleted inserted replaced
8:7066ff2fe8bc 9:d567f430a81d
14 static void configurerequest(XEvent *e); 14 static void configurerequest(XEvent *e);
15 static void destroynotify(XEvent *e); 15 static void destroynotify(XEvent *e);
16 static void enternotify(XEvent *e); 16 static void enternotify(XEvent *e);
17 static void leavenotify(XEvent *e); 17 static void leavenotify(XEvent *e);
18 static void expose(XEvent *e); 18 static void expose(XEvent *e);
19 static void keypress(XEvent *e);
20 static void keymapnotify(XEvent *e); 19 static void keymapnotify(XEvent *e);
21 static void maprequest(XEvent *e); 20 static void maprequest(XEvent *e);
22 static void propertynotify(XEvent *e); 21 static void propertynotify(XEvent *e);
23 static void unmapnotify(XEvent *e); 22 static void unmapnotify(XEvent *e);
24 23
45 } 44 }
46 45
47 static void 46 static void
48 configurerequest(XEvent *e) 47 configurerequest(XEvent *e)
49 { 48 {
50 #if 0
51 XConfigureRequestEvent *ev = &e->xconfigurerequest; 49 XConfigureRequestEvent *ev = &e->xconfigurerequest;
52 XWindowChanges wc; 50 XWindowChanges wc;
53 XRectangle *frect;
54 Client *c; 51 Client *c;
55 52
56 c = client_of_win(ev->window); 53 c = getclient(ev->window);
57 ev->value_mask &= ~CWSibling; 54 ev->value_mask &= ~CWSibling;
58 if(c) { 55 if(c) {
59 gravitate_client(c, True);
60
61 if(ev->value_mask & CWX) 56 if(ev->value_mask & CWX)
62 c->rect.x = ev->x; 57 c->r[RFloat].x = ev->x;
63 if(ev->value_mask & CWY) 58 if(ev->value_mask & CWY)
64 c->rect.y = ev->y; 59 c->r[RFloat].y = ev->y;
65 if(ev->value_mask & CWWidth) 60 if(ev->value_mask & CWWidth)
66 c->rect.width = ev->width; 61 c->r[RFloat].width = ev->width;
67 if(ev->value_mask & CWHeight) 62 if(ev->value_mask & CWHeight)
68 c->rect.height = ev->height; 63 c->r[RFloat].height = ev->height;
69 if(ev->value_mask & CWBorderWidth) 64 if(ev->value_mask & CWBorderWidth)
70 c->border = ev->border_width; 65 c->border = ev->border_width;
71
72 gravitate_client(c, False);
73
74 if(c->frame) {
75 if(c->sel->area->floating)
76 frect=&c->sel->rect;
77 else
78 frect=&c->sel->revert;
79
80 if(c->rect.width >= screen->rect.width && c->rect.height >= screen->rect.height) {
81 frect->y = wc.y = -height_of_bar();
82 frect->x = wc.x = -def.border;
83 }
84 else {
85 frect->y = wc.y = c->rect.y - height_of_bar();
86 frect->x = wc.x = c->rect.x - def.border;
87 }
88 frect->width = wc.width = c->rect.width + 2 * def.border;
89 frect->height = wc.height = c->rect.height + def.border
90 + height_of_bar();
91 wc.border_width = 1;
92 wc.sibling = None;
93 wc.stack_mode = ev->detail;
94 if(c->sel->area->view != screen->sel)
95 wc.x += 2 * screen->rect.width;
96 if(c->sel->area->floating) {
97 XConfigureWindow(dpy, c->framewin, ev->value_mask, &wc);
98 configure_client(c);
99 }
100 }
101 } 66 }
102 67
103 wc.x = ev->x; 68 wc.x = ev->x;
104 wc.y = ev->y; 69 wc.y = ev->y;
105 wc.width = ev->width; 70 wc.width = ev->width;
106 wc.height = ev->height; 71 wc.height = ev->height;
107
108 if(c && c->frame) {
109 wc.x = def.border;
110 wc.y = height_of_bar();
111 wc.width = c->sel->rect.width - 2 * def.border;
112 wc.height = c->sel->rect.height - def.border - height_of_bar();
113 }
114
115 wc.border_width = 0; 72 wc.border_width = 0;
116 wc.sibling = None; 73 wc.sibling = None;
117 wc.stack_mode = Above; 74 wc.stack_mode = Above;
118 ev->value_mask &= ~CWStackMode; 75 ev->value_mask &= ~CWStackMode;
119 ev->value_mask |= CWBorderWidth; 76 ev->value_mask |= CWBorderWidth;
120 XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); 77 XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
121
122 XFlush(dpy); 78 XFlush(dpy);
123 #endif
124 } 79 }
125 80
126 static void 81 static void
127 destroynotify(XEvent *e) 82 destroynotify(XEvent *e)
128 { 83 {
180 draw_bar(); 135 draw_bar();
181 } 136 }
182 } 137 }
183 138
184 static void 139 static void
185 keypress(XEvent *e)
186 {
187 #if 0
188 XKeyEvent *ev = &e->xkey;
189 KeySym k = 0;
190 char buf[32];
191 int n;
192 static Frame *f;
193
194
195 ev->state &= valid_mask;
196 if((f = frame_of_win(ev->window))) {
197 buf[0] = 0;
198 n = XLookupString(ev, buf, sizeof(buf), &k, 0);
199 if(IsFunctionKey(k) || IsKeypadKey(k) || IsMiscFunctionKey(k)
200 || IsPFKey(k) || IsPrivateKeypadKey(k))
201 return;
202 buf[n] = 0;
203 blitz_kpress_input(&f->tagbar, ev->state, k, buf);
204 }
205 else
206 key(root, ev->state, (KeyCode) ev->keycode);
207 #endif
208 }
209
210 static void
211 keymapnotify(XEvent *e) 140 keymapnotify(XEvent *e)
212 { 141 {
213 #if 0 142 #if 0
214 update_keys(); 143 update_keys();
215 #endif 144 #endif
229 (StructureNotifyMask | PropertyChangeMask)); 158 (StructureNotifyMask | PropertyChangeMask));
230 return; 159 return;
231 } 160 }
232 161
233 /*if(!client_of_win(ev->window))*/ 162 /*if(!client_of_win(ev->window))*/
234 manage(create_client(ev->window, &wa)); 163 /*manage(create_client(ev->window, &wa));*/
164 XMapRaised(dpy, ev->window);
165 XMoveResizeWindow(dpy, ev->window, rect.x, rect.y, rect.width, rect.height - barrect.height);
166 XSetInputFocus(dpy, ev->window, RevertToPointerRoot, CurrentTime);
167 XFlush(dpy);
235 } 168 }
236 169
237 static void 170 static void
238 propertynotify(XEvent *e) 171 propertynotify(XEvent *e)
239 { 172 {