[client,x11] add minimize shortcut

This commit is contained in:
akallabeth 2024-09-10 11:52:15 +02:00
parent d93d9765b3
commit 215f798665
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
5 changed files with 54 additions and 12 deletions

View File

@ -40,6 +40,8 @@ static void xfreerdp_print_help(void)
printf("\t\ttoggles fullscreen state of the application\n");
printf("\t<CTRL>+<ALT>+c\n");
printf("\t\ttoggles remote control in a remote assistance session\n");
printf("\t<CTRL>+<ALT>+m\n");
printf("\t\tminimizes the application\n");
printf("\tAction Script\n");
printf("\t\tExecutes a predefined script on key press.\n");
printf("\t\tShould the script not exist it is ignored.\n");

View File

@ -10,6 +10,10 @@
<listitem><para>toggles fullscreen state of the application</para></listitem>
</varlistentry>
<varlistentry>
<term>&lt;CTRL&gt;+&lt;ALT&gt;+&lt;m&gt;</term>
<listitem><para>Minimizes the application</para></listitem>
</varlistentry>
<varlistentry>
<term>&lt;CTRL&gt;+&lt;ALT&gt;+c</term>
<listitem><para>toggles remote control in a remote assistance session</para></listitem>
</varlistentry>

View File

@ -762,7 +762,7 @@ static void xf_window_free(xfContext* xfc)
void xf_toggle_fullscreen(xfContext* xfc)
{
WindowStateChangeEventArgs e;
WindowStateChangeEventArgs e = { 0 };
rdpContext* context = (rdpContext*)xfc;
rdpSettings* settings = context->settings;
@ -782,6 +782,28 @@ void xf_toggle_fullscreen(xfContext* xfc)
PubSub_OnWindowStateChange(context->pubSub, context, &e);
}
void xf_minimize(xfContext* xfc)
{
WindowStateChangeEventArgs e = { 0 };
rdpContext* context = (rdpContext*)xfc;
WINPR_ASSERT(context);
rdpSettings* settings = context->settings;
WINPR_ASSERT(settings);
/*
when debugging, ungrab keyboard when toggling fullscreen
to allow keyboard usage on the debugger
*/
if (xfc->debug)
xf_ungrab(xfc);
xf_SetWindowMinimized(xfc, xfc->window);
e.state = xfc->fullscreen ? FREERDP_WINDOW_STATE_FULLSCREEN : 0;
PubSub_OnWindowStateChange(context->pubSub, context, &e);
}
void xf_lock_x11_(xfContext* xfc, const char* fkt)
{

View File

@ -588,24 +588,37 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym)
if (!xfc->remote_app && xfc->fullscreen_toggle)
{
if (keysym == XK_Return)
switch (keysym)
{
if (mod.Ctrl && mod.Alt)
{
/* Ctrl-Alt-Enter: toggle full screen */
xf_toggle_fullscreen(xfc);
return TRUE;
}
case XK_Return:
if (mod.Ctrl && mod.Alt)
{
/* Ctrl-Alt-Enter: toggle full screen */
xf_toggle_fullscreen(xfc);
return TRUE;
}
break;
default:
break;
}
}
if ((keysym == XK_c) || (keysym == XK_C))
if (mod.Ctrl && mod.Alt)
{
if (mod.Ctrl && mod.Alt)
switch (keysym)
{
/* Ctrl-Alt-C: toggle control */
if (freerdp_client_encomsp_toggle_control(xfc->common.encomsp))
case XK_m:
case XK_M:
xf_minimize(xfc);
return TRUE;
case XK_c:
case XK_C:
/* Ctrl-Alt-C: toggle control */
if (freerdp_client_encomsp_toggle_control(xfc->common.encomsp))
return TRUE;
break;
default:
break;
}
}

View File

@ -312,6 +312,7 @@ struct xf_context
BOOL xf_create_window(xfContext* xfc);
BOOL xf_create_image(xfContext* xfc);
void xf_toggle_fullscreen(xfContext* xfc);
void xf_minimize(xfContext* xfc);
enum XF_EXIT_CODE
{