diff options
author | fvogel <fvogelnew1@free.fr> | 2019-08-26 10:01:17 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2019-08-26 10:01:17 (GMT) |
commit | cc20d8e7206d31689da6dc6f795c282e3a94b8bf (patch) | |
tree | 22400beab4ccaefabaa5c1f1bd672fff529340fe | |
parent | e5845ff546364f25ae5975f00bf7e2756f4d692d (diff) | |
download | tk-cc20d8e7206d31689da6dc6f795c282e3a94b8bf.zip tk-cc20d8e7206d31689da6dc6f795c282e3a94b8bf.tar.gz tk-cc20d8e7206d31689da6dc6f795c282e3a94b8bf.tar.bz2 |
Fix [943d5ebe51]: Destroying a widget cancels resizing of main window on Windows. (Note: Branch builds and works on Windows, will not build (yet) on Linux or macOS)
-rw-r--r-- | generic/tkInt.decls | 3 | ||||
-rw-r--r-- | generic/tkIntPlatDecls.h | 5 | ||||
-rw-r--r-- | generic/tkPointer.c | 10 | ||||
-rw-r--r-- | generic/tkStubInit.c | 1 | ||||
-rw-r--r-- | win/tkWinPointer.c | 23 |
5 files changed, 41 insertions, 1 deletions
diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 7b83861..f9beeb7 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -844,6 +844,9 @@ declare 45 win { int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) } +declare 46 win { + TkWindow *TkpGetCapture(void) +} ################################ # Aqua specific functions diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 26a5f46..598d121 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -142,6 +142,8 @@ EXTERN void TkSendCleanup(TkDisplay *dispPtr); EXTERN int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +/* 46 */ +EXTERN TkWindow * TkpGetCapture(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* 0 */ @@ -341,6 +343,7 @@ typedef struct TkIntPlatStubs { void (*tkWmCleanup) (TkDisplay *dispPtr); /* 43 */ void (*tkSendCleanup) (TkDisplay *dispPtr); /* 44 */ int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 45 */ + TkWindow * (*tkpGetCapture) (void); /* 46 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */ @@ -522,6 +525,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ #define TkpTestsendCmd \ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ +#define TkpGetCapture \ + (tkIntPlatStubsPtr->tkpGetCapture) /* 46 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ #define TkGenerateActivateEvents \ diff --git a/generic/tkPointer.c b/generic/tkPointer.c index de9d49d..7f1d113 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -503,7 +503,15 @@ TkPointerDeadWindow( tsdPtr->restrictWinPtr = NULL; } if (!(tsdPtr->restrictWinPtr || tsdPtr->grabWinPtr)) { - TkpSetCapture(NULL); + + /* + * Release mouse capture only if the dead window is the capturing + * window. + */ + + if (winPtr == TkpGetCapture()) { + TkpSetCapture(NULL); + } } } diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 7e02302..b41feda 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -505,6 +505,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkWmCleanup, /* 43 */ TkSendCleanup, /* 44 */ TkpTestsendCmd, /* 45 */ + TkpGetCapture, /* 46 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ TkGenerateActivateEvents, /* 0 */ diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 251b5b9..817d8f3 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -544,6 +544,29 @@ TkpSetCapture( } /* + *---------------------------------------------------------------------- + * + * TkpGetCapture -- + * + * This function requests which window is capturing the mouse. + * + * Results: + * The return value is a pointer to the capture window, if there is + * one, otherwise it is NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +TkWindow * +TkpGetCapture(void) +{ + return (TkWindow *) Tk_HWNDToWindow(GetCapture()); +} + +/* * Local Variables: * mode: c * c-basic-offset: 4 |