steamcompmgr: Don't composite the cursor when it's empty.

This commit is contained in:
Pierre-Loup A. Griffais 2020-01-05 18:10:15 -08:00
parent c4321e54b2
commit 0565c32a55

View file

@ -138,6 +138,8 @@ VulkanTexture_t cursorTexture;
Bool hideCursorForMovement; Bool hideCursorForMovement;
unsigned int lastCursorMovedTime; unsigned int lastCursorMovedTime;
static bool cursorImageEmpty;
Bool focusDirty = False; Bool focusDirty = False;
@ -423,8 +425,6 @@ paint_cursor ( Display *dpy, win *w, struct Composite_t *pComposite, struct Vulk
} }
// Assume the cursor is fully translucent unless proven otherwise // Assume the cursor is fully translucent unless proven otherwise
static bool s_noCursor = false;
bool bNoCursor = true; bool bNoCursor = true;
unsigned int cursorDataBuffer[cursorWidth * cursorHeight]; unsigned int cursorDataBuffer[cursorWidth * cursorHeight];
@ -438,16 +438,19 @@ paint_cursor ( Display *dpy, win *w, struct Composite_t *pComposite, struct Vulk
} }
} }
if ( bNoCursor != s_noCursor ) if ( bNoCursor != cursorImageEmpty )
{ {
s_noCursor = bNoCursor; cursorImageEmpty = bNoCursor;
if ( s_noCursor == true ) if ( cursorImageEmpty == true )
{ {
// fprintf( stderr, "grab?\n" ); // fprintf( stderr, "grab?\n" );
} }
} }
if ( cursorImageEmpty == True )
return;
cursorTexture = vulkan_create_texture_from_bits( cursorWidth, cursorHeight, VK_FORMAT_R8G8B8A8_UNORM, cursorDataBuffer ); cursorTexture = vulkan_create_texture_from_bits( cursorWidth, cursorHeight, VK_FORMAT_R8G8B8A8_UNORM, cursorDataBuffer );
assert( cursorTexture != 0 ); assert( cursorTexture != 0 );
@ -457,6 +460,9 @@ paint_cursor ( Display *dpy, win *w, struct Composite_t *pComposite, struct Vulk
cursorImageDirty = False; cursorImageDirty = False;
} }
if ( cursorImageEmpty == True )
return;
// Actual point on scaled screen where the cursor hotspot should be // Actual point on scaled screen where the cursor hotspot should be
scaledCursorX = (win_x - w->a.x) * cursorScaleRatio * globalScaleRatio + cursorOffsetX; scaledCursorX = (win_x - w->a.x) * cursorScaleRatio * globalScaleRatio + cursorOffsetX;
scaledCursorY = (win_y - w->a.y) * cursorScaleRatio * globalScaleRatio + cursorOffsetY; scaledCursorY = (win_y - w->a.y) * cursorScaleRatio * globalScaleRatio + cursorOffsetY;