src/video/x11/SDL_x11video.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Sep 2012 01:11:30 -0700
changeset 6484 b904bb684095
parent 6481 fab4b15b17e9
child 6637 31e3f5b04120
permissions -rw-r--r--
Don't base our resizable state on what the window manager decided, instead we want to base it on the size hints which we set.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
     2
  Simple DirectMedia Layer
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
     7
  arising from the use of this software.
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    11
  freely, subject to the following restrictions:
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5471
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
#include "SDL_config.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
#ifndef _SDL_x11video_h
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
#define _SDL_x11video_h
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
5326
4a4095fe12e3 Renamed SDL_keysym.h to SDL_keycode.h to avoid confusion.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    26
#include "SDL_keycode.h"
5154
fb424691cfc7 Moved the rendering code out to a separate directory in the hope that it can someday be completely decoupled from the rest of the library and be expanded to an awesome 2D on 3D library.
Sam Lantinga <slouken@libsdl.org>
parents: 5081
diff changeset
    27
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#include "../SDL_sysvideo.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
#include <X11/Xlib.h>
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
#include <X11/Xutil.h>
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
#include <X11/Xatom.h>
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
5471
179adad3ae6f Added support for the Xcursor library for color cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5466
diff changeset
    34
#if SDL_VIDEO_DRIVER_X11_XCURSOR
179adad3ae6f Added support for the Xcursor library for color cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5466
diff changeset
    35
#include <X11/Xcursor/Xcursor.h>
179adad3ae6f Added support for the Xcursor library for color cursors
Sam Lantinga <slouken@libsdl.org>
parents: 5466
diff changeset
    36
#endif
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
#if SDL_VIDEO_DRIVER_X11_XINERAMA
5408
35a63789c3f2 Dynamically load the Xinerama and xf86vmode extensions
Sam Lantinga <slouken@libsdl.org>
parents: 5326
diff changeset
    38
#include <X11/extensions/Xinerama.h>
35a63789c3f2 Dynamically load the Xinerama and xf86vmode extensions
Sam Lantinga <slouken@libsdl.org>
parents: 5326
diff changeset
    39
#endif
6311
4e5e46f43438 Initial support for XInput2 by Dimitris Zenios
Sam Lantinga <slouken@libsdl.org>
parents: 6167
diff changeset
    40
#if SDL_VIDEO_DRIVER_X11_XINPUT2
4e5e46f43438 Initial support for XInput2 by Dimitris Zenios
Sam Lantinga <slouken@libsdl.org>
parents: 6167
diff changeset
    41
#include <X11/extensions/XInput2.h>
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
#endif
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
#if SDL_VIDEO_DRIVER_X11_XRANDR
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
#include <X11/extensions/Xrandr.h>
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
#endif
5408
35a63789c3f2 Dynamically load the Xinerama and xf86vmode extensions
Sam Lantinga <slouken@libsdl.org>
parents: 5326
diff changeset
    46
#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
3025
54fac87e1f34 Added an API to enable/disable the screen saver.
Sam Lantinga <slouken@libsdl.org>
parents: 2963
diff changeset
    47
#include <X11/extensions/scrnsaver.h>
54fac87e1f34 Added an API to enable/disable the screen saver.
Sam Lantinga <slouken@libsdl.org>
parents: 2963
diff changeset
    48
#endif
4794
e562160a873f Check configure-defined macro before doing _anything_ with XShape.
Ryan C. Gordon <icculus@icculus.org>
parents: 3697
diff changeset
    49
#if SDL_VIDEO_DRIVER_X11_XSHAPE
e562160a873f Check configure-defined macro before doing _anything_ with XShape.
Ryan C. Gordon <icculus@icculus.org>
parents: 3697
diff changeset
    50
#include <X11/extensions/shape.h>
e562160a873f Check configure-defined macro before doing _anything_ with XShape.
Ryan C. Gordon <icculus@icculus.org>
parents: 3697
diff changeset
    51
#endif
5408
35a63789c3f2 Dynamically load the Xinerama and xf86vmode extensions
Sam Lantinga <slouken@libsdl.org>
parents: 5326
diff changeset
    52
#if SDL_VIDEO_DRIVER_X11_XVIDMODE
35a63789c3f2 Dynamically load the Xinerama and xf86vmode extensions
Sam Lantinga <slouken@libsdl.org>
parents: 5326
diff changeset
    53
#include <X11/extensions/xf86vmode.h>
35a63789c3f2 Dynamically load the Xinerama and xf86vmode extensions
Sam Lantinga <slouken@libsdl.org>
parents: 5326
diff changeset
    54
#endif
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
#include "SDL_x11dyn.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
4508
15d2c6f40c48 Added X11 clipboard support.
Sam Lantinga <slouken@libsdl.org>
parents: 4472
diff changeset
    58
#include "SDL_x11clipboard.h"
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    59
#include "SDL_x11events.h"
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    60
#include "SDL_x11keyboard.h"
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    61
#include "SDL_x11modes.h"
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    62
#include "SDL_x11mouse.h"
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents: 1951
diff changeset
    63
#include "SDL_x11opengl.h"
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    64
#include "SDL_x11window.h"
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    65
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
/* Private display data */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
typedef struct SDL_VideoData
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
{
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
    Display *display;
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    71
    char *classname;
6167
c071e1372341 X11: Move to XSetWMProperties and add support to _NET_WM_PID
Marco Trevisan (Treviño) <mail@3v1n0.net>
parents: 6138
diff changeset
    72
    pid_t pid;
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    73
    XIM im;
3025
54fac87e1f34 Added an API to enable/disable the screen saver.
Sam Lantinga <slouken@libsdl.org>
parents: 2963
diff changeset
    74
    Uint32 screensaver_activity;
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    75
    int numwindows;
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    76
    SDL_WindowData **windowlist;
2324
3202e4826c57 more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
    77
    int windowlistlength;
4518
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    78
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    79
    /* This is true for ICCCM2.0-compliant window managers */
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    80
    SDL_bool net_wm;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    81
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    82
    /* Useful atoms */
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
    83
    Atom WM_DELETE_WINDOW;
4518
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    84
    Atom _NET_WM_STATE;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    85
    Atom _NET_WM_STATE_HIDDEN;
6481
fab4b15b17e9 Compositing window managers can show and hide windows without ever affecting the mapped state. However they do send NetWM protocol messages to indicate this is happening.
Sam Lantinga <slouken@libsdl.org>
parents: 6466
diff changeset
    86
    Atom _NET_WM_STATE_FOCUSED;
4518
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    87
    Atom _NET_WM_STATE_MAXIMIZED_VERT;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    88
    Atom _NET_WM_STATE_MAXIMIZED_HORZ;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    89
    Atom _NET_WM_STATE_FULLSCREEN;
6466
ebe165c00fab On Compiz (etc?), _NET_WM_ACTION_FULLSCREEN needs the window to be resizable.
Ryan C. Gordon <icculus@icculus.org>
parents: 6370
diff changeset
    90
    Atom _NET_WM_ALLOWED_ACTIONS;
ebe165c00fab On Compiz (etc?), _NET_WM_ACTION_FULLSCREEN needs the window to be resizable.
Ryan C. Gordon <icculus@icculus.org>
parents: 6370
diff changeset
    91
    Atom _NET_WM_ACTION_FULLSCREEN;
4518
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    92
    Atom _NET_WM_NAME;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    93
    Atom _NET_WM_ICON_NAME;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    94
    Atom _NET_WM_ICON;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    95
    Atom UTF8_STRING;
a956a315fe67 Lots of prep for the "real" way to support fullscreen mode on modern window managers.
Sam Lantinga <slouken@libsdl.org>
parents: 4508
diff changeset
    96
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5183
diff changeset
    97
    SDL_Scancode key_layout[256];
6370
93187f7f7d5d Improved simultaneous support for OpenGL and OpenGL ES
Sam Lantinga <slouken@libsdl.org>
parents: 6369
diff changeset
    98
    SDL_bool selection_waiting;    
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
} SDL_VideoData;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
5466
006883d5fa51 Gamma support is back!
Sam Lantinga <slouken@libsdl.org>
parents: 5408
diff changeset
   101
extern SDL_bool X11_UseDirectColorVisuals(void);
006883d5fa51 Gamma support is back!
Sam Lantinga <slouken@libsdl.org>
parents: 5408
diff changeset
   102
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
#endif /* _SDL_x11video_h */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
/* vi: set ts=4 sw=4 expandtab: */