src/video/windows/SDL_windowswindow.c


Log

Author Commit Date CI Message
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Ryan C. Gordon 389ffab7 2022-11-16T12:53:48 Code style fixes, etc. Reference PR #6345.
ulatekh ec58a817 2022-10-05T19:26:09 Fixes made in response to running a static code analyzer under MS Windows. Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs. SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision. SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer. SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used. SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range. SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it. SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691). SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen. SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL. SDL_pixels.c: Looks like the switch is genuinely missing a break! SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons. SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
Ryan C. Gordon c8d20f96 2022-10-25T23:13:34 shape: Free platform-specific shaped window data. Fixes #2128.
xeonmc 228b9fb5 2022-09-14T03:43:16 Update SDL_windowswindow.c (#6225) Clip rectangle set to int(left+width/2) , int(top+height/2) , int(left+width/2)+1 , int(top+height/2)+1 a 1x1 box On even-valued resolution, cursor is stable at bottom-right central pixel On odd-valued resolution, cursor is stable at exact central pixel. this is the desired behaviour
Noel Berry 00452e47 2022-08-24T11:25:13 Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
Sam Lantinga be0cf257 2022-08-12T18:13:42 Only force the resize event in the DPI changed case OpenGL windows don't actually get the WM_WINDOWPOSCHANGED event in the SetWindowPos() call in WIN_SetWindowFullscreen(), so setting the window size to zero never gets reset and we're stuck with a zero sized window. Instead, just force the resize event in WM_DPICHANGED handling, where we know we need it. If we end up needing to force it in WIN_SetWindowFullscreen(), just set a flag in the window data and respond to that in WM_WINDOWPOSCHANGED, but that's a fairly risky behavior change as suddenly all applications would start getting SDL_WINDOWEVENT_SIZE_CHANGED when going fullscreen, and they may respond to that in expensive and potentially disruptive ways. For later we'll probably create a DPI changed event and respond to that in the renderer instead of this window size changed hack. This fixes https://github.com/libsdl-org/SDL/issues/6033 @ericwa
Sam Lantinga 602b7dd0 2022-08-01T17:47:26 Made the window ICMProfile filename per-window The event no longer spams each time a window gets focus if there are windows on monitors with different color profiles. This also has the side effect that you no longer get a color profile event at window creation, which is consistent with other events that communicate state changes.
Sam Lantinga 4d8bb89c 2022-07-24T11:50:14 Fixed mouse clip rect bounds on Windows Fixes https://github.com/libsdl-org/SDL/issues/5946
chalonverse f317d619 2022-07-01T13:59:14 Xbox GDKX support (#5869) * Xbox GDK support (14 squashed commits) * Added basic keyboard testing * Update readme * Code review fixes * Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
Ozkan Sezer 714502d3 2022-06-13T22:15:56 minor windows warning fixes.
Eric Wasylishen ab81a559 2022-06-07T02:01:27 Windows DPI scaling/highdpi support Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to change the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. This means windows will be appropriately sized, even when created on high-DPI displays with scaling. e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, will create a window with an 800x600 client area (in pixels). Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
Eric Wasylishen d3b970d4 2022-05-29T21:56:37 HighDPI: remove SWP_NOSIZE in WIN_SetWindowPosition If the move results in a DPI change, we need to allow the window to resize (e.g. AdjustWindowRectExForDpi frame sizes are different). - WM_DPICHANGED: Don't assume WM_GETDPISCALEDSIZE is always called for PMv2 awareness - it's only called during interactive dragging. - WIN_AdjustWindowRectWithStyle: always calculate final window size including frame based on the destination rect, not based on the current window DPI. - Update wmmsg.h to include WM_GETDPISCALEDSIZE (for WMMSG_DEBUG) - WIN_AdjustWindowRectWithStyle: add optional logging - WM_GETMINMAXINFO: add optional HIGHDPI_DEBUG logging - WM_DPICHANGED: fix potentially clobbering data->expected_resize Together these changes fix the following scenario: - launch testwm2 with the SDL_WINDOWS_DPI_AWARENESS=permonitorv2 environment variable - Windows 10 21H2 (OS Build 19044.1706) - Left (primary) monitor: 3840x2160, 125% scaling - Right (secondary) monitor: 2560x1440, 100% scaling - Alt+Enter, Alt+Enter (to enter + leave desktop fullscreen), Alt+Right (to move window to right monitor). Ensure the window client area stays 640x480. Drag the window back to the 125% monitor, ensure client area stays 640x480.
Eric Wasylishen 51ebefee 2022-02-28T00:43:43 Support PMv2 DPI awareness, add SDL_HINT_WINDOWS_DPI_AWARENESS The hint allows setting a specific DPI awareness ("unaware", "system", "permonitor", "permonitorv2"). This is the first part of High-DPI support on Windows ( https://github.com/libsdl-org/SDL/issues/2119 ). It doesn't implement a virtualized SDL coordinate system, which will be addressed in a later commit. (This hint could be useful for SDL apps that want 1 SDL unit = 1 pixel, though.) Detecting and behaving correctly under per-monitor V2 (calling AdjustWindowRectExForDpi where needed) should fix the following issues: https://github.com/libsdl-org/SDL/issues/3286 https://github.com/libsdl-org/SDL/issues/4712
Simon McVittie 412ceb84 2022-05-24T16:27:54 video: Only check major version in SDL_GetWindowWMInfo Since #5602, SDL is intended to have the same ABI across the whole major-version 2 cycle, so we should not check that the minor version matches the one that was used to compile an application. There are two checks that could make sense here. The first check is that the major version matches the expected major version. This is usually unnecessary and is not usually done (if we're calling into the wrong library we'll likely crash anyway), but since we have the information, we might as well continue to use it. The second check is whether the version provided by the caller is equal to or greater than a threshold version at which additional fields were added to the struct. If it is, we should populate those fields; if it is not, then we cannot. This is only useful on platforms where additional fields have genuinely been added during the lifetime of SDL 2, like Windows and DirectFB (but not X11). This commit changes the first check to be consistent about only looking at the minor version, while leaving the second check using SDL_VERSIONNUM (which will be removed or widened in SDL 3, but it's fine for now). Resolves: https://github.com/libsdl-org/SDL/issues/5711 Fixes: cd7c2f1 "Switch versioning scheme to be the same as GLib and Flatpak" Signed-off-by: Simon McVittie <smcv@collabora.com>
Sam Lantinga 9919d1a7 2022-04-18T11:51:09 Remove HWND_TOPMOST for fullscreen windows Fixes https://github.com/libsdl-org/SDL/issues/5509
Sam Lantinga 268c2fa8 2022-04-05T18:42:17 Don't resize fullscreen windows when hiding or minimizing them (thanks @madewokherd!) This has the benefit of window previews (mousing over the icon) having the correct size and contents. Fixes https://github.com/libsdl-org/SDL/issues/5320
Sam Lantinga 6c962177 2022-03-18T10:07:59 Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, controlling whether the mouse should be constrained to the center of the window or the whole window in relative mode. For further info about the pros and cons, check out the discussion in https://github.com/libsdl-org/SDL/issues/5271
Sam Lantinga d4062785 2022-03-17T17:01:36 Try not forcing activation when grabbing the mouse in fullscreen windows
Sam Lantinga 4e784fce 2022-03-17T16:57:33 When updating grab state, only activate windows that are grabbed, fullscreen, and shown. Fixes https://github.com/libsdl-org/SDL/issues/5371
Sam Lantinga e5f45455 2022-03-17T14:44:34 Added a hint to mark a foreign window as usable with OpenGL Fixes https://github.com/libsdl-org/SDL/issues/2942
Zach Reedy 363c3678 2022-03-10T17:12:33 Fixed: Incorrect assumption that mouse button is released when window is allocated
Jo Bates 01d38e7a 2022-03-09T14:03:52 Make Win32 fullscreen and borderless windows minimizable
pionere 014e2bbd 2022-01-12T16:40:52 use SDL_COMPILE_TIME_ASSERT instead of SDL_STATIC_ASSERT
pionere 942b01a5 2022-01-09T15:08:21 do not use RWOps in WIN_SetWindowIcon
ulatekh 57bc9040 2022-01-07T08:54:08 Add hint to optionally forcibly raise the window under MS Windows.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sam Lantinga 67c42cb4 2021-11-08T22:16:01 Fixed Windows build
Sam Lantinga fd79607e 2021-11-08T21:34:48 Added SDL_GetWindowMouseRect() Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
Sam Lantinga 4db546b0 2021-11-08T20:35:12 Implemented SDL_SetWindowMouseRect() on macOS
Sam Lantinga 2d23d66a 2021-11-08T16:33:50 Fixed SetWindowMouseRect return value on Windows
Sam Lantinga 7d21322d 2021-11-08T16:29:19 Implemented SDL_SetWindowMouseRect() on Windows
Cacodemon345 19dee1cd 2021-10-22T06:37:20 Add SDL_GetWindowICCProfile(). (#4314) * Add SDL_GetWindowICCProfile * Add new SDL display events * Implement ICC profile change event for macOS * Implement ICC profile notification for Windows * Fix SDL_GetWindowICCProfile() for X11 * Fix compile errors
Sam Lantinga a1fabca1 2021-10-14T16:52:21 Removed mouse warping for local mice and improved warp handling for mouse over RDP
Sam Lantinga 5e89b3c8 2021-10-14T11:46:07 Don't need to use raw input to track the mouse during mouse capture (thanks Brick!)
Rémy Tassoux 0789610c 2021-10-14T00:52:05 Add SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN
Sam Lantinga 632aca29 2021-10-01T16:17:38 Window input focus is based on WM_SETFOCUS and WM_KILLFOCUS as WM_ACTIVATE doesn't necessarily imply focus. Hopefully resolves https://github.com/libsdl-org/SDL/issues/4450 and https://github.com/libsdl-org/SDL/pull/4293
Henry G. Stratmann III 712e0d1f 2021-08-07T16:23:15 Fixing WM_CHAR event handling for Unicode characters outside the Basic Multilingual Plane.
Sam Lantinga f1633127 2021-07-24T13:41:55 Added a window flash operation to be explicit about window flash behavior
Sam Lantinga e1c3a250 2021-07-24T12:11:27 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
Dean Herbert 4359a47b 2021-04-02T12:48:16 Simplify ClipCursor behaviour when RelativeMouseMode is enabled The implementation of clip logic for relative mode seemed to unnecessarily limit the usable area to the middle of the window, in a 2x2 pixel region. This has the adverse side effect of moving the operating system cursor to that location, even if it is in a valid location in the window. While in most scenarios this is handled correctly (by storing the original position of the cursor in the window and restoring when leaving relative mode), there are edge cases where this clip operation can cause WM_MOUSEMOVE to fire at a point in time where it counts as a relative delta from SDL's perspective.
Dean Herbert 3720e254 2021-04-02T12:48:02 Trim some stray whitespace
Jupeyy 64724db0 2021-06-04T19:55:30 Implement bare minimum for SDL_FlashWindow
Joseph Lyncheski a0a5da5d 2021-04-19T07:13:38 Add SDL_SetWindowAlwaysOnTop()
Cameron Gutman a78bce9e 2021-01-28T20:02:01 Properly handle keys already down when the hook is installed For keys that are already down when we install the keyboard hook, we need to allow the WM_KEYUP/WM_SYSKEYUP message to be processed normally. This ensures that other applications see the key up, which prevents the key from being stuck down from the perspective of other apps when our grab is released.
Cameron Gutman 6b057c67 2021-01-26T19:16:17 Expose separate keyboard and mouse grab support This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(), SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise this functionality and makes a minor fix to X11 that I missed in https://hg.libsdl.org/SDL/rev/02a2d609369b To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards compatibility with older code.
Cameron Gutman a0d3c6c6 2021-01-25T21:42:14 Rename SetWindowGrab() to SetWindowMouseGrab()
Cameron Gutman e1f73e64 2021-01-23T16:22:44 Refactor keyboard grab to be managed by the video core This gives us flexibility to add others hints to control keyboard grab behavior without having to touch all of the backends. It also allows us to possibly expose keyboard grab separately from mouse grab for applications that want to manage those independently.
Cameron Gutman 8c921d82 2021-01-22T19:40:26 Implement keyboard grab support for Windows This is implemented via a low-level keyboard hook. Unfortunately, this is rather invasive, but it's how Microsoft recommends that it be done [0]. We want to do as little as possible in the hook, so we only intercept a few crucial modifier keys there, while leaving other keys to the normal event processing flow. We will only install this hook if SDL_HINT_GRAB_KEYBOARD=1, which is not the default. This will reduce any compatibility concerns to just the SDL applications that explicitly ask for this behavior. We also remove the hook when the grab is terminated to ensure that we're not unnecessarily staying involved in key event processing when it's not required anymore. [0]: https://docs.microsoft.com/en-us/windows/win32/dxtecharts/disabling-shortcut-keys-in-games
Ozkan Sezer 76295cec 2021-01-05T15:50:10 video/windows: ANSI/UNICODE updates (cf. bug 5435): - explicitly use UNICODE versions of DrawText, EnumDisplaySettings, EnumDisplayDevices, and CreateDC: the underlying structures have WCHAR strings. - change WIN_UpdateDisplayMode and WIN_GetDisplayMode() to accept LPCWSTR instead of LPCTSTR for the same reason. - change WIN_StringToUTF8 and WIN_UTF8ToString to the explicit 'W' versions where appropriate.
Ozkan Sezer 390fd14f 2021-01-04T01:23:50 SDL_windowswindow.c (SDL_HelperWindowCreate): adjust for ANSI/UNICODE: change SDL_HelperWindowClassName and SDL_HelperWindowName from WCHAR * to be const TCHAR* cf. bug #5435.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga cb361896 2020-12-09T07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
Sam Lantinga 50203d58 2020-12-08T22:00:06 Fixed bug 5329 - SDL_SetWindowGrab(SDL_FALSE) fails to unlock cursor if window is partially offscreen Ivan Mogilko With SDL 2.0.12 under MS Windows, if the window is partially offscreen calling SDL_SetWindowGrab(w, SDL_TRUE) works, but subsequent call to SDL_SetWindowGrab(w, SDL_FALSE) does not work. I tested this in both real program, and a small test app, where unlocking cursor worked perfectly while window is fully in desktop bounds, but did not work if it was at least few pixels outside. For the reference, following code is enough to reproduce the issue: #include <windows.h> #include <SDL.h> int WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { SDL_Init(SDL_INIT_VIDEO); SDL_Window* w = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 400, 0); bool grabbed = false; bool want_quit = false; while (!want_quit) { SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: want_quit = true; break; case SDL_KEYDOWN: if (event.key.keysym.scancode == SDL_SCANCODE_SPACE) { SDL_SetWindowGrab(w, static_cast<SDL_bool>(!grabbed)); grabbed = !grabbed; } } } } SDL_DestroyWindow(w); SDL_Quit(); return 0; }
Sam Lantinga a0c5bfa3 2020-11-27T13:08:40 Moved raw input event processing from the main thread to the joystick thread This allows fast joystick event delivery regardless of what the main thread is doing.
Sam Lantinga 44f50c64 2020-06-09T21:47:41 Fixed bug 5171 - PollEvent impacts performance in 2.0.12 On some systems, GetClipCursor() impacts performance when called frequently, so only call it every once in a while to make sure we haven't lost our capture.
Sam Lantinga 0721931f 2020-04-06T19:21:56 Avoid sending regular mouse messages for touch input
Sam Lantinga 4dea340c 2020-03-16T12:23:38 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows Jimb Esser Add new RawInput controller API, and improved correlation with XInput/WGI Reorder joystick init so drivers can ask the others if they handle a device reliably Do not poll disconnected XInput devices (major perf issue) Fix various cases where incorrect correlation could happen Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation Correlate by axis motion as well as button presses Fix failing to zero other trigger Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init() Add missing device to device names Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices Updated to SDL 2.0.13 code with the following notes: New HID driver: xbox360w - no idea what that is, hopefully urelated SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data. SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem. Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason. Something changed in how devices get names, so getting generic names. Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
Sam Lantinga e261bd42 2020-02-12T12:26:27 Improved fix for bug 4748 - Calling WIN_UpdateClipCursor() / WIN_UpdateClipCursorForWindows() on WIN_PumpEvents() causes beeping and choppy mouse cursor movement, right-click doesn't work
Sam Lantinga c31727c7 2020-02-11T10:08:22 Fixed bug 4748 - Calling WIN_UpdateClipCursor() / WIN_UpdateClipCursorForWindows() on WIN_PumpEvents() causes beeping and choppy mouse cursor movement, right-click doesn't work The problem here was calling ClipCursor() continuously in a tight loop. Fixed by only calling ClipCursor() if the clip area needs to be updated.
Sam Lantinga 668276fe 2020-02-11T09:41:55 Don't add a frame to borderless windows. It was done to allow hotkey resizing of borderless windows, but Windows will sometimes draw it, regardless of our WM_* message handling. See bug 4466 for more details.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Ryan C. Gordon 0beadea5 2019-06-26T01:29:01 windows: Call GetWindowText() with the correct parameters (thanks, Zebediah!) GetWindowText() wants you to tell it the size of the buffer--including the terminating NULL char--but we weren't counting that last char, losing the last char of the string in the process. This was only seen with the special case of SDL_CreateWindowFrom() to use an existing native window, not the usual SDL_CreateWindow() codepath. Fixes Bugzilla #4696.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon 62494a2e 2018-10-31T15:03:41 Merge SDL-ryan-batching-renderer branch to default.
Ryan C. Gordon b262b0eb 2018-10-22T20:50:32 Small stack allocations fall back to malloc if they're unexpectedly large.
Sam Lantinga 55b24b93 2018-09-26T11:17:43 Fixed bug 4265 - SDL window falls to the bottom of the screen when dragged down and stuck there Alexei On WM_WINDOWPOSCHANGED event, WIN_UpdateClipCursor() is called. SDL_WINDOW_INPUT_FOCUS is set even when the mouse pointer is not inside the SDL window and therefore ClipCursor(&rect) is called. When dragging the window and rect.bottom=800 (i.e. the bottom edge of the screen) the SDL window is clipped to the bottom of the screen and it is not possible to move it back to the center of the screen.
Sam Lantinga 15b3794f 2018-08-26T10:34:23 Only reset the clip rect if it's currently the rect we previously clipped. This prevents us from clearing the clip rect globally when another application has set it. There's also an experimental change to regularly update the clip rect for a window defensively, in case someone else has reset it. It works well, but I don't know if it's cheap enough to call as frequently as it would be called now, and might have other undesirable side effects. Also fixed whitespace and SDL coding style
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.
Ryan C. Gordon 862aa4b4 2018-07-22T19:28:27 windows: Fixed some Visual Studio warnings about shadowed variables. Fixes Bugzilla #4118.
Sam Lantinga 9d6ac3de 2018-06-05T12:46:09 Fix creating a minimized window in SDL to not cause focus to be stolen (because ShowWindow( hwnd, SW_MINIMIZE ) would be called after creation, thus changing focus to the prior window based on some per-app list in windows, rather than the window being created with WS_MINIMIZED to start with). This means we have to consider SDL_WINDOW_MINIMIZED a window creation flag, but on non-windows platforms we just remove it and let the normal FinishWindowCreation re-apply and do the minimize as I have no idea what is right on them or if anything should change. CR: Phil
Sam Lantinga 6a0ef0cd 2018-04-09T10:37:31 SDL: On Windows, have SDL_ShowWindow() not activate the window if the window has the WS_EX_NOACTIVATE window flag.
Sam Lantinga 2d7420f2 2018-01-25T11:12:20 Fixed bug 3985 - SDL_CreateWindow() has stopped changing screen mode when SDL_WINDOW_FULLSCREEN is used Anthony This worked in 2.0.5 as normal, but stopped working in 2.0.7. The monitor's resolution doesn't change, a window is created in full screen mode at the virtual desktop resolution instead.
Sam Lantinga 0cba6847 2018-01-15T10:29:53 Fixed bug 4043 - SDL_windowswindow.c incorrect icon height Needed to allocate space for the mask in the ICONIMAGE structure
Sam Lantinga a0c4eb2a 2018-01-10T18:00:51 Restored borderless window behavior where DOTA created a borderless window the size of the desktop and expected it to behave like a fullscreen desktop window. A future SDL release will change the borderless window to act more like a normal window that happens to have no chrome, to support windows that draw their own chrome. In the meantime, those applications should set the "SDL_BORDERLESS_WINDOWED_STYLE" hint.
Sam Lantinga 7c60bec4 2018-01-03T10:58:58 Fixed bug 4018 - Implement SDL_GetWindowBordersSize() under Windows/Win32/WinAPI Ismael Ferreras Morezuelas (Swyter) As a new year gift I have implemented the Windows version of SDL_GetWindowBordersSize(). I needed it for auto-selecting a cozy window size for the game I'm currently working on and noticed that it only worked under X11, so I thought it could be a good excuse to contribute back more stuff. The Mercurial patch is attached as a .diff file. Let me know what you think. Happy 2018 to all the SDL2 devs and users! -- PS: Keep in mind that Windows 10 includes the 8px invisible grip borders as part of the frame. There's a way of detecting if Aero/DWM is being used and ask only for the visible rect, but I believe that GetWindowRect() is doing that for a reason and working as intended, so I haven't changed it. (See [2]) References: [1]: http://www.firststeps.ru/mfc/winapi/r.php?72 [2]: https://stackoverflow.com/a/34143777/674685 [3]: https://stackoverflow.com/a/431548/674685 [4]: https://wiki.libsdl.org/SDL_GetWindowBordersSize
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 1bfe6d60 2017-10-06T21:43:59 Fixed restoring window size when coming out of fullscreen desktop mode. Use the style of the window as it will be, not as it currently is at the time of the AdjustWindowRect call.
Sam Lantinga 58d1c54d 2017-09-22T17:32:05 Fixed spacing
Sam Lantinga 499f928c 2017-09-22T07:15:41 borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
Sam Lantinga 3176a7f5 2017-09-22T07:11:36 sdl - Fixing rendering borderless window. Need to force windows to send a WM_NCCALCSIZE then return 0 for non-client area size. - Adding WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX to borderless windows, for reasons noted in comments. - Fix SetupWindowData() setting SDL_WINDOW_BORDERLESS. This was being cleared at window creation, causing hanlding for the first WM_NCCALCSIZE message to fail
Sam Lantinga fcd9c190 2017-09-09T09:31:12 Fixed window size when leaving fullscreen mode (thanks Eric!)
Sam Lantinga fa0eeff7 2017-09-06T07:29:34 sdl: Cleans up AdjustWindowEx calls
Sam Lantinga 20c5bc91 2017-09-06T05:23:26 You can have a borderless resizable window
Sam Lantinga 45cec28b 2017-08-12T16:44:00 Fixed bug 3058 - Slight mistake in GetWindowStyle in SDL_windowswindow.c Coriiander There's a slight mistake in the function "GetWindowStyle" found in file "SDL_windowswindow.c". When a window is marked to be resizable, the resizable style is being added regardless of whether the window has a border or not. While for some arcane, hidden semantics this can be ok, it's still inconsistent in this case.
Sam Lantinga 9085c7b3 2017-06-16T11:14:08 Get the parent of non-SDL-created windows, for completeness
Sam Lantinga 1b5614b3 2017-06-16T10:50:29 Clean up parent window when destroying a window
Sam Lantinga 0a75192d 2017-06-16T09:10:13 Implemented SDL_WINDOW_SKIP_TASKBAR on Windows
Joshua Granick 1286a7d2 2017-04-20T21:31:44 windows: Add SDL_WINDOW_ALWAYS_ON_TOP support.
Philipp Wiesemann 266816b4 2017-03-26T21:00:19 Removed newlines from error messages.
Sam Lantinga 95defd66 2017-01-17T21:18:31 Use icon width * sizeof(Uint32) instead of icon pitch when copying to icon resource data
Sam Lantinga a52d48c5 2017-01-10T08:54:33 Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11 Mark Callow The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile: - Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can say to use the OpenGL ES driver & EGL rather than the Open GL driver. (For bug #2570) - Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum OpenGL ES version supported by the OpenGL driver (for bug #3145) - Modifies the test that determines whether to use the OpenGL driver or the real OpenGL ES driver to take into account the hint, the requested and supported ES version and whether ES 1.X is being requested. (For bug #2570 & bug #3145) - Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds the test to the VisualC projects. With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 4a089ca1 2016-11-20T21:18:55 Fixed bug 3486 - Can't get HINSTANCE of my window realitix SDL2 allows to create widow and to get information through SDL_SysWMinfo. But it misses something, with Vulkan, you need the HWND and HINSTANCE of the window for Win32 system. Sadly, SDL2 provides only HWND but not HINSTANCE. In some context, it can be difficult to get the HINSTANCE, indeed, I'm using pySDL2 (Python) and I can only access properties that SDL2 gives me. I have to use a dirty trick like that to get the HINSTANCE: (https://raw.githubusercontent.com/bglgwyng/pyVulkan/master/examples/win32misc.py)
Philipp Wiesemann a49ac09c 2016-11-18T00:06:09 Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs.
Alex Szpakowski 8500de8f 2016-10-01T19:16:46 Fix tabs -> spaces
Alex Szpakowski f0539aa2 2016-10-01T19:12:58 Fix bug 3436 - SDL_RaiseWindow not working on windows
Ryan C. Gordon 4f4c4b62 2016-09-29T22:52:41 Added SDL_SetWindowResizable(). (thanks, Ethan!)