Fixed shadow server callbacks.
This commit is contained in:
parent
18f97d03e7
commit
d513f184e9
@ -20,6 +20,8 @@
|
||||
#ifndef FREERDP_CODEC_AUDIO_H
|
||||
#define FREERDP_CODEC_AUDIO_H
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
|
@ -75,15 +75,15 @@ typedef void (*pfnShadowClientDisconnect)(rdpShadowSubsystem* subsystem,
|
||||
typedef BOOL (*pfnShadowClientCapabilities)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client);
|
||||
|
||||
typedef int (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem,
|
||||
typedef BOOL (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT32 flags);
|
||||
typedef int (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 code);
|
||||
typedef int (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem,
|
||||
typedef BOOL (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 code);
|
||||
typedef BOOL (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 code);
|
||||
typedef int (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y);
|
||||
typedef int (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem,
|
||||
typedef BOOL (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y);
|
||||
typedef BOOL (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y);
|
||||
|
||||
typedef void (*pfnShadowChannelAudinServerReceiveSamples)(
|
||||
@ -184,46 +184,43 @@ struct _RDP_SHADOW_ENTRY_POINTS
|
||||
pfnShadowEnumMonitors EnumMonitors;
|
||||
};
|
||||
|
||||
#define RDP_SHADOW_SUBSYSTEM_COMMON() \
|
||||
RDP_SHADOW_ENTRY_POINTS ep; \
|
||||
HANDLE event; \
|
||||
int numMonitors; \
|
||||
int captureFrameRate; \
|
||||
int selectedMonitor; \
|
||||
MONITOR_DEF monitors[16]; \
|
||||
MONITOR_DEF virtualScreen; \
|
||||
\
|
||||
/* This event indicates that we have graphic change */ \
|
||||
/* such as screen update and resize. It should not be */ \
|
||||
/* used by subsystem implementation directly */ \
|
||||
rdpShadowMultiClientEvent* updateEvent; \
|
||||
\
|
||||
wMessagePipe* MsgPipe; \
|
||||
UINT32 pointerX; \
|
||||
UINT32 pointerY; \
|
||||
\
|
||||
const AUDIO_FORMAT* rdpsndFormats; \
|
||||
size_t nRdpsndFormats; \
|
||||
const AUDIO_FORMAT* audinFormats; \
|
||||
size_t nAudinFormats; \
|
||||
\
|
||||
pfnShadowSynchronizeEvent SynchronizeEvent; \
|
||||
pfnShadowKeyboardEvent KeyboardEvent; \
|
||||
pfnShadowUnicodeKeyboardEvent UnicodeKeyboardEvent; \
|
||||
pfnShadowMouseEvent MouseEvent; \
|
||||
pfnShadowExtendedMouseEvent ExtendedMouseEvent; \
|
||||
pfnShadowChannelAudinServerReceiveSamples AudinServerReceiveSamples; \
|
||||
\
|
||||
pfnShadowAuthenticate Authenticate; \
|
||||
pfnShadowClientConnect ClientConnect; \
|
||||
pfnShadowClientDisconnect ClientDisconnect; \
|
||||
pfnShadowClientCapabilities ClientCapabilities; \
|
||||
\
|
||||
rdpShadowServer* server
|
||||
|
||||
struct rdp_shadow_subsystem
|
||||
{
|
||||
RDP_SHADOW_SUBSYSTEM_COMMON();
|
||||
RDP_SHADOW_ENTRY_POINTS ep;
|
||||
HANDLE event;
|
||||
int numMonitors;
|
||||
int captureFrameRate;
|
||||
int selectedMonitor;
|
||||
MONITOR_DEF monitors[16];
|
||||
MONITOR_DEF virtualScreen;
|
||||
|
||||
/* This event indicates that we have graphic change */
|
||||
/* such as screen update and resize. It should not be */
|
||||
/* used by subsystem implementation directly */
|
||||
rdpShadowMultiClientEvent* updateEvent;
|
||||
|
||||
wMessagePipe* MsgPipe;
|
||||
UINT32 pointerX;
|
||||
UINT32 pointerY;
|
||||
|
||||
AUDIO_FORMAT* rdpsndFormats;
|
||||
size_t nRdpsndFormats;
|
||||
AUDIO_FORMAT* audinFormats;
|
||||
size_t nAudinFormats;
|
||||
|
||||
pfnShadowSynchronizeEvent SynchronizeEvent;
|
||||
pfnShadowKeyboardEvent KeyboardEvent;
|
||||
pfnShadowUnicodeKeyboardEvent UnicodeKeyboardEvent;
|
||||
pfnShadowMouseEvent MouseEvent;
|
||||
pfnShadowExtendedMouseEvent ExtendedMouseEvent;
|
||||
pfnShadowChannelAudinServerReceiveSamples AudinServerReceiveSamples;
|
||||
|
||||
pfnShadowAuthenticate Authenticate;
|
||||
pfnShadowClientConnect ClientConnect;
|
||||
pfnShadowClientDisconnect ClientDisconnect;
|
||||
pfnShadowClientCapabilities ClientCapabilities;
|
||||
|
||||
rdpShadowServer* server;
|
||||
};
|
||||
|
||||
/* Definition of message between subsystem and clients */
|
||||
|
@ -162,7 +162,7 @@ static int x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem,
|
||||
static int x11_shadow_pam_authenticate(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, const char* user, const char* domain,
|
||||
const char* password)
|
||||
{
|
||||
@ -219,19 +219,24 @@ static int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem,
|
||||
|
||||
#endif
|
||||
|
||||
static void x11_shadow_input_synchronize_event(x11ShadowSubsystem* subsystem,
|
||||
static BOOL x11_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT32 flags)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem,
|
||||
static BOOL x11_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 code)
|
||||
{
|
||||
#ifdef WITH_XTEST
|
||||
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
|
||||
DWORD vkcode;
|
||||
DWORD keycode;
|
||||
BOOL extended = FALSE;
|
||||
|
||||
if (!client || !subsystem)
|
||||
return FALSE;
|
||||
|
||||
if (flags & KBD_FLAGS_EXTENDED)
|
||||
extended = TRUE;
|
||||
|
||||
@ -247,43 +252,58 @@ static void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem,
|
||||
|
||||
if (keycode != 0)
|
||||
{
|
||||
XLockDisplay(subsystem->display);
|
||||
XTestGrabControl(subsystem->display, True);
|
||||
XLockDisplay(x11->display);
|
||||
XTestGrabControl(x11->display, True);
|
||||
|
||||
if (flags & KBD_FLAGS_DOWN)
|
||||
XTestFakeKeyEvent(subsystem->display, keycode, True, CurrentTime);
|
||||
XTestFakeKeyEvent(x11->display, keycode, True, CurrentTime);
|
||||
else if (flags & KBD_FLAGS_RELEASE)
|
||||
XTestFakeKeyEvent(subsystem->display, keycode, False, CurrentTime);
|
||||
XTestFakeKeyEvent(x11->display, keycode, False, CurrentTime);
|
||||
|
||||
XTestGrabControl(subsystem->display, False);
|
||||
XFlush(subsystem->display);
|
||||
XUnlockDisplay(subsystem->display);
|
||||
XTestGrabControl(x11->display, False);
|
||||
XFlush(x11->display);
|
||||
XUnlockDisplay(x11->display);
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void x11_shadow_input_unicode_keyboard_event(x11ShadowSubsystem*
|
||||
static BOOL x11_shadow_input_unicode_keyboard_event(rdpShadowSubsystem*
|
||||
subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 code)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem,
|
||||
static BOOL x11_shadow_input_mouse_event(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
#ifdef WITH_XTEST
|
||||
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
|
||||
int button = 0;
|
||||
BOOL down = FALSE;
|
||||
rdpShadowServer* server;
|
||||
rdpShadowSurface* surface;
|
||||
|
||||
if (!subsystem || !client)
|
||||
return FALSE;
|
||||
|
||||
server = subsystem->server;
|
||||
|
||||
if (!server)
|
||||
return FALSE;
|
||||
|
||||
surface = server->surface;
|
||||
subsystem->lastMouseClient = client;
|
||||
|
||||
if (!surface)
|
||||
return FALSE;
|
||||
|
||||
x11->lastMouseClient = client;
|
||||
x += surface->x;
|
||||
y += surface->y;
|
||||
XLockDisplay(subsystem->display);
|
||||
XTestGrabControl(subsystem->display, True);
|
||||
XLockDisplay(x11->display);
|
||||
XTestGrabControl(x11->display, True);
|
||||
|
||||
if (flags & PTR_FLAGS_WHEEL)
|
||||
{
|
||||
@ -293,13 +313,13 @@ static void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem,
|
||||
negative = TRUE;
|
||||
|
||||
button = (negative) ? 5 : 4;
|
||||
XTestFakeButtonEvent(subsystem->display, button, True, CurrentTime);
|
||||
XTestFakeButtonEvent(subsystem->display, button, False, CurrentTime);
|
||||
XTestFakeButtonEvent(x11->display, button, True, CurrentTime);
|
||||
XTestFakeButtonEvent(x11->display, button, False, CurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flags & PTR_FLAGS_MOVE)
|
||||
XTestFakeMotionEvent(subsystem->display, 0, x, y, CurrentTime);
|
||||
XTestFakeMotionEvent(x11->display, 0, x, y, CurrentTime);
|
||||
|
||||
if (flags & PTR_FLAGS_BUTTON1)
|
||||
button = 1;
|
||||
@ -312,31 +332,45 @@ static void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem,
|
||||
down = TRUE;
|
||||
|
||||
if (button)
|
||||
XTestFakeButtonEvent(subsystem->display, button, down, CurrentTime);
|
||||
XTestFakeButtonEvent(x11->display, button, down, CurrentTime);
|
||||
}
|
||||
|
||||
XTestGrabControl(subsystem->display, False);
|
||||
XFlush(subsystem->display);
|
||||
XUnlockDisplay(subsystem->display);
|
||||
XTestGrabControl(x11->display, False);
|
||||
XFlush(x11->display);
|
||||
XUnlockDisplay(x11->display);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem,
|
||||
static BOOL x11_shadow_input_extended_mouse_event(rdpShadowSubsystem* subsystem,
|
||||
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
#ifdef WITH_XTEST
|
||||
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
|
||||
int button = 0;
|
||||
BOOL down = FALSE;
|
||||
rdpShadowServer* server;
|
||||
rdpShadowSurface* surface;
|
||||
|
||||
if (!subsystem || !client)
|
||||
return FALSE;
|
||||
|
||||
server = subsystem->server;
|
||||
|
||||
if (!server)
|
||||
return FALSE;
|
||||
|
||||
surface = server->surface;
|
||||
subsystem->lastMouseClient = client;
|
||||
|
||||
if (!surface)
|
||||
return FALSE;
|
||||
|
||||
x11->lastMouseClient = client;
|
||||
x += surface->x;
|
||||
y += surface->y;
|
||||
XLockDisplay(subsystem->display);
|
||||
XTestGrabControl(subsystem->display, True);
|
||||
XTestFakeMotionEvent(subsystem->display, 0, x, y, CurrentTime);
|
||||
XLockDisplay(x11->display);
|
||||
XTestGrabControl(x11->display, True);
|
||||
XTestFakeMotionEvent(x11->display, 0, x, y, CurrentTime);
|
||||
|
||||
if (flags & PTR_XFLAGS_BUTTON1)
|
||||
button = 8;
|
||||
@ -347,12 +381,13 @@ static void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem,
|
||||
down = TRUE;
|
||||
|
||||
if (button)
|
||||
XTestFakeButtonEvent(subsystem->display, button, down, CurrentTime);
|
||||
XTestFakeButtonEvent(x11->display, button, down, CurrentTime);
|
||||
|
||||
XTestGrabControl(subsystem->display, False);
|
||||
XFlush(subsystem->display);
|
||||
XUnlockDisplay(subsystem->display);
|
||||
XTestGrabControl(x11->display, False);
|
||||
XFlush(x11->display);
|
||||
XUnlockDisplay(x11->display);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void x11_shadow_message_free(UINT32 id, SHADOW_MSG_OUT* msg)
|
||||
@ -384,13 +419,13 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
|
||||
int count = 0;
|
||||
int index = 0;
|
||||
|
||||
if (!subsystem || !subsystem->server || !subsystem->server->clients)
|
||||
if (!subsystem || !subsystem->common.server || !subsystem->common.server->clients)
|
||||
return -1;
|
||||
|
||||
templateMsg.xPos = subsystem->pointerX;
|
||||
templateMsg.yPos = subsystem->pointerY;
|
||||
templateMsg.xPos = subsystem->common.pointerX;
|
||||
templateMsg.yPos = subsystem->common.pointerY;
|
||||
templateMsg.Free = x11_shadow_message_free;
|
||||
server = subsystem->server;
|
||||
server = subsystem->common.server;
|
||||
ArrayList_Lock(server->clients);
|
||||
|
||||
for (index = 0; index < ArrayList_Count(server->clients); index++)
|
||||
@ -444,7 +479,7 @@ static int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
|
||||
}
|
||||
|
||||
msg->Free = x11_shadow_message_free;
|
||||
return shadow_client_boardcast_msg(subsystem->server, NULL, msgId,
|
||||
return shadow_client_boardcast_msg(subsystem->common.server, NULL, msgId,
|
||||
(SHADOW_MSG_OUT*) msg, NULL) ? 1 : -1;
|
||||
}
|
||||
|
||||
@ -453,7 +488,7 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
|
||||
int x = 0, y = 0, n, k;
|
||||
rdpShadowServer* server;
|
||||
rdpShadowSurface* surface;
|
||||
server = subsystem->server;
|
||||
server = subsystem->common.server;
|
||||
surface = server->surface;
|
||||
|
||||
if (getImage)
|
||||
@ -522,10 +557,10 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
|
||||
y -= surface->y;
|
||||
}
|
||||
|
||||
if ((x != subsystem->pointerX) || (y != subsystem->pointerY))
|
||||
if ((x != subsystem->common.pointerX) || (y != subsystem->common.pointerY))
|
||||
{
|
||||
subsystem->pointerX = x;
|
||||
subsystem->pointerY = y;
|
||||
subsystem->common.pointerX = x;
|
||||
subsystem->common.pointerY = y;
|
||||
x11_shadow_pointer_position_update(subsystem);
|
||||
}
|
||||
|
||||
@ -594,13 +629,13 @@ static int x11_shadow_blend_cursor(x11ShadowSubsystem* subsystem)
|
||||
if (!subsystem)
|
||||
return -1;
|
||||
|
||||
surface = subsystem->server->surface;
|
||||
surface = subsystem->common.server->surface;
|
||||
nXSrc = 0;
|
||||
nYSrc = 0;
|
||||
nWidth = subsystem->cursorWidth;
|
||||
nHeight = subsystem->cursorHeight;
|
||||
nXDst = subsystem->pointerX - subsystem->cursorHotX;
|
||||
nYDst = subsystem->pointerY - subsystem->cursorHotY;
|
||||
nXDst = subsystem->common.pointerX - subsystem->cursorHotX;
|
||||
nYDst = subsystem->common.pointerY - subsystem->cursorHotY;
|
||||
|
||||
if (nXDst >= surface->width)
|
||||
return 1;
|
||||
@ -687,11 +722,11 @@ static BOOL x11_shadow_check_resize(x11ShadowSubsystem* subsystem)
|
||||
if (attr.width != subsystem->width || attr.height != subsystem->height)
|
||||
{
|
||||
/* Screen size changed. Refresh monitor definitions and trigger screen resize */
|
||||
subsystem->numMonitors = x11_shadow_enum_monitors(subsystem->monitors, 16);
|
||||
shadow_screen_resize(subsystem->server->screen);
|
||||
subsystem->common.numMonitors = x11_shadow_enum_monitors(subsystem->common.monitors, 16);
|
||||
shadow_screen_resize(subsystem->common.server->screen);
|
||||
subsystem->width = attr.width;
|
||||
subsystem->height = attr.height;
|
||||
virtualScreen = &(subsystem->virtualScreen);
|
||||
virtualScreen = &(subsystem->common.virtualScreen);
|
||||
virtualScreen->left = 0;
|
||||
virtualScreen->top = 0;
|
||||
virtualScreen->right = subsystem->width;
|
||||
@ -732,7 +767,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
|
||||
RECTANGLE_16 invalidRect;
|
||||
RECTANGLE_16 surfaceRect;
|
||||
const RECTANGLE_16* extents;
|
||||
server = subsystem->server;
|
||||
server = subsystem->common.server;
|
||||
surface = server->surface;
|
||||
count = ArrayList_Count(server->clients);
|
||||
|
||||
@ -815,7 +850,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
|
||||
client = (rdpShadowClient*) ArrayList_GetItem(server->clients, 0);
|
||||
|
||||
if (client)
|
||||
subsystem->captureFrameRate = shadow_encoder_preferred_fps(client->encoder);
|
||||
subsystem->common.captureFrameRate = shadow_encoder_preferred_fps(client->encoder);
|
||||
}
|
||||
|
||||
region16_clear(&(surface->invalidRegion));
|
||||
@ -870,12 +905,12 @@ static DWORD WINAPI x11_shadow_subsystem_thread(LPVOID arg)
|
||||
HANDLE events[32];
|
||||
wMessage message;
|
||||
wMessagePipe* MsgPipe;
|
||||
MsgPipe = subsystem->MsgPipe;
|
||||
MsgPipe = subsystem->common.MsgPipe;
|
||||
nCount = 0;
|
||||
events[nCount++] = subsystem->event;
|
||||
events[nCount++] = subsystem->common.event;
|
||||
events[nCount++] = MessageQueue_Event(MsgPipe->In);
|
||||
subsystem->captureFrameRate = 16;
|
||||
dwInterval = 1000 / subsystem->captureFrameRate;
|
||||
subsystem->common.captureFrameRate = 16;
|
||||
dwInterval = 1000 / subsystem->common.captureFrameRate;
|
||||
frameTime = GetTickCount64() + dwInterval;
|
||||
|
||||
while (1)
|
||||
@ -895,7 +930,7 @@ static DWORD WINAPI x11_shadow_subsystem_thread(LPVOID arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (WaitForSingleObject(subsystem->event, 0) == WAIT_OBJECT_0)
|
||||
if (WaitForSingleObject(subsystem->common.event, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
XLockDisplay(subsystem->display);
|
||||
|
||||
@ -913,7 +948,7 @@ static DWORD WINAPI x11_shadow_subsystem_thread(LPVOID arg)
|
||||
x11_shadow_check_resize(subsystem);
|
||||
x11_shadow_screen_grab(subsystem);
|
||||
x11_shadow_query_cursor(subsystem, FALSE);
|
||||
dwInterval = 1000 / subsystem->captureFrameRate;
|
||||
dwInterval = 1000 / subsystem->common.captureFrameRate;
|
||||
frameTime += dwInterval;
|
||||
}
|
||||
}
|
||||
@ -1198,7 +1233,7 @@ static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
|
||||
if (!subsystem)
|
||||
return -1;
|
||||
|
||||
subsystem->numMonitors = x11_shadow_enum_monitors(subsystem->monitors, 16);
|
||||
subsystem->common.numMonitors = x11_shadow_enum_monitors(subsystem->common.monitors, 16);
|
||||
x11_shadow_subsystem_base_init(subsystem);
|
||||
|
||||
if ((subsystem->depth != 24) && (subsystem->depth != 32))
|
||||
@ -1304,11 +1339,11 @@ static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
|
||||
subsystem->use_xdamage = FALSE;
|
||||
}
|
||||
|
||||
if (!(subsystem->event = CreateFileDescriptorEvent(NULL, FALSE, FALSE,
|
||||
subsystem->xfds, WINPR_FD_READ)))
|
||||
if (!(subsystem->common.event = CreateFileDescriptorEvent(NULL, FALSE, FALSE,
|
||||
subsystem->xfds, WINPR_FD_READ)))
|
||||
return -1;
|
||||
|
||||
virtualScreen = &(subsystem->virtualScreen);
|
||||
virtualScreen = &(subsystem->common.virtualScreen);
|
||||
virtualScreen->left = 0;
|
||||
virtualScreen->top = 0;
|
||||
virtualScreen->right = subsystem->width;
|
||||
@ -1334,10 +1369,10 @@ static int x11_shadow_subsystem_uninit(rdpShadowSubsystem* sub)
|
||||
subsystem->display = NULL;
|
||||
}
|
||||
|
||||
if (subsystem->event)
|
||||
if (subsystem->common.event)
|
||||
{
|
||||
CloseHandle(subsystem->event);
|
||||
subsystem->event = NULL;
|
||||
CloseHandle(subsystem->common.event);
|
||||
subsystem->common.event = NULL;
|
||||
}
|
||||
|
||||
if (subsystem->cursorPixels)
|
||||
@ -1375,7 +1410,7 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
|
||||
|
||||
if (subsystem->thread)
|
||||
{
|
||||
if (MessageQueue_PostQuit(subsystem->MsgPipe->In, 0))
|
||||
if (MessageQueue_PostQuit(subsystem->common.MsgPipe->In, 0))
|
||||
WaitForSingleObject(subsystem->thread, INFINITE);
|
||||
|
||||
CloseHandle(subsystem->thread);
|
||||
@ -1394,17 +1429,13 @@ static rdpShadowSubsystem* x11_shadow_subsystem_new(void)
|
||||
return NULL;
|
||||
|
||||
#ifdef WITH_PAM
|
||||
subsystem->Authenticate = (pfnShadowAuthenticate) x11_shadow_pam_authenticate;
|
||||
subsystem->common.Authenticate = x11_shadow_pam_authenticate;
|
||||
#endif
|
||||
subsystem->SynchronizeEvent = (pfnShadowSynchronizeEvent)
|
||||
x11_shadow_input_synchronize_event;
|
||||
subsystem->KeyboardEvent = (pfnShadowKeyboardEvent)
|
||||
x11_shadow_input_keyboard_event;
|
||||
subsystem->UnicodeKeyboardEvent = (pfnShadowUnicodeKeyboardEvent)
|
||||
x11_shadow_input_unicode_keyboard_event;
|
||||
subsystem->MouseEvent = (pfnShadowMouseEvent) x11_shadow_input_mouse_event;
|
||||
subsystem->ExtendedMouseEvent = (pfnShadowExtendedMouseEvent)
|
||||
x11_shadow_input_extended_mouse_event;
|
||||
subsystem->common.SynchronizeEvent = x11_shadow_input_synchronize_event;
|
||||
subsystem->common.KeyboardEvent = x11_shadow_input_keyboard_event;
|
||||
subsystem->common.UnicodeKeyboardEvent = x11_shadow_input_unicode_keyboard_event;
|
||||
subsystem->common.MouseEvent = x11_shadow_input_mouse_event;
|
||||
subsystem->common.ExtendedMouseEvent = x11_shadow_input_extended_mouse_event;
|
||||
subsystem->composite = FALSE;
|
||||
subsystem->use_xshm = FALSE; /* temporarily disabled */
|
||||
subsystem->use_xfixes = TRUE;
|
||||
|
@ -53,7 +53,7 @@ typedef struct x11_shadow_subsystem x11ShadowSubsystem;
|
||||
|
||||
struct x11_shadow_subsystem
|
||||
{
|
||||
RDP_SHADOW_SUBSYSTEM_COMMON();
|
||||
rdpShadowSubsystem common;
|
||||
|
||||
HANDLE thread;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "shadow.h"
|
||||
|
||||
BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
static BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
{
|
||||
rdpShadowClient* client = (rdpShadowClient*) input->context;
|
||||
rdpShadowSubsystem* subsystem = client->server->subsystem;
|
||||
@ -30,29 +30,10 @@ BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
if (!client->mayInteract)
|
||||
return TRUE;
|
||||
|
||||
if (subsystem->SynchronizeEvent)
|
||||
{
|
||||
subsystem->SynchronizeEvent(subsystem, client, flags);
|
||||
}
|
||||
return TRUE;
|
||||
return IFCALLRESULT(TRUE, subsystem->SynchronizeEvent, subsystem, client, flags);
|
||||
}
|
||||
|
||||
BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
rdpShadowClient* client = (rdpShadowClient*) input->context;
|
||||
rdpShadowSubsystem* subsystem = client->server->subsystem;
|
||||
|
||||
if (!client->mayInteract)
|
||||
return TRUE;
|
||||
|
||||
if (subsystem->KeyboardEvent)
|
||||
{
|
||||
subsystem->KeyboardEvent(subsystem, client, flags, code);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
static BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
rdpShadowClient* client = (rdpShadowClient*) input->context;
|
||||
rdpShadowSubsystem* subsystem = client->server->subsystem;
|
||||
@ -60,14 +41,21 @@ BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 c
|
||||
if (!client->mayInteract)
|
||||
return TRUE;
|
||||
|
||||
if (subsystem->UnicodeKeyboardEvent)
|
||||
{
|
||||
subsystem->UnicodeKeyboardEvent(subsystem, client, flags, code);
|
||||
}
|
||||
return TRUE;
|
||||
return IFCALLRESULT(TRUE, subsystem->KeyboardEvent, subsystem, client, flags, code);
|
||||
}
|
||||
|
||||
BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
static BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
rdpShadowClient* client = (rdpShadowClient*) input->context;
|
||||
rdpShadowSubsystem* subsystem = client->server->subsystem;
|
||||
|
||||
if (!client->mayInteract)
|
||||
return TRUE;
|
||||
|
||||
return IFCALLRESULT(TRUE, subsystem->UnicodeKeyboardEvent, subsystem, client, flags, code);
|
||||
}
|
||||
|
||||
static BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
rdpShadowClient* client = (rdpShadowClient*) input->context;
|
||||
rdpShadowSubsystem* subsystem = client->server->subsystem;
|
||||
@ -84,7 +72,7 @@ BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
client->pointerY = y;
|
||||
|
||||
if ((client->pointerX == subsystem->pointerX) &&
|
||||
(client->pointerY == subsystem->pointerY))
|
||||
(client->pointerY == subsystem->pointerY))
|
||||
{
|
||||
flags &= ~PTR_FLAGS_MOVE;
|
||||
|
||||
@ -96,14 +84,10 @@ BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
if (!client->mayInteract)
|
||||
return TRUE;
|
||||
|
||||
if (subsystem->MouseEvent)
|
||||
{
|
||||
subsystem->MouseEvent(subsystem, client, flags, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
return IFCALLRESULT(TRUE, subsystem->MouseEvent, subsystem, client, flags, x, y);
|
||||
}
|
||||
|
||||
BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
static BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
rdpShadowClient* client = (rdpShadowClient*) input->context;
|
||||
rdpShadowSubsystem* subsystem = client->server->subsystem;
|
||||
@ -120,11 +104,7 @@ BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x,
|
||||
if (!client->mayInteract)
|
||||
return TRUE;
|
||||
|
||||
if (subsystem->ExtendedMouseEvent)
|
||||
{
|
||||
subsystem->ExtendedMouseEvent(subsystem, client, flags, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
return IFCALLRESULT(TRUE, subsystem->ExtendedMouseEvent, subsystem, client, flags, x, y);
|
||||
}
|
||||
|
||||
void shadow_input_register_callbacks(rdpInput* input)
|
||||
|
Loading…
Reference in New Issue
Block a user