view release on metacpan or search on metacpan
pTk/mTk/generic/tk.h view on Meta::CPAN
#define Tk_Name(tkwin) (((Tk_FakeWin *) (tkwin))->nameUid)
#define Tk_Class(tkwin) (((Tk_FakeWin *) (tkwin))->classUid)
#define Tk_X(tkwin) (((Tk_FakeWin *) (tkwin))->changes.x)
#define Tk_Y(tkwin) (((Tk_FakeWin *) (tkwin))->changes.y)
#define Tk_Width(tkwin) (((Tk_FakeWin *) (tkwin))->changes.width)
#define Tk_Height(tkwin) \
(((Tk_FakeWin *) (tkwin))->changes.height)
#define Tk_Changes(tkwin) (&((Tk_FakeWin *) (tkwin))->changes)
#define Tk_Attributes(tkwin) (&((Tk_FakeWin *) (tkwin))->atts)
#define Tk_IsEmbedded(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_EMBEDDED)
#define Tk_IsContainer(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_CONTAINER)
#define Tk_IsMapped(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_MAPPED)
#define Tk_IsTopLevel(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL)
#define Tk_HasWrapper(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_HAS_WRAPPER)
#define Tk_WinManaged(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)
pTk/mTk/generic/tk.h view on Meta::CPAN
* X window. The flag is set when the window
* has already been destroyed elsewhere (e.g.
* by another application) or when it will be
* destroyed later (e.g. by destroying its
* parent).
* TK_WM_COLORMAP_WINDOW: 1 means that this window has at some time
* appeared in the WM_COLORMAP_WINDOWS property
* for its toplevel, so we have to remove it
* from that property if the window is
* deleted and the toplevel isn't.
* TK_EMBEDDED: 1 means that this window (which must be a
* toplevel) is not a free-standing window but
* rather is embedded in some other application.
* TK_CONTAINER: 1 means that this window is a container, and
* that some other application (either in
* this process or elsewhere) may be
* embedding itself inside the window.
* TK_BOTH_HALVES: 1 means that this window is used for
* application embedding (either as
* container or embedded application), and
* both the containing and embedded halves
pTk/mTk/generic/tk.h view on Meta::CPAN
#define TK_MAPPED 1
#define TK_TOP_LEVEL 2
#define TK_ALREADY_DEAD 4
#define TK_NEED_CONFIG_NOTIFY 8
#define TK_GRAB_FLAG 0x10
#define TK_CHECKED_IC 0x20
#define TK_DONT_DESTROY_WINDOW 0x40
#define TK_WM_COLORMAP_WINDOW 0x80
#define TK_EMBEDDED 0x100
#define TK_CONTAINER 0x200
#define TK_BOTH_HALVES 0x400
#define TK_DEFER_MODAL 0x800
#define TK_WRAPPER 0x1000
#define TK_REPARENTED 0x2000
#define TK_ANONYMOUS_WINDOW 0x4000
#define TK_HAS_WRAPPER 0x8000
#define TK_WIN_MANAGED 0x10000
#define TK_TOP_HIERARCHY 0x20000
#define TK_PROP_PROPCHANGE 0x40000
pTk/mTk/generic/tkFocus.c view on Meta::CPAN
}
/*
* Check for special events generated by embedded applications to
* request the input focus. If this is one of those events, make
* the change in focus and return without any additional processing
* of the event (note: the "detail" field of the event indicates
* whether to claim the focus even if we don't already have it).
*/
if ((eventPtr->xfocus.mode == EMBEDDED_APP_WANTS_FOCUS)
&& (eventPtr->type == FocusIn)) {
TkSetFocusWin(winPtr, eventPtr->xfocus.detail);
return 0;
}
/*
* This was not a generated event. We'll return 1 (so that the
* event will be processed) if it's an Enter or Leave event, and
* 0 (so that the event won't be processed) if it's a FocusIn or
* FocusOut event.
pTk/mTk/generic/tkFocus.c view on Meta::CPAN
GenerateFocusEvents(displayFocusPtr->focusWinPtr, newFocusPtr);
displayFocusPtr->focusWinPtr = newFocusPtr;
dispPtr->focusPtr = newFocusPtr;
/*
* NotifyPointer gets set when the focus has been set to the root
* window but we have the pointer. We'll treat this like an implicit
* focus in event so that upon Leave events we release focus.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
if (eventPtr->xfocus.detail == NotifyPointer) {
dispPtr->implicitWinPtr = winPtr;
} else {
dispPtr->implicitWinPtr = NULL;
}
}
} else if (eventPtr->type == FocusOut) {
GenerateFocusEvents(displayFocusPtr->focusWinPtr, (TkWindow *) NULL);
/*
pTk/mTk/generic/tkFocus.c view on Meta::CPAN
* when the mouse enters the window (even though we didn't get
* a FocusIn event). Watch for this and grab the focus when it
* happens. Note: if this is an embedded application then don't
* accept the focus implicitly like this; the container
* application will give us the focus explicitly if it wants us
* to have it.
*/
if (eventPtr->xcrossing.focus &&
(displayFocusPtr->focusWinPtr == NULL)
&& !(winPtr->flags & TK_EMBEDDED)) {
if (dispPtr->focusDebug) {
printf("Focussed implicitly on %s\n",
newFocusPtr->pathName);
}
GenerateFocusEvents(displayFocusPtr->focusWinPtr, newFocusPtr);
displayFocusPtr->focusWinPtr = newFocusPtr;
dispPtr->implicitWinPtr = winPtr;
dispPtr->focusPtr = newFocusPtr;
}
pTk/mTk/generic/tkFocus.c view on Meta::CPAN
* window, where it was before we claimed it above. Note:
* dispPtr->implicitWinPtr may not be the same as
* displayFocusPtr->focusWinPtr (e.g. because the "focus"
* command was used to redirect the focus after it arrived at
* dispPtr->implicitWinPtr)!! In addition, we generate events
* because the window manager won't give us a FocusOut event when
* we focus on the root.
*/
if ((dispPtr->implicitWinPtr != NULL)
&& !(winPtr->flags & TK_EMBEDDED)) {
if (dispPtr->focusDebug) {
printf("Defocussed implicit Async\n");
}
GenerateFocusEvents(displayFocusPtr->focusWinPtr,
(TkWindow *) NULL);
XSetInputFocus(dispPtr->display, PointerRoot, RevertToPointerRoot,
CurrentTime);
displayFocusPtr->focusWinPtr = NULL;
dispPtr->implicitWinPtr = NULL;
}
pTk/mTk/generic/tkFocus.c view on Meta::CPAN
*
* 1. If the application is embedded and doesn't currently have the
* focus, don't set the focus directly. Instead, see if the
* embedding code can claim the focus from the enclosing
* container.
* 2. Otherwise, if the application doesn't currently have the
* focus, don't change the window system's focus unless it was
* already in this application or "force" was specified.
*/
if ((topLevelPtr->flags & TK_EMBEDDED)
&& (displayFocusPtr->focusWinPtr == NULL)) {
TkpClaimFocus(topLevelPtr, force);
} else if ((displayFocusPtr->focusWinPtr != NULL) || force) {
/*
* Generate events to shift focus between Tk windows.
* We do this regardless of what TkpChangeFocus does with
* the real X focus so that Tk widgets track focus commands
* when there is no window manager. GenerateFocusEvents will
* set up a serial number marker so we discard focus events
* that are triggered by the ChangeFocus.
pTk/mTk/generic/tkInt.h view on Meta::CPAN
*/
#define UCHAR(c) ((unsigned char) (c))
/*
* The following symbol is used in the mode field of FocusIn events
* generated by an embedded application to request the input focus from
* its container.
*/
#define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
/*
* The following special modifier mask bits are defined, to indicate
* logical modifiers such as Meta and Alt that may float among the
* actual modifier bits.
*/
#define META_MASK (AnyModifier<<1)
#define ALT_MASK (AnyModifier<<2)
pTk/mTk/generic/tkWindow.c view on Meta::CPAN
TkFocusFree(winPtr->mainPtr);
TkStylePkgFree(winPtr->mainPtr);
/*
* When embedding Tk into other applications, make sure
* that all destroy events reach the server. Otherwise
* the embedding application may also attempt to destroy
* the windows, resulting in an X error
*/
if (winPtr->flags & TK_EMBEDDED) {
XSync(winPtr->display, False);
}
ckfree((char *) winPtr->mainPtr);
/*
* If no other applications are using the display, close the
* display now and relinquish its data structures.
*/
#if !defined(WIN32) && !defined(MAC_TCL) && defined(NOT_YET)
pTk/mTk/tclGeneric/tclCmdAH.c view on Meta::CPAN
}
/*
*----------------------------------------------------------------------
*
* Tcl_FileObjCmd --
*
* This procedure is invoked to process the "file" Tcl command.
* See the user documentation for details on what it does.
* PLEASE NOTE THAT THIS FAILS WITH FILENAMES AND PATHS WITH
* EMBEDDED NULLS, WHICH COULD THEORETICALLY HAPPEN ON A MAC.
* With the object-based Tcl_FS APIs, the above NOTE may no
* longer be true. In any case this assertion should be tested.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* See the user documentation.
*
*----------------------------------------------------------------------
pTk/mTk/unix/tkUnixEmbed.c view on Meta::CPAN
if (containerPtr == NULL) {
containerPtr = (Container *) ckalloc(sizeof(Container));
containerPtr->parent = parent;
containerPtr->parentRoot = parentAtts.root;
containerPtr->parentPtr = NULL;
containerPtr->wrapper = None;
containerPtr->nextPtr = tsdPtr->firstContainerPtr;
tsdPtr->firstContainerPtr = containerPtr;
}
containerPtr->embeddedPtr = winPtr;
winPtr->flags |= TK_EMBEDDED;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TkpMakeWindow --
*
* Create an actual window system window object based on the
* current attributes of the specified TkWindow.
pTk/mTk/unix/tkUnixEmbed.c view on Meta::CPAN
TkpMakeWindow(winPtr, parent)
TkWindow *winPtr; /* Tk's information about the window that
* is to be instantiated. */
Window parent; /* Window system token for the parent in
* which the window is to be created. */
{
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
* This window is embedded. Don't create the new window in the
* given parent; instead, create it as a child of the root window
* of the container's screen. The window will get reparented
* into a wrapper window later.
*/
for (containerPtr = tsdPtr->firstContainerPtr; ;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
pTk/mTk/unix/tkUnixEmbed.c view on Meta::CPAN
*/
return;
}
if (winPtr->flags & TK_TOP_HIERARCHY) {
break;
}
winPtr = winPtr->parentPtr;
}
if (winPtr->flags & TK_EMBEDDED) {
/*
* This application is embedded. If we got a key event without
* officially having the focus, it means that the focus is
* really in the container, but the mouse was over the embedded
* application. Send the event back to the container.
*/
for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->embeddedPtr != winPtr;
containerPtr = containerPtr->nextPtr) {
pTk/mTk/unix/tkUnixEmbed.c view on Meta::CPAN
* focus window; should be embedded. */
int force; /* One means that the container should
* claim the focus if it doesn't
* currently have it. */
{
XEvent event;
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
return;
}
for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->embeddedPtr != topLevelPtr;
containerPtr = containerPtr->nextPtr) {
/* Empty loop body. */
}
event.xfocus.type = FocusIn;
event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display);
event.xfocus.send_event = 1;
event.xfocus.display = topLevelPtr->display;
event.xfocus.window = containerPtr->parent;
event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS;
event.xfocus.detail = force;
XSendEvent(event.xfocus.display, event.xfocus.window, False, 0, &event);
}
#if 0
/*
*----------------------------------------------------------------------
*
* TkpTestembedCmd --
*
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
": it is an embedded window", NULL);
return TCL_ERROR;
}
wmPtr->flags &= ~WM_WITHDRAWN;
TkpWmSetState(winPtr, NormalState);
return TCL_OK;
}
/*
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
if (wmPtr->masterPtr != NULL) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
"\": it is a transient", NULL);
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
": it is an embedded window", NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
Tcl_SetResult(interp,
"couldn't send iconify message to window manager",
TCL_STATIC);
return TCL_ERROR;
}
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
} else {
/*
* Note: if this window is embedded then don't set the external
* size, since it came from the containing application, not the
* user. In this case we want to keep sending our size requests to
* the containing application; if the user fixes the size of that
* application then it will still percolate down to us in the
* right way.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
if (wmPtr->gridWin != NULL) {
wmPtr->width = wmPtr->reqGridWidth
+ (configEventPtr->width
- winPtr->reqWidth)/wmPtr->widthInc;
if (wmPtr->width < 0) {
wmPtr->width = 0;
}
} else {
wmPtr->width = configEventPtr->width;
}
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
/*
* Don't set external height, since the user didn't change it from
* what the widgets asked for.
*/
} else {
/*
* See note for wmPtr->width about not setting external size for
* embedded windows.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
if (wmPtr->gridWin != NULL) {
wmPtr->height = wmPtr->reqGridHeight
+ (configEventPtr->height - wmPtr->menuHeight
- winPtr->reqHeight)/wmPtr->heightInc;
if (wmPtr->height < 0) {
wmPtr->height = 0;
}
} else {
wmPtr->height = configEventPtr->height - wmPtr->menuHeight;
}
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
* 3. Can't just reconfigure always, because we may not get a
* ConfigureNotify event back if nothing changed, so
* WaitForConfigureNotify will hang a long time.
* 4. Don't move window unless a new position has been requested for it.
* This is because of "features" in some window managers (e.g. twm, as
* of 4/24/91) where they don't interpret coordinates according to
* ICCCM. Moving a window to its current location may cause it to shift
* position on the screen.
*/
if ((winPtr->flags & (TK_EMBEDDED|TK_BOTH_HALVES))
== (TK_EMBEDDED|TK_BOTH_HALVES)) {
TkWindow *childPtr = TkpGetOtherWindow(winPtr);
/*
* This window is embedded and the container is also in this process,
* so we don't need to do anything special about the geometry, except
* to make sure that the desired size is known by the container. Also,
* zero out any position information, since embedded windows are not
* allowed to move.
*/
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
* This window is a special menubar; switch over to its associated
* toplevel, compensate for their differences in y coordinates,
* then continue with the toplevel (in case it's embedded).
*/
y -= winPtr->wmInfoPtr->menuHeight;
winPtr = winPtr->wmInfoPtr->winPtr;
continue;
}
if (winPtr->flags & TK_TOP_LEVEL) {
TkWindow *otherPtr;
if (!(winPtr->flags & TK_EMBEDDED)) {
break;
}
otherPtr = TkpGetOtherWindow(winPtr);
if (otherPtr == NULL) {
/*
* The container window is not in the same application. Query
* the X server.
*/
Window root, dummyChild;
pTk/mTk/unix/tkUnixWm.c view on Meta::CPAN
* Tk doesn't normally select for StructureNotifyMask events because the
* events are synthesized internally. However, for wrapper windows we need
* to know when the window manager modifies the window configuration. We
* also need to select on focus change events; these are the only windows
* for which we care about focus changes.
*/
wrapperPtr->flags |= TK_WRAPPER;
wrapperPtr->atts.event_mask |= StructureNotifyMask|FocusChangeMask;
wrapperPtr->atts.override_redirect = winPtr->atts.override_redirect;
if (winPtr->flags & TK_EMBEDDED) {
parent = TkUnixContainerId(winPtr);
} else {
parent = XRootWindow(wrapperPtr->display, wrapperPtr->screenNum);
}
wrapperPtr->window = XCreateWindow(wrapperPtr->display,
parent, wrapperPtr->changes.x, wrapperPtr->changes.y,
(unsigned) wrapperPtr->changes.width,
(unsigned) wrapperPtr->changes.height,
(unsigned) wrapperPtr->changes.border_width, wrapperPtr->depth,
InputOutput, wrapperPtr->visual,
pTk/mTk/win/tkWinEmbed.c view on Meta::CPAN
/*
* 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 --
*
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
if (winPtr->window == None) {
/*
* Ensure existence of the window to update the wrapper for.
*/
Tk_MakeWindowExist((Tk_Window) winPtr);
}
child = TkWinGetHWND(winPtr->window);
parentHWND = NULL;
if (winPtr->flags & TK_EMBEDDED) {
wmPtr->wrapper = (HWND) winPtr->privatePtr;
if (wmPtr->wrapper == NULL) {
panic("UpdateWrapper: Cannot find container window");
}
if (!IsWindow(wmPtr->wrapper)) {
panic("UpdateWrapper: Container was destroyed");
}
} else {
/*
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
* Windows doesn't try to set the focus to the child window.
*/
#ifdef _WIN64
SetWindowLongPtr(child, GWL_STYLE,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
#else
SetWindowLong(child, GWL_STYLE,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
#endif
if (winPtr->flags & TK_EMBEDDED) {
#ifdef _WIN64
SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc);
#else
SetWindowLong(child, GWL_WNDPROC, (LONG) TopLevelProc);
#endif
}
oldWrapper = SetParent(child, wmPtr->wrapper);
if (oldWrapper) {
hSmallIcon = (HICON) SendMessage(oldWrapper, WM_GETICON, ICON_SMALL,
(LPARAM) NULL);
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
}
if (hBigIcon != NULL) {
SendMessage(wmPtr->wrapper,WM_SETICON,ICON_BIG,(LPARAM)hBigIcon);
}
/*
* If we are embedded then force a mapping of the window now,
* because we do not necessarily own the wrapper and may not
* get another opportunity to map ourselves. We should not be
* in either iconified or zoomed states when we get here, so
* it is safe to just check for TK_EMBEDDED without checking
* what state we are supposed to be in (default to NormalState).
*/
if (winPtr->flags & TK_EMBEDDED) {
XMapWindow(winPtr->display, winPtr->window);
}
/*
* Set up menus on the wrapper if required.
*/
if (wmPtr->hMenu != NULL) {
wmPtr->flags = WM_SYNC_PENDING;
SetMenu(wmPtr->wrapper, wmPtr->hMenu);
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, (ClientData) winPtr);
wmPtr->masterPtr = NULL;
}
/*
* Destroy the decorative frame window.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
if (wmPtr->wrapper != NULL) {
DestroyWindow(wmPtr->wrapper);
} else {
DestroyWindow(Tk_GetHWND(winPtr->window));
}
}
if (wmPtr->iconPtr != NULL) {
/*
* This may delete the icon resource data. I believe we
* should do this after destroying the decorative frame,
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
stylePtr = &style;
styleBit = WS_DISABLED;
} else if ((strncmp(string, "-toolwindow", length) == 0)
&& (length >= 3)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOOLWINDOW;
} else if ((strncmp(string, "-topmost", length) == 0)
&& (length >= 3)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOPMOST;
if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) {
Tcl_AppendResult(interp, "can't set topmost flag on ",
winPtr->pathName, ": it is an embedded window",
(char *) NULL);
return TCL_ERROR;
}
} else {
goto configArgs;
}
if (i == objc-1) {
Tcl_SetIntObj(Tcl_GetObjResult(interp),
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
": it is an icon for ", Tk_PathName(wmPtr->iconFor),
(char *) NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
": it is an embedded window", (char *) NULL);
return TCL_ERROR;
}
wmPtr->flags &= ~WM_WITHDRAWN;
/*
* If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
* need to be called first to update a withdrawn toplevel's geometry
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
"\": it is a transient", (char *) NULL);
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
": it is an icon for ", Tk_PathName(wmPtr->iconFor),
(char *) NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
": it is an embedded window", (char *) NULL);
return TCL_ERROR;
}
TkpWmSetState(winPtr, IconicState);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
}
if (curValue != boolean) {
/*
* Only do this if we are really changing value, because it
* causes some funky stuff to occur
*/
atts.override_redirect = (boolean) ? True : False;
Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
&atts);
if (!(wmPtr->flags & (WM_NEVER_MAPPED)
&& !(winPtr->flags & TK_EMBEDDED))) {
UpdateWrapper(winPtr);
}
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* WmPositionfromCmd --
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
wmPtr->flags &= ~WM_WIDTH_NOT_RESIZABLE;
} else {
wmPtr->flags |= WM_WIDTH_NOT_RESIZABLE;
}
if (height) {
wmPtr->flags &= ~WM_HEIGHT_NOT_RESIZABLE;
} else {
wmPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
}
if (!((wmPtr->flags & WM_NEVER_MAPPED)
&& !(winPtr->flags & TK_EMBEDDED))) {
UpdateWrapper(winPtr);
}
WmUpdateGeom(wmPtr, winPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* WmSizefromCmd --
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
return TCL_ERROR;
}
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't change state of ",
Tcl_GetString(objv[2]),
": it is an icon for ", Tk_PathName(wmPtr->iconFor),
(char *) NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't change state of ",
winPtr->pathName, ": it is an embedded window",
(char *) NULL);
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
&index) != TCL_OK) {
return TCL_ERROR;
}
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
masterPtr->wmInfoPtr->numTransients++;
Tk_CreateEventHandler((Tk_Window) masterPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, (ClientData) winPtr);
wmPtr->masterPtr = masterPtr;
}
}
if (!((wmPtr->flags & WM_NEVER_MAPPED)
&& !(winPtr->flags & TK_EMBEDDED))) {
if (wmPtr->masterPtr != NULL &&
!Tk_IsMapped(wmPtr->masterPtr)) {
TkpWmSetState(winPtr, WithdrawnState);
} else {
UpdateWrapper(winPtr);
}
}
return TCL_OK;
}
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
(Tk_ErrorProc *) NULL, (ClientData) NULL);
Tk_DestroyWindow((Tk_Window) winPtr);
Tk_DeleteErrorHandler(handler);
}
}
else if (eventPtr->type == ConfigureNotify) {
WmInfo *wmPtr;
wmPtr = winPtr->wmInfoPtr;
if (winPtr->flags & TK_EMBEDDED) {
Tk_Window tkwin = (Tk_Window)winPtr;
SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
Tk_ReqHeight(tkwin));
}
}
}
/*
*----------------------------------------------------------------------
*
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
/* ARGSUSED */
static void
TopLevelReqProc(dummy, tkwin)
ClientData dummy; /* Not used. */
Tk_Window tkwin; /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
wmPtr = winPtr->wmInfoPtr;
if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) {
SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
Tk_ReqHeight(tkwin));
}
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
/*
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
if (wmPtr->flags & WM_CREATE_PENDING) {
winPtr->changes.x = x;
winPtr->changes.y = y;
winPtr->changes.width = width;
winPtr->changes.height = height;
return;
}
wmPtr->flags |= WM_SYNC_PENDING;
if (winPtr->flags & TK_EMBEDDED) {
/*
* The wrapper window is in a different process, so we need
* to send it a geometry request. This protocol assumes that
* the other process understands this Tk message, otherwise
* our requested geometry will be ignored.
*/
SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, width, height);
} else {
int reqHeight, reqWidth;
pTk/mTk/win/tkWinWm.c view on Meta::CPAN
void
TkWinSetMenu(tkwin, hMenu)
Tk_Window tkwin; /* the window to put the menu in */
HMENU hMenu; /* the menu to set */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
wmPtr->hMenu = hMenu;
if (!(wmPtr->flags & TK_EMBEDDED)) {
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
int syncPending = wmPtr->flags & WM_SYNC_PENDING;
wmPtr->flags |= WM_SYNC_PENDING;
SetMenu(wmPtr->wrapper, hMenu);
if (!syncPending) {
wmPtr->flags &= ~WM_SYNC_PENDING;
}
}
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
pod/Text.pod view on Meta::CPAN
See L<"TAGS"> below for more details.
The second form of annotation consists of marks, which are floating
markers in the text.
Marks are used to keep track of various interesting positions in the
text as it is edited.
See L<"MARKS"> below for more details.
The third form of annotation allows arbitrary windows to be
embedded in a text widget.
See L<"EMBEDDED WINDOWS"> below for more details.
The fourth form of annotation allows Tk images to be embedded in a text
widget.
See L<"EMBEDDED IMAGES"> below for more details.
The Perl/Tk B<Text> widget does not support undo/redo, use the B<TextUndo>
widget instead.
=head1 INDICES
Many of the methods for texts take one or more indices
as arguments.
An index is a string used to indicate a particular place within
a text, such as a place to insert characters or one endpoint of a
pod/Text.pod view on Meta::CPAN
First, the mark B<insert> is associated with the insertion cursor,
as described under L<"THE INSERTION CURSOR"> below.
Second, the mark B<current> is associated with the character
closest to the mouse and is adjusted automatically to track the
mouse position and any changes to the text in the widget (one
exception: B<current> is not updated in response to mouse
motions if a mouse button is down; the update will be deferred
until all mouse buttons have been released).
Neither of these special marks may be deleted.
=head1 EMBEDDED WINDOWS
The third form of annotation in text widgets is an embedded window.
Each embedded window annotation causes a window to be displayed
at a particular point in the text.
There may be any number of embedded windows in a text widget,
and any widget may be used as an embedded window (subject to the
usual rules for geometry management, which require the text window
to be the parent of the embedded window or a descendant of its
parent).
The embedded window's position on the screen will be updated as the
pod/Text.pod view on Meta::CPAN
If the B<-pady> option has been specified as well, then the
requested padding will be retained even if the window is
stretched.
=item B<-window> =E<gt> I<$widget>
Specifies the name of a window to display in the annotation.
=back
=head1 EMBEDDED IMAGES
The final form of annotation in text widgets is an embedded image.
Each embedded image annotation causes an image to be displayed
at a particular point in the text.
There may be any number of embedded images in a text widget,
and a particular image may be embedded in multiple places in the same
text widget.
The embedded image's position on the screen will be updated as the
text is modified or scrolled.
Each embedded image occupies one character's worth of index space
pod/Text.pod view on Meta::CPAN
that follows the B<image> prefix.
The following forms of the methods are currently supported:
=over 8
=item I<$text>-E<gt>B<imageCget>(I<index, option>)
Returns the value of a configuration option for an embedded image.
I<Index> identifies the embedded image, and I<option>
specifies a particular configuration option, which must be one of
the ones listed in L<"EMBEDDED IMAGES">.
=item I<$text>-E<gt>B<imageConfigure>(I<index, >?I<option, value, ...>?)
Query or modify the configuration options for an embedded image.
If no I<option> is specified, returns a list describing all of
the available options for the embedded image at I<index>
(see L<Tk::options> for information on the format of this list).
If I<option> is specified with no I<value>, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
I<option> is specified).
If one or more I<option-value> pairs are specified, then the command
modifies the given option(s) to have the given value(s); in
this case the command returns an empty string.
See L<"EMBEDDED IMAGES"> for information on the options that
are supported.
=item I<$text>-E<gt>B<imageCreate>(I<index, >?I<option, value, ...>?)
This command creates a new image annotation, which will appear
in the text at the position given by I<index>.
Any number of I<option-value> pairs may be specified to
configure the annotation.
Returns a unique identifier that may be used as an index to refer to
this image.
See L<"EMBEDDED IMAGES"> for information on the options that
are supported, and a description of the identifier returned.
=item I<$text>-E<gt>B<imageNames>
Returns a list whose elements are the names of all image instances currently
embedded in $text.
=back
=item I<$text>-E<gt>B<index>(I<index>)
pod/Text.pod view on Meta::CPAN
that follows the B<window> argument.
The following forms of the method are currently supported:
=over 8
=item I<$text>->B<windowCget>(I<index, option>)
Returns the value of a configuration option for an embedded window.
I<Index> identifies the embedded window, and I<option>
specifies a particular configuration option, which must be one of
the ones listed in L<"EMBEDDED WINDOWS"> above.
=item I<$text>->B<windowConfigure>(I<index>?, I<option, value, ...>?)
Query or modify the configuration options for an embedded window.
If no I<option> is specified, returns a list describing all of
the available options for the embedded window at I<index>
(see L<Tk::options> for information on the format of this list).
If I<option> is specified with no I<value>, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
I<option> is specified).
If one or more I<option-value> pairs are specified, then the command
modifies the given option(s) to have the given value(s); in
this case the command returns an empty string.
See L<"EMBEDDED WINDOWS"> above for information on the options that
are supported.
=item I<$text>->B<windowCreate>(I<index>?, I<option, value, ...>?)
This command creates a new window annotation, which will appear
in the text at the position given by I<index>.
Any number of I<option-value> pairs may be specified to
configure the annotation.
See L<"EMBEDDED WINDOWS"> above for information on the options that
are supported.
Returns an empty string.
=item I<$text>->B<windowNames>
Returns a list whose elements are the names of all windows currently
embedded in $text.
=back