src/video/x11/SDL_x11video.c


Log

Author Commit Date CI Message
Sam Lantinga 4b585e75 2020-02-03T08:06:52 Fixed bug 4833 - Use EGL for X11? Martin Fiedler To be precise, this is about *desktop OpenGL* on X11. For OpenGL ES, EGL is already used (as it's the only way to get an OpenGL ES context), as Sylvain noted above. To shine some light on why this is needed: In 99% of all cases, using GLX on X11 is fine, even though it's effectively deprecated in favor of EGL [1]. However, there's at least one use case that *requires* the OpenGL context being created with EGL instead of GLX, and that's DRM_PRIME interoperability: The function glEGLImageTargetTexture2DOES simply doesn't work with GLX. (Currently, Mesa actually crashes when trying that.) Some example code: https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e Runs on Intel and open-source AMD drivers just fine (others unconfirmed), but with #define USE_EGL 0 (i.e. forcing it to GLX), it crashes. The same happens when using SDL for window and context creation. The good news is that most of the pieces for EGL support on X11 are already in place: SDL_egl.c is pretty complete (and used for desktop OpenGL on Wayland, for example), and SDL_x11opengl.c has the aforementioned OpenGL-ES-on-EGL support. However, when it comes to desktop OpenGL, it's hardcoded to fall back to GLX. I'm not advocating to make EGL the default for desktop OpenGL on X11; don't fix what ain't broken. But something like an SDL_HINT_VIDEO_X11_FORCE_EGL would be very appreciated to make use cases like the above work with SDL. [1] source: Eric Anholt, major Linux graphics stack developer, 7 years ago already - see last paragraph of https://www.phoronix.com/scan.php?page=news_item&px=MTE3MTI
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon e061a92d 2018-08-02T16:03:47 Some drag'and'drop improvements. First: disable d'n'd events by default; most apps don't need these at all, and if an app doesn't explicitly handle these, each drop on the window will cause a memory leak if the events are enabled. This follows the guidelines we have for SDL_TEXTINPUT events already. Second: when events are enabled or disabled, signal the video layer, as it might be able to inform the OS, causing UI changes or optimizations (for example, dropping a file icon on a Cocoa app that isn't accepting drops will cause macOS to show a rejection animation instead of the drop operation just vanishing into the ether, X11 might show a different cursor when dragging onto an accepting window, etc). Third: fill in the drop event details in the test library and enable the events in testwm.c for making sure this all works as expected.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 50efbda7 2017-08-28T00:43:14 Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h
Sam Lantinga ce2b1644 2017-08-28T00:11:38 Be clear that disabling Vulkan surface support disables the entire SDL Vulkan integration
Ryan C. Gordon 25e3a1ec 2017-08-27T22:15:57 vulkan: Initial Vulkan support! This work was done by Jacob Lifshay and Mark Callow; I'm just merging it into revision control.
Sam Lantinga eb06aba8 2017-08-13T21:16:58 Fixed bug 3742 - minor warning fixes
Sam Lantinga d226594f 2017-08-12T16:48:46 Workaround for bug 3049 - SDL_Init(SDL_INIT_VIDEO) - XDM authorization key matches an existing client! malferit Hello, I began a little program with SDL2 on Linux in C, and when I call SDL_Init(SDL_INIT_VIDEO) I get an error and this is printed in the console: XDM authorization key matches an existing client! I searched through Internet, and found that some people suggest to run 'xhost +' or to specify this in /etc/X11/xdm/xdm-config: DisplayManager*authName: MIT-MAGIC-COOKIE-1 I don't think an end user needs to know that... But what bothered me is that first I started this little program in Pascal using the Freepascal compiler and it works. In freepascal you only use some thin header bindings in Pascal and then it links with the dynamic SDL library, so I don't understood why it worked with Freepascal and not in C. I run ldd to the two generated applications: Application in C: linux-gate.so.1 (0xffffe000) libSDL2-2.0.so.0 => /usr/lib/libSDL2-2.0.so.0 (0xb76ac000) libpthread.so.0 => /lib/libpthread.so.0 (0xb766e000) libc.so.6 => /lib/libc.so.6 (0xb74e2000) libm.so.6 => /lib/libm.so.6 (0xb74a0000) libdl.so.2 => /lib/libdl.so.2 (0xb749a000) librt.so.1 => /lib/librt.so.1 (0xb7491000) /lib/ld-linux.so.2 (0xb77b3000) Application compiled with Freepascal: linux-gate.so.1 (0xffffe000) libSDL2-2.0.so.0 => /usr/lib/libSDL2-2.0.so.0 (0xb762a000) libX11.so.6 => /usr/lib/libX11.so.6 (0xb74f3000) libc.so.6 => /lib/libc.so.6 (0xb7367000) libm.so.6 => /lib/libm.so.6 (0xb7325000) libdl.so.2 => /lib/libdl.so.2 (0xb731f000) libpthread.so.0 => /lib/libpthread.so.0 (0xb7305000) librt.so.1 => /lib/librt.so.1 (0xb72fc000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb72dc000) libXau.so.6 => /usr/lib/libXau.so.6 (0xb72d9000) libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb72d3000) /lib/ld-linux.so.2 (0xb7755000) It seems that Freepascal is linking with libX11, libxcb, libXau and libXdmcp . Linking my C application with libxcb solved the problem (linking with libXau and/or libXdmcp without libxcb didn't work). Linking with X11 links all the other libraries and works as well. So I fill this bug report mainly to let you know about this. I don't know if it is a problem that can be solved on the libSDL side or not, but at least I hope it will help. Hi, some tests: 1. Disabled XDM. Login in console and running 'startx'. The program works without having to link with X11. 2. Enabled XDM. Added 'DisplayManager*authName: MIT-MAGIC-COOKIE-1' to /etc/X11/xdm/xdm-config.The program works without having to link with X11. 3. Enabled XDM without 'DisplayManager*authName: MIT-MAGIC-COOKIE-1' in /etc/X11/xdm/xdm-config . I get the authentication error unless I link with X11.
Ryan C. Gordon 2ffd6d02 2017-07-31T13:49:22 x11: Make a separate unmapped window to own clipboard selections. Now the clipboard isn't lost if you destroy a specific SDL_Window, as it works on other platforms. You will still lose the clipboard data on SDL_Quit() or process termination, but that's X11 for you; run a Clipboard Manager daemon. Fixes Bugzilla #3222. Fixes Bugzilla #3718.
Ryan C. Gordon b3f94acb 2017-05-28T07:11:52 linux: Simplify D-Bus interface, remove lots of boilerplate.
Sam Lantinga cf31ea14 2017-02-11T11:14:48 Fixed bug 3583 - X11 touch device can be permanently lost Volumetric In X11 the SDL error "Unknown touch device" can occur after which the application stops recognizing touch events. For a kiosk-type application this results in a hang as far as the user is concerned. This is reproducible on HP Z220/Z230/Z240 workstations by swapping USB cables for a while and it also occurs with no physical changes, probably due to USB device power management. A workaround is to make SDL re-enumerate the touch devices like it does at startup. A patch is attached.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Alex Baines 5fe98497 2016-10-28T01:28:58 Fix double events / no repeat flag on key events when built withoutibus/fcitx Uses XkbSetDetectableKeyRepeat, and falls back to forcing @im=none if it's not supported.
Philipp Wiesemann f6bcfa01 2016-10-12T23:38:31 X11: Fixed compile warning about unused variable.
Sam Lantinga 42f85aa2 2016-10-08T11:30:07 Fixed building and using fcitx IME support on Linux
Alex Baines d9e3972a 2016-10-03T15:31:11 Fix invalid read from poor setlocale usage.
Sam Lantinga fa0f4176 2016-10-01T14:48:18 Fixed build warnings and errors
Ryan C. Gordon 4f4c4b62 2016-09-29T22:52:41 Added SDL_SetWindowResizable(). (thanks, Ethan!)
Ryan C. Gordon 02f49fdb 2016-03-04T18:47:19 x11: Deal with window borders better. - Cache the _NET_FRAME_EXTENTS data locally, so we don't have to query the X server for them (instead, we update our cached data when PropertyNotify events alert us to a change). - Use our cached extents for X11_GetWindowBordersSize(), so it's a fast call. - Window position was meant to refer to the client area, not the window decorations, so adjust appropriately when getting/setting the position.
Ryan C. Gordon 3bdaf4c6 2016-01-05T02:46:10 Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity(). This is currently implemented for X11, Cocoa, Windows, and DirectFB. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon 5696e88e 2016-01-05T02:29:06 Added SDL_GetWindowBordersSize(). This is currently only implemented for X11. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon e497e465 2016-01-05T02:28:56 Added SDL_SetWindowInputFocus(). This is currently only implemented for X11. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon dc532c70 2016-01-05T02:27:50 Added SDL_WINDOWEVENT_TAKE_FOCUS. This is for corner cases where a multi-window app is activated and wants to make a decision about where focus should go. This patch came from Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon f9af0c03 2016-01-05T02:27:26 x11: Put a matching window_group wmhint on every window created. This is useful to the Window Manager, so it can know to associate multiple SDL windows with a single app.
Ryan C. Gordon f2defe5e 2016-01-05T01:30:40 Added special window type flags. Specifically: always on top, skip taskbar, tooltip, utility, and popup menu. This is currently only implemented for X11. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon c3114975 2016-01-04T23:52:40 Added SDL_GetDisplayUsableBounds().
Ryan C. Gordon 6df5e1e5 2016-01-04T16:25:27 x11: Support _NET_WM_USER_TIME and give _NET_ACTIVE_WINDOW a valid timestamp. Fixes Bugzilla #3056.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Alex Baines 7543092a 2015-09-30T04:16:09 Call setlocale + XSetModifiers before XOpenIM, Work around ibus+xim duplicate events.
Ryan C. Gordon 81457603 2015-08-15T00:36:39 X11: Handle keyboard layout changing during app's run on Ubuntu 12.04 (etc). Fixes Bugzilla #3050 (in addition to Jason Wyatt's patch, prior to this).
Alfred Reynolds 51c72e10 2015-07-29T17:19:02 Add X11 implementation of SDL_GetDisplayDPI.
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon 8875a401 2015-04-22T16:50:48 x11: Optimize SDL_GetGlobalMouseState() a little. Use XInput2 to mark the global mouse state as dirty so we don't have to make a bunch of roundtrips to the X server when nothing has changed.
Ryan C. Gordon d4aedf99 2015-04-21T09:45:58 Added SDL_SetWindowModalFor(). This is currently only implemented for X11. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Ryan C. Gordon b29740b8 2014-06-25T17:06:12 Merged Ryan's SDL-gui-backend branch. Adds three APIs, and implements them on X11, Cocoa, and Windows: - SDL_CaptureMouse() - SDL_GetGlobalMouseState() - SDL_SetWindowHitTest()
Alex Baines 41a39837 2014-06-18T20:11:39 Add IBus IME Support, move DBus code to its own file. (v3.3 squashed)
Ryan C. Gordon 98c03f39 2014-05-28T01:22:47 Changed drag area API to a hit-testing API. There were several good arguments for this: it's how Windows works with WM_NCHITTEST, SDL doesn't need to manage a list of rects, it allows more control over the regions (how do you use rects to cleanly surround a circular button?), the callback can be more optimized than a iterating a list of rects, and you don't have to send an updated list of rects whenever the window resizes or layout changes.
Damian Kaczmarek 2744c019 2014-05-27T14:41:16 Initial work on X11 implementation of SDL_SetWindowDragAreas().
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Bastien Nocera 4ca76b3e 2014-03-02T14:59:06 Add support for the freedesktop.org Idle Inhibition specification, as per: http://people.freedesktop.org/~hadess/idle-inhibition-spec/ This makes screensaver inhibition work with GNOME 3 and other desktop environments that implement the specification. https://bugzilla.libsdl.org/show_bug.cgi?id=2169
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Sam Lantinga 2bb344d6 2013-11-27T10:29:27 Don't crash when no WM is present. CR: Sam Lantinga.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Ryan C. Gordon a2bd8970 2013-10-18T01:36:41 Don't supply duplicate X11 symbols inside SDL. Fixes static linking when something else also uses X11.
Sam Lantinga 6435a82d 2013-10-14T09:12:30 Backed out revision fb5ab0e91c56, the platform specific messagebox functions don't have the right prototype since they're designed to be used standalone.
Sam Lantinga f79fc33a 2013-08-29T08:29:21 Christoph Mallon: Remove pointless if (x) before SDL_free(x)
Gabriel Jacobo 2490166d 2013-08-21T10:12:16 Fixes for -Wdeclaration-after-statement
Gabriel Jacobo 0eeb76d8 2013-08-19T16:29:46 Fixes bug #2037, common EGL code for Android and X11
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.
Sam Lantinga 1df1e696 2013-07-14T11:28:44 Added the platform specific messagebox function to the video function list