2007/4/8, Sean Luke <[EMAIL PROTECTED]>:
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.
Attached is a revised version of the test app, that doesn't show the
bug at least (changes commented below).
Few notes on dragging:
- The tearing is due to the poor screen update rate (basically a hw limitation)
- I'm under the impression that there is some (heavy?) filtering
going on wrt touchscreen input (to check the pressure data and so on),
and also physical limits of the touchscreen I guess (it's really easy
to make it think you lifted the stylys for example). Both of these
have an impact on how well the dragging will work.
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.
g = gtk.Window(gtk.WINDOW_POPUP)
works fine.
We
then
# delete the separator and make the window bright blue.
g = gtk.Dialog()
g.set_has_separator(False)
g.set_decorated(False)
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
BUTTON_PRESSED,
# no BUTTON_PRESSED event actually gets through -- instead,
MOTION_NOTIFY
# starts coming in incorrectly. Looks like another bug. So we have to
# use a Button to grab the BUTTON_PRESSED events...
b = gtk.Button()
g.vbox.add(b)
I don't know what you tried here with the event mask, but
g.add_events(gtk.gdk.BUTTON_PRESS_MASK)
works just fine here (maybe it's the dialog that didn't work with this?)
--
Kalle Vahlman, [EMAIL PROTECTED]
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
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()
_______________________________________________
maemo-developers mailing list
[email protected]
https://maemo.org/mailman/listinfo/maemo-developers