21 #include <freerdp/config.h>
23 #include <winpr/crt.h>
24 #include <winpr/synch.h>
25 #include <winpr/thread.h>
27 #include <freerdp/streamdump.h>
28 #include <freerdp/freerdp.h>
29 #include <freerdp/client/cmdline.h>
31 #include "../xf_client.h"
32 #include "../xfreerdp.h"
34 static void xfreerdp_print_help(
void)
36 printf(
"Keyboard Shortcuts:\n");
37 printf(
"\t<Right CTRL>\n");
38 printf(
"\t\treleases keyboard and mouse grab\n");
39 printf(
"\t<CTRL>+<ALT>+<Return>\n");
40 printf(
"\t\ttoggles fullscreen state of the application\n");
41 printf(
"\t<CTRL>+<ALT>+c\n");
42 printf(
"\t\ttoggles remote control in a remote assistance session\n");
43 printf(
"\t<CTRL>+<ALT>+m\n");
44 printf(
"\t\tminimizes the application\n");
45 printf(
"\tAction Script\n");
46 printf(
"\t\tExecutes a predefined script on key press.\n");
47 printf(
"\t\tShould the script not exist it is ignored.\n");
48 printf(
"\t\tScripts can be provided at the default location ~/.config/freerdp/action.sh or as "
49 "command line argument /action:script:<path>\n");
50 printf(
"\t\tThe script will receive the current key combination as argument.\n");
51 printf(
"\t\tThe output of the script is parsed for 'key-local' which tells that the script "
52 "used the key combination, otherwise the combination is forwarded to the remote.\n");
55 int main(
int argc,
char* argv[])
60 xfContext* xfc = NULL;
62 rdpContext* context = NULL;
63 rdpSettings* settings = NULL;
64 RDP_CLIENT_ENTRY_POINTS clientEntryPoints = { 0 };
66 clientEntryPoints.Size =
sizeof(RDP_CLIENT_ENTRY_POINTS);
67 clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;
69 RdpClientEntry(&clientEntryPoints);
71 context = freerdp_client_context_new(&clientEntryPoints);
75 settings = context->settings;
76 xfc = (xfContext*)context;
78 status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE);
81 rc = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
84 xf_list_monitors(xfc);
89 case COMMAND_LINE_STATUS_PRINT:
90 case COMMAND_LINE_STATUS_PRINT_VERSION:
91 case COMMAND_LINE_STATUS_PRINT_BUILDCONFIG:
93 case COMMAND_LINE_STATUS_PRINT_HELP:
95 xfreerdp_print_help();
102 if (!stream_dump_register_handlers(context, CONNECTION_STATE_MCS_CREATE_REQUEST, FALSE))
105 if (freerdp_client_start(context) != 0)
108 thread = freerdp_client_get_thread(context);
110 (void)WaitForSingleObject(thread, INFINITE);
111 GetExitCodeThread(thread, &dwExitCode);
112 rc = xf_exit_code_from_disconnect_reason(dwExitCode);
114 freerdp_client_stop(context);
117 freerdp_client_context_free(context);
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.