diff -a -u -u -r1.7 gdkevents-quartz.c
--- gtk+/gdk/quartz/gdkevents-quartz.c	15 May 2006 19:01:57 -0000	1.7
+++ gtk+/gdk/quartz/gdkevents-quartz.c	5 Jul 2006 05:15:09 -0000
@@ -26,6 +26,12 @@
 #include <pthread.h>
 #include <unistd.h>
 
+/* If true, control-left-click is interpreted as a right mouse button click, and
+ * command-left-click as a control-left-click. This follows the behavior
+ * expected by most Mac users.
+ */
+#define EMULATE_RIGHT_CLICK 1
+
 #include "gdkscreen.h"
 #include "gdkprivate-quartz.h"
 
@@ -625,12 +631,16 @@
 }
 
 static int
-convert_mouse_button_number (int button)
+convert_mouse_button_number (NSEvent *event)
 {
+  int button = [event buttonNumber];
   switch (button)
     {
     case 0:
-      return 1;
+      if (EMULATE_RIGHT_CLICK && ([event modifierFlags] & NSControlKeyMask))
+        return 3;
+      else
+        return 1;
     case 1:
       return 3;
     case 2:
@@ -674,7 +684,7 @@
       {
 	GdkEventMask mask = GDK_POINTER_MOTION_MASK|GDK_POINTER_MOTION_HINT_MASK|
 	                    GDK_BUTTON_MOTION_MASK;
-	if (convert_mouse_button_number ([nsevent buttonNumber]) == 2)
+	if (convert_mouse_button_number (nsevent) == 2)
 	  mask |= GDK_BUTTON2_MOTION_MASK;
 
 	return mask;
@@ -741,17 +751,29 @@
 {
   GdkModifierType modifiers = 0;
   int nsflags;
+  gboolean swap_ctrl_cmd = FALSE;
 
   nsflags = [nsevent modifierFlags];
   
+  if (EMULATE_RIGHT_CLICK)
+    switch ([nsevent type])
+      {
+        case NSLeftMouseDown:
+        case NSLeftMouseUp:
+        case NSLeftMouseDragged:
+          swap_ctrl_cmd = TRUE;
+        default:
+          ; /* Do nothing */
+      }
+  
   if (nsflags & NSAlphaShiftKeyMask)
     modifiers |= GDK_LOCK_MASK;
   if (nsflags & NSShiftKeyMask)
     modifiers |= GDK_SHIFT_MASK;
   if (nsflags & NSControlKeyMask)
-    modifiers |= GDK_CONTROL_MASK;
+    modifiers |= swap_ctrl_cmd ? GDK_MOD1_MASK : GDK_CONTROL_MASK;
   if (nsflags & NSCommandKeyMask)
-    modifiers |= GDK_MOD1_MASK;
+    modifiers |= swap_ctrl_cmd ? GDK_CONTROL_MASK : GDK_MOD1_MASK;
   
   /* FIXME: Support GDK_BUTTON_MASK */
 
@@ -1178,19 +1200,13 @@
     case NSRightMouseDown:
     case NSOtherMouseDown:
       type = GDK_BUTTON_PRESS;
-      button = convert_mouse_button_number ([nsevent buttonNumber]);
+      button = convert_mouse_button_number (nsevent);
       break;
     case NSLeftMouseUp:
-      type = GDK_BUTTON_RELEASE;
-      button = 1;
-      break;
     case NSRightMouseUp:
-      type = GDK_BUTTON_RELEASE;
-      button = 3;
-      break;
     case NSOtherMouseUp:
       type = GDK_BUTTON_RELEASE;
-      button = convert_mouse_button_number ([nsevent buttonNumber]);
+      button = convert_mouse_button_number (nsevent);
       break;
     default:
       g_assert_not_reached ();
@@ -1209,6 +1225,12 @@
 				      &event->button.x_root,
 				      &event->button.y_root);
 
+  GDK_NOTE(EVENTS,
+    g_message ("button %s:\t\twindow: %p  x,y: %.1f %.1f  button: %d",
+      type == GDK_BUTTON_PRESS ? "press" : "release",
+      event->button.window,
+      event->button.x, event->button.y,
+      event->button.button));
   return event;
 }
 
@@ -1225,7 +1247,7 @@
     case NSLeftMouseDragged:
     case NSRightMouseDragged:
     case NSOtherMouseDragged:
-      button = convert_mouse_button_number ([nsevent buttonNumber]);
+      button = convert_mouse_button_number (nsevent);
       /* Fall through */
     case NSMouseMoved:
       type = GDK_MOTION_NOTIFY;
