diff options
author | fvogel <fvogelnew1@free.fr> | 2019-08-28 20:12:39 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2019-08-28 20:12:39 (GMT) |
commit | 1dd886e5882026dc5c89cb801251c13cfa070238 (patch) | |
tree | 158cf25bc46767a9b762ecd609fbaa28e49ffde5 | |
parent | b11c06fd0f8e1a52abeffb9aa2a9ee4055e35e83 (diff) | |
parent | d4ee00e26e9b7ab6c7eb33ef4c8e1c29ff73aa1e (diff) | |
download | tk-1dd886e5882026dc5c89cb801251c13cfa070238.zip tk-1dd886e5882026dc5c89cb801251c13cfa070238.tar.gz tk-1dd886e5882026dc5c89cb801251c13cfa070238.tar.bz2 |
Fix [943d5ebe51]: Destroying a widget cancels resizing of main window on Windows.
-rw-r--r-- | generic/tkInt.decls | 3 | ||||
-rw-r--r-- | generic/tkIntPlatDecls.h | 8 | ||||
-rw-r--r-- | generic/tkPointer.c | 10 | ||||
-rw-r--r-- | generic/tkStubInit.c | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXPort.h | 11 | ||||
-rw-r--r-- | win/tkWinPointer.c | 23 |
6 files changed, 57 insertions, 1 deletions
diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 7b83861..62441e5 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 47 win { + Tk_Window TkpGetCapture(void) +} ################################ # Aqua specific functions diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 26a5f46..f496e55 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -142,6 +142,9 @@ EXTERN void TkSendCleanup(TkDisplay *dispPtr); EXTERN int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +/* Slot 46 is reserved */ +/* 47 */ +EXTERN Tk_Window TkpGetCapture(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* 0 */ @@ -341,6 +344,8 @@ 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 */ + void (*reserved46)(void); + Tk_Window (*tkpGetCapture) (void); /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */ @@ -522,6 +527,9 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ #define TkpTestsendCmd \ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ +/* Slot 46 is reserved */ +#define TkpGetCapture \ + (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ #define TkGenerateActivateEvents \ diff --git a/generic/tkPointer.c b/generic/tkPointer.c index de9d49d..f764904 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 == (TkWindow *)TkpGetCapture()) { + TkpSetCapture(NULL); + } } } diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 7e02302..b531933 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -178,6 +178,7 @@ void TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c) # define TkAlignImageData 0 # define TkGenerateActivateEvents 0 # define TkpGetMS 0 +# define TkpGetCapture 0 # define TkPointerDeadWindow 0 # define TkpSetCapture 0 # define TkpSetCursor 0 @@ -505,6 +506,8 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkWmCleanup, /* 43 */ TkSendCleanup, /* 44 */ TkpTestsendCmd, /* 45 */ + 0, /* 46 */ + TkpGetCapture, /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ TkGenerateActivateEvents, /* 0 */ diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index e26328a..8961c25 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -129,6 +129,17 @@ #define TkpSync(display) /* + * TkMacOSXGetCapture is a legacy function used on the Mac. When fixing + * [943d5ebe51], TkpGetCapture was added to the Windows port. Both + * are actually the same feature and should bear the same name. However, + * in order to avoid potential backwards incompatibilities, renaming + * TkMacOSXGetCapture into TkpGetCapture in *PlatDecls.h shall not be + * done in a patch release, therefore use a define here. + */ + +#define TkpGetCapture TkMacOSXGetCapture + +/* * This macro stores a representation of the window handle in a string. */ diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 8ab512c..896500c 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -567,6 +567,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. + * + *---------------------------------------------------------------------- + */ + +Tk_Window +TkpGetCapture(void) +{ + return Tk_HWNDToWindow(GetCapture()); +} + +/* * Local Variables: * mode: c * c-basic-offset: 4 |