OSDN Git Service

It's not currently used in hengband, but bring over the change to mouse event handlin...
authorEric Branlund <ebranlund@fastmail.com>
Sun, 22 Mar 2020 19:02:28 +0000 (12:02 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Sun, 22 Mar 2020 19:02:28 +0000 (12:02 -0700)
src/main-cocoa.m

index 7a32574..778452c 100644 (file)
@@ -4963,10 +4963,12 @@ static void AngbandHandleEventMouseDown( NSEvent *event )
                /* Coordinates run from (0,0) to (cols-1, rows-1). */
                BOOL mouseInMapSection = (x > 13 && x <= cols - 1 && y > 0  && y <= rows - 2);
 
-               /* If we are displaying a menu, allow clicks anywhere; if we are
-                * displaying the main game interface, only allow clicks in the map
-                * section */
-               if (!displayingMapInterface || (displayingMapInterface && mouseInMapSection))
+               /* If we are displaying a menu, allow clicks anywhere within
+                * the terminal bounds; if we are displaying the main game
+                * interface, only allow clicks in the map section */
+               if ((!displayingMapInterface && x >= 0 && x < cols &&
+                    y >= 0 && y < rows) ||
+                    (displayingMapInterface && mouseInMapSection))
                {
                        /* [event buttonNumber] will return 0 for left click,
                         * 1 for right click, but this is safer */