John Spray <[EMAIL PROTECTED]> writes: | Hi, > | When writing the box dialog, I noticed that all mouse clicks were having | the button-1 effect. This was because the gdk mouse button integer was | being cast straight to a mouse_button::state, so 1 converted correctly | but other values didn't. Patch attached. > | John > | Index: GWorkArea.C | =================================================================== | RCS file: /cvs/lyx/lyx-devel/src/frontends/gtk/GWorkArea.C,v | retrieving revision 1.17 | diff -u -p -r1.17 GWorkArea.C | --- GWorkArea.C 2004/10/11 16:58:17 1.17 | +++ GWorkArea.C 2004/11/04 19:35:25 | @@ -358,6 +358,24 @@ bool GWorkArea::onScrollWheel(GdkEventSc | } | | | +mouse_button::state GWorkArea::gButtonToLyx(guint gdkbutton) | +{ | + // GDK uses int 1,2,3 but lyx uses enums (1,2,4) | + switch (gdkbutton) { | + case 1: | + return mouse_button::button1; | + case 2: | + return mouse_button::button2; | + case 3: | + return mouse_button::button3; | + case 4: | + return mouse_button::button4; | + case 5: | + return mouse_button::button5; | + } | +}
Why not a freestanding function? Should be no need to have this in GWorkArea? | Index: GWorkArea.h | =================================================================== | RCS file: /cvs/lyx/lyx-devel/src/frontends/gtk/GWorkArea.h,v | retrieving revision 1.14 | diff -u -p -r1.14 GWorkArea.h | --- GWorkArea.h 2004/09/27 19:04:17 1.14 | +++ GWorkArea.h 2004/11/04 19:35:25 | @@ -15,6 +15,7 @@ | #include "GPainter.h" | | #include "frontends/WorkArea.h" | +#include "frontends/mouse_state.h" | | #include <gtkmm.h> | #include <gtk/gtk.h> | @@ -91,6 +92,7 @@ private: | bool onConfigure(GdkEventConfigure * event); | void onScroll(); | bool onScrollWheel(GdkEventScroll * event); | + mouse_button::state gButtonToLyx(guint gdkbutton); until used in other places as well, just put it in anon namespace in GWorkArea.C. -- Lgb