Hi Peter and all,

I've fixed the mouse_wx/y issue with the last 3 commits of
http://repo.or.cz/w/geda-gaf/werner.git?a=shortlog;h=refs/heads/w_coords2

I've removed the global mouse_wx/y variables. I'm now using the 
gtk_widget_get_pointer() function to get the position of the pointer 
whenever a hotkey action is triggered.

The gtk function is encapsulated in the function 
x_event_get_pointer_position(). Thus I can get the pointer position in 
world coords, snapped or unsnapped and with a boolean result, whether 
the pointer is inside the drawing area.

The boolean result is used in the callbacks to ignore all hotkey action 
if the pointer is outside the drawing area. 

This function is used now in all places where the pointer position is 
required.
 * gschem callbacks
 * preview widget
 * attribedit dialog


This commits should fix several issues with the current code.

The global mouse_wx/y variable was used in the preview widgets and the 
drawing area. The variables got updated whenever a motion event was 
triggered.

There have been several actions, where no motion is done and the 
following actions have been using the wrong values of the mouse 
position.

* The motion was done in a preview, then the focus changed to the main 
window (without motion using ALT-tab) followed by an hotkey action like 
draw line --> wrong start coords.

* The world position changed without changing the screen position. This 
happens with zoom and panning actions. If after the zoom/pan action no 
motion event is triggered, the following hotkey action has used the 
wrong coordinate.
(This was a new bug introduced by storing the mouse in world coords)


> There's one known issue: The mouse_wx/y coords are snapped.
> There are 2 cases in i_callbacks.c where this ist not correct.
>
> ./i_callbacks.c:1421:  a_zoom_box_start(w_current, mouse_wx,
> mouse_wy); ./i_callbacks.c:1594:  a_pan(w_current, mouse_wx,
> mouse_wy);

This wrong behaviour is fixed now, too.

> In the discussion with Peter C. on IRC we found some places to
> simplify the source:
>
> * The global variables mouse_wx/y could be integrated into the
>   GSCHEM_TOPLEVEL structure

This wouldn't have solved the issue with world position changes without 
motion event.

Any comments?

I will use the code a few days and push it to the git repo if there are 
no further issues with it.

Regards
Werner


_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to