From ac6a1cd8947023cd680cc599ef07434e0a6f1a9b Mon Sep 17 00:00:00 2001 From: arif Date: Tue, 10 Nov 2009 16:39:40 +0000 Subject: [PATCH] middle button bug fixed --- cmd/smyrna/gltemplate.c | 19 +++++++++++++++++-- cmd/smyrna/gui/appmouse.c | 24 ++++++++++++++++++++---- cmd/smyrna/gui/appmouse.h | 7 +++++++ cmd/smyrna/gui/beacon.c | 3 +-- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/cmd/smyrna/gltemplate.c b/cmd/smyrna/gltemplate.c index adc2cf09e..fb4d21ea5 100755 --- a/cmd/smyrna/gltemplate.c +++ b/cmd/smyrna/gltemplate.c @@ -41,9 +41,13 @@ static glMouseButtonType getGlCompMouseType(int n) switch (n) { case 1: return glMouseLeftButton; + case 2: + return glMouseMiddleButton; case 3: - default: return glMouseRightButton; + + default: + return glMouseLeftButton; } } @@ -280,6 +284,9 @@ static gboolean button_press_event(GtkWidget * widget, if (event->button == 3) //right click appmouse_right_click_down(view,(int) event->x,(int) event->y); + if (event->button == 2) //middle click + appmouse_middle_click_down(view,(int) event->x,(int) event->y); + expose_event(view->drawing_area, NULL, NULL); return FALSE; } @@ -301,9 +308,13 @@ static gboolean button_release_event(GtkWidget * widget, appmouse_left_click_up(view,(int) event->x,(int) event->y); if (event->button == 3) //right click appmouse_right_click_up(view,(int) event->x,(int) event->y); + if (event->button == 2) //right click + appmouse_middle_click_up(view,(int) event->x,(int) event->y); + expose_event(view->drawing_area, NULL, NULL); dx = 0.0; dy = 0.0; + return FALSE; } static gboolean key_press_event(GtkWidget * widget, GdkEventKey * event, gpointer data) @@ -311,7 +322,6 @@ static gboolean key_press_event(GtkWidget * widget, GdkEventKey * event, gpointe view->keymap.down=1; view->keymap.keyVal=event->keyval; -// printf ("key is pressed:%d\n",event->keyval); } static gboolean key_release_event(GtkWidget * widget, GdkEventKey * event, gpointer data) @@ -374,6 +384,11 @@ static gboolean motion_notify_event(GtkWidget * widget, appmouse_right_drag(view,(int)event->x,(int)event->y); redraw = TRUE; } + if((view->mouse.t==glMouseMiddleButton) && (view->mouse.down)) + { + appmouse_middle_drag(view,(int)event->x,(int)event->y); + redraw = TRUE; + } diff --git a/cmd/smyrna/gui/appmouse.c b/cmd/smyrna/gui/appmouse.c index eb63b0d87..1d7146735 100644 --- a/cmd/smyrna/gui/appmouse.c +++ b/cmd/smyrna/gui/appmouse.c @@ -107,8 +107,8 @@ static void appmouse_down(ViewInfo* v,int x,int y) prevX=0; prevY=0; - - + view->Selection.X = view->mouse.GLpos.x; + view->Selection.Y = view->mouse.GLpos.y; } static void appmouse_up(ViewInfo* v,int x,int y) { @@ -172,8 +172,6 @@ void appmouse_right_click_down(ViewInfo* v,int x,int y) v->mouse.t=glMouseRightButton; appmouse_down(v,x,y); - view->Selection.X = view->mouse.GLpos.x; - view->Selection.Y = view->mouse.GLpos.y; } void appmouse_right_click_up(ViewInfo* v,int x,int y) @@ -189,4 +187,22 @@ void appmouse_right_drag(ViewInfo* v,int x,int y) } +void appmouse_middle_click_down(ViewInfo* v,int x,int y) +{ + v->mouse.t=glMouseMiddleButton; + appmouse_down(v,x,y); + + +} +void appmouse_middle_click_up(ViewInfo* v,int x,int y) +{ + appmouse_up(v,x,y); + +} +void appmouse_middle_drag(ViewInfo* v,int x,int y) +{ + + appmouse_drag(v,x,y); + +} diff --git a/cmd/smyrna/gui/appmouse.h b/cmd/smyrna/gui/appmouse.h index 0d6490f79..446a33521 100644 --- a/cmd/smyrna/gui/appmouse.h +++ b/cmd/smyrna/gui/appmouse.h @@ -21,7 +21,14 @@ extern void appmouse_left_click_down(ViewInfo* v,int x,int y); extern void appmouse_left_click_up(ViewInfo* v,int x,int y); extern void appmouse_left_drag(ViewInfo* v,int x,int y); + extern void appmouse_right_click_down(ViewInfo* v,int x,int y); extern void appmouse_right_click_up(ViewInfo* v,int x,int y); extern void appmouse_right_drag(ViewInfo* v,int x,int y); + +extern void appmouse_middle_click_down(ViewInfo* v,int x,int y); +extern void appmouse_middle_click_up(ViewInfo* v,int x,int y); +extern void appmouse_middle_drag(ViewInfo* v,int x,int y); + + #endif diff --git a/cmd/smyrna/gui/beacon.c b/cmd/smyrna/gui/beacon.c index 78ebab90a..8f7cac6f9 100644 --- a/cmd/smyrna/gui/beacon.c +++ b/cmd/smyrna/gui/beacon.c @@ -1,4 +1,3 @@ -/* $Id$Revision: */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** @@ -221,7 +220,7 @@ static void print_node(topview_node * n) val=agget(n->Node,l->attributes[ind]->name); if (val) { - printf("%s: %s\n",l->attributes[ind]->name,val); + printf("%s:%s\n",l->attributes[ind]->name,val); } } -- 2.40.0