Nit: "warning: extra tokens at end of #endif directive"
[sgt/puzzles] / osx.m
diff --git a/osx.m b/osx.m
index 11436a8..ed33bf6 100644 (file)
--- a/osx.m
+++ b/osx.m
@@ -589,22 +589,34 @@ struct frontend {
         * function key codes.
         */
        if (c >= 0x80) {
+           int mods = FALSE;
            switch (c) {
              case NSUpArrowFunctionKey:
                c = CURSOR_UP;
+               mods = TRUE;
                break;
              case NSDownArrowFunctionKey:
                c = CURSOR_DOWN;
+               mods = TRUE;
                break;
              case NSLeftArrowFunctionKey:
                c = CURSOR_LEFT;
+               mods = TRUE;
                break;
              case NSRightArrowFunctionKey:
                c = CURSOR_RIGHT;
+               mods = TRUE;
                break;
              default:
                continue;
            }
+
+           if (mods) {
+               if ([ev modifierFlags] & NSShiftKeyMask)
+                   c |= MOD_SHFT;
+               if ([ev modifierFlags] & NSControlKeyMask)
+                   c |= MOD_CTRL;
+           }
        }
 
        if (c >= '0' && c <= '9' && ([ev modifierFlags] & NSNumericPadKeyMask))
@@ -651,7 +663,7 @@ struct frontend {
 }
 - (void)restartGame:(id)sender
 {
-    [self processButton:'r' x:-1 y:-1];
+    midend_restart_game(me);
 }
 - (void)undoMove:(id)sender
 {
@@ -1051,6 +1063,11 @@ struct frontend {
 
 - (void)specificGame:(id)sender
 {
+    [self startConfigureSheet:CFG_DESC];
+}
+
+- (void)specificRandomGame:(id)sender
+{
     [self startConfigureSheet:CFG_SEED];
 }
 
@@ -1340,6 +1357,8 @@ int main(int argc, char **argv)
     item = newitem(menu, "New Game", "n", NULL, @selector(newGame:));
     item = newitem(menu, "Restart Game", "r", NULL, @selector(restartGame:));
     item = newitem(menu, "Specific Game", "", NULL, @selector(specificGame:));
+    item = newitem(menu, "Specific Random Seed", "", NULL,
+                   @selector(specificRandomGame:));
     [menu addItem:[NSMenuItem separatorItem]];
     {
        NSMenu *submenu = newsubmenu(menu, "New Window");