]> Dogcows Code - chaz/openbox/blob - openbox/extensions.c
remove blank line
[chaz/openbox] / openbox / extensions.c
1 #include "openbox.h"
2 #include "geom.h"
3 #include "extensions.h"
4 #include "screen.h"
5
6 gboolean extensions_xkb = FALSE;
7 int extensions_xkb_event_basep;
8 gboolean extensions_shape = FALSE;
9 int extensions_shape_event_basep;
10 gboolean extensions_xinerama = FALSE;
11 int extensions_xinerama_event_basep;
12 gboolean extensions_randr = FALSE;
13 int extensions_randr_event_basep;
14 gboolean extensions_vidmode = FALSE;
15 int extensions_vidmode_event_basep;
16
17 void extensions_query_all()
18 {
19 int junk;
20 (void)junk;
21
22 #ifdef XKB
23 extensions_xkb =
24 XkbQueryExtension(ob_display, &junk, &extensions_xkb_event_basep,
25 &junk, NULL, NULL);
26 #endif
27
28 #ifdef SHAPE
29 extensions_shape =
30 XShapeQueryExtension(ob_display, &extensions_shape_event_basep,
31 &junk);
32 #endif
33
34 #ifdef XINERAMA
35 extensions_xinerama =
36 XineramaQueryExtension(ob_display, &extensions_xinerama_event_basep,
37 &junk) && XineramaIsActive(ob_display);
38 #endif
39
40 #ifdef XRANDR
41 extensions_randr =
42 XRRQueryExtension(ob_display, &extensions_randr_event_basep,
43 &junk);
44 #endif
45
46 #ifdef VIDMODE
47 extensions_vidmode =
48 XF86VidModeQueryExtension(ob_display, &extensions_vidmode_event_basep,
49 &junk);
50 #endif
51 }
52
53 void extensions_xinerama_screens(Rect **xin_areas, guint *nxin)
54 {
55 guint i;
56 gint l, r, t, b;
57 #ifdef XINERAMA
58 if (extensions_xinerama) {
59 guint i;
60 gint n;
61 XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n);
62 *nxin = n;
63 *xin_areas = g_new(Rect, *nxin + 1);
64 for (i = 0; i < *nxin; ++i)
65 RECT_SET((*xin_areas)[i], info[i].x_org, info[i].y_org,
66 info[i].width, info[i].height);
67 } else
68 #endif
69 {
70 *nxin = 1;
71 *xin_areas = g_new(Rect, *nxin + 1);
72 RECT_SET((*xin_areas)[0], 0, 0,
73 WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
74 HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
75 }
76
77 /* returns one extra with the total area in it */
78 l = (*xin_areas)[0].x;
79 t = (*xin_areas)[0].y;
80 r = (*xin_areas)[0].x + (*xin_areas)[0].width - 1;
81 b = (*xin_areas)[0].y + (*xin_areas)[0].height - 1;
82 for (i = 1; i < *nxin; ++i) {
83 l = MIN(l, (*xin_areas)[i].x);
84 t = MIN(l, (*xin_areas)[i].y);
85 r = MAX(r, (*xin_areas)[i].x + (*xin_areas)[i].width - 1);
86 b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1);
87 }
88 RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
89 }
This page took 0.038085 seconds and 4 git commands to generate.