FreeRDP: [various window managers] Window focus management breaks mouse dragging

Describe the bug Simple mouse clicks work as expected, dragging something, e.g. windows (left mouse button held) does not work. Also, multi-selection with <ctrl>+<left mouse button> does not work.

To Reproduce Try dragging a window on the remote desktop with the mouse, it won’t move

Application details

  • FreeRDP version 2.3.2
  • Command line used
    xfreerdp /u:$RDP_LOGIN /v:$RDP_HOST /from-stdin \
      /bpp:24 /sound:sys:oss /microphone:sys:oss,format:1 \
      /dvc:video,sys:oss /gfx-h264:avc444 /fonts \
      /clipboard /dynamic-resolution /size:$RDP_SIZE
    
  • Output of xfreerdp /buildconfig
      BUILD_TESTING=OFF BUILTIN_CHANNELS=ON HAVE_AIO_H=1 HAVE_EXECINFO_H=1
      HAVE_FCNTL_H=1 HAVE_GETLOGIN_R=1 HAVE_INTTYPES_H=1 HAVE_MATH_C99_LONG_DOUBLE=1
      HAVE_POLL_H=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK=ON
      HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL=
      HAVE_SYSLOG_H=1 HAVE_SYS_EVENTFD_H=1 HAVE_SYS_FILIO_H=1 HAVE_SYS_MODEM_H=
      HAVE_SYS_SELECT_H=1 HAVE_SYS_SOCKIO_H=1 HAVE_SYS_STRTIO_H=
      HAVE_SYS_TIMERFD_H=1 HAVE_TM_GMTOFF=1 HAVE_UNISTD_H=1 HAVE_XI_TOUCH_CLASS=1
      WITH_ALSA=false WITH_CAIRO=OFF WITH_CCACHE=ON WITH_CHANNELS=ON
      WITH_CLANG_FORMAT=ON WITH_CLIENT=ON WITH_CLIENT_AVAILABLE=1
      WITH_CLIENT_CHANNELS=ON WITH_CLIENT_CHANNELS_AVAILABLE=1 WITH_CLIENT_COMMON=ON
      WITH_CLIENT_INTERFACE=OFF WITH_CUPS=true WITH_DEBUG_ALL=OFF
      WITH_DEBUG_CAPABILITIES=OFF WITH_DEBUG_CERTIFICATE=OFF WITH_DEBUG_CHANNELS=OFF
      WITH_DEBUG_CLIPRDR=OFF WITH_DEBUG_DVC=OFF WITH_DEBUG_KBD=OFF
      WITH_DEBUG_LICENSE=OFF WITH_DEBUG_MUTEX=OFF WITH_DEBUG_NEGO=OFF
      WITH_DEBUG_NLA=OFF WITH_DEBUG_NTLM=OFF WITH_DEBUG_RAIL=OFF WITH_DEBUG_RDP=OFF
      WITH_DEBUG_RDPDR=OFF WITH_DEBUG_RDPEI=OFF WITH_DEBUG_RDPGFX=OFF
      WITH_DEBUG_REDIR=OFF WITH_DEBUG_RFX=OFF WITH_DEBUG_RINGBUFFER=OFF
      WITH_DEBUG_SCARD=OFF WITH_DEBUG_SND=OFF WITH_DEBUG_SVC=OFF
      WITH_DEBUG_SYMBOLS=OFF WITH_DEBUG_THREADS=OFF WITH_DEBUG_TIMEZONE=OFF
      WITH_DEBUG_TRANSPORT=OFF WITH_DEBUG_TSG=OFF WITH_DEBUG_TSMF=OFF
      WITH_DEBUG_TSMF=OFF WITH_DEBUG_TSMF_AVAILABLE=0 WITH_DEBUG_URBDRC=OFF
      WITH_DEBUG_WND=OFF WITH_DEBUG_X11=OFF WITH_DEBUG_X11_CLIPRDR=OFF
      WITH_DEBUG_X11_LOCAL_MOVESIZE=OFF WITH_DEBUG_XV=OFF WITH_DIRECTFB=OFF
      WITH_DSP_EXPERIMENTAL=OFF WITH_DSP_FFMPEG=OFF WITH_EVENTFD_READ_WRITE=1
      WITH_FAAC=true WITH_FAAD2=true WITH_FFMPEG=TRUE WITH_FFMPEG=TRUE
      WITH_GFX_H264=ON WITH_GPROF=OFF WITH_GSM=true WITH_GSSAPI=OFF
      WITH_GSSAPI_HEIMDAL=true WITH_GSTREAMER_0_10=OFF WITH_GSTREAMER_1_0=true
      WITH_ICU=true WITH_IPP=OFF WITH_JPEG=OFF WITH_LAME=false
      WITH_LIBRARY_VERSIONING=ON WITH_LIBSYSTEMD=OFF WITH_MACAUDIO=OFF
      WITH_MACAUDIO=OFF WITH_MACAUDIO_AVAILABLE=0 WITH_MANPAGES=true
      WITH_MBEDTLS=OFF WITH_OPENCL=OFF WITH_OPENH264=TRUE WITH_OPENH264=TRUE
      WITH_OPENH264_LOADING=OFF WITH_OPENSLES=OFF WITH_OPENSSL=ON WITH_OSS=ON
      WITH_PCSC=false WITH_PROFILER=OFF WITH_PULSE=false WITH_SAMPLE=OFF
      WITH_SANITIZE_ADDRESS=OFF WITH_SANITIZE_ADDRESS_AVAILABLE=1
      WITH_SANITIZE_MEMORY=OFF WITH_SANITIZE_MEMORY_AVAILABLE=1
      WITH_SANITIZE_THREAD=OFF WITH_SANITIZE_THREAD_AVAILABLE=1 WITH_SERVER=OFF
      WITH_SERVER_INTERFACE=OFF WITH_SMARTCARD_INSPECT=OFF WITH_SOXR=false
      WITH_SSE2=true WITH_SWSCALE=OFF WITH_THIRD_PARTY=OFF WITH_VAAPI=OFF
      WITH_VALGRIND_MEMCHECK=OFF WITH_VALGRIND_MEMCHECK_AVAILABLE=1
      WITH_WAYLAND=true WITH_WINPR_TOOLS=ON WITH_X11=ON WITH_X264=OFF
      WITH_XCURSOR=ON WITH_XEXT=ON WITH_XFIXES=ON WITH_XI=ON WITH_XINERAMA=ON
      WITH_XKBFILE=ON WITH_XRANDR=ON WITH_XRENDER=ON WITH_XSHM=ON WITH_XV=ON
      WITH_ZLIB=ON
    
  • OS version connecting to: Windows Server 2016

Environment:

  • OS: FreeBSD 13.0-RC5
  • Architecture: amd64

Additional context Downgrading back to 2.2.0 (no other changes) solves the problem. Both versions are built from FreeBSD ports. See also FreeBSD PR #254908

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 71 (35 by maintainers)

Most upvoted comments

Hi, does anyone knows if is there a Workaround (like the one for FVWM) for Fluxbox on Linux? Im having an issue with freerdp when trying to select multiple files pressing Shift + Left Mouse Click or ALT + Left mouse Click, the instant I press the Left Mouse Click, the Shift or Ctrl Button are released so I can only select one single file at a time, its quite annoying. With previous versions, multiple file selection worked as expected.

the odd thing is, if I press Ctrl or Shift and press the RIGHT mouse click, the keys are not released and worked as expected 😦

@akallabeth I decided to take the code plunge, and looking the changes made by commit 2d84387fcd3787af6294509d166d746c83d0acf5 I found out it introduced one change in logic:

@@ -179,6 +182,7 @@ void xf_keyboard_release_all_keypress(xfContext* xfc)
                        xfc->KeyboardState[keycode] = FALSE;
                }
        }
+       xf_sync_kbd_state(xfc);
 }

commenting out call to xf_sync_kdb_state on line 185 in client/X11/xf_keyboard.c seems to fix the mouse dragging issue. I have absolutely no idea WHY, or whether commenting it out introduces any other bugs, but I guess now you have something to work on 😃

BIG THANKS!!!

I’m on FVWM and I’ve bound a command to left mouse button + super to move the window when I click-drag inside of it.

Mouse 1 W 4 MoveClickX Move Nop Nop

Removing this bind avoids the bug. When running xev and attaching it to the xfreerdp window there’s no FocusOut and FocusIn events anymore while click-dragging inside the remote desktop. Binding a command to the left mouse button while inside of a window (even with a modifier) seems to trigger the bug.

@akallabeth I decided to take the code plunge, and looking the changes made by commit 2d84387fcd3787af6294509d166d746c83d0acf5 I found out it introduced one change in logic:

@@ -179,6 +182,7 @@ void xf_keyboard_release_all_keypress(xfContext* xfc)
                        xfc->KeyboardState[keycode] = FALSE;
                }
        }
+       xf_sync_kbd_state(xfc);
 }

commenting out call to xf_sync_kdb_state on line 185 in client/X11/xf_keyboard.c seems to fix the mouse dragging issue. I have absolutely no idea WHY, or whether commenting it out introduces any other bugs, but I guess now you have something to work on 😃