Make popovers stay open on spinbutton activate (03c3f33d) · Commits · René de Hesselle / inkscape · GitLab
Wen-Wei Kao
·
2025-11-27
·
via inkscape:windows_ci_14x commits
| Original line number |
Diff line number |
Diff line |
|
@@ -10,7 +10,10 @@ |
|
|
|
|
|
#include "toolbar-menu-button.h"
|
|
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
#include <gtkmm/box.h>
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
#include "ui/util.h"
|
|
|
|
|
|
namespace Inkscape::UI::Widget {
|
|
|
|
|
@@ -45,6 +48,21 @@ void ToolbarMenuButton::init(int priority, std::string tag, Gtk::Box *popover_bo |
|
|
if (is_child) {
|
|
|
_children.emplace_back(pos, child);
|
|
|
}
|
|
|
// When pressing Enter, the spinbutton emits the Activate signal causing the popover to be
|
|
|
// closed. Capture them and do a manual update instead.
|
|
|
for_each_descendant(*child, [&](Gtk::Widget &widget) {
|
|
|
if (Gtk::SpinButton *child_spinbutton = dynamic_cast<Gtk::SpinButton *>(&widget)) {
|
|
|
child_spinbutton->signal_key_press_event().connect([child_spinbutton](GdkEventKey *event) -> bool {
|
|
|
if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) {
|
|
|
child_spinbutton->update();
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
}, false);
|
|
|
}
|
|
|
return ForEachResult::_continue;
|
|
|
});
|
|
|
pos++;
|
|
|
}
|
|
|
}
|
|
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。