OSDN Git Service

Changed to user changes to the window size are in increments of the current width...
authorEric Branlund <ebranlund@fastmail.com>
Wed, 18 Mar 2020 05:32:54 +0000 (22:32 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Wed, 18 Mar 2020 05:32:54 +0000 (22:32 -0700)
src/main-cocoa.m

index 366edb6..0f6b17f 100644 (file)
@@ -1062,11 +1062,11 @@ struct PendingCellChange {
 - (void)resizeTerminalWithContentRect: (NSRect)contentRect saveToDefaults: (BOOL)saveToDefaults;
 
 /*
- * Change the minimum size for the window associated with the context.
- * termIdx is the index for the terminal:  pass it so this function can be
- * used when self->terminal has not yet been set.
+ * Change the minimum size and size increments for the window associated with
+ * the context.  termIdx is the index for the terminal:  pass it so this
+ * function can be used when self->terminal has not yet been set.
  */
-- (void)setMinimumWindowSize:(int)termIdx;
+- (void)constrainWindowSize:(int)termIdx;
 
 /* Called from the view to indicate that it is starting or ending live resize */
 - (void)viewWillStartLiveResize:(AngbandView *)view;
@@ -1777,7 +1777,7 @@ static int compare_advances(const void *ap, const void *bp)
            [self.primaryWindow
                 contentRectForFrameRect: [self.primaryWindow frame]];
 
-       [self setMinimumWindowSize:[self terminalIndex]];
+       [self constrainWindowSize:[self terminalIndex]];
        NSSize size = self.primaryWindow.contentMinSize;
        BOOL windowNeedsResizing = NO;
        if (contentRect.size.width < size.width) {
@@ -2175,7 +2175,7 @@ static __strong NSFont* gDefaultFont = nil;
     Term_activate( old );
 }
 
-- (void)setMinimumWindowSize:(int)termIdx
+- (void)constrainWindowSize:(int)termIdx
 {
     NSSize minsize;
 
@@ -2191,6 +2191,7 @@ static __strong NSFont* gDefaultFont = nil;
     minsize.height =
         minsize.height * self.tileSize.height + self.borderSize.height * 2.0;
     [[self makePrimaryWindow] setContentMinSize:minsize];
+    self.primaryWindow.contentResizeIncrements = self.tileSize;
 }
 
 - (void)saveWindowVisibleToDefaults: (BOOL)windowVisible
@@ -2535,7 +2536,7 @@ static void Term_init_cocoa(term *t)
 
        /* Set its title and, for auxiliary terms, tentative size */
        [context setDefaultTitle:termIdx];
-       [context setMinimumWindowSize:termIdx];
+       [context constrainWindowSize:termIdx];
 
        /*
         * If this is the first term, and we support full screen (Mac OS X Lion