]>
Commit | Line | Data |
---|---|---|
4ee8acb5 KK |
1 | --- rdesktop/configure.ac |
2 | +++ rdesktop/configure.ac | |
3 | @@ -30,6 +30,8 @@ | |
e3229496 | 4 | AC_SEARCH_LIBS(socket, socket) |
5 | AC_SEARCH_LIBS(inet_aton, resolv) | |
6 | ||
7 | +AC_CHECK_LIB(Xinerama, XineramaQueryScreens, AC_DEFINE(HAVE_XINERAMA) LIBS="$LIBS -lXinerama", [], []) | |
8 | + | |
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)) | |
4ee8acb5 KK |
12 | --- rdesktop/xwin.c |
13 | +++ rdesktop/xwin.c | |
14 | @@ -31,6 +31,9 @@ | |
15 | #ifdef HAVE_XRANDR | |
16 | #include <X11/extensions/Xrandr.h> | |
17 | #endif | |
e3229496 | 18 | +#ifdef HAVE_XINERAMA |
4ee8acb5 | 19 | +#include <X11/extensions/Xinerama.h> |
e3229496 | 20 | +#endif |
4ee8acb5 KK |
21 | |
22 | extern int g_sizeopt; | |
23 | extern int g_width; | |
24 | @@ -816,6 +819,66 @@ | |
e3229496 | 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; } | |
27 | ||
28 | +#ifdef HAVE_XINERAMA | |
e3229496 | 29 | +void |
30 | +ScreenSize(XRectangle *screen) | |
31 | +{ | |
32 | + int screens; | |
33 | + int event_base; | |
34 | + int error_base; | |
4ee8acb5 KK |
35 | + int x, y, i, __unused_int; |
36 | + unsigned int __unused_uint; | |
37 | + Window __unused_win; | |
e3229496 | 38 | + |
4ee8acb5 | 39 | + if ((XineramaQueryExtension(g_display, &event_base, &error_base)) && (XineramaIsActive(g_display))) |
e3229496 | 40 | + { |
41 | + XineramaScreenInfo *screeninfo; | |
e3229496 | 42 | + |
4ee8acb5 KK |
43 | + /* getting current cursor position */ |
44 | + XQueryPointer(g_display, RootWindowOfScreen(g_screen), &__unused_win, &__unused_win, &x, &y, &__unused_int, &__unused_int, &__unused_uint); | |
45 | + | |
46 | + /* Get the Xinerama screen infomation */ | |
e3229496 | 47 | + screeninfo = XineramaQueryScreens(g_display, &screens); |
48 | + | |
4ee8acb5 | 49 | + /* Search for the appropriate screen */ |
e3229496 | 50 | + i = 0; |
4ee8acb5 KK |
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 )) | |
e3229496 | 55 | + i++; |
4ee8acb5 KK |
56 | + if (i >= screens) |
57 | + i = 0; | |
e3229496 | 58 | + |
4ee8acb5 | 59 | + /* Position according to the present screen */ |
e3229496 | 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; | |
64 | + | |
4ee8acb5 | 65 | + /* Free allocated memory */ |
e3229496 | 66 | + XFree(screeninfo); |
67 | + } | |
68 | + else | |
69 | + { | |
70 | + /* Xinerama is not in use, default to the XLib screensize call. */ | |
71 | + screen->x = 0; | |
72 | + screen->y = 0; | |
73 | + screen->width = WidthOfScreen(g_screen); | |
74 | + screen->height = HeightOfScreen(g_screen); | |
75 | + } | |
76 | +} | |
e3229496 | 77 | +#else |
e3229496 | 78 | +void |
79 | +ScreenSize(XRectangle *screen) | |
80 | +{ | |
81 | + screen->x = 0; | |
82 | + screen->y = 0; | |
83 | + screen->width = WidthOfScreen(g_screen); | |
84 | + screen->height = HeightOfScreen(g_screen); | |
85 | +} | |
e3229496 | 86 | +#endif |
87 | + | |
88 | static uint32 | |
89 | translate_colour(uint32 colour) | |
90 | { | |
4ee8acb5 | 91 | @@ -1912,17 +1975,26 @@ |
e3229496 | 92 | */ |
93 | if (g_fullscreen) | |
94 | { | |
95 | - g_width = WidthOfScreen(g_screen); | |
96 | - g_height = HeightOfScreen(g_screen); | |
97 | + XRectangle screen; | |
98 | + ScreenSize(&screen); | |
99 | + | |
100 | + g_width = screen.width; | |
101 | + g_height = screen.height; | |
102 | g_using_full_workarea = True; | |
103 | } | |
4ee8acb5 | 104 | else if (g_sizeopt < 0) |
e3229496 | 105 | { |
106 | + XRectangle screen; | |
107 | + ScreenSize(&screen); | |
108 | + | |
109 | + g_width = screen.width; | |
110 | + g_height = screen.height; | |
111 | + | |
112 | /* Percent of screen */ | |
4ee8acb5 | 113 | if (-g_sizeopt >= 100) |
e3229496 | 114 | g_using_full_workarea = True; |
4ee8acb5 KK |
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; | |
e3229496 | 119 | } |
4ee8acb5 | 120 | else if (g_sizeopt == 1) |
e3229496 | 121 | { |
4ee8acb5 | 122 | @@ -2005,14 +2077,19 @@ |
e3229496 | 123 | long input_mask, ic_input_mask; |
124 | XEvent xevent; | |
125 | ||
126 | - wndwidth = g_fullscreen ? WidthOfScreen(g_screen) : g_width; | |
127 | - wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height; | |
128 | + XRectangle screen; | |
e3229496 | 129 | + ScreenSize(&screen); |
4ee8acb5 | 130 | |
e3229496 | 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; | |
4ee8acb5 | 135 | + |
e3229496 | 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; | |
143 | ||
144 | get_window_attribs(&attribs); | |
145 |