src/video/x11/SDL_x11video.h
changeset 0 74212992fb08
child 227 24878c14b391
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/video/x11/SDL_x11video.h	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,190 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@devolution.com
    1.24 +*/
    1.25 +
    1.26 +#ifdef SAVE_RCSID
    1.27 +static char rcsid =
    1.28 + "@(#) $Id$";
    1.29 +#endif
    1.30 +
    1.31 +#ifndef _SDL_x11video_h
    1.32 +#define _SDL_x11video_h
    1.33 +
    1.34 +#include <X11/Xlib.h>
    1.35 +#include <X11/Xutil.h>
    1.36 +#include <X11/Xatom.h>
    1.37 +#ifndef NO_SHARED_MEMORY
    1.38 +#include <sys/ipc.h>
    1.39 +#include <sys/shm.h>
    1.40 +#include <X11/extensions/XShm.h>
    1.41 +#endif
    1.42 +#ifdef XFREE86_DGAMOUSE
    1.43 +#include <X11/extensions/xf86dga.h>
    1.44 +#endif
    1.45 +#ifdef XFREE86_VM
    1.46 +#include <X11/extensions/xf86vmode.h>
    1.47 +#ifdef XFREE86_VM_DYNAMIC_HACK
    1.48 +#define XVidMode(func, args)	XF40VidMode##func args
    1.49 +#else
    1.50 +#define XVidMode(func, args)	XF86VidMode##func args
    1.51 +#endif
    1.52 +#endif /* XFREE86_VM */
    1.53 +#include <string.h>
    1.54 +
    1.55 +#include "SDL_mouse.h"
    1.56 +#include "SDL_sysvideo.h"
    1.57 +
    1.58 +/* Hidden "this" pointer for the video functions */
    1.59 +#define _THIS	SDL_VideoDevice *this
    1.60 +
    1.61 +/* Private display data */
    1.62 +struct SDL_PrivateVideoData {
    1.63 +    int local_X11;		/* Flag: true if local display */
    1.64 +    Display *X11_Display;	/* Used for events and window management */
    1.65 +    Display *GFX_Display;	/* Used for graphics and colormap stuff */
    1.66 +    Visual *SDL_Visual;		/* The visual used by our window */
    1.67 +    Window WMwindow;		/* Input window, managed by window manager */
    1.68 +    Window FSwindow;		/* Fullscreen window, completely unmanaged */
    1.69 +    Window SDL_Window;		/* Shared by both displays (no X security?) */
    1.70 +    Atom WM_DELETE_WINDOW;	/* "close-window" protocol atom */
    1.71 +    WMcursor *BlankCursor;	/* The invisible cursor */
    1.72 +
    1.73 +    char *SDL_windowid;		/* Flag: true if we have been passed a window */
    1.74 +
    1.75 +    /* Direct Graphics Access extension information */
    1.76 +    int using_dga;
    1.77 +
    1.78 +#ifndef NO_SHARED_MEMORY
    1.79 +    /* MIT shared memory extension information */
    1.80 +    int use_mitshm;
    1.81 +    XShmSegmentInfo shminfo;
    1.82 +#endif
    1.83 +
    1.84 +    /* The variables used for displaying graphics */
    1.85 +    XImage *Ximage;		/* The X image for our window */
    1.86 +    GC	gc;			/* The graphic context for drawing */
    1.87 +    int swap_pixels;		/* Flag: true if display is swapped endian */
    1.88 +
    1.89 +    /* The current width and height of the fullscreen mode */
    1.90 +    int current_w;
    1.91 +    int current_h;
    1.92 +
    1.93 +    /* Support for internal mouse warping */
    1.94 +    struct {
    1.95 +        int x;
    1.96 +        int y;
    1.97 +    } mouse_last;
    1.98 +    struct {
    1.99 +        int numerator;
   1.100 +        int denominator;
   1.101 +        int threshold;
   1.102 +    } mouse_accel;
   1.103 +    int mouse_relative;
   1.104 +
   1.105 +    /* The current list of available video modes */
   1.106 +    SDL_Rect **modelist;
   1.107 +
   1.108 +    /* available visuals of interest to us, sorted deepest first */
   1.109 +    struct {
   1.110 +	Visual *visual;
   1.111 +	int depth;		/* number of significant bits/pixel */
   1.112 +	int bpp;		/* pixel quantum in bits */
   1.113 +    } visuals[2*5];		/* at most 2 entries for 8, 15, 16, 24, 32 */
   1.114 +    int nvisuals;
   1.115 +
   1.116 +    Visual *vis;		/* current visual in use */
   1.117 +    int depth;			/* current visual depth (not bpp) */
   1.118 +
   1.119 +    /* Variables used by the X11 video mode code */
   1.120 +#ifdef XFREE86_VM
   1.121 +    XF86VidModeModeInfo saved_mode;
   1.122 +    struct {
   1.123 +        int x, y;
   1.124 +    } saved_view;
   1.125 +#endif
   1.126 +    int use_vidmode;
   1.127 +    int currently_fullscreen;
   1.128 +
   1.129 +    /* Automatic mode switching support (entering/leaving fullscreen) */
   1.130 +    Uint32 switch_waiting;
   1.131 +    Uint32 switch_time;
   1.132 +
   1.133 +    /* Prevent too many XSync() calls */
   1.134 +    int blit_queued;
   1.135 +
   1.136 +    /* Colormap handling */
   1.137 +    Colormap DisplayColormap;	/* The default display colormap */
   1.138 +    Colormap XColorMap;		/* The current window colormap */
   1.139 +    int *XPixels;		/* pixels value allocation counts */
   1.140 +    float gamma_saved[3];	/* Saved gamma values for VidMode gamma */
   1.141 +    int gamma_changed;		/* flag: has VidMode gamma been modified? */
   1.142 +
   1.143 +    short *iconcolors;		/* List of colors used by the icon */
   1.144 +};
   1.145 +
   1.146 +/* Old variable names */
   1.147 +#define local_X11		(this->hidden->local_X11)
   1.148 +#define SDL_Display		(this->hidden->X11_Display)
   1.149 +#define GFX_Display		(this->hidden->GFX_Display)
   1.150 +#define SDL_Screen		DefaultScreen(this->hidden->X11_Display)
   1.151 +
   1.152 +#define SDL_Visual		(this->hidden->vis)
   1.153 +
   1.154 +#define SDL_Root		RootWindow(SDL_Display, SDL_Screen)
   1.155 +#define WMwindow		(this->hidden->WMwindow)
   1.156 +#define FSwindow		(this->hidden->FSwindow)
   1.157 +#define SDL_Window		(this->hidden->SDL_Window)
   1.158 +#define WM_DELETE_WINDOW	(this->hidden->WM_DELETE_WINDOW)
   1.159 +#define SDL_BlankCursor		(this->hidden->BlankCursor)
   1.160 +#define SDL_windowid		(this->hidden->SDL_windowid)
   1.161 +#define using_dga		(this->hidden->using_dga)
   1.162 +#define use_mitshm		(this->hidden->use_mitshm)
   1.163 +#define shminfo			(this->hidden->shminfo)
   1.164 +#define SDL_Ximage		(this->hidden->Ximage)
   1.165 +#define SDL_GC			(this->hidden->gc)
   1.166 +#define swap_pixels		(this->hidden->swap_pixels)
   1.167 +#define current_w		(this->hidden->current_w)
   1.168 +#define current_h		(this->hidden->current_h)
   1.169 +#define mouse_last		(this->hidden->mouse_last)
   1.170 +#define mouse_accel		(this->hidden->mouse_accel)
   1.171 +#define mouse_relative		(this->hidden->mouse_relative)
   1.172 +#define SDL_modelist		(this->hidden->modelist)
   1.173 +#define saved_mode		(this->hidden->saved_mode)
   1.174 +#define saved_view		(this->hidden->saved_view)
   1.175 +#define use_vidmode		(this->hidden->use_vidmode)
   1.176 +#define currently_fullscreen	(this->hidden->currently_fullscreen)
   1.177 +#define switch_waiting		(this->hidden->switch_waiting)
   1.178 +#define switch_time		(this->hidden->switch_time)
   1.179 +#define blit_queued		(this->hidden->blit_queued)
   1.180 +#define SDL_DisplayColormap	(this->hidden->DisplayColormap)
   1.181 +#define SDL_PrivateColormap	(this->hidden->PrivateColormap)
   1.182 +#define SDL_XColorMap		(this->hidden->XColorMap)
   1.183 +#define SDL_XPixels		(this->hidden->XPixels)
   1.184 +#define gamma_saved		(this->hidden->gamma_saved)
   1.185 +#define gamma_changed		(this->hidden->gamma_changed)
   1.186 +#define SDL_iconcolors		(this->hidden->iconcolors)
   1.187 +
   1.188 +/* Some versions of XFree86 have bugs - detect if this is one of them */
   1.189 +#define BUGGY_XFREE86(condition, buggy_version) \
   1.190 +((strcmp(ServerVendor(SDL_Display), "The XFree86 Project, Inc") == 0) && \
   1.191 + (VendorRelease(SDL_Display) condition buggy_version))
   1.192 +
   1.193 +#endif /* _SDL_x11video_h */