Commit daab242a authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #45

Improved Xinerama support.
Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment variable, currently supported on X11 Xinerama configurations.
Only use the VidMode extension on the primary head.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401724
parent b8685c44
......@@ -4,6 +4,9 @@ This is a list of API changes in SDL's version history.
Version 1.0:
1.2.10:
Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment
variable, currently supported on X11 Xinerama configurations.
Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications.
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
......
This diff is collapsed.
......@@ -197,7 +197,7 @@ static int x_errhandler(Display *d, XErrorEvent *e)
(((e->error_code == BadRequest)&&(e->request_code == vm_error)) ||
((e->error_code > vm_error) &&
(e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) {
#ifdef XFREE86_DEBUG
#ifdef X11_DEBUG
{ char errmsg[1024];
XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
printf("VidMode error: %s\n", errmsg);
......@@ -212,7 +212,7 @@ printf("VidMode error: %s\n", errmsg);
if ( (dga_error >= 0) &&
((e->error_code > dga_error) &&
(e->error_code <= (dga_error+XF86DGANumberErrors))) ) {
#ifdef XFREE86_DEBUG
#ifdef X11_DEBUG
{ char errmsg[1024];
XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
printf("DGA error: %s\n", errmsg);
......@@ -244,7 +244,7 @@ static int xio_errhandler(Display *d)
static int (*Xext_handler)(Display *, _Xconst char *, _Xconst char *) = NULL;
static int xext_errhandler(Display *d, _Xconst char *ext, _Xconst char *reason)
{
#ifdef XFREE86_DEBUG
#ifdef X11_DEBUG
printf("Xext error inside SDL (may be harmless):\n");
printf(" Extension \"%s\" %s on display \"%s\".\n",
ext, reason, XDisplayString(d));
......@@ -310,6 +310,7 @@ static char *get_classname(char *classname, int maxlen)
/* Create auxiliary (toplevel) windows with the current visual */
static void create_aux_windows(_THIS)
{
int x = 0, y = 0;
Atom _NET_WM_NAME;
Atom _NET_WM_ICON_NAME;
char classname[1024];
......@@ -333,13 +334,19 @@ static void create_aux_windows(_THIS)
if(FSwindow)
XDestroyWindow(SDL_Display, FSwindow);
#if SDL_VIDEO_DRIVER_X11_VIDMODE
if ( use_xinerama ) {
x = xinerama_info.x_org;
y = xinerama_info.y_org;
}
#endif
xattr.override_redirect = True;
xattr.background_pixel = def_vis ? BlackPixel(SDL_Display, SDL_Screen) : 0;
xattr.border_pixel = 0;
xattr.colormap = SDL_XColorMap;
FSwindow = XCreateWindow(SDL_Display, SDL_Root,
xinerama_x, xinerama_y, 32, 32, 0,
x, y, 32, 32, 0,
this->hidden->depth, InputOutput, SDL_Visual,
CWOverrideRedirect | CWBackPixel | CWBorderPixel
| CWColormap,
......@@ -379,7 +386,8 @@ static void create_aux_windows(_THIS)
/* Create the window for windowed management */
/* (reusing the xattr structure above) */
WMwindow = XCreateWindow(SDL_Display, SDL_Root, 0, 0, 32, 32, 0,
WMwindow = XCreateWindow(SDL_Display, SDL_Root,
x, y, 32, 32, 0,
this->hidden->depth, InputOutput, SDL_Visual,
CWBackPixel | CWBorderPixel | CWColormap,
&xattr);
......
......@@ -34,15 +34,18 @@
#if SDL_VIDEO_DRIVER_X11_DGAMOUSE
#include "../Xext/extensions/xf86dga.h"
#endif
#if SDL_VIDEO_DRIVER_X11_XINERAMA
#include "../Xext/extensions/Xinerama.h"
#endif
#if SDL_VIDEO_DRIVER_X11_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#if SDL_VIDEO_DRIVER_X11_VIDMODE
#include "../Xext/extensions/xf86vmode.h"
#endif
#if SDL_VIDEO_DRIVER_X11_XME
#include "../Xext/extensions/xme.h"
#endif
#if SDL_VIDEO_DRIVER_X11_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "SDL_x11dyn.h"
......@@ -109,6 +112,14 @@ struct SDL_PrivateVideoData {
int depth; /* current visual depth (not bpp) */
/* Variables used by the X11 video mode code */
#if SDL_VIDEO_DRIVER_X11_XINERAMA
SDL_NAME(XineramaScreenInfo) xinerama_info;
#endif
#if SDL_VIDEO_DRIVER_X11_XRANDR
XRRScreenConfiguration* screen_config;
int saved_size_id;
Rotation saved_rotation;
#endif
#if SDL_VIDEO_DRIVER_X11_VIDMODE
SDL_NAME(XF86VidModeModeInfo) saved_mode;
struct {
......@@ -116,19 +127,13 @@ struct SDL_PrivateVideoData {
} saved_view;
#endif
#if SDL_VIDEO_DRIVER_X11_XME /* XiG XME fullscreen */
int use_xme;
XiGMiscResolutionInfo saved_res;
#endif
#if SDL_VIDEO_DRIVER_X11_XRANDR
XRRScreenConfiguration* screen_config;
int saved_size_id;
Rotation saved_rotation;
#endif
int xinerama_x;
int xinerama_y;
int use_vidmode;
int use_xinerama;
int use_xrandr;
int use_vidmode;
int use_xme;
int currently_fullscreen;
/* Automatic mode switching support (entering/leaving fullscreen) */
......@@ -174,17 +179,17 @@ struct SDL_PrivateVideoData {
#define mouse_accel (this->hidden->mouse_accel)
#define mouse_relative (this->hidden->mouse_relative)
#define SDL_modelist (this->hidden->modelist)
#define xinerama_info (this->hidden->xinerama_info)
#define saved_mode (this->hidden->saved_mode)
#define saved_view (this->hidden->saved_view)
#define use_xme (this->hidden->use_xme)
#define saved_res (this->hidden->saved_res)
#define use_xrandr (this->hidden->use_xrandr)
#define screen_config (this->hidden->screen_config)
#define saved_size_id (this->hidden->saved_size_id)
#define saved_rotation (this->hidden->saved_rotation)
#define xinerama_x (this->hidden->xinerama_x)
#define xinerama_y (this->hidden->xinerama_y)
#define use_xinerama (this->hidden->use_xinerama)
#define use_vidmode (this->hidden->use_vidmode)
#define use_xrandr (this->hidden->use_xrandr)
#define use_xme (this->hidden->use_xme)
#define currently_fullscreen (this->hidden->currently_fullscreen)
#define switch_waiting (this->hidden->switch_waiting)
#define switch_time (this->hidden->switch_time)
......
......@@ -332,6 +332,13 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
if ( ! SDL_Window ) {
return(mode); /* Will be set later on mode switch */
}
#if SDL_VIDEO_DRIVER_X11_XINERAMA
/* FIXME: Is this okay?
if ( use_xinerama ) {
mode &= ~SDL_GRAB_FULLSCREEN;
}
*/
#endif
if ( mode == SDL_GRAB_OFF ) {
XUngrabPointer(SDL_Display, CurrentTime);
XUngrabKeyboard(SDL_Display, CurrentTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment