mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
fix interpreting of gdk mouse button numbers
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9170 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
456e7098b5
commit
5b9330bb8e
@ -1,3 +1,9 @@
|
|||||||
|
2004-11-04 John Spray <spray_john@users.sourceforge.net>
|
||||||
|
|
||||||
|
* GWorkArea.C: convert GdkEventButton->state from
|
||||||
|
gdk mouse button ids into mouse_button::state
|
||||||
|
using gButtonToLyx function
|
||||||
|
|
||||||
2004-10-23 John Spray <spray_john@users.sourceforge.net>
|
2004-10-23 John Spray <spray_john@users.sourceforge.net>
|
||||||
|
|
||||||
* ghelpers.[Ch]: Add buildLengthUnitList() to get vector of
|
* ghelpers.[Ch]: Add buildLengthUnitList() to get vector of
|
||||||
|
@ -26,8 +26,32 @@ using std::string;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
ColorCache colorCache;
|
namespace {
|
||||||
|
|
||||||
|
mouse_button::state 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This shouldn't happen, according to gdk docs
|
||||||
|
lyxerr << "gButtonToLyx: unhandled button index\n";
|
||||||
|
return mouse_button::button1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
ColorCache colorCache;
|
||||||
|
|
||||||
Gdk::Color * ColorCache::getColor(LColor_color clr)
|
Gdk::Color * ColorCache::getColor(LColor_color clr)
|
||||||
{
|
{
|
||||||
@ -377,7 +401,7 @@ bool GWorkArea::onButtonPress(GdkEventButton * event)
|
|||||||
dispatch(FuncRequest(ka,
|
dispatch(FuncRequest(ka,
|
||||||
static_cast<int>(event->x),
|
static_cast<int>(event->x),
|
||||||
static_cast<int>(event->y),
|
static_cast<int>(event->y),
|
||||||
static_cast<mouse_button::state>(event->button)));
|
gButtonToLyx(event->button)));
|
||||||
workArea_.grab_focus();
|
workArea_.grab_focus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -388,7 +412,7 @@ bool GWorkArea::onButtonRelease(GdkEventButton * event)
|
|||||||
dispatch(FuncRequest(LFUN_MOUSE_RELEASE,
|
dispatch(FuncRequest(LFUN_MOUSE_RELEASE,
|
||||||
static_cast<int>(event->x),
|
static_cast<int>(event->x),
|
||||||
static_cast<int>(event->y),
|
static_cast<int>(event->y),
|
||||||
static_cast<mouse_button::state>(event->button)));
|
gButtonToLyx(event->button)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user