![]() |
SDL on N900 / Maemo
i am new to Linux / N900 / SDL programming. but I am not new to mobile development (11 years) or programming (>25 years). i have experience in C and C++ plus a few other languages.
i am currently picking up an app that someone wrote here but has since abandoned a long time ago. this app uses SDL. the app is written in C to keep things simple. i call SDL_WM_ToggleFullScreen to get the app into full screen. everything works fine except - i can't use the CTRL-BACKSPACE key combo on the N900 to switch back out to the task viewer or desktop. the only way i can get out is to hit the power button at the top which brings down a menu and if i wait a few seconds it then goes back out to the desktop. i can then swap to the task manager and see my app's window. is there a way to pass the CTRL-BACKSPACE key combination back to the operating system instead of having it trapped by SDL? or is there another way to handle this? my thoughts now are to have a key in my app that allows the user to toggle between full screen and windowed mode. but ideally i would like my app to run in full screen all the time but still give the flexibility to the user to task out and say respond to an incoming SMS. |
Re: SDL on N900 / Maemo
Using D-Bus is the answer:
Code:
|
Re: SDL on N900 / Maemo
aaaaaaaaah thank u. thanks for the code snippet too.
let me try to figure out how to integrate this. i'm guessing i should run the code when i detect ctrl-backspace in SDL, yes? |
Re: SDL on N900 / Maemo
Include stdlib.h and you can use the code:
Code:
system("dbus-send /com/nokia/hildon_desktop com.nokia.hildon_desktop.exit_app_view"); You can either add a key combination or an on screen button much like the one originally in hildon windows. Ctrl+backspace works when I code in SDL & c++. Don't know why it doesn't for you. |
Re: SDL on N900 / Maemo
got it working nicely. thanks!!!!
i basically capture a keycode which i designate for activating the task manager. perfect. i don't know why ctrl-backspace doesn't work yet since i just started looking through the sources of that app. are you running in full screen mode? |
Re: SDL on N900 / Maemo
hmmmmmmmmm gotta spend a bit more time debugging the code though. if i manage to get toggle to the task manager ONCE, then ctrl-backspace works nicely thereafter without needing dbus.
but if i don't toggle to the task manager for the first time, ctrl-backspace doesn't work. |
Re: SDL on N900 / Maemo
Personally I think the user should have options to have either fullscreen or not - you can still make your preference the default without actually limiting user choice to make the app full-screen or not. Of course, some apps would be hard to properly scale to both fullscreen/'normal', so can't really be picky if that's the case.
|
Re: SDL on N900 / Maemo
Maybe its the way you go to fullscreen. Have you tried creating the screen surface already as a fullscreen surface with "SDL_SWSURFACE|SDL_FULLSCREEN"
|
Re: SDL on N900 / Maemo
nevermind. fixed it. all is fine and dandy. no need to use dbus anymore. yup, i had to use SDL_FULLSCREEN plus some other minor logic errors that the original author had in the code.
thanks folks. |
Re: SDL on N900 / Maemo
I love SDL :) I wrote some good things in C+SDL before (mainly a 2d/physics engine and other small cool stuff) and got them working on PSP, linux and now n900, without much tweaking at all, pretty cool
|
All times are GMT. The time now is 06:21. |
vBulletin® Version 3.8.8