summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWindowEvent.c
diff options
context:
space:
mode:
authordas <das>2007-07-09 08:32:11 (GMT)
committerdas <das>2007-07-09 08:32:11 (GMT)
commita6c78109ec048c2c92578fc5b1de44043c7ee6cc (patch)
treed4affb081149e46c7b2692e6e4129b995048e1a1 /macosx/tkMacOSXWindowEvent.c
parentdc26b700389d7dcdd93397c78a01d231c322af6e (diff)
downloadtk-a6c78109ec048c2c92578fc5b1de44043c7ee6cc.zip
tk-a6c78109ec048c2c92578fc5b1de44043c7ee6cc.tar.gz
tk-a6c78109ec048c2c92578fc5b1de44043c7ee6cc.tar.bz2
* macosx/tkMacOSXWindowEvent.c (Tk_MacOSXIsAppInFront): use process mgr
* macosx/tkMacOSXMouseEvent.c: to determine if app is in front instead of relying on activate/deactivate events (which may arrive after this info is needed, e.g. during window drag/click activation); replace other process mgr use to get this info with calls to Tk_MacOSXIsAppInFront(). * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): correct window click activation, titlebar click handling and background window dragging/growing in the presence of grabs or window-/app-modal windows; fix window click activation bringing all other app windows to front.
Diffstat (limited to 'macosx/tkMacOSXWindowEvent.c')
-rw-r--r--macosx/tkMacOSXWindowEvent.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 37139f3..f909f32 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.24 2007/06/29 03:22:02 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.25 2007/07/09 08:32:12 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -69,14 +69,6 @@
*/
/*
- * Declarations of global variables defined in this file.
- */
-
-static int tkMacOSXAppInFront = true; /* Boolean variable for determining if
- * we are the frontmost app. Only set
- * in TkMacOSXProcessApplicationEvent
- */
-/*
* Declaration of functions used only in this file
*/
@@ -99,7 +91,7 @@ static void ClearPort(CGrafPtr port, RgnHandle updateRgn);
* 0.
*
* Side effects:
- * Hide or reveal floating windows, and set tkMacOSXAppInFront.
+ * Hide or reveal floating windows.
*
*----------------------------------------------------------------------
*/
@@ -121,12 +113,10 @@ TkMacOSXProcessApplicationEvent(
switch (eventPtr->eKind) {
case kEventAppActivated:
- tkMacOSXAppInFront = true;
ShowFloatingWindows();
break;
case kEventAppDeactivated:
TkSuspendClipboard();
- tkMacOSXAppInFront = false;
HideFloatingWindows();
break;
case kEventAppQuit:
@@ -335,10 +325,10 @@ TkMacOSXProcessWindowEvent(
}
break;
case kEventWindowDragStarted:
- TkMacOSXTrackingLoop(1);
if (!(TkMacOSXModifierState() & cmdKey)) {
TkMacOSXBringWindowForward(whichWindow);
}
+ TkMacOSXTrackingLoop(1);
break;
case kEventWindowDragCompleted: {
Rect maxBounds, bounds, strWidths;
@@ -925,7 +915,16 @@ TkWmProtocolEventProc(
int
Tk_MacOSXIsAppInFront(void)
{
- return tkMacOSXAppInFront;
+ OSStatus err;
+ ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess};
+ Boolean isFrontProcess = true;
+
+ err = ChkErr(GetFrontProcess, &frontPsn);
+ if (err == noErr) {
+ ChkErr(SameProcess, &frontPsn, &ourPsn, &isFrontProcess);
+ }
+
+ return (isFrontProcess == true);
}
/*