summaryrefslogtreecommitdiff
path: root/hw/xscreen/xs-screen.c
blob: 0f690691ee7f2069ef9eb439b62ee299836c72a6 (plain)
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
#ifdef HAVE_XSCREEN_CONFIG_H
#include <xs-config.h>
#endif

#include <stdlib.h>

/* need to include Xmd before XCB stuff, or
 * things get redeclared.*/
#include <X11/Xmd.h>
#include <X11/XCB/xcb.h>
#include <X11/XCB/xcb_aux.h>
#include <X11/XCB/xproto.h>
#include <X11/XCB/shape.h>
#include "scrnintstr.h"
#include "dix.h"
#include "mi.h"
#include "mibstore.h"
#include "micmap.h"
#include "colormapst.h"
#include "resource.h"

#include "mi.h"

#include "xs-globals.h"
#include "xs-gc.h"
#include "xs-font.h"
#include "xs-gcops.h"
#include "xs-screen.h"
#include "xs-window.h"
#include "xs-pixmap.h"
#include "xs-color.h"


/*sets up screensaver*/
static Bool xsSaveScreen(ScreenPtr pScreen, int action)
{
    /* It makes absolutely no sense to support a screensaver
     * in a rootless nested X server, so I'm just returning FALSE
     * here. Hopefully this is correct.*/
    return FALSE;
}

/**
 * Initialize the function pointers in pScreen.
 * Just grouped together here for readability.
 **/
static void xsScreenSetProcs(ScreenPtr pScreen)
{
    /* Random screen procedures */
    pScreen->QueryBestSize = xsQueryBestSize;
    pScreen->SaveScreen = xsSaveScreen;
    pScreen->GetImage = xsGetImage;
    pScreen->GetSpans = xsGetSpans;
    pScreen->PointerNonInterestBox = NULL;
    pScreen->SourceValidate = NULL;

    /* Window Procedures */
    pScreen->CreateWindow = xsCreateWindow;
    pScreen->DestroyWindow = xsDestroyWindow;
    pScreen->PositionWindow = xsPositionWindow;
    pScreen->ChangeWindowAttributes = xsChangeWindowAttributes;
    pScreen->RealizeWindow = xsRealizeWindow;
    pScreen->UnrealizeWindow = xsUnrealizeWindow;
    pScreen->PostValidateTree = NULL;
    //pScreen->WindowExposures = xsWindowExposures;
    pScreen->PaintWindowBackground = xsPaintWindowBackground;
    pScreen->PaintWindowBorder = xsPaintWindowBorder;
    pScreen->CopyWindow = xsCopyWindow;
    pScreen->ClipNotify = xsClipNotify;
    
    /* Pixmap procedures */
    pScreen->CreatePixmap = xsCreatePixmap;
    pScreen->DestroyPixmap = xsDestroyPixmap;

    /* Backing store procedures */
    pScreen->SaveDoomedAreas = NULL;
    pScreen->RestoreAreas = NULL;
    pScreen->ExposeCopy = NULL;
    pScreen->TranslateBackingStore = NULL;
    pScreen->ClearBackingStore = NULL;
    pScreen->DrawGuarantee = NULL;

    /* Font procedures */
    pScreen->RealizeFont = xsRealizeFont;
    pScreen->UnrealizeFont = xsUnrealizeFont;

    /* GC procedures */
    pScreen->CreateGC = xsCreateGC;

    /* Colormap procedures */
    pScreen->CreateColormap = xsCreateColormap;
    pScreen->DestroyColormap = xsDestroyColormap;
    pScreen->InstallColormap = xsInstallColormap;
    pScreen->UninstallColormap = xsUninstallColormap;
    pScreen->ListInstalledColormaps = (ListInstalledColormapsProcPtr) xsListInstalledColormaps;
    pScreen->StoreColors = (StoreColorsProcPtr) xsStoreColors;
    pScreen->ResolveColor = xsResolveColor;

    pScreen->BitmapToRegion = xsPixmapToRegion;

    /* OS layer procedures */
    pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
    pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
    pScreen->blockData = NULL;
    pScreen->wakeupData = NULL;

    #ifdef SHAPE
    /* overwrite miSetShape with our own */
    pScreen->SetShape = xsSetShape;
    #endif /* SHAPE */
}

Bool xsOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
{
    xsScreenSetProcs(pScreen);
    xsAllocPrivateIndecies(pScreen);

    return TRUE;
}