summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-05-28 11:50:12 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-05-29 09:47:21 +0200
commit405cf00e4818886b0d3053d03cfb2e3f3a5e8eb8 (patch)
tree4fe7ab6bbc3b5e382bb4df925185ad5b2640f8ef /vcl/unx/gtk3
parentceca4cde363154b0c7e276d65fc87ec94eb0bb9a (diff)
related tdf#160971 gtk3 a11y: Keep new combobox value
Selecting a new value in an editable combobox using the gtk3 VCL plugin using the popup didn't work when that popup was opened using the keyboard, sample scenario: 1) Start Writer 2) Press F6 until the Formatting toolbar has focus 3) Press Tab until the "Font Name" combobox has focus 4) Press Alt+Down to open the combobox popup 5) Press Down key a few times to select another font, e.g. "Carlito" 6) Press Enter to confirm Rather than the newly selected font, the previously set one would still be set in the combobox. Selecting a new font using the popup would work however when clicking the combobox's button using the mouse instead of steps 1-4 above. The problem was that restoring focus was resulting in the newly selected value not getting saved. Backtrace for how the value already got properly saved for the case where the button was previously clicked using the mouse: 1 weld::ComboBox::save_value weld.hxx 853 0x7f19a7af3f81 2 FontNameBox::save_value ctrlbox.hxx 369 0x7f19a7b01f3d 3 (anonymous namespace)::SvxFontNameBox_Base::statusChanged_Impl tbcontrl.cxx 3432 0x7f19a7ad95e0 4 (anonymous namespace)::SvxFontNameToolBoxControl::statusChanged tbcontrl.cxx 3439 0x7f19a7ad8312 5 SfxStatusDispatcher::sendStatusChanged(rtl::OUString const&, com::sun::star::frame::FeatureStateEvent const&)::$_0::operator()(com::sun::star::uno::Reference<com::sun::star::frame::XStatusListener> const&) const unoctitm.cxx 132 0x7f19a98ae241 6 comphelper::OInterfaceContainerHelper4<com::sun::star::frame::XStatusListener>::forEach<SfxStatusDispatcher::sendStatusChanged(rtl::OUString const&, com::sun::star::frame::FeatureStateEvent const&)::$_0>(std::unique_lock<std::mutex>&, SfxStatusDispatcher::sendStatusChanged(rtl::OUString const&, com::sun::star::frame::FeatureStateEvent const&)::$_0 const&) const interfacecontainer4.hxx 304 0x7f19a98a4411 7 SfxStatusDispatcher::sendStatusChanged unoctitm.cxx 129 0x7f19a98a42aa 8 SfxDispatchController_Impl::sendStatusChanged unoctitm.cxx 802 0x7f19a98a907c 9 SfxDispatchController_Impl::StateChanged unoctitm.cxx 885 0x7f19a98a987a 10 SfxStateCache::SetState_Impl statcach.cxx 424 0x7f19a98308cc 11 SfxStateCache::SetState statcach.cxx 328 0x7f19a98306f2 12 SfxBindings::UpdateControllers_Impl bindings.cxx 1211 0x7f19a97aeffd 13 SfxBindings::Update_Impl bindings.cxx 274 0x7f19a97ae5cf 14 SfxBindings::Update bindings.cxx 353 0x7f19a97af682 15 SfxDispatcher::Call_Impl dispatch.cxx 280 0x7f19a97c731c 16 SfxDispatcher::Execute_ dispatch.cxx 753 0x7f19a97cbc4b 17 SfxDispatcher::Execute dispatch.cxx 812 0x7f19a97cc02f 18 SfxDispatchController_Impl::dispatch unoctitm.cxx 671 0x7f19a98a6673 19 SfxOfficeDispatch::dispatch unoctitm.cxx 250 0x7f19a98a511a 20 SfxToolBoxControl::Dispatch tbxitem.cxx 253 0x7f19a9df168f 21 (anonymous namespace)::SvxFontNameBox_Base::Select tbcontrl.cxx 2007 0x7f19a7adb44a 22 (anonymous namespace)::SvxFontNameBox_Base::SelectHdl tbcontrl.cxx 1962 0x7f19a7adafb4 23 (anonymous namespace)::SvxFontNameBox_Base::LinkStubSelectHdl tbcontrl.cxx 1960 0x7f19a7adab9d 24 Link<weld::ComboBox&, void>::Call link.hxx 111 0x7f199a19ddd8 25 weld::ComboBox::signal_changed weld.hxx 731 0x7f199a19dd8c 26 (anonymous namespace)::GtkInstanceComboBox::fire_signal_changed gtkinst.cxx 21229 0x7f199a0e1880 27 (anonymous namespace)::GtkInstanceComboBox::handle_row_activated gtkinst.cxx 21891 0x7f199a0e17f9 28 (anonymous namespace)::GtkInstanceComboBox::signalRowActivated gtkinst.cxx 21876 0x7f199a0dd299 29 ?? 0x7f1999695931 30 ?? 0x7f19a87b4939 31 ?? 0x7f19a87ca33f 32 g_signal_emit_valist 0x7f19a87cff06 33 g_signal_emit 0x7f19a87cffc3 34 ?? 0x7f199993384b 35 ?? 0x7f1999697085 36 ?? 0x7f19a87b4939 37 ?? 0x7f19a87ca33f 38 g_signal_emit_valist 0x7f19a87cff06 39 g_signal_emit 0x7f19a87cffc3 40 ?? 0x7f19997b317e 41 g_cclosure_marshal_VOID__BOXEDv 0x7f19a87b7b76 42 ?? 0x7f19a87b4939 43 ?? 0x7f19a87ca33f 44 g_signal_emit_valist 0x7f19a87cff06 45 g_signal_emit 0x7f19a87cffc3 46 ?? 0x7f19997b0213 47 ?? 0x7f19997b1803 48 ?? 0x7f19997b4a42 49 gtk_event_controller_handle_event 0x7f1999779361 50 ?? 0x7f19999488bd 51 ?? 0x7f1999690db8 52 ?? 0x7f19a87b4939 53 ?? 0x7f19a87c9693 54 g_signal_emit_valist 0x7f19a87cff06 55 g_signal_emit 0x7f19a87cffc3 56 ?? 0x7f199994a314 57 ?? 0x7f19997fc84e 58 gtk_main_do_event 0x7f19997fe4be 59 ?? 0x7f199a7b1a79 60 ?? 0x7f199a7e5586 61 ?? 0x7f199ed1ce3f 62 ?? 0x7f199ed1eec7 63 g_main_context_iteration 0x7f199ed1f4e0 64 GtkSalData::Yield gtkdata.cxx 405 0x7f199a08827f 65 GtkInstance::DoYield gtkinst.cxx 427 0x7f199a08d6e3 66 ImplYield svapp.cxx 384 0x7f19a47bf65c 67 Application::Yield svapp.cxx 472 0x7f19a47bef6b 68 Application::Execute svapp.cxx 359 0x7f19a47bed02 69 desktop::Desktop::Main app.cxx 1652 0x7f19ad928434 70 ImplSVMain svmain.cxx 229 0x7f19a47e226e 71 SVMain svmain.cxx 261 0x7f19a47e4299 72 soffice_main sofficemain.cxx 93 0x7f19ad9aca7c 73 sal_main main.c 51 0x55cb2e25aa5d 74 main main.c 49 0x55cb2e25aa37 However, for the keyboard-only case, `GtkInstanceComboBox::m_bChangedByMenu` got reset to false in `set_active_including_mru` with this backtrace: 1 (anonymous namespace)::GtkInstanceComboBox::set_active_including_mru gtkinst.cxx 21976 0x7f199a0e812b 2 (anonymous namespace)::GtkInstanceComboBox::set_active gtkinst.cxx 22406 0x7f199a0de9dc 3 FontNameBox::set_active_or_entry_text ctrlbox.cxx 897 0x7f19a64d904c 4 (anonymous namespace)::SvxFontNameBox_Base::set_active_or_entry_text tbcontrl.cxx 1823 0x7f19a7ad983d 5 (anonymous namespace)::SvxFontNameBox_Base::FocusOutHdl tbcontrl.cxx 1872 0x7f19a7adb9e2 6 (anonymous namespace)::SvxFontNameBox_Base::LinkStubFocusOutHdl tbcontrl.cxx 1868 0x7f19a7adac5d 7 Link<weld::Widget&, void>::Call link.hxx 111 0x7f199a13b618 8 (anonymous namespace)::GtkInstanceWidget::signal_focus_out gtkinst.cxx 2630 0x7f199a0a1ef6 9 (anonymous namespace)::GtkInstanceComboBox::signal_entry_focus_out gtkinst.cxx 21427 0x7f199a0e83f6 10 (anonymous namespace)::GtkInstanceComboBox::signalEntryFocusOut gtkinst.cxx 21412 0x7f199a0dd525 11 ?? 0x7f1999690caa 12 g_closure_invoke 0x7f19a87b4730 13 ?? 0x7f19a87c887c 14 ?? 0x7f19a87c9ad1 15 g_signal_emit_valist 0x7f19a87cff06 16 g_signal_emit 0x7f19a87cffc3 17 ?? 0x7f199994a314 18 gtk_widget_send_focus_change 0x7f199995c0ea 19 ?? 0x7f199996153b 20 ?? 0x7f1999961822 21 g_closure_invoke 0x7f19a87b4730 22 ?? 0x7f19a87c8f08 23 ?? 0x7f19a87ca281 24 g_signal_emit_valist 0x7f19a87cff06 25 g_signal_emit 0x7f19a87cffc3 26 ?? 0x7f19a87b4939 27 ?? 0x7f19a87ca33f 28 g_signal_emit_valist 0x7f19a87cff06 29 g_signal_emit 0x7f19a87cffc3 30 gtk_widget_grab_focus 0x7f199994e7fa 31 (anonymous namespace)::GtkInstanceComboBox::menu_toggled gtkinst.cxx 21320 0x7f199a0ea4b8 32 (anonymous namespace)::GtkInstanceComboBox::signal_popup_toggled gtkinst.cxx 21356 0x7f199a0de2e9 33 (anonymous namespace)::GtkInstanceComboBox::signalPopupToggled gtkinst.cxx 21236 0x7f199a0dd375 34 g_closure_invoke 0x7f19a87b4730 35 ?? 0x7f19a87c887c 36 ?? 0x7f19a87ca281 37 g_signal_emit_valist 0x7f19a87cff06 38 g_signal_emit 0x7f19a87cffc3 39 ?? 0x7f19998f7ac5 40 ?? 0x7f19a87b4939 41 ?? 0x7f19a87ca33f 42 g_signal_emit_valist 0x7f19a87cff06 43 g_signal_emit 0x7f19a87cffc3 44 gtk_toggle_button_set_active 0x7f19998f7868 45 (anonymous namespace)::GtkInstanceComboBox::handle_row_activated gtkinst.cxx 21890 0x7f199a0e17f0 46 (anonymous namespace)::GtkInstanceComboBox::signalRowActivated gtkinst.cxx 21876 0x7f199a0dd299 47 ?? 0x7f1999695931 48 ?? 0x7f19a87b4939 49 ?? 0x7f19a87ca33f 50 g_signal_emit_valist 0x7f19a87cff06 51 g_signal_emit 0x7f19a87cffc3 52 ?? 0x7f1999935562 53 ?? 0x7f1999693eca 54 g_closure_invoke 0x7f19a87b4730 55 ?? 0x7f19a87c8f08 56 g_signal_emitv 0x7f19a87cfcf2 57 ?? 0x7f19996c773d 58 ?? 0x7f19996c7bf8 59 ?? 0x7f19996c7d80 60 gtk_bindings_activate_event 0x7f19996c922b 61 ?? 0x7f1999936b18 62 ?? 0x7f1999690db8 63 ?? 0x7f19a87b4894 64 ?? 0x7f19a87c9693 65 g_signal_emit_valist 0x7f19a87cff06 66 g_signal_emit 0x7f19a87cffc3 67 ?? 0x7f199994a314 68 gtk_window_propagate_key_event 0x7f199996cdeb 69 ?? 0x7f199997143b 70 ?? 0x7f1999690caa 71 g_closure_invoke 0x7f19a87b4730 72 ?? 0x7f19a87c8f08 73 ?? 0x7f19a87c9ad1 74 g_signal_emit_valist 0x7f19a87cff06 75 g_signal_emit 0x7f19a87cffc3 76 ?? 0x7f199994a314 77 ?? 0x7f19997fc8ff 78 gtk_main_do_event 0x7f19997fe4be 79 ?? 0x7f199a7b1a79 80 ?? 0x7f199a7e5586 81 ?? 0x7f199ed1ce3f 82 ?? 0x7f199ed1eec7 83 g_main_context_iteration 0x7f199ed1f4e0 84 GtkSalData::Yield gtkdata.cxx 405 0x7f199a08827f 85 GtkInstance::DoYield gtkinst.cxx 427 0x7f199a08d6e3 86 ImplYield svapp.cxx 384 0x7f19a47bf65c 87 Application::Yield svapp.cxx 472 0x7f19a47bef6b 88 Application::Execute svapp.cxx 359 0x7f19a47bed02 89 desktop::Desktop::Main app.cxx 1652 0x7f19ad928434 90 ImplSVMain svmain.cxx 229 0x7f19a47e226e 91 SVMain svmain.cxx 261 0x7f19a47e4299 92 soffice_main sofficemain.cxx 93 0x7f19ad9aca7c 93 sal_main main.c 51 0x55cb2e25aa5d 94 main main.c 49 0x55cb2e25aa37 As a consequence, `GtkInstanceComboBox::changed_by_direct_pick` would then return false when called in `SvxFontNameBox_Base::SelectHdl` (s. frame 21 in the first backtrace above), so the new value wouldn't get saved, but the previous one would get used instead since commit 131c1c7da8c567636ca55751e49d24cb6d6c9b9e Date: Sun Nov 21 19:53:47 2021 +0000 Related: tdf#145786 cooperate between our own grabs , which introduced grabbing the focus for the combobox in `GtkInstanceComboBox::menu_toggled` (s. frame 31 in above backtrace). Fix this by calling `fire_signal_changed` before `gtk_toggle_button_set_active` in `GtkInstanceComboBox::handle_row_activated` (s. frame 26 in the first and frame 44 in the second backtrace above), so `m_bChangedByMenu` only gets reset to false at the end of `fire_signal_changed`, not before it gets called. With that in place, the new value now gets set and the combobox shows the newly selected value as expected. Change-Id: Ib1919a99b46c33981593d9c5ec9a0d21443890b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168146 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 6e4f95dc7e3d..94963428f305 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -20101,8 +20101,8 @@ private:
else
tree_view_set_cursor(nActive);
#endif
- enable_notify_events();
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pToggleButton), false);
+ enable_notify_events();
fire_signal_changed();
update_mru();
}
@@ -21887,8 +21887,8 @@ private:
else
tree_view_set_cursor(nActive);
enable_notify_events();
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pToggleButton), false);
fire_signal_changed();
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pToggleButton), false);
update_mru();
}