3 #include "extensions.h"
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
;
17 void extensions_query_all()
24 XkbQueryExtension(ob_display
, &junk
, &extensions_xkb_event_basep
,
30 XShapeQueryExtension(ob_display
, &extensions_shape_event_basep
,
36 XineramaQueryExtension(ob_display
, &extensions_xinerama_event_basep
,
37 &junk
) && XineramaIsActive(ob_display
);
42 XRRQueryExtension(ob_display
, &extensions_randr_event_basep
,
48 XF86VidModeQueryExtension(ob_display
, &extensions_vidmode_event_basep
,
53 void extensions_xinerama_screens(Rect
**xin_areas
, guint
*nxin
)
58 if (extensions_xinerama
) {
61 XineramaScreenInfo
*info
= XineramaQueryScreens(ob_display
, &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
);
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
)));
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);
88 RECT_SET((*xin_areas
)[*nxin
], l
, t
, r
- l
+ 1, b
- t
+ 1);