diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:25:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:25:11 +0000 |
commit | 941f9937e0744d18de4cc0afa71e0caa925d82ac (patch) | |
tree | 67872b86dbf72d73e91188bf8de12594668fe4aa /client/X11 | |
parent | Adding upstream version 3.3.0+dfsg1. (diff) | |
download | freerdp3-941f9937e0744d18de4cc0afa71e0caa925d82ac.tar.xz freerdp3-941f9937e0744d18de4cc0afa71e0caa925d82ac.zip |
Adding upstream version 3.5.0+dfsg1.upstream/3.5.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'client/X11')
-rw-r--r-- | client/X11/CMakeLists.txt | 65 | ||||
-rw-r--r-- | client/X11/cli/CMakeLists.txt | 20 | ||||
-rw-r--r-- | client/X11/cli/xfreerdp.c | 21 | ||||
-rw-r--r-- | client/X11/man/CMakeLists.txt | 7 | ||||
-rw-r--r-- | client/X11/man/xfreerdp-shortcuts.1.xml | 25 | ||||
-rw-r--r-- | client/X11/man/xfreerdp.1.xml.in | 3 | ||||
-rw-r--r-- | client/X11/xf_client.c | 5 | ||||
-rw-r--r-- | client/X11/xf_cliprdr.c | 40 | ||||
-rw-r--r-- | client/X11/xf_event.c | 26 | ||||
-rw-r--r-- | client/X11/xf_input.c | 29 | ||||
-rw-r--r-- | client/X11/xf_keyboard.c | 12 | ||||
-rw-r--r-- | client/X11/xf_window.c | 1 | ||||
-rw-r--r-- | client/X11/xfreerdp.h | 2 |
13 files changed, 145 insertions, 111 deletions
diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 099d00d..bf7c842 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT FREERDP_DEFAULT_PROJECT_VERSION) set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(xfreerdp +project(xfreerdp-client LANGUAGES C VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} ) @@ -84,29 +84,14 @@ if (CHANNEL_TSMF_CLIENT) ) endif() -if(WITH_CLIENT_INTERFACE) - if(CLIENT_INTERFACE_SHARED) - add_library(${PROJECT_NAME} SHARED ${SRCS}) - if (WITH_LIBRARY_VERSIONING) - set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) - endif() - else() - add_library(${PROJECT_NAME} ${SRCS}) - endif() - target_include_directories(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>) - +if(CLIENT_INTERFACE_SHARED) + AddTargetWithResourceFile(${PROJECT_NAME} "SHARED" "${PROJECT_VERSION}" SRCS) else() - list(APPEND SRCS - cli/xfreerdp.c xfreerdp.h - ) - add_executable(${PROJECT_NAME} ${SRCS}) - if (WITH_BINARY_VERSIONING) - set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}") - endif() - include_directories(..) + AddTargetWithResourceFile(${PROJECT_NAME} "STATIC" "${PROJECT_VERSION}" SRCS) endif() +target_include_directories(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>) -set(LIBS +set(PRIV_LIBS ${X11_LIBRARIES} ) @@ -116,7 +101,7 @@ find_package(X11 REQUIRED) if(X11_XShm_FOUND) add_definitions(-DWITH_XSHM) include_directories(${X11_XShm_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xext_LIB} ) endif() @@ -128,7 +113,7 @@ if (WITH_XINERAMA) if(X11_Xinerama_FOUND) add_definitions(-DWITH_XINERAMA) include_directories(${X11_Xinerama_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xinerama_LIB} ) endif() @@ -139,7 +124,7 @@ if (WITH_XEXT) find_package(X11 REQUIRED) if(X11_Xext_FOUND) add_definitions(-DWITH_XEXT) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xext_LIB} ) endif() @@ -151,7 +136,7 @@ if (WITH_XCURSOR) if(X11_Xcursor_FOUND) add_definitions(-DWITH_XCURSOR) include_directories(${X11_Xcursor_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xcursor_LIB} ) endif() @@ -163,7 +148,7 @@ if (WITH_XV) if(X11_Xv_FOUND) add_definitions(-DWITH_XV) include_directories(${X11_Xv_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xv_LIB} ) endif() @@ -175,7 +160,7 @@ if (WITH_XI) if(X11_Xi_FOUND) add_definitions(-DWITH_XI) include_directories(${X11_Xi_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xi_LIB} ) endif() @@ -187,7 +172,7 @@ if(WITH_XRENDER) if(X11_Xrender_FOUND) add_definitions(-DWITH_XRENDER) include_directories(${X11_Xrender_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xrender_LIB} ) endif() @@ -199,7 +184,7 @@ if (WITH_XRANDR) if(X11_Xrandr_FOUND) add_definitions(-DWITH_XRANDR) include_directories(${X11_Xrandr_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xrandr_LIB} ) endif() @@ -211,7 +196,7 @@ if (WITH_XFIXES) if(X11_Xfixes_FOUND) add_definitions(-DWITH_XFIXES) include_directories(${X11_Xfixes_INCLUDE_PATH}) - list(APPEND LIBS + list(APPEND PRIV_LIBS ${X11_Xfixes_LIB} ) endif() @@ -219,27 +204,23 @@ endif() include_directories(${PROJECT_SOURCE_DIR}/resources) -list(APPEND LIBS +list(APPEND PUB_LIBS freerdp-client - freerdp +) + +list(APPEND PRIV_LIBS m ) if (NOT APPLE) - list(APPEND LIBS rt) + list(APPEND PRIV_LIBS rt) endif() -target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS}) +target_link_libraries(${PROJECT_NAME} PUBLIC ${PUB_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${PRIV_LIBS}) -if(WITH_IPP) - target_link_libraries(${PROJECT_NAME} PRIVATE ${IPP_LIBRARY_LIST}) -endif() - -option(WITH_CLIENT_INTERFACE "Build clients as a library with an interface" OFF) if(WITH_CLIENT_INTERFACE) install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) - add_subdirectory(cli) -else() - install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client) endif() +add_subdirectory(cli) set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Client/X11") diff --git a/client/X11/cli/CMakeLists.txt b/client/X11/cli/CMakeLists.txt index 580337b..0761b2f 100644 --- a/client/X11/cli/CMakeLists.txt +++ b/client/X11/cli/CMakeLists.txt @@ -15,32 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(MODULE_NAME "xfreerdp-cli") +set(MODULE_NAME "xfreerdp") set(MODULE_PREFIX "FREERDP_CLIENT_X11") set(SRCS - xfreerdp.c + xfreerdp.c ) -add_executable(${MODULE_NAME} ${SRCS}) - -if (WITH_BINARY_VERSIONING) - set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp${PROJECT_VERSION_MAJOR}") -else() - set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp") -endif() +AddTargetWithResourceFile(${MODULE_NAME} TRUE "${PROJECT_VERSION}" SRCS) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "..") list(APPEND LIBS - xfreerdp-client freerdp-client + xfreerdp-client ) -if(OPENBSD) - list(APPEND LIBS - ossaudio - ) -endif() - target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client) diff --git a/client/X11/cli/xfreerdp.c b/client/X11/cli/xfreerdp.c index 33b2a96..4bdaf4c 100644 --- a/client/X11/cli/xfreerdp.c +++ b/client/X11/cli/xfreerdp.c @@ -31,6 +31,25 @@ #include "../xf_client.h" #include "../xfreerdp.h" +static void xfreerdp_print_help(void) +{ + printf("Keyboard Shortcuts:\n"); + printf("\t<Right CTRL>\n"); + printf("\t\treleases keyboard and mouse grab\n"); + printf("\t<CTRL>+<ALT>+<Return>\n"); + 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("\tAction Script\n"); + printf("\t\tExecutes a predefined script on key press.\n"); + printf("\t\tShould the script not exist it is ignored.\n"); + printf("\t\tScripts can be provided at the default localtion ~/.config/freerdp/action.sh or as " + "command line argument /action:script:<path>\n"); + printf("\t\tThe script will receive the current key combination as argument.\n"); + printf("\t\tThe output of the script is parsed for 'key-local' which tells that the script " + "used the key combination, otherwise the combination is forwarded to the remote.\n"); +} + int main(int argc, char* argv[]) { int rc = 1; @@ -59,6 +78,8 @@ int main(int argc, char* argv[]) { rc = freerdp_client_settings_command_line_status_print(settings, status, argc, argv); + xfreerdp_print_help(); + if (freerdp_settings_get_bool(settings, FreeRDP_ListMonitors)) xf_list_monitors(xfc); diff --git a/client/X11/man/CMakeLists.txt b/client/X11/man/CMakeLists.txt index 386f13d..ed50e63 100644 --- a/client/X11/man/CMakeLists.txt +++ b/client/X11/man/CMakeLists.txt @@ -1,11 +1,8 @@ set(DEPS xfreerdp-channels.1.xml xfreerdp-examples.1.xml + xfreerdp-shortcuts.1.xml xfreerdp-envvar.1.xml ) -set(MANPAGE_NAME ${PROJECT_NAME}) -if (WITH_BINARY_VERSIONING) - set(MANPAGE_NAME ${PROJECT_NAME}${PROJECT_VERSION_MAJOR}) -endif() -generate_and_install_freerdp_man_from_xml(${PROJECT_NAME}.1 ${MANPAGE_NAME}.1 ${DEPS}) +generate_and_install_freerdp_man_from_xml("xfreerdp" "1" "${FREERDP_API_VERSION}" ${DEPS}) diff --git a/client/X11/man/xfreerdp-shortcuts.1.xml b/client/X11/man/xfreerdp-shortcuts.1.xml new file mode 100644 index 0000000..a6b96ea --- /dev/null +++ b/client/X11/man/xfreerdp-shortcuts.1.xml @@ -0,0 +1,25 @@ +<refsect1> + <title>Keyboard Shortcuts</title> + <variablelist> + <varlistentry> + <term><Right CTRL></term> + <listitem><para>releases keyboard and mouse grab</para></listitem> + </varlistentry> + <varlistentry> + <term><CTRL>+<ALT>+<Return></term> + <listitem><para>toggles fullscreen state of the application</para></listitem> + </varlistentry> + <varlistentry> + <term><CTRL>+<ALT>+c</term> + <listitem><para>toggles remote control in a remote assistance session</para></listitem> + </varlistentry> + <varlistentry> + <term>Action Script</term> + <listitem><para>executes a predefined script on key press.</para></listitem> + <listitem><para>Should the script not exist it is ignored.</para></listitem> + <listitem><para>Scripts can be provided at the default localtion ~/.config/freerdp/action.sh or as command line argument /action:script:<path>.</para></listitem> + <listitem><para>The script will receive the current key combination as argument.</para></listitem> + <listitem><para>The output of the script is parsed for key-local which tells that the script used the key combination, otherwise the combination is forwarded to the remote.</para></listitem> + </varlistentry> + </variablelist> +</refsect1> diff --git a/client/X11/man/xfreerdp.1.xml.in b/client/X11/man/xfreerdp.1.xml.in index 271e39d..7e7c782 100644 --- a/client/X11/man/xfreerdp.1.xml.in +++ b/client/X11/man/xfreerdp.1.xml.in @@ -3,6 +3,7 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ <!ENTITY syntax SYSTEM "freerdp-argument.1.xml"> + <!ENTITY shortcuts SYSTEM "xfreerdp-shortcuts.1.xml"> <!ENTITY channels SYSTEM "xfreerdp-channels.1.xml"> <!ENTITY envvar SYSTEM "xfreerdp-envvar.1.xml"> <!ENTITY examples SYSTEM "xfreerdp-examples.1.xml"> @@ -49,6 +50,8 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" &syntax; + &shortcuts; + &channels; &envvar; diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 0f51745..7324bdc 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -1156,11 +1156,10 @@ static BOOL xf_pre_connect(freerdp* instance) { if (!xf_keyboard_init(xfc)) return FALSE; + if (!xf_detect_monitors(xfc, &maxWidth, &maxHeight)) + return FALSE; } - if (!xf_detect_monitors(xfc, &maxWidth, &maxHeight)) - return FALSE; - if (maxWidth && maxHeight && !freerdp_settings_get_bool(settings, FreeRDP_SmartSizing)) { if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, maxWidth)) diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index a68dae9..de92b41 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -181,7 +181,7 @@ static xfCachedData* xf_cached_data_new(BYTE* data, UINT32 data_length) return cached_data; } -static xfCachedData* xf_cached_data_new_copy(BYTE* data, UINT32 data_length) +static xfCachedData* xf_cached_data_new_copy(const BYTE* data, size_t data_length) { BYTE* copy = NULL; if (data_length > 0) @@ -214,26 +214,28 @@ static void xf_clipboard_free_server_formats(xfClipboard* clipboard) } } -static void xf_cliprdr_check_owner(xfClipboard* clipboard) +static BOOL xf_cliprdr_update_owner(xfClipboard* clipboard) { - Window owner = 0; - xfContext* xfc = NULL; - WINPR_ASSERT(clipboard); - xfc = clipboard->xfc; + xfContext* xfc = clipboard->xfc; WINPR_ASSERT(xfc); - if (clipboard->sync) - { - owner = XGetSelectionOwner(xfc->display, clipboard->clipboard_atom); + if (!clipboard->sync) + return FALSE; - if (clipboard->owner != owner) - { - clipboard->owner = owner; - xf_cliprdr_send_client_format_list(clipboard, FALSE); - } - } + Window owner = XGetSelectionOwner(xfc->display, clipboard->clipboard_atom); + if (clipboard->owner == owner) + return FALSE; + + clipboard->owner = owner; + return TRUE; +} + +static void xf_cliprdr_check_owner(xfClipboard* clipboard) +{ + if (xf_cliprdr_update_owner(clipboard)) + xf_cliprdr_send_client_format_list(clipboard, FALSE); } static BOOL xf_cliprdr_is_self_owned(xfClipboard* clipboard) @@ -580,9 +582,11 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_raw_server_formats(xfClipboard* clipboard, WINPR_ASSERT(xfc); *numFormats = 0; - LogTagAndXGetWindowProperty( - TAG, xfc->display, clipboard->owner, clipboard->raw_format_list_atom, 0, 4096, False, - clipboard->raw_format_list_atom, &type, &format, &length, &remaining, &data); + + Window owner = XGetSelectionOwner(xfc->display, clipboard->clipboard_atom); + LogTagAndXGetWindowProperty(TAG, xfc->display, owner, clipboard->raw_format_list_atom, 0, 4096, + False, clipboard->raw_format_list_atom, &type, &format, &length, + &remaining, &data); if (data && length > 0 && format == 8 && type == clipboard->raw_format_list_atom) { diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index 6bc4c4d..a00a950 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -41,10 +41,13 @@ #define TAG CLIENT_TAG("x11") #define CLAMP_COORDINATES(x, y) \ - if (x < 0) \ - x = 0; \ - if (y < 0) \ - y = 0 + do \ + { \ + if ((x) < 0) \ + (x) = 0; \ + if ((y) < 0) \ + (y) = 0; \ + } while (0) const char* x11_event_string(int event) { @@ -201,7 +204,7 @@ BOOL xf_event_action_script_init(xfContext* xfc) char* context = NULL; strtok_s(buffer, "\n", &context); - if (!buffer || !ArrayList_Append(xfc->xevents, buffer)) + if (!ArrayList_Append(xfc->xevents, buffer)) { pclose(actionScript); ArrayList_Free(xfc->xevents); @@ -447,7 +450,8 @@ static BOOL xf_event_MotionNotify(xfContext* xfc, const XMotionEvent* event, BOO { WINPR_ASSERT(xfc); - if (xfc->xi_event) + if (xfc->xi_event || + (xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common))) return TRUE; if (xfc->window) @@ -556,7 +560,8 @@ static BOOL xf_event_ButtonPress(xfContext* xfc, const XButtonEvent* event, BOOL { xf_grab_mouse(xfc); - if (xfc->xi_event) + if (xfc->xi_event || + (xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common))) return TRUE; return xf_generic_ButtonEvent(xfc, event->x, event->y, event->button, event->window, app, TRUE); } @@ -565,7 +570,8 @@ static BOOL xf_event_ButtonRelease(xfContext* xfc, const XButtonEvent* event, BO { xf_grab_mouse(xfc); - if (xfc->xi_event) + if (xfc->xi_event || + (xfc->common.mouse_grabbed && freerdp_client_use_relative_mouse_events(&xfc->common))) return TRUE; return xf_generic_ButtonEvent(xfc, event->x, event->y, event->button, event->window, app, FALSE); @@ -645,6 +651,8 @@ static BOOL xf_event_FocusIn(xfContext* xfc, const XFocusInEvent* event, BOOL ap * if the WM decided to use an alternate event order */ if (!app) xf_keyboard_release_all_keypress(xfc); + else + xf_rail_send_activate(xfc, event->window, TRUE); xf_pointer_update_scale(xfc); @@ -673,6 +681,8 @@ static BOOL xf_event_FocusOut(xfContext* xfc, const XFocusOutEvent* event, BOOL XUngrabKeyboard(xfc->display, CurrentTime); xf_keyboard_release_all_keypress(xfc); + if (app) + xf_rail_send_activate(xfc, event->window, FALSE); return TRUE; } diff --git a/client/X11/xf_input.c b/client/X11/xf_input.c index f1cdc83..dfbe051 100644 --- a/client/X11/xf_input.c +++ b/client/X11/xf_input.c @@ -200,7 +200,7 @@ static BOOL register_raw_events(xfContext* xfc, Window window) settings = xfc->common.context.settings; WINPR_ASSERT(settings); - if (freerdp_client_use_relative_mouse_events(&xfc->common)) + if (freerdp_settings_get_bool(settings, FreeRDP_MouseUseRelativeMove)) { XISetMask(mask_bytes, XI_RawMotion); XISetMask(mask_bytes, XI_RawButtonPress); @@ -780,21 +780,26 @@ int xf_input_event(xfContext* xfc, const XEvent* xevent, XIDeviceEvent* event, i switch (evtype) { case XI_ButtonPress: - xfc->xi_event = TRUE; - xf_generic_ButtonEvent(xfc, (int)event->event_x, (int)event->event_y, event->detail, - event->event, xfc->remote_app, TRUE); - break; - case XI_ButtonRelease: - xfc->xi_event = TRUE; - xf_generic_ButtonEvent(xfc, (int)event->event_x, (int)event->event_y, event->detail, - event->event, xfc->remote_app, FALSE); + xfc->xi_event = !xfc->common.mouse_grabbed || + !freerdp_client_use_relative_mouse_events(&xfc->common); + + if (xfc->xi_event) + { + xf_generic_ButtonEvent(xfc, (int)event->event_x, (int)event->event_y, event->detail, + event->event, xfc->remote_app, evtype == XI_ButtonPress); + } break; case XI_Motion: - xfc->xi_event = TRUE; - xf_generic_MotionNotify(xfc, (int)event->event_x, (int)event->event_y, event->detail, - event->event, xfc->remote_app); + xfc->xi_event = !xfc->common.mouse_grabbed || + !freerdp_client_use_relative_mouse_events(&xfc->common); + + if (xfc->xi_event) + { + xf_generic_MotionNotify(xfc, (int)event->event_x, (int)event->event_y, + event->detail, event->event, xfc->remote_app); + } break; case XI_RawButtonPress: case XI_RawButtonRelease: diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 9b575c2..cfbd6ca 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -120,7 +120,7 @@ static BOOL xf_keyboard_action_script_init(xfContext* xfc) char* context = NULL; strtok_s(buffer, "\n", &context); - if (!buffer || !ArrayList_Append(xfc->keyCombinations, buffer)) + if (!ArrayList_Append(xfc->keyCombinations, buffer)) { ArrayList_Free(xfc->keyCombinations); xfc->actionScriptExists = FALSE; @@ -180,7 +180,7 @@ void xf_keyboard_key_press(xfContext* xfc, const XKeyEvent* event, KeySym keysym WINPR_ASSERT(xfc); WINPR_ASSERT(event); - WINPR_ASSERT(event->keycode <= ARRAYSIZE(xfc->KeyboardState)); + WINPR_ASSERT(event->keycode < ARRAYSIZE(xfc->KeyboardState)); last = xfc->KeyboardState[event->keycode]; xfc->KeyboardState[event->keycode] = TRUE; @@ -195,7 +195,7 @@ void xf_keyboard_key_release(xfContext* xfc, const XKeyEvent* event, KeySym keys { WINPR_ASSERT(xfc); WINPR_ASSERT(event); - WINPR_ASSERT(event->keycode <= ARRAYSIZE(xfc->KeyboardState)); + WINPR_ASSERT(event->keycode < ARRAYSIZE(xfc->KeyboardState)); BOOL last = xfc->KeyboardState[event->keycode]; xfc->KeyboardState[event->keycode] = FALSE; @@ -555,11 +555,11 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym) // do not return anything such that the key could be used by client if ungrab is not the goal if (keysym == XK_Control_R) { - if (mod.RightCtrl && xfc->firstPressRightCtrl) + if (mod.RightCtrl && !xfc->wasRightCtrlAlreadyPressed) { // Right Ctrl is pressed, getting ready to ungrab xfc->ungrabKeyboardWithRightCtrl = TRUE; - xfc->firstPressRightCtrl = FALSE; + xfc->wasRightCtrlAlreadyPressed = TRUE; } } else @@ -689,7 +689,7 @@ void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym) if (keysym != XK_Control_R) return; - xfc->firstPressRightCtrl = TRUE; + xfc->wasRightCtrlAlreadyPressed = FALSE; if (!xfc->ungrabKeyboardWithRightCtrl) return; diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index a5e68c7..1d7330d 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -562,6 +562,7 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig else res_class = _strdup("xfreerdp"); + classHints->res_class = res_class; XSetClassHint(xfc->display, window->handle, classHints); XFree(classHints); free(res_class); diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 314c63d..42a2224 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -277,7 +277,7 @@ struct xf_context button_map button_map[NUM_BUTTONS_MAPPED]; BYTE savedMaximizedState; UINT32 locked; - BOOL firstPressRightCtrl; + BOOL wasRightCtrlAlreadyPressed; BOOL ungrabKeyboardWithRightCtrl; #if defined(WITH_XI) |