From 561873b4d2fee856d38c1a85002be1ab4f6a97e7 Mon Sep 17 00:00:00 2001 From: ftomara Date: Tue, 18 Mar 2025 04:39:50 +0200 Subject: [PATCH] removed lpe focus_dialog from selection_info func and made extenssion & filter galleries work on firstly docked created mode back to normal focus again ! modified git ignore --- src/ui/dialog/dialog-base.cpp | 3 ++- src/ui/dialog/dialog-base.h | 2 +- src/ui/dialog/dialog-notebook.cpp | 10 +++++++++- src/ui/dialog/extensions-gallery.cpp | 6 ++++++ src/ui/dialog/extensions-gallery.h | 2 +- src/ui/dialog/livepatheffect-editor.cpp | 6 ++++++ src/ui/dialog/livepatheffect-editor.h | 2 +- 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/ui/dialog/dialog-base.cpp b/src/ui/dialog/dialog-base.cpp index 14ef28b084..52a5b44d47 100644 --- a/src/ui/dialog/dialog-base.cpp +++ b/src/ui/dialog/dialog-base.cpp @@ -122,10 +122,10 @@ void DialogBase::blink() } void DialogBase::focus_dialog() { + set_visible(true); if (auto window = dynamic_cast(get_root())) { window->present(); } - // widget that had focus, if any if (auto child = get_focus_child()) { child->grab_focus(); @@ -135,6 +135,7 @@ void DialogBase::focus_dialog() { child->grab_focus(); } } + } void DialogBase::defocus_dialog() { diff --git a/src/ui/dialog/dialog-base.h b/src/ui/dialog/dialog-base.h index dc1d025800..496c84d4b2 100644 --- a/src/ui/dialog/dialog-base.h +++ b/src/ui/dialog/dialog-base.h @@ -68,7 +68,7 @@ public: void blink(); // find focusable widget to grab focus - void focus_dialog(); + virtual void focus_dialog(); // return focus back to canvas void defocus_dialog(); bool getShowing() { return _showing; } diff --git a/src/ui/dialog/dialog-notebook.cpp b/src/ui/dialog/dialog-notebook.cpp index eaeb985eaf..f4467c78de 100644 --- a/src/ui/dialog/dialog-notebook.cpp +++ b/src/ui/dialog/dialog-notebook.cpp @@ -137,7 +137,12 @@ DialogNotebook::DialogNotebook(DialogContainer* container) : _container(containe _tabs.set_new_tab_popup(&_menu_dialogs); _tabs.signal_select_tab().connect([this](auto& tab) { _tabs.select_tab(tab); - _notebook.set_current_page(_tabs.get_tab_position(tab)); + int page_pos = _tabs.get_tab_position(tab); + _notebook.set_current_page(page_pos); + auto curr_page = _notebook.get_nth_page(page_pos); + if (auto dialog = dynamic_cast(curr_page)) { + dialog->focus_dialog(); + } }); _tabs.signal_close_tab().connect([this](auto& tab) { auto index = _tabs.get_tab_position(tab); @@ -663,6 +668,9 @@ void DialogNotebook::on_size_allocate_scroll(int const width) void DialogNotebook::on_page_switch(Gtk::Widget *curr_page, guint page) { _tabs.select_tab_at(page); + if (auto dialog = dynamic_cast(curr_page)) { + dialog->focus_dialog(); + } } bool DialogNotebook::on_scroll_event(double dx, double dy) diff --git a/src/ui/dialog/extensions-gallery.cpp b/src/ui/dialog/extensions-gallery.cpp index efba3be948..abbc5ec609 100644 --- a/src/ui/dialog/extensions-gallery.cpp +++ b/src/ui/dialog/extensions-gallery.cpp @@ -466,6 +466,7 @@ ExtensionsGallery::ExtensionsGallery(ExtensionsGallery::Type type) : }); append(get_widget(_builder, "main")); + focus_dialog(); } void ExtensionsGallery::update_name() { @@ -581,5 +582,10 @@ Glib::RefPtr ExtensionsGallery::get_image(const std::string& key, return tex; } } +void ExtensionsGallery::focus_dialog() +{ + DialogBase::focus_dialog(); + _search.grab_focus(); +} } // namespace Inkscape::UI::Dialog diff --git a/src/ui/dialog/extensions-gallery.h b/src/ui/dialog/extensions-gallery.h index 5e41ff3371..548585527c 100644 --- a/src/ui/dialog/extensions-gallery.h +++ b/src/ui/dialog/extensions-gallery.h @@ -55,7 +55,7 @@ class ExtensionsGallery : public DialogBase public: enum Type { Filters, Effects }; ExtensionsGallery(Type type); - + void focus_dialog() override; private: Glib::RefPtr _builder; Gtk::GridView& _gridview; diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 70c58e55a6..cb0ca199e6 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -1130,6 +1130,12 @@ void LivePathEffectEditor::do_item_action_favorite(PathEffectSharedPtr const &, _reload_menu = true; _item_type = ""; // here we force reload even with the same tipe item selected } +void LivePathEffectEditor::focus_dialog() +{ + DialogBase::focus_dialog(); + _lpes_popup.get_entry().grab_focus(); + _lpes_popup.get_entry().queue_draw(); // force redraw to fix delay in hover style +} } // namespace Inkscape::UI::Dialog diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 234e3b04c3..228ac93b7c 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -61,7 +61,7 @@ class LivePathEffectEditor final : public DialogBase public: LivePathEffectEditor(); ~LivePathEffectEditor() final; - + void focus_dialog() override; void move_list(int origin, int dest); using LPEExpander = std::pair; -- GitLab