DIX: Clean up null root cursor handling
Move the null root cursor handling out of main() and into CreateRootCursor.
This commit is contained in:
parent
62ec6d09b3
commit
0afeb0241a
22
dix/cursor.c
22
dix/cursor.c
|
@ -430,25 +430,41 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
CursorPtr
|
CursorPtr
|
||||||
CreateRootCursor(char *pfilename, unsigned glyph)
|
CreateRootCursor(char *unused1, unsigned int unused2)
|
||||||
{
|
{
|
||||||
CursorPtr curs;
|
CursorPtr curs;
|
||||||
|
#ifdef NULL_ROOT_CURSOR
|
||||||
|
CursorMetricRec cm;
|
||||||
|
#else
|
||||||
FontPtr cursorfont;
|
FontPtr cursorfont;
|
||||||
int err;
|
int err;
|
||||||
XID fontID;
|
XID fontID;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NULL_ROOT_CURSOR
|
||||||
|
cm.width = 0;
|
||||||
|
cm.height = 0;
|
||||||
|
cm.xhot = 0;
|
||||||
|
cm.yhot = 0;
|
||||||
|
|
||||||
|
curs = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
if (curs == NullCursor)
|
||||||
|
return NullCursor;
|
||||||
|
#else
|
||||||
fontID = FakeClientID(0);
|
fontID = FakeClientID(0);
|
||||||
err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
|
err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
|
||||||
(unsigned)strlen( pfilename), pfilename);
|
(unsigned)strlen(defaultCursorFont), defaultCursorFont);
|
||||||
if (err != Success)
|
if (err != Success)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
|
|
||||||
cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
|
cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
|
||||||
if (!cursorfont)
|
if (!cursorfont)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
if (AllocGlyphCursor(fontID, glyph, fontID, glyph + 1,
|
if (AllocGlyphCursor(fontID, 0, fontID, 1,
|
||||||
0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success)
|
0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
|
if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
|
|
14
dix/main.c
14
dix/main.c
|
@ -411,22 +411,10 @@ main(int argc, char *argv[], char *envp[])
|
||||||
FatalError("could not open default font '%s'", defaultTextFont);
|
FatalError("could not open default font '%s'", defaultTextFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NULL_ROOT_CURSOR
|
if (!(rootCursor = CreateRootCursor(NULL, 0))) {
|
||||||
cm.width = 0;
|
|
||||||
cm.height = 0;
|
|
||||||
cm.xhot = 0;
|
|
||||||
cm.yhot = 0;
|
|
||||||
|
|
||||||
if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0))) {
|
|
||||||
FatalError("could not create empty root cursor");
|
|
||||||
}
|
|
||||||
AddResource(FakeClientID(0), RT_CURSOR, (pointer)rootCursor);
|
|
||||||
#else
|
|
||||||
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) {
|
|
||||||
FatalError("could not open default cursor font '%s'",
|
FatalError("could not open default cursor font '%s'",
|
||||||
defaultCursorFont);
|
defaultCursorFont);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
/* check all screens, looking for DPMS Capabilities */
|
/* check all screens, looking for DPMS Capabilities */
|
||||||
|
|
Loading…
Reference in New Issue