mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] add support for masked colour cursors (fixes #61)
Also allows early SDL usage for cursor and keyboard control before the host application starts
This commit is contained in:
parent
871aee2aae
commit
882b31aeaa
@ -899,7 +899,19 @@ int run()
|
||||
DEBUG_INFO("Waiting for host to signal it's ready...");
|
||||
__sync_or_and_fetch(&state.shm->flags, KVMFR_HEADER_FLAG_RESTART);
|
||||
while(state.running && (state.shm->flags & KVMFR_HEADER_FLAG_RESTART))
|
||||
{
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
if (event.type == SDL_QUIT)
|
||||
{
|
||||
if (!params.ignoreQuit)
|
||||
state.running = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
usleep(1000);
|
||||
}
|
||||
DEBUG_INFO("Host ready, starting session");
|
||||
|
||||
// check the header's magic and version are valid
|
||||
|
@ -867,9 +867,26 @@ static void update_mouse_shape(struct Inst * this, bool * newShape)
|
||||
const int pitch = this->mousePitch;
|
||||
const uint8_t * data = this->mouseData;
|
||||
|
||||
// tmp buffer for masked colour
|
||||
uint32_t tmp[width * height];
|
||||
|
||||
this->mouseType = cursor;
|
||||
switch(cursor)
|
||||
{
|
||||
case LG_CURSOR_MASKED_COLOR:
|
||||
{
|
||||
for(int i = 0; i < width * height; ++i)
|
||||
{
|
||||
const uint32_t c = ((uint32_t *)data)[i];
|
||||
tmp[i] = (c & ~0xFF000000) | (c & 0xFF000000 ? 0x0 : 0xFF000000);
|
||||
}
|
||||
data = (uint8_t *)tmp;
|
||||
// fall through to LG_CURSOR_COLOR
|
||||
//
|
||||
// technically we should also create an XOR texture from the data but this
|
||||
// usage seems very rare in modern software.
|
||||
}
|
||||
|
||||
case LG_CURSOR_COLOR:
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, this->textures[MOUSE_TEXTURE]);
|
||||
@ -974,12 +991,6 @@ static void update_mouse_shape(struct Inst * this, bool * newShape)
|
||||
glEndList();
|
||||
break;
|
||||
}
|
||||
|
||||
case LG_CURSOR_MASKED_COLOR:
|
||||
{
|
||||
//TODO
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->mouseUpdate = true;
|
||||
|
Loading…
Reference in New Issue
Block a user