On Sat, Jul 11, 2009 at 12:09, Andrew Flegg<[email protected]> wrote:
> On Sat, Jul 11, 2009 at 08:28, Faheem Pervez<[email protected]> wrote:
>
>> FocusOut event, serial 20, synthetic NO, window 0x1600001,
>> mode NotifyNormal, detail NotifyNonlinear
>
> I had a thought about using focus-in/out and checking
> window.get_property("is-topmost") - unfortunately, the value of that
> property doesn't seem reliable enough (or, rather, the focus-out fires
> before the window is minimised)
Right, my current strategy - which seems to work in Diablo[1] and on a
GTK+ desktop - is as follows, in Pythonesque pseudo-code:
--------8<--------
visible = True
paused = False
def osso_state_change(shutdown, save_unsaved_data, memory_low,
system_inactivity, message, widget):
paused = system_inactivity
set_visible(not paused)
def do_window_state_event(self, window, event):
set_visible(not event.new_window_state &
(gtk.gdk.WINDOW_STATE_ICONIFIED
|gtk.gdk.WINDOW_STATE_WITHDRAWN))
def do_focus_in_event(self, widget, event):
set_visible(True)
def do_expose_event(self, event):
topmost = self.app_window.get_property('is-topmost')
self.set_visible(not self.paused and topmost)
...
def set_visible(self, visible):
if (visible == self.visible):
return
if (visible):
my_custom_redraw_and_invalidate()
gobject.timeout_add(self.freq, my_custom_redraw_and_invalidate)
def my_custom_redraw_and_invalidate():
...
return visible
------->8-------
Since "expose-event" is firing regularly anyway (because of
my_custom_redraw_and_invalidate), it can check the 'is-topmost'
property of HildonWindow[2].
The application can't get focus without it being on top, so if a
"focus-in-event" is received, assume we're visible again.
Comments, as ever, welcome.
Cheers,
Andrew
[1] Fremantle has no app switching, so not easy to test.
[2] Interestingly, is-topmost is still true even when the display
is blanked.
--
Andrew Flegg -- mailto:[email protected] | http://www.bleb.org/
Maemo Community Council chair
_______________________________________________
maemo-developers mailing list
[email protected]
https://lists.maemo.org/mailman/listinfo/maemo-developers