Commit graph

110 commits

Author SHA1 Message Date
Michael Sartain
195b20e40e Fix Colormap when using X11_SetWindowFullscreenViaWM() path.
This was needed to get X11_SetWindowGammaRamp() working. Sam points out that there is an issue right now where
colormaps will only work with fullscreen windows, and we may want to set this when getting input focus for
windowed apps.
2012-10-11 09:34:13 -07:00
Ryan C. Gordon
b73e16cc4a Fixed memory leak in X11_SetWindowIcon(). 2012-10-05 22:43:00 -04:00
Sam Lantinga
670eb787d6 Poke window managers to get them to respect the resize hints. 2012-10-03 12:33:42 -07:00
Sam Lantinga
39f2156ead Fix the size to the windowed mode, not the fullscreen mode. 2012-10-03 12:19:55 -07:00
Sam Lantinga
b19b82aa44 Always set the size hints for consistent behavior with all window managers, and it wasn't resetting when switching back from fullscreen mode. 2012-10-03 12:14:04 -07:00
Sam Lantinga
a6fdbb6213 Theoretically fixed the position of the child window, though it's always ending up at the upper left corner for some reason. 2012-09-28 10:54:26 -07:00
Sam Lantinga
26efe14fd6 A few more tweaks for the legacy fullscreen support 2012-09-28 10:24:28 -07:00
Sam Lantinga
43674fabab We don't always get the focus change events. Argh! 2012-09-28 02:15:44 -07:00
Sam Lantinga
e6a0c63fb7 Simplified the NetWM code a little bit, and it now operates on X11 Window 2012-09-28 01:51:51 -07:00
Sam Lantinga
32c3816470 Don't set the hidden netwm state, that would mean we don't want to be shown, which is bad. 2012-09-28 01:36:26 -07:00
Sam Lantinga
b9083adeb5 Pass the flags in, not the window pointer! 2012-09-28 01:15:48 -07:00
Sam Lantinga
71450f7c85 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. 2012-09-28 01:11:30 -07:00
Sam Lantinga
6380cc6759 Only map/unmap if the window isn't already in the correct state. 2012-09-28 00:57:47 -07:00
Sam Lantinga
c5d1dc43c3 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.
Also refactored the netwm state code so it's consistent between the places that use it.
2012-09-27 23:55:38 -07:00
Sam Lantinga
7e30790b41 Hopefully improved legacy fullscreen handling (it works now on my Ubuntu Unity system) 2012-09-27 17:17:33 -07:00
Sam Lantinga
535b566931 Removed unused variables 2012-09-27 14:38:56 -07:00
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
5390cf0ace When we're reparented we'll get both unmapnotify and mapnotify. Eat both so the unmap notify doesn't confuse the normal event processing. 2012-09-27 13:52:57 -07:00
Sam Lantinga
2c07f9f35b Fixed fullscreen origin for multi-head displays 2012-09-27 13:23:34 -07:00
Sam Lantinga
c95f18c57a Use the legacy fullscreen code if the window manager doesn't support the NetWM protocol. 2012-09-27 11:39:31 -07:00
Sam Lantinga
8bbb66b684 Removed unused functions 2012-09-27 11:16:31 -07:00
Ryan C. Gordon
6d86238afc X11: Attempt to go fullscreen the way SDL 1.2 did it.
Ideally this code is never used, but as a legacy fallback, it could be useful.

--HG--
extra : rebase_source : aea45507c3b6388d929b6074351fb59c2dab2097
2012-09-27 03:36:13 -04:00
Ryan C. Gordon
170089c6aa On Compiz (etc?), _NET_WM_ACTION_FULLSCREEN needs the window to be resizable.
Thanks to Edward Rudd for the patch!

--HG--
extra : rebase_source : 2039db129b3a6801e0001c6b8f508f5b0d27269e
2012-09-27 00:53:37 -04:00
Edward Rudd
df2acac897 allocate *Hint structures per Xlib docs 2012-09-26 14:08:46 -04:00
Ryan C. Gordon
30291cdd9a Make the X11 SetBordered event tapdancing more robust, restore focus, etc.
--HG--
extra : rebase_source : 9618675dc68a00d7f2dd6ddaf87ad73386f4a546
2012-09-13 15:24:04 -04:00
Ryan C. Gordon
8835a0dacb Added SDL_SetWindowBordered() API.
--HG--
extra : rebase_source : 11750f0d8e7b59af26d97c778a332c0b4b72ea4b
2012-09-13 01:43:53 -04:00
Sam Lantinga
1277706b2b More OpenGL ES fixes from Scott Percival 2012-07-19 09:36:58 -07:00
Sam Lantinga
b3219a6db1 Improved simultaneous support for OpenGL and OpenGL ES
From Scott Percival

Okay, I think I have something for this. Tested it on GL and GLES
machines, it seems to work okay.

- Add a new SDL GL attribute SDL_GL_CONTEXT_EGL:
        - Only useful for the X11 video driver at the moment
        - Set to 1 for an EGL context, 0 to use the default for the video driver
        - Default is 0, unless library is built for EGL only
        - Should be set after SDL init, but before window/context
creation (i.e. same place you'd specify attributes for major/minor GL
version)
- After a lot of agony pondering the least-terrible way to go about
it, made it so that X11_GL_LoadLibrary and X11_GLES_LoadLibrary check
SDL_GL_CONTEXT_EGL. If no GL context exists yet, and the attribute
choice doesn't match with the checking function, then it changes all
the function pointers in the video driver and passes control on to the
new LoadLibrary method.
- Likewise, make X11_CreateWindow check this attribute before firing
off a call to X11_GL_GetVisual/X11_GLES_GetVisual
- Added a sanity check to the start of X11_GL_LoadLibrary
- Tidied up SDL_x11opengles.h
- Moved ownership of the gles_data structure over to
X11_GLES_LoadLibrary/UnloadLibrary
- Should incorporate the 3 fixes posted by Andre Heider

This is obviously quite a bit to take in, but is (at least) a proof of
concept for the approach I think EGL/GLX mingling should take. Any
comments/criticism is much appreciated.
2012-07-18 15:17:27 -07:00
Sam Lantinga
cb83481887 Fix OpenGL initialization when OpenGL and OpenGLES are both available.
Both options default to "yes" via configure, and having libs/headers
for both installed is not unusual.

We default to OpenGL on this compile time combination, but can enforce
OpenGLES via setting the envvar SDL_VIDEO_X11_GLES.
This will be further refined based on community feedback.

Contributed by Andre Heider
2012-07-18 15:02:48 -07:00
Sam Lantinga
a3161ce5ae Fix SDL_SetWindowSize with X11 non-RESIZABLE windows, patch by Pierre-Loup. 2012-06-22 23:31:22 -04:00
Sam Lantinga
6b9b78a899 Fixed issue with tiling window managers (bug 1246)
Patch contributed by Driedfruit - thanks!
2012-06-21 09:58:22 -04:00
Gabriel Jacobo
1d3f4c2eca Fixes #1522, improved Xinerama / Twinview support 2012-06-19 14:19:05 -03:00
Dimitris Zenios
497b8deec4 1.Moved all xinput2 functionality to its own file
2.Implement touch events using Xinput2.Leave evtouch as a fallback when xinput2 is not supported
2012-05-31 13:37:02 +03:00
Sam Lantinga
4c9a5c130f Fixed bug 1403 - Creating a window with resizable flags may crash
jordirovira 2012-01-28 12:07:39 PST

in SDL_x11window around 520:

    /* Setup the normal size hints */
    if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
        sizehints.min_width = sizehints.max_width = window->w;
        sizehints.min_height = sizehints.max_height = window->h;
        sizehints.flags = PMaxSize | PMinSize;
    }
    sizehints.x = window->x;
    sizehints.y = window->y;
    sizehints.flags |= USPosition;

the sizehints.flags member is not initizalised if it doesn't enter the
conditional. It is as easy as setting it to zero before the conditional.
2012-02-03 22:24:33 -05:00
Sam Lantinga
296e78b65f Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Scott Percival 2011-07-03 06:41:51 PDT

This submission is aimed at making life easier for OpenGL ES capable devices
running a X11 stack (e.g. Maemo, Meego, TrimSlice, other ARM SoC boards not
running Android). SDL's Pandora support already has the neccesary GLES-to-X11
glue code, however it's all ghetto'd off in Makefile.pandora and not very
flexible.

The patch:
- adds an awesome --enable-video-opengles option to configure
- re-modifies the opengles and opengles2 SDL_renderers to use function pointers
- no idea why this was removed?
- for SDL_Renderers, links in libGLESv1_CM, libGLES_CM (for PowerVR fans) or
libGLESv2 at runtime
- links in libEGL.so at runtime - the old code made an assumption that
eglFunctions could be pulled from the active GLES library, PowerVR for one
doesn't let you do that with their libGLESv2
- allows you to pick which of GLES v1 or v2 to load via
SDL_GL_CONTEXT_MAJOR_VERSION

So far I've tested this on a Nokia N900 (OMAP 3430/SGX 530 running Maemo 5) and
a Toshiba AC100 (Tegra 2 running Ubuntu 10.10). I haven't tested it on... well,
everything that isn't those two, such as a Pandora, iOS or Android device. The
Pandora specific code should be kept intact (fingers crossed), and nothing
painfully drastic has been added to the SDL_renderers. The library loading
sequence in SDL_x11opengles has been updated to accomodate both NVIDIA's
propensity to let developers get away with murder and PowerVR's alternative of
punishing every missed step.

The test apps work okay with GLES or GLES2 as the renderer. For some reason
alpha blending doesn't seem to work on the Tegra 2; last week NVIDIA pushed out
a new set of X11 GLES drivers, so I'll try and investigate once I upgrade
those. Also, this patch adds things to configure.in, include/SDL_config.h.in
and test/configure.in. I didn't know what the policy was re. committing
generated spaghetti from autotools, so ./autogen.sh has to be run again. Sorry.

I think that's about everything, let me know if there's anything I've
overlooked.
2012-01-08 02:23:37 -05:00
Marco Trevisan (Treviño)
8279896de9 X11: Move to XSetWMProperties and add support to _NET_WM_PID
Use the convenience function XSetWMProperties to set size, input
and class hints, it also automatically sets the WM_CLIENT_MACHINE
(this one needed by _NET_WM_PID) and WM_LOCALE_NAME windows hints.

Plus we add support to the _NET_WM_PID atom which is needed by many
windows managers to correctly associate a SDL window to its process
and to related .desktop file and icon for the given host.
2011-06-27 19:30:52 +02:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Ryan C. Gordon
9f84d0e002 Fix crash on X servers without UTF-8 support. 2011-10-31 23:37:57 -04:00
Ryan C. Gordon
bc4b0f28f1 Set up window focus correctly when using an existing X11 window.
Thanks to Joseph Toppi for the fix!

--HG--
extra : rebase_source : be4596056669a0a9c7580355084b7f9eca345d78
2011-10-22 02:14:57 -04:00
Ryan C. Gordon
20181eb52a XGetWindowProperty() can report success but still give you a NULL pointer.
Thanks to Joseph Toppi for the fix!

--HG--
extra : rebase_source : c450494b2c2e397098e50b621b01895fc587357f
2011-10-22 02:13:35 -04:00
Ryan C. Gordon
bc13816375 Fixed a whole slew of compiler warnings that -Wall exposed. 2011-10-13 01:08:30 -04:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
0e83d1d4f3 Fixed setting programmatically setting the size of a window on X11 for non-resizable windows.
Patch by Matthew Smaling
2011-04-05 09:47:34 -07:00
Sam Lantinga
fc9ee0c10f Fixed so code will compile with SDL_config_minimal.h 2011-03-12 13:21:57 -08:00
Sam Lantinga
0eb0a30eca Fixed bug 1167 (SDL_WINDOWPOS_CENTERED doesn't work if used right after fullscreen -> windowed switch)
The top level code handles SDL_WINDOWPOS_CENTERED now, and the Cocoa SetWindowPosition call will clear the moveHack before adjusting the window position.
2011-03-11 16:54:43 -08:00
Sam Lantinga
7dd0385c57 Gamma support is back!
New API functions:
	SDL_SetWindowBrightness()
	SDL_GetWindowBrightness()
	SDL_SetWindowGammaRamp()
	SDL_GetWindowGammaRamp()
	SDL_CalculateGammaRamp()
2011-03-11 08:49:20 -08:00
Sam Lantinga
642eea1ebc Simplified the X11 window creation 2011-02-21 22:52:31 -08:00
Sam Lantinga
6c726ca475 Fixed a host of issues with Windows fullscreen modes. Toggling fullscreen OpenGL works now in my test environment. 2011-02-15 23:07:14 -08:00
Sam Lantinga
99260d91a1 Implemented X11 fullscreen toggling with modern window managers 2011-02-15 17:23:02 -08:00
Sam Lantinga
5095592ce5 A few fixes:
Fixed creating render texture framebuffer.
Removed the need for palette watch, added surface format caching.
Added an SDL_DONTFREE flag so you can't free the window and 1.2 shadow surfaces.
2011-02-13 13:46:10 -08:00