]> Dogcows Code - chaz/openbox/blob - openbox/frame.c
0b85245652065687e6765b07d1b9745285cbfaa7
[chaz/openbox] / openbox / frame.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 frame.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #include "frame.h"
21 #include "client.h"
22 #include "openbox.h"
23 #include "extensions.h"
24 #include "prop.h"
25 #include "config.h"
26 #include "framerender.h"
27 #include "mainloop.h"
28 #include "focus_cycle.h"
29 #include "focus_cycle_indicator.h"
30 #include "composite.h"
31 #include "moveresize.h"
32 #include "screen.h"
33 #include "render/theme.h"
34
35 #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
36 ButtonPressMask | ButtonReleaseMask | \
37 SubstructureRedirectMask | FocusChangeMask)
38 #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
39 ButtonMotionMask | PointerMotionMask | \
40 EnterWindowMask | LeaveWindowMask)
41
42 #define FRAME_ANIMATE_ICONIFY_TIME 150000 /* .15 seconds */
43 #define FRAME_ANIMATE_ICONIFY_STEP_TIME (G_USEC_PER_SEC / 60) /* 60 Hz */
44
45 #define FRAME_HANDLE_Y(f) (f->size.top + f->client->area.height + f->cbwidth_b)
46
47 static void flash_done(gpointer data);
48 static gboolean flash_timeout(gpointer data);
49
50 static void layout_title(ObFrame *self);
51 static void set_theme_statics(ObFrame *self);
52 static void free_theme_statics(ObFrame *self);
53 static gboolean frame_animate_iconify(gpointer self);
54 static void frame_adjust_cursors(ObFrame *self);
55 static void frame_get_offscreen_buffer(ObFrame *self);
56 static void frame_free_offscreen_buffer(ObFrame *self);
57
58 static Window createWindow(Window parent, Visual *visual,
59 gulong mask, XSetWindowAttributes *attrib)
60 {
61 return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
62 (visual ? 32 : RrDepth(ob_rr_inst)), InputOutput,
63 (visual ? visual : RrVisual(ob_rr_inst)),
64 mask, attrib);
65
66 }
67
68 ObFrame *frame_new(ObClient *client)
69 {
70 XSetWindowAttributes attrib;
71 gulong mask;
72 ObFrame *self;
73 XWindowAttributes wattrib;
74 Status ret;
75
76 self = g_new0(ObFrame, 1);
77 self->client = client;
78
79 ret = XGetWindowAttributes(ob_display, client->window, &wattrib);
80 g_assert(ret != BadDrawable);
81 g_assert(ret != BadWindow);
82 self->has_alpha = composite_window_has_alpha(wattrib.visual);
83
84 /* create the non-visible decor windows */
85
86 mask = 0;
87 if (self->has_alpha) {
88 /* the colormap/backpixel/borderpixel are required for supporting
89 windows with 32bit visuals */
90 mask = CWColormap | CWBackPixel | CWBorderPixel;
91 /* create a colormap with the visual */
92 self->colormap = attrib.colormap =
93 XCreateColormap(ob_display,
94 RootWindow(ob_display, ob_screen),
95 wattrib.visual, AllocNone);
96 attrib.background_pixel = BlackPixel(ob_display, ob_screen);
97 attrib.border_pixel = BlackPixel(ob_display, ob_screen);
98 }
99
100 self->window = createWindow(RootWindow(ob_display, ob_screen),
101 (self->has_alpha ? wattrib.visual : NULL),
102 mask, &attrib);
103
104 /* create the visible decor windows */
105
106 mask = 0;
107 if (self->has_alpha) {
108 /* client has a 32-bit visual */
109 mask |= CWColormap | CWBackPixel | CWBorderPixel;
110 attrib.colormap = RrColormap(ob_rr_inst);
111 }
112
113 self->backback = createWindow(self->window, NULL, mask, &attrib);
114 self->backfront = createWindow(self->backback, NULL, mask, &attrib);
115
116 mask |= CWEventMask;
117 attrib.event_mask = ELEMENT_EVENTMASK;
118 self->innerleft = createWindow(self->window, NULL, mask, &attrib);
119 self->innertop = createWindow(self->window, NULL, mask, &attrib);
120 self->innerright = createWindow(self->window, NULL, mask, &attrib);
121 self->innerbottom = createWindow(self->window, NULL, mask, &attrib);
122
123 self->title = createWindow(self->window, NULL, mask, &attrib);
124 self->titleleft = createWindow(self->window, NULL, mask, &attrib);
125 self->titletop = createWindow(self->window, NULL, mask, &attrib);
126 self->titletopleft = createWindow(self->window, NULL, mask, &attrib);
127 self->titletopright = createWindow(self->window, NULL, mask, &attrib);
128 self->titleright = createWindow(self->window, NULL, mask, &attrib);
129 self->titlebottom = createWindow(self->window, NULL, mask, &attrib);
130
131 self->topresize = createWindow(self->title, NULL, mask, &attrib);
132 self->tltresize = createWindow(self->title, NULL, mask, &attrib);
133 self->tllresize = createWindow(self->title, NULL, mask, &attrib);
134 self->trtresize = createWindow(self->title, NULL, mask, &attrib);
135 self->trrresize = createWindow(self->title, NULL, mask, &attrib);
136
137 self->left = createWindow(self->window, NULL, mask, &attrib);
138 self->right = createWindow(self->window, NULL, mask, &attrib);
139
140 self->label = createWindow(self->title, NULL, mask, &attrib);
141 self->max = createWindow(self->title, NULL, mask, &attrib);
142 self->close = createWindow(self->title, NULL, mask, &attrib);
143 self->desk = createWindow(self->title, NULL, mask, &attrib);
144 self->shade = createWindow(self->title, NULL, mask, &attrib);
145 self->icon = createWindow(self->title, NULL, mask, &attrib);
146 self->iconify = createWindow(self->title, NULL, mask, &attrib);
147
148 self->handle = createWindow(self->window, NULL, mask, &attrib);
149 self->lgrip = createWindow(self->handle, NULL, mask, &attrib);
150 self->rgrip = createWindow(self->handle, NULL, mask, &attrib);
151
152 self->handleleft = createWindow(self->handle, NULL, mask, &attrib);
153 self->handleright = createWindow(self->handle, NULL, mask, &attrib);
154
155 self->handletop = createWindow(self->window, NULL, mask, &attrib);
156 self->handlebottom = createWindow(self->window, NULL, mask, &attrib);
157 self->lgripleft = createWindow(self->window, NULL, mask, &attrib);
158 self->lgriptop = createWindow(self->window, NULL, mask, &attrib);
159 self->lgripbottom = createWindow(self->window, NULL, mask, &attrib);
160 self->rgripright = createWindow(self->window, NULL, mask, &attrib);
161 self->rgriptop = createWindow(self->window, NULL, mask, &attrib);
162 self->rgripbottom = createWindow(self->window, NULL, mask, &attrib);
163
164 self->focused = FALSE;
165
166 /* the other stuff is shown based on decor settings */
167 XMapWindow(ob_display, self->label);
168 XMapWindow(ob_display, self->backback);
169 XMapWindow(ob_display, self->backfront);
170
171 self->max_press = self->close_press = self->desk_press =
172 self->iconify_press = self->shade_press = FALSE;
173 self->max_hover = self->close_hover = self->desk_hover =
174 self->iconify_hover = self->shade_hover = FALSE;
175
176 set_theme_statics(self);
177
178 return (ObFrame*)self;
179 }
180
181 static void set_theme_statics(ObFrame *self)
182 {
183 /* set colors/appearance/sizes for stuff that doesn't change */
184 XResizeWindow(ob_display, self->max,
185 ob_rr_theme->button_size, ob_rr_theme->button_size);
186 XResizeWindow(ob_display, self->iconify,
187 ob_rr_theme->button_size, ob_rr_theme->button_size);
188 XResizeWindow(ob_display, self->icon,
189 ob_rr_theme->button_size + 2, ob_rr_theme->button_size + 2);
190 XResizeWindow(ob_display, self->close,
191 ob_rr_theme->button_size, ob_rr_theme->button_size);
192 XResizeWindow(ob_display, self->desk,
193 ob_rr_theme->button_size, ob_rr_theme->button_size);
194 XResizeWindow(ob_display, self->shade,
195 ob_rr_theme->button_size, ob_rr_theme->button_size);
196 XResizeWindow(ob_display, self->tltresize,
197 ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1);
198 XResizeWindow(ob_display, self->trtresize,
199 ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1);
200 XResizeWindow(ob_display, self->tllresize,
201 ob_rr_theme->paddingx + 1, ob_rr_theme->title_height);
202 XResizeWindow(ob_display, self->trrresize,
203 ob_rr_theme->paddingx + 1, ob_rr_theme->title_height);
204
205 /* set up the dynamic appearances */
206 self->a_unfocused_title = RrAppearanceCopy(ob_rr_theme->a_unfocused_title);
207 self->a_focused_title = RrAppearanceCopy(ob_rr_theme->a_focused_title);
208 self->a_unfocused_label = RrAppearanceCopy(ob_rr_theme->a_unfocused_label);
209 self->a_focused_label = RrAppearanceCopy(ob_rr_theme->a_focused_label);
210 self->a_unfocused_handle =
211 RrAppearanceCopy(ob_rr_theme->a_unfocused_handle);
212 self->a_focused_handle = RrAppearanceCopy(ob_rr_theme->a_focused_handle);
213 self->a_icon = RrAppearanceCopy(ob_rr_theme->a_icon);
214 }
215
216 static void free_theme_statics(ObFrame *self)
217 {
218 RrAppearanceFree(self->a_unfocused_title);
219 RrAppearanceFree(self->a_focused_title);
220 RrAppearanceFree(self->a_unfocused_label);
221 RrAppearanceFree(self->a_focused_label);
222 RrAppearanceFree(self->a_unfocused_handle);
223 RrAppearanceFree(self->a_focused_handle);
224 RrAppearanceFree(self->a_icon);
225 }
226
227 void frame_free(ObFrame *self)
228 {
229 free_theme_statics(self);
230
231 XDestroyWindow(ob_display, self->window);
232 if (self->colormap)
233 XFreeColormap(ob_display, self->colormap);
234 frame_free_offscreen_buffer(self);
235
236 g_free(self);
237 }
238
239 void frame_show(ObFrame *self)
240 {
241 if (!self->visible) {
242 self->visible = TRUE;
243 framerender_frame(self);
244 XMapWindow(ob_display, self->client->window);
245 XMapWindow(ob_display, self->window);
246
247 frame_get_offscreen_buffer(self);
248 }
249 }
250
251 void frame_hide(ObFrame *self)
252 {
253 if (self->visible) {
254 self->visible = FALSE;
255 if (!frame_iconify_animating(self))
256 XUnmapWindow(ob_display, self->window);
257
258 /* we unmap the client itself so that we can get MapRequest
259 events, and because the ICCCM tells us to! */
260 XUnmapWindow(ob_display, self->client->window);
261 self->client->ignore_unmaps += 1;
262 }
263 }
264
265 void frame_adjust_theme(ObFrame *self)
266 {
267 free_theme_statics(self);
268 set_theme_statics(self);
269 }
270
271 void frame_adjust_shape(ObFrame *self)
272 {
273 #ifdef SHAPE
274 gint num;
275 XRectangle xrect[2];
276
277 if (!self->client->shaped) {
278 /* clear the shape on the frame window */
279 XShapeCombineMask(ob_display, self->window, ShapeBounding,
280 self->size.left,
281 self->size.top,
282 None, ShapeSet);
283 } else {
284 /* make the frame's shape match the clients */
285 XShapeCombineShape(ob_display, self->window, ShapeBounding,
286 self->size.left,
287 self->size.top,
288 self->client->window,
289 ShapeBounding, ShapeSet);
290
291 num = 0;
292 if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
293 xrect[0].x = 0;
294 xrect[0].y = 0;
295 xrect[0].width = self->area.width;
296 xrect[0].height = self->size.top;
297 ++num;
298 }
299
300 if (self->decorations & OB_FRAME_DECOR_HANDLE &&
301 ob_rr_theme->handle_height > 0)
302 {
303 xrect[1].x = 0;
304 xrect[1].y = FRAME_HANDLE_Y(self);
305 xrect[1].width = self->area.width;
306 xrect[1].height = ob_rr_theme->handle_height +
307 self->bwidth * 2;
308 ++num;
309 }
310
311 XShapeCombineRectangles(ob_display, self->window,
312 ShapeBounding, 0, 0, xrect, num,
313 ShapeUnion, Unsorted);
314 }
315
316 if (self->pixmap)
317 XShapeCombineShape(ob_display, self->pixmap, ShapeBounding,
318 0, 0, self->window, ShapeBounding, ShapeSet);
319
320 #endif
321 }
322
323 void frame_adjust_area(ObFrame *self, gboolean moved,
324 gboolean resized, gboolean fake)
325 {
326 Strut oldsize;
327
328 oldsize = self->size;
329
330 if (resized) {
331 /* do this before changing the frame's status like max_horz max_vert */
332 frame_adjust_cursors(self);
333
334 self->functions = self->client->functions;
335 self->decorations = self->client->decorations;
336 self->max_horz = self->client->max_horz;
337 self->max_vert = self->client->max_vert;
338 self->shaded = self->client->shaded;
339
340 if (self->decorations & OB_FRAME_DECOR_BORDER ||
341 (self->client->undecorated && config_theme_keepborder))
342 self->bwidth = ob_rr_theme->fbwidth;
343 else
344 self->bwidth = 0;
345
346 if (self->decorations & OB_FRAME_DECOR_BORDER) {
347 self->cbwidth_l = self->cbwidth_r = ob_rr_theme->cbwidthx;
348 self->cbwidth_t = self->cbwidth_b = ob_rr_theme->cbwidthy;
349 } else
350 self->cbwidth_l = self->cbwidth_t =
351 self->cbwidth_r = self->cbwidth_b = 0;
352
353 if (self->max_horz) {
354 self->cbwidth_l = self->cbwidth_r = 0;
355 self->width = self->client->area.width;
356 if (self->max_vert)
357 self->cbwidth_b = 0;
358 } else
359 self->width = self->client->area.width +
360 self->cbwidth_l + self->cbwidth_r;
361
362 /* some elements are sized based of the width, so don't let them have
363 negative values */
364 self->width = MAX(self->width,
365 (ob_rr_theme->grip_width + self->bwidth) * 2 + 1);
366
367 STRUT_SET(self->size,
368 self->cbwidth_l + (!self->max_horz ? self->bwidth : 0),
369 self->cbwidth_t + self->bwidth,
370 self->cbwidth_r + (!self->max_horz ? self->bwidth : 0),
371 self->cbwidth_b + (!self->max_horz || !self->max_vert ?
372 self->bwidth : 0));
373
374 if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
375 self->size.top += ob_rr_theme->title_height + self->bwidth;
376 if (self->decorations & OB_FRAME_DECOR_HANDLE &&
377 ob_rr_theme->handle_height > 0)
378 {
379 self->size.bottom += ob_rr_theme->handle_height + self->bwidth;
380 }
381
382 /* position/size and map/unmap all the windows */
383
384 if (!fake) {
385 if (self->cbwidth_l) {
386 XMoveResizeWindow(ob_display, self->innerleft,
387 self->size.left - self->cbwidth_l,
388 self->size.top,
389 self->cbwidth_l, self->client->area.height);
390
391 XMapWindow(ob_display, self->innerleft);
392 } else
393 XUnmapWindow(ob_display, self->innerleft);
394
395 if (self->cbwidth_r) {
396 XMoveResizeWindow(ob_display, self->innerright,
397 self->size.left + self->client->area.width,
398 self->size.top,
399 self->cbwidth_r, self->client->area.height);
400
401 XMapWindow(ob_display, self->innerright);
402 } else
403 XUnmapWindow(ob_display, self->innerright);
404
405 if (self->cbwidth_t) {
406 XMoveResizeWindow(ob_display, self->innertop,
407 self->size.left - self->cbwidth_l,
408 self->size.top - self->cbwidth_t,
409 self->client->area.width +
410 self->cbwidth_l + self->cbwidth_r,
411 self->cbwidth_t);
412
413 XMapWindow(ob_display, self->innertop);
414 } else
415 XUnmapWindow(ob_display, self->innertop);
416
417 if (self->cbwidth_b) {
418 XMoveResizeWindow(ob_display, self->innerbottom,
419 self->size.left - self->cbwidth_l,
420 self->size.top + self->client->area.height,
421 self->client->area.width +
422 self->cbwidth_l + self->cbwidth_r,
423 self->cbwidth_b);
424
425 XMapWindow(ob_display, self->innerbottom);
426 } else
427 XUnmapWindow(ob_display, self->innerbottom);
428
429 if (self->bwidth) {
430 gint titlesides;
431
432 /* height of titleleft and titleright */
433 titlesides = (!self->max_horz ? ob_rr_theme->grip_width : 0);
434
435 XMoveResizeWindow(ob_display, self->titletop,
436 ob_rr_theme->grip_width + self->bwidth, 0,
437 /* width + bwidth*2 - bwidth*2 - grips*2 */
438 self->width - ob_rr_theme->grip_width * 2,
439 self->bwidth);
440 XMoveResizeWindow(ob_display, self->titletopleft,
441 0, 0,
442 ob_rr_theme->grip_width + self->bwidth,
443 self->bwidth);
444 XMoveResizeWindow(ob_display, self->titletopright,
445 self->client->area.width +
446 self->size.left + self->size.right -
447 ob_rr_theme->grip_width - self->bwidth,
448 0,
449 ob_rr_theme->grip_width + self->bwidth,
450 self->bwidth);
451
452 if (titlesides > 0) {
453 XMoveResizeWindow(ob_display, self->titleleft,
454 0, self->bwidth,
455 self->bwidth,
456 titlesides);
457 XMoveResizeWindow(ob_display, self->titleright,
458 self->client->area.width +
459 self->size.left + self->size.right -
460 self->bwidth,
461 self->bwidth,
462 self->bwidth,
463 titlesides);
464
465 XMapWindow(ob_display, self->titleleft);
466 XMapWindow(ob_display, self->titleright);
467 } else {
468 XUnmapWindow(ob_display, self->titleleft);
469 XUnmapWindow(ob_display, self->titleright);
470 }
471
472 XMapWindow(ob_display, self->titletop);
473 XMapWindow(ob_display, self->titletopleft);
474 XMapWindow(ob_display, self->titletopright);
475
476 if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
477 XMoveResizeWindow(ob_display, self->titlebottom,
478 (self->max_horz ? 0 : self->bwidth),
479 ob_rr_theme->title_height + self->bwidth,
480 self->width,
481 self->bwidth);
482
483 XMapWindow(ob_display, self->titlebottom);
484 } else
485 XUnmapWindow(ob_display, self->titlebottom);
486 } else {
487 XUnmapWindow(ob_display, self->titlebottom);
488
489 XUnmapWindow(ob_display, self->titletop);
490 XUnmapWindow(ob_display, self->titletopleft);
491 XUnmapWindow(ob_display, self->titletopright);
492 XUnmapWindow(ob_display, self->titleleft);
493 XUnmapWindow(ob_display, self->titleright);
494 }
495
496 if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
497 XMoveResizeWindow(ob_display, self->title,
498 (self->max_horz ? 0 : self->bwidth),
499 self->bwidth,
500 self->width, ob_rr_theme->title_height);
501
502 XMapWindow(ob_display, self->title);
503
504 if (self->decorations & OB_FRAME_DECOR_GRIPS) {
505 XMoveResizeWindow(ob_display, self->topresize,
506 ob_rr_theme->grip_width,
507 0,
508 self->width - ob_rr_theme->grip_width *2,
509 ob_rr_theme->paddingy + 1);
510
511 XMoveWindow(ob_display, self->tltresize, 0, 0);
512 XMoveWindow(ob_display, self->tllresize, 0, 0);
513 XMoveWindow(ob_display, self->trtresize,
514 self->width - ob_rr_theme->grip_width, 0);
515 XMoveWindow(ob_display, self->trrresize,
516 self->width - ob_rr_theme->paddingx - 1, 0);
517
518 XMapWindow(ob_display, self->topresize);
519 XMapWindow(ob_display, self->tltresize);
520 XMapWindow(ob_display, self->tllresize);
521 XMapWindow(ob_display, self->trtresize);
522 XMapWindow(ob_display, self->trrresize);
523 } else {
524 XUnmapWindow(ob_display, self->topresize);
525 XUnmapWindow(ob_display, self->tltresize);
526 XUnmapWindow(ob_display, self->tllresize);
527 XUnmapWindow(ob_display, self->trtresize);
528 XUnmapWindow(ob_display, self->trrresize);
529 }
530 } else
531 XUnmapWindow(ob_display, self->title);
532 }
533
534 if ((self->decorations & OB_FRAME_DECOR_TITLEBAR))
535 /* layout the title bar elements */
536 layout_title(self);
537
538 if (!fake) {
539 gint sidebwidth = self->max_horz ? 0 : self->bwidth;
540
541 if (self->bwidth && self->size.bottom) {
542 XMoveResizeWindow(ob_display, self->handlebottom,
543 ob_rr_theme->grip_width +
544 self->bwidth + sidebwidth,
545 self->size.top + self->client->area.height +
546 self->size.bottom - self->bwidth,
547 self->width - (ob_rr_theme->grip_width +
548 sidebwidth) * 2,
549 self->bwidth);
550
551
552 if (sidebwidth) {
553 XMoveResizeWindow(ob_display, self->lgripleft,
554 0,
555 self->size.top +
556 self->client->area.height +
557 self->size.bottom -
558 (!self->max_horz ?
559 ob_rr_theme->grip_width :
560 self->size.bottom - self->cbwidth_b),
561 self->bwidth,
562 (!self->max_horz ?
563 ob_rr_theme->grip_width :
564 self->size.bottom - self->cbwidth_b));
565 XMoveResizeWindow(ob_display, self->rgripright,
566 self->size.left +
567 self->client->area.width +
568 self->size.right - self->bwidth,
569 self->size.top +
570 self->client->area.height +
571 self->size.bottom -
572 (!self->max_horz ?
573 ob_rr_theme->grip_width :
574 self->size.bottom - self->cbwidth_b),
575 self->bwidth,
576 (!self->max_horz ?
577 ob_rr_theme->grip_width :
578 self->size.bottom - self->cbwidth_b));
579
580 XMapWindow(ob_display, self->lgripleft);
581 XMapWindow(ob_display, self->rgripright);
582 } else {
583 XUnmapWindow(ob_display, self->lgripleft);
584 XUnmapWindow(ob_display, self->rgripright);
585 }
586
587 XMoveResizeWindow(ob_display, self->lgripbottom,
588 sidebwidth,
589 self->size.top + self->client->area.height +
590 self->size.bottom - self->bwidth,
591 ob_rr_theme->grip_width + self->bwidth,
592 self->bwidth);
593 XMoveResizeWindow(ob_display, self->rgripbottom,
594 self->size.left + self->client->area.width +
595 self->size.right - self->bwidth - sidebwidth -
596 ob_rr_theme->grip_width,
597 self->size.top + self->client->area.height +
598 self->size.bottom - self->bwidth,
599 ob_rr_theme->grip_width + self->bwidth,
600 self->bwidth);
601
602 XMapWindow(ob_display, self->handlebottom);
603 XMapWindow(ob_display, self->lgripbottom);
604 XMapWindow(ob_display, self->rgripbottom);
605
606 if (self->decorations & OB_FRAME_DECOR_HANDLE &&
607 ob_rr_theme->handle_height > 0)
608 {
609 XMoveResizeWindow(ob_display, self->handletop,
610 ob_rr_theme->grip_width +
611 self->bwidth + sidebwidth,
612 FRAME_HANDLE_Y(self),
613 self->width - (ob_rr_theme->grip_width +
614 sidebwidth) * 2,
615 self->bwidth);
616 XMapWindow(ob_display, self->handletop);
617
618 if (self->decorations & OB_FRAME_DECOR_GRIPS) {
619 XMoveResizeWindow(ob_display, self->handleleft,
620 ob_rr_theme->grip_width,
621 0,
622 self->bwidth,
623 ob_rr_theme->handle_height);
624 XMoveResizeWindow(ob_display, self->handleright,
625 self->width -
626 ob_rr_theme->grip_width -
627 self->bwidth,
628 0,
629 self->bwidth,
630 ob_rr_theme->handle_height);
631
632 XMoveResizeWindow(ob_display, self->lgriptop,
633 sidebwidth,
634 FRAME_HANDLE_Y(self),
635 ob_rr_theme->grip_width +
636 self->bwidth,
637 self->bwidth);
638 XMoveResizeWindow(ob_display, self->rgriptop,
639 self->size.left +
640 self->client->area.width +
641 self->size.right - self->bwidth -
642 sidebwidth - ob_rr_theme->grip_width,
643 FRAME_HANDLE_Y(self),
644 ob_rr_theme->grip_width +
645 self->bwidth,
646 self->bwidth);
647
648 XMapWindow(ob_display, self->handleleft);
649 XMapWindow(ob_display, self->handleright);
650 XMapWindow(ob_display, self->lgriptop);
651 XMapWindow(ob_display, self->rgriptop);
652 } else {
653 XUnmapWindow(ob_display, self->handleleft);
654 XUnmapWindow(ob_display, self->handleright);
655 XUnmapWindow(ob_display, self->lgriptop);
656 XUnmapWindow(ob_display, self->rgriptop);
657 }
658 } else {
659 XUnmapWindow(ob_display, self->handleleft);
660 XUnmapWindow(ob_display, self->handleright);
661 XUnmapWindow(ob_display, self->lgriptop);
662 XUnmapWindow(ob_display, self->rgriptop);
663
664 XUnmapWindow(ob_display, self->handletop);
665 }
666 } else {
667 XUnmapWindow(ob_display, self->handleleft);
668 XUnmapWindow(ob_display, self->handleright);
669 XUnmapWindow(ob_display, self->lgriptop);
670 XUnmapWindow(ob_display, self->rgriptop);
671
672 XUnmapWindow(ob_display, self->handletop);
673
674 XUnmapWindow(ob_display, self->handlebottom);
675 XUnmapWindow(ob_display, self->lgripleft);
676 XUnmapWindow(ob_display, self->rgripright);
677 XUnmapWindow(ob_display, self->lgripbottom);
678 XUnmapWindow(ob_display, self->rgripbottom);
679 }
680
681 if (self->decorations & OB_FRAME_DECOR_HANDLE &&
682 ob_rr_theme->handle_height > 0)
683 {
684 XMoveResizeWindow(ob_display, self->handle,
685 sidebwidth,
686 FRAME_HANDLE_Y(self) + self->bwidth,
687 self->width, ob_rr_theme->handle_height);
688 XMapWindow(ob_display, self->handle);
689
690 if (self->decorations & OB_FRAME_DECOR_GRIPS) {
691 XMoveResizeWindow(ob_display, self->lgrip,
692 0, 0,
693 ob_rr_theme->grip_width,
694 ob_rr_theme->handle_height);
695 XMoveResizeWindow(ob_display, self->rgrip,
696 self->width - ob_rr_theme->grip_width,
697 0,
698 ob_rr_theme->grip_width,
699 ob_rr_theme->handle_height);
700
701 XMapWindow(ob_display, self->lgrip);
702 XMapWindow(ob_display, self->rgrip);
703 } else {
704 XUnmapWindow(ob_display, self->lgrip);
705 XUnmapWindow(ob_display, self->rgrip);
706 }
707 } else {
708 XUnmapWindow(ob_display, self->lgrip);
709 XUnmapWindow(ob_display, self->rgrip);
710
711 XUnmapWindow(ob_display, self->handle);
712 }
713
714 if (self->bwidth && !self->max_horz) {
715 XMoveResizeWindow(ob_display, self->left,
716 0,
717 self->bwidth + ob_rr_theme->grip_width,
718 self->bwidth,
719 self->client->area.height +
720 self->size.top + self->size.bottom -
721 ob_rr_theme->grip_width * 2);
722
723 XMapWindow(ob_display, self->left);
724 } else
725 XUnmapWindow(ob_display, self->left);
726
727 if (self->bwidth && !self->max_horz) {
728 XMoveResizeWindow(ob_display, self->right,
729 self->client->area.width +
730 self->cbwidth_l + self->cbwidth_r + self->bwidth,
731 self->bwidth + ob_rr_theme->grip_width,
732 self->bwidth,
733 self->client->area.height +
734 self->size.top + self->size.bottom -
735 ob_rr_theme->grip_width * 2);
736
737 XMapWindow(ob_display, self->right);
738 } else
739 XUnmapWindow(ob_display, self->right);
740
741 XMoveResizeWindow(ob_display, self->backback,
742 self->size.left, self->size.top,
743 self->client->area.width,
744 self->client->area.height);
745 }
746 }
747
748 /* shading can change without being moved or resized */
749 RECT_SET_SIZE(self->area,
750 self->client->area.width +
751 self->size.left + self->size.right,
752 (self->client->shaded ?
753 ob_rr_theme->title_height + self->bwidth * 2:
754 self->client->area.height +
755 self->size.top + self->size.bottom));
756
757 if ((moved || resized) && !fake) {
758 /* find the new coordinates, done after setting the frame.size, for
759 frame_client_gravity. */
760 self->area.x = self->client->area.x;
761 self->area.y = self->client->area.y;
762 frame_client_gravity(self, &self->area.x, &self->area.y,
763 self->client->area.width,
764 self->client->area.height);
765 }
766
767 if (!fake) {
768 if (!frame_iconify_animating(self))
769 /* move and resize the top level frame.
770 shading can change without being moved or resized.
771
772 but don't do this during an iconify animation. it will be
773 reflected afterwards.
774 */
775 XMoveResizeWindow(ob_display, self->window,
776 self->area.x,
777 self->area.y,
778 self->area.width,
779 self->area.height);
780
781 /* when the client has StaticGravity, it likes to move around.
782 also this correctly positions the client when it maps.
783 this also needs to be run when the frame's decorations sizes change!
784 */
785 XMoveWindow(ob_display, self->client->window,
786 self->size.left, self->size.top);
787
788 if (resized) {
789 self->need_render = TRUE;
790 framerender_frame(self);
791 frame_adjust_shape(self);
792
793 /* the offscreen buffer is invalid when the window is resized */
794 if (self->visible)
795 frame_get_offscreen_buffer(self);
796 }
797
798 if (!STRUT_EQUAL(self->size, oldsize)) {
799 gulong vals[4];
800 vals[0] = self->size.left;
801 vals[1] = self->size.right;
802 vals[2] = self->size.top;
803 vals[3] = self->size.bottom;
804 PROP_SETA32(self->client->window, net_frame_extents,
805 cardinal, vals, 4);
806 PROP_SETA32(self->client->window, kde_net_wm_frame_strut,
807 cardinal, vals, 4);
808 }
809
810 /* if this occurs while we are focus cycling, the indicator needs to
811 match the changes */
812 if (focus_cycle_target == self->client)
813 focus_cycle_draw_indicator(self->client);
814 }
815 if (resized && (self->decorations & OB_FRAME_DECOR_TITLEBAR))
816 XResizeWindow(ob_display, self->label, self->label_width,
817 ob_rr_theme->label_height);
818
819 }
820
821 static void frame_adjust_cursors(ObFrame *self)
822 {
823 if ((self->functions & OB_CLIENT_FUNC_RESIZE) !=
824 (self->client->functions & OB_CLIENT_FUNC_RESIZE) ||
825 self->max_horz != self->client->max_horz ||
826 self->max_vert != self->client->max_vert ||
827 self->shaded != self->client->shaded)
828 {
829 gboolean r = (self->client->functions & OB_CLIENT_FUNC_RESIZE) &&
830 !(self->client->max_horz && self->client->max_vert);
831 gboolean topbot = !self->client->max_vert;
832 gboolean sh = self->client->shaded;
833 XSetWindowAttributes a;
834
835 /* these ones turn off when max vert, and some when shaded */
836 a.cursor = ob_cursor(r && topbot && !sh ?
837 OB_CURSOR_NORTH : OB_CURSOR_NONE);
838 XChangeWindowAttributes(ob_display, self->topresize, CWCursor, &a);
839 XChangeWindowAttributes(ob_display, self->titletop, CWCursor, &a);
840 a.cursor = ob_cursor(r && topbot ? OB_CURSOR_SOUTH : OB_CURSOR_NONE);
841 XChangeWindowAttributes(ob_display, self->handle, CWCursor, &a);
842 XChangeWindowAttributes(ob_display, self->handletop, CWCursor, &a);
843 XChangeWindowAttributes(ob_display, self->handlebottom, CWCursor, &a);
844 XChangeWindowAttributes(ob_display, self->innerbottom, CWCursor, &a);
845
846 /* these ones change when shaded */
847 a.cursor = ob_cursor(r ? (sh ? OB_CURSOR_WEST : OB_CURSOR_NORTHWEST) :
848 OB_CURSOR_NONE);
849 XChangeWindowAttributes(ob_display, self->titleleft, CWCursor, &a);
850 XChangeWindowAttributes(ob_display, self->tltresize, CWCursor, &a);
851 XChangeWindowAttributes(ob_display, self->tllresize, CWCursor, &a);
852 XChangeWindowAttributes(ob_display, self->titletopleft, CWCursor, &a);
853 a.cursor = ob_cursor(r ? (sh ? OB_CURSOR_EAST : OB_CURSOR_NORTHEAST) :
854 OB_CURSOR_NONE);
855 XChangeWindowAttributes(ob_display, self->titleright, CWCursor, &a);
856 XChangeWindowAttributes(ob_display, self->trtresize, CWCursor, &a);
857 XChangeWindowAttributes(ob_display, self->trrresize, CWCursor, &a);
858 XChangeWindowAttributes(ob_display, self->titletopright, CWCursor, &a);
859
860 /* these ones are pretty static */
861 a.cursor = ob_cursor(r ? OB_CURSOR_WEST : OB_CURSOR_NONE);
862 XChangeWindowAttributes(ob_display, self->left, CWCursor, &a);
863 XChangeWindowAttributes(ob_display, self->innerleft, CWCursor, &a);
864 a.cursor = ob_cursor(r ? OB_CURSOR_EAST : OB_CURSOR_NONE);
865 XChangeWindowAttributes(ob_display, self->right, CWCursor, &a);
866 XChangeWindowAttributes(ob_display, self->innerright, CWCursor, &a);
867 a.cursor = ob_cursor(r ? OB_CURSOR_SOUTHWEST : OB_CURSOR_NONE);
868 XChangeWindowAttributes(ob_display, self->lgrip, CWCursor, &a);
869 XChangeWindowAttributes(ob_display, self->handleleft, CWCursor, &a);
870 XChangeWindowAttributes(ob_display, self->lgripleft, CWCursor, &a);
871 XChangeWindowAttributes(ob_display, self->lgriptop, CWCursor, &a);
872 XChangeWindowAttributes(ob_display, self->lgripbottom, CWCursor, &a);
873 a.cursor = ob_cursor(r ? OB_CURSOR_SOUTHEAST : OB_CURSOR_NONE);
874 XChangeWindowAttributes(ob_display, self->rgrip, CWCursor, &a);
875 XChangeWindowAttributes(ob_display, self->handleright, CWCursor, &a);
876 XChangeWindowAttributes(ob_display, self->rgripright, CWCursor, &a);
877 XChangeWindowAttributes(ob_display, self->rgriptop, CWCursor, &a);
878 XChangeWindowAttributes(ob_display, self->rgripbottom, CWCursor, &a);
879 }
880 }
881
882 void frame_adjust_client_area(ObFrame *self)
883 {
884 /* adjust the window which is there to prevent flashing on unmap */
885 XMoveResizeWindow(ob_display, self->backfront, 0, 0,
886 self->client->area.width,
887 self->client->area.height);
888 }
889
890 void frame_adjust_state(ObFrame *self)
891 {
892 self->need_render = TRUE;
893 framerender_frame(self);
894 }
895
896 void frame_adjust_focus(ObFrame *self, gboolean hilite)
897 {
898 self->focused = hilite;
899 self->need_render = TRUE;
900 framerender_frame(self);
901 XFlush(ob_display);
902 }
903
904 void frame_adjust_title(ObFrame *self)
905 {
906 self->need_render = TRUE;
907 framerender_frame(self);
908 }
909
910 void frame_adjust_icon(ObFrame *self)
911 {
912 self->need_render = TRUE;
913 framerender_frame(self);
914 }
915
916 void frame_grab_client(ObFrame *self)
917 {
918 /* DO NOT map the client window here. we used to do that, but it is bogus.
919 we need to set up the client's dimensions and everything before we
920 send a mapnotify or we create race conditions.
921 */
922
923 /* reparent the client to the frame */
924 XReparentWindow(ob_display, self->client->window, self->window, 0, 0);
925
926 /*
927 When reparenting the client window, it is usually not mapped yet, since
928 this occurs from a MapRequest. However, in the case where Openbox is
929 starting up, the window is already mapped, so we'll see an unmap event
930 for it.
931 */
932 if (ob_state() == OB_STATE_STARTING)
933 ++self->client->ignore_unmaps;
934
935 /* select the event mask on the client's parent (to receive config/map
936 req's) the ButtonPress is to catch clicks on the client border */
937 XSelectInput(ob_display, self->window, FRAME_EVENTMASK);
938
939 /* set all the windows for the frame in the window_map */
940 g_hash_table_insert(window_map, &self->window, self->client);
941 g_hash_table_insert(window_map, &self->backback, self->client);
942 g_hash_table_insert(window_map, &self->backfront, self->client);
943 g_hash_table_insert(window_map, &self->innerleft, self->client);
944 g_hash_table_insert(window_map, &self->innertop, self->client);
945 g_hash_table_insert(window_map, &self->innerright, self->client);
946 g_hash_table_insert(window_map, &self->innerbottom, self->client);
947 g_hash_table_insert(window_map, &self->title, self->client);
948 g_hash_table_insert(window_map, &self->label, self->client);
949 g_hash_table_insert(window_map, &self->max, self->client);
950 g_hash_table_insert(window_map, &self->close, self->client);
951 g_hash_table_insert(window_map, &self->desk, self->client);
952 g_hash_table_insert(window_map, &self->shade, self->client);
953 g_hash_table_insert(window_map, &self->icon, self->client);
954 g_hash_table_insert(window_map, &self->iconify, self->client);
955 g_hash_table_insert(window_map, &self->handle, self->client);
956 g_hash_table_insert(window_map, &self->lgrip, self->client);
957 g_hash_table_insert(window_map, &self->rgrip, self->client);
958 g_hash_table_insert(window_map, &self->topresize, self->client);
959 g_hash_table_insert(window_map, &self->tltresize, self->client);
960 g_hash_table_insert(window_map, &self->tllresize, self->client);
961 g_hash_table_insert(window_map, &self->trtresize, self->client);
962 g_hash_table_insert(window_map, &self->trrresize, self->client);
963 g_hash_table_insert(window_map, &self->left, self->client);
964 g_hash_table_insert(window_map, &self->right, self->client);
965 g_hash_table_insert(window_map, &self->titleleft, self->client);
966 g_hash_table_insert(window_map, &self->titletop, self->client);
967 g_hash_table_insert(window_map, &self->titletopleft, self->client);
968 g_hash_table_insert(window_map, &self->titletopright, self->client);
969 g_hash_table_insert(window_map, &self->titleright, self->client);
970 g_hash_table_insert(window_map, &self->titlebottom, self->client);
971 g_hash_table_insert(window_map, &self->handleleft, self->client);
972 g_hash_table_insert(window_map, &self->handletop, self->client);
973 g_hash_table_insert(window_map, &self->handleright, self->client);
974 g_hash_table_insert(window_map, &self->handlebottom, self->client);
975 g_hash_table_insert(window_map, &self->lgripleft, self->client);
976 g_hash_table_insert(window_map, &self->lgriptop, self->client);
977 g_hash_table_insert(window_map, &self->lgripbottom, self->client);
978 g_hash_table_insert(window_map, &self->rgripright, self->client);
979 g_hash_table_insert(window_map, &self->rgriptop, self->client);
980 g_hash_table_insert(window_map, &self->rgripbottom, self->client);
981 }
982
983 void frame_release_client(ObFrame *self)
984 {
985 XEvent ev;
986 gboolean reparent = TRUE;
987
988 /* if there was any animation going on, kill it */
989 ob_main_loop_timeout_remove_data(ob_main_loop, frame_animate_iconify,
990 self, FALSE);
991
992 /* check if the app has already reparented its window away */
993 while (XCheckTypedWindowEvent(ob_display, self->client->window,
994 ReparentNotify, &ev))
995 {
996 /* This check makes sure we don't catch our own reparent action to
997 our frame window. This doesn't count as the app reparenting itself
998 away of course.
999
1000 Reparent events that are generated by us are just discarded here.
1001 They are of no consequence to us anyhow.
1002 */
1003 if (ev.xreparent.parent != self->window) {
1004 reparent = FALSE;
1005 XPutBackEvent(ob_display, &ev);
1006 break;
1007 }
1008 }
1009
1010 if (reparent) {
1011 /* according to the ICCCM - if the client doesn't reparent itself,
1012 then we will reparent the window to root for them */
1013 XReparentWindow(ob_display, self->client->window,
1014 RootWindow(ob_display, ob_screen),
1015 self->client->area.x,
1016 self->client->area.y);
1017 }
1018
1019 /* remove all the windows for the frame from the window_map */
1020 g_hash_table_remove(window_map, &self->window);
1021 g_hash_table_remove(window_map, &self->backback);
1022 g_hash_table_remove(window_map, &self->backfront);
1023 g_hash_table_remove(window_map, &self->innerleft);
1024 g_hash_table_remove(window_map, &self->innertop);
1025 g_hash_table_remove(window_map, &self->innerright);
1026 g_hash_table_remove(window_map, &self->innerbottom);
1027 g_hash_table_remove(window_map, &self->title);
1028 g_hash_table_remove(window_map, &self->label);
1029 g_hash_table_remove(window_map, &self->max);
1030 g_hash_table_remove(window_map, &self->close);
1031 g_hash_table_remove(window_map, &self->desk);
1032 g_hash_table_remove(window_map, &self->shade);
1033 g_hash_table_remove(window_map, &self->icon);
1034 g_hash_table_remove(window_map, &self->iconify);
1035 g_hash_table_remove(window_map, &self->handle);
1036 g_hash_table_remove(window_map, &self->lgrip);
1037 g_hash_table_remove(window_map, &self->rgrip);
1038 g_hash_table_remove(window_map, &self->topresize);
1039 g_hash_table_remove(window_map, &self->tltresize);
1040 g_hash_table_remove(window_map, &self->tllresize);
1041 g_hash_table_remove(window_map, &self->trtresize);
1042 g_hash_table_remove(window_map, &self->trrresize);
1043 g_hash_table_remove(window_map, &self->left);
1044 g_hash_table_remove(window_map, &self->right);
1045 g_hash_table_remove(window_map, &self->titleleft);
1046 g_hash_table_remove(window_map, &self->titletop);
1047 g_hash_table_remove(window_map, &self->titletopleft);
1048 g_hash_table_remove(window_map, &self->titletopright);
1049 g_hash_table_remove(window_map, &self->titleright);
1050 g_hash_table_remove(window_map, &self->titlebottom);
1051 g_hash_table_remove(window_map, &self->handleleft);
1052 g_hash_table_remove(window_map, &self->handletop);
1053 g_hash_table_remove(window_map, &self->handleright);
1054 g_hash_table_remove(window_map, &self->handlebottom);
1055 g_hash_table_remove(window_map, &self->lgripleft);
1056 g_hash_table_remove(window_map, &self->lgriptop);
1057 g_hash_table_remove(window_map, &self->lgripbottom);
1058 g_hash_table_remove(window_map, &self->rgripright);
1059 g_hash_table_remove(window_map, &self->rgriptop);
1060 g_hash_table_remove(window_map, &self->rgripbottom);
1061
1062 ob_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self, TRUE);
1063 }
1064
1065 /* is there anything present between us and the label? */
1066 static gboolean is_button_present(ObFrame *self, const gchar *lc, gint dir) {
1067 for (; *lc != '\0' && lc >= config_title_layout; lc += dir) {
1068 if (*lc == ' ') continue; /* it was invalid */
1069 if (*lc == 'N' && self->decorations & OB_FRAME_DECOR_ICON)
1070 return TRUE;
1071 if (*lc == 'D' && self->decorations & OB_FRAME_DECOR_ALLDESKTOPS)
1072 return TRUE;
1073 if (*lc == 'S' && self->decorations & OB_FRAME_DECOR_SHADE)
1074 return TRUE;
1075 if (*lc == 'I' && self->decorations & OB_FRAME_DECOR_ICONIFY)
1076 return TRUE;
1077 if (*lc == 'M' && self->decorations & OB_FRAME_DECOR_MAXIMIZE)
1078 return TRUE;
1079 if (*lc == 'C' && self->decorations & OB_FRAME_DECOR_CLOSE)
1080 return TRUE;
1081 if (*lc == 'L') return FALSE;
1082 }
1083 return FALSE;
1084 }
1085
1086 static void layout_title(ObFrame *self)
1087 {
1088 gchar *lc;
1089 gint i;
1090
1091 const gint bwidth = ob_rr_theme->button_size + ob_rr_theme->paddingx + 1;
1092 /* position of the left most button */
1093 const gint left = ob_rr_theme->paddingx + 1;
1094 /* position of the right most button */
1095 const gint right = self->width;
1096
1097 /* turn them all off */
1098 self->icon_on = self->desk_on = self->shade_on = self->iconify_on =
1099 self->max_on = self->close_on = self->label_on = FALSE;
1100 self->label_width = self->width - (ob_rr_theme->paddingx + 1) * 2;
1101 self->leftmost = self->rightmost = OB_FRAME_CONTEXT_NONE;
1102
1103 /* figure out what's being show, find each element's position, and the
1104 width of the label
1105
1106 do the ones before the label, then after the label,
1107 i will be +1 the first time through when working to the left,
1108 and -1 the second time through when working to the right */
1109 for (i = 1; i >= -1; i-=2) {
1110 gint x;
1111 ObFrameContext *firstcon;
1112
1113 if (i > 0) {
1114 x = left;
1115 lc = config_title_layout;
1116 firstcon = &self->leftmost;
1117 } else {
1118 x = right;
1119 lc = config_title_layout + strlen(config_title_layout)-1;
1120 firstcon = &self->rightmost;
1121 }
1122
1123 /* stop at the end of the string (or the label, which calls break) */
1124 for (; *lc != '\0' && lc >= config_title_layout; lc+=i) {
1125 if (*lc == 'L') {
1126 if (i > 0) {
1127 self->label_on = TRUE;
1128 self->label_x = x;
1129 }
1130 break; /* break the for loop, do other side of label */
1131 } else if (*lc == 'N') {
1132 if (firstcon) *firstcon = OB_FRAME_CONTEXT_ICON;
1133 if ((self->icon_on = is_button_present(self, lc, i))) {
1134 /* icon is bigger than buttons */
1135 self->label_width -= bwidth + 2;
1136 if (i > 0) self->icon_x = x;
1137 x += i * (bwidth + 2);
1138 if (i < 0) self->icon_x = x;
1139 }
1140 } else if (*lc == 'D') {
1141 if (firstcon) *firstcon = OB_FRAME_CONTEXT_ALLDESKTOPS;
1142 if ((self->desk_on = is_button_present(self, lc, i))) {
1143 self->label_width -= bwidth;
1144 if (i > 0) self->desk_x = x;
1145 x += i * bwidth;
1146 if (i < 0) self->desk_x = x;
1147 }
1148 } else if (*lc == 'S') {
1149 if (firstcon) *firstcon = OB_FRAME_CONTEXT_SHADE;
1150 if ((self->shade_on = is_button_present(self, lc, i))) {
1151 self->label_width -= bwidth;
1152 if (i > 0) self->shade_x = x;
1153 x += i * bwidth;
1154 if (i < 0) self->shade_x = x;
1155 }
1156 } else if (*lc == 'I') {
1157 if (firstcon) *firstcon = OB_FRAME_CONTEXT_ICONIFY;
1158 if ((self->iconify_on = is_button_present(self, lc, i))) {
1159 self->label_width -= bwidth;
1160 if (i > 0) self->iconify_x = x;
1161 x += i * bwidth;
1162 if (i < 0) self->iconify_x = x;
1163 }
1164 } else if (*lc == 'M') {
1165 if (firstcon) *firstcon = OB_FRAME_CONTEXT_MAXIMIZE;
1166 if ((self->max_on = is_button_present(self, lc, i))) {
1167 self->label_width -= bwidth;
1168 if (i > 0) self->max_x = x;
1169 x += i * bwidth;
1170 if (i < 0) self->max_x = x;
1171 }
1172 } else if (*lc == 'C') {
1173 if (firstcon) *firstcon = OB_FRAME_CONTEXT_CLOSE;
1174 if ((self->close_on = is_button_present(self, lc, i))) {
1175 self->label_width -= bwidth;
1176 if (i > 0) self->close_x = x;
1177 x += i * bwidth;
1178 if (i < 0) self->close_x = x;
1179 }
1180 } else
1181 continue; /* don't set firstcon */
1182 firstcon = NULL;
1183 }
1184 }
1185
1186 /* position and map the elements */
1187 if (self->icon_on) {
1188 XMapWindow(ob_display, self->icon);
1189 XMoveWindow(ob_display, self->icon, self->icon_x,
1190 ob_rr_theme->paddingy);
1191 } else
1192 XUnmapWindow(ob_display, self->icon);
1193
1194 if (self->desk_on) {
1195 XMapWindow(ob_display, self->desk);
1196 XMoveWindow(ob_display, self->desk, self->desk_x,
1197 ob_rr_theme->paddingy + 1);
1198 } else
1199 XUnmapWindow(ob_display, self->desk);
1200
1201 if (self->shade_on) {
1202 XMapWindow(ob_display, self->shade);
1203 XMoveWindow(ob_display, self->shade, self->shade_x,
1204 ob_rr_theme->paddingy + 1);
1205 } else
1206 XUnmapWindow(ob_display, self->shade);
1207
1208 if (self->iconify_on) {
1209 XMapWindow(ob_display, self->iconify);
1210 XMoveWindow(ob_display, self->iconify, self->iconify_x,
1211 ob_rr_theme->paddingy + 1);
1212 } else
1213 XUnmapWindow(ob_display, self->iconify);
1214
1215 if (self->max_on) {
1216 XMapWindow(ob_display, self->max);
1217 XMoveWindow(ob_display, self->max, self->max_x,
1218 ob_rr_theme->paddingy + 1);
1219 } else
1220 XUnmapWindow(ob_display, self->max);
1221
1222 if (self->close_on) {
1223 XMapWindow(ob_display, self->close);
1224 XMoveWindow(ob_display, self->close, self->close_x,
1225 ob_rr_theme->paddingy + 1);
1226 } else
1227 XUnmapWindow(ob_display, self->close);
1228
1229 if (self->label_on) {
1230 self->label_width = MAX(1, self->label_width); /* no lower than 1 */
1231 XMapWindow(ob_display, self->label);
1232 XMoveWindow(ob_display, self->label, self->label_x,
1233 ob_rr_theme->paddingy);
1234 } else
1235 XUnmapWindow(ob_display, self->label);
1236 }
1237
1238 ObFrameContext frame_context_from_string(const gchar *name)
1239 {
1240 if (!g_ascii_strcasecmp("Desktop", name))
1241 return OB_FRAME_CONTEXT_DESKTOP;
1242 else if (!g_ascii_strcasecmp("Root", name))
1243 return OB_FRAME_CONTEXT_ROOT;
1244 else if (!g_ascii_strcasecmp("Client", name))
1245 return OB_FRAME_CONTEXT_CLIENT;
1246 else if (!g_ascii_strcasecmp("Titlebar", name))
1247 return OB_FRAME_CONTEXT_TITLEBAR;
1248 else if (!g_ascii_strcasecmp("Frame", name))
1249 return OB_FRAME_CONTEXT_FRAME;
1250 else if (!g_ascii_strcasecmp("TLCorner", name))
1251 return OB_FRAME_CONTEXT_TLCORNER;
1252 else if (!g_ascii_strcasecmp("TRCorner", name))
1253 return OB_FRAME_CONTEXT_TRCORNER;
1254 else if (!g_ascii_strcasecmp("BLCorner", name))
1255 return OB_FRAME_CONTEXT_BLCORNER;
1256 else if (!g_ascii_strcasecmp("BRCorner", name))
1257 return OB_FRAME_CONTEXT_BRCORNER;
1258 else if (!g_ascii_strcasecmp("Top", name))
1259 return OB_FRAME_CONTEXT_TOP;
1260 else if (!g_ascii_strcasecmp("Bottom", name))
1261 return OB_FRAME_CONTEXT_BOTTOM;
1262 else if (!g_ascii_strcasecmp("Left", name))
1263 return OB_FRAME_CONTEXT_LEFT;
1264 else if (!g_ascii_strcasecmp("Right", name))
1265 return OB_FRAME_CONTEXT_RIGHT;
1266 else if (!g_ascii_strcasecmp("Maximize", name))
1267 return OB_FRAME_CONTEXT_MAXIMIZE;
1268 else if (!g_ascii_strcasecmp("AllDesktops", name))
1269 return OB_FRAME_CONTEXT_ALLDESKTOPS;
1270 else if (!g_ascii_strcasecmp("Shade", name))
1271 return OB_FRAME_CONTEXT_SHADE;
1272 else if (!g_ascii_strcasecmp("Iconify", name))
1273 return OB_FRAME_CONTEXT_ICONIFY;
1274 else if (!g_ascii_strcasecmp("Icon", name))
1275 return OB_FRAME_CONTEXT_ICON;
1276 else if (!g_ascii_strcasecmp("Close", name))
1277 return OB_FRAME_CONTEXT_CLOSE;
1278 else if (!g_ascii_strcasecmp("MoveResize", name))
1279 return OB_FRAME_CONTEXT_MOVE_RESIZE;
1280 return OB_FRAME_CONTEXT_NONE;
1281 }
1282
1283 ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
1284 {
1285 ObFrame *self;
1286
1287 if (moveresize_in_progress)
1288 return OB_FRAME_CONTEXT_MOVE_RESIZE;
1289
1290 if (win == RootWindow(ob_display, ob_screen))
1291 return OB_FRAME_CONTEXT_ROOT ;
1292 if (client == NULL) return OB_FRAME_CONTEXT_NONE;
1293 if (win == client->window) {
1294 /* conceptually, this is the desktop, as far as users are
1295 concerned */
1296 if (client->type == OB_CLIENT_TYPE_DESKTOP)
1297 return OB_FRAME_CONTEXT_DESKTOP;
1298 return OB_FRAME_CONTEXT_CLIENT;
1299 }
1300
1301 self = client->frame;
1302
1303 /* when the user clicks in the corners of the titlebar and the client
1304 is fully maximized, then treat it like they clicked in the
1305 button that is there */
1306 if (self->max_horz && self->max_vert &&
1307 (win == self->title || win == self->titletop ||
1308 win == self->titleleft || win == self->titletopleft ||
1309 win == self->titleright || win == self->titletopright))
1310 {
1311 /* get the mouse coords in reference to the whole frame */
1312 gint fx = x;
1313 gint fy = y;
1314
1315 /* these windows are down a border width from the top of the frame */
1316 if (win == self->title ||
1317 win == self->titleleft || win == self->titleright)
1318 fy += self->bwidth;
1319
1320 /* title is a border width in from the edge */
1321 if (win == self->title)
1322 fx += self->bwidth;
1323 /* titletop is a bit to the right */
1324 else if (win == self->titletop)
1325 fx += ob_rr_theme->grip_width + self->bwidth;
1326 /* titletopright is way to the right edge */
1327 else if (win == self->titletopright)
1328 fx += self->area.width - (ob_rr_theme->grip_width + self->bwidth);
1329 /* titleright is even more way to the right edge */
1330 else if (win == self->titleright)
1331 fx += self->area.width - self->bwidth;
1332
1333 /* figure out if we're over the area that should be considered a
1334 button */
1335 if (fy < self->bwidth + ob_rr_theme->paddingy + 1 +
1336 ob_rr_theme->button_size)
1337 {
1338 if (fx < (self->bwidth + ob_rr_theme->paddingx + 1 +
1339 ob_rr_theme->button_size))
1340 {
1341 if (self->leftmost != OB_FRAME_CONTEXT_NONE)
1342 return self->leftmost;
1343 }
1344 else if (fx >= (self->area.width -
1345 (self->bwidth + ob_rr_theme->paddingx + 1 +
1346 ob_rr_theme->button_size)))
1347 {
1348 if (self->rightmost != OB_FRAME_CONTEXT_NONE)
1349 return self->rightmost;
1350 }
1351 }
1352
1353 /* there is no resizing maximized windows so make them the titlebar
1354 context */
1355 return OB_FRAME_CONTEXT_TITLEBAR;
1356 }
1357 else if (self->max_vert &&
1358 (win == self->titletop || win == self->topresize))
1359 /* can't resize vertically when max vert */
1360 return OB_FRAME_CONTEXT_TITLEBAR;
1361 else if (self->shaded &&
1362 (win == self->titletop || win == self->topresize))
1363 /* can't resize vertically when shaded */
1364 return OB_FRAME_CONTEXT_TITLEBAR;
1365
1366 if (win == self->window) return OB_FRAME_CONTEXT_FRAME;
1367 if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR;
1368 if (win == self->handle) return OB_FRAME_CONTEXT_BOTTOM;
1369 if (win == self->handletop) return OB_FRAME_CONTEXT_BOTTOM;
1370 if (win == self->handlebottom) return OB_FRAME_CONTEXT_BOTTOM;
1371 if (win == self->handleleft) return OB_FRAME_CONTEXT_BLCORNER;
1372 if (win == self->lgrip) return OB_FRAME_CONTEXT_BLCORNER;
1373 if (win == self->lgripleft) return OB_FRAME_CONTEXT_BLCORNER;
1374 if (win == self->lgriptop) return OB_FRAME_CONTEXT_BLCORNER;
1375 if (win == self->lgripbottom) return OB_FRAME_CONTEXT_BLCORNER;
1376 if (win == self->handleright) return OB_FRAME_CONTEXT_BRCORNER;
1377 if (win == self->rgrip) return OB_FRAME_CONTEXT_BRCORNER;
1378 if (win == self->rgripright) return OB_FRAME_CONTEXT_BLCORNER;
1379 if (win == self->rgriptop) return OB_FRAME_CONTEXT_BLCORNER;
1380 if (win == self->rgripbottom) return OB_FRAME_CONTEXT_BLCORNER;
1381 if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR;
1382 if (win == self->titlebottom) return OB_FRAME_CONTEXT_TITLEBAR;
1383 if (win == self->titleleft) return OB_FRAME_CONTEXT_TLCORNER;
1384 if (win == self->titletopleft) return OB_FRAME_CONTEXT_TLCORNER;
1385 if (win == self->titleright) return OB_FRAME_CONTEXT_TRCORNER;
1386 if (win == self->titletopright) return OB_FRAME_CONTEXT_TRCORNER;
1387 if (win == self->titletop) return OB_FRAME_CONTEXT_TOP;
1388 if (win == self->topresize) return OB_FRAME_CONTEXT_TOP;
1389 if (win == self->tltresize) return OB_FRAME_CONTEXT_TLCORNER;
1390 if (win == self->tllresize) return OB_FRAME_CONTEXT_TLCORNER;
1391 if (win == self->trtresize) return OB_FRAME_CONTEXT_TRCORNER;
1392 if (win == self->trrresize) return OB_FRAME_CONTEXT_TRCORNER;
1393 if (win == self->left) return OB_FRAME_CONTEXT_LEFT;
1394 if (win == self->right) return OB_FRAME_CONTEXT_RIGHT;
1395 if (win == self->innertop) return OB_FRAME_CONTEXT_TITLEBAR;
1396 if (win == self->innerleft) return OB_FRAME_CONTEXT_LEFT;
1397 if (win == self->innerbottom) return OB_FRAME_CONTEXT_BOTTOM;
1398 if (win == self->innerright) return OB_FRAME_CONTEXT_RIGHT;
1399 if (win == self->max) return OB_FRAME_CONTEXT_MAXIMIZE;
1400 if (win == self->iconify) return OB_FRAME_CONTEXT_ICONIFY;
1401 if (win == self->close) return OB_FRAME_CONTEXT_CLOSE;
1402 if (win == self->icon) return OB_FRAME_CONTEXT_ICON;
1403 if (win == self->desk) return OB_FRAME_CONTEXT_ALLDESKTOPS;
1404 if (win == self->shade) return OB_FRAME_CONTEXT_SHADE;
1405
1406 return OB_FRAME_CONTEXT_NONE;
1407 }
1408
1409 void frame_client_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h)
1410 {
1411 /* horizontal */
1412 switch (self->client->gravity) {
1413 default:
1414 case NorthWestGravity:
1415 case SouthWestGravity:
1416 case WestGravity:
1417 break;
1418
1419 case NorthGravity:
1420 case SouthGravity:
1421 case CenterGravity:
1422 /* the middle of the client will be the middle of the frame */
1423 *x -= (self->size.right - self->size.left) / 2;
1424 break;
1425
1426 case NorthEastGravity:
1427 case SouthEastGravity:
1428 case EastGravity:
1429 /* the right side of the client will be the right side of the frame */
1430 *x -= self->size.right + self->size.left -
1431 self->client->border_width * 2;
1432 break;
1433
1434 case ForgetGravity:
1435 case StaticGravity:
1436 /* the client's position won't move */
1437 *x -= self->size.left - self->client->border_width;
1438 break;
1439 }
1440
1441 /* vertical */
1442 switch (self->client->gravity) {
1443 default:
1444 case NorthWestGravity:
1445 case NorthEastGravity:
1446 case NorthGravity:
1447 break;
1448
1449 case CenterGravity:
1450 case EastGravity:
1451 case WestGravity:
1452 /* the middle of the client will be the middle of the frame */
1453 *y -= (self->size.bottom - self->size.top) / 2;
1454 break;
1455
1456 case SouthWestGravity:
1457 case SouthEastGravity:
1458 case SouthGravity:
1459 /* the bottom of the client will be the bottom of the frame */
1460 *y -= self->size.bottom + self->size.top -
1461 self->client->border_width * 2;
1462 break;
1463
1464 case ForgetGravity:
1465 case StaticGravity:
1466 /* the client's position won't move */
1467 *y -= self->size.top - self->client->border_width;
1468 break;
1469 }
1470 }
1471
1472 void frame_frame_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h)
1473 {
1474 /* horizontal */
1475 switch (self->client->gravity) {
1476 default:
1477 case NorthWestGravity:
1478 case WestGravity:
1479 case SouthWestGravity:
1480 break;
1481 case NorthGravity:
1482 case CenterGravity:
1483 case SouthGravity:
1484 /* the middle of the client will be the middle of the frame */
1485 *x += (self->size.right - self->size.left) / 2;
1486 break;
1487 case NorthEastGravity:
1488 case EastGravity:
1489 case SouthEastGravity:
1490 /* the right side of the client will be the right side of the frame */
1491 *x += self->size.right + self->size.left -
1492 self->client->border_width * 2;
1493 break;
1494 case StaticGravity:
1495 case ForgetGravity:
1496 /* the client's position won't move */
1497 *x += self->size.left - self->client->border_width;
1498 break;
1499 }
1500
1501 /* vertical */
1502 switch (self->client->gravity) {
1503 default:
1504 case NorthWestGravity:
1505 case NorthGravity:
1506 case NorthEastGravity:
1507 break;
1508 case WestGravity:
1509 case CenterGravity:
1510 case EastGravity:
1511 /* the middle of the client will be the middle of the frame */
1512 *y += (self->size.bottom - self->size.top) / 2;
1513 break;
1514 case SouthWestGravity:
1515 case SouthGravity:
1516 case SouthEastGravity:
1517 /* the bottom of the client will be the bottom of the frame */
1518 *y += self->size.bottom + self->size.top -
1519 self->client->border_width * 2;
1520 break;
1521 case StaticGravity:
1522 case ForgetGravity:
1523 /* the client's position won't move */
1524 *y += self->size.top - self->client->border_width;
1525 break;
1526 }
1527 }
1528
1529 void frame_rect_to_frame(ObFrame *self, Rect *r)
1530 {
1531 r->width += self->size.left + self->size.right;
1532 r->height += self->size.top + self->size.bottom;
1533 frame_client_gravity(self, &r->x, &r->y, r->width, r->height);
1534 }
1535
1536 static void flash_done(gpointer data)
1537 {
1538 ObFrame *self = data;
1539
1540 if (self->focused != self->flash_on)
1541 frame_adjust_focus(self, self->focused);
1542 }
1543
1544 static gboolean flash_timeout(gpointer data)
1545 {
1546 ObFrame *self = data;
1547 GTimeVal now;
1548
1549 g_get_current_time(&now);
1550 if (now.tv_sec > self->flash_end.tv_sec ||
1551 (now.tv_sec == self->flash_end.tv_sec &&
1552 now.tv_usec >= self->flash_end.tv_usec))
1553 self->flashing = FALSE;
1554
1555 if (!self->flashing)
1556 return FALSE; /* we are done */
1557
1558 self->flash_on = !self->flash_on;
1559 if (!self->focused) {
1560 frame_adjust_focus(self, self->flash_on);
1561 self->focused = FALSE;
1562 }
1563
1564 return TRUE; /* go again */
1565 }
1566
1567 void frame_flash_start(ObFrame *self)
1568 {
1569 self->flash_on = self->focused;
1570
1571 if (!self->flashing)
1572 ob_main_loop_timeout_add(ob_main_loop,
1573 G_USEC_PER_SEC * 0.6,
1574 flash_timeout,
1575 self,
1576 g_direct_equal,
1577 flash_done);
1578 g_get_current_time(&self->flash_end);
1579 g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 5);
1580
1581 self->flashing = TRUE;
1582 }
1583
1584 void frame_flash_stop(ObFrame *self)
1585 {
1586 self->flashing = FALSE;
1587 }
1588
1589 static gulong frame_animate_iconify_time_left(ObFrame *self,
1590 const GTimeVal *now)
1591 {
1592 glong sec, usec;
1593 sec = self->iconify_animation_end.tv_sec - now->tv_sec;
1594 usec = self->iconify_animation_end.tv_usec - now->tv_usec;
1595 if (usec < 0) {
1596 usec += G_USEC_PER_SEC;
1597 sec--;
1598 }
1599 /* no negative values */
1600 return MAX(sec * G_USEC_PER_SEC + usec, 0);
1601 }
1602
1603 static gboolean frame_animate_iconify(gpointer p)
1604 {
1605 ObFrame *self = p;
1606 gint x, y, w, h;
1607 gint iconx, icony, iconw;
1608 GTimeVal now;
1609 gulong time;
1610 gboolean iconifying;
1611
1612 if (self->client->icon_geometry.width == 0) {
1613 /* there is no icon geometry set so just go straight down */
1614 Rect *a = screen_physical_area_monitor
1615 (screen_find_monitor(&self->area));
1616 iconx = self->area.x + self->area.width / 2 + 32;
1617 icony = a->y + a->width;
1618 iconw = 64;
1619 g_free(a);
1620 } else {
1621 iconx = self->client->icon_geometry.x;
1622 icony = self->client->icon_geometry.y;
1623 iconw = self->client->icon_geometry.width;
1624 }
1625
1626 iconifying = self->iconify_animation_going > 0;
1627
1628 /* how far do we have left to go ? */
1629 g_get_current_time(&now);
1630 time = frame_animate_iconify_time_left(self, &now);
1631
1632 if (time == 0 || iconifying) {
1633 /* start where the frame is supposed to be */
1634 x = self->area.x;
1635 y = self->area.y;
1636 w = self->area.width;
1637 h = self->area.height;
1638 } else {
1639 /* start at the icon */
1640 x = iconx;
1641 y = icony;
1642 w = iconw;
1643 h = self->size.top; /* just the titlebar */
1644 }
1645
1646 if (time > 0) {
1647 glong dx, dy, dw;
1648 glong elapsed;
1649
1650 dx = self->area.x - iconx;
1651 dy = self->area.y - icony;
1652 dw = self->area.width - self->bwidth * 2 - iconw;
1653 /* if restoring, we move in the opposite direction */
1654 if (!iconifying) { dx = -dx; dy = -dy; dw = -dw; }
1655
1656 elapsed = FRAME_ANIMATE_ICONIFY_TIME - time;
1657 x = x - (dx * elapsed) / FRAME_ANIMATE_ICONIFY_TIME;
1658 y = y - (dy * elapsed) / FRAME_ANIMATE_ICONIFY_TIME;
1659 w = w - (dw * elapsed) / FRAME_ANIMATE_ICONIFY_TIME;
1660 h = self->size.top; /* just the titlebar */
1661 }
1662
1663 if (time == 0)
1664 frame_end_iconify_animation(self);
1665 else {
1666 XMoveResizeWindow(ob_display, self->window, x, y, w, h);
1667 XFlush(ob_display);
1668 }
1669
1670 return time > 0; /* repeat until we're out of time */
1671 }
1672
1673 void frame_end_iconify_animation(ObFrame *self)
1674 {
1675 /* see if there is an animation going */
1676 if (self->iconify_animation_going == 0) return;
1677
1678 if (!self->visible)
1679 XUnmapWindow(ob_display, self->window);
1680 else {
1681 /* Send a ConfigureNotify when the animation is done, this fixes
1682 KDE's pager showing the window in the wrong place. */
1683 client_reconfigure(self->client, TRUE);
1684
1685 /* the offscreen buffer is invalid when the window is resized */
1686 frame_get_offscreen_buffer(self);
1687 }
1688
1689 /* we're not animating any more ! */
1690 self->iconify_animation_going = 0;
1691
1692 XMoveResizeWindow(ob_display, self->window,
1693 self->area.x, self->area.y,
1694 self->area.width, self->area.height);
1695 /* we delay re-rendering until after we're done animating */
1696 framerender_frame(self);
1697 XFlush(ob_display);
1698 }
1699
1700 void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying)
1701 {
1702 gulong time;
1703 gboolean new_anim = FALSE;
1704 gboolean set_end = TRUE;
1705 GTimeVal now;
1706
1707 /* if there is no titlebar, just don't animate for now
1708 XXX it would be nice tho.. */
1709 if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
1710 return;
1711
1712 /* get the current time */
1713 g_get_current_time(&now);
1714
1715 /* get how long until the end */
1716 time = FRAME_ANIMATE_ICONIFY_TIME;
1717 if (self->iconify_animation_going) {
1718 if (!!iconifying != (self->iconify_animation_going > 0)) {
1719 /* animation was already going on in the opposite direction */
1720 time = time - frame_animate_iconify_time_left(self, &now);
1721 } else
1722 /* animation was already going in the same direction */
1723 set_end = FALSE;
1724 } else
1725 new_anim = TRUE;
1726 self->iconify_animation_going = iconifying ? 1 : -1;
1727
1728 /* set the ending time */
1729 if (set_end) {
1730 self->iconify_animation_end.tv_sec = now.tv_sec;
1731 self->iconify_animation_end.tv_usec = now.tv_usec;
1732 g_time_val_add(&self->iconify_animation_end, time);
1733 }
1734
1735 if (new_anim) {
1736 ob_main_loop_timeout_remove_data(ob_main_loop, frame_animate_iconify,
1737 self, FALSE);
1738 ob_main_loop_timeout_add(ob_main_loop,
1739 FRAME_ANIMATE_ICONIFY_STEP_TIME,
1740 frame_animate_iconify, self,
1741 g_direct_equal, NULL);
1742
1743 /* do the first step */
1744 frame_animate_iconify(self);
1745
1746 /* show it during the animation even if it is not "visible" */
1747 if (!self->visible)
1748 XMapWindow(ob_display, self->window);
1749 }
1750 }
1751
1752 static void frame_get_offscreen_buffer(ObFrame *self)
1753 {
1754 frame_free_offscreen_buffer(self);
1755
1756 if (self->visible || frame_iconify_animating(self)) {
1757 self->pixmap = composite_get_window_pixmap(self->window);
1758 /*
1759 self->picture = composite_create_picture(self->window,
1760 wattrib.visual,
1761 &self->has_alpha);
1762 */
1763 }
1764
1765 }
1766
1767 static void frame_free_offscreen_buffer(ObFrame *self)
1768 {
1769 if (self->pixmap) {
1770 XFreePixmap(ob_display, self->pixmap);
1771 self->pixmap = None;
1772 }
1773 }
This page took 0.12775 seconds and 4 git commands to generate.