import gtk

# We create a Dialog because maemo has hard-locked gtk.Window to be
# 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.Window(gtk.WINDOW_POPUP)
g.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0,0,65535))
g.resize(100,100)
g.move(300,300)

# 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...
g.add_events(gtk.gdk.BUTTON_PRESS_MASK)

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