2 * screen.c - screen management
4 * Copyright © 2007 Julien Danjou <julien@danjou.info>
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.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * \param disp Display ref
27 * \param screen Screen number
28 * \param statusbar statusbar
29 * \param screen_number int pointer filled with number of screens
30 * \return ScreenInfo struct array with all screens info
33 get_screen_info(Display
*disp
, int screen
, Statusbar statusbar
, int *screen_number
)
38 if(XineramaIsActive(disp
))
39 si
= XineramaQueryScreens(disp
, screen_number
);
42 /* emulate Xinerama info */
44 si
= p_new(ScreenInfo
, 1);
45 si
->width
= DisplayWidth(disp
, screen
);
46 si
->height
= DisplayHeight(disp
, screen
);
51 for(i
= 0; i
< *screen_number
; i
++)
53 if(statusbar
.position
== BarTop
54 || statusbar
.position
== BarBot
)
55 si
[i
].height
-= statusbar
.height
;
56 if(statusbar
.position
== BarTop
)
57 si
[i
].y_org
+= statusbar
.height
;
64 * \param disp Display ref
65 * \param screen Screen number
66 * \param statusbar the statusbar
67 * \return ScreenInfo struct pointer with all display info
70 get_display_info(Display
*disp
, int screen
, Statusbar statusbar
)
74 si
= p_new(ScreenInfo
, 1);
77 si
->y_org
= statusbar
.position
== BarTop
? statusbar
.height
: 0;
78 si
->width
= DisplayWidth(disp
, screen
);
79 si
->height
= DisplayHeight(disp
, screen
) -
80 ((statusbar
.position
== BarTop
|| statusbar
.position
== BarBot
) ? statusbar
.height
: 0);