1 --- rdesktop/configure.ac
2 +++ rdesktop/configure.ac
4 AC_SEARCH_LIBS(socket, socket)
5 AC_SEARCH_LIBS(inet_aton, resolv)
7 +AC_CHECK_LIB(Xinerama, XineramaQueryScreens, AC_DEFINE(HAVE_XINERAMA) LIBS="$LIBS -lXinerama", [], [])
9 AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
10 AC_CHECK_HEADER(sys/modem.h, AC_DEFINE(HAVE_SYS_MODEM_H))
11 AC_CHECK_HEADER(sys/filio.h, AC_DEFINE(HAVE_SYS_FILIO_H))
16 #include <X11/extensions/Xrandr.h>
19 +#include <X11/extensions/Xinerama.h>
25 #define LOUT24(o, x) { *(o++) = x; *(o++) = x >> 8; *(o++) = x >> 16; }
26 #define LOUT32(o, x) { *(o++) = x; *(o++) = x >> 8; *(o++) = x >> 16; *(o++) = x >> 24; }
30 +ScreenSize(XRectangle *screen)
35 + int x, y, i, __unused_int;
36 + unsigned int __unused_uint;
37 + Window __unused_win;
39 + if ((XineramaQueryExtension(g_display, &event_base, &error_base)) && (XineramaIsActive(g_display)))
41 + XineramaScreenInfo *screeninfo;
43 + /* getting current cursor position */
44 + XQueryPointer(g_display, RootWindowOfScreen(g_screen), &__unused_win, &__unused_win, &x, &y, &__unused_int, &__unused_int, &__unused_uint);
46 + /* Get the Xinerama screen infomation */
47 + screeninfo = XineramaQueryScreens(g_display, &screens);
49 + /* Search for the appropriate screen */
51 + while (! (screeninfo[i].x_org <= x
52 + && screeninfo[i].y_org <= y
53 + && screeninfo[i].x_org + screeninfo[i].width >= x
54 + && screeninfo[i].y_org + screeninfo[i].height >= y ))
59 + /* Position according to the present screen */
60 + screen->x = screeninfo[i].x_org;
61 + screen->y = screeninfo[i].y_org;
62 + screen->width = screeninfo[i].width;
63 + screen->height = screeninfo[i].height;
65 + /* Free allocated memory */
70 + /* Xinerama is not in use, default to the XLib screensize call. */
73 + screen->width = WidthOfScreen(g_screen);
74 + screen->height = HeightOfScreen(g_screen);
79 +ScreenSize(XRectangle *screen)
83 + screen->width = WidthOfScreen(g_screen);
84 + screen->height = HeightOfScreen(g_screen);
89 translate_colour(uint32 colour)
91 @@ -1912,17 +1975,26 @@
95 - g_width = WidthOfScreen(g_screen);
96 - g_height = HeightOfScreen(g_screen);
98 + ScreenSize(&screen);
100 + g_width = screen.width;
101 + g_height = screen.height;
102 g_using_full_workarea = True;
104 else if (g_sizeopt < 0)
107 + ScreenSize(&screen);
109 + g_width = screen.width;
110 + g_height = screen.height;
112 /* Percent of screen */
113 if (-g_sizeopt >= 100)
114 g_using_full_workarea = True;
115 - g_height = HeightOfScreen(g_screen) * (-g_sizeopt) / 100;
116 - g_width = WidthOfScreen(g_screen) * (-g_sizeopt) / 100;
117 + g_width = screen.width * (-g_width) / 100;
118 + g_height = screen.height * (-g_width) / 100;
120 else if (g_sizeopt == 1)
122 @@ -2005,14 +2077,19 @@
123 long input_mask, ic_input_mask;
126 - wndwidth = g_fullscreen ? WidthOfScreen(g_screen) : g_width;
127 - wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
129 + ScreenSize(&screen);
131 + wndwidth = g_fullscreen ? screen.width : g_width;
132 + wndheight = g_fullscreen ? screen.height : g_height;
133 + g_xpos = g_fullscreen ? screen.x : g_xpos;
134 + g_ypos = g_fullscreen ? screen.y : g_ypos;
136 /* Handle -x-y portion of geometry string */
137 if (g_xpos < 0 || (g_xpos == 0 && (g_pos & 2)))
138 - g_xpos = WidthOfScreen(g_screen) + g_xpos - g_width;
139 + g_xpos = screen.width + g_xpos - g_width;
140 if (g_ypos < 0 || (g_ypos == 0 && (g_pos & 4)))
141 - g_ypos = HeightOfScreen(g_screen) + g_ypos - g_height;
142 + g_ypos = screen.height + g_ypos - g_height;
144 get_window_attribs(&attribs);