aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2010-01-04 21:25:07 -0800
committerRuss Cox <rsc@swtch.com>2010-01-04 21:25:07 -0800
commit7d9c0f0f0e041051d3105404ada074cf983cd6ad (patch)
tree1c2ce7cc10a1995df5b13c003c106ed6900c1394
parent100ec44e5170878bbd7fd28f7f68d884d0618173 (diff)
downloadplan9port-7d9c0f0f0e041051d3105404ada074cf983cd6ad.tar.gz
plan9port-7d9c0f0f0e041051d3105404ada074cf983cd6ad.tar.bz2
plan9port-7d9c0f0f0e041051d3105404ada074cf983cd6ad.zip
devdraw: release multitouch mouse when app is collapsed (minimized)
R=rsc CC=plalonde, r http://codereview.appspot.com/181129
-rw-r--r--src/cmd/devdraw/osx-screen-carbon.m16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cmd/devdraw/osx-screen-carbon.m b/src/cmd/devdraw/osx-screen-carbon.m
index 20bdb4ca..0a791c30 100644
--- a/src/cmd/devdraw/osx-screen-carbon.m
+++ b/src/cmd/devdraw/osx-screen-carbon.m
@@ -60,6 +60,7 @@ struct {
int infullscreen;
int kalting; // last keystroke was Kalt
int touched; // last mouse event was touchCallback
+ int collapsed; // parked in dock
NSMutableArray* devicelist;
} osx;
@@ -383,6 +384,8 @@ _screeninit(void)
{ kEventClassCommand, kEventCommandProcess },
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
+ { kEventClassWindow, kEventWindowCollapsed },
+ { kEventClassWindow, kEventWindowExpanded },
};
const EventTypeSpec events[] = {
{ kEventClassApplication, kEventAppShown },
@@ -517,13 +520,24 @@ eventhandler(EventHandlerCallRef next, EventRef event, void *arg)
break;
case kEventWindowActivated:
- activated(1);
+ if(!osx.collapsed)
+ activated(1);
return eventNotHandledErr;
case kEventWindowDeactivated:
activated(0);
return eventNotHandledErr;
+ case kEventWindowCollapsed:
+ osx.collapsed = 1;
+ activated(0);
+ return eventNotHandledErr;
+
+ case kEventWindowExpanded:
+ osx.collapsed = 0;
+ activated(1);
+ return eventNotHandledErr;
+
default:
return eventNotHandledErr;
}