From 5a7c9991c1e212687cf3383f542968c474dc6497 Mon Sep 17 00:00:00 2001 From: hobbs Date: Mon, 3 May 2004 22:23:08 +0000 Subject: * generic/tkClipboard.c: Move TkClipCleanup from tkClipboard.c * mac/tkMacXStubs.c: to being implemented in a platform * macosx/tkMacOSXXStubs.c: specific manner. The cleanup order was * unix/tkUnixEvent.c: bad at least on Windows, where we * win/tkWinX.c: reset/cleared display info that was still needed for the clipboard to render. [Bug #939389, #822002, #732662] --- ChangeLog | 8 ++++++++ generic/tkClipboard.c | 38 +----------------------------------- mac/tkMacXStubs.c | 52 +++++++++++++++++++++++++++++++++++++++++-------- macosx/tkMacOSXXStubs.c | 52 +++++++++++++++++++++++++++++++++++++++++-------- unix/tkUnixEvent.c | 38 +++++++++++++++++++++++++++++++++++- win/tkWinX.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 183 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index b913b81..5c3e23f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-05-03 Jeff Hobbs + * generic/tkClipboard.c: Move TkClipCleanup from tkClipboard.c + * mac/tkMacXStubs.c: to being implemented in a platform + * macosx/tkMacOSXXStubs.c: specific manner. The cleanup order was + * unix/tkUnixEvent.c: bad at least on Windows, where we + * win/tkWinX.c: reset/cleared display info that was + still needed for the clipboard to render. + [Bug #939389, #822002, #732662] + * library/panedwindow.tcl (MarkSash): call DragSash to stop sash jump when B1 is pressed and released without moving. [Bug #932155] Make the panedwindow -opaqueresize option work as per the docs. diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 2efdeac..5f23a90 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkClipboard.c,v 1.12 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkClipboard.c,v 1.12.2.1 2004/05/03 22:23:08 hobbs Exp $ */ #include "tkInt.h" @@ -623,42 +623,6 @@ Tk_ClipboardObjCmd(clientData, interp, objc, objv) /* *---------------------------------------------------------------------- * - * TkClipCleanup -- - * - * This procedure is called to cleanup resources associated with - * claiming clipboard ownership and for receiving selection get - * results. This function is called in tkWindow.c. This has to be - * called by the display cleanup function because we still need the - * access display elements. - * - * Results: - * None. - * - * Side effects: - * Resources are freed - the clipboard may no longer be used. - * - *---------------------------------------------------------------------- - */ - -void -TkClipCleanup(dispPtr) - TkDisplay *dispPtr; /* display associated with clipboard */ -{ - if (dispPtr->clipWindow != NULL) { - Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, - dispPtr->applicationAtom); - Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, - dispPtr->windowAtom); - - Tk_DestroyWindow(dispPtr->clipWindow); - Tcl_Release((ClientData) dispPtr->clipWindow); - dispPtr->clipWindow = NULL; - } -} - -/* - *---------------------------------------------------------------------- - * * TkClipInit -- * * This procedure is called to initialize the window for claiming diff --git a/mac/tkMacXStubs.c b/mac/tkMacXStubs.c index 2de6028..e49d622 100644 --- a/mac/tkMacXStubs.c +++ b/mac/tkMacXStubs.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacXStubs.c,v 1.16 2002/10/09 11:57:05 das Exp $ + * RCS: @(#) $Id: tkMacXStubs.c,v 1.16.2.1 2004/05/03 22:23:09 hobbs Exp $ */ #include "tkInt.h" @@ -169,13 +169,6 @@ TkpCloseDisplay( panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display"); } - /* - * Make sure that the local scrap is transfered to the global - * scrap if needed. - */ - - TkSuspendClipboard(); - gMacDisplay = NULL; if (display->screens != (Screen *) NULL) { if (display->screens->root_visual != (Visual *) NULL) { @@ -189,6 +182,49 @@ TkpCloseDisplay( /* *---------------------------------------------------------------------- * + * TkClipCleanup -- + * + * This procedure is called to cleanup resources associated with + * claiming clipboard ownership and for receiving selection get + * results. This function is called in tkWindow.c. This has to be + * called by the display cleanup function because we still need the + * access display elements. + * + * Results: + * None. + * + * Side effects: + * Resources are freed - the clipboard may no longer be used. + * + *---------------------------------------------------------------------- + */ + +void +TkClipCleanup(dispPtr) + TkDisplay *dispPtr; /* display associated with clipboard */ +{ + /* + * Make sure that the local scrap is transfered to the global + * scrap if needed. + */ + + TkSuspendClipboard(); + + if (dispPtr->clipWindow != NULL) { + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->applicationAtom); + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->windowAtom); + + Tk_DestroyWindow(dispPtr->clipWindow); + Tcl_Release((ClientData) dispPtr->clipWindow); + dispPtr->clipWindow = NULL; + } +} + +/* + *---------------------------------------------------------------------- + * * MacXIdAlloc -- * * This procedure is invoked by Xlib as the resource allocator diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 3260d08..4d83c7b 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.2 2004/02/23 10:49:29 das Exp $ + * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.3 2004/05/03 22:23:09 hobbs Exp $ */ #include "tkInt.h" @@ -181,13 +181,6 @@ TkpCloseDisplay( panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display"); } - /* - * Make sure that the local scrap is transfered to the global - * scrap if needed. - */ - - TkSuspendClipboard(); - gMacDisplay = NULL; if (display->screens != (Screen *) NULL) { if (display->screens->root_visual != (Visual *) NULL) { @@ -201,6 +194,49 @@ TkpCloseDisplay( /* *---------------------------------------------------------------------- * + * TkClipCleanup -- + * + * This procedure is called to cleanup resources associated with + * claiming clipboard ownership and for receiving selection get + * results. This function is called in tkWindow.c. This has to be + * called by the display cleanup function because we still need the + * access display elements. + * + * Results: + * None. + * + * Side effects: + * Resources are freed - the clipboard may no longer be used. + * + *---------------------------------------------------------------------- + */ + +void +TkClipCleanup(dispPtr) + TkDisplay *dispPtr; /* display associated with clipboard */ +{ + /* + * Make sure that the local scrap is transfered to the global + * scrap if needed. + */ + + TkSuspendClipboard(); + + if (dispPtr->clipWindow != NULL) { + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->applicationAtom); + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->windowAtom); + + Tk_DestroyWindow(dispPtr->clipWindow); + Tcl_Release((ClientData) dispPtr->clipWindow); + dispPtr->clipWindow = NULL; + } +} + +/* + *---------------------------------------------------------------------- + * * MacXIdAlloc -- * * This procedure is invoked by Xlib as the resource allocator diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 8fa56d1..b1bf18b 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixEvent.c,v 1.11.2.1 2003/07/16 01:20:13 mdejong Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.11.2.2 2004/05/03 22:23:09 hobbs Exp $ */ #include "tkInt.h" @@ -241,6 +241,42 @@ TkpCloseDisplay(dispPtr) /* *---------------------------------------------------------------------- * + * TkClipCleanup -- + * + * This procedure is called to cleanup resources associated with + * claiming clipboard ownership and for receiving selection get + * results. This function is called in tkWindow.c. This has to be + * called by the display cleanup function because we still need the + * access display elements. + * + * Results: + * None. + * + * Side effects: + * Resources are freed - the clipboard may no longer be used. + * + *---------------------------------------------------------------------- + */ + +void +TkClipCleanup(dispPtr) + TkDisplay *dispPtr; /* display associated with clipboard */ +{ + if (dispPtr->clipWindow != NULL) { + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->applicationAtom); + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->windowAtom); + + Tk_DestroyWindow(dispPtr->clipWindow); + Tcl_Release((ClientData) dispPtr->clipWindow); + dispPtr->clipWindow = NULL; + } +} + +/* + *---------------------------------------------------------------------- + * * DisplaySetupProc -- * * This procedure implements the setup part of the UNIX X display diff --git a/win/tkWinX.c b/win/tkWinX.c index ae21e4b..26a76a3 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.25 2002/12/08 00:46:51 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.25.2.1 2004/05/03 22:23:09 hobbs Exp $ */ #include "tkWinInt.h" @@ -594,6 +594,54 @@ TkpCloseDisplay(dispPtr) /* *---------------------------------------------------------------------- * + * TkClipCleanup -- + * + * This procedure is called to cleanup resources associated with + * claiming clipboard ownership and for receiving selection get + * results. This function is called in tkWindow.c. This has to be + * called by the display cleanup function because we still need the + * access display elements. + * + * Results: + * None. + * + * Side effects: + * Resources are freed - the clipboard may no longer be used. + * + *---------------------------------------------------------------------- + */ + +void +TkClipCleanup(dispPtr) + TkDisplay *dispPtr; /* display associated with clipboard */ +{ + if (dispPtr->clipWindow != NULL) { + /* + * Force the clipboard to be rendered if we are the clipboard owner. + */ + + HWND hwnd = Tk_GetHWND(Tk_WindowId(dispPtr->clipWindow)); + if (GetClipboardOwner() == hwnd) { + OpenClipboard(hwnd); + EmptyClipboard(); + TkWinClipboardRender(dispPtr, CF_TEXT); + CloseClipboard(); + } + + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->applicationAtom); + Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, + dispPtr->windowAtom); + + Tk_DestroyWindow(dispPtr->clipWindow); + Tcl_Release((ClientData) dispPtr->clipWindow); + dispPtr->clipWindow = NULL; + } +} + +/* + *---------------------------------------------------------------------- + * * XBell -- * * Generate a beep. -- cgit v0.12