[resapplet] recreate wacom patch
Radek Vokál
rvokal at fedoraproject.org
Fri Sep 3 04:57:13 UTC 2010
commit 2bce87944a9f147ab9f6ed8276272e1bf1de1927
Author: Radek <radek at samo.(none)>
Date: Fri Sep 3 06:57:14 2010 +0200
recreate wacom patch
resapplet-rotate-wacom.patch | 227 +++++++++++++++++++++---------------------
resapplet.spec | 15 ++--
2 files changed, 120 insertions(+), 122 deletions(-)
---
diff --git a/resapplet-rotate-wacom.patch b/resapplet-rotate-wacom.patch
index 6e44911..1894e51 100644
--- a/resapplet-rotate-wacom.patch
+++ b/resapplet-rotate-wacom.patch
@@ -1,114 +1,113 @@
-Only in .: resapplet.spec
-diff -ur /usr/src/packages/BUILD/resapplet-0.1.4/src/resapplet.c ./src/resapplet.c
---- /usr/src/packages/BUILD/resapplet-0.1.4/src/resapplet.c 2008-01-17 12:18:59.000000000 -0500
-+++ ./src/resapplet.c 2008-01-17 12:18:21.000000000 -0500
-@@ -84,6 +84,7 @@
- };
-
- static Resapplet *resapplet;
-+static gchar *wacom_util_path;
-
- static void populate_popup_menu (void);
- static char *get_str_for_res (int width, int height, Rotation rotation);
-@@ -251,6 +252,64 @@
- return screen_info->user_set_rotation;
- }
-
-+static void
-+set_wacom_cursors (Rotation rot)
-+{
-+ gchar *output = NULL, *p = NULL, *nl = NULL;
-+ int status = 1;
-+
-+ if (!wacom_util_path)
-+ return;
-+
-+ g_spawn_command_line_sync ("xsetwacom list",
-+ &output, NULL,
-+ &status, NULL);
-+ if (!output || status) {
-+ g_printerr ("Failed to get cursor list from xsetwacom\n");
-+ return;
-+ }
-+
-+ for (p = output; *p != '\0'; p = nl + 1) {
-+ gchar *cmd, *arg, *end;
-+
-+ nl = strchr (p, '\n');
-+ if (!nl)
-+ break;
-+
-+ *nl = '\0';
-+ if (!strstr (p, "stylus"))
-+ continue;
-+
-+ for (end = p; *end == '\0' || !g_ascii_isspace (*end); end++);
-+ *end = '\0';
-+
-+ switch (rot) {
-+ case RR_Rotate_90:
-+ arg = "CW";
-+ break;
-+ case RR_Rotate_180:
-+ arg = "HALF";
-+ break;
-+ case RR_Rotate_270:
-+ arg = "CCW";
-+ break;
-+ default:
-+ arg = "NONE";
-+ break;
-+ }
-+
-+ cmd = g_strconcat ("xsetwacom set ", p, " Rotate ", arg, NULL);
-+ g_print ("Running '%s'\n", cmd);
-+ g_spawn_command_line_sync (cmd, NULL, NULL, &status, NULL);
-+ g_free (cmd);
-+
-+ if (status)
-+ g_printerr ("Failed to rotate stylus %s\n", p);
-+ }
-+
-+ g_free (output);
-+}
-+
- static gboolean
- apply_config (DisplayInfo *info)
- {
-@@ -302,6 +361,9 @@
- new_res,
- new_rotation,
- GDK_CURRENT_TIME);
-+
-+ if (new_rotation != screen_info->current_rotation)
-+ set_wacom_cursors (new_rotation);
- }
- }
-
-@@ -345,7 +407,9 @@
- screen_info->old_rotation,
- screen_info->old_rate,
- GDK_CURRENT_TIME);
--
-+
-+ if (screen_info->old_rotation != screen_info->current_rotation)
-+ set_wacom_cursors (screen_info->old_rotation);
- }
-
- update_display_info (info, display);
-@@ -1113,6 +1177,8 @@
-
- gtk_init (&argc, &argv);
-
-+ wacom_util_path = g_find_program_in_path ("xsetwacom");
-+
- resapplet = resapplet_new ();
-
- resapplet_set_tooltip ();
-@@ -1123,5 +1189,6 @@
-
- gtk_main ();
-
-+ g_free (wacom_util_path);
- return 0;
- }
+diff -up resapplet-0.1.4/src/resapplet.c.wacom resapplet-0.1.4/src/resapplet.c
+--- resapplet-0.1.4/src/resapplet.c.wacom 2010-09-03 06:51:57.543319038 +0200
++++ resapplet-0.1.4/src/resapplet.c 2010-09-03 06:51:57.548318935 +0200
+@@ -84,6 +84,7 @@ enum {
+ };
+
+ static Resapplet *resapplet;
++static gchar *wacom_util_path;
+
+ static void populate_popup_menu (void);
+ static char *get_str_for_res (int width, int height, Rotation rotation);
+@@ -251,6 +252,64 @@ get_current_rotation (ScreenInfo *screen
+ return screen_info->user_set_rotation;
+ }
+
++static void
++set_wacom_cursors (Rotation rot)
++{
++ gchar *output = NULL, *p = NULL, *nl = NULL;
++ int status = 1;
++
++ if (!wacom_util_path)
++ return;
++
++ g_spawn_command_line_sync ("xsetwacom list",
++ &output, NULL,
++ &status, NULL);
++ if (!output || status) {
++ g_printerr ("Failed to get cursor list from xsetwacom\n");
++ return;
++ }
++
++ for (p = output; *p != '\0'; p = nl + 1) {
++ gchar *cmd, *arg, *end;
++
++ nl = strchr (p, '\n');
++ if (!nl)
++ break;
++
++ *nl = '\0';
++ if (!strstr (p, "stylus"))
++ continue;
++
++ for (end = p; *end == '\0' || !g_ascii_isspace (*end); end++);
++ *end = '\0';
++
++ switch (rot) {
++ case RR_Rotate_90:
++ arg = "CW";
++ break;
++ case RR_Rotate_180:
++ arg = "HALF";
++ break;
++ case RR_Rotate_270:
++ arg = "CCW";
++ break;
++ default:
++ arg = "NONE";
++ break;
++ }
++
++ cmd = g_strconcat ("xsetwacom set ", p, " Rotate ", arg, NULL);
++ g_print ("Running '%s'\n", cmd);
++ g_spawn_command_line_sync (cmd, NULL, NULL, &status, NULL);
++ g_free (cmd);
++
++ if (status)
++ g_printerr ("Failed to rotate stylus %s\n", p);
++ }
++
++ g_free (output);
++}
++
+ static gboolean
+ apply_config (DisplayInfo *info)
+ {
+@@ -302,6 +361,9 @@ apply_config (DisplayInfo *info)
+ new_res,
+ new_rotation,
+ GDK_CURRENT_TIME);
++
++ if (new_rotation != screen_info->current_rotation)
++ set_wacom_cursors (new_rotation);
+ }
+ }
+
+@@ -345,7 +407,9 @@ revert_config (DisplayInfo *info)
+ screen_info->old_rotation,
+ screen_info->old_rate,
+ GDK_CURRENT_TIME);
+-
++
++ if (screen_info->old_rotation != screen_info->current_rotation)
++ set_wacom_cursors (screen_info->old_rotation);
+ }
+
+ update_display_info (info, display);
+@@ -1128,6 +1192,8 @@ main (int argc, char *argv[])
+
+ gtk_init (&argc, &argv);
+
++ wacom_util_path = g_find_program_in_path ("xsetwacom");
++
+ resapplet = resapplet_new ();
+ resapplet_set_icon ();
+
+@@ -1139,5 +1205,6 @@ main (int argc, char *argv[])
+
+ gtk_main ();
+
++ g_free (wacom_util_path);
+ return 0;
+ }
diff --git a/resapplet.spec b/resapplet.spec
index 878b25a..935365e 100644
--- a/resapplet.spec
+++ b/resapplet.spec
@@ -1,7 +1,7 @@
Summary: Resolution Switching Applet
Name: resapplet
Version: 0.1.4
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2+ and GPLv2
# This is the best we have to silence rpmlint:
URL: http://svn.gnome.org/viewcvs/resapplet/
@@ -35,8 +35,8 @@ area.
cp -a %{S:1} .
%patch1 -p0
%patch2 -p0
-%patch3 -p0
-%patch4 -p1 -b lX11
+%patch3 -p1 -b .wacom
+%patch4 -p1 -b .lX11
%patch5 -p1
%build
@@ -87,10 +87,6 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/resapplet
%{_datadir}/applications/fedora-resapplet.desktop
%{_datadir}/gnome/autostart/fedora-resapplet.desktop
-#%{_datadir}/icons/gnome/16x16/apps/resapplet.png
-#%{_datadir}/icons/gnome/32x32/apps/resapplet.png
-#%{_datadir}/icons/gnome/24x24/apps/resapplet.png
-#%{_datadir}/icons/gnome/48x48/apps/resapplet.png
%{_datadir}/icons/hicolor/16x16/apps/resapplet.png
%{_datadir}/icons/hicolor/22x22/apps/resapplet.png
%{_datadir}/icons/hicolor/24x24/apps/resapplet.png
@@ -98,7 +94,10 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/icons/hicolor/scalable/apps/resapplet.svg
%changelog
-* Fri Sep 3 2010 Radek Vokal <rvokal at redhat.com>
+* Fri Sep 3 2010 Radek Vokal <rvokal at redhat.com> - 0.1.4-2
+- recreated wacom patch
+
+* Fri Sep 3 2010 Radek Vokal <rvokal at redhat.com> - 0.1.4-1
- update to 0.1.4 from Suse trunk
- drop dependency on s-c-display
More information about the scm-commits
mailing list