Accept control-click as an alternative for right-click when the Gdk

backend is Quartz.


This is a standard behavior on Macs, since they often have single-button 
mice or trackpads.



svn: r19752
This commit is contained in:
John Ralls
2012-06-04 00:47:19 +00:00
parent bb38c5c0ee
commit 0cc0915c03
16 changed files with 72 additions and 39 deletions

View File

@@ -77,7 +77,7 @@ from QuestionDialog import WarningDialog, ErrorDialog
from gen.plug.menu import PersonOption, FilterOption, FamilyOption
import ManagedWindow
from glade import Glade
from gui.utils import open_file_with_default_application
import gui.utils
import gui.user
# Import from specific modules in ReportBase
@@ -970,7 +970,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
"""
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.on_setup_clicked(obj)
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
elif gui.utils.is_right_click(event):
self.build_book_context_menu(event)
def avail_button_press(self, obj, event):
@@ -980,7 +980,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
"""
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.on_add_clicked(obj)
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
elif gui.utils.is_right_click(event):
self.build_avail_context_menu(event)
def build_book_context_menu(self, event):
@@ -1287,7 +1287,7 @@ class BookReportDialog(DocReportDialog):
self.doc.close()
if self.open_with_app.get_active():
open_file_with_default_application(self.target_path)
gui.utils.open_file_with_default_application(self.target_path)
#------------------------------------------------------------------------
#

View File

@@ -60,6 +60,7 @@ from libformatting import FormattingHelper
import gen.lib
import Errors
from gui.editors import EditPerson
import gui.utils
#-------------------------------------------------------------------------
#
@@ -523,7 +524,8 @@ class FanChartWidget(gtk.Widget):
if selected is None: # clicked in open area, or center
if radius < self.center:
# right mouse
if event.button == 3 and self.context_popup_callback:
if (gui.utils.is_right_click(event)
and self.context_popup_callback):
if self.data[0][0][1]:
self.context_popup_callback(widget, event,
self.data[0][0][1].handle)
@@ -538,7 +540,7 @@ class FanChartWidget(gtk.Widget):
# Do things based on state, event.state, or button, event.button
if event.button == 1: # left mouse
self.change_slice(generation, selected)
elif event.button == 3: # right mouse
elif gui.utils.is_right_click(event): # right mouse
text, person, parents, child = self.data[generation][selected]
if person and self.context_popup_callback:
self.context_popup_callback(widget, event, person.handle)

View File

@@ -56,6 +56,7 @@ from gui.plug import tool
import ManagedWindow
from QuestionDialog import InfoDialog
from glade import Glade
import gui.utils
#-------------------------------------------------------------------------
#
@@ -116,7 +117,7 @@ class Leak(tool.Tool, ManagedWindow.ManagedWindow):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.referenced_in()
return True
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
elif gui.utils.is_right_click(event):
self.refers_to()
return True

View File

@@ -46,6 +46,7 @@ import ManagedWindow
from gui.plug import tool
from gen.ggettext import sgettext as _
from glade import Glade
import gui.utils
#-------------------------------------------------------------------------
#
@@ -154,7 +155,7 @@ class OwnerEditor(tool.Tool, ManagedWindow.ManagedWindow):
def on_button_press_event(self, obj, event):
"""Shows popup-menu for db <-> preferences copying"""
if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
if gui.utils.is_right_click(event):
self.menu.popup(None,None,None,0,0)
def build_menu_names(self, obj):

View File

@@ -61,6 +61,7 @@ from gui.views.navigationview import NavigationView
import Errors
import Bookmarks
from gui.editors import EditPerson
import gui.utils
#-------------------------------------------------------------------------
#
@@ -539,7 +540,7 @@ class FanChartWidget(gtk.Widget):
if selected is None: # clicked in open area, or center
if radius < self.center:
# right mouse
if event.button == 3 and self.context_popup_callback:
if gui.utils.is_right_click(event):
if self.data[0][0][1]:
self.context_popup_callback(widget, event,
self.data[0][0][1].handle)
@@ -554,7 +555,7 @@ class FanChartWidget(gtk.Widget):
# Do things based on state, event.state, or button, event.button
if event.button == 1: # left mouse
self.change_slice(generation, selected)
elif event.button == 3: # right mouse
elif gui.utils.is_right_click(event):
text, person, parents, child = self.data[generation][selected]
if person and self.context_popup_callback:
self.context_popup_callback(widget, event, person.handle)

View File

@@ -64,6 +64,7 @@ import Bookmarks
import const
import constfunc
from QuestionDialog import RunDatabaseRepair, ErrorDialog
import gui.utils
#-------------------------------------------------------------------------
#
@@ -1511,7 +1512,7 @@ class PedigreeView(NavigationView):
self._last_y = event.y
self._in_move = True
return True
elif event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
elif gui.utils.is_right_click(event):
self.cb_on_show_option_menu(widget, event)
return True
return False
@@ -1565,7 +1566,7 @@ class PedigreeView(NavigationView):
or submenu for person for mouse right click.
And setup plug for button press on person widget.
"""
if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
if gui.utils.is_right_click(event):
self.cb_build_full_nav_menu(obj, event,
person_handle, family_handle)
return True
@@ -1580,7 +1581,7 @@ class PedigreeView(NavigationView):
on family line or call full submenu for mouse right click.
And setup plug for button press on family line.
"""
if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
if gui.utils.is_right_click(event):
self.cb_build_relation_nav_menu(obj, event, family_handle)
return True
elif event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
@@ -1597,7 +1598,7 @@ class PedigreeView(NavigationView):
if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
self.cb_add_parents(obj, person_handle, family_handle)
return True
elif event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
elif gui.utils.is_right_click(event):
self.cb_build_missing_parent_nav_menu(obj, event, person_handle,
family_handle)
return True