19 #include <freerdp/config.h>
23 static BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
25 rdpShadowClient* client = (rdpShadowClient*)input->context;
26 rdpShadowSubsystem* subsystem = client->server->subsystem;
28 if (!client->mayInteract)
31 return IFCALLRESULT(TRUE, subsystem->SynchronizeEvent, subsystem, client, flags);
34 static BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
36 rdpShadowClient* client = (rdpShadowClient*)input->context;
37 rdpShadowSubsystem* subsystem = client->server->subsystem;
39 if (!client->mayInteract)
42 return IFCALLRESULT(TRUE, subsystem->KeyboardEvent, subsystem, client, flags, code);
45 static BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
47 rdpShadowClient* client = (rdpShadowClient*)input->context;
48 rdpShadowSubsystem* subsystem = client->server->subsystem;
50 if (!client->mayInteract)
53 return IFCALLRESULT(TRUE, subsystem->UnicodeKeyboardEvent, subsystem, client, flags, code);
56 static BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
58 rdpShadowClient* client = (rdpShadowClient*)input->context;
59 rdpShadowSubsystem* subsystem = client->server->subsystem;
61 if (client->server->shareSubRect)
63 x += client->server->subRect.left;
64 y += client->server->subRect.top;
67 if (!(flags & PTR_FLAGS_WHEEL))
72 if ((client->pointerX == subsystem->pointerX) && (client->pointerY == subsystem->pointerY))
74 flags &= ~PTR_FLAGS_MOVE;
76 if (!(flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3)))
81 if (!client->mayInteract)
84 return IFCALLRESULT(TRUE, subsystem->MouseEvent, subsystem, client, flags, x, y);
87 static BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
89 rdpShadowClient* client = (rdpShadowClient*)input->context;
90 rdpShadowSubsystem* subsystem = client->server->subsystem;
92 if (client->server->shareSubRect)
94 x += client->server->subRect.left;
95 y += client->server->subRect.top;
101 if (!client->mayInteract)
104 return IFCALLRESULT(TRUE, subsystem->ExtendedMouseEvent, subsystem, client, flags, x, y);
107 void shadow_input_register_callbacks(rdpInput* input)
109 input->SynchronizeEvent = shadow_input_synchronize_event;
110 input->KeyboardEvent = shadow_input_keyboard_event;
111 input->UnicodeKeyboardEvent = shadow_input_unicode_keyboard_event;
112 input->MouseEvent = shadow_input_mouse_event;
113 input->ExtendedMouseEvent = shadow_input_extended_mouse_event;