~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/kdrive/ephyr/ephyrinit.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
Import upstream version 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Xephyr - A kdrive X server thats runs in a host X window.
 
3
 *          Authored by Matthew Allum <mallum@o-hand.com>
 
4
 * 
 
5
 * Copyright � 2004 Nokia 
 
6
 *
 
7
 * Permission to use, copy, modify, distribute, and sell this software and its
 
8
 * documentation for any purpose is hereby granted without fee, provided that
 
9
 * the above copyright notice appear in all copies and that both that
 
10
 * copyright notice and this permission notice appear in supporting
 
11
 * documentation, and that the name of Nokia not be used in
 
12
 * advertising or publicity pertaining to distribution of the software without
 
13
 * specific, written prior permission. Nokia makes no
 
14
 * representations about the suitability of this software for any purpose.  It
 
15
 * is provided "as is" without express or implied warranty.
 
16
 *
 
17
 * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
18
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
19
 * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
20
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
21
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
22
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
23
 * PERFORMANCE OF THIS SOFTWARE.
 
24
 */
 
25
 
 
26
#ifdef HAVE_CONFIG_H
 
27
#include <kdrive-config.h>
 
28
#endif
 
29
#include "ephyr.h"
 
30
 
 
31
extern Window EphyrPreExistingHostWin;
 
32
 
 
33
void
 
34
InitCard (char *name)
 
35
{
 
36
    KdCardAttr  attr;
 
37
 
 
38
    EPHYR_DBG("mark");
 
39
 
 
40
 
 
41
    KdCardInfoAdd (&ephyrFuncs, &attr, 0);
 
42
}
 
43
 
 
44
void
 
45
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
 
46
{
 
47
  KdInitOutput (pScreenInfo, argc, argv);
 
48
}
 
49
 
 
50
void
 
51
InitInput (int argc, char **argv)
 
52
{
 
53
  KdInitInput (&EphyrMouseFuncs, &EphyrKeyboardFuncs);
 
54
}
 
55
 
 
56
void
 
57
ddxUseMsg (void)
 
58
{
 
59
  KdUseMsg();
 
60
 
 
61
  ErrorF("\nXephyr Option Usage:\n");
 
62
  ErrorF("-parent XID   Use existing window as Xephyr root win\n");
 
63
  ErrorF("-host-cursor  Re-use exisiting X host server cursor\n");
 
64
  ErrorF("-fullscreen   Attempt to run Xephyr fullscreen\n");
 
65
  ErrorF("\n");
 
66
 
 
67
  exit(1);
 
68
}
 
69
 
 
70
int
 
71
ddxProcessArgument (int argc, char **argv, int i)
 
72
{
 
73
  EPHYR_DBG("mark");
 
74
 
 
75
  if (!strcmp (argv[i], "-parent"))
 
76
    {
 
77
      if(i+1 < argc) 
 
78
        {
 
79
          hostx_use_preexisting_window(strtol(argv[i+1], NULL, 0));
 
80
          return 2;
 
81
        } 
 
82
      
 
83
      UseMsg();
 
84
      exit(1);
 
85
    }
 
86
  else if (!strcmp (argv[i], "-host-cursor"))
 
87
    {
 
88
      hostx_use_host_cursor();
 
89
      return 1;
 
90
    }
 
91
  else if (!strcmp (argv[i], "-fullscreen"))
 
92
    {
 
93
      hostx_use_fullscreen();
 
94
      return 1;
 
95
    }
 
96
  else if (argv[i][0] == ':')
 
97
    {
 
98
      hostx_set_display_name(argv[i]);
 
99
    }
 
100
 
 
101
  return KdProcessArgument (argc, argv, i);
 
102
}
 
103
 
 
104
void
 
105
OsVendorInit (void)
 
106
{
 
107
  EPHYR_DBG("mark");
 
108
 
 
109
  if (hostx_want_host_cursor())
 
110
    {
 
111
      ephyrFuncs.initCursor   = &ephyrCursorInit;
 
112
      ephyrFuncs.enableCursor = &ephyrCursorEnable;
 
113
    }
 
114
 
 
115
  KdOsInit (&EphyrOsFuncs);
 
116
}
 
117
 
 
118
/* 'Fake' cursor stuff, could be improved */
 
119
 
 
120
static Bool
 
121
ephyrRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
 
122
{
 
123
  return TRUE;
 
124
}
 
125
 
 
126
static Bool
 
127
ephyrUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
 
128
{
 
129
  return TRUE;
 
130
}
 
131
 
 
132
static void
 
133
ephyrSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
 
134
{
 
135
  ;
 
136
}
 
137
 
 
138
static void
 
139
ephyrMoveCursor(ScreenPtr pScreen, int x, int y)
 
140
{
 
141
  ;
 
142
}
 
143
 
 
144
miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
 
145
        ephyrRealizeCursor,
 
146
        ephyrUnrealizeCursor,
 
147
        ephyrSetCursor,
 
148
        ephyrMoveCursor,
 
149
};
 
150
 
 
151
 
 
152
Bool
 
153
ephyrCursorInit(ScreenPtr pScreen)
 
154
{
 
155
  miPointerInitialize(pScreen, &EphyrPointerSpriteFuncs,
 
156
                      &kdPointerScreenFuncs, FALSE);
 
157
 
 
158
  return TRUE;
 
159
}
 
160
 
 
161
void
 
162
ephyrCursorEnable(ScreenPtr pScreen)
 
163
{
 
164
  ;
 
165
}
 
166
 
 
167
KdCardFuncs ephyrFuncs = {
 
168
    ephyrCardInit,          /* cardinit */
 
169
    ephyrScreenInit,        /* scrinit */
 
170
    ephyrInitScreen,        /* initScreen */
 
171
    ephyrFinishInitScreen,  /* finishInitScreen */
 
172
    ephyrCreateResources,   /* createRes */
 
173
    ephyrPreserve,          /* preserve */
 
174
    ephyrEnable,            /* enable */
 
175
    ephyrDPMS,              /* dpms */
 
176
    ephyrDisable,           /* disable */
 
177
    ephyrRestore,           /* restore */
 
178
    ephyrScreenFini,        /* scrfini */
 
179
    ephyrCardFini,          /* cardfini */
 
180
    
 
181
    0,                      /* initCursor */
 
182
    0,                      /* enableCursor */
 
183
    0,                      /* disableCursor */
 
184
    0,                      /* finiCursor */
 
185
    0,                      /* recolorCursor */
 
186
    
 
187
    0,                      /* initAccel */
 
188
    0,                      /* enableAccel */
 
189
    0,                      /* disableAccel */
 
190
    0,                      /* finiAccel */
 
191
    
 
192
    ephyrGetColors,         /* getColors */
 
193
    ephyrPutColors,         /* putColors */
 
194
};