21#include <freerdp/config.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 "../xf_cmdline.h"
33#include "../xfreerdp.h"
35static void xfreerdp_print_help(
void)
37 printf(
"Keyboard Shortcuts:\n");
38 printf(
"\t<Right CTRL>\n");
39 printf(
"\t\treleases keyboard and mouse grab\n");
40 printf(
"\t<CTRL>+<ALT>+<Return>\n");
41 printf(
"\t\ttoggles fullscreen state of the application\n");
42 printf(
"\t<CTRL>+<ALT>+c\n");
43 printf(
"\t\ttoggles remote control in a remote assistance session\n");
44 printf(
"\t<CTRL>+<ALT>+m\n");
45 printf(
"\t\tminimizes the application\n");
46 printf(
"\tAction Script\n");
47 printf(
"\t\tExecutes a predefined script on key press.\n");
48 printf(
"\t\tShould the script not exist it is ignored.\n");
49 printf(
"\t\tScripts can be provided at the default location ~/.config/freerdp/action.sh or as "
50 "command line argument /action:script:<path>\n");
51 printf(
"\t\tThe script will receive the current key combination as argument.\n");
52 printf(
"\t\tThe output of the script is parsed for 'key-local' which tells that the script "
53 "used the key combination, otherwise the combination is forwarded to the remote.\n");
56int main(
int argc,
char* argv[])
60 HANDLE thread =
nullptr;
61 xfContext* xfc =
nullptr;
63 rdpContext* context =
nullptr;
64 rdpSettings* settings =
nullptr;
65 RDP_CLIENT_ENTRY_POINTS clientEntryPoints = WINPR_C_ARRAY_INIT;
67 clientEntryPoints.Size =
sizeof(RDP_CLIENT_ENTRY_POINTS);
68 clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;
70 RdpClientEntry(&clientEntryPoints);
72 context = freerdp_client_context_new(&clientEntryPoints);
76 settings = context->settings;
77 xfc = (xfContext*)context;
79 status = xf_client_settings_parse_command_line(xfc, argc, argv);
82 rc = xf_client_settings_command_line_status_print(xfc, status, argc, argv);
85 xf_list_monitors(xfc);
90 case COMMAND_LINE_STATUS_PRINT:
91 case COMMAND_LINE_STATUS_PRINT_VERSION:
92 case COMMAND_LINE_STATUS_PRINT_BUILDCONFIG:
94 case COMMAND_LINE_STATUS_PRINT_HELP:
95 xfreerdp_print_help();
104 if (!stream_dump_register_handlers(context, CONNECTION_STATE_MCS_CREATE_REQUEST, FALSE))
107 if (freerdp_client_start(context) != 0)
110 thread = freerdp_client_get_thread(context);
112 (void)WaitForSingleObject(thread, INFINITE);
113 if (!GetExitCodeThread(thread, &dwExitCode))
115 rc = xf_exit_code_from_disconnect_reason(dwExitCode);
117 freerdp_client_stop(context);
120 freerdp_client_context_free(context);
WINPR_ATTR_NODISCARD FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.