Qtopia backend fixes

Hi dear SDL guys,

Just wanted to submit this little patch that fixes one important issue
with the Qtopia backend: the menu/applications keys weren’t catched by
SDL, which caused the corresponding application to be launched, making
SDL lose the focus and often requiring a soft reboot. Moreover, due to
the limited number of keys on PDAs, it would have been nice to use them.

The trick was to create a new QPEApplication instead of using qApp, and
to call grabKeyboard() / ungrabKeyboard() on it when appropriate. I’ve
also tuned a little bit the key mapping to make them all recognized. The
patch isn’t very long - if the other people working on the Qtopia port
(David?) could have a quick look to confirm I haven’t broken anything
before integrating it, it’d be nice. But AFAIK this doesn’t cause any
problem. I’ll update my packages very soon.

Alex.–
http://www.gnurou.org

-------------- next part --------------
A non-text attachment was scrubbed…
Name: qtopia.patch
Type: application/octet-stream
Size: 6422 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20021124/eba5b5d1/attachment.obj

Alexandre Courbot writes:

Hi dear SDL guys,

Just wanted to submit this little patch that fixes one important issue
with the Qtopia backend: the menu/applications keys weren’t catched by
SDL, which caused the corresponding application to be launched, making
SDL lose the focus and often requiring a soft reboot. Moreover, due to
the limited number of keys on PDAs, it would have been nice to use them.

The trick was to create a new QPEApplication instead of using qApp, and
to call grabKeyboard() / ungrabKeyboard() on it when appropriate. I’ve
also tuned a little bit the key mapping to make them all recognized. The
patch isn’t very long - if the other people working on the Qtopia port
(David?) could have a quick look to confirm I haven’t broken anything
before integrating it, it’d be nice. But AFAIK this doesn’t cause any
problem. I’ll update my packages very soon.

Please send me the patch. I don’t understand what ‘create a new
QPEApplication’ means. I hope you didn’ do 'new QPEApplication(…)'
just to grab the keyboard/ Just use
((QPEApplication*)qApp)->grabKeyboard().

Also when ungrabbing, you need to grab first or it won’t always
work. In either case, send the patch to me, I’ll look at it and send
it to sam.–
[ Below is a random fortune, which is unrelated to the above message. ]
One meets his destiny often on the road he takes to avoid it.

I just noticed the patch was attached. Doh.–
[ Below is a random fortune, which is unrelated to the above message. ]
Real Programmers don’t write in PL/I. PL/I is for programmers who can’t
decide whether to write in COBOL or FORTRAN.

Please send me the patch. I don’t understand what ‘create a new
QPEApplication’ means. I hope you didn’ do 'new QPEApplication(…)'
just to grab the keyboard/ Just use
((QPEApplication*)qApp)->grabKeyboard().

Also when ungrabbing, you need to grab first or it won’t always
work. In either case, send the patch to me, I’ll look at it and send
it to sam.

I had to create a new QPEApplication. When using qApp, the keyboard was
not ungrabbed, even when I called qApp->ungrabKeyboard(). That’s what I
tested at first, of course. Creating a new QPEApp didn’t hurt, and
worked perfectly even.

Anyway, you know the matter much better than me, so if there is
somethign wrong, feel free to flame me :wink:

Alex.–
http://www.gnurou.org

Alexandre Courbot writes:

Please send me the patch. I don’t understand what ‘create a new
QPEApplication’ means. I hope you didn’ do 'new QPEApplication(…)'
just to grab the keyboard/ Just use
((QPEApplication*)qApp)->grabKeyboard().

Also when ungrabbing, you need to grab first or it won’t always
work. In either case, send the patch to me, I’ll look at it and send
it to sam.

I had to create a new QPEApplication. When using qApp, the keyboard was
not ungrabbed, even when I called qApp->ungrabKeyboard(). That’s what I
tested at first, of course. Creating a new QPEApp didn’t hurt, and
worked perfectly even.

The trick is to grabKeyboard right before ungrabbing.

Anyway, you know the matter much better than me, so if there is
somethign wrong, feel free to flame me :wink:

There are bugs related to this yes. I am working on a patch that, rather
than forcing grabbing, fixes so that SDL_WM_GrabInput works (as well
as fixing SDL_WM_IconifyWindow plus some other minor things).–
[ Below is a random fortune, which is unrelated to the above message. ]
Famous last words: