summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMouseEvent.c
diff options
context:
space:
mode:
authordas <das>2007-05-09 12:55:15 (GMT)
committerdas <das>2007-05-09 12:55:15 (GMT)
commitc0e4ec8c452c01a8d95608e922f8bd3657c10ccb (patch)
tree506fdf03b09705deab71a428fb32dc8204a24c92 /macosx/tkMacOSXMouseEvent.c
parentb7ca14476921fec908be93647b91fe3947b5f824 (diff)
downloadtk-c0e4ec8c452c01a8d95608e922f8bd3657c10ccb.zip
tk-c0e4ec8c452c01a8d95608e922f8bd3657c10ccb.tar.gz
tk-c0e4ec8c452c01a8d95608e922f8bd3657c10ccb.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 (fixes fileDialog-0.1, fileDialog-0.2 failures). * 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/Wish.xcodeproj/project.pbxproj: add 'DebugUnthreaded' & * macosx/Wish.xcodeproj/default.pbxuser: 'DebugLeaks' targets and env var settings needed to run the 'leaks' tool. * 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 d3d1f61..782ca69 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.28 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.29 2007/05/09 12:55:15 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.