Skip to content

Commit

Permalink
fix an issue with double clicking in gui
Browse files Browse the repository at this point in the history
  • Loading branch information
johnathan-becker committed Nov 7, 2024
1 parent c89d743 commit 2abd852
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions Source/NSMenuView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,7 @@ - (BOOL) _trackWithEvent: (NSEvent*)event
BOOL justAttachedNewSubmenu = NO;
BOOL subMenusNeedRemoving = YES;
BOOL shouldFinish = YES;
BOOL shouldStop = NO;
BOOL popUpProcessEvents = [[GSTheme theme] doesProcessEventsForPopUpMenu];
int delayCount = 0;
int indexOfActionToExecute = -1;
Expand Down Expand Up @@ -1826,18 +1827,24 @@ - (BOOL) _trackWithEvent: (NSEvent*)event
}

do
{
event = [NSApp nextEventMatchingMask: eventMask
untilDate: theDistantFuture
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
type = [event type];
if (type == NSAppKitDefined)
{
[[event window] sendEvent: event];
}
}
while (type == NSAppKitDefined);
{
event = [NSApp nextEventMatchingMask: eventMask
untilDate: theDistantFuture
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
type = [event type];
// once we mouse up we shouldn't wait for other events
if (type == NSLeftMouseUp || type == NSRightMouseUp || type == NSOtherMouseUp)
{
shouldFinish = YES;
shouldStop = YES; // Set the stop flag when mouse-up occurs
break; // Exit the loop to proceed to StopPeriodicEvents
}
if (type == NSAppKitDefined)
{
[[event window] sendEvent: event];
}
} while (type == NSAppKitDefined);
}
while ((type != NSLeftMouseUp &&
type != NSRightMouseUp &&
Expand Down

0 comments on commit 2abd852

Please sign in to comment.