Mercurial > sdl-ios-xcode
view docs/html/sdlenvvars.html @ 1212:7663bb0f52c7
To: sdl@libsdl.org
From: Christian Walther <cwalther@gmx.ch>
Date: Thu, 15 Dec 2005 21:19:53 +0100
Subject: [SDL] More mouse enhancements for Mac OS X
The attached patch brings two more enhancements to mouse handling on Mac
OS X (Quartz):
1. Currently, after launching an SDL application, SDL's notion of the
mouse position is stuck in the top left corner (0,0) until the first
time the mouse is moved. That's because the UpdateMouse() function isn't
implemented in the Quartz driver. This patch adds it.
2. When grabbing input while the mouse cursor is hidden, the function
CGAssociateMouseAndMouseCursorPosition(0) is called, which prevents the
system's notion of the mouse location from moving (and therefore leaving
the SDL window) even when the mouse is moved. However, apparently the
Wacom tablet driver (and maybe other special pointing device drivers)
doesn't care about that setting and still allows the mouse location to
go outside of the window. Interestingly, the system cursor, which is
made visible by the existing code in SDL in that case, does not follow
the mouse location, but appears in the middle of the SDL window. The
mouse location being outside of the window however means that mouse
button events go to background applications (or the dock or whatever is
there), which is very confusing to the user who sees no cursor outside
of the SDL window.
I have not found any way of intercepting these events (and that's
probably by design, as "normal" applications shouldn't prevent the user
from bringing other applications' windows to the front by clicking on
them). An idea would be placing a fully transparent, screen-filling
window in front of everything, but I fear that this might affect
rendering performance (by doing unnecessary compositing, using up
memory, or whatever).
The deluxe solution to the problem would be talking to the tablet
driver using AppleEvents to tell it to constrain its mapped area to the
window (see Wacom's "TabletEventDemo" sample app,
http://www.wacomeng.com/devsupport/mac/downloads.html), but I think that
the bloat that solution would add to SDL would outweigh its usefulness.
What I did instead in my patch is reassociating mouse and cursor when
the mouse leaves the window while an invisible grab is in effect, and
restoring the grab when the window is entered. That way, the grab can
still be effectively broken by a tablet, but at least it's obvious to
the user that it is broken. That change is minimal - it doesn't affect
operation with a mouse (or a trackpad), and the code that it adds is not
executed on every PumpEvents() call, only when entering and leaving the
window.
Unless there are any concerns about the patch, please apply. Feel free
to shorten the lengthy comment in SDL_QuartzEvents.m if you think it's
too verbose.
Thanks
-Christian
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 02 Jan 2006 00:31:00 +0000 |
parents | 355632dca928 |
children | 34cca785be57 |
line wrap: on
line source
<HTML ><HEAD ><TITLE >SDL_envvars</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="HOME" TITLE="SDL Library Documentation" HREF="index.html"><LINK REL="UP" TITLE="General" HREF="general.html"><LINK REL="PREVIOUS" TITLE="SDL_GetError" HREF="sdlgeterror.html"><LINK REL="NEXT" TITLE="Video" HREF="video.html"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFF8DC" TEXT="#000000" LINK="#0000ee" VLINK="#551a8b" ALINK="#ff0000" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >SDL Library Documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="sdlgeterror.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="video.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="SDLENVVARS" ></A >SDL_envvars</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN675" ></A ><H2 >Name</H2 >SDL_envvars -- SDL environment variables</DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN678" ></A ><H2 >Description</H2 ><P >Not a function, set using setenv()</P ><P >Several environment variables are available to modify the behaviour of SDL. Using these variables isn't recommened and the names and presence of these variables aren't guaranteed from one release to the next. However, they can be very useful for debugging purposes.</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN682" ></A ><H2 >Video</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_FBACCEL</TT ></DT ><DD ><P >If set to 0, disable hardware acceleration in the linux fbcon driver.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_FBDEV</TT ></DT ><DD ><P >Frame buffer device to use in the linux fbcon driver, instead of /dev/fb0</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_FULLSCREEN_UPDATE</TT ></DT ><DD ><P >In the ps2gs driver, sets the <TT CLASS="LITERAL" >SDL_ASYNCBLIT</TT > flag on the display surface.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEODRIVER</TT ></DT ><DD ><P >Selectes the video driver for SDL to use. Possible values, in the order they are tried if this variable is not set:</P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN706" ></A ><P ></P ><TABLE BORDER="0" CLASS="CALSTABLE" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >x11</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dga</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(the XFree86 DGA2)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >nanox</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >fbcon</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >directfb</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >ps2gs</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Playstation 2)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >ggi</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >vgl</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(BSD)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >svgalib</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >aalib</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >directx</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >windib</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >bwindow</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(BeOS)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >toolbox</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS Classic)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >DSp</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS Classic)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >Quartz</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS X)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >CGX</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Amiga)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >photon</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(QNX)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >epoc</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Epoc)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dummy</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_CENTERED</TT ></DT ><DD ><P >If set, tries to center the SDL window when running in X11 windowed mode, or using the CyberGrafix driver.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_GL_DRIVER</TT ></DT ><DD ><P >The openGL driver (shared library) to use for X11. Default is libGL.so.1</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_DGAMOUSE</TT ></DT ><DD ><P >With XFree86, enables use of DGA mouse if set.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_MOUSEACCEL</TT ></DT ><DD ><P >For X11, sets the mouse acceleration. The value should be a string on the form:</P ><P >"<TT CLASS="PARAMETER" ><I >n</I ></TT >/<TT CLASS="PARAMETER" ><I >d</I ></TT >/<TT CLASS="PARAMETER" ><I >t</I ></TT >"</P ><P >where <TT CLASS="PARAMETER" ><I >n</I ></TT > and <TT CLASS="PARAMETER" ><I >d</I ></TT > are the acceleration numerator/denumerators (so mouse movement is accelerated by <TT CLASS="PARAMETER" ><I >n</I ></TT >/<TT CLASS="PARAMETER" ><I >d</I ></TT >), and <TT CLASS="PARAMETER" ><I >t</I ></TT > is the threshold above which acceleration applies (counted as number of pixels the mouse moves at once).</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_NODIRECTCOLOR</TT ></DT ><DD ><P >If set, don't attempt to use DirectColor visuals even if they are present. (SDL will use them otherwise for gamma correction). This is needed with older X servers when using the XVideo extension.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_VISUALID</TT ></DT ><DD ><P >ID of an X11 visual to use, overriding SDL's default visual selection algorithm. It can be in decimal or in hex (prefixed by 0x).</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_YUV_DIRECT</TT ></DT ><DD ><P >If set, display YUV overlay directly on the video surface if possible, instead of on the surface passed to <A HREF="sdlcreateyuvoverlay.html" ><TT CLASS="FUNCTION" >SDL_CreateYUVOverlay</TT ></A >.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_YUV_HWACCEL</TT ></DT ><DD ><P >If not set or set to a nonzero value, SDL will attempt to use hardware YUV acceleration for video playback.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_WINDOWID</TT ></DT ><DD ><P >For X11 or Win32, contains the ID number of the window to be used by SDL instead of creating its own window. Either in decimal or in hex (prefixed by 0x).</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN866" ></A ><H2 >Events/Input</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_MOUSE_RELATIVE</TT ></DT ><DD ><P >If set to 0, do not use mouse relative mode in X11. The default is to use it if the mouse is hidden and input is grabbed.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_MOUSEDEV</TT ></DT ><DD ><P >The mouse device to use for the linux fbcon driver. If not set, SDL first tries to use GPM in repeater mode, then various other devices (/dev/pcaux, /dev/adbmouse, /dev/mouse etc).</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_MOUSEDEV_IMPS2</TT ></DT ><DD ><P >If set, SDL will not try to auto-detect the IMPS/2 protocol of a PS/2 mouse but use it right away. For the fbcon and ps2gs drivers.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_MOUSEDRV</TT ></DT ><DD ><P >For the linux fbcon driver: if set to ELO, use the ELO touchscreen controller as a pointer device</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_NO_RAWKBD</TT ></DT ><DD ><P >For the libvga driver: If set, do not attempt to put the keyboard in raw mode.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_NOMOUSE</TT ></DT ><DD ><P >If set, the linux fbcon driver will not use a mouse at all.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN899" ></A ><H2 >Audio</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >AUDIODEV</TT ></DT ><DD ><P >The audio device to use, if <TT CLASS="LITERAL" >SDL_PATH_DSP</TT > isn't set.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_AUDIODRIVER</TT ></DT ><DD ><P >Selects the audio driver for SDL to use. Possible values, in the order they are tried if this variable is not set:</P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN913" ></A ><P ></P ><TABLE BORDER="0" CLASS="CALSTABLE" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >openbsd</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(OpenBSD)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dsp</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(OSS /dev/dsp: Linux, Solaris, BSD etc)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >alsa</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >audio</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Unix style /dev/audio: SunOS, Solaris etc)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >AL</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Irix)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >artsc</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(ARTS audio daemon)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >esd</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(esound audio daemon)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >nas</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(NAS audio daemon)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dma</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(OSS /dev/dsp, using DMA)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dsound</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32 DirectX)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >waveout</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32 WaveOut)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >baudio</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(BeOS)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >sndmgr</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS SoundManager)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >paud</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(AIX)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >AHI</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Amiga)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >disk</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(all; output to file)</P ></TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DD ><DT ><TT CLASS="LITERAL" >SDL_DISKAUDIOFILE</TT ></DT ><DD ><P >The name of the output file for the "disk" audio driver. If not set, the name <TT CLASS="LITERAL" >sdlaudio.raw</TT > is used.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_DISKAUDIODELAY</TT ></DT ><DD ><P >For the "disk" audio driver, how long to wait (in ms) before writing a full sound buffer. The default is 150 ms.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_DSP_NOSELECT</TT ></DT ><DD ><P >For some audio drivers (alsa, paud, dma and dsp), don't use select() but a timed method instead. May cure some audio problems, or cause others.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_PATH_DSP</TT ></DT ><DD ><P >The audio device to use. If not set, SDL tries AUDIODEV and then a platform-dependent default value (/dev/audio on Solaris, /dev/dsp on Linux etc).</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1017" ></A ><H2 >CD-ROM</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_CDROM</TT ></DT ><DD ><P >A colon-separated list of CD-ROM devices to use, in addition to the standard devices (typically /dev/cdrom, platform-dependent).</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1025" ></A ><H2 >Debugging</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_DEBUG</TT ></DT ><DD ><P >If set, causes every call to <TT CLASS="FUNCTION" >SDL_SetError</TT > (that is, every time SDL signals an error) to also print an error message on stderr.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1034" ></A ><H2 >Joystick</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_JOYSTICK_DEVICE</TT ></DT ><DD ><P >Joystick device to use in the linux joystick driver, in addition to the usual: /dev/js*, /dev/input/event*, /dev/input/js*</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_LINUX_JOYSTICK</TT ></DT ><DD ><P >Special joystick configuration string for linux. The format is</P ><P >"<TT CLASS="PARAMETER" ><I >name</I ></TT > <TT CLASS="PARAMETER" ><I >numaxes</I ></TT > <TT CLASS="PARAMETER" ><I >numhats</I ></TT > <TT CLASS="PARAMETER" ><I >numballs</I ></TT >"</P ><P >where <TT CLASS="PARAMETER" ><I >name</I ></TT > is the name string of the joystick (possibly in single quotes), and the rest are the number of axes, hats and balls respectively.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="sdlgeterror.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="video.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >SDL_GetError</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="general.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Video</TD ></TR ></TABLE ></DIV ></BODY ></HTML >