orca r4037 - in trunk: . src/orca



Author: wwalker
Date: Thu Jul 17 10:03:29 2008
New Revision: 4037
URL: http://svn.gnome.org/viewvc/orca?rev=4037&view=rev

Log:
Fix for bug #533095 - Magnifier should turn off the system sprite/cursor/mouse when using full screen magnification


Modified:
   trunk/ChangeLog
   trunk/src/orca/mag.py
   trunk/src/orca/orca-setup.glade
   trunk/src/orca/orca_gui_prefs.py
   trunk/src/orca/settings.py

Modified: trunk/src/orca/mag.py
==============================================================================
--- trunk/src/orca/mag.py	(original)
+++ trunk/src/orca/mag.py	Thu Jul 17 10:03:29 2008
@@ -465,6 +465,21 @@
     except:
         debug.printException(debug.LEVEL_WARNING)
 
+    # If we are running in full screen mode, try to hide the original cursor
+    # (assuming the user wants to). See bug #533095 for more details.
+    # Depends upon new functionality in gnome-mag, so just catch the 
+    # exception if this functionality isn't there.
+    #
+    try:
+        hideCursor = restore.get('magHideCursor', settings.magHideCursor)
+        if hideCursor and \
+           _fullScreenCapable and \
+           _magnifier.SourceDisplay == _magnifier.TargetDisplay and \
+           position == settings.MAG_ZOOMER_TYPE_FULL_SCREEN:
+            _magnifier.hideCursor()
+    except:
+        pass
+
     _magnifierPBag = _magnifier.getProperties()
     sdb = _magnifierPBag.getValue("source-display-bounds").value()
     if not _originalSourceDisplayBounds:
@@ -1377,6 +1392,42 @@
     if updateScreen:
         _zoomer.markDirty(_roi)
 
+def setSystemPointer(hidePointer):
+    """Hide or show the system pointer.
+
+    Arguments:
+    -hidePointer: If True, hide the system pointer, otherwise show it.
+    """
+
+    global _magnifier
+
+    if not _initialized:
+        _magnifier = bonobo.get_object("OAFIID:GNOME_Magnifier_Magnifier:0.9",
+                                       "GNOME/Magnifier/Magnifier")
+
+    # Depends upon new functionality in gnome-mag, so just catch the
+    # exception if this functionality isn't there.
+    #
+    try:
+        if hidePointer:
+            _magnifier.hideCursor()
+        else:
+            _magnifier.showCursor()
+    except:
+        pass
+
+def isFullScreenCapable():
+    """Returns True if we are capable of doing full screen (i.e. whether
+    composite is being used.
+    """
+
+    try:
+        capable = _magnifier.fullScreenCapable()
+    except:
+        capable = False
+
+    return capable
+
 def isFilteringCapable():
     """Returns True if we're able to take advantage of libcolorblind's color
     filtering.

Modified: trunk/src/orca/orca-setup.glade
==============================================================================
--- trunk/src/orca/orca-setup.glade	(original)
+++ trunk/src/orca/orca-setup.glade	Thu Jul 17 10:03:29 2008
@@ -2576,58 +2576,6 @@
 				      </child>
 
 				      <child>
-					<widget class="GtkAlignment" id="alignment31">
-					  <property name="visible">True</property>
-					  <property name="xalign">0.5</property>
-					  <property name="yalign">0.5</property>
-					  <property name="xscale">1</property>
-					  <property name="yscale">1</property>
-					  <property name="top_padding">12</property>
-					  <property name="bottom_padding">0</property>
-					  <property name="left_padding">0</property>
-					  <property name="right_padding">0</property>
-
-					  <child>
-					    <placeholder/>
-					  </child>
-					</widget>
-					<packing>
-					  <property name="left_attach">0</property>
-					  <property name="right_attach">1</property>
-					  <property name="top_attach">2</property>
-					  <property name="bottom_attach">3</property>
-					  <property name="x_options">fill</property>
-					  <property name="y_options">fill</property>
-					</packing>
-				      </child>
-
-				      <child>
-					<widget class="GtkAlignment" id="alignment30">
-					  <property name="visible">True</property>
-					  <property name="xalign">0.5</property>
-					  <property name="yalign">0.5</property>
-					  <property name="xscale">1</property>
-					  <property name="yscale">1</property>
-					  <property name="top_padding">12</property>
-					  <property name="bottom_padding">0</property>
-					  <property name="left_padding">0</property>
-					  <property name="right_padding">0</property>
-
-					  <child>
-					    <placeholder/>
-					  </child>
-					</widget>
-					<packing>
-					  <property name="left_attach">1</property>
-					  <property name="right_attach">2</property>
-					  <property name="top_attach">2</property>
-					  <property name="bottom_attach">3</property>
-					  <property name="x_options">fill</property>
-					  <property name="y_options">fill</property>
-					</packing>
-				      </child>
-
-				      <child>
 					<widget class="GtkSpinButton" id="magZoomFactorSpinButton">
 					  <property name="visible">True</property>
 					  <property name="can_focus">True</property>
@@ -3061,6 +3009,44 @@
 					  <property name="y_options"></property>
 					</packing>
 				      </child>
+
+				      <child>
+					<widget class="GtkAlignment" id="alignment31">
+					  <property name="visible">True</property>
+					  <property name="xalign">0.5</property>
+					  <property name="yalign">0.5</property>
+					  <property name="xscale">1</property>
+					  <property name="yscale">1</property>
+					  <property name="top_padding">2</property>
+					  <property name="bottom_padding">0</property>
+					  <property name="left_padding">19</property>
+					  <property name="right_padding">0</property>
+
+					  <child>
+					    <widget class="GtkCheckButton" id="magHideCursorCheckButton">
+					      <property name="border_width">3</property>
+					      <property name="visible">True</property>
+					      <property name="can_focus">True</property>
+					      <property name="label" translatable="yes">Hide s_ystem pointer</property>
+					      <property name="use_underline">True</property>
+					      <property name="relief">GTK_RELIEF_NORMAL</property>
+					      <property name="focus_on_click">True</property>
+					      <property name="active">False</property>
+					      <property name="inconsistent">False</property>
+					      <property name="draw_indicator">True</property>
+					      <signal name="toggled" handler="magHideCursorChecked" last_modification_time="Mon, 07 Jul 2008 14:41:59 GMT"/>
+					    </widget>
+					  </child>
+					</widget>
+					<packing>
+					  <property name="left_attach">0</property>
+					  <property name="right_attach">2</property>
+					  <property name="top_attach">2</property>
+					  <property name="bottom_attach">3</property>
+					  <property name="x_options">fill</property>
+					  <property name="y_options">fill</property>
+					</packing>
+				      </child>
 				    </widget>
 				  </child>
 				</widget>

Modified: trunk/src/orca/orca_gui_prefs.py
==============================================================================
--- trunk/src/orca/orca_gui_prefs.py	(original)
+++ trunk/src/orca/orca_gui_prefs.py	Thu Jul 17 10:03:29 2008
@@ -1589,6 +1589,12 @@
         self.get_widget("magCursorOnOffCheckButton").set_active(value)
         self.get_widget("magCursorTable").set_sensitive(value)
 
+        # Get the 'Hide system cursor' preference and set the checkbox 
+        # accordingly.
+        #
+        value = prefs["magHideCursor"]
+        self.get_widget("magHideCursorCheckButton").set_active(value)
+
         # Get the 'Explicit cursor size' preference and set the checkbox
         # accordingly. If the value is not checked, then the cursor size
         # spin button and label need to be set insensitive.
@@ -1739,6 +1745,18 @@
         self.get_widget("magZoomerCustomPositionTable").\
                 set_sensitive(zoomerPref == settings.MAG_ZOOMER_TYPE_CUSTOM)
 
+        # If the Zoomer settings position is full screen, and we are full
+        # screen capable and we are capable of hiding or showing the system
+        # pointer, then show the Hide system cursor checkbox.
+        #
+        isFullScreen = (zoomerPref == settings.MAG_ZOOMER_TYPE_FULL_SCREEN)
+        try:
+            showCheckbox = mag.isFullScreenCapable() and isFullScreen
+            mag.setSystemPointer(False)
+        except:
+            showCheckbox = False
+        self.get_widget("magHideCursorCheckButton").set_sensitive(showCheckbox)
+
         # Populate the zoomer spin buttons based on the size of the target
         # display.
         #
@@ -3099,9 +3117,33 @@
             size = \
                  self.get_widget("magBorderSizeSpinButton").get_value_as_int()
 
+        # If the Zoomer settings position is full screen, and we are full
+        # screen capable and we are capable of hiding or showing the system
+        # pointer, then show the Hide system cursor checkbox.
+        #
+        isFullScreen = (zoomerType == settings.MAG_ZOOMER_TYPE_FULL_SCREEN)
+        try:
+            showCheckbox = mag.isFullScreenCapable() and isFullScreen
+            mag.setSystemPointer(False)
+        except:
+            showCheckbox = False
+        self.get_widget("magHideCursorCheckButton").set_sensitive(showCheckbox)
+
+        # Also if it's not full screen, then automatically clear the 
+        # 'hide cursor' preference and check box.
+        #
+        if not isFullScreen:
+            self.prefsDict["magHideCursor"] = False
+            self.get_widget("magHideCursorCheckButton").set_active(False)
+
         if not self.enableLiveUpdating:
             return
 
+        try:
+            mag.setSystemPointer(self.prefsDict["magHideCursor"])
+        except:
+            pass
+
         if zoomerType == settings.MAG_ZOOMER_TYPE_CUSTOM:
             top = \
                 self.get_widget("magZoomerTopSpinButton").get_value_as_int()
@@ -3118,6 +3160,22 @@
             mag.setupMagnifier(zoomerType, restore=self.prefsDict)
         mag.setZoomerObjectSize("border-size", size)
 
+    def magHideCursorChecked(self, widget):
+        """Signal handler for the "toggled" signal for the
+           magHideCursorCheckButton GtkCheckButton widget. The user
+           has [un]checked the hide system cursor checkbox. Set the
+           'magHideCursor' preference to the new value.
+
+        Arguments:
+        - widget: the component that generated the signal.
+        """
+
+        checked = widget.get_active()
+        self.prefsDict["magHideCursor"] = checked
+
+        if self.enableLiveUpdating:
+            mag.setSystemPointer(checked)
+
     def magZoomerTopValueChanged(self, widget):
         """Signal handler for the "value_changed" signal for the
            magZoomerTopSpinButton GtkSpinButton widget.

Modified: trunk/src/orca/settings.py
==============================================================================
--- trunk/src/orca/settings.py	(original)
+++ trunk/src/orca/settings.py	Thu Jul 17 10:03:29 2008
@@ -119,6 +119,7 @@
     "enableMagLiveUpdating",
     "enableMagCursor",
     "enableMagCursorExplicitSize",
+    "magHideCursor",
     "magCursorSize",
     "magCursorColor",
     "enableMagCrossHair",
@@ -368,6 +369,10 @@
 #
 enableMagCursorExplicitSize      = False
 
+# If True, hide the system cursor.
+#
+magHideCursor                    = False
+
 # Size of the magnification cursor (in pixels).
 #
 magCursorSize                    = 32



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