]> Dogcows Code - chaz/openbox/blob - openbox/extensions.c
add a focus_hilite variable
[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) 2003 Ben Jansens
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #include "openbox.h"
20 #include "geom.h"
21 #include "extensions.h"
22 #include "screen.h"
23
24 gboolean extensions_xkb = FALSE;
25 int extensions_xkb_event_basep;
26 gboolean extensions_shape = FALSE;
27 int extensions_shape_event_basep;
28 gboolean extensions_xinerama = FALSE;
29 int extensions_xinerama_event_basep;
30 gboolean extensions_randr = FALSE;
31 int extensions_randr_event_basep;
32 gboolean extensions_vidmode = FALSE;
33 int extensions_vidmode_event_basep;
34
35 void extensions_query_all()
36 {
37 int junk;
38 (void)junk;
39
40 #ifdef XKB
41 extensions_xkb =
42 XkbQueryExtension(ob_display, &junk, &extensions_xkb_event_basep,
43 &junk, NULL, NULL);
44 #endif
45
46 #ifdef SHAPE
47 extensions_shape =
48 XShapeQueryExtension(ob_display, &extensions_shape_event_basep,
49 &junk);
50 #endif
51
52 #ifdef XINERAMA
53 extensions_xinerama =
54 XineramaQueryExtension(ob_display, &extensions_xinerama_event_basep,
55 &junk) && XineramaIsActive(ob_display);
56 #endif
57
58 #ifdef XRANDR
59 extensions_randr =
60 XRRQueryExtension(ob_display, &extensions_randr_event_basep,
61 &junk);
62 #endif
63
64 #ifdef VIDMODE
65 extensions_vidmode =
66 XF86VidModeQueryExtension(ob_display, &extensions_vidmode_event_basep,
67 &junk);
68 #endif
69 }
70
71 void extensions_xinerama_screens(Rect **xin_areas, guint *nxin)
72 {
73 guint i;
74 gint l, r, t, b;
75 #ifdef XINERAMA
76 if (extensions_xinerama) {
77 guint i;
78 gint n;
79 XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n);
80 *nxin = n;
81 *xin_areas = g_new(Rect, *nxin + 1);
82 for (i = 0; i < *nxin; ++i)
83 RECT_SET((*xin_areas)[i], info[i].x_org, info[i].y_org,
84 info[i].width, info[i].height);
85 } else
86 #endif
87 {
88 *nxin = 1;
89 *xin_areas = g_new(Rect, *nxin + 1);
90 RECT_SET((*xin_areas)[0], 0, 0,
91 WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
92 HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
93 }
94
95 /* returns one extra with the total area in it */
96 l = (*xin_areas)[0].x;
97 t = (*xin_areas)[0].y;
98 r = (*xin_areas)[0].x + (*xin_areas)[0].width - 1;
99 b = (*xin_areas)[0].y + (*xin_areas)[0].height - 1;
100 for (i = 1; i < *nxin; ++i) {
101 l = MIN(l, (*xin_areas)[i].x);
102 t = MIN(l, (*xin_areas)[i].y);
103 r = MAX(r, (*xin_areas)[i].x + (*xin_areas)[i].width - 1);
104 b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1);
105 }
106 RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
107 }
This page took 0.044129 seconds and 4 git commands to generate.