Commit 1442b0b1 authored by Jabier Arraiza's avatar Jabier Arraiza

Try to fix issue with focus with thomas and add also stops to combos and unitcombos

parent 6c3ff075
Pipeline #65963411 failed with stages
in 34 minutes
......@@ -45,7 +45,8 @@ public:
_sort = sort;
signal_changed().connect(signal_attr_changed().make_slot());
gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
signal_scroll_event().connect(sigc::mem_fun(*this, &ComboBoxEnum<E>::on_scroll_event));
_model = Gtk::ListStore::create(_columns);
set_model(_model);
......@@ -73,6 +74,8 @@ public:
_sort = sort;
signal_changed().connect(signal_attr_changed().make_slot());
gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
signal_scroll_event().connect(sigc::mem_fun(*this, &ComboBoxEnum<E>::on_scroll_event));
_model = Gtk::ListStore::create(_columns);
set_model(_model);
......@@ -152,6 +155,11 @@ public:
}
};
bool on_scroll_event(GdkEventScroll* event)
{
return false;
}
void set_active_by_key(const Glib::ustring& key) {
setProgrammatically = true;
set_active_by_id( _converter.get_id_from_key(key) );
......
......@@ -1177,7 +1177,7 @@ void SelectedStyle::on_opacity_changed ()
_("Change opacity"));
// resume interruptibility
_desktop->getCanvas()->endForcedFullRedraws();
spinbutton_defocus(GTK_WIDGET(_opacity_sb.gobj()));
// spinbutton_defocus(GTK_WIDGET(_opacity_sb.gobj()));
_opacity_blocked = false;
}
......
......@@ -25,7 +25,8 @@ SpinButton::connect_signals() {
signal_focus_in_event().connect(sigc::mem_fun(*this, &SpinButton::on_my_focus_in_event));
signal_key_press_event().connect(sigc::mem_fun(*this, &SpinButton::on_my_key_press_event));
gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
signal_scroll_event().connect(sigc::mem_fun(*this, &SpinButton::on_my_scroll_event));
signal_scroll_event().connect(sigc::mem_fun(*this, &SpinButton::on_scroll_event));
set_focus_on_click(true);
};
int SpinButton::on_input(double* newvalue)
......@@ -66,16 +67,18 @@ bool SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/)
return false; // do not consume the event
}
bool SpinButton::on_my_scroll_event(GdkEventScroll* event)
bool SpinButton::on_scroll_event(GdkEventScroll *event)
{
if (!property_has_focus()) {
if (!is_focus()) {
return false;
}
double step, page;
get_increments(step, page);
if (event->state & GDK_CONTROL_MASK) {
step = page;
}
/*if (event->state & GDK_CONTROL_MASK) {
page = step;
} */
double change = 0.0;
if (event->direction == GDK_SCROLL_UP) {
change = step;
......
......@@ -46,7 +46,7 @@ public:
connect_signals();
};
~SpinButton() override = default;;
~SpinButton() override = default;
// noncopyable
SpinButton(const SpinButton&) = delete;
......@@ -84,8 +84,7 @@ protected:
* @retval false continue with default handler.
* @retval true don't call default handler.
*/
bool on_my_scroll_event(GdkEventScroll* event);
bool on_scroll_event(GdkEventScroll* event);
/**
* Handle specific keypress events, like Ctrl+Z.
*
......
......@@ -21,6 +21,8 @@ namespace Widget {
UnitMenu::UnitMenu() : _type(UNIT_TYPE_NONE)
{
set_active(0);
gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
signal_scroll_event().connect(sigc::mem_fun(*this, &UnitMenu::on_scroll_event));
}
UnitMenu::~UnitMenu() = default;
......@@ -132,6 +134,11 @@ bool UnitMenu::isRadial() const
return getUnitType() == UNIT_TYPE_RADIAL;
}
bool UnitMenu::on_scroll_event(GdkEventScroll* event)
{
return false;
}
} // namespace Widget
} // namespace UI
} // namespace Inkscape
......
......@@ -122,6 +122,10 @@ public:
protected:
UnitType _type;
/**
* block scroll from widget if is inside a scrolled window.
*/
bool on_scroll_event(GdkEventScroll* event);
};
} // namespace Widget
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment