aboutsummaryrefslogtreecommitdiff
path: root/windows.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-05-11 17:44:30 +0000
committerSimon Tatham <anakin@pobox.com>2004-05-11 17:44:30 +0000
commit180802b362c715dfb22893021f3434834447e5b5 (patch)
treea19141061c1ce27e17dbb3dda20eaf4cfbbf2cb6 /windows.c
parenta1c88470a30cf57226aa091f546da18d0dff07e1 (diff)
downloadpuzzles-180802b362c715dfb22893021f3434834447e5b5.zip
puzzles-180802b362c715dfb22893021f3434834447e5b5.tar.gz
puzzles-180802b362c715dfb22893021f3434834447e5b5.tar.bz2
puzzles-180802b362c715dfb22893021f3434834447e5b5.tar.xz
Framework alteration: we now support a `game_ui' structure in
addition to the `game_state'. The new structure is intended to contain ephemeral data pertaining to the game's user interface rather than the actual game: things stored in the UI structure are not restored in an Undo, for example. make_move() is passed the UI to modify as it wishes; it is now allowed to return the _same_ game_state it was passed, to indicate that although no move has been made there has been a UI operation requiring a redraw. [originally from svn r4207]
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/windows.c b/windows.c
index 4213e4c..7689993 100644
--- a/windows.c
+++ b/windows.c
@@ -939,7 +939,50 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
button = LEFT_BUTTON;
else
button = RIGHT_BUTTON;
-
+
+ if (!midend_process_key(fe->me, LOWORD(lParam),
+ HIWORD(lParam), button))
+ PostQuitMessage(0);
+
+ SetCapture(hwnd);
+ }
+ break;
+ case WM_LBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MBUTTONUP:
+ {
+ 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_MBUTTONUP || (wParam & MK_SHIFT))
+ button = MIDDLE_RELEASE;
+ else if (message == WM_LBUTTONUP)
+ button = LEFT_RELEASE;
+ else
+ button = RIGHT_RELEASE;
+
+ if (!midend_process_key(fe->me, LOWORD(lParam),
+ HIWORD(lParam), button))
+ PostQuitMessage(0);
+
+ ReleaseCapture();
+ }
+ break;
+ case WM_MOUSEMOVE:
+ {
+ int button;
+
+ if (wParam & (MK_MBUTTON | MK_SHIFT))
+ button = MIDDLE_DRAG;
+ else if (wParam & MK_LBUTTON)
+ button = LEFT_DRAG;
+ else
+ button = RIGHT_DRAG;
+
if (!midend_process_key(fe->me, LOWORD(lParam),
HIWORD(lParam), button))
PostQuitMessage(0);