summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-10-13 13:59:01 +0200
committerMatthias Melcher <github@matthiasm.com>2023-10-13 13:59:01 +0200
commit58b13b868e9be35e2b516a72a736b8c61178467a (patch)
tree3e28043094070c79871fe35c67943581e307d738 /fluid
parentb1321bb97e254a5aa4d5ed6eef03d89a3892d1f9 (diff)
FLUID: allow mousewheel events on coordinate input
MACOS: make sure that even small mouse wheel deltas count at least as 1 unit
Diffstat (limited to 'fluid')
-rw-r--r--fluid/custom_widgets.cxx16
-rw-r--r--fluid/custom_widgets.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/fluid/custom_widgets.cxx b/fluid/custom_widgets.cxx
index 170ef44a2..f409e9761 100644
--- a/fluid/custom_widgets.cxx
+++ b/fluid/custom_widgets.cxx
@@ -292,3 +292,19 @@ void Fluid_Coord_Input::value(int v) {
fl_snprintf(buf, sizeof(buf), "%d", v);
text(buf);
}
+
+/**
+ Allow vertical mouse dragging and mouse wheel to interactively change the value.
+ */
+int Fluid_Coord_Input::handle(int event) {
+ switch (event) {
+ case FL_MOUSEWHEEL:
+ if (Fl::event_dy()) {
+ value( value() - Fl::event_dy() );
+ set_changed();
+ do_callback(FL_REASON_CHANGED);
+ }
+ return 1;
+ }
+ return Fl_Input::handle(event);
+}
diff --git a/fluid/custom_widgets.h b/fluid/custom_widgets.h
index 8a464ae82..36abc1414 100644
--- a/fluid/custom_widgets.h
+++ b/fluid/custom_widgets.h
@@ -83,6 +83,8 @@ public:
vars_ = vars;
vars_user_data_ = user_data;
}
+
+ int handle(int) override;
};
#endif