|
Lines 84-89
Link Here
|
| 84 |
}; |
84 |
}; |
| 85 |
|
85 |
|
| 86 |
static Resapplet *resapplet; |
86 |
static Resapplet *resapplet; |
|
|
87 |
static gchar *wacom_util_path; |
| 87 |
|
88 |
|
| 88 |
static void populate_popup_menu (void); |
89 |
static void populate_popup_menu (void); |
| 89 |
static char *get_str_for_res (int width, int height, Rotation rotation); |
90 |
static char *get_str_for_res (int width, int height, Rotation rotation); |
|
Lines 251-256
Link Here
|
| 251 |
return screen_info->user_set_rotation; |
252 |
return screen_info->user_set_rotation; |
| 252 |
} |
253 |
} |
| 253 |
|
254 |
|
|
|
255 |
static void |
| 256 |
set_wacom_cursors (Rotation rot) |
| 257 |
{ |
| 258 |
gchar *output = NULL, *p = NULL, *nl = NULL; |
| 259 |
int status = 1; |
| 260 |
|
| 261 |
if (!wacom_util_path) |
| 262 |
return; |
| 263 |
|
| 264 |
g_spawn_command_line_sync ("xsetwacom list", |
| 265 |
&output, NULL, |
| 266 |
&status, NULL); |
| 267 |
if (!output || status) { |
| 268 |
g_printerr ("Failed to get cursor list from xsetwacom\n"); |
| 269 |
return; |
| 270 |
} |
| 271 |
|
| 272 |
for (p = output; *p != '\0'; p = nl + 1) { |
| 273 |
gchar *cmd, *arg, *end; |
| 274 |
|
| 275 |
nl = strchr (p, '\n'); |
| 276 |
if (!nl) |
| 277 |
break; |
| 278 |
|
| 279 |
*nl = '\0'; |
| 280 |
if (!strstr (p, "stylus")) |
| 281 |
continue; |
| 282 |
|
| 283 |
for (end = p; *end == '\0' || !g_ascii_isspace (*end); end++); |
| 284 |
*end = '\0'; |
| 285 |
|
| 286 |
switch (rot) { |
| 287 |
case RR_Rotate_90: |
| 288 |
arg = "CW"; |
| 289 |
break; |
| 290 |
case RR_Rotate_180: |
| 291 |
arg = "HALF"; |
| 292 |
break; |
| 293 |
case RR_Rotate_270: |
| 294 |
arg = "CCW"; |
| 295 |
break; |
| 296 |
default: |
| 297 |
arg = "NONE"; |
| 298 |
break; |
| 299 |
} |
| 300 |
|
| 301 |
cmd = g_strconcat ("xsetwacom set ", p, " Rotate ", arg, NULL); |
| 302 |
g_print ("Running '%s'\n", cmd); |
| 303 |
g_spawn_command_line_sync (cmd, NULL, NULL, &status, NULL); |
| 304 |
g_free (cmd); |
| 305 |
|
| 306 |
if (status) |
| 307 |
g_printerr ("Failed to rotate stylus %s\n", p); |
| 308 |
} |
| 309 |
|
| 310 |
g_free (output); |
| 311 |
} |
| 312 |
|
| 254 |
static gboolean |
313 |
static gboolean |
| 255 |
apply_config (DisplayInfo *info) |
314 |
apply_config (DisplayInfo *info) |
| 256 |
{ |
315 |
{ |
|
Lines 302-307
Link Here
|
| 302 |
new_res, |
361 |
new_res, |
| 303 |
new_rotation, |
362 |
new_rotation, |
| 304 |
GDK_CURRENT_TIME); |
363 |
GDK_CURRENT_TIME); |
|
|
364 |
|
| 365 |
if (new_rotation != screen_info->current_rotation) |
| 366 |
set_wacom_cursors (new_rotation); |
| 305 |
} |
367 |
} |
| 306 |
} |
368 |
} |
| 307 |
|
369 |
|
|
Lines 345-351
Link Here
|
| 345 |
screen_info->old_rotation, |
407 |
screen_info->old_rotation, |
| 346 |
screen_info->old_rate, |
408 |
screen_info->old_rate, |
| 347 |
GDK_CURRENT_TIME); |
409 |
GDK_CURRENT_TIME); |
| 348 |
|
410 |
|
|
|
411 |
if (screen_info->old_rotation != screen_info->current_rotation) |
| 412 |
set_wacom_cursors (screen_info->old_rotation); |
| 349 |
} |
413 |
} |
| 350 |
|
414 |
|
| 351 |
update_display_info (info, display); |
415 |
update_display_info (info, display); |
|
Lines 1113-1118
Link Here
|
| 1113 |
|
1177 |
|
| 1114 |
gtk_init (&argc, &argv); |
1178 |
gtk_init (&argc, &argv); |
| 1115 |
|
1179 |
|
|
|
1180 |
wacom_util_path = g_find_program_in_path ("xsetwacom"); |
| 1181 |
|
| 1116 |
resapplet = resapplet_new (); |
1182 |
resapplet = resapplet_new (); |
| 1117 |
|
1183 |
|
| 1118 |
resapplet_set_tooltip (); |
1184 |
resapplet_set_tooltip (); |
|
Lines 1123-1127
Link Here
|
| 1123 |
|
1189 |
|
| 1124 |
gtk_main (); |
1190 |
gtk_main (); |
| 1125 |
|
1191 |
|
|
|
1192 |
g_free (wacom_util_path); |
| 1126 |
return 0; |
1193 |
return 0; |
| 1127 |
} |
1194 |
} |