1 /* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20 */ 21 #include "../../SDL_internal.h" 22 23 #ifndef SDL_x11video_h_ 24 #define SDL_x11video_h_ 25 26 #include "SDL_keycode.h" 27 28 #include "../SDL_sysvideo.h" 29 30 #include <X11/Xlib.h> 31 #include <X11/Xutil.h> 32 #include <X11/Xatom.h> 33 34 #if SDL_VIDEO_DRIVER_X11_XCURSOR 35 #include <X11/Xcursor/Xcursor.h> 36 #endif 37 #if SDL_VIDEO_DRIVER_X11_XDBE 38 #include <X11/extensions/Xdbe.h> 39 #endif 40 #if SDL_VIDEO_DRIVER_X11_XINERAMA 41 #include <X11/extensions/Xinerama.h> 42 #endif 43 #if SDL_VIDEO_DRIVER_X11_XINPUT2 44 #include <X11/extensions/XInput2.h> 45 #endif 46 #if SDL_VIDEO_DRIVER_X11_XRANDR 47 #include <X11/extensions/Xrandr.h> 48 #endif 49 #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER 50 #include <X11/extensions/scrnsaver.h> 51 #endif 52 #if SDL_VIDEO_DRIVER_X11_XSHAPE 53 #include <X11/extensions/shape.h> 54 #endif 55 #if SDL_VIDEO_DRIVER_X11_XVIDMODE 56 #include <X11/extensions/xf86vmode.h> 57 #endif 58 59 #include "../../core/linux/SDL_dbus.h" 60 #include "../../core/linux/SDL_ime.h" 61 62 #include "SDL_x11dyn.h" 63 64 #include "SDL_x11clipboard.h" 65 #include "SDL_x11events.h" 66 #include "SDL_x11keyboard.h" 67 #include "SDL_x11modes.h" 68 #include "SDL_x11mouse.h" 69 #include "SDL_x11opengl.h" 70 #include "SDL_x11window.h" 71 #include "SDL_x11vulkan.h" 72 73 /* Private display data */ 74 75 typedef struct SDL_VideoData 76 { 77 Display *display; 78 Display *request_display; 79 char *classname; 80 pid_t pid; 81 XIM im; 82 Uint32 screensaver_activity; 83 int numwindows; 84 SDL_WindowData **windowlist; 85 int windowlistlength; 86 XID window_group; 87 Window clipboard_window; 88 #if SDL_VIDEO_DRIVER_X11_XFIXES 89 SDL_Window *active_cursor_confined_window; 90 #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ 91 92 /* This is true for ICCCM2.0-compliant window managers */ 93 SDL_bool net_wm; 94 95 /* Useful atoms */ 96 Atom WM_PROTOCOLS; 97 Atom WM_DELETE_WINDOW; 98 Atom WM_TAKE_FOCUS; 99 Atom WM_NAME; 100 Atom _NET_WM_STATE; 101 Atom _NET_WM_STATE_HIDDEN; 102 Atom _NET_WM_STATE_FOCUSED; 103 Atom _NET_WM_STATE_MAXIMIZED_VERT; 104 Atom _NET_WM_STATE_MAXIMIZED_HORZ; 105 Atom _NET_WM_STATE_FULLSCREEN; 106 Atom _NET_WM_STATE_ABOVE; 107 Atom _NET_WM_STATE_SKIP_TASKBAR; 108 Atom _NET_WM_STATE_SKIP_PAGER; 109 Atom _NET_WM_ALLOWED_ACTIONS; 110 Atom _NET_WM_ACTION_FULLSCREEN; 111 Atom _NET_WM_NAME; 112 Atom _NET_WM_ICON_NAME; 113 Atom _NET_WM_ICON; 114 Atom _NET_WM_PING; 115 Atom _NET_WM_WINDOW_OPACITY; 116 Atom _NET_WM_USER_TIME; 117 Atom _NET_ACTIVE_WINDOW; 118 Atom _NET_FRAME_EXTENTS; 119 Atom _SDL_WAKEUP; 120 Atom UTF8_STRING; 121 Atom PRIMARY; 122 Atom XdndEnter; 123 Atom XdndPosition; 124 Atom XdndStatus; 125 Atom XdndTypeList; 126 Atom XdndActionCopy; 127 Atom XdndDrop; 128 Atom XdndFinished; 129 Atom XdndSelection; 130 Atom XKLAVIER_STATE; 131 132 SDL_Scancode key_layout[256]; 133 SDL_bool selection_waiting; 134 135 SDL_bool broken_pointer_grab; /* true if XGrabPointer seems unreliable. */ 136 137 Uint32 last_mode_change_deadline; 138 139 SDL_bool global_mouse_changed; 140 SDL_Point global_mouse_position; 141 Uint32 global_mouse_buttons; 142 143 #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 144 XkbDescPtr xkb; 145 #endif 146 int xkb_event; 147 148 KeyCode filter_code; 149 Time filter_time; 150 151 #if SDL_VIDEO_VULKAN 152 /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */ 153 void *vulkan_xlib_xcb_library; 154 PFN_XGetXCBConnection vulkan_XGetXCBConnection; 155 #endif 156 157 } SDL_VideoData; 158 159 extern SDL_bool X11_UseDirectColorVisuals(void); 160 161 #endif /* SDL_x11video_h_ */ 162 163 /* vi: set ts=4 sw=4 expandtab: */ 164