Commit Graph

2352 Commits

Author SHA1 Message Date
Sam Lantinga
d92ef194bc Fixed crash - need to save and restore rbx around cpuid, since the compiler may be assuming the stack pointer isn't being modified when filling in %0.
I did it around each call to cpuid which isn't strictly necessary, but is definitely future proof. :)

--HG--
branch : SDL-1.2
2009-12-02 16:24:21 +00:00
Sam Lantinga
6b6579081f Fixed bug #888
The OS/2 joystick code included an IBM header and was in violation of the license.
Ryan may put this back someday with a legal header. :)

--HG--
branch : SDL-1.2
2009-11-17 05:14:23 +00:00
Sam Lantinga
6c9d143fb3 Fixed bugs #882 and 865, re-opening bug #634
Ronald Lamprecht to SDL

Hi,

    Sam Lantinga wrote:

        The problem with that fix is that it breaks IME events again.  Maybe
        we can handle keyboard events differently to prevent this issue?


Spending an hour reading MSDN, analysing SDL and another hour testing the reality on XP I am really wondering how patch r4990 could have ever worked in any situation. It's main effect is to break the unicode translation and causing spurious activation events!

Why does TranslateMessage(&msg) nothing useful? Simply because it does not affect "msg" at all! All keyboard events are dispatched without the slightest change (see MSDN). TranslateMessage() just appends additional WM_CHAR, WM_DEADCHAR, WM_SYSCHAR, WM_SYSDEADCHAR event messages to the queue. But I could not find any SDL event handling routine that catches these events and transforms them to proper SDL keyevents while eliminating the corresponding WM_KEYDOWN, etc. events. Thus any IME input like the '@' generated by "Alt + 6(Numpad) + 4(Numpad)" is simply lost.

But the situation is even worse! Up to r4990 the TranslateKey()/ToUnicode() calls did evaluate dead keys and did deliver proper key events for subsequent key strokes like '´' + 'e' resulting in 'é'. ToUnicode() needs proper key state informations to be able to handle these substitutions. But unfortunatly TranslateMessage() needs the same state information and eats it up while generating the WM_CHAR messages :-( Thus the current 1.2.14 breakes the partial IME support of previous releases, too.

The key state race condition between ToUnicode() and TranslateMessage() requires to avoid any ToUnicode() usage for receiving proper WM_CHAR, etc. messages generated by TranslateMessage(). (Yes - the '@' and 'é' appear as WM_CHAR messages when unicode is switched off).

The spurious SDL activation events are *not* caused by additional WM_ACTIVATE Windows messages! Besides DIB_HandleMessage() SDL_PrivateAppActive() is called by another source which I am not yet aware of - any hints?

Thus I do strongly recommend the deletion of the TranslateMessage(&msg) call as a quick fix.

A proper support of unicode and IME requires a clean SDL keyboard input concept first. Which SDL keyboards events should be transmitted to the app when the user presses '´' + 'e' ? Within the current unicode handling the first key stroke is hidden. Even though ToUnicode() delivers the proper key SDL does ignore it in TranslateKey(). Just the composed key event is transmitted to the app. That is what you expect for text input, but the app can no longer use keys like '^' as a key button because it will never receive a key event for it!

With a given concept it seems to be necessary to regenerate SDL key events out of the WM_CHAR, etc. events and to drop all related direct WM_KEYDOWN, etc. events while the remaining basic WM_KEYDOWN, etc. events would still have to result in SDL key events.

Anyway the source of the spurious WM_ACTIVATE should be located to avoid future trouble.

Greets,

Ronald

--HG--
branch : SDL-1.2
2009-11-17 04:59:13 +00:00
Sam Lantinga
db37d6e3b3 Gregory Smith
Another one for the "How did this ever work?" file: when
DX5_HandleMessage is called with WM_ACTIVATEAPP, it goes past the end
of the 2-element SDL_DIdev array and if there doesn't happen to be a 0
in the memory next to it, crashes. Patch against SVN attached.

--HG--
branch : SDL-1.2
2009-11-15 17:21:24 +00:00
Patrice Mandin
c1aa984d3b Forgot a check for Coldfire CPU
--HG--
branch : SDL-1.2
2009-11-09 18:02:32 +00:00
Patrice Mandin
f5f458cd8d Adapt timer code for Coldfire
--HG--
branch : SDL-1.2
2009-11-07 20:56:09 +00:00
Patrice Mandin
d2a96d82ef Adapt audio interrupts for Coldfire
--HG--
branch : SDL-1.2
2009-11-07 20:45:45 +00:00
Patrice Mandin
5a7245bafd Adapt XBIOS asm routine for Coldfire
--HG--
branch : SDL-1.2
2009-11-07 12:20:01 +00:00
Patrice Mandin
ce98820894 Damn. Need to be more careful with stack stuff.
--HG--
branch : SDL-1.2
2009-11-06 22:43:51 +00:00
Patrice Mandin
e11f10bb89 Oops. Forgot a change for Coldfire.
--HG--
branch : SDL-1.2
2009-11-06 22:40:19 +00:00
Patrice Mandin
9ed1221830 Adapt IKBD asm routine for Coldfire
--HG--
branch : SDL-1.2
2009-11-06 22:32:16 +00:00
Patrice Mandin
68eefb3a22 Disable C2P routines for Coldfire CPUs
--HG--
branch : SDL-1.2
2009-11-06 21:17:16 +00:00
Patrice Mandin
62830367f0 Disable m68k assembly for Coldfire CPUs
--HG--
branch : SDL-1.2
2009-11-06 18:06:01 +00:00
Patrice Mandin
608c80be92 Update for include file locations
--HG--
branch : SDL-1.2
2009-11-06 17:42:14 +00:00
Ryan C. Gordon
747a6f5647 1.2 branch: fixed assembly code register clobbering.
--HG--
branch : SDL-1.2
2009-11-01 17:51:39 +00:00
Ryan C. Gordon
939f043686 fatbuild.sh: work around directory name change in Xcode 3.2.
--HG--
branch : SDL-1.2
2009-10-28 19:42:16 +00:00
Sam Lantinga
b55be8c9da C.W. Betts 2009-10-20 09:58:56 PDT
The compiler complains that long is an incompatible pointer type for
[gl_context setValues: forParameter:] and CGLSetParameter.  This only shows up
on x86_64, but it still might be an issue.

--HG--
branch : SDL-1.2
2009-10-22 04:53:44 +00:00
Sam Lantinga
e6b7fe6556 Better fix for bug #861
--HG--
branch : SDL-1.2
release-1.2.14
2009-10-20 03:47:29 +00:00
Sam Lantinga
3d6bd8a62b Fixed bug #861
C.W. Betts      2009-10-19 19:16:41 PDT

In 64-bit libraries, the fork reference is a different size than in 32-bit.
Apple has tried to help this transition by making a typedef called FSIORefNum,
but it is only available in Mac OS X 10.5 headers or later.  I first noticed
this bug in Mac OS X's CD player code, and the patch is set to fix it
accordingly.  This might also be an issue in SDL_QuartzVideo.m

--HG--
branch : SDL-1.2
2009-10-20 03:45:06 +00:00
Sam Lantinga
83ced0b76d Fixed compiler warnings
--HG--
branch : SDL-1.2
2009-10-19 10:09:58 +00:00
Sam Lantinga
83eded22dd Fixed bug #858
Fixed compiler warning

--HG--
branch : SDL-1.2
2009-10-19 10:03:16 +00:00
Sam Lantinga
d460dd9cfc Fixed bug #857
Fixed compiler warnings

--HG--
branch : SDL-1.2
2009-10-19 10:02:00 +00:00
Sam Lantinga
b8ce312c2d Whoops, missing newline!
--HG--
branch : SDL-1.2
2009-10-19 06:01:58 +00:00
Sam Lantinga
f005939def Added an untested code path for snd_pcm_wait()
--HG--
branch : SDL-1.2
2009-10-19 05:59:07 +00:00
Sam Lantinga
f91f685e87 ALSA write failed (unrecoverable): Resource temporarily unavailable
--HG--
branch : SDL-1.2
2009-10-19 05:24:48 +00:00
Sam Lantinga
1b26102024 Added an error message for when ALSA audio fails
--HG--
branch : SDL-1.2
2009-10-19 05:15:21 +00:00
Sam Lantinga
bb0c0285eb Getting as close as you can with periods is better than the default parameters.
--HG--
branch : SDL-1.2
2009-10-19 03:18:15 +00:00
Sam Lantinga
9d6d374b2e Recoomendation from Lennart Poettering:
I guess I don't have to mention that, but ALSA_WaitAudio() is
pure evil, and just broken. getpid() returns pids, not tids. You get
those via gettid(). But I'd recommend dropping that entirely. It's
just broken.

--HG--
branch : SDL-1.2
2009-10-19 02:36:02 +00:00
Sam Lantinga
9ae92e66fe Recommendation from Lennart Poettering:
In ALSA_PlayAudio() it is a good idea to use snd_pcm_recover() instead
of checking for the error codes yourself.

--HG--
branch : SDL-1.2
2009-10-19 02:33:07 +00:00
Sam Lantinga
1c6619a32c Recommendation from Lennart Poettering:
In ALSA_OpenAudio(): instead of setting period_size+n_periods OR
buffer_size I'd recommend copying the hwparams stuff before you do
this, then first try period_size+n_periods, and then apply it with
snd_pcm_hw_params() and check if that works. If it didn't you should
take the copy of hwparams and try setting buffer_size and apply that
via snd_pcm_hw_params() and check if that worked. And if that failed
too, then take the copy and don't apply neither period nor buffer
settings and see if that works.

--HG--
branch : SDL-1.2
2009-10-19 02:23:21 +00:00
Sam Lantinga
eaeafb88da There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct value after the first scanline. Ugh.
--HG--
branch : SDL-1.2
2009-10-18 23:18:28 +00:00
Sam Lantinga
f611e45868 Fixed bug #855
Ludwig Nussel      2009-10-18 06:31:52 PDT

an mprotect call was added to fix bug 528. However that results in a buffer
that allows writing and code execution. Ie the no-execute security features of
modern operating systems are defeated this way. Two mprotect calls are needed.
One to make the buffer executable but not writeable when done and another one
to make the buffer writeable again if the content needs to be changed.

--HG--
branch : SDL-1.2
2009-10-18 17:31:37 +00:00
Sam Lantinga
0f00a541da Use MacOS line endings for Mac resource files
--HG--
branch : SDL-1.2
2009-10-18 16:23:12 +00:00
Sam Lantinga
0c1cc75bbe Use MacOS line endings for SDL.x
--HG--
branch : SDL-1.2
2009-10-18 16:17:13 +00:00
Sam Lantinga
4ec7a0bc45 Fixed bug #853
Ludwig Nussel      2009-10-18 05:34:18 PDT

src/joystick/linux/SDL_sysjoystick.c has some problems:

- test_bit() might break with strict aliasing
- test_bit() assumes array is Uint32 but its actually "unsigned long"
  on 64bit systems sizeof(long) != sizeof(Uint32).
- the keybit array is too small
- the arrays are unitialized so the number of
  detected buttons is quite random

--HG--
branch : SDL-1.2
2009-10-18 16:14:57 +00:00
Sam Lantinga
c41d89fdc8 We no longer have a DirectInput link requirement
--HG--
branch : SDL-1.2
2009-10-17 17:35:48 +00:00
Sam Lantinga
c97278db23 Fixed bug #849
This was a silly bug. :)

--HG--
branch : SDL-1.2
2009-10-17 16:49:23 +00:00
Sam Lantinga
eea9c5c809 Don't need the define anymore...
--HG--
branch : SDL-1.2
2009-10-17 07:05:33 +00:00
Sam Lantinga
e79fc21546 Enable the ALSA debug code via environment variable
--HG--
branch : SDL-1.2
2009-10-17 07:04:58 +00:00
Sam Lantinga
b634b7d198 Option to fix bug #851
For some people setting the period size works better (and is what SDL 1.2.13 did), but for most people it's the same or worse.  You can use an environment variable to pick which one you want.

--HG--
branch : SDL-1.2
2009-10-17 06:55:17 +00:00
Sam Lantinga
54db02f8b2 matthew green
actually, please don't apply this upstream.  i need to think about
a better solution..

thanks.

.mrg.

--HG--
branch : SDL-1.2
2009-10-17 05:05:29 +00:00
Sam Lantinga
6ccc33a7a8 Allow the application to resize the window without destroying the OpenGL context
--HG--
branch : SDL-1.2
2009-10-16 07:24:11 +00:00
Sam Lantinga
8f203969cf patch-pulse (from ahoka@NetBSD.org):
Fix assertion triggered in pulsaudio by returning "unknown" instead
of NULL pointer when guessing application name.

- Use getprogname on NetBSD as it wont return NULL

--HG--
branch : SDL-1.2
2009-10-16 05:12:20 +00:00
Sam Lantinga
ab219723ac patch-ac (from mrg@NetBSD.org):
Look for libGL.so, not any particular libGL.so.<X>, on NetBSD.
(the comment inline explains why)

--HG--
branch : SDL-1.2
2009-10-16 05:06:17 +00:00
Sam Lantinga
7b8a094162 patch-ab (from reinoud@NetBSD.org):
Apply patch to first unlock the CD before trying to eject it. Since
SDL doesn't seem to have lock/unlock primitives, this looks like the
right thing to do.

Fixes audio/tcd's eject function too.

--HG--
branch : SDL-1.2
2009-10-16 05:05:21 +00:00
Sam Lantinga
a225b3fe43 It helps to use the right constant. :)
--HG--
branch : SDL-1.2
2009-10-16 04:29:27 +00:00
Sam Lantinga
79753ff54b Use SDL's byte order check, just to be sure
--HG--
branch : SDL-1.2
2009-10-16 04:24:03 +00:00
Ryan C. Gordon
5ef00a7131 Don't call it "ALSA 0.9 PCM audio" anymore, since we moved to the stable API.
--HG--
branch : SDL-1.2
2009-10-15 05:29:49 +00:00
Sam Lantinga
d82e5fefad Fixed building on Mac OS X
--HG--
branch : SDL-1.2
2009-10-15 05:18:48 +00:00
Sam Lantinga
20aa1c739b Fixed bug #728
I am using a headset on my monitor as primary sound output device. From time to
time it happens that I switch off my monitor when I leave my computer and
switch it on when I come back.
When doing so while wesnoth is running I get no sound back when I switch on my
monitor. There is probably good reason for that. Therefore I wanted to exit and
restart wesnoth. Unfortunately, wesnoth always hangs in this situation. It
looks like wesnoth can not be exited when the primary sound device vanished.
I created a backtrace of this situation (please see attachment).

--HG--
branch : SDL-1.2
2009-10-15 02:52:11 +00:00