summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMouseEvent.c
diff options
context:
space:
mode:
authordas <das>2007-05-09 12:57:44 (GMT)
committerdas <das>2007-05-09 12:57:44 (GMT)
commitf826ac6217b819d53876353acf2eb6688622564e (patch)
tree1ea5714938378ea764c1925d778432b293d1173e /macosx/tkMacOSXMouseEvent.c
parentc91f8973c04a4f3c48dd907359c7c98042e5d976 (diff)
downloadtk-f826ac6217b819d53876353acf2eb6688622564e.zip
tk-f826ac6217b819d53876353acf2eb6688622564e.tar.gz
tk-f826ac6217b819d53876353acf2eb6688622564e.tar.bz2
* macosx/tkMacOSXWindowEvent.c: ensure window is brought to the front
* macosx/tkMacOSXMouseEvent.c: at the start of a window drag (except * macosx/tkMacOSXInt.h: when cmd key is down); formatting and whitespace fixes. * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd): add -filetypes option processing. * macosx/tkMacOSXEmbed.c (TkpMakeWindow, TkpUseWindow): fix sending of Visibility event for embedded windows (fixes frame-3.9 hang). * macosx/tkMacOSXScrlbr.c (ScrollbarBindProc): fix testsuite * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): crashes by adding sanity checks. * macosx/tkMacOSXButton.c: fix debug msg typo.
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r--macosx/tkMacOSXMouseEvent.c81
1 files changed, 57 insertions, 24 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index bc8dff8..a44118d 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.18 2007/04/29 02:26:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.19 2007/05/09 12:57:46 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -304,29 +304,31 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
*/
if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) {
return result;
- } else
- /*
- * Only windows with the kWindowNoActivatesAttribute can
- * receive mouse events in the background.
- */
- if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
- kWindowNoActivatesAttribute)) {
- /*
- * Allow background window dragging & growing with Command down
- */
- if (!((medPtr->windowPart == inDrag ||
- medPtr->windowPart == inGrow) &&
- medPtr->state & Mod1Mask)) {
- TkMacOSXSetEatButtonUp(true);
- BringWindowForward(medPtr->whichWin, isFrontProcess);
- }
+ } else {
/*
- * Allow dragging & growing of windows that were/are in the
- * background.
+ * Only windows with the kWindowNoActivatesAttribute can
+ * receive mouse events in the background.
*/
- if (!(medPtr->windowPart == inDrag ||
- medPtr->windowPart == inGrow)) {
- return false;
+ if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
+ kWindowNoActivatesAttribute)) {
+ /*
+ * Allow background window dragging & growing with Command
+ * down.
+ */
+ if (!((medPtr->windowPart == inDrag ||
+ medPtr->windowPart == inGrow) &&
+ medPtr->state & Mod1Mask)) {
+ TkMacOSXSetEatButtonUp(true);
+ BringWindowForward(medPtr->whichWin, isFrontProcess);
+ }
+ /*
+ * Allow dragging & growing of windows that were/are in the
+ * background.
+ */
+ if (!(medPtr->windowPart == inDrag ||
+ medPtr->windowPart == inGrow)) {
+ return false;
+ }
}
}
} else {
@@ -513,8 +515,7 @@ GeneratePollingEvents(MouseEventData * medPtr)
*
* BringWindowForward --
*
- * Bring this background window to the front. We also set state
- * so Tk thinks the button is currently up.
+ * Bring this background window to the front.
*
* Results:
* None.
@@ -546,6 +547,38 @@ BringWindowForward(
/*
*----------------------------------------------------------------------
*
+ * TkMacOSXBringWindowForward --
+ *
+ * Bring this background window to the front (wrapper around
+ * BringWindowForward()).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The window is brought forward.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXBringWindowForward(
+ WindowRef wRef)
+{
+ OSStatus err;
+ ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess};
+ Boolean isFrontProcess = true;
+
+ err = ChkErr(GetFrontProcess, &frontPsn);
+ if (err == noErr) {
+ ChkErr(SameProcess, &frontPsn, &ourPsn, &isFrontProcess);
+ }
+ BringWindowForward(wRef, isFrontProcess);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* GenerateMouseWheelEvent --
*
* Generates a "MouseWheel" Tk event.