Add some code to detect if the cursor becomes fully hidden.

That should come in handy for auto-grabbing in the nested case.
This commit is contained in:
Pierre-Loup A. Griffais 2020-01-04 19:18:42 -08:00
parent 8a8eea1df3
commit 97aac0bbf9

View file

@ -421,9 +421,31 @@ paint_cursor ( Display *dpy, win *w, struct Composite_t *pComposite, struct Vulk
cursorTexture = 0;
}
// Assume the cursor is fully translucent unless proven otherwise
static bool s_noCursor = false;
bool bNoCursor = true;
unsigned int cursorDataBuffer[cursorWidth * cursorHeight];
for (int i = 0; i < cursorWidth * cursorHeight; i++)
{
cursorDataBuffer[i] = im->pixels[i];
if ( cursorDataBuffer[i] & 0x000000ff )
{
bNoCursor = false;
}
}
if ( bNoCursor != s_noCursor )
{
s_noCursor = bNoCursor;
if ( s_noCursor == true )
{
// fprintf( stderr, "grab?\n" );
}
}
cursorTexture = vulkan_create_texture_from_bits( cursorWidth, cursorHeight, VK_FORMAT_R8G8B8A8_UNORM, cursorDataBuffer );
@ -477,7 +499,7 @@ paint_window (Display *dpy, win *w, struct Composite_t *pComposite, struct Vulka
int drawXOffset = 0, drawYOffset = 0;
float currentScaleRatio = 1.0;
if (!w)
if (!w)
return;
if (w->isOverlay && !w->validContents)