src/video/windows


Log

Author Commit Date CI Message
Sam Lantinga d44f3922 2014-07-07T10:33:32 Fixed bug 2629 - Mac: crash when calling SDL_DestroyWindow with an active OpenGL context Alex Szpakowski Since this commit https://hg.libsdl.org/SDL/rev/59b543340d63 , calling SDL_DestroyWindow will crash the program if the window has an active OpenGL context. This is because the Cocoa_DestroyWindow code sets the window's driverdata to NULL and then calls [context setWindow:NULL], which tries to access the window's driverdata, resulting in a null pointer dereference. I have attached a patch which fixes the issue by moving the line which sets the driverdata to NULL to after the lines which call functions that use the driverdata pointer.
Sam Lantinga 1ee96bb9 2014-07-07T10:26:28 Fixed mingw64 build and warnings
Ryan C. Gordon 95864f86 2014-06-25T17:24:06 Patched to compile on Windows.
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()
Ryan C. Gordon 84369567 2014-06-25T16:16:55 Changed SDL_GetAbsoluteMouseState() to SDL_GetGlobalMouseState(). This matches naming conventions in the main repository, between SDL_GetRelativeMouseState() and SDL_WarpMouseGlobal().
Sam Lantinga 67e55655 2014-06-23T10:09:15 Fixed grab interaction with Windows Classic theme Testing: * For each theme in Windows 7, Windows 7 Basic, and Windows 7 Classic: - Ran testsprite2 - Pressed Ctrl-G to grab the mouse - Alt-tabbed away, verified mouse is no longer grabbed - Alt-tabbed back, verified that mouse was grabbed - Alt-tabbed away - Clicked in the window, verified mouse was grabbed - Alt-tabbed away - Grabbed the title bar and dragged the window around successfully, verified that mouse was grabbed when move modal loop completed - Alt-tabbed away - Clicked the minimize button on the title bar, the window was successfully minimized - Clicked on the icon in the task bar, the window was restored and the mouse grabbed again - Alt-tabbed away - Clicked the close button on the title bar, the window was successfully closed
Sam Lantinga 9e2a2639 2014-06-23T10:09:13 Added names for some theme related windows messages
Sam Lantinga cff9eac6 2014-06-22T09:48:46 Fixed bug 2579 - SDL fails to compile on Windows when only EGL+OpenGL ES defined callow.mark Compiling with SDL_VIDEO_RENDER_OGL=0, SDL_VIDEO_OPENGL=0, SDL_VIDEO_OPENGL_WGL=0, SDL_VIDEO_RENDER_OGL_ES2=1, SDL_VIDEO_OPENGL_ES2=1 and SDL_VIDEO_OPENGL_EGL=1 set in SDL_config_windows.h fails. A patch is attached. See bug #2570 for reasons you might want to compile this way.
Sam Lantinga b7b6d8ab 2014-06-22T02:30:36 Fixed crash initializing OpenGL ES renderer if OpenGL renderer fails
Ryan C. Gordon 4676705d 2014-06-11T00:12:19 Implement Windows GetAbsoluteMouseState().
Ryan C. Gordon c8c55a01 2014-06-11T00:12:06 This should probably query async button state.
Ryan C. Gordon c8cf407e 2014-06-05T00:54:43 Wired up Windows resize hit testing.
Sam Lantinga 707fd9f0 2014-06-04T10:56:30 Fixed bug where changing the window border would change the window size on Windows.
Sam Lantinga 45ed5ee4 2014-06-04T10:55:26 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
Sam Lantinga 3e3b34ad 2014-06-04T10:52:34 Added a hint to disable windows message processing in SDL_PumpEvents() SDL_SetHint( SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, "0" );
Sam Lantinga 0d1f0fed 2014-06-04T10:50:32 Added a hint to disable window frame and title bar interaction when the cursor is hidden
Sam Lantinga 75c57f8d 2014-06-02T08:58:07 Don't use D3D9Ex by default, since it can change behavior for games which rely on D3D9 classic.
Sam Lantinga 9d00f75a 2014-05-31T14:03:04 Fixed bug 2520 - Held double-click app startup creates a stuck MOUSEBUTTONDOWN event snake5creator When starting application with the usual "double click on file" method on Windows, only holding the last click, an unnecessary MOUSEBUTTONDOWN event is sent before the initial MOUSEMOTION event, and mouse button state is stuck in the sense that it takes a subsequent button release, followed by another press for the system to resume sending events (beginning with the next button release / MOUSEBUTTONUP event). Input event log with held double-click startup: http://i.imgur.com/nypGKR2.png Without: http://i.imgur.com/yaIqAvV.png
Sam Lantinga 70df9cd0 2014-05-31T12:21:55 Fullscreen to windowed mode switch From Melesie I noticed that when user switches from fullscreen mode to windowed mode and exits application while in windowed mode, Windows performs an additional change of display settings, even though desktop resolution is the same as current one. This causes short black screen to show up. The only way I know of avoiding this is to explicitly switch to default display settings found in registry. MSDN documentation for ChangeDisplaySettingsEx states: Passing NULL for the lpDevMode parameter and 0 for the dwFlags parameter is the easiest way to return to the default mode after a dynamic mode change.
Sam Lantinga 18c31dec 2014-05-31T11:53:19 Fixed Direct3DCreate9Ex prototype
Sam Lantinga 0c6b99d5 2014-05-31T11:48:52 Fixed cast
Sam Lantinga 49c53fd2 2014-05-31T11:37:12 Use D3D9Ex when available This hopefully works around crashes in Intel D3D9 support in Windows 8.1.
Ryan C. Gordon bb7a27fa 2014-05-30T01:51:13 Fixed up SDL_CaptureMouse() on Windows to work like I expected. This would have been a one-line patch to the documentation (specifying that captures only work as long as the left mouse button is pressed), but I didn't like that, so I got a little crazy about this instead.
Ryan C. Gordon bcc2cc87 2014-05-30T01:49:26 Fixed hit-testing on Windows. Needed to convert from screen to client coords.
Ryan C. Gordon 89ad7934 2014-05-29T13:39:02 First shot (not even compiled) at Windows hit-testing support.
Ryan C. Gordon b7d2c0e9 2014-05-24T01:30:37 Implemented SDL_CaptureMouse().
Philipp Wiesemann 9bc47465 2014-05-18T21:11:30 Changed C++ style comments.
Ryan C. Gordon 2a7aa9bd 2014-05-06T00:13:07 Fix build on Windows targets without dxgi.h, like MingW32.
Sam Lantinga 45dc89c2 2014-04-23T13:48:01 Fixed detecting output on second adapter CR: Sam Lantinga
Sam Lantinga 3e3570df 2014-04-23T13:47:57 Don't crash in WIN_GL_InitExtensions() if the OpenGL library couldn't be loaded
Sam Lantinga af395e97 2014-04-23T13:47:35 Removed possible implicit memset()
Sam Lantinga d2ea7cfe 2014-04-18T12:43:10 Fixed logic error loading DXGI
Sam Lantinga 03afd0de 2014-04-18T12:43:04 SDL_DXGIGetOutputInfo() checks input parameters and returns a boolean value whether or not it succeeded.
Sam Lantinga 6dd9ea8d 2014-04-17T21:00:25 Fixed bug 2496 - mouse left button double click event issue cplu When I double click on a window, the "clicks" field (newly added since 2.0.2) in SDL_MouseButtonEvent is 1 instead of 2. However, when I "tripple" click, "clicks" field is then 2. I'v look into the source code in SDL_windowsevents.c and found that when a double click event comes, WIN_WindowProc will get a WM_LBUTTONDBLCLK msg. The message sequence of a double click is:WM_LBUTTONDOWN->WM_LBUTTONUP->WM_LBUTTONDBLCLK->WM_LBUTTONUP.
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.
Sam Lantinga 56b40ce0 2014-03-15T16:32:45 Fixed bug 2450 - Crosscompiling for Win32 with MinGW fails due to WM_UNICHAR undeclared
Sam Lantinga f9a58968 2014-03-13T21:21:26 Added missing copyright notices
Sam Lantinga b677d1d8 2014-03-10T19:59:06 Fixed Mac OS X OpenGL context creation to match other backends, where we only care about the actual version we request if it's 3.0 or newer or a special profile context. Eventually we'll probably move the version checking to higher level code and report the actual version of context that got created, but to avoid breakage we'll leave it like this for now.
Ryan C. Gordon db568d69 2014-03-09T11:52:52 Patched to compile with MingW64 on case-sensitive systems (thanks, Martin!). Fixes Bugzilla #2440.
Sam Lantinga 54ba385b 2014-03-01T11:42:12 Fixed compiler warning
Sam Lantinga 86655b64 2014-03-01T11:40:41 Fixed compiler warning
Sam Lantinga c916f388 2014-03-01T09:59:06 Fixed bug 2368 - Security Software is blocking RegisterRawInputDevices() Yamagi A customer of mine had the strange problem, that SDL_SetRelativeMouseMode() was failing for him on Windows 7. Luckily he was willing to provide some debug informations. We could track this problem down to RegisterRawInputDevices() failing due to security software running on his system (Norton Internet Security to be precise, but there are reports of similar problems with other products. For example [1]). Working around this issue with SDL_WarpMouseInWindow() is easy, and while I don't think that SDL2 can provide an internal workaround it would be really nice and helpfull if this could be documentated somewhere. 1: http://forums.codeguru.com/showthread.php?498374-How-to-run-a-very-long-SQL-statement
Sam Lantinga b420ad0e 2014-02-24T23:09:35 Don't warp the mouse while we're doing a modal interaction
Sam Lantinga 2a6213ad 2014-02-24T22:49:30 Make sure we don't clip the cursor while clicking on the window title bar
Sam Lantinga 973d890b 2014-02-24T22:37:58 Fixed relative mouse mode with multiple windows. The window cursor clipping will be taken care of when SDL_UpdateWindowGrab() is called.
Sam Lantinga 54debf84 2014-02-24T22:36:24 Added a bunch of missing windows messages
Sam Lantinga b80f4f9e 2014-02-22T17:39:35 Don't fail initialization if the helper window class already exists.
Sam Lantinga 5c5770ad 2014-02-14T11:39:58 Make sure we don't stay in the windows event loop forever if there are lots of events coming in quickly.
Sam Lantinga c52c9105 2014-02-13T11:05:30 Added SDL_DXGIGetOutputInfo which returns the adapter and output indices that are used to create DX10 and DX11 devices and swap chains on a particular display. CR: SamL
Sam Lantinga e34da680 2014-02-13T11:05:28 Fixed lost mouse button when in relative mouse warp mode and you click on the title bar, entering a modal move/resize loop. Testing: * Set the SDL_HINT_MOUSE_RELATIVE_MODE_WARP hint true, run testsprite2, press Ctrl-R to enter relative mode, alt tab away from the window, then click on the title bar of the window. Didn't get the mouse button release before, and we do now. CR: Yahn + Alfred
Sam Lantinga a396841f 2014-02-10T10:02:18 Fixed bug where a window created fullscreen and hidden would get activated and "shown" but never actually be visible. This is the case with the Steam In-Home Streaming client.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Sam Lantinga d76c2cc1 2014-01-30T12:30:40 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
Sam Lantinga dbd4a917 2014-01-30T12:27:24 Document Michael's changes adding TranslateMessage() back to the SDL message loop.
Sam Lantinga 5c58bd68 2014-01-30T12:27:00 * 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.
Sam Lantinga b44e7470 2013-12-30T12:49:15 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 ); }
Sam Lantinga 6f6c76a6 2013-12-27T10:18:18 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.
Philipp Wiesemann 87ad7a1c 2013-12-25T16:57:59 Fixed pointer from integer warning and bug if compiled without EGL.
Sam Lantinga 2521e497 2013-12-23T17:55:06 Setting the mouse in relative mode implies grabbing the mouse. This fixes getting mouse button events in raw input relative mode on X11.
Sam Lantinga 7aef2350 2013-12-23T17:37:22 Added a relative mouse mode that uses mouse warping instead of raw input. To enable this, set the environment variable SDL_MOUSE_RELATIVE_MODE_WARP to "1" When mouse relative mode is disabled, put the cursor back where the application expects it to be, instead of where it was when relative mode was enabled.
Sam Lantinga 74692835 2013-12-23T12:17:52 Added support for double-clicks, through a new "clicks" field in the mouse button event.
Sam Lantinga 7afb7682 2013-12-05T09:29:04 Added code missed in the resolve
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Sam Lantinga 9fa4da13 2013-11-28T02:31:32 Fixed windows build with conflict resolve
Sam Lantinga d2511d9e 2013-11-27T10:29:38 Fixed bug 2260 - SDL_SetCursorGrab() is buggy on Windows BurnSpamAddress Steps to reproduce: 1. Grab the cursor with SDL_SetCursorGrab() 2. Alt-tab away from the window 3. Click on the titlebar of the window This will cause the window to disappear underneath the taskbar! This appears to be a general issue with ClipCursor() on windows, i.e. I am getting the same behavior if I call ClipCursor() directly. It is caused by a feedback loop between the ClipCursor function and the modal resize/move event loop that handles mouse-based sizing on Windows.
Sam Lantinga fa4e4a64 2013-11-27T10:29:32 Fixed large relative mouse motion when iconifying the SDL window. Windows will move the window to -32000,-32000 when it is iconified, so we don't want to send mouse motion for iconic windows.
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.
Philipp Wiesemann 01acbd38 2013-11-23T18:34:27 Fixed spaces in license comment.
Gabriel Jacobo 4abeed93 2013-11-22T14:19:52 Fixes compilation on Mingw.
Gabriel Jacobo 61959aa6 2013-11-22T13:24:53 OpenGL ES support for Windows
Gabriel Jacobo 5b8b403e 2013-11-13T11:18:37 [Windows] Fixes bug #1555, handle ALT+F4 on Windows
Sam Lantinga e19f15dd 2013-11-10T14:10:00 Fixed bug 2067 - Window size limit calculation issue when exiting fullscreen on Windows Also fixed minimize and maximize state detection for Windows.
Sam Lantinga 976c8769 2013-11-08T14:05:23 Fixed bug 2172 - Window loses maximized state when activated I still haven't figured out why my application is being minimized when I try to raise, it but my previous workaround is causing issues. For now the correct way to raise and/or restore the window is as follows: if ( !(SDL_GetWindowFlags( window ) & SDL_WINDOW_MINIMIZED) ) { SDL_RaiseWindow( window ); } if ( SDL_GetWindowFlags( window ) & SDL_WINDOW_MINIMIZED ) { SDL_RestoreWindow( window ); } I will investigate the window state change rules more fully in the future. CR: Alfred Reynolds
Sam Lantinga 48e44f7f 2013-11-06T23:59:24 Fixed Windows compile error
Sam Lantinga 3b050fc9 2013-11-06T23:35:08 Horizontal wheel support in windows Lorenzo Pistone this patch adds support for the horizontal wheel in Windows. It is shamelessly copied off the vertical wheel code, but I guess that that is a value added in consistency.
Sam Lantinga b8b9bfbe 2013-10-21T01:16:16 Fixed some warnings building for 64-bit Windows
Sam Lantinga 360c3d85 2013-10-21T00:15:24 Better cleanup if OpenGL initialization fails
Ryan C. Gordon 0e699eb5 2013-10-20T21:18:05 Added SDL_GL_FRAMEBUFFER_SRGB_CAPABLE (thanks, David!). Fixes Bugzilla #1985.
Sam Lantinga 888d807a 2013-10-17T23:05:40 Removed redundant #ifdef
Sam Lantinga 12ca3ce3 2013-10-17T23:02:29 Fixed building using MinGW Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
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 4b603abf 2013-10-14T08:56:55 For some reason, trying to raise the window programmatically while it's alt-tabbed away will minimize it. Added a workaround for this.
Sam Lantinga fea2699c 2013-10-14T08:56:50 Fixed the windows message debug output so it works without HAVE_LIBC
Sam Lantinga 8ec3ba38 2013-10-13T19:59:40 Fixed accumulating mouse wheel motion for the Microsoft Wireless Mouse 5000
Sam Lantinga 8fbd7dc7 2013-10-03T00:54:58 Fixed bug 2130 - Two members of Windows WindowData not initialized norfanin SetupWindowData in SDL_windowswindow.c doesn't initialize two members of SDL_WindowData with NULL. This is an issue because other parts of the SDL code seem to make the assumption that this is the case. WIN_DestroyWindowFramebuffer for example uses data->mdc and data->hbm if they're not NULL.
Sam Lantinga 9f390e79 2013-09-28T14:06:59 Moved SDL_Direct3D9GetAdapterIndex() to SDL_windowsvideo.c since it doesn't belong in the window code.
Sam Lantinga b6be1435 2013-09-28T14:06:20 Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support. Added a reference to SDL_Direct3D9GetAdapterIndex to SDL_test_common.c so SDL will fail to compile if the new symbol isn't included properly. CR: Jorgen
Sam Lantinga e07d7e64 2013-08-29T08:30:21 Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)).
Sam Lantinga f79fc33a 2013-08-29T08:29:21 Christoph Mallon: Remove pointless if (x) before SDL_free(x)
Gabriel Jacobo 1e49b1ed 2013-08-21T09:47:10 OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo 695344d1 2013-08-21T09:43:09 OCD fixes: Adds a space before */
Gabriel Jacobo 552b04c5 2013-08-20T20:34:40 More non C89 compliant comments
Sam Lantinga 9ab14aa5 2013-08-16T17:50:44 Fixed windows build
Sam Lantinga ff77ca8d 2013-08-16T15:38:06 The keyboard text events should be sent after the key down events
Sam Lantinga b4b12d95 2013-08-16T15:35:10 Fixed bug 1876 - SDL_TEXTINPUT only returns '?' (0x3F) in event.text.text with Khmer language input Andreas The issue comes down to this line on MSDN: "TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the keyboard driver." "WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message. WM_SYSKEYDOWN and WM_SYSKEYUP combinations produce a WM_SYSCHAR or WM_SYSDEADCHAR message." Except for WM_CHAR, none of these messages are used in SDL. Hence TranslateMessage should be dropped entirely and proper handling be included in the WM_KEYDOWN event. Currently TranslateMessage is called for every message even if it must not be called in certain cases (like "An application should not call TranslateMessage if the TranslateAccelerator function returns a nonzero value."). WM_CHAR message handling should remain for external processes posting these messages - additionally, WM_UNICHAR should be added. I made a patch for src/video/windows/SDL_windowsevents.c that seems to work fine. It doesn't solve the "missing" composition for Khmer, but at least input for languages that cannot be mapped to ASCII characters (and for which IME is not used) will now work on Windows.
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