diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-05-24 11:45:42 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-24 22:15:14 -0700 |
commit | 7c085aebfedeb621a6fbeb3f09f4fcc640452044 (patch) | |
tree | 0e728c2ccd3a3666c7d4ae7ad33542e31e0e40c6 /xfixes/cursor.c | |
parent | 2ffffb4daf6161e6a22d81442ecf6209acc9e975 (diff) |
xfixes: Remove the invisible cursor sprite, using NullCursor instead.
Oliver McFadden reports that the invisible cursor sprite caused damage
events and thus unnecessary redrawing, so removing it improves
performance when using software cursor sprites, especially on those
devices where you do not want a visible cursor: touchscreen tablets,
embedded devices, etc.
For the xfree86 DDX, if hardware cursors are used, the driver is
required to provide a HideCursor function, which will be called instead
of trying to set a null cursor. I think software cursors are already
safe. The other DDXes also look safe.
As far as I can tell, there's no reason to realize a null cursor. I
think everything that handles null cursors doesn't rely on any setup in
RealizeCursor, and treats them as empty cursors.
Xnest assumes that if a cursor is created, it will be realized before it
is freed, which didn't happen if the invisible cursor was never used in
a server generation. So this fixes a segfault in Xnest as well.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Oliver McFadden <oliver.mcfadden@nokia.com>
Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Tested-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'xfixes/cursor.c')
-rw-r--r-- | xfixes/cursor.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 52bdb27f6..d3a207ddb 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -58,7 +58,6 @@ static RESTYPE CursorClientType; static RESTYPE CursorHideCountType; static RESTYPE CursorWindowType; static CursorPtr CursorCurrent[MAXDEVICES]; -static CursorPtr pInvisibleCursor = NULL; static int CursorScreenPrivateKeyIndex; static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKeyIndex; @@ -148,8 +147,7 @@ CursorDisplayCursor (DeviceIntPtr pDev, CursorVisible = EnableCursor; if (cs->pCursorHideCounts != NULL || !CursorVisible) { - ret = ((*pScreen->RealizeCursor)(pDev, pScreen, pInvisibleCursor) && - (*pScreen->DisplayCursor) (pDev, pScreen, pInvisibleCursor)); + ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor); } else { ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); } @@ -1031,37 +1029,6 @@ CursorFreeWindow (pointer data, XID id) return 1; } -static CursorPtr -createInvisibleCursor (void) -{ - CursorPtr pCursor; - unsigned char *psrcbits, *pmaskbits; - CursorMetricRec cm; - - psrcbits = (unsigned char *) calloc(4, 1); - pmaskbits = (unsigned char *) calloc(4, 1); - if (psrcbits == NULL || pmaskbits == NULL) { - return NULL; - } - - cm.width = 1; - cm.height = 1; - cm.xhot = 0; - cm.yhot = 0; - - if (AllocARGBCursor(psrcbits, pmaskbits, - NULL, &cm, - 0, 0, 0, - 0, 0, 0, - &pCursor, serverClient, (XID)0) != Success) - return NullCursor; - - if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer) pCursor)) - return NullCursor; - - return pCursor; -} - Bool XFixesCursorInit (void) { @@ -1090,10 +1057,6 @@ XFixesCursorInit (void) CursorWindowType = CreateNewResourceType(CursorFreeWindow, "XFixesCursorWindow"); - pInvisibleCursor = createInvisibleCursor(); - if (pInvisibleCursor == NULL) - return BadAlloc; - return CursorClientType && CursorHideCountType && CursorWindowType; } |