1. This bit must come _before_ any drawing in GDK_MOTION_NOTIFY:
if ( event_context->within_tolerance && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance ) && ( abs( (gint) event->motion.y - event_context->yp ) < event_context->tolerance ) ) { break; // do not drag if we're within tolerance from origin } // Once the user has moved farther than tolerance from the original location // (indicating they intend to draw, not click), then always process the // motion notify coordinates as given (no snapping back to origin) event_context->within_tolerance = false;
Its purpose is to do nothing if the mouse hasn't trespassed tolerance limit from the origin. However in arc-context (and probably elsewhere) you have sp_arc_drag() before it, which kinda defeats its purpose.
2. event_context->xp and xy should be reset to 0 in GDK_BUTTON_RELEASE, just in case.
3. Like I said, tolerance can be a local variable, i.e. instead of
event_context->tolerance = prefs_get_int_attribute_limited ("options.dragtolerance", "value", 0, 0, 100);
you can have
guint tolerance = prefs_get_int_attribute_limited ("options.dragtolerance", "value", 0, 0, 100);
and remove it from SPEventContext.
4. Cosmetics: please fix indentation (I don't care tabs or spaces, but the nesting structure must be indented properly), AUTHORS should remain alphabetical, and remove the "hello" :)
Other than that, good work! Now what remains is the cosmetic/behavior of spinbuttons (focus, keys, font size - as in rect) and, most importantly, spinbuttons' event handlers and listeners to track selection.
_________________________________________________________________ http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI...
bulia byak wrote:
&& ( abs( (gint) event->motion.x - event_context->xp )
< event_context->tolerance ) && ( abs( (gint) event->motion.y - event_context->yp ) < event_context->tolerance ) ) {
when you see this pattern you should realise that it is a distance comparison. in this case you could replace it with NR::LInfty(d) < event_context->tolerance
I also think it would be worth moving the conversion to NR::Point back into GdkEvent or similar. (not sure how, perhaps inherit from gdkevent and provide an accessor function?)
p.s. you needed to set CVS_RSH=ssh .
njh
participants (2)
-
bulia byak
-
Nathan Hurst