mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 10:13:35 +00:00
Fix OS X cmd/alt key modifiers status when app is reactivated
This commit is contained in:
parent
7b4a1ec4af
commit
51a0bbe6a4
@ -14,6 +14,8 @@
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender;
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app;
|
||||
- (void)applicationWillTerminate:(NSNotification*)notification;
|
||||
- (void)applicationWillResignActive:(NSNotification*)notification;
|
||||
- (void)applicationDidBecomeActive:(NSNotification*)notification;
|
||||
- (BOOL)application:(NSApplication*)app openFiles:(NSArray*)filenames;
|
||||
@end
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "she/event_queue.h"
|
||||
#include "she/osx/app.h"
|
||||
#include "she/osx/generate_drop_files.h"
|
||||
#include "she/osx/view.h"
|
||||
#include "she/system.h"
|
||||
|
||||
@implementation OSXAppDelegate
|
||||
@ -38,6 +39,20 @@
|
||||
she::queue_event(ev);
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification*)notification
|
||||
{
|
||||
NSEvent* event = [NSApp currentEvent];
|
||||
if (event != nil)
|
||||
[OSXView updateKeyFlags:event];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification*)notification
|
||||
{
|
||||
NSEvent* event = [NSApp currentEvent];
|
||||
if (event != nil)
|
||||
[OSXView updateKeyFlags:event];
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication*)app openFiles:(NSArray*)filenames
|
||||
{
|
||||
generate_drop_files_from_nsarray(filenames);
|
||||
|
@ -28,6 +28,7 @@
|
||||
- (void)keyDown:(NSEvent*)event;
|
||||
- (void)keyUp:(NSEvent*)event;
|
||||
- (void)flagsChanged:(NSEvent*)event;
|
||||
+ (void)updateKeyFlags:(NSEvent*)event;
|
||||
- (void)mouseEntered:(NSEvent*)event;
|
||||
- (void)mouseMoved:(NSEvent*)event;
|
||||
- (void)mouseExited:(NSEvent*)event;
|
||||
|
@ -188,7 +188,11 @@ bool is_key_pressed(KeyScancode scancode)
|
||||
- (void)flagsChanged:(NSEvent*)event
|
||||
{
|
||||
[super flagsChanged:event];
|
||||
[OSXView updateKeyFlags:event];
|
||||
}
|
||||
|
||||
+ (void)updateKeyFlags:(NSEvent*)event
|
||||
{
|
||||
static int lastFlags = 0;
|
||||
static int flags[] = {
|
||||
NSShiftKeyMask,
|
||||
|
Loading…
x
Reference in New Issue
Block a user