1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*
* External interface to generic rootless mode
*
* Greg Parker gparker@cs.stanford.edu March 3, 2001
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/rootless.h,v 1.3 2001/08/01 05:34:06 torrey Exp $ */
#ifndef _ROOTLESS_H
#define _ROOTLESS_H
#include "mi.h"
#include "gcstruct.h"
// RootlessFrameRec
// Describes a single rootless window (aka frame).
// The rootless mode keeps track of window position, and the
// rootless implementation is responsible for the pixmap.
// Multiple screens: all coordinates are SCREEN-LOCAL, not global.
typedef struct RootlessFrameRec {
/* Data maintained by rootless mode */
/* position and size, including window border, in screen coordinates */
int x;
int y;
unsigned int w;
unsigned int h;
WindowPtr win; /* the top-level window drawn in this frame */
int isRoot; /* TRUE if this is the root window */
/* Data maintained by rootless implementation */
char *pixelData;
int depth; // color bits per pixel; depth <= bitsPerPixel
int bitsPerPixel;
int bytesPerRow;
void *devPrivate; /* for caller's use */
} RootlessFrameRec, *RootlessFramePtr;
// Create a new frame.
// pUpper is the window above the new frame, or NULL if the new
// frame will be on top.
// pFrame is completely initialized. devPrivate is NULL
// The pixmap must be valid when this is done.
typedef void (*RootlessCreateFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame, RootlessFramePtr pUpper);
// Destroy a frame. Caller must free any private data and the pixmap.
// All drawing is stopped and all updates are flushed before this is called.
typedef void (*RootlessDestroyFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame);
// Move a frame on screen.
// The frame changes position and nothing else.
// pFrame and pFrame->win already contain the information about the
// new position. oldX and oldY are the old position.
// All updates are flushed before this is called.
// The pixmap may change during this function.
typedef void (*RootlessMoveFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame, int oldX, int oldY);
// Change frame ordering (aka stacking, layering)
// pFrame->win already has its new siblings.
// pOldNext is the window that was below this one, or NULL if this was
// at the bottom.
// pNewNext is the window that is now below this one, or NULL if this is
// now at the bottom.
typedef void (*RootlessRestackFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame,
RootlessFramePtr pOldNext, RootlessFramePtr pNewNext);
// Flush drawing updates to the screen.
// pDamage contains all changed pixels.
// pDamage is in frame-local coordinates.
// pDamage is clipped to the frame bounds and the frame shape.
typedef void (*RootlessUpdateRegionProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame, RegionPtr pDamage);
// Change the frame's shape.
// pNewShape is in frame-local coordinates.
// Everything outside pNewShape is no longer part of the frame.
// pNewShape is {0, 0, width, height} for a plain-shaped frame.
// fixme can the pixmap change here?
// fixme reimplement shape
typedef void (*RootlessReshapeFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame, RegionPtr pNewShape);
// Frame is about to resize.
// The frame has its new position and size already.
// postconditions:
// The pixmap MUST point to a pixmap with the new size.
// The pixmap data is undefined.
// The old pixmap may be destroyed here.
typedef void (*RootlessStartResizeFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame,
int oldX, int oldY, unsigned int oldW, unsigned int oldH);
// Frame is done resizing.
// Destroy the old pixmap if you haven't already.
typedef void (*RootlessFinishResizeFrameProc)
(ScreenPtr pScreen, RootlessFramePtr pFrame,
int oldX, int oldY, unsigned int oldW, unsigned int oldH);
// The callback function list.
// Any of these may be NULL.
typedef struct RootlessFrameProcs {
RootlessCreateFrameProc CreateFrame;
RootlessDestroyFrameProc DestroyFrame;
RootlessMoveFrameProc MoveFrame;
RootlessStartResizeFrameProc StartResizeFrame;
RootlessFinishResizeFrameProc FinishResizeFrame;
RootlessRestackFrameProc RestackFrame;
RootlessReshapeFrameProc ReshapeFrame;
RootlessUpdateRegionProc UpdateRegion;
// RootlessStartDrawingProc StartDrawing;
// RootlessStopDrawingProc StopDrawing;
} RootlessFrameProcs;
// Initialize rootless mode on the given screen.
Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcs *procs);
#endif /* _ROOTLESS_H */
|