Commit graph

47 commits

Author SHA1 Message Date
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
Sam Lantinga
f4e5303f46 sdl - use the wParam and rawinput data for mouse state rather than just the message type, fixes missing mouse up events when alt-tabing out of the window
CR: SamL
2013-02-27 11:39:39 -08:00
Sam Lantinga
a2dccaee2b Fixed cygwin compile 2013-02-26 20:32:11 -08:00
Andreas Schiffler
3269062684 Fix cygwin compile 2013-02-26 07:50:42 -08:00
Jørgen P. Tjernø
383deb9a61 sdl2
- more scancode goodness, removing now dead wparam translation code
- add scancode for SDL_SCANCODE_NONUSBACKSLASH
- don't translate sdl key values for numeric and grave key

CR: SamL
2013-02-25 16:52:51 -08:00
Jørgen P. Tjernø
cf58b77360 sdl2
- change the windows scancode logic to use the scan code value in lparam rather than VK's to get a stable scancode value across different KB layouts
2013-02-25 16:52:42 -08:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
c54822142d Fixed increasing the size of resizable windows 2013-02-11 21:39:58 -08:00
Sam Lantinga
eb63dcd330 Fixed mouse wheel delta on Windows 2013-02-11 21:29:36 -08:00
Sam Lantinga
069a2cce76 Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.
Marco Schmidt

After sizing my main window (the only window in my application) through
grabbing the window border with the mouse the window collapses instantly to a
size of 0 x 124. In my application I can not resize the window to a normal size
again.

I tried to reproduce the problem - and here a the minimal steps I found.

I'm running WIN8 x64, VS2012Pro, HG SDL-2.0 tip, WIN32-Build.

Minimal steps to reproduce my problem:

- open solution SDL_VS2012
- make testdraw2 the start project
- pass command line option --resize to the debuggee testdraw2
- starting the application testdraw2
- try to resize the window
- the application window resizes to a minimal size 0 x 124.
- the application crashes to divide by zero .... (this is only the aftermath
but a unhandled error condition)
2013-02-08 01:04:07 -08:00
Sam Lantinga
1a92f18381 Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Also fixed Cocoa implementation so that it affects client area, not the whole window area.
2012-12-31 12:15:25 -08:00
Sam Lantinga
f4294fd806 Improvements from Alfred:
- Added new SDL_HINT_ALLOW_TOPMOST hint, when set to "0" then never set the topmost bit on a window. Useful when debugging fullscreen issues.
- fixed crash in windows joystick scanning if we failed to load the xinput dll
- added support for SDL_WINDOW_FULLSCREEN_DESKTOP under windows
- synthesize relative mouse movements if directinput fails to send relative moves, happens under virtual box.
2012-12-31 09:30:15 -08:00
stopiccot
ea4e328e39 SetWindowMinimumSize Windows implementation 2012-11-19 00:39:19 +03:00
Sam Lantinga
b6fe53e5ea Fixed bug 1593 - SDL_DROPFILE event doesn't work on Windows
Philipp Wiesemann 2012-09-30 05:56:09 PDT

I attached a patch which tries to implement the dropfile support for Microsoft
Windows. If applied SDL_DROPFILE events should be sent for single or multiple
files which are dropped on window.

The handling on Windows side is always activated (cursor will change and so on)
because there is no connection between SDL_EventState() and the window setup. I
assumed this additional overhead would be small and can be ignored.
2012-09-30 11:10:17 -07:00
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Ryan C. Gordon
5c732d6324 Removed Windows CE support from SDL 2.0.
It's a long-dead platform, and we don't have any way to build for, test, or
maintain it, so there's no sense in doing acrobatics to support it.

If you need Windows CE support, use SDL 1.2. If you need Windows Phone support,
send SDL 2.0 patches for the newer Windows Mobile platform.
2012-09-15 10:59:39 -04:00
Sam Lantinga
c7a5aa5128 Patrick Baggett implemented relative mouse mode on Win32
Here is my first rough attempt. "testrelative" feels right to me, but I'd like it someone else tested this, especially compared to Linux/OSX. The "Ctrl+r" to switch between relative and normal mouse movements seems to work flawlessly. With relative mouse movement, the only way to change focus is via keyboard. I'm not sure if that is the correct approach, but that would seem to be the most useful mode for games. Still, if my assumption is wrong, I can fix that no problem.
2012-07-03 23:52:02 -04:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
ad2a21d404 Lots of fixes importing SDL source wholesale into a new iOS project
--HG--
rename : src/libm/math.h => src/libm/math_libm.h
2011-10-31 05:56:58 -04:00
Ryan C. Gordon
d7cb5c41ca More work on cleaning out compiler warnings.
--HG--
extra : rebase_source : ab97ecaafc5a22451ea1bf8d4740380cf56f2f98
2011-09-11 04:02:40 -04:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
2368a3301a Added support for Windows cursors 2011-02-28 23:50:32 -08:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
09a8558897 Making the API simpler, removed support for palettized video modes and textures. 2011-02-01 21:23:43 -08:00
Sam Lantinga
372693d86f Removed more partially functional renderers
--HG--
extra : rebase_source : d00f0590e133604070f978762a6728b4afde02ca
2011-01-31 22:53:45 -08:00
Sam Lantinga
10b8372bd3 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008 2011-01-24 15:46:11 -08:00
Sam Lantinga
9d25ba272a Fixed bug #925
Changed "win32" to "windows"

--HG--
rename : include/SDL_config_win32.h => include/SDL_config_windows.h
rename : src/events/scancodes_win32.h => src/events/scancodes_windows.h
rename : src/haptic/win32/SDL_syshaptic.c => src/haptic/windows/SDL_syshaptic.c
rename : src/joystick/win32/SDL_dxjoystick.c => src/joystick/windows/SDL_dxjoystick.c
rename : src/joystick/win32/SDL_dxjoystick_c.h => src/joystick/windows/SDL_dxjoystick_c.h
rename : src/joystick/win32/SDL_mmjoystick.c => src/joystick/windows/SDL_mmjoystick.c
rename : src/loadso/win32/SDL_sysloadso.c => src/loadso/windows/SDL_sysloadso.c
rename : src/main/win32/SDL_win32_main.c => src/main/windows/SDL_windows_main.c
rename : src/main/win32/version.rc => src/main/windows/version.rc
rename : src/thread/win32/SDL_sysmutex.c => src/thread/windows/SDL_sysmutex.c
rename : src/thread/win32/SDL_syssem.c => src/thread/windows/SDL_syssem.c
rename : src/thread/win32/SDL_systhread.c => src/thread/windows/SDL_systhread.c
rename : src/thread/win32/SDL_systhread_c.h => src/thread/windows/SDL_systhread_c.h
rename : src/thread/win32/win_ce_semaphore.c => src/thread/windows/win_ce_semaphore.c
rename : src/thread/win32/win_ce_semaphore.h => src/thread/windows/win_ce_semaphore.h
rename : src/timer/win32/SDL_systimer.c => src/timer/windows/SDL_systimer.c
rename : src/video/win32/SDL_ceddrawrender.c => src/video/windows/SDL_ceddrawrender.c
rename : src/video/win32/SDL_ceddrawrender.h => src/video/windows/SDL_ceddrawrender.h
rename : src/video/win32/SDL_d3drender.c => src/video/windows/SDL_d3drender.c
rename : src/video/win32/SDL_d3drender.h => src/video/windows/SDL_d3drender.h
rename : src/video/win32/SDL_gapirender.c => src/video/windows/SDL_gapirender.c
rename : src/video/win32/SDL_gapirender.h => src/video/windows/SDL_gapirender.h
rename : src/video/win32/SDL_gapirender_c.h => src/video/windows/SDL_gapirender_c.h
rename : src/video/win32/SDL_gdirender.c => src/video/windows/SDL_gdirender.c
rename : src/video/win32/SDL_gdirender.h => src/video/windows/SDL_gdirender.h
rename : src/video/win32/SDL_msctf.h => src/video/windows/SDL_msctf.h
rename : src/video/win32/SDL_vkeys.h => src/video/windows/SDL_vkeys.h
rename : src/video/win32/SDL_win32clipboard.c => src/video/windows/SDL_windowsclipboard.c
rename : src/video/win32/SDL_win32clipboard.h => src/video/windows/SDL_windowsclipboard.h
rename : src/video/win32/SDL_win32events.c => src/video/windows/SDL_windowsevents.c
rename : src/video/win32/SDL_win32events.h => src/video/windows/SDL_windowsevents.h
rename : src/video/win32/SDL_win32gamma.c => src/video/windows/SDL_windowsgamma.c
rename : src/video/win32/SDL_win32gamma.h => src/video/windows/SDL_windowsgamma.h
rename : src/video/win32/SDL_win32keyboard.c => src/video/windows/SDL_windowskeyboard.c
rename : src/video/win32/SDL_win32keyboard.h => src/video/windows/SDL_windowskeyboard.h
rename : src/video/win32/SDL_win32modes.c => src/video/windows/SDL_windowsmodes.c
rename : src/video/win32/SDL_win32modes.h => src/video/windows/SDL_windowsmodes.h
rename : src/video/win32/SDL_win32mouse.c => src/video/windows/SDL_windowsmouse.c
rename : src/video/win32/SDL_win32mouse.h => src/video/windows/SDL_windowsmouse.h
rename : src/video/win32/SDL_win32opengl.c => src/video/windows/SDL_windowsopengl.c
rename : src/video/win32/SDL_win32opengl.h => src/video/windows/SDL_windowsopengl.h
rename : src/video/win32/SDL_win32shape.c => src/video/windows/SDL_windowsshape.c
rename : src/video/win32/SDL_win32shape.h => src/video/windows/SDL_windowsshape.h
rename : src/video/win32/SDL_win32video.c => src/video/windows/SDL_windowsvideo.c
rename : src/video/win32/SDL_win32video.h => src/video/windows/SDL_windowsvideo.h
rename : src/video/win32/SDL_win32window.c => src/video/windows/SDL_windowswindow.c
rename : src/video/win32/SDL_win32window.h => src/video/windows/SDL_windowswindow.h
rename : src/video/win32/wmmsg.h => src/video/windows/wmmsg.h
2011-01-20 18:04:05 -08:00
Renamed from src/video/win32/SDL_win32events.c (Browse further)