[maemo-developers] Moving windows in Maemo

From: Sean Luke sean at cs.gmu.edu
Date: Sun Apr 8 18:20:45 EEST 2007
I'm wondering if anyone has had previous experience in moving windows  
in maemo.  I'm experimenting with various things which involve small  
movable or resizable windows.  Yeah, yeah, I know that Nokia's UI  
guidelines foolishly declare that you can't move any windows, and  
that all drag-and-drop must stop at the app windows' edge.

Anyway, I whipped up the following little program below as a test and  
low and behold I can get the window to drag around BUT it creates all  
sorts of artifacts: screen tearing, a bizarre window flashing in the  
top-left corner, and slow updates.  The window moves very slowly  
too.  Not what I would have expected for a 300MHz machine.  There are  
three possibilities:

- I'm doing window moves all wrong.  The most likely case: in which  
case, how do I do it right?
- This bug was never caught by Nokia because it's a use case they  
didn't expect due to their UI guidelines.
- [conspiracy theorist alert :-)] Nokia specified the UI guidelines  
the way they did in order to avoid fixing this bug.  :-)

I strongly suspect the first.  Anyone tried to do this before?  No  
doubt I'm screwing something up.  I'm running on an N800, not  
upgraded yet.


import gtk

# We create a Dialog because maemo has hard-locked gtk.Window to be  
the full
# size of the screen, and I've found now way to counteract that.  We  
# delete the separator and make the window bright blue.
g = gtk.Dialog()
g.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0,0,65535))

# We add a button to the Dialog and try to move after the Button has
# been pushed because if you set Dialog's mask to include  
# no BUTTON_PRESSED event actually gets through -- instead,  
# starts coming in incorrectly.  Looks like another bug.  So we have to
# use a Button to grab the BUTTON_PRESSED events...
b = gtk.Button()

# I'm using begin_move_drag here, but if I implement it myself with  
# the same exact buggy artifacts occur.
b.connect("button_press_event", lambda widget, event:
	event.x + g.window.get_root_origin()[0],
	event.y + g.window.get_root_origin()[1], event.time))

More information about the maemo-developers mailing list