From: arif Date: Thu, 4 Jun 2009 19:13:34 +0000 (+0000) Subject: mouse wheel issue..third attempt....get fixed already!!!!! X-Git-Tag: LAST_LIBGRAPH~32^2~1945 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=338d494a55427c946d80ec434469b88e27a33a5f;p=graphviz mouse wheel issue..third attempt....get fixed already!!!!! --- diff --git a/cmd/smyrna/gltemplate.c b/cmd/smyrna/gltemplate.c index 21149870a..c68810ca7 100755 --- a/cmd/smyrna/gltemplate.c +++ b/cmd/smyrna/gltemplate.c @@ -393,16 +393,23 @@ static gboolean button_release_event(GtkWidget * widget, static gboolean scroll_event(GtkWidget * widget, GdkEventScroll * event, gpointer data) { - g_signal_handlers_disconnect_by_func(G_OBJECT(view->drawing_area),scroll_event,NULL); - if(event->direction==0) - view->mouse.dx = -30; - if(event->direction==1) - view->mouse.dx = 30; - glmotion_zoom(view); - glexpose(); -// g_signal_handlers_unblock_by_func(G_OBJECT(view->drawing_area),scroll_event,NULL); - g_signal_connect(G_OBJECT(view->drawing_area), "scroll_event",G_CALLBACK(scroll_event), NULL); + gdouble seconds; + static int callcount=0; + int fr; + seconds=g_timer_elapsed(view->timer2,NULL); + if (seconds > 0.005) + { + g_timer_stop(view->timer2); + if(event->direction==0) + view->mouse.dx=-30; + if(event->direction==1) + view->mouse.dx=+30; + glmotion_zoom(view); + glexpose(); + g_timer_start(view->timer2); + + } return TRUE; } diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index ec7e1f0bf..6109a4281 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -516,6 +516,8 @@ typedef struct _ViewInfo Agraph_t* default_attributes; /*timer for animations*/ GTimer* timer; + /*this timer is session timer and always active*/ + GTimer* timer2; int active_frame; int total_frames; int frame_length; diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 7f0eaff18..2e4a01dc3 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -451,6 +451,8 @@ void init_viewport(ViewInfo * view) view->Topview->parms.repos.distortion = 1.0; /*create timer*/ view->timer=g_timer_new(); + view->timer2=g_timer_new(); + g_timer_stop(view->timer); view->active_frame=0; view->total_frames=1500;