summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMouseEvent.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-09-09 23:52:02 (GMT)
committerhobbs <hobbs>2002-09-09 23:52:02 (GMT)
commit958042034bbbe215fbb0915cf6c07b9914923724 (patch)
tree804bf93151524b4ec43b4495c97883b3f0b0d9d8 /macosx/tkMacOSXMouseEvent.c
parentec6a4daee7df6a5652185b52f34a9e48d28a652e (diff)
downloadtk-958042034bbbe215fbb0915cf6c07b9914923724.zip
tk-958042034bbbe215fbb0915cf6c07b9914923724.tar.gz
tk-958042034bbbe215fbb0915cf6c07b9914923724.tar.bz2
* library/tk.tcl: use command instead of control on Aqua bindings.
Force dialogs to appear below fixed native Mac menubar. * macosx/tkMacOSXKeyEvent.c: * macosx/tkMacOSXKeyboard.c: Keypress/release events for pure modifier keys were not being passed to Tk. Deadkey presses were inserting null characters into text windows. Now they do nothing. (Still not ideal, but better than before!) * macosx/tkMacOSXMenu.c: Allow more than 200 menus to exist - increased to 2000. * macosx/tkMacOSXMouseEvent.c: Bad interactions between floating windows and ordinary ones. Ensure that local<->global coordinate transformations are wrt to the correct window. * macosx/tkMacOSXWm.c: Better error msg for 'wm attributes'. Remove crash in 'wm transient'. Add 'noActivates' and 'noUpdates' flags to unsupported command. [Patch #606658] (darley)
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r--macosx/tkMacOSXMouseEvent.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 769472c..12bfc93 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -215,7 +215,17 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
medPtr->global = where;
medPtr->local = where;
- SetPortWindowPort(frontWindow);
+ /*
+ * We must set the port to the right window -- the one
+ * we are actually going to use -- before finding
+ * the local coordinates, otherwise we will have completely
+ * wrong local x,y!
+ *
+ * I'm pretty sure this window is medPtr->whichWin, unless
+ * perhaps there is a grab. Certainly 'frontWindow' or
+ * 'medPtr->activeNonFloating' are wrong.
+ */
+ SetPortWindowPort(medPtr->whichWin);
GlobalToLocal(&medPtr->local);
if (eventPtr->eKind == kEventMouseWheelMoved ) {
return GenerateMouseWheelEvent(medPtr);
@@ -389,7 +399,14 @@ GeneratePollingEvents(MouseEventData * medPtr)
int local_x, local_y;
TkDisplay *dispPtr;
-
+ /*
+ * I really do not understand this complicated logic. Surely the event
+ * should be to either: (1) medPtr->whichWin, the window under the mouse
+ * (from which we then obviously extract the correct Tk subwindow), or
+ * (2) the current grab window. I really don't see why anything else is
+ * relevant.
+ */
+#if 0
if ((!TkpIsWindowFloating(medPtr->whichWin)
&& (medPtr->activeNonFloating != medPtr->whichWin))) {
tkwin = NULL;
@@ -416,6 +433,23 @@ GeneratePollingEvents(MouseEventData * medPtr)
if ((tkwin == NULL) && (grabWin != NULL)) {
tkwin = grabWin;
}
+#else
+ grabWin = TkMacOSXGetCapture();
+ if (grabWin != NULL) {
+ tkwin = grabWin;
+ } else {
+ window = TkMacOSXGetXWindow(medPtr->whichWin);
+ dispPtr = TkGetDisplayList();
+ rootwin = Tk_IdToWindow(dispPtr->display, window);
+ if (rootwin == NULL) {
+ tkwin = NULL;
+ } else {
+ tkwin = Tk_TopCoordsToWindow(rootwin,
+ medPtr->local.h, medPtr->local.v,
+ &local_x, &local_y);
+ }
+ }
+#endif
Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v,
medPtr->state);
@@ -683,15 +717,17 @@ TkGenerateButtonEvent(
FindWindow(where, &whichWin);
frontWin = FrontNonFloatingWindow();
- if ((frontWin == NULL) || ((!(TkpIsWindowFloating(whichWin))
+ if (0 && ((frontWin == NULL) || ((!(TkpIsWindowFloating(whichWin))
&& (frontWin != whichWin))
- && TkMacOSXGetCapture() == NULL)) {
+ && TkMacOSXGetCapture() == NULL))) {
return false;
}
dispPtr = TkGetDisplayList();
tkwin = Tk_IdToWindow(dispPtr->display, window);
+ /* SetPortWindowPort(ActiveNonFloatingWindow()); */
+ SetPortWindowPort(whichWin);
GlobalToLocal(&where);
if (tkwin != NULL) {
tkwin = Tk_TopCoordsToWindow(tkwin, where.h, where.v,