Re: crazy behaviour of GtkFixed children
- From: John Cupitt <jcupitt gmail com>
- To: Calin Vatavu <cvatavu skim com>
- Cc: gtk-list gnome org
- Subject: Re: crazy behaviour of GtkFixed children
- Date: Mon, 18 Jul 2005 08:46:49 +0100
Hi,
On 7/18/05, Calin Vatavu <cvatavu skim com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]