Functions

# dmxwindow.c File Reference

`#include "dmx.h"`
`#include "dmxsync.h"`
`#include "dmxwindow.h"`
`#include "dmxpixmap.h"`
`#include "dmxcmap.h"`
`#include "dmxvisual.h"`
`#include "dmxinput.h"`
`#include "dmxextension.h"`
`#include "dmxpict.h"`
`#include "windowstr.h"`

## Functions
static void | dmxDoRestackWindow (WindowPtr pWindow)
static void | dmxDoChangeWindowAttributes (WindowPtr pWindow, unsigned long *mask, XSetWindowAttributes *attribs)
static void | dmxDoSetShape (WindowPtr pWindow)
Bool | dmxInitWindow (ScreenPtr pScreen)
Window | dmxCreateRootWindow (WindowPtr pWindow)
void | dmxResizeScreenWindow (ScreenPtr pScreen, int x, int y, int w, int h)
void | dmxResizeRootWindow (WindowPtr pRoot, int x, int y, int w, int h)
void | dmxGetDefaultWindowAttributes (WindowPtr pWindow, Colormap *cmap, Visual **visual)
static Window | dmxCreateNonRootWindow (WindowPtr pWindow)
void | dmxCreateAndRealizeWindow (WindowPtr pWindow, Bool doSync)
Bool | dmxCreateWindow (WindowPtr pWindow)
Bool | dmxBEDestroyWindow (WindowPtr pWindow)
Bool | dmxDestroyWindow (WindowPtr pWindow)
Bool | dmxPositionWindow (WindowPtr pWindow, int x, int y)
Bool | dmxChangeWindowAttributes (WindowPtr pWindow, unsigned long mask)
Bool | dmxRealizeWindow (WindowPtr pWindow)
Bool | dmxUnrealizeWindow (WindowPtr pWindow)
void | dmxRestackWindow (WindowPtr pWindow, WindowPtr pOldNextSib)
static Bool | dmxWindowExposurePredicate (Display *dpy, XEvent *ev, XPointer ptr)
void | dmxWindowExposures (WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)
void | dmxCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
void | dmxResizeWindow (WindowPtr pWindow, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib)
void | dmxReparentWindow (WindowPtr pWindow, WindowPtr pPriorParent)
void | dmxChangeBorderWidth (WindowPtr pWindow, unsigned int width)
void | dmxSetShape (WindowPtr pWindow, int kind)

## Detailed Description

This file provides support for window-related functions.

## Function Documentation

Bool dmxBEDestroyWindow | ( | WindowPtr | pWindow | ) |

Destroy pWindow on the back-end server.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, dmxScreens, and _dmxWinPriv::window.

Referenced by dmxBEDestroyWindowTree(), and dmxDestroyWindow().

void dmxChangeBorderWidth | ( | WindowPtr | pWindow,
|  | unsigned int | width |
| ) |  |  |

Change border width for pWindow to width pixels.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WRAP, dmxChangeBorderWidth(), dmxScreens, dmxSync(), and _dmxWinPriv::window.

Referenced by dmxChangeBorderWidth(), and dmxScreenInit().

Bool dmxChangeWindowAttributes | ( | WindowPtr | pWindow,
|  | unsigned long | mask |
| ) |  |  |

Change the window attributes of pWindow.

References _dmxWinPriv::attribMask, _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WRAP, dmxChangeWindowAttributes(), dmxDoChangeWindowAttributes(), dmxScreens, dmxSync(), and _dmxWinPriv::window.

Referenced by dmxChangeWindowAttributes(), and dmxScreenInit().

void dmxCopyWindow | ( | WindowPtr | pWindow,
|  | DDXPointRec | ptOldOrg,
|  | RegionPtr | prgnSrc |
| ) |  |  |

Move pWindow on the back-end server. Determine whether or not it is on or offscreen, and realize it if it is newly on screen and the lazy window creation optimization is enabled.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_UPDATE_COPY, DMX_WINDOW_OFFSCREEN, DMX_WRAP, dmxCopyWindow(), dmxCreateAndRealizeWindow(), dmxScreens, dmxSync(), dmxUpdateWindowInfo(), _dmxWinPriv::mapped, _dmxWinPriv::offscreen, and _dmxWinPriv::window.

Referenced by dmxCopyWindow(), and dmxScreenInit().

void dmxCreateAndRealizeWindow | ( | WindowPtr | pWindow,
|  | Bool | doSync |
| ) |  |  |

This function handles lazy window creation and realization. Window creation is handled by dmxCreateNonRootWindow(). It also handles any stacking changes that have occured since the window was originally created by calling dmxDoRestackWindow(). If the window is shaped, the shape is set on the back-end server by calling dmxDoSetShape(), and if the window has pictures (from RENDER) associated with it, those pictures are created on the back-end server by calling dmxCreatePictureList(). If doSync is TRUE, then dmxSync() is called.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, dmxCreateNonRootWindow(), dmxCreatePictureList(), dmxDoRestackWindow(), dmxDoSetShape(), dmxScreens, dmxSync(), _dmxWinPriv::hasPict, _dmxWinPriv::isShaped, _dmxWinPriv::mapped, _dmxWinPriv::restacked, and _dmxWinPriv::window.

Referenced by dmxBECreateWindowTree(), dmxCopyWindow(), dmxCreateNonRootWindow(), dmxForceWindowCreation(), dmxPositionWindow(), dmxRealizeWindow(), dmxReparentWindow(), and dmxResizeWindow().

static Window dmxCreateNonRootWindow | ( | WindowPtr | pWindow | ) | `[static]`

References _dmxWinPriv::attribMask, _DMXScreenInfo::beDisplay, _dmxWinPriv::cmap, DMX_GET_WINDOW_PRIV, dmxCreateAndRealizeWindow(), dmxDoChangeWindowAttributes(), dmxScreens, _dmxWinPriv::restacked, _dmxWinPriv::visual, and _dmxWinPriv::window.

Referenced by dmxCreateAndRealizeWindow(), and dmxCreateWindow().

Window dmxCreateRootWindow | ( | WindowPtr | pWindow | ) |

References _dmxWinPriv::attribMask, _DMXScreenInfo::beDefVisualIndex, _DMXScreenInfo::beDisplay, _DMXScreenInfo::beVisuals, _dmxColormapPriv::cmap, DMX_GET_COLORMAP_PRIV, DMX_GET_WINDOW_PRIV, dmxDoChangeWindowAttributes(), dmxScreens, and _DMXScreenInfo::scrnWin.

Referenced by dmxBECreateWindowTree(), and dmxCreateWindow().

Bool dmxCreateWindow | ( | WindowPtr | pWindow | ) |

Create pWindow on the back-end server. If the lazy window creation optimization is enabled, then the actual creation and realization of the window is handled by dmxCreateAndRealizeWindow().

References _dmxWinPriv::attribMask, _DMXScreenInfo::beDisplay, _dmxWinPriv::cmap, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WRAP, dmxCreateNonRootWindow(), dmxCreateRootWindow(), dmxCreateWindow(), dmxGetDefaultWindowAttributes(), dmxLazyWindowCreation, dmxLookupVisualFromID(), dmxResizeRootWindow(), dmxScreens, dmxSync(), dmxUpdateScreenResources(), _dmxWinPriv::hasPict, _DMXScreenInfo::index, _dmxWinPriv::isShaped, _dmxWinPriv::mapped, _dmxWinPriv::offscreen, _dmxWinPriv::restacked, _DMXScreenInfo::rootHeight, _DMXScreenInfo::rootWidth, _DMXScreenInfo::rootWin, _DMXScreenInfo::rootX, _DMXScreenInfo::rootY, _DMXScreenInfo::scrnHeight, _DMXScreenInfo::scrnWidth, _DMXScreenInfo::scrnX, _DMXScreenInfo::scrnY, _dmxWinPriv::visual, and _dmxWinPriv::window.

Referenced by dmxCreateWindow(), and dmxScreenInit().

Bool dmxDestroyWindow | ( | WindowPtr | pWindow | ) |

Destroy pWindow on the back-end server. If any RENDER pictures were created, destroy them as well.

References DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WRAP, dmxBEDestroyWindow(), dmxDestroyPictureList(), dmxDestroyWindow(), dmxScreens, and dmxSync().

Referenced by dmxDestroyWindow(), and dmxScreenInit().

static void dmxDoChangeWindowAttributes | ( | WindowPtr | pWindow,
|  | unsigned long * | mask,
|  | XSetWindowAttributes * | attribs |
| ) |  |  | `[static]`

References _dmxColormapPriv::cmap, DMX_GET_COLORMAP_PRIV, DMX_GET_PIXMAP_PRIV, and _dmxPixPriv::pixmap.

Referenced by dmxChangeWindowAttributes(), dmxCreateNonRootWindow(), and dmxCreateRootWindow().

static void dmxDoRestackWindow | ( | WindowPtr | pWindow | ) | `[static]`

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, dmxScreens, and _dmxWinPriv::window.

Referenced by dmxCreateAndRealizeWindow(), and dmxRestackWindow().

static void dmxDoSetShape | ( | WindowPtr | pWindow | ) | `[static]`

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, dmxScreens, and _dmxWinPriv::window.

Referenced by dmxCreateAndRealizeWindow(), and dmxSetShape().

void dmxGetDefaultWindowAttributes | ( | WindowPtr | pWindow,
|  | Colormap * | cmap,
|  | Visual ** | visual |
| ) |  |  |

References _dmxColormapPriv::cmap, DMX_GET_COLORMAP_PRIV, dmxColormapFromDefaultVisual(), and dmxLookupVisualFromID().

Referenced by dmxBECreateWindowTree(), and dmxCreateWindow().

Bool dmxInitWindow | ( | ScreenPtr | pScreen | ) |

Initialize the private area for the window functions.

References dmxWinPrivateKeyRec.

Referenced by dmxScreenInit().

Bool dmxPositionWindow | ( | WindowPtr | pWindow,
|  | int | x,
|  | int | y |
| ) |  |  |

Change the position of pWindow to be x, y.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WINDOW_OFFSCREEN, DMX_WRAP, dmxCreateAndRealizeWindow(), dmxPositionWindow(), dmxScreens, dmxSync(), _dmxWinPriv::mapped, _dmxWinPriv::offscreen, and _dmxWinPriv::window.

Referenced by dmxPositionWindow(), and dmxScreenInit().

Bool dmxRealizeWindow | ( | WindowPtr | pWindow | ) |

Realize pWindow on the back-end server. If the lazy window creation optimization is enabled, the window is only realized when it at least partially overlaps the screen.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_UPDATE_REALIZE, DMX_WINDOW_OFFSCREEN, DMX_WRAP, dmxCreateAndRealizeWindow(), dmxRealizeWindow(), dmxScreens, dmxSync(), dmxUpdateWindowInfo(), _dmxWinPriv::mapped, _dmxWinPriv::offscreen, and _dmxWinPriv::window.

Referenced by dmxRealizeWindow(), and dmxScreenInit().

void dmxReparentWindow | ( | WindowPtr | pWindow,
|  | WindowPtr | pPriorParent |
| ) |  |  |

Reparent pWindow on the back-end server.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_UPDATE_REPARENT, DMX_WRAP, dmxCreateAndRealizeWindow(), dmxReparentWindow(), dmxScreens, dmxSync(), dmxUpdateWindowInfo(), and _dmxWinPriv::window.

Referenced by dmxReparentWindow(), and dmxScreenInit().

void dmxResizeRootWindow | ( | WindowPtr | pRoot,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h |
| ) |  |  |

Change the location and size of the "root" window. Called from dmxConfigureRootWindow.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, dmxScreens, dmxSync(), _dmxWinPriv::mapped, and _dmxWinPriv::window.

Referenced by dmxCreateWindow().

void dmxResizeScreenWindow | ( | ScreenPtr | pScreen,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h |
| ) |  |  |

Change the location and size of the "screen" window. Called from dmxConfigureScreenWindow().

References _DMXScreenInfo::beDisplay, dmxScreens, dmxSync(), and _DMXScreenInfo::scrnWin.

void dmxResizeWindow | ( | WindowPtr | pWindow,
|  | int | x,
|  | int | y,
|  | unsigned int | w,
|  | unsigned int | h,
|  | WindowPtr | pSib |
| ) |  |  |

Resize pWindow on the back-end server. Determine whether or not it is on or offscreen, and realize it if it is newly on screen and the lazy window creation optimization is enabled.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_UPDATE_RESIZE, DMX_WINDOW_OFFSCREEN, DMX_WRAP, dmxCreateAndRealizeWindow(), dmxResizeWindow(), dmxScreens, dmxSync(), dmxUpdateWindowInfo(), _dmxWinPriv::mapped, _dmxWinPriv::offscreen, and _dmxWinPriv::window.

Referenced by dmxResizeWindow(), and dmxScreenInit().

void dmxRestackWindow | ( | WindowPtr | pWindow,
|  | WindowPtr | pOldNextSib |
| ) |  |  |

Handle window restacking. The actual restacking occurs in dmxDoRestackWindow().

References DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_UPDATE_RESTACK, DMX_WRAP, dmxDoRestackWindow(), dmxRestackWindow(), dmxScreens, dmxSync(), dmxUpdateWindowInfo(), _dmxWinPriv::restacked, and _dmxWinPriv::window.

Referenced by dmxRestackWindow(), and dmxScreenInit().

void dmxSetShape | ( | WindowPtr | pWindow,
|  | int | kind |
| ) |  |  |

Set shape of pWindow on the back-end server.

References DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WRAP, dmxDoSetShape(), dmxScreens, dmxSetShape(), dmxSync(), _dmxWinPriv::isShaped, and _dmxWinPriv::window.

Referenced by dmxScreenInit(), and dmxSetShape().

Bool dmxUnrealizeWindow | ( | WindowPtr | pWindow | ) |

Unrealize pWindow on the back-end server.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_UPDATE_UNREALIZE, DMX_WRAP, dmxScreens, dmxSync(), dmxUnrealizeWindow(), dmxUpdateWindowInfo(), _dmxWinPriv::mapped, _dmxWinPriv::offscreen, and _dmxWinPriv::window.

Referenced by dmxScreenInit(), and dmxUnrealizeWindow().

static Bool dmxWindowExposurePredicate | ( | Display * | dpy,
|  | XEvent * | ev,
|  | XPointer | ptr |
| ) |  |  | `[static]`

Referenced by dmxWindowExposures().

void dmxWindowExposures | ( | WindowPtr | pWindow,
|  | RegionPtr | prgn,
|  | RegionPtr | other_exposed |
| ) |  |  |

Handle exposures on pWindow. Since window exposures are handled in DMX, the events that are generated by the back-end server are redundant, so we eat them here.

References _DMXScreenInfo::beDisplay, DMX_GET_WINDOW_PRIV, DMX_UNWRAP, DMX_WRAP, dmxScreens, dmxSync(), dmxWindowExposurePredicate(), dmxWindowExposures(), and _dmxWinPriv::window.

Referenced by dmxScreenInit(), and dmxWindowExposures().