[gnome-settings-daemon] wacom: Remove calibration notification
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Remove calibration notification
- Date: Thu, 30 Apr 2015 12:20:10 +0000 (UTC)
commit 015f050724ac89422abeb1448b9e95ab74e82801
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Apr 29 19:13:41 2015 +0200
wacom: Remove calibration notification
On sane hardware it is mainly unneeded, and the UI on g-c-c is
discoverable enough for the cases where it isn't, so let's avoid
nagging about something mostly superfluous.
https://bugzilla.gnome.org/show_bug.cgi?id=748659
...ings-daemon.peripherals.wacom.gschema.xml.in.in | 5 -
plugins/wacom/gsd-wacom-manager.c | 210 --------------------
2 files changed, 0 insertions(+), 215 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
index 4e02770..083913a 100644
--- a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
@@ -41,11 +41,6 @@
<_summary>Wacom touch feature</_summary>
<_description>Enable this to move the cursor when the user touches the tablet.</_description>
</key>
- <key name="last-calibrated-resolution" type="(ii)">
- <default>(-1, -1)</default>
- <_summary>Wacom last calibrated resolution</_summary>
- <_description>Holds the last calibrated resolution to help check if calibration is
needed.</_description>
- </key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom.stylus">
<key name="pressurecurve" type="ai">
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 6fd2113..f0732bd 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -64,7 +64,6 @@
#define KEY_IS_ABSOLUTE "is-absolute"
#define KEY_AREA "area"
#define KEY_KEEP_ASPECT "keep-aspect"
-#define KEY_LAST_CALIBRATED_RESOLUTION "last-calibrated-resolution"
/* Stylus and Eraser settings */
#define KEY_BUTTON_MAPPING "buttonmapping"
@@ -80,8 +79,6 @@
/* See "Wacom Pressure Threshold" */
#define DEFAULT_PRESSURE_THRESHOLD 27
-#define CALIBRATION_NOTIFICATION_TIMEOUT 15000
-#define SHOW_CALIBRATION_TIMEOUT 2000
#define UNKNOWN_DEVICE_NOTIFICATION_TIMEOUT 15000
#define GSD_WACOM_DBUS_PATH GSD_DBUS_PATH "/Wacom"
@@ -98,13 +95,6 @@ static const gchar introspection_xml[] =
" </interface>"
"</node>";
-typedef struct
-{
- NotifyNotification *calibration_notification;
- GsdWacomDevice *device;
- guint notification_timeout_id;
-} GsdWacomDeviceCalibration;
-
struct GsdWacomManagerPrivate
{
guint start_idle_id;
@@ -138,8 +128,6 @@ static void gsd_wacom_manager_class_init (GsdWacomManagerClass *klass);
static void gsd_wacom_manager_init (GsdWacomManager *wacom_manager);
static void gsd_wacom_manager_finalize (GObject *object);
-static void wacom_device_calibration_check (GsdWacomDevice *device);
-
static gboolean osd_window_toggle_visibility (GsdWacomManager *manager,
GsdWacomDevice *device);
@@ -866,10 +854,6 @@ wacom_settings_changed (GSettings *settings,
type != WACOM_TYPE_PAD &&
type != WACOM_TYPE_TOUCH)
set_absolute (device, g_settings_get_boolean (settings, key));
- } else if (g_str_equal (key, KEY_LAST_CALIBRATED_RESOLUTION)) {
- if (type == WACOM_TYPE_STYLUS &&
- gsd_wacom_device_is_screen_tablet (device))
- wacom_device_calibration_check (device);
} else if (g_str_equal (key, KEY_AREA)) {
if (type != WACOM_TYPE_CURSOR &&
type != WACOM_TYPE_PAD &&
@@ -1095,10 +1079,6 @@ gsd_wacom_manager_add_gdk_device (GsdWacomManager *manager,
}
set_wacom_settings (manager, device);
-
- if (type == WACOM_TYPE_STYLUS &&
- gsd_wacom_device_is_screen_tablet (device))
- wacom_device_calibration_check (device);
}
static void
@@ -1578,194 +1558,6 @@ gsd_wacom_manager_idle_cb (GsdWacomManager *manager)
return FALSE;
}
-static gboolean
-check_need_for_calibration (GsdWacomDevice *device)
-{
- GSettings *settings;
- GVariant *variant;
- gint width, height;
- GdkScreen *screen;
- GdkDevice *gdk_device;
- GsdDevice *gsd_device;
- GsdDeviceMapper *mapper;
- gint monitor;
- GdkRectangle geometry;
-
- g_debug ("Checking calibration for: %s", gsd_wacom_device_get_name (device));
-
- width = -1;
- height = -1;
-
- screen = gdk_screen_get_default ();
- mapper = gsd_device_mapper_get ();
- gdk_device = gsd_wacom_device_get_gdk_device (device);
- gsd_device = gsd_x11_device_manager_lookup_gdk_device (GSD_X11_DEVICE_MANAGER
(gsd_device_manager_get ()),
- gdk_device);
- monitor = gsd_device_mapper_get_device_monitor (mapper, gsd_device);
-
- if (monitor < 0) {
- geometry.width = gdk_screen_get_width (screen);
- geometry.height = gdk_screen_get_height (screen);
- } else {
- gdk_screen_get_monitor_geometry (screen, monitor, &geometry);
- }
-
- settings = gsd_wacom_device_get_settings (device);
-
- variant = g_settings_get_value (settings, KEY_LAST_CALIBRATED_RESOLUTION);
-
- g_variant_get (variant, "(ii)", &width, &height);
-
- g_debug ("Last calibrated resolution: %d, %d", width, height);
-
- return width == -1 || width != geometry.width ||
- height == -1 || height != geometry.height;
-}
-
-static void
-wacom_device_calibration_data_unset (GsdWacomDevice *device)
-{
- g_object_set_data (G_OBJECT (device),
- "gsd-wacom-calibration-data", NULL);
-}
-
-static void
-on_notification_closed (NotifyNotification *notification,
- GsdWacomDeviceCalibration *data)
-{
- wacom_device_calibration_data_unset (data->device);
-}
-
-static void
-on_notification_action (NotifyNotification *notification,
- gchar *action,
- gpointer user_data)
-{
- gboolean success;
- gchar *command;
- const gchar *device_name;
- GError *error = NULL;
- GsdWacomDeviceCalibration *data = user_data;
-
- device_name = gsd_wacom_device_get_name (data->device);
-
- if (g_strcmp0 (action, "run-calibration") == 0) {
- command = g_strdup_printf ("gnome-control-center wacom run-calibration \"%s\"",
- device_name);
- success = g_spawn_command_line_async (command, &error);
- if (!success) {
- g_warning ("Failure launching gnome-control-center: %s",
- error->message);
- g_clear_error (&error);
- }
- g_free (command);
- }
-
- wacom_device_calibration_data_unset (data->device);
-}
-
-static void
-wacom_device_calibration_data_free (GsdWacomDeviceCalibration *data)
-{
- if (data->notification_timeout_id)
- g_source_remove (data->notification_timeout_id);
-
- if (data->calibration_notification) {
- notify_notification_close (data->calibration_notification, NULL);
- g_object_unref (data->calibration_notification);
- }
-
- g_free (data);
-}
-
-static void
-wacom_device_calibration_data_update (GsdWacomDeviceCalibration *data)
-{
- gchar *msg_body;
-
- if (data->calibration_notification) {
- notify_notification_close (data->calibration_notification, NULL);
- g_object_unref (data->calibration_notification);
- }
-
- msg_body = g_strdup_printf (_("Tablet %s needs to be calibrated."),
- gsd_wacom_device_get_name (data->device));
- data->calibration_notification = notify_notification_new (_("Calibration needed"),
- msg_body,
- "input-tablet");
- notify_notification_set_app_name (data->calibration_notification,
- _("Wacom Settings"));
- notify_notification_set_timeout (data->calibration_notification,
- CALIBRATION_NOTIFICATION_TIMEOUT);
- notify_notification_set_urgency (data->calibration_notification,
- NOTIFY_URGENCY_NORMAL);
- /* TRANSLATORS: launches the calibration screen for the
- tablet in question */
- notify_notification_add_action (data->calibration_notification,
- "run-calibration",
- _("Calibrate"),
- on_notification_action,
- data,
- NULL);
-
- g_signal_connect (data->calibration_notification,
- "closed",
- G_CALLBACK (on_notification_closed),
- data);
-
- g_free (msg_body);
-}
-
-static GsdWacomDeviceCalibration *
-wacom_device_calibration_data_get (GsdWacomDevice *device)
-{
- GsdWacomDeviceCalibration *data;
-
- data = g_object_get_data (G_OBJECT (device), "gsd-wacom-calibration-data");
-
- if (data)
- return data;
-
- data = g_new0 (GsdWacomDeviceCalibration, 1);
- data->device = device;
-
- g_object_set_data_full (G_OBJECT (device),
- "gsd-wacom-calibration-data", data,
- (GDestroyNotify) wacom_device_calibration_data_free);
- return data;
-}
-
-static gboolean
-notify_need_for_calibration (gpointer user_data)
-{
- GsdWacomDeviceCalibration *data = user_data;
-
- notify_notification_show (data->calibration_notification, NULL);
- data->notification_timeout_id = 0;
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-wacom_device_calibration_check (GsdWacomDevice *device)
-{
- if (check_need_for_calibration (device)) {
- GsdWacomDeviceCalibration *data;
-
- data = wacom_device_calibration_data_get (device);
- wacom_device_calibration_data_update (data);
-
- if (data->notification_timeout_id == 0) {
- data->notification_timeout_id = g_timeout_add (SHOW_CALIBRATION_TIMEOUT,
- notify_need_for_calibration,
- data);
- g_source_set_name_by_id (data->notification_timeout_id, "[gnome-settings-daemon]
notify_need_for_calibration");
- }
- } else {
- wacom_device_calibration_data_unset (device);
- }
-}
-
/*
* The monitors-changed signal is emitted when the number, size or
* position of the monitors attached to the screen change.
@@ -1800,8 +1592,6 @@ on_screen_changed_cb (GnomeRRScreen *rr_screen,
if (type != WACOM_TYPE_TOUCH) {
if (gsd_wacom_device_is_screen_tablet (device) == FALSE) {
set_keep_aspect (device, g_settings_get_boolean (settings, KEY_KEEP_ASPECT));
- } else if (type == WACOM_TYPE_STYLUS) {
- wacom_device_calibration_check (device);
}
set_area (device, g_settings_get_value (settings, KEY_AREA));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]