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

📄 tkmacsubwindows.c

📁 linux系统下的音频通信
💻 C
📖 第 1 页 / 共 3 页
字号:
RgnHandleTkMacVisableClipRgn(    TkWindow *winPtr){    if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {	TkMacUpdateClipRgn(winPtr);    }    return winPtr->privatePtr->clipRgn;}/* *---------------------------------------------------------------------- * * TkMacInvalidateWindow -- * *	This function makes the window as invalid will generate damage *	for the window. * * Results: *	None. * * Side effects: *	Damage is created. * *---------------------------------------------------------------------- */voidTkMacInvalidateWindow(    MacDrawable *macWin,        /* Make window that's causing damage. */    int flag)			/* Should be TK_WINDOW_ONLY or				 * TK_PARENT_WINDOW */{        if (flag == TK_WINDOW_ONLY) {	InvalRgn(macWin->clipRgn);    } else {	if (!EmptyRgn(macWin->aboveClipRgn)) {	    InvalRgn(macWin->aboveClipRgn);	}    }}/* *---------------------------------------------------------------------- * * TkMacGetDrawablePort -- * *	This function returns the Graphics Port for a given X drawable. * * Results: *	A GWorld pointer.  Either an off screen pixmap or a Window. * * Side effects: *	None. * *---------------------------------------------------------------------- */GWorldPtrTkMacGetDrawablePort(    Drawable drawable){    MacDrawable *macWin = (MacDrawable *) drawable;    GWorldPtr resultPort = NULL;        if (macWin == NULL) {        return NULL;    }        /*     * This is NULL for off-screen pixmaps.  Then the portPtr     * always points to the off-screen port, and we don't     * have to worry about containment     */         if (macWin->clipRgn == NULL) {	return macWin->portPtr;    }        /*     * If the Drawable is in an embedded window, use the Port of its container.     *       * TRICKY POINT: we can have cases when a toplevel is being destroyed     * where the winPtr for the toplevel has been freed, but the children      * are not all the way destroyed.  The children will call this function     * as they are being destroyed, but Tk_IsEmbedded will return garbage.     * So we check the copy of the TK_EMBEDDED flag we put into the      * toplevel's macWin flags.     */        if (!(macWin->toplevel->flags & TK_EMBEDDED)) {        return macWin->toplevel->portPtr;    } else {    	TkWindow *contWinPtr;	contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);	    	if (contWinPtr != NULL) {    	    resultPort = TkMacGetDrawablePort((Drawable) contWinPtr->privatePtr);    	} else if (gMacEmbedHandler != NULL) {	    resultPort = gMacEmbedHandler->getPortProc(                    (Tk_Window) macWin->winPtr);    	} 		if (resultPort == NULL) {    	    panic("TkMacGetDrawablePort couldn't find container");    	    return NULL;    	}		    	/*	 * NOTE: Here we should handle out of process embedding.	 */		        }    return resultPort;}/* *---------------------------------------------------------------------- * * TkMacInvalClipRgns -- * *	This function invalidates the clipping regions for a given *	window and all of its children.  This function should be *	called whenever changes are made to subwindows that would *	effect the size or position of windows. * * Results: *	None. * * Side effects: *	The cliping regions for the window and its children are *	mark invalid.  (Make sure they are valid before drawing.) * *---------------------------------------------------------------------- */voidTkMacInvalClipRgns(    TkWindow *winPtr){    TkWindow *childPtr;	    /*      * If already marked we can stop because all      * decendants will also already be marked.     */    if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {	return;    }	    winPtr->privatePtr->flags |= TK_CLIP_INVALID;	    /*      * Invalidate clip regions for all children &      * their decendants - unless the child is a toplevel.     */    childPtr = winPtr->childList;    while (childPtr != NULL) {	if (!Tk_IsTopLevel(childPtr) && Tk_IsMapped(childPtr)) {	    TkMacInvalClipRgns(childPtr);	}	childPtr = childPtr->nextPtr;    }        /*     * Also, if the window is a container, mark its embedded window     */         if (Tk_IsContainer(winPtr)) {	childPtr = TkpGetOtherWindow(winPtr);	if (childPtr != NULL && Tk_IsMapped(childPtr)) {	    TkMacInvalClipRgns(childPtr);	}		/*	 * NOTE: Here we should handle out of process embedding.	 */		    	    }     	    }/* *---------------------------------------------------------------------- * * TkMacWinBounds -- * *	Given a Tk window this function determines the windows *	bounds in relation to the Macintosh window's coordinate *	system.  This is also the same coordinate system as the *	Tk toplevel window in which this window is contained. * * Results: *	None. * * Side effects: *	None. * *---------------------------------------------------------------------- */voidTkMacWinBounds(    TkWindow *winPtr,    Rect *bounds){    bounds->left = (short) winPtr->privatePtr->xOff;    bounds->top = (short) winPtr->privatePtr->yOff;    bounds->right = (short) (winPtr->privatePtr->xOff +	    winPtr->changes.width);    bounds->bottom = (short) (winPtr->privatePtr->yOff +	    winPtr->changes.height);}/* *---------------------------------------------------------------------- * * tkMacMoveWindow -- * *	A replacement for the Macintosh MoveWindow function.  This *	function adjusts the inputs to MoveWindow to offset the root of  *	the window system.  This has the effect of making the coords  *	refer to the window dressing rather than the top of the content. * * Results: *	None. * * Side effects: *	Moves the Macintosh window. * *---------------------------------------------------------------------- */void tkMacMoveWindow(    WindowRef window,    int x,    int y){    int xOffset, yOffset;    TkMacWindowOffset(window, &xOffset, &yOffset);    MoveWindow((WindowRef) window, 	(short) (x + xOffset), (short) (y + yOffset), false);}/* *---------------------------------------------------------------------- * * UpdateOffsets -- * *	Updates the X & Y offsets of the given TkWindow from the *	TopLevel it is a decendant of. * * Results: *	None. * * Side effects: *	The xOff & yOff fields for the Mac window datastructure *	is updated to the proper offset. * *---------------------------------------------------------------------- */static voidUpdateOffsets(    TkWindow *winPtr,    int deltaX,    int deltaY){    TkWindow *childPtr;    if (winPtr->privatePtr == NULL) {	/*	 * We havn't called Tk_MakeWindowExist for this window yet.  The	 * offset information will be postponed and calulated at that 	 * time.  (This will usually only happen when a mapped parent is	 * being moved but has child windows that have yet to be mapped.)	 */	return;    }        winPtr->privatePtr->xOff += deltaX;    winPtr->privatePtr->yOff += deltaY;    childPtr = winPtr->childList;    while (childPtr != NULL) {	if (!Tk_IsTopLevel(childPtr)) {	    UpdateOffsets(childPtr, deltaX, deltaY);	}	childPtr = childPtr->nextPtr;    }        if (Tk_IsContainer(winPtr)) {	childPtr = TkpGetOtherWindow(winPtr);	if (childPtr != NULL) {	    UpdateOffsets(childPtr,deltaX,deltaY);	}	    	/*	 * NOTE: Here we should handle out of process embedding.	 */		        }}/* *---------------------------------------------------------------------- * * Tk_GetPixmap -- * *	Creates an in memory drawing surface. * * Results: *	Returns a handle to a new pixmap. * * Side effects: *	Allocates a new Macintosh GWorld. * *---------------------------------------------------------------------- */PixmapTk_GetPixmap(    Display *display,	/* Display for new pixmap (can be null). */    Drawable d,		/* Drawable where pixmap will be used (ignored). */    int width,		/* Dimensions of pixmap. */    int height,    int depth)		/* Bits per pixel for pixmap. */{    QDErr err;    GWorldPtr gWorld;    Rect bounds;    MacDrawable *macPix;    PixMapHandle pixels;        if (display != NULL) {	display->request++;    }    macPix = (MacDrawable *) ckalloc(sizeof(MacDrawable));    macPix->winPtr = NULL;    macPix->xOff = 0;    macPix->yOff = 0;    macPix->clipRgn = NULL;    macPix->aboveClipRgn = NULL;    macPix->referenceCount = 0;    macPix->toplevel = NULL;    macPix->flags = 0;    bounds.top = bounds.left = 0;    bounds.right = (short) width;    bounds.bottom = (short) height;    if (depth != 1) {	depth = 0;    }    /*     * Allocate memory for the off screen pixmap.  If we fail     * try again from system memory.  Eventually, we may have     * to panic.     */    err = NewGWorld(&gWorld, depth, &bounds, NULL, NULL, 0);    if (err != noErr) {	err = NewGWorld(&gWorld, depth, &bounds, NULL, NULL, useTempMem);    }    if (err != noErr) {        panic("Out of memory: NewGWorld failed in Tk_GetPixmap");    }    /*     * Lock down the pixels so they don't move out from under us.     */    pixels = GetGWorldPixMap(gWorld);    LockPixels(pixels);    macPix->portPtr = gWorld;    return (Pixmap) macPix;}/* *---------------------------------------------------------------------- * * Tk_FreePixmap -- * *	Release the resources associated with a pixmap. * * Results: *	None. * * Side effects: *	Deletes the Macintosh GWorld created by Tk_GetPixmap. * *---------------------------------------------------------------------- */void Tk_FreePixmap(    Display *display,		/* Display. */    Pixmap pixmap)     		/* Pixmap to destroy */{    MacDrawable *macPix = (MacDrawable *) pixmap;    PixMapHandle pixels;    display->request++;    pixels = GetGWorldPixMap(macPix->portPtr);    UnlockPixels(pixels);    DisposeGWorld(macPix->portPtr);    ckfree((char *) macPix);}

⌨️ 快捷键说明

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