summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorculler <culler>2024-07-08 02:07:57 (GMT)
committerculler <culler>2024-07-08 02:07:57 (GMT)
commit365059dd56e66d2056e28432b1420bfe676c260b (patch)
treec9226ff6937df277c893bfd24c4968fd3bfe4693 /generic
parentc2f8aeaa3b5abbf7ce84a9f4476a5592c0932ddf (diff)
parentd516c14a8643ea0b488683bd1b4b0e34c9a91f64 (diff)
downloadtk-365059dd56e66d2056e28432b1420bfe676c260b.zip
tk-365059dd56e66d2056e28432b1420bfe676c260b.tar.gz
tk-365059dd56e66d2056e28432b1420bfe676c260b.tar.bz2
Merge with cgimage_with_crossing branch.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkFont.c11
-rw-r--r--generic/tkFrame.c2
-rw-r--r--generic/tkTextDisp.c2
-rw-r--r--generic/tkWindow.c53
4 files changed, 54 insertions, 14 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 1918d78..6a90add 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -887,17 +887,6 @@ TheWorldHasChanged(
{
TkFontInfo *fiPtr = (TkFontInfo *)clientData;
- /*
- * On macOS it is catastrophic to recompute all widgets while the
- * [NSView drawRect] method is drawing. The best that we can do in
- * that situation is to abort the recomputation and hope for the best.
- * This is ignored on other platforms.
- */
-
- if (TkpWillDrawWidget(NULL)) {
- return;
- }
-
fiPtr->updatePending = 0;
RecomputeWidgets(fiPtr->mainPtr->winPtr);
}
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 302542c..d49292b 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -1478,6 +1478,8 @@ DisplayFrame(
Tk_Depth(tkwin));
#else
pixmap = Tk_WindowId(tkwin);
+ Tk_ClipDrawableToRect(Tk_Display(tkwin), pixmap, 0, 0,
+ Tk_Width(tkwin), Tk_Height(tkwin));
#endif /* TK_NO_DOUBLE_BUFFERING */
if (framePtr->type != TYPE_LABELFRAME) {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 905a4c6..027efc8 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -24,7 +24,7 @@
#include "tkMacOSXInt.h"
#endif
-#define OK_TO_LOG (!TkpWillDrawWidget(textPtr->tkwin))
+#define OK_TO_LOG 1
/*
* "Calculations of line pixel heights and the size of the vertical
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 68f3406..9d36e9f 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -215,6 +215,17 @@ static int Initialize(Tcl_Interp *interp);
static int NameWindow(Tcl_Interp *interp, TkWindow *winPtr,
TkWindow *parentPtr, const char *name);
static void UnlinkWindow(TkWindow *winPtr);
+
+/*
+ * This static variable only makes sense for macOS and Windows, which never
+ * have more than one display. It is set by TkCloseDisplay, and when set
+ * prevents sending Enter and Leave events when all of the windows in the
+ * display are being destroyed. Tk does not send those events on X11; that
+ * job is handled by the X server.
+ */
+
+static int displayBeingClosed = 0;
+
/*
*----------------------------------------------------------------------
@@ -239,6 +250,7 @@ static void
TkCloseDisplay(
TkDisplay *dispPtr)
{
+ displayBeingClosed = 1;
TkClipCleanup(dispPtr);
if (dispPtr->name != NULL) {
@@ -1334,6 +1346,39 @@ Tk_CreateWindowFromPath(
*--------------------------------------------------------------
*/
+#if defined(MAC_OSX_TK) || defined(_WIN32)
+static void SendEnterLeaveForDestroy(
+ Tk_Window tkwin)
+{
+ int x, y;
+ unsigned int state;
+ Tk_Window pointerWin;
+ TkWindow *containerPtr;
+
+ if (displayBeingClosed) {
+ return;
+ }
+ XQueryPointer(Tk_Display(tkwin), None, NULL, NULL, &x, &y,
+ NULL, NULL, &state);
+ pointerWin = Tk_CoordsToWindow(x, y, tkwin);
+ if (pointerWin == tkwin) {
+ if (!Tk_IsTopLevel(tkwin)) {
+ containerPtr = TkGetContainer((TkWindow *)pointerWin);
+ Tk_UpdatePointer((Tk_Window) containerPtr, x, y, state);
+ }
+ }
+
+ if (pointerWin && (tkwin == Tk_Parent(pointerWin))) {
+ Tk_UpdatePointer(Tk_Parent(tkwin), x, y, state);
+ }
+}
+#else
+static void SendEnterLeaveForDestroy(
+ TCL_UNUSED(Tk_Window))
+{
+}
+#endif
+
void
Tk_DestroyWindow(
Tk_Window tkwin) /* Window to destroy. */
@@ -1353,6 +1398,10 @@ Tk_DestroyWindow(
return;
}
+ if ((winPtr->flags & TK_DONT_DESTROY_WINDOW) == 0) {
+ SendEnterLeaveForDestroy(tkwin);
+ }
+
winPtr->flags |= TK_ALREADY_DEAD;
/*
@@ -1523,7 +1572,7 @@ Tk_DestroyWindow(
* Cleanup the data structures associated with this window.
*/
- if (winPtr->flags & TK_WIN_MANAGED) {
+ if (winPtr->wmInfoPtr && (winPtr->flags & TK_WIN_MANAGED)) {
TkWmDeadWindow(winPtr);
} else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) {
TkWmRemoveFromColormapWindows(winPtr);
@@ -2612,7 +2661,7 @@ Tk_RestackWindow(
TkWindow *otherPtr = (TkWindow *) other;
/*
- * Special case: if winPtr is a top-level window then just find the
+ * Special case: if winPtr is a toplevel window then just find the
* top-level ancestor of otherPtr and restack winPtr above otherPtr
* without changing any of Tk's childLists.
*/