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)
commit2588b8fc6521e8e49a9dc97e5b56a79b6d7ff5d2 (patch)
treed4affb081149e46c7b2692e6e4129b995048e1a1 /macosx/tkMacOSXWindowEvent.c
parent69f858d6108cc05f12abb8629986777e4adadd33 (diff)
downloadtk-2588b8fc6521e8e49a9dc97e5b56a79b6d7ff5d2.zip
tk-2588b8fc6521e8e49a9dc97e5b56a79b6d7ff5d2.tar.gz
tk-2588b8fc6521e8e49a9dc97e5b56a79b6d7ff5d2.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);
}
/*