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_xinerama_active
= FALSE
;
13 gboolean extensions_randr
= FALSE
;
14 int extensions_randr_event_basep
;
15 gboolean extensions_vidmode
= FALSE
;
16 int extensions_vidmode_event_basep
;
18 void extensions_query_all()
25 XkbQueryExtension(ob_display
, &junk
, &extensions_xkb_event_basep
,
31 XShapeQueryExtension(ob_display
, &extensions_shape_event_basep
,
37 XineramaQueryExtension(ob_display
, &extensions_xinerama_event_basep
,
39 extensions_xinerama_active
= XineramaIsActive(ob_display
);
44 XRRQueryExtension(ob_display
, &extensions_randr_event_basep
,
50 XF86VidModeQueryExtension(ob_display
, &extensions_vidmode_event_basep
,
55 void extensions_xinerama_screens(Rect
**xin_areas
, guint
*nxin
)
60 if (extensions_xinerama_active
) {
63 XineramaScreenInfo
*info
= XineramaQueryScreens(ob_display
, &n
);
65 *xin_areas
= g_new(Rect
, *nxin
+ 1);
66 for (i
= 0; i
< *nxin
; ++i
)
67 RECT_SET((*xin_areas
)[i
], info
[i
].x_org
, info
[i
].y_org
,
68 info
[i
].width
, info
[i
].height
);
73 *xin_areas
= g_new(Rect
, *nxin
+ 1);
74 RECT_SET((*xin_areas
)[0], 0, 0,
75 screen_physical_size
.width
, screen_physical_size
.height
);
78 /* returns one extra with the total area in it */
79 l
= (*xin_areas
)[0].x
;
80 t
= (*xin_areas
)[0].y
;
81 r
= (*xin_areas
)[0].x
+ (*xin_areas
)[0].width
- 1;
82 b
= (*xin_areas
)[0].y
+ (*xin_areas
)[0].height
- 1;
83 for (i
= 1; i
< *nxin
; ++i
) {
84 l
= MIN(l
, (*xin_areas
)[i
].x
);
85 t
= MIN(l
, (*xin_areas
)[i
].y
);
86 r
= MIN(r
, (*xin_areas
)[0].x
+ (*xin_areas
)[0].width
- 1);
87 b
= MIN(b
, (*xin_areas
)[0].y
+ (*xin_areas
)[0].height
- 1);
89 RECT_SET((*xin_areas
)[*nxin
], l
, t
, r
- l
+ 1, b
- t
+ 1);