Fixed windows shadow server update copy.
This commit is contained in:
parent
14997f96e3
commit
2ad5b3510d
@ -61,7 +61,7 @@ static BOOL shw_end_paint(rdpContext* context)
|
|||||||
rdpGdi* gdi = context->gdi;
|
rdpGdi* gdi = context->gdi;
|
||||||
shwContext* shw = (shwContext*) context;
|
shwContext* shw = (shwContext*) context;
|
||||||
winShadowSubsystem* subsystem = shw->subsystem;
|
winShadowSubsystem* subsystem = shw->subsystem;
|
||||||
rdpShadowSurface* surface = subsystem->server->surface;
|
rdpShadowSurface* surface = subsystem->base.server->surface;
|
||||||
ninvalid = gdi->primary->hdc->hwnd->ninvalid;
|
ninvalid = gdi->primary->hdc->hwnd->ninvalid;
|
||||||
cinvalid = gdi->primary->hdc->hwnd->cinvalid;
|
cinvalid = gdi->primary->hdc->hwnd->cinvalid;
|
||||||
|
|
||||||
|
@ -28,13 +28,14 @@
|
|||||||
|
|
||||||
#define TAG SERVER_TAG("shadow.win")
|
#define TAG SERVER_TAG("shadow.win")
|
||||||
|
|
||||||
void win_shadow_input_synchronize_event(winShadowSubsystem* subsystem,
|
static int win_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem,
|
||||||
rdpShadowClient* client, UINT32 flags)
|
rdpShadowClient* client, UINT32 flags)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_shadow_input_keyboard_event(winShadowSubsystem* subsystem,
|
static int win_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem,
|
||||||
rdpShadowClient* client, UINT16 flags, UINT16 code)
|
rdpShadowClient* client, UINT16 flags, UINT16 code)
|
||||||
{
|
{
|
||||||
INPUT event;
|
INPUT event;
|
||||||
event.type = INPUT_KEYBOARD;
|
event.type = INPUT_KEYBOARD;
|
||||||
@ -50,10 +51,10 @@ void win_shadow_input_keyboard_event(winShadowSubsystem* subsystem,
|
|||||||
if (flags & KBD_FLAGS_EXTENDED)
|
if (flags & KBD_FLAGS_EXTENDED)
|
||||||
event.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
event.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||||
|
|
||||||
SendInput(1, &event, sizeof(INPUT));
|
return SendInput(1, &event, sizeof(INPUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_shadow_input_unicode_keyboard_event(winShadowSubsystem* subsystem,
|
static int win_shadow_input_unicode_keyboard_event(rdpShadowSubsystem* subsystem,
|
||||||
rdpShadowClient* client, UINT16 flags, UINT16 code)
|
rdpShadowClient* client, UINT16 flags, UINT16 code)
|
||||||
{
|
{
|
||||||
INPUT event;
|
INPUT event;
|
||||||
@ -67,11 +68,11 @@ void win_shadow_input_unicode_keyboard_event(winShadowSubsystem* subsystem,
|
|||||||
if (flags & KBD_FLAGS_RELEASE)
|
if (flags & KBD_FLAGS_RELEASE)
|
||||||
event.ki.dwFlags |= KEYEVENTF_KEYUP;
|
event.ki.dwFlags |= KEYEVENTF_KEYUP;
|
||||||
|
|
||||||
SendInput(1, &event, sizeof(INPUT));
|
return SendInput(1, &event, sizeof(INPUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_shadow_input_mouse_event(winShadowSubsystem* subsystem,
|
static int win_shadow_input_mouse_event(rdpShadowSubsystem* subsystem,
|
||||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
|
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
|
||||||
{
|
{
|
||||||
INPUT event;
|
INPUT event;
|
||||||
float width;
|
float width;
|
||||||
@ -133,9 +134,11 @@ void win_shadow_input_mouse_event(winShadowSubsystem* subsystem,
|
|||||||
SendInput(1, &event, sizeof(INPUT));
|
SendInput(1, &event, sizeof(INPUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_shadow_input_extended_mouse_event(winShadowSubsystem* subsystem,
|
static int win_shadow_input_extended_mouse_event(rdpShadowSubsystem* subsystem,
|
||||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
|
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
|
||||||
{
|
{
|
||||||
INPUT event;
|
INPUT event;
|
||||||
@ -171,16 +174,18 @@ void win_shadow_input_extended_mouse_event(winShadowSubsystem* subsystem,
|
|||||||
|
|
||||||
SendInput(1, &event, sizeof(INPUT));
|
SendInput(1, &event, sizeof(INPUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int win_shadow_invalidate_region(winShadowSubsystem* subsystem, int x, int y,
|
static int win_shadow_invalidate_region(winShadowSubsystem* subsystem, int x, int y,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
{
|
{
|
||||||
rdpShadowServer* server;
|
rdpShadowServer* server;
|
||||||
rdpShadowSurface* surface;
|
rdpShadowSurface* surface;
|
||||||
RECTANGLE_16 invalidRect;
|
RECTANGLE_16 invalidRect;
|
||||||
server = subsystem->server;
|
server = subsystem->base.server;
|
||||||
surface = server->surface;
|
surface = server->surface;
|
||||||
invalidRect.left = x;
|
invalidRect.left = x;
|
||||||
invalidRect.top = y;
|
invalidRect.top = y;
|
||||||
@ -193,7 +198,7 @@ int win_shadow_invalidate_region(winShadowSubsystem* subsystem, int x, int y,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_shadow_surface_copy(winShadowSubsystem* subsystem)
|
static int win_shadow_surface_copy(winShadowSubsystem* subsystem)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
int width;
|
int width;
|
||||||
@ -208,7 +213,7 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
|
|||||||
RECTANGLE_16 surfaceRect;
|
RECTANGLE_16 surfaceRect;
|
||||||
RECTANGLE_16 invalidRect;
|
RECTANGLE_16 invalidRect;
|
||||||
const RECTANGLE_16* extents;
|
const RECTANGLE_16* extents;
|
||||||
server = subsystem->server;
|
server = subsystem->base.server;
|
||||||
surface = server->surface;
|
surface = server->surface;
|
||||||
|
|
||||||
if (ArrayList_Count(server->clients) < 1)
|
if (ArrayList_Count(server->clients) < 1)
|
||||||
@ -252,7 +257,7 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
|
|||||||
shwContext* shw;
|
shwContext* shw;
|
||||||
rdpContext* context;
|
rdpContext* context;
|
||||||
shw = subsystem->shw;
|
shw = subsystem->shw;
|
||||||
context = (rdpContext*) shw;
|
context = &shw->context;
|
||||||
gdi = context->gdi;
|
gdi = context->gdi;
|
||||||
pDstData = gdi->primary_buffer;
|
pDstData = gdi->primary_buffer;
|
||||||
nDstStep = gdi->width * 4;
|
nDstStep = gdi->width * 4;
|
||||||
@ -267,12 +272,14 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
|
|||||||
if (status <= 0)
|
if (status <= 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
freerdp_image_copy(surface->data, surface->format,
|
if (!freerdp_image_copy(surface->data, surface->format,
|
||||||
surface->scanline, x - surface->x, y - surface->y, width, height,
|
surface->scanline, x, y, width, height,
|
||||||
pDstData, DstFormat, nDstStep, 0, 0, NULL, FREERDP_FLIP_NONE);
|
pDstData, DstFormat, nDstStep, x, y, NULL, FREERDP_FLIP_NONE))
|
||||||
|
return ERROR_INTERNAL_ERROR;
|
||||||
|
|
||||||
ArrayList_Lock(server->clients);
|
ArrayList_Lock(server->clients);
|
||||||
count = ArrayList_Count(server->clients);
|
count = ArrayList_Count(server->clients);
|
||||||
shadow_subsystem_frame_update((rdpShadowSubsystem*)subsystem);
|
shadow_subsystem_frame_update(&subsystem->base);
|
||||||
ArrayList_Unlock(server->clients);
|
ArrayList_Unlock(server->clients);
|
||||||
region16_clear(&(surface->invalidRegion));
|
region16_clear(&(surface->invalidRegion));
|
||||||
return 1;
|
return 1;
|
||||||
@ -287,7 +294,7 @@ static DWORD WINAPI win_shadow_subsystem_thread(LPVOID arg)
|
|||||||
DWORD nCount;
|
DWORD nCount;
|
||||||
HANDLE events[32];
|
HANDLE events[32];
|
||||||
HANDLE StopEvent;
|
HANDLE StopEvent;
|
||||||
StopEvent = subsystem->server->StopEvent;
|
StopEvent = subsystem->base.server->StopEvent;
|
||||||
nCount = 0;
|
nCount = 0;
|
||||||
events[nCount++] = StopEvent;
|
events[nCount++] = StopEvent;
|
||||||
events[nCount++] = subsystem->RdpUpdateEnterEvent;
|
events[nCount++] = subsystem->RdpUpdateEnterEvent;
|
||||||
@ -368,7 +375,7 @@ static DWORD WINAPI win_shadow_subsystem_thread(LPVOID arg)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int win_shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors)
|
static UINT32 win_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
int index;
|
int index;
|
||||||
@ -400,17 +407,18 @@ int win_shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors)
|
|||||||
return numMonitors;
|
return numMonitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_shadow_subsystem_init(winShadowSubsystem* subsystem)
|
static int win_shadow_subsystem_init(rdpShadowSubsystem* arg)
|
||||||
{
|
{
|
||||||
|
winShadowSubsystem* subsystem = (winShadowSubsystem*)arg;
|
||||||
int status;
|
int status;
|
||||||
MONITOR_DEF* virtualScreen;
|
MONITOR_DEF* virtualScreen;
|
||||||
subsystem->numMonitors = win_shadow_enum_monitors(subsystem->monitors, 16);
|
subsystem->base.numMonitors = win_shadow_enum_monitors(subsystem->base.monitors, 16);
|
||||||
#if defined(WITH_WDS_API)
|
#if defined(WITH_WDS_API)
|
||||||
status = win_shadow_wds_init(subsystem);
|
status = win_shadow_wds_init(subsystem);
|
||||||
#elif defined(WITH_DXGI_1_2)
|
#elif defined(WITH_DXGI_1_2)
|
||||||
status = win_shadow_dxgi_init(subsystem);
|
status = win_shadow_dxgi_init(subsystem);
|
||||||
#endif
|
#endif
|
||||||
virtualScreen = &(subsystem->virtualScreen);
|
virtualScreen = &(subsystem->base.virtualScreen);
|
||||||
virtualScreen->left = 0;
|
virtualScreen->left = 0;
|
||||||
virtualScreen->top = 0;
|
virtualScreen->top = 0;
|
||||||
virtualScreen->right = subsystem->width;
|
virtualScreen->right = subsystem->width;
|
||||||
@ -420,8 +428,10 @@ int win_shadow_subsystem_init(winShadowSubsystem* subsystem)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_shadow_subsystem_uninit(winShadowSubsystem* subsystem)
|
static int win_shadow_subsystem_uninit(rdpShadowSubsystem* arg)
|
||||||
{
|
{
|
||||||
|
winShadowSubsystem* subsystem = (winShadowSubsystem*)arg;
|
||||||
|
|
||||||
if (!subsystem)
|
if (!subsystem)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -433,14 +443,16 @@ int win_shadow_subsystem_uninit(winShadowSubsystem* subsystem)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_shadow_subsystem_start(winShadowSubsystem* subsystem)
|
static int win_shadow_subsystem_start(rdpShadowSubsystem* arg)
|
||||||
{
|
{
|
||||||
|
winShadowSubsystem* subsystem = (winShadowSubsystem*)arg;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
|
|
||||||
if (!subsystem)
|
if (!subsystem)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(thread = CreateThread(NULL, 0, win_shadow_subsystem_thread,
|
if (!(thread = CreateThread(NULL, 0,
|
||||||
|
win_shadow_subsystem_thread,
|
||||||
(void*) subsystem, 0, NULL)))
|
(void*) subsystem, 0, NULL)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Failed to create thread");
|
WLog_ERR(TAG, "Failed to create thread");
|
||||||
@ -450,24 +462,28 @@ int win_shadow_subsystem_start(winShadowSubsystem* subsystem)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_shadow_subsystem_stop(winShadowSubsystem* subsystem)
|
static int win_shadow_subsystem_stop(rdpShadowSubsystem* arg)
|
||||||
{
|
{
|
||||||
|
winShadowSubsystem* subsystem = (winShadowSubsystem*)arg;
|
||||||
|
|
||||||
if (!subsystem)
|
if (!subsystem)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_shadow_subsystem_free(winShadowSubsystem* subsystem)
|
static void win_shadow_subsystem_free(rdpShadowSubsystem* arg)
|
||||||
{
|
{
|
||||||
|
winShadowSubsystem* subsystem = (winShadowSubsystem*)arg;
|
||||||
|
|
||||||
if (!subsystem)
|
if (!subsystem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
win_shadow_subsystem_uninit(subsystem);
|
win_shadow_subsystem_uninit(arg);
|
||||||
free(subsystem);
|
free(subsystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
winShadowSubsystem* win_shadow_subsystem_new()
|
static rdpShadowSubsystem* win_shadow_subsystem_new(void)
|
||||||
{
|
{
|
||||||
winShadowSubsystem* subsystem;
|
winShadowSubsystem* subsystem;
|
||||||
subsystem = (winShadowSubsystem*) calloc(1, sizeof(winShadowSubsystem));
|
subsystem = (winShadowSubsystem*) calloc(1, sizeof(winShadowSubsystem));
|
||||||
@ -475,26 +491,22 @@ winShadowSubsystem* win_shadow_subsystem_new()
|
|||||||
if (!subsystem)
|
if (!subsystem)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
subsystem->SynchronizeEvent = (pfnShadowSynchronizeEvent)
|
subsystem->base.SynchronizeEvent = win_shadow_input_synchronize_event;
|
||||||
win_shadow_input_synchronize_event;
|
subsystem->base.KeyboardEvent = win_shadow_input_keyboard_event;
|
||||||
subsystem->KeyboardEvent = (pfnShadowKeyboardEvent)
|
subsystem->base.UnicodeKeyboardEvent = win_shadow_input_unicode_keyboard_event;
|
||||||
win_shadow_input_keyboard_event;
|
subsystem->base.MouseEvent = win_shadow_input_mouse_event;
|
||||||
subsystem->UnicodeKeyboardEvent = (pfnShadowUnicodeKeyboardEvent)
|
subsystem->base.ExtendedMouseEvent = win_shadow_input_extended_mouse_event;
|
||||||
win_shadow_input_unicode_keyboard_event;
|
return &subsystem->base;
|
||||||
subsystem->MouseEvent = (pfnShadowMouseEvent) win_shadow_input_mouse_event;
|
|
||||||
subsystem->ExtendedMouseEvent = (pfnShadowExtendedMouseEvent)
|
|
||||||
win_shadow_input_extended_mouse_event;
|
|
||||||
return subsystem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FREERDP_API int Win_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
|
FREERDP_API int Win_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
|
||||||
{
|
{
|
||||||
pEntryPoints->New = (pfnShadowSubsystemNew) win_shadow_subsystem_new;
|
pEntryPoints->New = win_shadow_subsystem_new;
|
||||||
pEntryPoints->Free = (pfnShadowSubsystemFree) win_shadow_subsystem_free;
|
pEntryPoints->Free = win_shadow_subsystem_free;
|
||||||
pEntryPoints->Init = (pfnShadowSubsystemInit) win_shadow_subsystem_init;
|
pEntryPoints->Init = win_shadow_subsystem_init;
|
||||||
pEntryPoints->Uninit = (pfnShadowSubsystemInit) win_shadow_subsystem_uninit;
|
pEntryPoints->Uninit = win_shadow_subsystem_uninit;
|
||||||
pEntryPoints->Start = (pfnShadowSubsystemStart) win_shadow_subsystem_start;
|
pEntryPoints->Start = win_shadow_subsystem_start;
|
||||||
pEntryPoints->Stop = (pfnShadowSubsystemStop) win_shadow_subsystem_stop;
|
pEntryPoints->Stop = win_shadow_subsystem_stop;
|
||||||
pEntryPoints->EnumMonitors = (pfnShadowEnumMonitors) win_shadow_enum_monitors;
|
pEntryPoints->EnumMonitors = win_shadow_enum_monitors;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ typedef struct win_shadow_subsystem winShadowSubsystem;
|
|||||||
|
|
||||||
struct win_shadow_subsystem
|
struct win_shadow_subsystem
|
||||||
{
|
{
|
||||||
RDP_SHADOW_SUBSYSTEM_COMMON();
|
rdpShadowSubsystem base;
|
||||||
|
|
||||||
int bpp;
|
int bpp;
|
||||||
int width;
|
int width;
|
||||||
|
Loading…
Reference in New Issue
Block a user