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