⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tkwindow.c

📁 linux系统下的音频通信
💻 C
📖 第 1 页 / 共 5 页
字号:
	XSetWindowBorderPixmap(winPtr->display,		winPtr->window, pixmap);    } else {	winPtr->dirtyAtts = (winPtr->dirtyAtts & (unsigned) ~CWBorderPixel)		| CWBorderPixmap;    }}voidTk_DefineCursor(tkwin, cursor)    Tk_Window tkwin;		/* Window to manipulate. */    Tk_Cursor cursor;		/* Cursor to use for window (may be None). */{    register TkWindow *winPtr = (TkWindow *) tkwin;#ifdef MAC_TCL    winPtr->atts.cursor = (XCursor) cursor;#else    winPtr->atts.cursor = (Cursor) cursor;#endif        if (winPtr->window != None) {	XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor);    } else {	winPtr->dirtyAtts = winPtr->dirtyAtts | CWCursor;    }}voidTk_UndefineCursor(tkwin)    Tk_Window tkwin;		/* Window to manipulate. */{    Tk_DefineCursor(tkwin, None);}voidTk_SetWindowColormap(tkwin, colormap)    Tk_Window tkwin;		/* Window to manipulate. */    Colormap colormap;		/* Colormap to use for window. */{    register TkWindow *winPtr = (TkWindow *) tkwin;    winPtr->atts.colormap = colormap;    if (winPtr->window != None) {	XSetWindowColormap(winPtr->display, winPtr->window, colormap);	if (!(winPtr->flags & TK_TOP_LEVEL)) {	    TkWmAddToColormapWindows(winPtr);	    winPtr->flags |= TK_WM_COLORMAP_WINDOW;	}    } else {	winPtr->dirtyAtts |= CWColormap;    }}/* *---------------------------------------------------------------------- * * Tk_SetWindowVisual -- * *	This procedure is called to specify a visual to be used *	for a Tk window when it is created.  This procedure, if *	called at all, must be called before the X window is created *	(i.e. before Tk_MakeWindowExist is called). * * Results: *	The return value is 1 if successful, or 0 if the X window has *	been already created. * * Side effects: *	The information given is stored for when the window is created. * *---------------------------------------------------------------------- */intTk_SetWindowVisual(tkwin, visual, depth, colormap)    Tk_Window tkwin;		/* Window to manipulate. */    Visual *visual;		/* New visual for window. */    int depth;			/* New depth for window. */    Colormap colormap;		/* An appropriate colormap for the visual. */{    register TkWindow *winPtr = (TkWindow *) tkwin;    if( winPtr->window != None ){	/* Too late! */	return 0;    }    winPtr->visual = visual;    winPtr->depth = depth;    winPtr->atts.colormap = colormap;    winPtr->dirtyAtts |= CWColormap;    /*     * The following code is needed to make sure that the window doesn't     * inherit the parent's border pixmap, which would result in a BadMatch     * error.     */    if (!(winPtr->dirtyAtts & CWBorderPixmap)) {	winPtr->dirtyAtts |= CWBorderPixel;    }    return 1;}/* *---------------------------------------------------------------------- * * TkDoConfigureNotify -- * *	Generate a ConfigureNotify event describing the current *	configuration of a window. * * Results: *	None. * * Side effects: *	An event is generated and processed by Tk_HandleEvent. * *---------------------------------------------------------------------- */voidTkDoConfigureNotify(winPtr)    register TkWindow *winPtr;		/* Window whose configuration					 * was just changed. */{    XEvent event;    event.type = ConfigureNotify;    event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display);    event.xconfigure.send_event = False;    event.xconfigure.display = winPtr->display;    event.xconfigure.event = winPtr->window;    event.xconfigure.window = winPtr->window;    event.xconfigure.x = winPtr->changes.x;    event.xconfigure.y = winPtr->changes.y;    event.xconfigure.width = winPtr->changes.width;    event.xconfigure.height = winPtr->changes.height;    event.xconfigure.border_width = winPtr->changes.border_width;    if (winPtr->changes.stack_mode == Above) {	event.xconfigure.above = winPtr->changes.sibling;    } else {	event.xconfigure.above = None;    }    event.xconfigure.override_redirect = winPtr->atts.override_redirect;    Tk_HandleEvent(&event);}/* *---------------------------------------------------------------------- * * Tk_SetClass -- * *	This procedure is used to give a window a class. * * Results: *	None. * * Side effects: *	A new class is stored for tkwin, replacing any existing *	class for it. * *---------------------------------------------------------------------- */voidTk_SetClass(tkwin, className)    Tk_Window tkwin;		/* Token for window to assign class. */    char *className;		/* New class for tkwin. */{    register TkWindow *winPtr = (TkWindow *) tkwin;    winPtr->classUid = Tk_GetUid(className);    if (winPtr->flags & TK_TOP_LEVEL) {	TkWmSetClass(winPtr);    }    TkOptionClassChanged(winPtr);}/* *---------------------------------------------------------------------- * * TkSetClassProcs -- * *	This procedure is used to set the class procedures and *	instance data for a window. * * Results: *	None. * * Side effects: *	A new set of class procedures and instance data is stored *	for tkwin, replacing any existing values. * *---------------------------------------------------------------------- */voidTkSetClassProcs(tkwin, procs, instanceData)    Tk_Window tkwin;		/* Token for window to modify. */    TkClassProcs *procs;	/* Class procs structure. */    ClientData instanceData;	/* Data to be passed to class procedures. */{    register TkWindow *winPtr = (TkWindow *) tkwin;    winPtr->classProcsPtr = procs;    winPtr->instanceData = instanceData;}/* *---------------------------------------------------------------------- * * Tk_NameToWindow -- * *	Given a string name for a window, this procedure *	returns the token for the window, if there exists a *	window corresponding to the given name. * * Results: *	The return result is either a token for the window corresponding *	to "name", or else NULL to indicate that there is no such *	window.  In this case, an error message is left in interp->result. * * Side effects: *	None. * *---------------------------------------------------------------------- */Tk_WindowTk_NameToWindow(interp, pathName, tkwin)    Tcl_Interp *interp;		/* Where to report errors. */    char *pathName;		/* Path name of window. */    Tk_Window tkwin;		/* Token for window:  name is assumed to				 * belong to the same main window as tkwin. */{    Tcl_HashEntry *hPtr;    hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->nameTable,	    pathName);    if (hPtr == NULL) {	Tcl_AppendResult(interp, "bad window path name \"",		pathName, "\"", (char *) NULL);	return NULL;    }    return (Tk_Window) Tcl_GetHashValue(hPtr);}/* *---------------------------------------------------------------------- * * Tk_IdToWindow -- * *	Given an X display and window ID, this procedure returns the *	Tk token for the window, if there exists a Tk window corresponding *	to the given ID. * * Results: *	The return result is either a token for the window corresponding *	to the given X id, or else NULL to indicate that there is no such *	window. * * Side effects: *	None. * *---------------------------------------------------------------------- */Tk_WindowTk_IdToWindow(display, window)    Display *display;		/* X display containing the window. */    Window window;		/* X window window id. */{    TkDisplay *dispPtr;    Tcl_HashEntry *hPtr;    for (dispPtr = tkDisplayList; ; dispPtr = dispPtr->nextPtr) {	if (dispPtr == NULL) {	    return NULL;	}	if (dispPtr->display == display) {	    break;	}    }    hPtr = Tcl_FindHashEntry(&dispPtr->winTable, (char *) window);    if (hPtr == NULL) {	return NULL;    }    return (Tk_Window) Tcl_GetHashValue(hPtr);}/* *---------------------------------------------------------------------- * * Tk_DisplayName -- * *	Return the textual name of a window's display. * * Results: *	The return value is the string name of the display associated *	with tkwin. * * Side effects: *	None. * *---------------------------------------------------------------------- */char *Tk_DisplayName(tkwin)    Tk_Window tkwin;		/* Window whose display name is desired. */{    return ((TkWindow *) tkwin)->dispPtr->name;}/* *---------------------------------------------------------------------- * * UnlinkWindow -- * *	This procedure removes a window from the childList of its *	parent. * * Results: *	None. * * Side effects: *	The window is unlinked from its childList. * *---------------------------------------------------------------------- */static voidUnlinkWindow(winPtr)    TkWindow *winPtr;			/* Child window to be unlinked. */{    TkWindow *prevPtr;    if (winPtr->parentPtr == NULL) {	return;    }    prevPtr = winPtr->parentPtr->childList;    if (prevPtr == winPtr) {	winPtr->parentPtr->childList = winPtr->nextPtr;	if (winPtr->nextPtr == NULL) {	    winPtr->parentPtr->lastChildPtr = NULL;	}    } else {	while (prevPtr->nextPtr != winPtr) {	    prevPtr = prevPtr->nextPtr;	    if (prevPtr == NULL) {		panic("UnlinkWindow couldn't find child in parent");	    }	}	prevPtr->nextPtr = winPtr->nextPtr;	if (winPtr->nextPtr == NULL) {	    winPtr->parentPtr->lastChildPtr = prevPtr;	}    }}/* *---------------------------------------------------------------------- * * Tk_RestackWindow -- * *	Change a window's position in the stacking order. * * Results: *	TCL_OK is normally returned.  If other is not a descendant *	of tkwin's parent then TCL_ERROR is returned and tkwin is *	not repositioned. * * Side effects: *	Tkwin is repositioned in the stacking order. * *---------------------------------------------------------------------- */intTk_RestackWindow(tkwin, aboveBelow, other)    Tk_Window tkwin;		/* Token for window whose position in				 * the stacking order is to change. */    int aboveBelow;		/* Indicates new position of tkwin relative				 * to other;  must be Above or Below. */    Tk_Window other;		/* Tkwin will be moved to a position that				 * puts it just above or below this window.				 * If NULL then tkwin goes above or below				 * all windows in the same parent. */{    TkWindow *winPtr = (TkWindow *) tkwin;    TkWindow *otherPtr = (TkWindow *) other;    XWindowChanges changes;    unsigned int mask;    /*     * Special case:  if winPtr is a top-level window then just find     * the top-level ancestor of otherPtr and restack winPtr above     * otherPtr without changing any of Tk's childLists.     */    changes.stack_mode = aboveBelow;    mask = CWStackMode;    if (winPtr->flags & TK_TOP_LEVEL) {	while ((otherPtr != NULL) && !(otherPtr->flags & TK_TOP_LEVEL)) {	    otherPtr = otherPtr->parentPtr;	}	TkWmRestackToplevel(winPtr, aboveBelow, otherPtr);	return TCL_OK;    }    /*     * Find an ancestor of otherPtr that is a sibling of winPtr.     */    if (winPtr->parentPtr == NULL) {	/*	 * Window is going to be deleted shortly;  don't do anything.	 */	return TCL_OK;    }    if (otherPtr == NULL) {	if (aboveBelow == Above) {	    otherPtr = winPtr->parentPtr->lastChildPtr;	} else {	    otherPtr = winPtr->parentPtr->childList;	}    } else {	while (winPtr->parentPtr != otherPtr->parentPtr) {	    if ((otherPtr == NULL) || (otherPtr->flags & TK_TOP_LEVEL)) {		return TCL_ERROR;	    }	    otherPtr = otherPtr->parentPtr;	}    }    if (otherPtr 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -