aboutsummaryrefslogtreecommitdiff
path: root/nestedvm.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 /nestedvm.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 'nestedvm.c')
-rw-r--r--nestedvm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/nestedvm.c b/nestedvm.c
index ec633d3..11be3b8 100644
--- a/nestedvm.c
+++ b/nestedvm.c
@@ -206,7 +206,7 @@ int jcallback_key_event(int x, int y, int keyval)
if (fe->ox == -1)
return 1;
if (keyval >= 0 &&
- !midend_process_key(fe->me, x - fe->ox, y - fe->oy, keyval))
+ !midend_process_key(fe->me, x - fe->ox, y - fe->oy, keyval, NULL))
return 42;
return 1;
}
@@ -323,7 +323,7 @@ static bool get_config(frontend *fe, int which)
int jcallback_newgame_event(void)
{
frontend *fe = (frontend *)_fe;
- if (!midend_process_key(fe->me, 0, 0, UI_NEWGAME))
+ if (!midend_process_key(fe->me, 0, 0, UI_NEWGAME, NULL))
return 42;
return 0;
}
@@ -331,7 +331,7 @@ int jcallback_newgame_event(void)
int jcallback_undo_event(void)
{
frontend *fe = (frontend *)_fe;
- if (!midend_process_key(fe->me, 0, 0, UI_UNDO))
+ if (!midend_process_key(fe->me, 0, 0, UI_UNDO, NULL))
return 42;
return 0;
}
@@ -339,7 +339,7 @@ int jcallback_undo_event(void)
int jcallback_redo_event(void)
{
frontend *fe = (frontend *)_fe;
- if (!midend_process_key(fe->me, 0, 0, UI_REDO))
+ if (!midend_process_key(fe->me, 0, 0, UI_REDO, NULL))
return 42;
return 0;
}
@@ -347,7 +347,7 @@ int jcallback_redo_event(void)
int jcallback_quit_event(void)
{
frontend *fe = (frontend *)_fe;
- if (!midend_process_key(fe->me, 0, 0, UI_QUIT))
+ if (!midend_process_key(fe->me, 0, 0, UI_QUIT, NULL))
return 42;
return 0;
}