1 --- configure.ac.orig 2008-06-25 23:22:27.000000000 +0200
2 +++ configure.ac 2008-06-25 23:17:51.000000000 +0200
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))
12 --- xwin.c.orig 2008-06-25 23:50:02.000000000 +0200
13 +++ xwin.c 2008-06-25 23:49:25.000000000 +0200
17 #include <X11/Xutil.h>
19 + #include <X11/extensions/Xinerama.h>
21 #include <X11/Xproto.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; }
29 +// IF XINERAMA LIBRARY
31 +int g_last_wnd_pos_x;
32 +int g_last_wnd_pos_y;
35 +ScreenSize(XRectangle *screen)
41 + if (XineramaQueryExtension(g_display, &event_base, &error_base))
43 + XineramaScreenInfo *screeninfo;
46 + /* Get the Xinerama screen infomation. */
47 + screeninfo = XineramaQueryScreens(g_display, &screens);
49 + /* Search for the appropriate screen. */
51 + while (!(screeninfo[i].x_org <= g_last_wnd_pos_x
52 + && screeninfo[i].y_org <= g_last_wnd_pos_y
53 + && screeninfo[i].x_org + screeninfo[i].width >= g_last_wnd_pos_x
54 + && screeninfo[i].y_org + screeninfo[i].height >= g_last_wnd_pos_y ))
58 + if (i >= screens) i = 0;
60 + /* Position according to the present screen. */
61 + screen->x = screeninfo[i].x_org;
62 + screen->y = screeninfo[i].y_org;
63 + screen->width = screeninfo[i].width;
64 + screen->height = screeninfo[i].height;
66 + /* Free allocated memory. */
71 + /* Xinerama is not in use, default to the XLib screensize call. */
74 + screen->width = WidthOfScreen(g_screen);
75 + screen->height = HeightOfScreen(g_screen);
80 +// IF NO XINERAMA LIBRARY
83 +ScreenSize(XRectangle *screen)
87 + screen->width = WidthOfScreen(g_screen);
88 + screen->height = HeightOfScreen(g_screen);
94 translate_colour(uint32 colour)
96 @@ -1615,17 +1683,26 @@
100 - g_width = WidthOfScreen(g_screen);
101 - g_height = HeightOfScreen(g_screen);
103 + ScreenSize(&screen);
105 + g_width = screen.width;
106 + g_height = screen.height;
107 g_using_full_workarea = True;
109 else if (g_width < 0)
112 + ScreenSize(&screen);
114 + g_width = screen.width;
115 + g_height = screen.height;
117 /* Percent of screen */
119 g_using_full_workarea = True;
120 - g_height = HeightOfScreen(g_screen) * (-g_width) / 100;
121 - g_width = WidthOfScreen(g_screen) * (-g_width) / 100;
122 + g_width = screen.width * (-g_width) / 100;
123 + g_height = screen.height * (-g_width) / 100;
125 else if (g_width == 0)
127 @@ -1734,14 +1811,19 @@
128 long input_mask, ic_input_mask;
131 - wndwidth = g_fullscreen ? WidthOfScreen(g_screen) : g_width;
132 - wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
135 + ScreenSize(&screen);
136 + wndwidth = g_fullscreen ? screen.width : g_width;
137 + wndheight = g_fullscreen ? screen.height : g_height;
138 + g_xpos = g_fullscreen ? screen.x : g_xpos;
139 + g_ypos = g_fullscreen ? screen.y : g_ypos;
141 /* Handle -x-y portion of geometry string */
142 if (g_xpos < 0 || (g_xpos == 0 && (g_pos & 2)))
143 - g_xpos = WidthOfScreen(g_screen) + g_xpos - g_width;
144 + g_xpos = screen.width + g_xpos - g_width;
145 if (g_ypos < 0 || (g_ypos == 0 && (g_pos & 4)))
146 - g_ypos = HeightOfScreen(g_screen) + g_ypos - g_height;
147 + g_ypos = screen.height + g_ypos - g_height;
149 get_window_attribs(&attribs);
151 @@ -1882,6 +1964,11 @@
153 xwin_toggle_fullscreen(void)
155 +#ifdef HAVE_XINERAMA
156 + Window root, parent, *children;
157 + unsigned int nchildren;
158 + XWindowAttributes win_attrib;
162 if (g_seamless_active)
163 @@ -1895,6 +1982,17 @@
164 XCopyArea(g_display, g_wnd, contents, g_gc, 0, 0, g_width, g_height, 0, 0);
167 +#ifdef HAVE_XINERAMA
168 + /* Determine the parent window. */
169 + XQueryTree(g_display, g_wnd, &root, &parent, &children, &nchildren);
170 + if (children != NULL) XFree(children);
172 + /* Find the present coordinates of the window. */
173 + XGetWindowAttributes(g_display, parent, &win_attrib);
174 + g_last_wnd_pos_x = win_attrib.x + 1;
175 + g_last_wnd_pos_y = win_attrib.y + 1;
179 g_fullscreen = !g_fullscreen;