Added X11 Xinerama support - fullscreen starts on screen 0
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40228
This commit is contained in:
parent
ad2cc0a6ae
commit
c05194de44
4 changed files with 79 additions and 15 deletions
20
configure.in
20
configure.in
|
@ -602,6 +602,26 @@ CheckX11()
|
|||
SYSTEM_LIBS="$SYSTEM_LIBS -lXv"
|
||||
fi
|
||||
fi
|
||||
AC_ARG_ENABLE(video-x11-xinerama,
|
||||
[ --enable-video-x11-xinerama enable X11 Xinerama support [default=yes]],
|
||||
, enable_video_x11_xinerama=yes)
|
||||
if test x$enable_video_x11_xinerama = xyes; then
|
||||
AC_MSG_CHECKING(for X11 Xinerama support)
|
||||
video_x11_xinerama=no
|
||||
AC_TRY_COMPILE([
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
],[
|
||||
XineramaScreenInfo *xinerama;
|
||||
],[
|
||||
video_x11_xinerama=yes
|
||||
])
|
||||
AC_MSG_RESULT($video_x11_xinerama)
|
||||
if test x$video_x11_xinerama = xyes; then
|
||||
CFLAGS="$CFLAGS -DHAVE_XINERAMA"
|
||||
SYSTEM_LIBS="$SYSTEM_LIBS -lXinerama"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>.
|
|||
Major changes since SDL 1.0.0:
|
||||
</H2>
|
||||
<UL>
|
||||
<LI> 1.2.3: Added X11 Xinerama support - fullscreen starts on screen 0
|
||||
<LI> 1.2.3: Added platform independent OpenGL header - SDL_opengl.h
|
||||
<LI> 1.2.3: Fixed flashing the screen when creating a window on BeOS
|
||||
<LI> 1.2.3: Added double-buffering support for SVGAlib (thanks Kutak!)
|
||||
|
|
|
@ -39,6 +39,9 @@ static char rcsid =
|
|||
#include "SDL_x11modes_c.h"
|
||||
#include "SDL_x11image_c.h"
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif
|
||||
|
||||
#ifdef XFREE86_VM
|
||||
Bool XVidMode(GetModeInfo, (Display *dpy, int scr, XF86VidModeModeInfo *info))
|
||||
|
@ -99,10 +102,11 @@ static void set_best_resolution(_THIS, int width, int height)
|
|||
XVidMode(GetAllModeLines, (SDL_Display,SDL_Screen,&nmodes,&modes))){
|
||||
qsort(modes, nmodes, sizeof *modes, cmpmodes);
|
||||
#ifdef XFREE86_DEBUG
|
||||
printf("Available modes:\n");
|
||||
for ( i = 0; i < nmodes; ++i ) {
|
||||
printf("Mode %d: %dx%d\n", i, modes[i]->hdisplay, modes[i]->vdisplay);
|
||||
}
|
||||
printf("Available modes:\n");
|
||||
for ( i = 0; i < nmodes; ++i ) {
|
||||
printf("Mode %d: %dx%d\n", i,
|
||||
modes[i]->hdisplay, modes[i]->vdisplay);
|
||||
}
|
||||
#endif
|
||||
for ( i = nmodes-1; i > 0 ; --i ) {
|
||||
if ( (modes[i]->hdisplay >= width) &&
|
||||
|
@ -238,8 +242,8 @@ int X11_GetVideoModes(_THIS)
|
|||
#ifdef X_XF86VidModeGetDotClocks /* Compiled under XFree86 4.0 */
|
||||
/* Earlier X servers hang when doing vidmode */
|
||||
if ( vm_major < 2 ) {
|
||||
#ifdef DEBUG_XF86
|
||||
printf("Compiled under XFree86 4.0, server is XFree86 3.X\n");
|
||||
#ifdef XFREE86_DEBUG
|
||||
printf("Compiled under XFree86 4.0, server is XFree86 3.X\n");
|
||||
#endif
|
||||
buggy_X11 = 1;
|
||||
}
|
||||
|
@ -335,18 +339,50 @@ int X11_GetVideoModes(_THIS)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_XF86
|
||||
#ifdef XFREE86_DEBUG
|
||||
if ( use_vidmode ) {
|
||||
fprintf(stderr, "XFree86 VidMode is enabled\n");
|
||||
printf("XFree86 VidMode is enabled\n");
|
||||
}
|
||||
if ( SDL_modelist ) {
|
||||
fprintf(stderr, "X11 video mode list:\n");
|
||||
printf("X11 video mode list:\n");
|
||||
for ( i=0; SDL_modelist[i]; ++i ) {
|
||||
fprintf(stderr, "\t%dx%d\n",
|
||||
SDL_modelist[i]->w, SDL_modelist[i]->h);
|
||||
printf("\t%dx%d\n", SDL_modelist[i]->w, SDL_modelist[i]->h);
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG_XF86 */
|
||||
#endif /* XFREE86_DEBUG */
|
||||
|
||||
/* The default X/Y fullscreen offset is 0/0 */
|
||||
xinerama_x = 0;
|
||||
xinerama_y = 0;
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
/* Query Xinerama extention */
|
||||
if ( XineramaQueryExtension(SDL_Display, &i, &i) &&
|
||||
XineramaIsActive(SDL_Display) ) {
|
||||
/* Find out which screen is the zero'th one */
|
||||
int screens;
|
||||
XineramaScreenInfo *xinerama;
|
||||
|
||||
#ifdef XINERAMA_DEBUG
|
||||
printf("X11 detected Xinerama:\n");
|
||||
#endif
|
||||
xinerama = XineramaQueryScreens(SDL_Display, &screens);
|
||||
for ( i = 0; i < screens; i++ ) {
|
||||
#ifdef XINERAMA_DEBUG
|
||||
printf("xinerama %d: %dx%d+%d+%d\n",
|
||||
xinerama[i].screen_number,
|
||||
xinerama[i].width, xinerama[i].height,
|
||||
xinerama[i].x_org, xinerama[i].y_org);
|
||||
#endif
|
||||
if ( xinerama[i].screen_number == 0 ) {
|
||||
xinerama_x = xinerama[i].x_org;
|
||||
xinerama_y = xinerama[i].y_org;
|
||||
}
|
||||
}
|
||||
XFree(xinerama);
|
||||
}
|
||||
#endif /* HAVE_XINERAMA */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -390,13 +426,15 @@ int X11_ResizeFullScreen(_THIS)
|
|||
int x, y;
|
||||
int real_w, real_h;
|
||||
|
||||
x = xinerama_x;
|
||||
y = xinerama_y;
|
||||
if ( currently_fullscreen ) {
|
||||
/* Switch resolution and cover it with the FSwindow */
|
||||
move_cursor_to(this, 0, 0);
|
||||
move_cursor_to(this, x, y);
|
||||
set_best_resolution(this, current_w, current_h);
|
||||
move_cursor_to(this, 0, 0);
|
||||
move_cursor_to(this, x, y);
|
||||
get_real_resolution(this, &real_w, &real_h);
|
||||
XMoveResizeWindow(SDL_Display, FSwindow, 0, 0, real_w, real_h);
|
||||
XMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
|
||||
move_cursor_to(this, real_w/2, real_h/2);
|
||||
|
||||
/* Center and reparent the drawing window */
|
||||
|
|
|
@ -47,6 +47,7 @@ static char rcsid =
|
|||
#define XVidMode(func, args) XF86VidMode##func args
|
||||
#endif
|
||||
#endif /* XFREE86_VM */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL_mouse.h"
|
||||
|
@ -120,6 +121,8 @@ struct SDL_PrivateVideoData {
|
|||
int x, y;
|
||||
} saved_view;
|
||||
#endif
|
||||
int xinerama_x;
|
||||
int xinerama_y;
|
||||
int use_vidmode;
|
||||
int currently_fullscreen;
|
||||
|
||||
|
@ -169,6 +172,8 @@ struct SDL_PrivateVideoData {
|
|||
#define SDL_modelist (this->hidden->modelist)
|
||||
#define saved_mode (this->hidden->saved_mode)
|
||||
#define saved_view (this->hidden->saved_view)
|
||||
#define xinerama_x (this->hidden->xinerama_x)
|
||||
#define xinerama_y (this->hidden->xinerama_y)
|
||||
#define use_vidmode (this->hidden->use_vidmode)
|
||||
#define currently_fullscreen (this->hidden->currently_fullscreen)
|
||||
#define switch_waiting (this->hidden->switch_waiting)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue