summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/hide-cursor-and-ppm-root.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/hide-cursor-and-ppm-root.patch')
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/hide-cursor-and-ppm-root.patch312
1 files changed, 0 insertions, 312 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/hide-cursor-and-ppm-root.patch b/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/hide-cursor-and-ppm-root.patch
deleted file mode 100644
index b946bb5475..0000000000
--- a/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/hide-cursor-and-ppm-root.patch
+++ /dev/null
@@ -1,312 +0,0 @@
1Upstream-Status: Pending
2
3Signed-off-by: Yu Ke <ke.yu@intel.com>
4
5Index: xorg-server-1.7.99.2/dix/window.c
6===================================================================
7--- xorg-server-1.7.99.2.orig/dix/window.c 2009-11-04 16:25:50.000000000 +0000
8+++ xorg-server-1.7.99.2/dix/window.c 2010-02-10 17:42:22.719078216 +0000
9@@ -179,6 +179,8 @@
10
11 #define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
12
13+char* RootPPM = NULL;
14+
15 #ifdef DEBUG
16 /******
17 * PrintWindowTree
18@@ -304,6 +306,115 @@
19 #endif
20 }
21
22+static int
23+get_int(FILE *fp)
24+{
25+ int c = 0;
26+
27+ while ((c = getc(fp)) != EOF)
28+ {
29+ if (isspace(c))
30+ continue;
31+
32+ if (c == '#')
33+ while (c = getc(fp))
34+ if (c == EOF)
35+ return 0;
36+ else if (c == '\n')
37+ break;
38+
39+ if (isdigit(c))
40+ {
41+ int val = c - '0';
42+ while ((c = getc(fp)) && isdigit(c))
43+ val = (val * 10) + (c - '0');
44+ return val;
45+ }
46+ }
47+
48+ return 0;
49+}
50+
51+static unsigned char*
52+ppm_load (const char* path, int depth, int *width, int *height)
53+{
54+ FILE *fp;
55+ int max, n = 0, w, h, i, j, bytes_per_line;
56+ unsigned char *data, *res, h1, h2;
57+
58+ if (depth < 16 || depth > 32)
59+ return NULL;
60+
61+ if (depth > 16)
62+ depth = 32;
63+
64+ fp = fopen (path, "r");
65+ if (fp == NULL)
66+ return FALSE;
67+
68+ h1 = getc(fp);
69+ h2 = getc(fp);
70+
71+ /* magic is 'P6' for raw ppm */
72+ if (h1 != 'P' && h2 != '6')
73+ goto fail;
74+
75+ w = get_int(fp);
76+ h = get_int(fp);
77+
78+ if (w == 0 || h == 0)
79+ goto fail;
80+
81+ max = get_int(fp);
82+
83+ if (max != 255)
84+ goto fail;
85+
86+ bytes_per_line = ((w * depth + 31) >> 5) << 2;
87+
88+ res = data = malloc(bytes_per_line * h);
89+
90+ for (i=0; i<h; i++)
91+ {
92+ for (j=0; j<w; j++)
93+ {
94+ unsigned char buf[3];
95+ fread(buf, 1, 3, fp);
96+
97+ switch (depth)
98+ {
99+ case 24:
100+ case 32:
101+ *data = buf[2];
102+ *(data+1) = buf[1];
103+ *(data+2) = buf[0];
104+ data += 4;
105+ break;
106+ case 16:
107+ default:
108+ *(unsigned short*)data
109+ = ((buf[0] >> 3) << 11) | ((buf[1] >> 2) << 5) | (buf[2] >> 3);
110+ data += 2;
111+ break;
112+ }
113+ }
114+ data += (bytes_per_line - (w*(depth>>3)));
115+ }
116+
117+ data = res;
118+
119+ *width = w;
120+ *height = h;
121+
122+ fclose(fp);
123+
124+ return res;
125+
126+ fail:
127+ fclose(fp);
128+ return NULL;
129+}
130+
131 static void
132 MakeRootTile(WindowPtr pWin)
133 {
134@@ -314,6 +425,36 @@
135 unsigned char *from, *to;
136 int i, j;
137
138+ if (RootPPM != NULL)
139+ {
140+ int w, h;
141+ unsigned char *data;
142+
143+ if ((data = ppm_load (RootPPM, pScreen->rootDepth, &w, &h)) != NULL)
144+ {
145+ pWin->background.pixmap
146+ = (*pScreen->CreatePixmap)(pScreen, w, h, pScreen->rootDepth, 0);
147+
148+ pWin->backgroundState = BackgroundPixmap;
149+ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
150+ if (!pWin->background.pixmap || !pGC)
151+ FatalError("could not create root tile");
152+
153+ ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
154+
155+ (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap,
156+ pGC,
157+ pScreen->rootDepth,
158+ 0, 0, w, h, 0, ZPixmap, (char *)data);
159+ FreeScratchGC(pGC);
160+
161+ free(data);
162+ return;
163+ }
164+ else
165+ ErrorF("Unable to load root window image.");
166+ }
167+
168 pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
169 pScreen->rootDepth, 0);
170
171@@ -530,6 +671,7 @@
172 }
173
174
175+
176 WindowPtr
177 RealChildHead(WindowPtr pWin)
178 {
179Index: xorg-server-1.7.99.2/hw/kdrive/src/kdrive.c
180===================================================================
181--- xorg-server-1.7.99.2.orig/hw/kdrive/src/kdrive.c 2010-02-10 17:36:36.000000000 +0000
182+++ xorg-server-1.7.99.2/hw/kdrive/src/kdrive.c 2010-02-10 17:43:07.797828099 +0000
183@@ -60,6 +60,9 @@
184 { 32, 32 }
185 };
186
187+int
188+ProcXFixesHideCursor (ClientPtr client) ;
189+
190 #define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
191
192 #define KD_DEFAULT_BUTTONS 5
193@@ -92,6 +95,9 @@
194
195 KdOsFuncs *kdOsFuncs;
196
197+extern Bool CursorInitiallyHidden; /* See Xfixes cursor.c */
198+extern char* RootPPM; /* dix/window.c */
199+
200 void
201 KdSetRootClip (ScreenPtr pScreen, BOOL enable)
202 {
203@@ -275,6 +281,7 @@
204 KdSetRootClip (pScreen, TRUE);
205 if (pScreenPriv->card->cfuncs->dpms)
206 (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
207+
208 return TRUE;
209 }
210
211@@ -553,6 +560,8 @@
212 ErrorF("-switchCmd Command to execute on vt switch\n");
213 ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n");
214 ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
215+ ErrorF("-hide-cursor Start with cursor hidden\n");
216+ ErrorF("-root-ppm [path] Specify ppm file to use as root window background.\n");
217 }
218
219 int
220@@ -616,6 +625,19 @@
221 kdSoftCursor = TRUE;
222 return 1;
223 }
224+ if (!strcmp (argv[i], "-hide-cursor"))
225+ {
226+ CursorInitiallyHidden = TRUE;
227+ return 1;
228+ }
229+ if (!strcmp (argv[i], "-root-ppm"))
230+ {
231+ if ((i+1) < argc)
232+ RootPPM = argv[i+1];
233+ else
234+ UseMsg ();
235+ return 2;
236+ }
237 if (!strcmp (argv[i], "-videoTest"))
238 {
239 kdVideoTest = TRUE;
240Index: xorg-server-1.7.99.2/xfixes/cursor.c
241===================================================================
242--- xorg-server-1.7.99.2.orig/xfixes/cursor.c 2009-12-19 01:43:53.000000000 +0000
243+++ xorg-server-1.7.99.2/xfixes/cursor.c 2010-02-10 17:45:02.089079491 +0000
244@@ -57,6 +57,7 @@
245 static RESTYPE CursorClientType;
246 static RESTYPE CursorHideCountType;
247 static RESTYPE CursorWindowType;
248+static Bool CursorGloballyHidden;
249 static CursorPtr CursorCurrent[MAXDEVICES];
250 static CursorPtr pInvisibleCursor = NULL;
251
252@@ -65,6 +66,8 @@
253
254 static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
255
256+Bool CursorInitiallyHidden = FALSE;
257+
258 #define VERIFY_CURSOR(pCursor, cursor, client, access) \
259 do { \
260 int err; \
261@@ -150,7 +153,7 @@
262 if (ConnectionInfo)
263 CursorVisible = EnableCursor;
264
265- if (cs->pCursorHideCounts != NULL || !CursorVisible) {
266+ if (cs->pCursorHideCounts != NULL || !CursorVisible || CursorGloballyHidden) {
267 ret = ((*pScreen->RealizeCursor)(pDev, pScreen, pInvisibleCursor) &&
268 (*pScreen->DisplayCursor) (pDev, pScreen, pInvisibleCursor));
269 } else {
270@@ -887,6 +890,12 @@
271 return (ret == BadValue) ? BadWindow : ret;
272 }
273
274+ /* Is cursor set to be initially hidden ?, if so reset this
275+ * flag as now visibility assumed under control of client.
276+ */
277+ if (CursorGloballyHidden)
278+ CursorGloballyHidden = FALSE;
279+
280 /*
281 * Has client hidden the cursor before on this screen?
282 * If so, just increment the count.
283@@ -950,9 +959,19 @@
284 return (rc == BadValue) ? BadWindow : rc;
285 }
286
287+ /* X was started with cursor hidden, therefore just reset our flag
288+ * (returning to normal client control) and cause cursor to now be
289+ * shown.
290+ */
291+ if (CursorGloballyHidden == TRUE)
292+ {
293+ CursorGloballyHidden = FALSE;
294+ return (client->noClientException);
295+ }
296+
297 /*
298 * Has client hidden the cursor on this screen?
299- * If not, generate an error.
300+ * If so, generate an error.
301 */
302 pChc = findCursorHideCount(client, pWin->drawable.pScreen);
303 if (pChc == NULL) {
304@@ -1068,6 +1087,8 @@
305 {
306 int i;
307
308+ CursorGloballyHidden = CursorInitiallyHidden;
309+
310 if (party_like_its_1989)
311 CursorVisible = EnableCursor;
312