aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-28 17:42:32 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-28 17:42:32 +0000
commite96f53452ac06e6b533a30d4caad30dd0dbe46fb (patch)
tree967d1371d7d38d30924873fbcc88e8ac0fe400df
parent3b1ec74d732399333f0b99a7af2a55cdd394a6cb (diff)
downloadpuzzles-e96f53452ac06e6b533a30d4caad30dd0dbe46fb.zip
puzzles-e96f53452ac06e6b533a30d4caad30dd0dbe46fb.tar.gz
puzzles-e96f53452ac06e6b533a30d4caad30dd0dbe46fb.tar.bz2
puzzles-e96f53452ac06e6b533a30d4caad30dd0dbe46fb.tar.xz
Shift-click is equivalent to middle-click. This is mostly for
Windows users who may not have a middle button at all, but I've replicated it in GTK to maintain cross-platform consistency. [originally from svn r4166]
-rw-r--r--gtk.c6
-rw-r--r--windows.c25
2 files changed, 22 insertions, 9 deletions
diff --git a/gtk.c b/gtk.c
index b69e95d..8a26730 100644
--- a/gtk.c
+++ b/gtk.c
@@ -181,10 +181,10 @@ static gint button_event(GtkWidget *widget, GdkEventButton *event,
if (event->type != GDK_BUTTON_PRESS)
return TRUE;
- if (event->button == 1)
- button = LEFT_BUTTON;
- else if (event->button == 2)
+ if (event->button == 2 || (event->state & GDK_SHIFT_MASK))
button = MIDDLE_BUTTON;
+ else if (event->button == 1)
+ button = LEFT_BUTTON;
else if (event->button == 3)
button = RIGHT_BUTTON;
else
diff --git a/windows.c b/windows.c
index 3d9820d..29b50bc 100644
--- a/windows.c
+++ b/windows.c
@@ -438,12 +438,25 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
- if (!midend_process_key(fe->me, LOWORD(lParam), HIWORD(lParam),
- (message == WM_LBUTTONDOWN ? LEFT_BUTTON :
- message == WM_RBUTTONDOWN ? RIGHT_BUTTON :
- MIDDLE_BUTTON)))
- PostQuitMessage(0);
-
+ {
+ int button;
+
+ /*
+ * Shift-clicks count as middle-clicks, since otherwise
+ * two-button Windows users won't have any kind of
+ * middle click to use.
+ */
+ if (message == WM_MBUTTONDOWN || (wParam & MK_SHIFT))
+ button = MIDDLE_BUTTON;
+ else if (message == WM_LBUTTONDOWN)
+ button = LEFT_BUTTON;
+ else
+ button = RIGHT_BUTTON;
+
+ if (!midend_process_key(fe->me, LOWORD(lParam),
+ HIWORD(lParam), button))
+ PostQuitMessage(0);
+ }
break;
case WM_CHAR:
if (!midend_process_key(fe->me, 0, 0, (unsigned char)wParam))