OSDN Git Service

Since the contents of Term aren't used, don't bother to call Term_activate() from...
[hengbandforosx/hengbandosx.git] / src / main-cocoa.m
index 06422b3..3cc5dff 100644 (file)
@@ -33,7 +33,7 @@
 #define kVK_ANSI_KeypadEnter 0x4C
 
 static NSString * const AngbandDirectoryNameLib = @"lib";
-static NSString * const AngbandDirectoryNameBase = @"Hengband";
+static NSString * const AngbandDirectoryNameBase = @VERSION_NAME;
 
 static NSString * const AngbandMessageCatalog = @"Localizable";
 static NSString * const AngbandTerminalsDefaultsKey = @"Terminals";
@@ -2177,9 +2177,6 @@ static bool initialized = FALSE;
 
 @implementation AngbandContext
 
-@synthesize hasSubwindowFlags=_hasSubwindowFlags;
-@synthesize windowVisibilityChecked=_windowVisibilityChecked;
-
 - (NSSize)baseSize
 {
     /*
@@ -2292,9 +2289,9 @@ static int compare_advances(const void *ap, const void *bp)
 
     /* Pick the center to find the median */
     CGFloat medianAdvance = 0;
+    /* In case we have all zero advances for some reason */
     if (startIdx < GLYPH_COUNT)
     {
-               /* In case we have all zero advances for some reason */
         medianAdvance = advances[(startIdx + GLYPH_COUNT)/2].width;
     }
 
@@ -2661,7 +2658,6 @@ static __strong NSFont* gDefaultFont = nil;
                                  backing:NSBackingStoreBuffered defer:YES];
        }
 
-
         /* Not to be released when closed */
         [self.primaryWindow setReleasedWhenClosed:NO];
         [self.primaryWindow setExcludedFromWindowsMenu: YES]; /* we're using custom window menu handling */
@@ -3295,7 +3291,6 @@ static int compare_nsrect_yorigin_greater(const void *ap, const void *bp)
     NSGraphicsContext *nsctx = nil;
     CGContextRef ctx = 0;
     NSFont* screenFont = nil;
-    term *old = 0;
     int graf_width = 0, graf_height = 0;
     int overdraw_row = 0, overdraw_max = 0;
     wchar_t blank = 0;
@@ -3303,8 +3298,6 @@ static int compare_nsrect_yorigin_greater(const void *ap, const void *bp)
        rect.origin.x + rect.size.width > self.borderSize.width &&
        rect.origin.y < bottomY &&
        rect.origin.y + rect.size.height > self.borderSize.height) {
-       old = Term;
-       Term_activate(self->terminal);
        nsctx = [NSGraphicsContext currentContext];
        ctx = [nsctx graphicsPort];
        screenFont = [self.angbandViewFont screenFont];
@@ -3330,9 +3323,6 @@ static int compare_nsrect_yorigin_greater(const void *ap, const void *bp)
     if (overdraw_row && invalidCount > 1) {
        sortedRects = malloc(invalidCount * sizeof(NSRect));
        if (sortedRects == 0) {
-           if (old != 0) {
-               Term_activate(old);
-           }
            NSException *exc = [NSException exceptionWithName:@"OutOfMemory"
                                            reason:@"sorted rects in drawRect"
                                            userInfo:nil];
@@ -3679,9 +3669,6 @@ static int compare_nsrect_yorigin_greater(const void *ap, const void *bp)
     }
 
     free(sortedRects);
-    if (old != 0) {
-       Term_activate(old);
-    }
 }
 
 - (BOOL)isOrderedIn
@@ -4250,8 +4237,8 @@ static void Term_init_cocoa(term *t)
                 * windows in the "standard default" window position in OS X:
                 * the upper center of the screen.  The term sizes set in
                 * load_prefs() are based on a 5-wide by 3-high grid, with the
-                 * main term being 4/5 wide by 2/3 high (hence the scaling to
-                 * find what the containing rect would be).
+                * main term being 4/5 wide by 2/3 high (hence the scaling to
+                * find what the containing rect would be).
                 */
                NSRect originalMainTermFrame = [window frame];
                NSRect scaledFrame = originalMainTermFrame;
@@ -4490,7 +4477,6 @@ static errr Term_xtra_cocoa_react(void)
                        @"Could not load the tile set.  Switched back to ASCII.",
                        @"Alert informative message for failed tile set load");
                    NSAlert *alert = [[NSAlert alloc] init];
-
                    alert.messageText = msg;
                    alert.informativeText = info;
                    [alert runModal];
@@ -5248,7 +5234,7 @@ static NSString* get_lib_directory(void)
 
     if( !libExists || !isDirectory )
     {
-       NSLog( @"Hengband: can't find %@/ in bundle: isDirectory: %d libExists: %d", AngbandDirectoryNameLib, isDirectory, libExists );
+       NSLog( @"%@: can't find %@/ in bundle: isDirectory: %d libExists: %d", @VERSION_NAME, AngbandDirectoryNameLib, isDirectory, libExists );
 
        NSString *msg = NSLocalizedStringWithDefaultValue(
            @"Error.MissingResources",
@@ -5266,7 +5252,6 @@ static NSString* get_lib_directory(void)
            @"Label.Quit", AngbandMessageCatalog, [NSBundle mainBundle],
            @"Quit", @"Quit");
        NSAlert *alert = [[NSAlert alloc] init];
-
        /*
         * Note that NSCriticalAlertStyle was deprecated in 10.10.  The
         * replacement is NSAlertStyleCritical.
@@ -5276,7 +5261,7 @@ static NSString* get_lib_directory(void)
        alert.informativeText = info;
        [alert addButtonWithTitle:quit_label];
        [alert runModal];
-       exit( 0 );
+       exit(0);
     }
 
     return bundleLibPath;
@@ -5363,15 +5348,18 @@ static term *term_data_link(int i)
     /* Initialize the term */
     term_init(newterm, columns, rows, 256 /* keypresses, for some reason? */);
 
-    /* Differentiate between BS/^h, Tab/^i, etc. */
-    /* newterm->complex_input = TRUE; */
-
     /* Use a "software" cursor */
     newterm->soft_cursor = TRUE;
 
     /* Disable the per-row flush notifications since they are not used. */
     newterm->never_frosh = TRUE;
 
+    /*
+     * Differentiate between BS/^h, Tab/^i, ... so ^h and ^j work under the
+     * roguelike command set.
+     */
+    /* newterm->complex_input = TRUE; */
+
     /* Erase with "white space" */
     newterm->attr_blank = TERM_WHITE;
     newterm->char_blank = ' ';