[gimp] app: grab focus before blinking a dockable widget.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: grab focus before blinking a dockable widget.
- Date: Fri, 4 Mar 2022 17:28:58 +0000 (UTC)
commit dac452f3a2102abe65bb2cd2be12482f481ed5d8
Author: Jehan <jehan girinstud io>
Date: Fri Mar 4 18:14:09 2022 +0100
app: grab focus before blinking a dockable widget.
It should help with scrolling the dockable to make the widget visible,
as I don't see a generic and simple scrolling API for GTK scrollable
containers.
In my own testing, it did work if the dockable was already opened. But
if it was just created by the blink API, then giving focus immediately
doesn't properly scroll. I am not really going to investigate now, but
this should be fixed eventually.
app/tools/gimptools-utils.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimptools-utils.c b/app/tools/gimptools-utils.c
index 1e50214e24..f46858112a 100644
--- a/app/tools/gimptools-utils.c
+++ b/app/tools/gimptools-utils.c
@@ -84,7 +84,7 @@ gimp_tools_blink_lock_box (Gimp *gimp,
/**
- * gimp_tools_blink_property:
+ * gimp_tools_blink_widget:
* @gimp:
* @dockable_identifier:
* @widget_identifier:
@@ -139,10 +139,23 @@ gimp_tools_search_widget_rec (GtkWidget *widget,
"gimp-widget-identifier");
if (id && g_strcmp0 (id, searched_id) == 0)
- gimp_widget_blink (widget);
+ {
+ /* Giving focus to help scrolling the dockable so that the
+ * widget is visible. Note that it seems to work fine if the
+ * dockable was already present, not if it was just created.
+ *
+ * TODO: this should be fixed so that we always make the
+ * widget visible before blinking, otherwise it's a bit
+ * useless when this happens.
+ */
+ gtk_widget_grab_focus (widget);
+ gimp_widget_blink (widget);
+ }
else if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gimp_tools_search_widget_rec,
- (gpointer) searched_id);
+ {
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gimp_tools_search_widget_rec,
+ (gpointer) searched_id);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]