[aseprite] 39/51: Fix OS X cmd/alt key modifiers status when app is reactivated

Tobias Hansen thansen at moszumanska.debian.org
Mon Jul 11 21:35:18 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 51a0bbe6a44dac224cc911a3d3b4c817150a54f1
Author: David Capello <davidcapello at gmail.com>
Date:   Mon Jul 4 14:14:57 2016 -0300

    Fix OS X cmd/alt key modifiers status when app is reactivated
---
 src/she/osx/app_delegate.h  |  2 ++
 src/she/osx/app_delegate.mm | 15 +++++++++++++++
 src/she/osx/view.h          |  1 +
 src/she/osx/view.mm         |  4 ++++
 4 files changed, 22 insertions(+)

diff --git a/src/she/osx/app_delegate.h b/src/she/osx/app_delegate.h
index fa10667..f3e8dd1 100644
--- a/src/she/osx/app_delegate.h
+++ b/src/she/osx/app_delegate.h
@@ -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
 
diff --git a/src/she/osx/app_delegate.mm b/src/she/osx/app_delegate.mm
index 4eefe80..667b81b 100644
--- a/src/she/osx/app_delegate.mm
+++ b/src/she/osx/app_delegate.mm
@@ -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);
diff --git a/src/she/osx/view.h b/src/she/osx/view.h
index f71a2d7..853a892 100644
--- a/src/she/osx/view.h
+++ b/src/she/osx/view.h
@@ -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;
diff --git a/src/she/osx/view.mm b/src/she/osx/view.mm
index b291af1..d41b41d 100644
--- a/src/she/osx/view.mm
+++ b/src/she/osx/view.mm
@@ -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,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list