Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Frantisek Dufka

Johan Bilien wrote:


http://maemo.org/platform/docs/api/libosso/html/index.html

You can register a callback with osso_hw_set_event_cb, set the
system_inactivity_ind flag in the osso_hw_state_t argument.



Will this callback be called even without processing gtk/glib loop?
If not is there other way how to check for blanked display e.g. from SDL 
app? How SDL games shipped with device do that?


Frantisek

___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


RE: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Jakub.Pavelek
 http://maemo.org/platform/docs/api/libosso/html/index.html
 
 You can register a callback with osso_hw_set_event_cb, set the 
 system_inactivity_ind flag in the osso_hw_state_t argument.


Will this callback be called even without processing gtk/glib loop?
If not is there other way how to check for blanked display 
e.g. from SDL app? How SDL games shipped with device do that?

Frantisek

Hi,

Shipped SDL games use wrappers to get some useful callbacks. It is not
documented anywhere AFAIK (but sure enough we do have a howto for
SDL_net that is about 100% useless for the device).

Br,

--jakub
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Kimmo Hämäläinen
On Wed, 2006-12-13 at 15:22 -0800, ext Aaron Levinson wrote:
 On Wed, 13 Dec 2006, Johan Bilien wrote:
 
  On Wed, Dec 13, 2006, Aaron Levinson wrote:
   In the Maemo coding style and programming guidelines document on
   maemo.org, it states the following:  Avoid updating the GUI when the
   application running on the background and when the screen has been turned
   off. Remove unnecessary graphical elements or constantly updated screen
   components.  Now, it appears that hildon_window_get_is_topmost() or
   hildon_program_get_is_topmost() can be used to determine if an application
   is running in the background, but how does one programmatically determine
   if the screen has been turned off?  I see in the latest version of libosso
   in SVN that there is a muali API that provides the ability to access the
   information via a callback, but it is unclear how to determine this on 2.0
   or 2.1.  Perhaps I can use XScreenSaverQueryInfo() ?
  
  http://maemo.org/platform/docs/api/libosso/html/index.html
  
  You can register a callback with osso_hw_set_event_cb, set the
  system_inactivity_ind flag in the osso_hw_state_t argument.
 
 Well, I had already examining the libosso APIs before sending the e-mail,
 and I did notice the system_inactivity_ind flag in the osso_hw_state_t
 struct.  However, according to the libosso documentation, if the callback
 is called for system inactivity, this means that the application should
 reduce its activity.  I didn't directly associate this text with the
 screen being blanked, which I think is understandable, since screen
 blanking is not the same thing.
 
 What are the conditions that result in the callback for the system 
 inactivity indicator being called?  The statement the application should 
 reduce its activity is somewhat open-ended, and perhaps this callback is 
 used for more than just to indicate that the screen has been blanked.

It's not clear to me either, but you can use the system_inactivity_ind
for the display on/off information as well (I added that to the trunk
libosso.h). I have verified this from the MCE guys some time ago.

I'll ask for comments about the new 'muali' API at some point. Now I'm
pondering about the API to replace the osso_rpc_* functions.

BR; Kimmo

 
 Thanks,
 Aaron
 
 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://maemo.org/mailman/listinfo/maemo-developers
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Tapani Pälli
ext Frantisek Dufka wrote:
 Johan Bilien wrote:

 http://maemo.org/platform/docs/api/libosso/html/index.html

 You can register a callback with osso_hw_set_event_cb, set the
 system_inactivity_ind flag in the osso_hw_state_t argument.


 Will this callback be called even without processing gtk/glib loop?

Yes

 If not is there other way how to check for blanked display e.g. from
 SDL app? How SDL games shipped with device do that?


Nope, but this shouldn't be problem. Just include libosso.h and use the
functions.

 Frantisek

 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://maemo.org/mailman/listinfo/maemo-developers


// Tapani

___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Eero Tamminen
Hi,

 http://maemo.org/platform/docs/api/libosso/html/index.html

 You can register a callback with osso_hw_set_event_cb, set the
 system_inactivity_ind flag in the osso_hw_state_t argument.

 Will this callback be called even without processing gtk/glib loop?
 If not is there other way how to check for blanked display e.g. from SDL
 app? How SDL games shipped with device do that?

I think the app loses focus when the screen is blanked.
So, the SDL app could catch screen focus events and do
some additional checks when that happens.  Can the device
state be checked e.g. from some file on the filesystem
(it would be better if SDL apps wouldn't need to use/link
D-BUS)?

Whether app is top one can be checked from a Matchbox
maintained (root?) window X property I think.

Or SDL app could always pause when it loses focus...


- Eero
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Kimmo Hämäläinen
On Thu, 2006-12-14 at 11:16 +0200, ext Eero Tamminen wrote:
 Hi,
 
  http://maemo.org/platform/docs/api/libosso/html/index.html
 
  You can register a callback with osso_hw_set_event_cb, set the
  system_inactivity_ind flag in the osso_hw_state_t argument.
 
  Will this callback be called even without processing gtk/glib loop?
  If not is there other way how to check for blanked display e.g. from SDL
  app? How SDL games shipped with device do that?
 
 I think the app loses focus when the screen is blanked.
 So, the SDL app could catch screen focus events and do
 some additional checks when that happens.  Can the device
 state be checked e.g. from some file on the filesystem
 (it would be better if SDL apps wouldn't need to use/link
 D-BUS)?

AFAIK, it's not possible. MCE has D-Bus interface only. D-Bus is used so
much in Maemo that it's quite hard to not use it :P

BR; Kimmo

 
 Whether app is top one can be checked from a Matchbox
 maintained (root?) window X property I think.
 
 Or SDL app could always pause when it loses focus...
 
 
   - Eero
 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://maemo.org/mailman/listinfo/maemo-developers
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread David Weinehall
On tor, 2006-12-14 at 11:01 +0200, ext Kimmo Hämäläinen wrote:
 On Wed, 2006-12-13 at 15:22 -0800, ext Aaron Levinson wrote:
  On Wed, 13 Dec 2006, Johan Bilien wrote:
  
   On Wed, Dec 13, 2006, Aaron Levinson wrote:
In the Maemo coding style and programming guidelines document on
maemo.org, it states the following:  Avoid updating the GUI when the
application running on the background and when the screen has been 
turned
off. Remove unnecessary graphical elements or constantly updated screen
components.  Now, it appears that hildon_window_get_is_topmost() or
hildon_program_get_is_topmost() can be used to determine if an 
application
is running in the background, but how does one programmatically 
determine
if the screen has been turned off?  I see in the latest version of 
libosso
in SVN that there is a muali API that provides the ability to access the
information via a callback, but it is unclear how to determine this on 
2.0
or 2.1.  Perhaps I can use XScreenSaverQueryInfo() ?
   
   http://maemo.org/platform/docs/api/libosso/html/index.html
   
   You can register a callback with osso_hw_set_event_cb, set the
   system_inactivity_ind flag in the osso_hw_state_t argument.
  
  Well, I had already examining the libosso APIs before sending the e-mail,
  and I did notice the system_inactivity_ind flag in the osso_hw_state_t
  struct.  However, according to the libosso documentation, if the callback
  is called for system inactivity, this means that the application should
  reduce its activity.  I didn't directly associate this text with the
  screen being blanked, which I think is understandable, since screen
  blanking is not the same thing.
  
  What are the conditions that result in the callback for the system 
  inactivity indicator being called?  The statement the application should 
  reduce its activity is somewhat open-ended, and perhaps this callback is 
  used for more than just to indicate that the screen has been blanked.
 
 It's not clear to me either, but you can use the system_inactivity_ind
 for the display on/off information as well (I added that to the trunk
 libosso.h). I have verified this from the MCE guys some time ago.

(MCE guys -- that'd be me, I guess?)

Basically, the system_inactivity_ind should not be used for display
on/off information, since activity is supposed to be tied to user
activity, not screen state; the system can be inactive but still have
the display on (however, MCE will not report it as inactive in that
case).  Sadly some applications relies on the display - activity
connection, so MCE reports display on as activity, and it will still
remain supported for a few releases to come.  However, I want to make it
clear that this is not the proper way to do it, and that such an
assumption will be incorrect in the long run. 

 I guess the big problem is that there really hasn't been any proper way
to do things...  The next version of MCE will introduce a new D-Bus
signal for this purpose (display_status_ind, and the companion
method-call get_display_status), and one or two releases later the old
behaviour will no longer be supported.  Hopefully these signals will
also be taken in use by libosso.

[snip]


Regards: David
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Frantisek Dufka

Eero Tamminen wrote:

I think the app loses focus when the screen is blanked.
So, the SDL app could catch screen focus events and do
some additional checks when that happens.


Good idea, thanks.



Or SDL app could always pause when it loses focus...



This is good for video updates but sometimes not good for sound or AI 
code in games. Of course when the device is really inactive (whatever 
that means exactly) sound and other stuff should be stopped too.


Frantisek


___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-14 Thread Tapani Pälli
ext Frantisek Dufka wrote:
 Eero Tamminen wrote:
 I think the app loses focus when the screen is blanked.
 So, the SDL app could catch screen focus events and do
 some additional checks when that happens.

 Good idea, thanks.


 Or SDL app could always pause when it loses focus...


 This is good for video updates but sometimes not good for sound or AI
 code in games. Of course when the device is really inactive (whatever
 that means exactly) sound and other stuff should be stopped too.


HW independent idea : a timer that pauses the game when user has not
pushed button/screen for x seconds. Not very good for chess or
civilization but very good for a gauntlet clone.

 Frantisek


 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://maemo.org/mailman/listinfo/maemo-developers


// Tapani

___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


[maemo-developers] How to determine if the screen has turned off?

2006-12-13 Thread Aaron Levinson
In the Maemo coding style and programming guidelines document on
maemo.org, it states the following:  Avoid updating the GUI when the
application running on the background and when the screen has been turned
off. Remove unnecessary graphical elements or constantly updated screen
components.  Now, it appears that hildon_window_get_is_topmost() or
hildon_program_get_is_topmost() can be used to determine if an application
is running in the background, but how does one programmatically determine
if the screen has been turned off?  I see in the latest version of libosso
in SVN that there is a muali API that provides the ability to access the
information via a callback, but it is unclear how to determine this on 2.0
or 2.1.  Perhaps I can use XScreenSaverQueryInfo() ?

Thanks,
Aaron

___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-13 Thread Johan Bilien
On Wed, Dec 13, 2006, Aaron Levinson wrote:
 In the Maemo coding style and programming guidelines document on
 maemo.org, it states the following:  Avoid updating the GUI when the
 application running on the background and when the screen has been turned
 off. Remove unnecessary graphical elements or constantly updated screen
 components.  Now, it appears that hildon_window_get_is_topmost() or
 hildon_program_get_is_topmost() can be used to determine if an application
 is running in the background, but how does one programmatically determine
 if the screen has been turned off?  I see in the latest version of libosso
 in SVN that there is a muali API that provides the ability to access the
 information via a callback, but it is unclear how to determine this on 2.0
 or 2.1.  Perhaps I can use XScreenSaverQueryInfo() ?

http://maemo.org/platform/docs/api/libosso/html/index.html

You can register a callback with osso_hw_set_event_cb, set the
system_inactivity_ind flag in the osso_hw_state_t argument.

-- 
Johan Bilien
[EMAIL PROTECTED]
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


Re: [maemo-developers] How to determine if the screen has turned off?

2006-12-13 Thread Johan Bilien

Aaron Levinson wrote:




Well, I had already examining the libosso APIs before sending the e-mail,
and I did notice the system_inactivity_ind flag in the osso_hw_state_t
struct.  However, according to the libosso documentation, if the callback
is called for system inactivity, this means that the application should
reduce its activity.  I didn't directly associate this text with the
screen being blanked, which I think is understandable, since screen
blanking is not the same thing.

What are the conditions that result in the callback for the system 
inactivity indicator being called?  The statement the application should 
reduce its activity is somewhat open-ended, and perhaps this callback is 
used for more than just to indicate that the screen has been blanked.
 



Right, screen blanking is the only occasion where I have seen this 
callback triggered, but maybe it's used in other cases, Kimmo?


--
Johan
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers