2 * Copyright © 2011 Red Hat, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #ifdef HAVE_DIX_CONFIG_H
25 #include <dix-config.h>
30 #include "scrnintstr.h"
32 ScreenInfo screenInfo
;
35 dix_version_compare(void)
39 rc
= version_compare(0, 0, 1, 0);
41 rc
= version_compare(1, 0, 0, 0);
43 rc
= version_compare(0, 0, 0, 0);
45 rc
= version_compare(1, 0, 1, 0);
47 rc
= version_compare(1, 0, 0, 9);
49 rc
= version_compare(0, 9, 1, 0);
51 rc
= version_compare(1, 0, 1, 9);
53 rc
= version_compare(1, 9, 1, 0);
55 rc
= version_compare(2, 0, 1, 9);
57 rc
= version_compare(1, 9, 2, 0);
62 dix_update_desktop_dimensions(void)
67 ScreenRec screens
[MAXSCREENS
];
69 for (i
= 0; i
< MAXSCREENS
; i
++)
70 screenInfo
.screens
[i
] = &screens
[i
];
79 #define assert_dimensions(_x, _y, _w, _h) \
80 update_desktop_dimensions(); \
81 assert(screenInfo.x == _x); \
82 assert(screenInfo.y == _y); \
83 assert(screenInfo.width == _w); \
84 assert(screenInfo.height == _h);
86 #define set_screen(idx, _x, _y, _w, _h) \
87 screenInfo.screens[idx]->x = _x; \
88 screenInfo.screens[idx]->y = _y; \
89 screenInfo.screens[idx]->width = _w; \
90 screenInfo.screens[idx]->height = _h; \
93 screenInfo
.numScreens
= 1;
94 set_screen(0, x
, y
, w
, h
);
95 assert_dimensions(x
, y
, w
, h
);
97 /* dualhead rightof */
98 screenInfo
.numScreens
= 2;
99 set_screen(1, w
, 0, w2
, h2
);
100 assert_dimensions(x
, y
, w
+ w2
, h2
);
102 /* dualhead belowof */
103 screenInfo
.numScreens
= 2;
104 set_screen(1, 0, h
, w2
, h2
);
105 assert_dimensions(x
, y
, w2
, h
+ h2
);
107 /* triplehead L shape */
108 screenInfo
.numScreens
= 3;
109 set_screen(1, 0, h
, w2
, h2
);
110 set_screen(2, w2
, h2
, w
, h
);
111 assert_dimensions(x
, y
, w
+ w2
, h
+ h2
);
114 screenInfo
.numScreens
= 4;
115 set_screen(1, 0, h
, w
, h
);
116 set_screen(2, w
, h
, w
, h2
);
117 set_screen(3, w
, 0, w2
, h
);
118 assert_dimensions(x
, y
, w
+ w2
, h
+ h2
);
120 /* quadhead horiz line */
121 screenInfo
.numScreens
= 4;
122 set_screen(1, w
, 0, w
, h
);
123 set_screen(2, 2 * w
, 0, w
, h
);
124 set_screen(3, 3 * w
, 0, w
, h
);
125 assert_dimensions(x
, y
, 4 * w
, h
);
127 /* quadhead vert line */
128 screenInfo
.numScreens
= 4;
129 set_screen(1, 0, h
, w
, h
);
130 set_screen(2, 0, 2 * h
, w
, h
);
131 set_screen(3, 0, 3 * h
, w
, h
);
132 assert_dimensions(x
, y
, w
, 4 * h
);
135 screenInfo
.numScreens
= 2;
136 set_screen(0, 0, 0, w2
, h2
);
137 set_screen(1, w
, 0, w2
, h2
);
138 assert_dimensions(x
, y
, w2
+ w
, h2
);
141 screenInfo
.numScreens
= 2;
142 set_screen(0, 0, 0, w2
, h2
);
143 set_screen(1, 0, h
, w2
, h2
);
144 assert_dimensions(x
, y
, w2
, h2
+ h
);
146 /* negative origin */
147 screenInfo
.numScreens
= 1;
148 set_screen(0, -w2
, -h2
, w
, h
);
149 assert_dimensions(-w2
, -h2
, w
, h
);
151 /* dualhead negative origin, overlap */
152 screenInfo
.numScreens
= 2;
153 set_screen(0, -w2
, -h2
, w2
, h2
);
154 set_screen(1, -w
, -h
, w
, h
);
155 assert_dimensions(-w2
, -h2
, w2
, h2
);
159 main(int argc
, char **argv
)
161 dix_version_compare();
162 dix_update_desktop_dimensions();