]> Dogcows Code - chaz/openbox/blob - openbox/extensions.c
add _NET_WM_FULL_PLACEMENT, cuz openbox does do placement, even tho it can be sucky...
[chaz/openbox] / openbox / extensions.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 extensions.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003 Ben 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 "openbox.h"
21 #include "geom.h"
22 #include "extensions.h"
23 #include "screen.h"
24
25 gboolean extensions_xkb = FALSE;
26 gint extensions_xkb_event_basep;
27 gboolean extensions_shape = FALSE;
28 gint extensions_shape_event_basep;
29 gboolean extensions_xinerama = FALSE;
30 gint extensions_xinerama_event_basep;
31 gboolean extensions_randr = FALSE;
32 gint extensions_randr_event_basep;
33
34 void extensions_query_all()
35 {
36 gint junk;
37 (void)junk;
38
39 #ifdef XKB
40 extensions_xkb =
41 XkbQueryExtension(ob_display, &junk, &extensions_xkb_event_basep,
42 &junk, NULL, NULL);
43 #endif
44
45 #ifdef SHAPE
46 extensions_shape =
47 XShapeQueryExtension(ob_display, &extensions_shape_event_basep,
48 &junk);
49 #endif
50
51 #ifdef XINERAMA
52 extensions_xinerama =
53 XineramaQueryExtension(ob_display, &extensions_xinerama_event_basep,
54 &junk) && XineramaIsActive(ob_display);
55 #endif
56
57 #ifdef XRANDR
58 extensions_randr =
59 XRRQueryExtension(ob_display, &extensions_randr_event_basep,
60 &junk);
61 #endif
62 }
63
64 void extensions_xinerama_screens(Rect **xin_areas, guint *nxin)
65 {
66 guint i;
67 gint l, r, t, b;
68 #ifdef XINERAMA
69 if (extensions_xinerama) {
70 guint i;
71 gint n;
72 XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n);
73 *nxin = n;
74 *xin_areas = g_new(Rect, *nxin + 1);
75 for (i = 0; i < *nxin; ++i)
76 RECT_SET((*xin_areas)[i], info[i].x_org, info[i].y_org,
77 info[i].width, info[i].height);
78 } else
79 #endif
80 {
81 *nxin = 1;
82 *xin_areas = g_new(Rect, *nxin + 1);
83 RECT_SET((*xin_areas)[0], 0, 0,
84 WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
85 HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
86 }
87
88 /* returns one extra with the total area in it */
89 l = (*xin_areas)[0].x;
90 t = (*xin_areas)[0].y;
91 r = (*xin_areas)[0].x + (*xin_areas)[0].width - 1;
92 b = (*xin_areas)[0].y + (*xin_areas)[0].height - 1;
93 for (i = 1; i < *nxin; ++i) {
94 l = MIN(l, (*xin_areas)[i].x);
95 t = MIN(l, (*xin_areas)[i].y);
96 r = MAX(r, (*xin_areas)[i].x + (*xin_areas)[i].width - 1);
97 b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1);
98 }
99 RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
100 }
This page took 0.03912 seconds and 4 git commands to generate.