mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-14 19:38:10 +00:00
[c-host] revert locking series, this needs more thought
Revert "[c-host] make pointer post function thread safe" This reverts commit3feed7ba07
. Revert "[c-hots] fix incorrect unlock timing" This reverts commit57f1f2d1fe
. Revert "[c-host] increase the queue length and remove debug output" This reverts commitb0f9f15a60
. Revert "[c-host] dxgi: use low level mouse input by default" This reverts commitdc4d820666
. Revert "[c-host] nvfbc: no need for a cursor position event with LGMP" This reverts commite30b54ddb2
.
This commit is contained in:
@@ -25,8 +25,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "common/locking.h"
|
||||
#include "common/event.h"
|
||||
|
||||
#include "windows/mousehook.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <dxgi.h>
|
||||
#include <d3d11.h>
|
||||
@@ -84,9 +82,6 @@ struct iface
|
||||
unsigned int stride;
|
||||
CaptureFormat format;
|
||||
|
||||
LG_Lock pointerLock;
|
||||
bool decouplePointer;
|
||||
int hotspotX , hotspotY;
|
||||
int lastPointerX, lastPointerY;
|
||||
bool lastPointerVisible;
|
||||
};
|
||||
@@ -101,27 +96,6 @@ static CaptureResult dxgi_releaseFrame();
|
||||
|
||||
// implementation
|
||||
|
||||
static void on_mouseMove(int x, int y)
|
||||
{
|
||||
LG_LOCK(this->pointerLock);
|
||||
|
||||
x -= this->hotspotX;
|
||||
y -= this->hotspotY;
|
||||
|
||||
this->lastPointerX = x;
|
||||
this->lastPointerY = y;
|
||||
|
||||
CapturePointer pointer =
|
||||
{
|
||||
.positionUpdate = true,
|
||||
.visible = this->lastPointerVisible,
|
||||
.x = x,
|
||||
.y = y
|
||||
};
|
||||
LG_UNLOCK(this->pointerLock);
|
||||
this->postPointerBufferFn(pointer);
|
||||
}
|
||||
|
||||
static const char * dxgi_getName()
|
||||
{
|
||||
return "DXGI";
|
||||
@@ -159,14 +133,6 @@ static void dxgi_initOptions()
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false
|
||||
},
|
||||
{
|
||||
.module = "dxgi",
|
||||
.name = "decouplePointer",
|
||||
.description = "Use a low level hook to obtain cursor position information",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
|
||||
{0}
|
||||
};
|
||||
|
||||
@@ -195,18 +161,10 @@ static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostP
|
||||
if (this->maxTextures <= 0)
|
||||
this->maxTextures = 1;
|
||||
|
||||
this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock" );
|
||||
this->decouplePointer = option_get_bool("dxgi", "decouplePointer");
|
||||
|
||||
this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock");
|
||||
this->texture = calloc(sizeof(struct Texture), this->maxTextures);
|
||||
this->getPointerBufferFn = getPointerBufferFn;
|
||||
this->postPointerBufferFn = postPointerBufferFn;
|
||||
|
||||
LG_LOCK_INIT(this->pointerLock);
|
||||
|
||||
if (this->decouplePointer)
|
||||
mouseHook_install(on_mouseMove);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -571,8 +529,6 @@ static bool dxgi_deinit()
|
||||
{
|
||||
assert(this);
|
||||
|
||||
mouseHook_remove();
|
||||
|
||||
for(int i = 0; i < this->maxTextures; ++i)
|
||||
{
|
||||
this->texture[i].state = TEXTURE_STATE_UNUSED;
|
||||
@@ -756,20 +712,22 @@ static CaptureResult dxgi_capture()
|
||||
frameInfo.PointerPosition.Visible != this->lastPointerVisible
|
||||
)
|
||||
{
|
||||
LG_LOCK(this->pointerLock);
|
||||
|
||||
/* the pointer position is invalid if the pointer is not visible */
|
||||
if (!this->decouplePointer && frameInfo.PointerPosition.Visible)
|
||||
if (frameInfo.PointerPosition.Visible)
|
||||
{
|
||||
pointer.positionUpdate = true;
|
||||
this->lastPointerX = frameInfo.PointerPosition.Position.x;
|
||||
this->lastPointerY = frameInfo.PointerPosition.Position.y;
|
||||
pointer.x =
|
||||
this->lastPointerX =
|
||||
frameInfo.PointerPosition.Position.x;
|
||||
pointer.y =
|
||||
this->lastPointerY =
|
||||
frameInfo.PointerPosition.Position.y;
|
||||
}
|
||||
|
||||
this->lastPointerVisible = frameInfo.PointerPosition.Visible;
|
||||
pointer.visible =
|
||||
this->lastPointerVisible =
|
||||
frameInfo.PointerPosition.Visible;
|
||||
postPointer = true;
|
||||
|
||||
LG_UNLOCK(this->pointerLock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -800,12 +758,6 @@ static CaptureResult dxgi_capture()
|
||||
return CAPTURE_RESULT_ERROR;
|
||||
}
|
||||
|
||||
// needed in decouple mode
|
||||
LG_LOCK(this->pointerLock);
|
||||
this->hotspotX = shapeInfo.HotSpot.x;
|
||||
this->hotspotY = shapeInfo.HotSpot.y;
|
||||
LG_UNLOCK(this->pointerLock);
|
||||
|
||||
pointer.shapeUpdate = true;
|
||||
pointer.width = shapeInfo.Width;
|
||||
pointer.height = shapeInfo.Height;
|
||||
@@ -816,12 +768,7 @@ static CaptureResult dxgi_capture()
|
||||
|
||||
// post back the pointer information
|
||||
if (postPointer)
|
||||
{
|
||||
LG_LOCK(this->pointerLock);
|
||||
pointer.visible = this->lastPointerVisible;
|
||||
LG_UNLOCK(this->pointerLock);
|
||||
this->postPointerBufferFn(pointer);
|
||||
}
|
||||
|
||||
return CAPTURE_RESULT_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user