summaryrefslogtreecommitdiffstats
path: root/meta/packages/xorg-xserver
diff options
context:
space:
mode:
authorMatthew Allum <mallum@openedhand.com>2007-01-22 16:31:21 +0000
committerMatthew Allum <mallum@openedhand.com>2007-01-22 16:31:21 +0000
commitd212d585e4ac7bd67ca47b935f221de922560704 (patch)
tree317822b507f6b721b8deeb63c64f37a728cbb7e3 /meta/packages/xorg-xserver
parentfe3e623c96494cc029acf54e0447f6784467425d (diff)
downloadpoky-d212d585e4ac7bd67ca47b935f221de922560704.tar.gz
Add hide cursor and root ppm patch
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1191 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/xorg-xserver')
-rw-r--r--meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch307
-rw-r--r--meta/packages/xorg-xserver/xserver-kdrive_X11R7.1-1.1.0.bb5
2 files changed, 310 insertions, 2 deletions
diff --git a/meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch b/meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch
new file mode 100644
index 0000000000..c160cd41dc
--- /dev/null
+++ b/meta/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch
@@ -0,0 +1,307 @@
1diff -u -r xorg-server-X11R7.1-1.1.0.orig/dix/window.c xorg-server-X11R7.1-1.1.0/dix/window.c
2--- xorg-server-X11R7.1-1.1.0.orig/dix/window.c 2007-01-08 14:30:38.000000000 +0000
3+++ xorg-server-X11R7.1-1.1.0/dix/window.c 2007-01-16 17:16:19.000000000 +0000
4@@ -185,6 +185,8 @@
5 _X_EXPORT int numSaveUndersViewable = 0;
6 _X_EXPORT int deltaSaveUndersViewable = 0;
7
8+char* RootPPM = NULL;
9+
10 #ifdef DEBUG
11 /******
12 * PrintWindowTree
13@@ -311,6 +313,115 @@
14 #endif
15 }
16
17+static int
18+get_int(FILE *fp)
19+{
20+ int c = 0;
21+
22+ while ((c = getc(fp)) != EOF)
23+ {
24+ if (isspace(c))
25+ continue;
26+
27+ if (c == '#')
28+ while (c = getc(fp))
29+ if (c == EOF)
30+ return 0;
31+ else if (c == '\n')
32+ break;
33+
34+ if (isdigit(c))
35+ {
36+ int val = c - '0';
37+ while ((c = getc(fp)) && isdigit(c))
38+ val = (val * 10) + (c - '0');
39+ return val;
40+ }
41+ }
42+
43+ return 0;
44+}
45+
46+static unsigned char*
47+ppm_load (const char* path, int depth, int *width, int *height)
48+{
49+ FILE *fp;
50+ int max, n = 0, w, h, i, j, bytes_per_line;
51+ unsigned char *data, *res, h1, h2;
52+
53+ if (depth < 16 || depth > 32)
54+ return NULL;
55+
56+ if (depth > 16)
57+ depth = 32;
58+
59+ fp = fopen (path, "r");
60+ if (fp == NULL)
61+ return FALSE;
62+
63+ h1 = getc(fp);
64+ h2 = getc(fp);
65+
66+ /* magic is 'P6' for raw ppm */
67+ if (h1 != 'P' && h2 != '6')
68+ goto fail;
69+
70+ w = get_int(fp);
71+ h = get_int(fp);
72+
73+ if (w == 0 || h == 0)
74+ goto fail;
75+
76+ max = get_int(fp);
77+
78+ if (max != 255)
79+ goto fail;
80+
81+ bytes_per_line = ((w * depth + 31) >> 5) << 2;
82+
83+ res = data = malloc(bytes_per_line * h);
84+
85+ for (i=0; i<h; i++)
86+ {
87+ for (j=0; j<w; j++)
88+ {
89+ unsigned char buf[3];
90+ fread(buf, 1, 3, fp);
91+
92+ switch (depth)
93+ {
94+ case 24:
95+ case 32:
96+ *data = buf[2];
97+ *(data+1) = buf[1];
98+ *(data+2) = buf[0];
99+ data += 4;
100+ break;
101+ case 16:
102+ default:
103+ *(unsigned short*)data
104+ = ((buf[0] >> 3) << 11) | ((buf[1] >> 2) << 5) | (buf[2] >> 3);
105+ data += 2;
106+ break;
107+ }
108+ }
109+ data += (bytes_per_line - (w*(depth>>3)));
110+ }
111+
112+ data = res;
113+
114+ *width = w;
115+ *height = h;
116+
117+ fclose(fp);
118+
119+ return res;
120+
121+ fail:
122+ fclose(fp);
123+ return NULL;
124+}
125+
126 static void
127 MakeRootTile(WindowPtr pWin)
128 {
129@@ -321,6 +432,36 @@
130 register unsigned char *from, *to;
131 register int i, j;
132
133+ if (RootPPM != NULL)
134+ {
135+ int w, h;
136+ unsigned char *data;
137+
138+ if ((data = ppm_load (RootPPM, pScreen->rootDepth, &w, &h)) != NULL)
139+ {
140+ pWin->background.pixmap
141+ = (*pScreen->CreatePixmap)(pScreen, w, h, pScreen->rootDepth);
142+
143+ pWin->backgroundState = BackgroundPixmap;
144+ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
145+ if (!pWin->background.pixmap || !pGC)
146+ FatalError("could not create root tile");
147+
148+ ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
149+
150+ (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap,
151+ pGC,
152+ pScreen->rootDepth,
153+ 0, 0, w, h, 0, ZPixmap, (char *)data);
154+ FreeScratchGC(pGC);
155+
156+ free(data);
157+ return;
158+ }
159+ else
160+ ErrorF("Unable to load root window image.");
161+ }
162+
163 pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
164 pScreen->rootDepth);
165
166@@ -357,6 +498,7 @@
167
168 }
169
170+
171 WindowPtr
172 AllocateWindow(ScreenPtr pScreen)
173 {
174diff -u -r xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/src/kdrive.c xorg-server-X11R7.1-1.1.0/hw/kdrive/src/kdrive.c
175--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/src/kdrive.c 2007-01-08 14:30:38.000000000 +0000
176+++ xorg-server-X11R7.1-1.1.0/hw/kdrive/src/kdrive.c 2007-01-15 17:53:06.000000000 +0000
177@@ -58,6 +58,9 @@
178 { 32, 32 }
179 };
180
181+int
182+ProcXFixesHideCursor (ClientPtr client) ;
183+
184 #define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
185
186 int kdScreenPrivateIndex;
187@@ -84,6 +87,9 @@
188 KdOsFuncs *kdOsFuncs;
189 extern WindowPtr *WindowTable;
190
191+extern Bool CursorInitiallyHidden; /* See Xfixes cursor.c */
192+extern char* RootPPM; /* dix/window.c */
193+
194 void
195 KdSetRootClip (ScreenPtr pScreen, BOOL enable)
196 {
197@@ -312,6 +318,7 @@
198 KdSetRootClip (pScreen, TRUE);
199 if (pScreenPriv->card->cfuncs->dpms)
200 (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
201+
202 return TRUE;
203 }
204
205@@ -686,10 +693,14 @@
206 ErrorF("-mouse path[,n] Filename of mouse device, n is number of buttons\n");
207 ErrorF("-switchCmd Command to execute on vt switch\n");
208 ErrorF("-nozap Don't terminate server on Ctrl+Alt+Backspace\n");
209+ ErrorF("-hide-cursor Start with cursor hidden\n");
210+ ErrorF("-root-ppm [path] Specify ppm file to use as root window background.\n");
211 ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
212 #ifdef PSEUDO8
213 p8UseMsg ();
214 #endif
215+
216+
217 }
218
219 int
220@@ -761,6 +772,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;
240diff -u -r xorg-server-X11R7.1-1.1.0.orig/xfixes/cursor.c xorg-server-X11R7.1-1.1.0/xfixes/cursor.c
241--- xorg-server-X11R7.1-1.1.0.orig/xfixes/cursor.c 2007-01-08 14:30:38.000000000 +0000
242+++ xorg-server-X11R7.1-1.1.0/xfixes/cursor.c 2007-01-11 16:33:00.000000000 +0000
243@@ -59,9 +59,12 @@
244 static RESTYPE CursorWindowType;
245 static int CursorScreenPrivateIndex = -1;
246 static int CursorGeneration;
247+static Bool CursorGloballyHidden;
248 static CursorPtr CursorCurrent;
249 static CursorPtr pInvisibleCursor = NULL;
250
251+Bool CursorInitiallyHidden = FALSE;
252+
253 static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
254
255 #define VERIFY_CURSOR(pCursor, cursor, client, access) { \
256@@ -130,7 +133,7 @@
257
258 Unwrap (cs, pScreen, DisplayCursor);
259
260- if (cs->pCursorHideCounts != NULL) {
261+ if (cs->pCursorHideCounts != NULL || CursorGloballyHidden) {
262 ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor);
263 } else {
264 ret = (*pScreen->DisplayCursor) (pScreen, pCursor);
265@@ -848,6 +851,12 @@
266 return BadWindow;
267 }
268
269+ /* Is cursor set to be initially hidden ?, if so reset this
270+ * flag as now visibility assumed under control of client.
271+ */
272+ if (CursorGloballyHidden)
273+ CursorGloballyHidden = FALSE;
274+
275 /*
276 * Has client hidden the cursor before on this screen?
277 * If so, just increment the count.
278@@ -899,9 +908,19 @@
279 return BadWindow;
280 }
281
282+ /* X was started with cursor hidden, therefore just reset our flag
283+ * (returning to normal client control) and cause cursor to now be
284+ * shown.
285+ */
286+ if (CursorGloballyHidden == TRUE)
287+ {
288+ CursorGloballyHidden = FALSE;
289+ return (client->noClientException);
290+ }
291+
292 /*
293 * Has client hidden the cursor on this screen?
294- * If not, generate an error.
295+ * If so, generate an error.
296 */
297 pChc = findCursorHideCount(client, pWin->drawable.pScreen);
298 if (pChc == NULL) {
299@@ -1009,6 +1028,8 @@
300 XFixesCursorInit (void)
301 {
302 int i;
303+
304+ CursorGloballyHidden = CursorInitiallyHidden;
305
306 if (CursorGeneration != serverGeneration)
307 {
diff --git a/meta/packages/xorg-xserver/xserver-kdrive_X11R7.1-1.1.0.bb b/meta/packages/xorg-xserver/xserver-kdrive_X11R7.1-1.1.0.bb
index 5f362412d3..1182d7d441 100644
--- a/meta/packages/xorg-xserver/xserver-kdrive_X11R7.1-1.1.0.bb
+++ b/meta/packages/xorg-xserver/xserver-kdrive_X11R7.1-1.1.0.bb
@@ -10,7 +10,7 @@ DESCRIPTION_xserver-kdrive-fbdev = "X server from freedesktop.org, supporting ge
10DESCRIPTION_xserver-kdrive-fake = "Fake X server" 10DESCRIPTION_xserver-kdrive-fake = "Fake X server"
11DESCRIPTION_xserver-kdrive-xephyr = "X server in an X window" 11DESCRIPTION_xserver-kdrive-xephyr = "X server in an X window"
12 12
13PR="r1" 13PR="r2"
14 14
15FILES_${PN} = "${libdir}/xserver" 15FILES_${PN} = "${libdir}/xserver"
16FILES_xserver-kdrive-fbdev = "${bindir}/Xfbdev" 16FILES_xserver-kdrive-fbdev = "${bindir}/Xfbdev"
@@ -33,7 +33,8 @@ SRC_URI = "http://ftp.x.org/pub/X11R7.1/src/xserver/xorg-server-X11R7.1-1.1.0.ta
33 file://disable-xf86-dga-xorgcfg.patch;patch=1 \ 33 file://disable-xf86-dga-xorgcfg.patch;patch=1 \
34 file://enable-tslib.patch;patch=1 \ 34 file://enable-tslib.patch;patch=1 \
35 file://xcalibrate.patch;patch=1 \ 35 file://xcalibrate.patch;patch=1 \
36 file://xfbdev-fb-opt.patch;patch=1" 36 file://xfbdev-fb-opt.patch;patch=1 \
37 file://hide-cursor-and-ppm-root.patch;patch=1"
37 38
38SRC_URI_append_mnci = " file://onlyfb.patch;patch=1" 39SRC_URI_append_mnci = " file://onlyfb.patch;patch=1"
39SRC_URI_append_poodle = " file://xserver-kdrive-poodle.patch;patch=1" 40SRC_URI_append_poodle = " file://xserver-kdrive-poodle.patch;patch=1"