aboutsummaryrefslogtreecommitdiff
path: root/windows.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2022-11-05 16:05:39 +0000
committerBen Harris <bjh21@bjh21.me.uk>2022-11-08 10:27:19 +0000
commit4a37f7cf782592b670d0180a38eb1fd680288421 (patch)
tree5ddcad0f237d79bd8de158c1cb840f7ad5301958 /windows.c
parent4fdcc5497503658324fda2e0073d830276b24b60 (diff)
downloadpuzzles-4a37f7cf782592b670d0180a38eb1fd680288421.zip
puzzles-4a37f7cf782592b670d0180a38eb1fd680288421.tar.gz
puzzles-4a37f7cf782592b670d0180a38eb1fd680288421.tar.bz2
puzzles-4a37f7cf782592b670d0180a38eb1fd680288421.tar.xz
Add a way for midend_process_key() to report whether it handled a keypress
This adds a new bool * argument, which can be NULL if front ends don't care whether the keypress was handled. Currently they all do that. Currently, "undo" and "redo" keys are treated as not handled if there's no move to undo or redo. This may be a little too strict.
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/windows.c b/windows.c
index e58a150..e4942f4 100644
--- a/windows.c
+++ b/windows.c
@@ -2530,18 +2530,18 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
cmd = wParam & ~0xF; /* low 4 bits reserved to Windows */
switch (cmd) {
case IDM_NEW:
- if (!midend_process_key(fe->me, 0, 0, UI_NEWGAME))
+ if (!midend_process_key(fe->me, 0, 0, UI_NEWGAME, NULL))
PostQuitMessage(0);
break;
case IDM_RESTART:
midend_restart_game(fe->me);
break;
case IDM_UNDO:
- if (!midend_process_key(fe->me, 0, 0, UI_UNDO))
+ if (!midend_process_key(fe->me, 0, 0, UI_UNDO, NULL))
PostQuitMessage(0);
break;
case IDM_REDO:
- if (!midend_process_key(fe->me, 0, 0, UI_REDO))
+ if (!midend_process_key(fe->me, 0, 0, UI_REDO, NULL))
PostQuitMessage(0);
break;
case IDM_COPY:
@@ -2563,7 +2563,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
}
break;
case IDM_QUIT:
- if (!midend_process_key(fe->me, 0, 0, UI_QUIT))
+ if (!midend_process_key(fe->me, 0, 0, UI_QUIT, NULL))
PostQuitMessage(0);
break;
case IDM_CONFIG:
@@ -2833,7 +2833,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
}
if (key != -1) {
- if (!midend_process_key(fe->me, 0, 0, key))
+ if (!midend_process_key(fe->me, 0, 0, key, NULL))
PostQuitMessage(0);
} else {
MSG m;
@@ -2866,7 +2866,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
if (!midend_process_key(fe->me,
(signed short)LOWORD(lParam) - fe->bitmapPosition.left,
(signed short)HIWORD(lParam) - fe->bitmapPosition.top,
- button))
+ button, NULL))
PostQuitMessage(0);
SetCapture(hwnd);
@@ -2893,7 +2893,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
if (!midend_process_key(fe->me,
(signed short)LOWORD(lParam) - fe->bitmapPosition.left,
(signed short)HIWORD(lParam) - fe->bitmapPosition.top,
- button))
+ button, NULL))
PostQuitMessage(0);
ReleaseCapture();
@@ -2913,7 +2913,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
if (!midend_process_key(fe->me,
(signed short)LOWORD(lParam) - fe->bitmapPosition.left,
(signed short)HIWORD(lParam) - fe->bitmapPosition.top,
- button))
+ button, NULL))
PostQuitMessage(0);
}
break;
@@ -2927,7 +2927,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
(keystate[VK_CONTROL] & 0x80))
key = UI_REDO;
}
- if (!midend_process_key(fe->me, 0, 0, key))
+ if (!midend_process_key(fe->me, 0, 0, key, NULL))
PostQuitMessage(0);
}
return 0;