[gimp] app: better tool defaults depending on the device source.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: better tool defaults depending on the device source.
- Date: Thu, 10 Dec 2020 23:33:11 +0000 (UTC)
commit 31e38fe86910ea178cf7ae43350d29344d345a32
Author: Jehan <jehan girinstud io>
Date: Fri Dec 11 00:14:28 2020 +0100
app: better tool defaults depending on the device source.
This code is the result of discussions with and propositions by Aryeom
who thinks (and I agree obviously) better defaults should be set for
beginners and first time users. This is only a first change, more
similar defaults updates will likely come in the next few months on
various parts of GIMP.
Existing code was only making a differenciation for eraser-type devices,
setting them to the eraser tool (which is fine of course).
So far, I only added 2 types of device source, which we should
definitely special-case as well: pen tools (tablet styluses) should
definitely map to the Paintbrush (pencil could be a reasonable defaults
too, though brush seems much more common); as for touchscreen, I chose
to map to the Smudge tool (though to be fair, if we had gesture
recognition, this should not map to any tool). I also set a generic
default now because it seems that right now, we don't specify anything
(it ends up defaulting to the Crop tool for first uses, at least in my
case). I set the rectangle select tool. I'm not sure it actually makes
particular sense, but at least it's probably better to default to
something not destructive for first time users.
app/widgets/gimpdeviceinfo.c | 47 +++++++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 12 deletions(-)
---
diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c
index 206eafddc4..446fd44f57 100644
--- a/app/widgets/gimpdeviceinfo.c
+++ b/app/widgets/gimpdeviceinfo.c
@@ -845,22 +845,45 @@ gimp_device_info_set_device (GimpDeviceInfo *info,
void
gimp_device_info_set_default_tool (GimpDeviceInfo *info)
{
+ GimpContainer *tools;
+ GimpToolInfo *tool_info = NULL;
+
g_return_if_fail (GIMP_IS_DEVICE_INFO (info));
- if (info->priv->device &&
- gdk_device_get_source (info->priv->device) == GDK_SOURCE_ERASER)
- {
- GimpContainer *tools = GIMP_TOOL_PRESET (info)->gimp->tool_info_list;
- GimpToolInfo *eraser;
+ tools = GIMP_TOOL_PRESET (info)->gimp->tool_info_list;
+ tool_info =
+ GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
+ "gimp-rect-select-tool"));
- eraser =
- GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
- "gimp-eraser-tool"));
+ if (info->priv->device)
+ {
+ switch (gdk_device_get_source (info->priv->device))
+ {
+ case GDK_SOURCE_ERASER:
+ tool_info =
+ GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
+ "gimp-eraser-tool"));
+ break;
+ case GDK_SOURCE_PEN:
+ tool_info =
+ GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
+ "gimp-paintbrush-tool"));
+ break;
+ case GDK_SOURCE_TOUCHSCREEN:
+ tool_info =
+ GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
+ "gimp-smudge-tool"));
+ break;
+ default:
+ break;
+ }
+ }
- if (eraser)
- g_object_set (info,
- "tool-options", eraser->tool_options,
- NULL);
+ if (tool_info)
+ {
+ g_object_set (info,
+ "tool-options", tool_info->tool_options,
+ NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]