File: rootless.h

package info (click to toggle)
vnc4 4.1.1%2BX4.3.0-31
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 171,548 kB
  • ctags: 288,231
  • sloc: ansic: 2,205,256; cpp: 56,016; sh: 38,092; pascal: 13,773; asm: 12,656; tcl: 9,182; lisp: 7,831; perl: 3,338; makefile: 2,957; yacc: 2,902; objc: 2,698; xml: 2,614; python: 2,383; lex: 1,477; awk: 901; csh: 58; sed: 50
file content (136 lines) | stat: -rw-r--r-- 4,958 bytes parent folder | download | duplicates (6)
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
128
129
130
131
132
133
134
135
136
/*
 * External interface to generic rootless mode
 *
 * Greg Parker     gparker@cs.stanford.edu     March 3, 2001
 */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/rootless.h,v 1.2 2002/08/28 06:41:26 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);

// 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.
typedef void (*RootlessReshapeFrameProc)
    (ScreenPtr pScreen, RootlessFramePtr pFrame, RegionPtr pNewShape);

// 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);

// Prepare a window for direct access to its backing buffer.
typedef void (*RootlessStartDrawingProc)
    (ScreenPtr pScreen, RootlessFramePtr pFrame);

// Stop access to a window's backing buffer.
typedef void (*RootlessStopDrawingProc)
    (ScreenPtr pScreen, RootlessFramePtr pFrame);

// 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);

// Return the rootless frame for the given window or NULL if it's not framed
RootlessFramePtr RootlessFrameForWindow(WindowPtr pWin);

#endif /* _ROOTLESS_H */