mousetweaks r154 - in trunk: . man src



Author: gerdk
Date: Wed May 14 15:35:48 2008
New Revision: 154
URL: http://svn.gnome.org/viewvc/mousetweaks?rev=154&view=rev

Log:
2008-05-14 Gerd Kohlberger <gerdk svn gnome org>

	* src/mt-main.c: Add more command-line options.
	* man/mousetweaks.1: Add new options.



Modified:
   trunk/ChangeLog
   trunk/man/mousetweaks.1
   trunk/src/mt-main.c

Modified: trunk/man/mousetweaks.1
==============================================================================
--- trunk/man/mousetweaks.1	(original)
+++ trunk/man/mousetweaks.1	Wed May 14 15:35:48 2008
@@ -9,48 +9,60 @@
 mousetweaks \- Accessibility enhancements for the mouse
 .SH SYNOPSIS
 .B mousetweaks
-[\-e|\-\-enable=STRING] [\-m|\-\-dwell\-mode=STRING]
-[\-c|\-\-show\-ctw] [\-x|\-\-ctw\-x=INT] [\-y|\-\-ctw\-y=INT] [\-s|\-\-shutdown]
-.br
-.B mousetweaks
-[\-?|\-\-help]
+[\-\-enable\-dwell] [\-\-enable\-secondary]
+[\-\-dwell\-time=FLOAT] [\-\-secondary\-time=FLOAT]
+[\-m|\-\-dwell\-mode=STRING] [\-c|\-\-show\-ctw]
+[\-x|\-\-ctw\-x=INT] [\-y|\-\-ctw\-y=INT]
+[\-t|\-\-threshold=INT] [\-a|\-\-animate\-cursor]
+[\-s|\-\-shutdown] [\-?|\-\-help]
 .SH DESCRIPTION
 .B mousetweaks
 is a daemon that provides various mouse features for the GNOME desktop.
-It depends on Assistve Technology.
+It depends on the Assistive Technology Service Provider Interface (AT-SPI).
 .SH OPTIONS
 .TP
-.B \-e, \-\-enable=STRING
-Enable a mousetweaks feature. Available arguments are: dwell, delay
-.RS
-.IPs DWELL
-Automatically perform mouse clicks without using a physical button
-.IPs DELAY
-Trigger the secondary mouse button when the primary button is held down
-for a specified amount of time 
-.RE
+.B \-\-enable\-dwell
+Automatically perform mouse clicks without using a physical button.
+.TP
+.B \-\-enable\-secondary
+Trigger the secondary mouse button when the primary mouse button is held down
+for a specified amount of time.
+.TP
+.B \-\-dwell\-time=FLOAT
+Time to keep the pointer motionless before a dwell click is performed.
+Range: 0.5 - 3.0 seconds.
+.TP
+.B \-\-secondary\-time=FLOAT
+Time to hold the primary mouse button before a simulated secondary
+click is performed. Range: 0.5 - 3.0 seconds.
 .TP
 .B \-m, \-\-dwell\-mode=STRING
 Select a dwelling mode. Available arguments are: window, gesture
 .RS
 .IPs WINDOW
-Select the active click type from a window or a panel applet
+Select the active click type from a window or a panel applet.
 .IPs GESTURE
 Perform clicks by moving in different directions after the cursor changes
-to a cross
+its shape.
 .RE
 .TP
 .B \-c, \-\-show\-ctw
-Show the click\-type window. Only useful in combination with dwell\-mode window
+Show the click\-type window. Only useful in combination with dwell\-mode=window.
 .TP
 .B \-x, \-\-ctw\-x=INT
-X Position of the click\-type window on screen
+X Position of the click\-type window on screen.
 .TP
 .B \-y, \-\-ctw\-y=INT
-Y Position of the click\-type window on screen
+Y Position of the click\-type window on screen.
+.TP
+.B \-t, \-\-threshold=INT
+Ignore small pointer movements. Range 0 - 30 pixels.
+.TP
+.B \-a, \-\-animate-cursor
+Show elapsed time as cursor overlay.
 .TP
 .B \-s, \-\-shutdown
-Stop the mousetweaks daemon
+Stop the mousetweaks daemon.
 .SH FILES
 .I ~/.mousetweaks.pid
 .RS

Modified: trunk/src/mt-main.c
==============================================================================
--- trunk/src/mt-main.c	(original)
+++ trunk/src/mt-main.c	Wed May 14 15:35:48 2008
@@ -541,6 +541,11 @@
 		gnome_client_request_save (session, GNOME_SAVE_GLOBAL, TRUE,
 					   GNOME_INTERACT_ANY, FALSE, TRUE);
 	}
+	else {
+	    /* reset the selected option again */
+	    gconf_client_set_bool (mt->client, OPT_DELAY, FALSE, NULL);
+	    gconf_client_set_bool (mt->client, OPT_DWELL, FALSE, NULL);
+	}
 	return FALSE;
     }
     return TRUE;
@@ -596,25 +601,43 @@
 int
 main (int argc, char **argv)
 {
-    pid_t pid;
-    gboolean shutdown = FALSE, ctw = FALSE;
-    gchar *mode = NULL, *enable = NULL;
-    gint pos_x = -1, pos_y = -1;
+    pid_t    pid;
+    gboolean delay_click = FALSE;
+    gboolean dwell_click = FALSE;
+    gdouble  delay_time  = -1.;
+    gdouble  dwell_time  = -1.;
+    gboolean shutdown    = FALSE;
+    gboolean ctw         = FALSE;
+    gboolean animate     = FALSE;
+    gchar   *mode        = NULL;
+    gint     pos_x       = -1;
+    gint     pos_y       = -1;
+    gint     threshold   = -1;
     GOptionContext *context;
     GOptionEntry entries[] = {
-	{"enable", 'e', 0, G_OPTION_ARG_STRING, &enable,
-	    _("Enable mousetweaks feature"), "(dwell|delay)"},
+	{"enable-dwell", 0, 0, G_OPTION_ARG_NONE, &dwell_click,
+	    _("Enable dwell click"), 0},
+	{"enable-seconadry", 0, 0, G_OPTION_ARG_NONE, &delay_click,
+	    _("Enable simualted secondary click"), 0},
+	{"dwell-time", 0, 0, G_OPTION_ARG_DOUBLE, &dwell_time,
+	    _("Dwell click time"), "[0.5-3.0]"},
+	{"seconadry-time", 0, 0, G_OPTION_ARG_DOUBLE, &delay_time,
+	    _("Simualted secondary click time"), "[0.5-3.0]"},
 	{"dwell-mode", 'm', 0, G_OPTION_ARG_STRING, &mode,
-	    _("Use dwell mode"), "(window|gesture)"},
+	    _("Dwell mode to use"), "[window|gesture]"},
 	{"show-ctw", 'c', 0, G_OPTION_ARG_NONE, &ctw,
 	    _("Show click type window"), 0},
 	{"ctw-x", 'x', 0, G_OPTION_ARG_INT, &pos_x,
 	    _("Window x position"), 0},
 	{"ctw-y", 'y', 0, G_OPTION_ARG_INT, &pos_y,
 	    _("Window y position"), 0},
+	{"threshold", 't', 0, G_OPTION_ARG_INT, &threshold,
+	    _("Ignore small pointer movements"), "[0-30]"},
+	{"animate-cursor", 'a', 0, G_OPTION_ARG_NONE, &animate,
+	    _("Show elapsed time as cursor overlay"), 0},
 	{"shutdown", 's', 0, G_OPTION_ARG_NONE, &shutdown,
 	    _("Shut down mousetweaks"), 0},
-	{NULL}
+	{ NULL }
     };
 
     bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
@@ -636,12 +659,10 @@
 
 	return ret < 0 ? 1 : 0;
     }
-
     if ((pid = mt_pidfile_is_running ()) >= 0) {
 	g_print ("Daemon is already running. (PID %u)\n", pid);
 	return 1;
     }
-
     g_print ("Starting daemon.\n");
 
     if ((pid = fork ()) < 0) {
@@ -678,9 +699,6 @@
 
 	spi_status = SPI_init ();
 	if (!accessibility_enabled (mt, spi_status)) {
-	    /* disable options again */
-	    gconf_client_set_bool (mt->client, OPT_DELAY, FALSE, NULL);
-	    gconf_client_set_bool (mt->client, OPT_DWELL, FALSE, NULL);
 	    mt_closure_free (mt);
 	    goto FINISH;
 	}
@@ -693,21 +711,20 @@
 	SPI_registerGlobalEventListener (bl, "mouse:button:1r");
 
 	/* command-line options */
-	if (enable) {
-	    if (g_str_equal (enable, "dwell")) {
-		gconf_client_set_bool (mt->client, OPT_DELAY, FALSE, NULL);
-		gconf_client_set_bool (mt->client, OPT_DWELL, TRUE, NULL);
-	    }
-	    if (g_str_equal (enable, "delay")) {
-		gconf_client_set_bool (mt->client, OPT_DWELL, FALSE, NULL);
-		gconf_client_set_bool (mt->client, OPT_DELAY, TRUE, NULL);
-	    }
-	    g_free (enable);
-	}
-
+	if (dwell_click)
+	    gconf_client_set_bool (mt->client, OPT_DWELL, TRUE, NULL);
+	if (delay_click)
+	    gconf_client_set_bool (mt->client, OPT_DELAY, TRUE, NULL);
+	if (delay_time >= .5 && delay_time <= 3.)
+	    gconf_client_set_float (mt->client, OPT_DELAY_T, delay_time, NULL);
+	if (dwell_time >= .5 && dwell_time <= 3.)
+	    gconf_client_set_float (mt->client, OPT_DWELL_T, dwell_time, NULL);
+	if (threshold >= 0 && threshold <= 30)
+	    gconf_client_set_int (mt->client, OPT_THRESHOLD, threshold, NULL);
 	if (ctw)
 	    gconf_client_set_bool (mt->client, OPT_CTW, TRUE, NULL);
-
+	if (animate)
+	    gconf_client_set_bool (mt->client, OPT_ANIMATE, TRUE, NULL);
 	if (mode) {
 	    if (g_str_equal (mode, "gesture"))
 		gconf_client_set_int (mt->client, OPT_MODE,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]