1 | /* |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997-2025 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_x11modes_h_ |
24 | #define SDL_x11modes_h_ |
25 | |
26 | struct SDL_DisplayData |
27 | { |
28 | int screen; |
29 | Visual *visual; |
30 | int depth; |
31 | int scanline_pad; |
32 | int x; |
33 | int y; |
34 | |
35 | Uint64 mode_switch_deadline_ns; |
36 | |
37 | bool use_xrandr; |
38 | |
39 | #ifdef SDL_VIDEO_DRIVER_X11_XRANDR |
40 | RROutput xrandr_output; |
41 | char connector_name[16]; |
42 | #endif |
43 | }; |
44 | |
45 | struct SDL_DisplayModeData |
46 | { |
47 | #ifdef SDL_VIDEO_DRIVER_X11_XRANDR |
48 | RRMode xrandr_mode; |
49 | #else |
50 | int unused; // just so struct isn't empty. |
51 | #endif |
52 | }; |
53 | |
54 | extern bool X11_InitModes(SDL_VideoDevice *_this); |
55 | extern bool X11_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display); |
56 | extern bool X11_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode); |
57 | extern void X11_QuitModes(SDL_VideoDevice *_this); |
58 | |
59 | // Some utility functions for working with visuals |
60 | extern bool X11_GetVisualInfoFromVisual(Display *display, Visual *visual, XVisualInfo *vinfo); |
61 | extern SDL_PixelFormat X11_GetPixelFormatFromVisualInfo(Display *display, XVisualInfo *vinfo); |
62 | extern bool X11_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *sdl_display, SDL_Rect *rect); |
63 | extern bool X11_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *sdl_display, SDL_Rect *rect); |
64 | |
65 | #ifdef SDL_VIDEO_DRIVER_X11_XRANDR |
66 | extern void X11_HandleXRandREvent(SDL_VideoDevice *_this, const XEvent *xevent); |
67 | #endif |
68 | |
69 | #endif // SDL_x11modes_h_ |
70 | |