summaryrefslogtreecommitdiff
path: root/src/gui/widgets/table.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/table.cpp')
-rw-r--r--src/gui/widgets/table.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index 66ee3857..f353c6fe 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -462,6 +462,15 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
{
+ if (mouseEvent.getButton() != gcn::MouseEvent::LEFT)
+ return;
+
+ // Make table selection update on drag
+ const int x = std::max(0, mouseEvent.getX());
+ const int y = std::max(0, mouseEvent.getY());
+
+ setSelectedRow(getRowForY(y));
+ setSelectedColumn(getColumnForX(x));
}
// -- TableModelListener notifications