Commit graph

76 commits

Author SHA1 Message Date
Ryan C. Gordon
0dc198273c Wired up Windows resize hit testing. 2014-06-05 00:54:43 -04:00
Ryan C. Gordon
be872bff15 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.
2014-05-30 01:51:13 -04:00
Ryan C. Gordon
9efc4a5fdd Fixed hit-testing on Windows.
Needed to convert from screen to client coords.
2014-05-30 01:49:26 -04:00
Ryan C. Gordon
7cc0821ab0 First shot (not even compiled) at Windows hit-testing support.
--HG--
extra : rebase_source : 0563e3a3584a43403b46a8e89477deba4c502430
2014-05-29 13:39:02 -04:00
Sam Lantinga
399e1ddba7 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.
2014-04-17 21:00:25 -07:00
Sam Lantinga
dfd9c3a58e Fixed bug 2450 - Crosscompiling for Win32 with MinGW fails due to WM_UNICHAR undeclared 2014-03-15 16:32:45 -07:00
Sam Lantinga
0439b46866 Make sure we don't clip the cursor while clicking on the window title bar 2014-02-24 22:49:30 -08:00
Sam Lantinga
a51fa61986 Make sure we don't stay in the windows event loop forever if there are lots of events coming in quickly. 2014-02-14 11:39:58 -08:00
Sam Lantinga
e16a129e19 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
2014-02-13 11:05:28 -08:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Sam Lantinga
d9f1c7b666 Document Michael's changes adding TranslateMessage() back to the SDL message loop. 2014-01-30 12:27:24 -08:00
Sam Lantinga
ff4616a9f6 * 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
Ryan C. Gordon
82edee6971 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.

--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Sam Lantinga
95c34dcdd1 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
e19941b406 Setting the mouse in relative mode implies grabbing the mouse.
This fixes getting mouse button events in raw input relative mode on X11.
2013-12-23 17:55:06 -08:00
Sam Lantinga
134d56c6d9 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.
2013-12-23 17:37:22 -08:00
Sam Lantinga
e191f1f872 Added code missed in the resolve 2013-12-05 09:29:04 -08:00
Sam Lantinga
94adb0c939 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.
2013-11-27 10:29:38 -08:00
Sam Lantinga
4c087a3780 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.
2013-11-27 10:29:32 -08:00
Sam Lantinga
aee889c1bd Don't crash when no WM is present.
CR: Sam Lantinga.
2013-11-27 10:29:27 -08:00
Gabriel Jacobo
ee3f8b15d5 [Windows] Fixes bug #1555, handle ALT+F4 on Windows 2013-11-13 11:18:37 -03:00
Sam Lantinga
20f5652c62 Fixed bug 2067 - Window size limit calculation issue when exiting fullscreen on Windows
Also fixed minimize and maximize state detection for Windows.
2013-11-10 14:10:00 -08:00
Sam Lantinga
3b80318c57 Fixed Windows compile error 2013-11-06 23:59:24 -08:00
Sam Lantinga
fb36af2724 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.
2013-11-06 23:35:08 -08:00
Sam Lantinga
0b7df34286 Fixed the windows message debug output so it works without HAVE_LIBC 2013-10-14 08:56:50 -07:00
Sam Lantinga
097878a78e Fixed accumulating mouse wheel motion for the Microsoft Wireless Mouse 5000 2013-10-13 19:59:40 -07:00
Gabriel Jacobo
298ce1c1a7 OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
Gabriel Jacobo
271e0d67c4 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Gabriel Jacobo
5e78879e76 More non C89 compliant comments 2013-08-20 20:34:40 -03:00
Sam Lantinga
814d56a9cc Fixed windows build 2013-08-16 17:50:44 -07:00
Sam Lantinga
8b93c73d0d The keyboard text events should be sent after the key down events 2013-08-16 15:38:06 -07:00
Sam Lantinga
ec992b0558 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.

--HG--
extra : rebase_source : 7024be6c3a874d0319ea4c65b7d43f105915288f
2013-08-16 15:35:10 -07:00
Philipp Wiesemann
286dc2e1dc Added missing call to SDL_stack_free().
On Windows this is needed because SDL_stack_alloc() wraps SDL_malloc().
2013-08-10 23:21:06 +02:00
Ryan C. Gordon
72d8cda7bb Windows: Unstick shift keys in a timely manner when the OS loses a KEYUP event.
Fixes Bugzilla #1959.
2013-08-01 01:50:02 -04:00
Ryan C. Gordon
b8198f3b2a Attempt to fix compiler warning.
Fixes Bugzilla #1784. (or at least the only part of it that was a real bug.)
2013-07-30 00:17:44 -04:00
Sam Lantinga
f26e1bc175 Fixed bug 1897 - CPU spike on Windows with WM_EVENT and OpenGL
buckyballreaction

On some Windows systems, when switching from fullscreen to windowed mode in my game, the CPU will spike and the application never shows the window again.

See the part of the e-mail thread here:

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-June/088626.html

I change the window by calling:

SDL_SetWindowFullscreen(gScreenInfo.sdlWindow, SDL_FALSE);
SDL_SetWindowSize(gScreenInfo.sdlWindow, sdlWindowWidth, sdlWindowHeight);

which you can see in our source:

https://code.google.com/p/bitfighter/source/browse/zap/VideoSystem.cpp#377

Then all of a sudden the application gets stuck in WIN_PumpEvents() in SDL_windowsevents.c.  I turned on WMMSG_DEBUG and found that there was an endless stream of WM_EVENT messages.  I also found that where WM_PAINT is being handled in the callback WIN_WindowProc(), ValidateRect is somehow not clearing, or it is persisting, the WM_EVENT message like it's supposed to (according to the docs).

This may be a hardware issue.  The issue has appeared on three different systems, one of them sporadically:
 - Windows XP SP3 running in VMware 9.0 (without VMWare 3D acceleration, but with the tools and drivers installed), Host: openSUSE 12.3 x86_64, NVidia NVS 3100M
 - Windows XP SP3 64bit running in VirtualBox, Host: Debian Wheezy (stable), Mobility Radeon HD 4100 (this was the sporadic one)
 - Windows 7 64 bit, Radeon 6770
2013-06-06 23:18:36 -07:00
Jørgen P. Tjernø
df3b1a6ed1 Win32: Fix issue with SetCapture & negative values.
This fixes an issue where we were using the wrong macros to extract the position from WM_MOUSEMOVE, so negative values were behaving incorrectly.
These would be generated in multimon situations, or if you use SetCapture.

Fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1175
2013-06-05 12:00:18 -07:00
Jørgen P. Tjernø
c6dd828f1e Win32: Ignore WM_MOUSELEAVE in relative mode.
We get an WM_MOUSELEAVE when we switch to relative mode, even though the cursor is still in the window.
Ignoring this event to not end up with a NULL mouse focus.

This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1861
2013-06-05 12:00:15 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Jørgen P. Tjernø
f7032de060 Send mouse leave updates for Windows and X11.
We now generate a final SDL_MOUSEMOTION before the cursor leaves the
window, followed by a SDL_WINDOWEVENT_LEAVE.
2013-04-22 18:14:55 -07:00
Jørgen P. Tjernø
4bf8e7bd24 Numlock & pause fix from Alfred.
Fix numlock and pause keys not being pressable on win32, they both report under
the same scancode, so use the VK to tell them apart

--HG--
extra : histedit_source : ea129a468bd8ca3164b1aaea0fa143cf2e130b7b
2013-04-10 14:11:26 -07:00
Ryan C. Gordon
4f438b70a2 Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
Sam Lantinga
607bf8a77c Fixed compiler warning with Cygwin 2013-03-26 05:08:57 -07:00
Sam Lantinga
fb49761922 Fixed 64-bit compile warnings on Visual C++ 2013-03-06 11:59:19 -08:00
Sam Lantinga
bb0752e573 Updated touch API
* Normalized touch coordinates as floats in the 0...1 range
* Removed unused touchpad concepts from the API
* Added API functions to get active touch devices and current finger state
2013-03-03 01:01:33 -08:00
Sam Lantinga
71ea3033fa Added a mouse ID to the mouse events, which set to the special value SDL_TOUCH_MOUSEID for mouse events simulated by touch input. 2013-03-02 20:44:16 -08:00
Sam Lantinga
932ea49e88 Merged 2013-03-01 11:18:35 -08:00
Sam Lantinga
1b30d1a566 Cleaned up and fixed the Windows keyboard mapping code.
Use KP_PERIOD instead of KP_DECIMAL
Don't remap keys which are always keycode named versions of scancodes
2013-02-28 21:40:08 -08:00
Sam Lantinga
176d7c570c sdl - check for both the up and down flags being set in the raw input calls. Also use WM_ACTIVE to resync mouse buttons on activate 2013-02-27 11:39:43 -08:00
Sam Lantinga
6b945c8586 sdl - don't use the RAWMOUSE struct to get button press information, it lies badly to you, just use the usual windows message path 2013-02-27 11:39:41 -08:00