gok r2618 - in trunk: . gok



Author: gerdk
Date: Mon Feb  2 19:10:35 2009
New Revision: 2618
URL: http://svn.gnome.org/viewvc/gok?rev=2618&view=rev

Log:
2009-02-02  Gerd Kohlberger  <gerdk svn gnome org>

	Add a new '--disable-autobranch' command-line option to improve
	GOK for pointer users. See bug #536277 for details.

	* gok/main.c:
	* gok/main.h:
	* gok/gok-spy.c:



Modified:
   trunk/ChangeLog
   trunk/gok/gok-spy.c
   trunk/gok/main.c
   trunk/gok/main.h

Modified: trunk/gok/gok-spy.c
==============================================================================
--- trunk/gok/gok-spy.c	(original)
+++ trunk/gok/gok-spy.c	Mon Feb  2 19:10:35 2009
@@ -2302,7 +2302,8 @@
 	role = Accessible_getRole (accessible);
 
 	if (accessible && (m_ptheWindowAccessible == NULL) && 
-	    gok_spy_is_menu_role (role))
+	    gok_spy_is_menu_role (role) &&
+	    !gok_main_get_disable_autobranch ())
 	{
 	    AccessibleNode *node = g_new0 (AccessibleNode, 1);
 	    gchar *name;

Modified: trunk/gok/main.c
==============================================================================
--- trunk/gok/main.c	(original)
+++ trunk/gok/main.c	Mon Feb  2 19:10:35 2009
@@ -157,6 +157,7 @@
 	char* usb_vid_pid;
 	gdouble valuator_sensitivity;
 	gboolean non_system_mouse;
+	gboolean disable_autobranch;
 } GokArgs;
 
 static GokArgs gok_args;
@@ -348,6 +349,15 @@
 		N_("Attempt to use GOK without the system mouse"),
 		NULL
 	},
+	{
+		"disable-autobranch",
+		0,
+		0,
+		G_OPTION_ARG_NONE,
+		&gok_args.disable_autobranch,
+		N_("Disable automatic keyboard branching"),
+		NULL
+	},
 	/* End the list */
 	{	NULL}
 };
@@ -432,6 +442,7 @@
 	args->usb_vid_pid = NULL;
 	args->valuator_sensitivity = 0;
 	args->non_system_mouse = 0;
+	args->disable_autobranch = FALSE;
 }
 
 /* callback for gok window state events */
@@ -1098,15 +1109,19 @@
 {
 	GokKeyboard* pKeyboard = NULL;
 	Accessible *acc = NULL;
+	gboolean branch;
 
 	gok_log_enter();	
 
 	/* note: ref counting happens in gok-spy's listeners */
 	m_pForegroundWindowAccessible = pAccessible;
 
+	branch = !gok_main_get_disable_autobranch ();
+
 	/* reset the context menu until we receive a focus event */
 	/*gok_spy_set_context_menu_accessible (NULL, 0);*/
-	if (pAccessible && (Accessible_getRole (pAccessible) == SPI_ROLE_ALERT))
+	if (pAccessible && (Accessible_getRole (pAccessible) == SPI_ROLE_ALERT)
+	    && branch)
 	{
 	    AccessibleNode *node = g_malloc (sizeof (AccessibleNode));
 	    GokSpyUIFlags ui_flags;
@@ -1123,7 +1138,8 @@
 	}
 	else if (pAccessible && Accessible_getChildCount (pAccessible) == 1
 	    && (acc = Accessible_getChildAtIndex (pAccessible, 0))
-	    && Accessible_getRole (acc) == SPI_ROLE_MENU) 
+	    && Accessible_getRole (acc) == SPI_ROLE_MENU
+	    && branch)
 	{
 	    AccessibleNode *node = g_malloc (sizeof (AccessibleNode));
 	    GokSpyUIFlags menu_flags;
@@ -1557,7 +1573,11 @@
 	if (pKeyboard->bDynamicallyCreated != TRUE)
 	{
 		gok_log_leave();
-		return gok_main_display_scan_previous();
+
+		if (gok_main_get_disable_autobranch ())
+			return FALSE;
+		else
+			return gok_main_display_scan_previous ();
 	}
 
 	/* initialize this array */
@@ -2983,6 +3003,20 @@
 }
 
 /**
+ * gok_main_get_disable_autobranch:
+ *
+ * Call this to see if the disable-autobranch argument was passed
+ * in from the command line.
+ *
+ * Returns: TRUE if auto-branching is disabled.
+ **/
+gboolean
+gok_main_get_disable_autobranch (void)
+{
+	return gok_args.disable_autobranch;
+}
+
+/**
 * gok_main_get_inputdevice_name
 * 
 * returns: input device name

Modified: trunk/gok/main.h
==============================================================================
--- trunk/gok/main.h	(original)
+++ trunk/gok/main.h	Mon Feb  2 19:10:35 2009
@@ -96,6 +96,7 @@
 gboolean gok_main_get_use_corepointer (void);
 gboolean gok_main_get_use_xevie (void);
 gchar* gok_main_get_inputdevice_name (void);
+gboolean gok_main_get_disable_autobranch (void);
 void gok_main_check_accessibility (void);
 void gok_main_warn_corepointer (gboolean always, gboolean configuring, gboolean opt_out);
 gboolean gok_main_warn (gchar *message, gboolean always, GCallback cancelfunc, GCallback okfunc, gboolean opt_out);



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