[gimp] Only select available API's
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Only select available API's
- Date: Wed, 25 Aug 2021 23:24:53 +0000 (UTC)
commit 16857465791347a4635c9b593f423a2741da3fb4
Author: Luca Bacci <luca bacci982 gmail com>
Date: Thu Aug 19 21:55:20 2021 +0200
Only select available API's
app/config/gimpcoreconfig.c | 21 ++++++++++++++++++++-
app/config/gimpearlyrc.c | 24 +++++++++++++++++++++++-
2 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index 159dea084f..72a116dcef 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -1182,7 +1182,26 @@ gimp_core_config_set_property (GObject *object,
break;
#ifdef G_OS_WIN32
case PROP_WIN32_POINTER_INPUT_API:
- core_config->win32_pointer_input_api = g_value_get_enum (value);
+ {
+ GimpWin32PointerInputAPI api = g_value_get_enum (value);
+ gboolean have_wintab = gimp_win32_have_wintab ();
+ gboolean have_windows_ink = gimp_win32_have_windows_ink ();
+ gboolean api_is_wintab = (api == GIMP_WIN32_POINTER_INPUT_API_WINTAB);
+ gboolean api_is_windows_ink = (api == GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK);
+
+ if (api_is_wintab && !have_wintab && have_windows_ink)
+ {
+ core_config->win32_pointer_input_api = GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK;
+ }
+ else if (api_is_windows_ink && !have_windows_ink && have_wintab)
+ {
+ core_config->win32_pointer_input_api = GIMP_WIN32_POINTER_INPUT_API_WINTAB;
+ }
+ else
+ {
+ core_config->win32_pointer_input_api = api;
+ }
+ }
break;
#endif
diff --git a/app/config/gimpearlyrc.c b/app/config/gimpearlyrc.c
index b6a42b1f35..16f6281fbe 100644
--- a/app/config/gimpearlyrc.c
+++ b/app/config/gimpearlyrc.c
@@ -29,6 +29,9 @@
#include "config-types.h"
+#include "core/core-types.h"
+#include "core/gimp-utils.h"
+
#include "gimpearlyrc.h"
enum
@@ -210,7 +213,26 @@ gimp_early_rc_set_property (GObject *object,
#ifdef G_OS_WIN32
case PROP_WIN32_POINTER_INPUT_API:
- rc->win32_pointer_input_api = g_value_get_enum (value);
+ {
+ GimpWin32PointerInputAPI api = g_value_get_enum (value);
+ gboolean have_wintab = gimp_win32_have_wintab ();
+ gboolean have_windows_ink = gimp_win32_have_windows_ink ();
+ gboolean api_is_wintab = (api == GIMP_WIN32_POINTER_INPUT_API_WINTAB);
+ gboolean api_is_windows_ink = (api == GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK);
+
+ if (api_is_wintab && !have_wintab && have_windows_ink)
+ {
+ rc->win32_pointer_input_api = GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK;
+ }
+ else if (api_is_windows_ink && !have_windows_ink && have_wintab)
+ {
+ rc->win32_pointer_input_api = GIMP_WIN32_POINTER_INPUT_API_WINTAB;
+ }
+ else
+ {
+ rc->win32_pointer_input_api = api;
+ }
+ }
break;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]