Tk
view release on metacpan or search on metacpan
pTk/mTk/win/tkWinEmbed.c view on Meta::CPAN
}
}
/*
* Store the parent window in the platform private data slot so
* TkWmMapWindow can use it when creating the wrapper window.
*/
winPtr->privatePtr = (struct TkWindowPrivate*) hwnd;
/*
* Create an event handler to clean up the Container structure when
* tkwin is eventually deleted.
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
(ClientData) winPtr);
/*
* If this is the first container, register an exit handler so that
* things will get cleaned up at finalization.
*/
if (tsdPtr->firstContainerPtr == (Container *) NULL) {
Tcl_CreateExitHandler(CleanupContainerList, (ClientData) NULL);
}
/*
* Save information about the container and the embedded window
* in a Container structure. If there is already an existing
* Container structure, it means that both container and embedded
* app. are in the same process.
*/
for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->parentHWnd == hwnd) {
winPtr->flags |= TK_BOTH_HALVES;
containerPtr->parentPtr->flags |= TK_BOTH_HALVES;
break;
}
}
if (containerPtr == NULL) {
containerPtr = (Container *) ckalloc(sizeof(Container));
containerPtr->parentPtr = NULL;
containerPtr->parentHWnd = hwnd;
containerPtr->nextPtr = tsdPtr->firstContainerPtr;
tsdPtr->firstContainerPtr = containerPtr;
}
/*
* embeddedHWnd is not created yet. It will be created by TkWmMapWindow(),
* which will send a TK_ATTACHWINDOW to the container window.
* TkWinEmbeddedEventProc will process this message and set the embeddedHWnd
* variable
*/
containerPtr->embeddedPtr = winPtr;
containerPtr->embeddedHWnd = NULL;
winPtr->flags |= TK_EMBEDDED;
winPtr->flags &= (~(TK_MAPPED));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TkpMakeContainer --
*
* This procedure is called to indicate that a particular window will
* be a container for an embedded application. This changes certain
* aspects of the window's behavior, such as whether it will receive
* events anymore.
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
void
TkpMakeContainer(tkwin)
Tk_Window tkwin;
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* If this is the first container, register an exit handler so that
* things will get cleaned up at finalization.
*/
if (tsdPtr->firstContainerPtr == (Container *) NULL) {
Tcl_CreateExitHandler(CleanupContainerList, (ClientData) NULL);
}
/*
* Register the window as a container so that, for example, we can
* find out later if the embedded app. is in the same process.
*/
Tk_MakeWindowExist(tkwin);
containerPtr = (Container *) ckalloc(sizeof(Container));
containerPtr->parentPtr = winPtr;
containerPtr->parentHWnd = Tk_GetHWND(Tk_WindowId(tkwin));
containerPtr->embeddedHWnd = NULL;
containerPtr->embeddedPtr = NULL;
containerPtr->nextPtr = tsdPtr->firstContainerPtr;
tsdPtr->firstContainerPtr = containerPtr;
winPtr->flags |= TK_CONTAINER;
/*
* Unlike in tkUnixEmbed.c, we don't make any requests for events
* in the embedded window here. Now we just allow the embedding
( run in 0.838 second using v1.01-cache-2.11-cpan-71847e10f99 )