diff options
Diffstat (limited to 'macosx/tkMacOSXWindowEvent.c')
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index fb53c81..20b79f3 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.27 2007/06/29 03:20:02 das Exp $ + * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.28 2007/07/09 08:31:55 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); } /* |