Skip to content

DialogBase: Donʼt defocus if we lack window focus | Fix slow is_descendant_of()

Daniel Boles requested to merge dboles/inkscape:djb_DialogBase_Esc_focus into master

commit b51fb1a7 (HEAD -> djb_DialogBase_Esc_focus) Author: Daniel Boles dboles.src+inkscape@gmail.com Date: Mon Sep 25 11:11:00 2023 +0100

DialogBase: Donʼt defocus if we lack window focus…

…thus fixing this accidental regression:

https://gitlab.com/inkscape/inkscape/-/merge_requests/5833#note_1576879501

commit db28dd3f Author: Daniel Boles dboles.src+inkscape@gmail.com Date: Mon Sep 25 11:07:51 2023 +0100

DialogBase: on_key_pressed → on_window_key_pressed

Letʼs be very clear that we are listening to keys on the toplevel window
since that is not ideal. I also add a TODO to see if we can stop in GTK4

commit c040067f Author: Daniel Boles dboles.src+inkscape@gmail.com Date: Mon Sep 25 11:05:00 2023 +0100

ui/util: Fix overly slow impl @ is_descendant_of()

Recursing from the potential ancestor through all its children trying to
find the potential descendant is very slow, so e.g. using this to
defocus DialogBase on Esc pressed but only if the Window:focus is within
it seemed noticeably slow. Fix it by just looking at successive parents,
which achieves the same result but needn't recurse or allocate vectors.
Edited by Daniel Boles

Merge request reports