summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWindowEvent.c
diff options
context:
space:
mode:
authordas <das>2007-07-09 08:31:54 (GMT)
committerdas <das>2007-07-09 08:31:54 (GMT)
commita5f405cd8430eed957da22358c7830158eb0dd89 (patch)
tree24a556a0ecf5553f747023cdbc144c81be84cd6d /macosx/tkMacOSXWindowEvent.c
parent710025d82c3e93a1ca59eda256cfacf1e849293f (diff)
downloadtk-a5f405cd8430eed957da22358c7830158eb0dd89.zip
tk-a5f405cd8430eed957da22358c7830158eb0dd89.tar.gz
tk-a5f405cd8430eed957da22358c7830158eb0dd89.tar.bz2
* macosx/tkMacOSXWindowEvent.c (Tk_MacOSXIsAppInFront): use process mgrcore_stablilizer_merge
* 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 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);
}
/*