Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-01-29 13:51:31 +0000
committerStijn Buys <ingar@osirion.org>2012-01-29 13:51:31 +0000
commit398f3df8af02047a76ab7172c69d93313250260c (patch)
tree0a4925510726d74b23d84115c56de0ca4042643e /src/ui/ui.cc
parentf320ee25c74b6f24db58d97c0129de6e94db3345 (diff)
FS#80 Have mouse focus stick to the widget when the mouse button is down.
Diffstat (limited to 'src/ui/ui.cc')
-rw-r--r--src/ui/ui.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index 4977d03..e10d77a 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -87,6 +87,8 @@ UI::UI() : Window(0)
mouse_pointer_color = Palette::Pointer;
mouse_pointer_bitmap.assign("pointer");
+
+ mouse_buttonleft_pressed = false;
}
UI::~UI()
@@ -249,12 +251,18 @@ void UI::list_visible() const
void UI::frame()
{
ui_input_focus = find_input_focus();
- Widget *f = find_mouse_focus(mouse_cursor);
+
+ Widget *f = 0;
+ if (!mouse_buttonleft_pressed) {
+ f = find_mouse_focus(mouse_cursor);
+ } else {
+ f = find_visible_child(ui_mouse_focus);
+ }
if (f) {
f->event_mouse(mouse_cursor);
}
ui_mouse_focus = f;
-
+
// reset mouse pointer
ui::root()->set_pointer("pointer");
@@ -288,6 +296,9 @@ bool UI::input_key(const bool pressed, const int key, const unsigned int modifie
ui_input_focus = f;
} else if (key < 564) {
+ if ( key == 512 + SDL_BUTTON_LEFT) {
+ mouse_buttonleft_pressed = pressed;
+ }
// mouse buttons
Widget *f = find_mouse_focus(mouse_cursor);
if (f) {