From 9a77f14b5c9fe1244e7adf02ee263083f7adf721 Mon Sep 17 00:00:00 2001 From: gambas Date: Mon, 7 Jan 2019 22:44:03 +0100 Subject: [PATCH] Do not propagate mouse wheel events of ComboBox, TextArea, Slider and ScrollBar, as in Qt components. [GB.GTK] * BUG: Do not propagate mouse wheel events of ComboBox, TextArea, Slider and ScrollBar, as in Qt components. [GB.GTK3] * BUG: Do not propagate mouse wheel events of ComboBox, TextArea, Slider and ScrollBar, as in Qt components. --- gb.gtk/src/gapplication.cpp | 9 ++++++--- gb.gtk/src/gcombobox.cpp | 1 + gb.gtk/src/gcontrol.cpp | 1 + gb.gtk/src/gcontrol.h | 1 + gb.gtk/src/gslider.cpp | 1 + gb.gtk/src/gtextarea.cpp | 1 + 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index 57790c9ad..fa75aff3c 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -787,9 +787,12 @@ __FOUND_WIDGET: goto __SCROLL_TRY_PROXY; } - control = control->parent(); - if (control) - goto __SCROLL_TRY_PROXY; + if (!control->_use_wheel) + { + control = control->parent(); + if (control) + goto __SCROLL_TRY_PROXY; + } if (widget != save_control->border && widget != save_control->widget) { diff --git a/gb.gtk/src/gcombobox.cpp b/gb.gtk/src/gcombobox.cpp index 928e4d7de..63ef97e28 100644 --- a/gb.gtk/src/gcombobox.cpp +++ b/gb.gtk/src/gcombobox.cpp @@ -265,6 +265,7 @@ gComboBox::gComboBox(gContainer *parent) : gTextBox(parent, true) entry = NULL; _button = NULL; cell = NULL; + _use_wheel = true; g_typ = Type_gComboBox; diff --git a/gb.gtk/src/gcontrol.cpp b/gb.gtk/src/gcontrol.cpp index 466578483..ce6709154 100644 --- a/gb.gtk/src/gcontrol.cpp +++ b/gb.gtk/src/gcontrol.cpp @@ -315,6 +315,7 @@ void gControl::initAll(gContainer *parent) _inside = false; _no_auto_grab = false; _no_background = false; + _use_wheel = false; _scrollbar = SCROLL_NONE; _input_method = NULL; diff --git a/gb.gtk/src/gcontrol.h b/gb.gtk/src/gcontrol.h index 115575a91..7c7999ffe 100644 --- a/gb.gtk/src/gcontrol.h +++ b/gb.gtk/src/gcontrol.h @@ -258,6 +258,7 @@ public: unsigned _inside : 1; // if we got an enter event, but not a leave event yet. unsigned _no_auto_grab : 1; // do not automatically grab widget on button press event unsigned _no_background : 1; // Don't draw the background automatically + unsigned _use_wheel : 1; // Do not propagate the mouse wheel event void removeParent() { pr = NULL; } void initSignals(); diff --git a/gb.gtk/src/gslider.cpp b/gb.gtk/src/gslider.cpp index f60ab9165..a744a5400 100644 --- a/gb.gtk/src/gslider.cpp +++ b/gb.gtk/src/gslider.cpp @@ -75,6 +75,7 @@ void gSlider::init() { GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(widget)); + _use_wheel = true; onChange = NULL; g_signal_connect(adj, "value-changed", G_CALLBACK(cb_change), (gpointer)this); diff --git a/gb.gtk/src/gtextarea.cpp b/gb.gtk/src/gtextarea.cpp index a6bd68dbf..0e1a2d90a 100644 --- a/gb.gtk/src/gtextarea.cpp +++ b/gb.gtk/src/gtextarea.cpp @@ -477,6 +477,7 @@ gTextArea::gTextArea(gContainer *parent) : gControl(parent) _not_undoable_action = 0; _undo_in_progress = false; _has_input_method = true; + _use_wheel = true; onChange = 0; onCursor = 0;