Commit Graph

4427 Commits

Author SHA1 Message Date
Jørgen P. Tjernø
7e4c549afe Add SDL_GL_ResetAttributes. 2014-01-29 18:38:13 -08:00
Sam Lantinga
7490c5a28f Add a new hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that allows SDL_CreateWindowFrom() to set the pixel format of another SDL_Window (and also will set the SDL_WINDOW_OPENGL flag on the window created with SDL_CreateWindowFrom()).
The reasoning behind this change is that source2 in -tools mode has a single OpenGL context that is used with multiple different windows.  Some of those windows are created outside the engine (i.e. with Qt) and therefore we need to use SDL_CreateWindowFrom() to get an SDL_Window for those.  The requirement for sharing an OpenGL context across multiple different windows is that each window has the same pixel format.  To facilitate this, I now set SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT for the main window before calling SDL_CreateWindowFrom().  When I do this, SDL_CreateWindowFrom() will:

1. Set the pixel format of the returned window to the same pixel format as this SDL_Window passed in with the hint
2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for OpenGL rendering.

I only currently implemented this for Win32/WGL so implementing it for other platforms (i.e. X11) remains a TODO.

CR: SamL

Some pseudocode that shows how this is used in Source2:

HWND hExternalHwnd; // HWND that was established outside of SDL

// Create main window (happens inside platwindow.cpp)
SDL_Window *mainWindow = SDL_CreateWindow( , SDL_WINDOW_OPENGL .. );
// Create GL context, happens inside rendersystemgl
SDL_GLContext onlyContext = SDL_GL_CreateContext( mainWindow );

// Now I need to create another window from hEternalHwnd for my swap chain that will have the same pixel format as mainWindow, so set the hint
SDL_SetHint( SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, CFmtStr( %p, mainWindow) );

// Create the secondary window.  This returned window will have SDL_WINDOW_OPENGL set and share a pixel format with mainWindow from the hint
SDL_Window *secondaryWindow = SDL_CreateWindowFrom( hExternalHwnd );

// To render to the main window:
SDL_GL_MakeCurrent( mainWindow, onlyContext );
// Do some rendering to main window

// To render to the secondary window:
SDL_GLMakeCurrent( secondaryWindow, onlyContext );
// Do some rendering to secondary window
2014-01-30 12:30:40 -08:00
Sam Lantinga
171fa6872d Document Michael's changes adding TranslateMessage() back to the SDL message loop. 2014-01-30 12:27:24 -08:00
Sam Lantinga
7bd79f5a4b * Added TranslateMessage call to SDL default message pump - was causing problems in S2 tools mode apps that used Qt. Qt relies on the WM_CHAR message generated by TranslateMessage and keyboard input was showing up in the UI as mixed-case. (Depending on which message pump got a given message - both SDL and Qt pump messages for the entire process.) Sam will review and possibly tweak this change before propagating to public SDL, but I'm checking this version in so I can integrate into S2 and fix the issue there. 2014-01-30 12:27:00 -08:00
Jørgen P. Tjernø
fa1d9a169f Mac: [NSApp keyWindow] is not valid in windowDidBecomeKey:
This fixes weird behavior on Mac where our first responder reverts to the window
itself, rather than the SDLTranslatorResponder, after the window has lost focus
once. This causes Escape to call cancelOperation: on the NSWindow, which by
default removes our fullscreen-ness.

When someone has turned off SDL_TEXTINPUT we should probably set another initial
responder that handles the Escape behavior, so that SDL_TEXTINPUT doesn't change
fullscreen behavior (and possibly other behavior) like it does now.
2014-01-29 18:37:23 -08:00
dbrady
99745583e9 fixed hat code validation. 2014-01-28 15:28:20 -08:00
Philipp Wiesemann
9cc268018e Fixed spaces in source file license comment. 2014-01-29 00:29:14 +01:00
Philipp Wiesemann
6303c03038 Fixed comments in joystick implementation files claiming to be headers.
It seems comments were originally copied from SDL_sysjoystick.h.
2014-01-29 00:27:54 +01:00
Gabriel Jacobo
b4b85ca976 [Wayland] Fixes segfault when mouse enters window 2014-01-28 11:39:37 -03:00
Jørgen P. Tjernø
9111603fa6 X11: Don't redraw dialog box when mouse moves.
This fixes bug #2343. (https://bugzilla.libsdl.org/show_bug.cgi?id=2343)

Thanks to Melker Narikka for the patch.
2014-01-27 13:43:04 -08:00
Ryan C. Gordon
838a451cc7 Patched to compile...uh, everywhere. :) 2014-01-27 16:13:13 -05:00
Ryan C. Gordon
d0ebb0069a Patched to compile on Windows when not supporting Direct3D. 2014-01-27 16:10:15 -05:00
Gabriel Jacobo
3ef0d0add4 [Android] Fixes Bug 2370, don't send accelerometer changes when
Android_JNI_GetAccelerometerValues return SDL_FALSE (thanks to Jairo Luiz)
2014-01-27 17:59:19 -03:00
Gabriel Jacobo
7d608b46c4 Bug 2358 - [Android] Joystick Button Mappings are strange (fix by David Brady) 2014-01-23 08:44:25 -03:00
Ryan C. Gordon
05c0fb18a6 Fix detection of iOS for disabling dynamic API. 2014-01-22 12:39:34 -05:00
Gabriel Jacobo
a18005ede7 Fixes 2356, [Android] SDL_JoystickGetAttached does not function
Also fix a potential NULL pointer access in android/SDL_SYS_JoystickGetGUID
2014-01-21 18:20:12 -03:00
Gabriel Jacobo
17044ac9db Move Wayland driver above dummy, check for driver availability before creation 2014-01-20 20:25:43 -03:00
Ryan C. Gordon
aae22a730e Patched to compile if Wayland is disabled via SDL_config.h (thanks, Martin!).
Fixes Bugzilla #2351.
2014-01-20 12:53:44 -05:00
Sam Lantinga
1ae5a81b22 Make sure you clean up the associated renderer when destroying a window. 2014-01-18 11:47:03 -08:00
Gabriel Jacobo
5084a02e2b Fixes prototype declaration for wl_proxy_marshal_constructor [Wayland 1.4] 2014-01-16 15:02:41 -03:00
Gabriel Jacobo
45aadb2396 Fix to compile against the Wayland v1.4 headers 2014-01-16 11:33:39 -03:00
Jørgen P. Tjernø
cf3e2b51cc Don't minimize fullscreen windows when destroying them.
Previously, we'd minimize fullscreen windows (if
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS was set) during SDL_DestroyWindow if they
had keyboard focus, because we call SDL_SetKeyboardFocus(NULL) which yields a
OnWindowsFocusLost event.

Related to https://bugzilla.libsdl.org/show_bug.cgi?id=1840
2014-01-15 11:34:03 -08:00
Jørgen P. Tjernø
5de6ce1665 Mac: Don't give windows focus back when we're closing them.
Fixes bug #1840 (https://bugzilla.libsdl.org/show_bug.cgi?id=1840)
2014-01-15 11:31:56 -08:00
Jørgen P. Tjernø
dd8e5d8468 Allow switching between FS and desktop FS.
This should fix bug #2057 (https://bugzilla.libsdl.org/show_bug.cgi?id=2057)
2014-01-15 11:17:09 -08:00
Jørgen P. Tjernø
0fbedf0a52 Test: Add Shift-Enter to switch between FS and desktop FS. 2014-01-15 11:08:55 -08:00
Jørgen P. Tjernø
0cc44e6565 Tests: Refactor key modifier checking. 2014-01-15 10:40:14 -08:00
Jørgen P. Tjernø
ab93ed077d Mac: Trigger SDL_FINGERUP for all touches.
Fixes bug #2348. Thanks to Alex Szpakowski for the patch!
2014-01-14 17:33:24 -08:00
Gabriel Jacobo
a5c13afc78 Make EGL loading more resilient.
Lesson learned while trying to run L4D2 under Wayland :)
2014-01-14 21:29:38 -03:00
Gabriel Jacobo
7396953eb6 Dynamic loading support for Wayland 2014-01-09 13:56:21 -03:00
Edward Rudd
5cb6bf79c2 define a font-size for the "unicode" message box font so the text isn't unreadable on linux systems 2014-01-08 14:53:08 -05:00
Ryan C. Gordon
d93d8b9275 Maybe fix Cygwin. 2014-01-08 01:07:57 -05:00
Ryan C. Gordon
0e22c5574b Patched to compile on Cygwin. 2014-01-08 00:58:03 -05:00
Ryan C. Gordon
f09890ba84 Another Android fix. 2014-01-08 00:51:31 -05:00
Ryan C. Gordon
f0aa433525 Updated Dynamic API jumptable. 2014-01-08 00:46:39 -05:00
Ryan C. Gordon
46a0b527dc Patched to compile on Android (I think). 2014-01-08 00:40:48 -05:00
Ryan C. Gordon
a2e609694d Patched to compile on OpenBSD. 2014-01-08 00:31:19 -05:00
Ryan C. Gordon
3dfc14ade2 Implemented the Dynamic API magic. 2013-12-09 16:03:18 -05:00
Ryan C. Gordon
03d5719413 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.
2013-11-24 23:56:17 -05:00
Ryan C. Gordon
572834c79a Patched stdlib changes to compile on Windows. 2013-12-09 13:30:35 -05:00
Ryan C. Gordon
df9f367941 Added SDL_vsscanf(). 2013-11-24 23:35:38 -05:00
Ryan C. Gordon
19706b10e9 Moved atomic API implementation out of headers. 2013-11-24 21:04:51 -05:00
Sam Lantinga
9fd68ed188 Fixed display mode calculations for applications which are not DPI aware.
If your application wants to have access to the full resolution even when the system has DPI scaling enabled, call SetProcessDPIAware() before calling SDL_Init()

e.g.
	typedef BOOL (WINAPI *SetProcessDPIAware_t)(void);
	HMODULE hMod = LoadLibrary("user32.dll");
	if ( hMod ) {
		SetProcessDPIAware_t pSetProcessDPIAware = GetProcAddress( hMod, "SetProcessDPIAware" );
		if ( pSetProcessDPIAware ) {
			pSetProcessDPIAware();
		}
		FreeLibrary( hMod );
	}
2013-12-30 12:49:15 -08:00
Sam Lantinga
942d949ae2 Switch back to apartment threaded COM initialization, which was the previous default.
We do succeed now if the application previously initialized COM in multi-threaded mode.
2013-12-27 10:18:19 -08:00
Sam Lantinga
ba4526a713 Make sure our window has mouse focus before processing raw input events.
This happens rarely, but not reproducibly, where we get raw input events for the window even though it doesn't have focus.
2013-12-27 10:18:18 -08:00
Sam Lantinga
eff7d88566 Bump SDL to build with 10.7 SDK.
This also bumps the minimum requirement for building SDL to 10.7, and
removes some checking we no longer need.

CR: saml
2013-12-27 10:18:11 -08:00
Gabriel Jacobo
08ed2e33eb Implements touch support on QTWayland. Contributed by Thomas Perl. 2013-12-27 09:29:39 -03:00
Philipp Wiesemann
c5691d9d83 Changed return -1 after SDL_SetError() to return SDL_SetError(). 2013-12-25 17:02:15 +01:00
Philipp Wiesemann
0006677531 Fixed pointer from integer warning and bug if compiled without EGL. 2013-12-25 16:57:59 +01:00
Philipp Wiesemann
2312c0b887 Fixed unused local variable warning in joystick source for Android. 2013-12-24 20:00:58 +01:00
Philipp Wiesemann
a5793c1d5c Fixed implicit declaration of SDL_Log() warning in joystick source for Android. 2013-12-24 19:59:35 +01:00