mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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]
This commit is contained in:
6
gtk.c
6
gtk.c
@ -181,10 +181,10 @@ static gint button_event(GtkWidget *widget, GdkEventButton *event,
|
|||||||
if (event->type != GDK_BUTTON_PRESS)
|
if (event->type != GDK_BUTTON_PRESS)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (event->button == 1)
|
if (event->button == 2 || (event->state & GDK_SHIFT_MASK))
|
||||||
button = LEFT_BUTTON;
|
|
||||||
else if (event->button == 2)
|
|
||||||
button = MIDDLE_BUTTON;
|
button = MIDDLE_BUTTON;
|
||||||
|
else if (event->button == 1)
|
||||||
|
button = LEFT_BUTTON;
|
||||||
else if (event->button == 3)
|
else if (event->button == 3)
|
||||||
button = RIGHT_BUTTON;
|
button = RIGHT_BUTTON;
|
||||||
else
|
else
|
||||||
|
23
windows.c
23
windows.c
@ -438,12 +438,25 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
if (!midend_process_key(fe->me, LOWORD(lParam), HIWORD(lParam),
|
{
|
||||||
(message == WM_LBUTTONDOWN ? LEFT_BUTTON :
|
int button;
|
||||||
message == WM_RBUTTONDOWN ? RIGHT_BUTTON :
|
|
||||||
MIDDLE_BUTTON)))
|
|
||||||
PostQuitMessage(0);
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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;
|
break;
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
if (!midend_process_key(fe->me, 0, 0, (unsigned char)wParam))
|
if (!midend_process_key(fe->me, 0, 0, (unsigned char)wParam))
|
||||||
|
Reference in New Issue
Block a user