Re: crazy behaviour of GtkFixed children

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 7/18/05, Calin Vatavu <cvatavu@xxxxxxxx> wrote:
> I'm trying to achieve a canvas-like functionality using a GtkFixed widget. I know, there's GnomeCanvas, but I can't use it, it's buggy on win32. The problem is, when I'm trying to move a widget it starts shaking, like having a double. You can try it for yourself.
> Where am I doing wrong? Is there any alternative?

I've not tried your code, but this behaviour usually comes from some
kind of feedback in absolute and relative positioning.

The trick is to use screen coordinates. When you get button down, note
the position of the widget and note the position of the mouse stored
in button.x_root (the mouse position in absolute screen coordinates).

When you get a drag event, compare the current position of the mouse
to the stored position (again, use motion.x_root) to find how far the
mouse has moved, then add that displacement to the original widget
position and set that as the new widget position. Never read the
current position of the widget being dragged during a drag and you
won't get feedback.

You'll find this kind of thing even more important when you add auto
scroll, heh.

John
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux