mirror of
https://github.com/1Remote/1Remote.git
synced 2026-04-25 13:36:03 +03:00
[GH-ISSUE #530] Changing RDP tabs should focus the new tab #3340
Labels
No labels
area-configuration
area-ct-app
area-ct-rdp
area-ct-remoteapp
area-ct-ssh
area-ct-vnc
area-launcher
area-list
area-tags
area-teamwork
bug
chore
dependencies
general-build/ci
general-performance
general-refactor
general-security
general-supportive
general-ux
meta-documentation
meta-enhancement
meta-enhancement
meta-feature
meta-help-wanted
meta-unknown-error
priority-hi
priority-low
pull-request
question
resolution-duplicate
resolution-invalid
resolution-wontfix
stale
task-put-off
task-still-considering
task-working-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/1Remote#3340
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @OronDF343 on GitHub (Oct 16, 2023).
Original GitHub issue: https://github.com/1Remote/1Remote/issues/530
Originally assigned to: @VShawn on GitHub.
When I am working on an RDP session and I change tabs, for some reason keyboard focus is retained by the previous tab. Whatever I type is affecting the other (hidden) tab until I click on the screen.
Changing tabs should always immediately focus the keyboard on the displayed session.
@VShawn commented on GitHub (Oct 16, 2023):
thankx for your remind, This is the first time I'm aware of this bug, but don't worry, it will be fixed soon.
@VShawn commented on GitHub (Oct 17, 2023):
After a day of test, I discovered that I couldn't fix this problem quickly. I couldn't find a way through the code to cancel the focus of the previous RDP session and focus on the new RDP.
@itagagaki commented on GitHub (Dec 21, 2025):
I think this is a Drabablz issue rather than an issue with the RDP session.
@itagagaki commented on GitHub (Dec 21, 2025):
I think this is a Drabablz issue rather than an issue with the RDP session.
@itagagaki commented on GitHub (Dec 21, 2025):
My investigation revealed the following:
Nothing happens until the fourth attempt, after which the focus shifts. This is odd.
The cause is unknown, but this behavior could provide a clue.
@itagagaki commented on GitHub (Dec 22, 2025):
I used a tool to observe the keyboard events that were actually being received by the remote Windows system.
https://kts.sakaiweb.com/keymill.html
(Maybe Japanese only)
Then, various strange phenomena were observed.
For example, opening or closing an entirely completely unrelated application on the client-side Windows caused Keymill to react on the remote Windows machine. It's utterly bizarre.
This strange behaviour may have caused some of the unexplained bug reports.
@VShawn commented on GitHub (Dec 23, 2025):
I also suspected it might be an issue with Drabablz, but so far I haven't found any other suitable tab controls support splitting, so I haven't proceeded with replacement testing.
Additionally, calling
rdp.focus();does not shift the focus to rdp, which I believe is also problematic.@itagagaki commented on GitHub (Dec 28, 2025):
As part of my investigation, I decided to observe the
m.MsginAxMsRdpClient9NotSafeForScriptingEx.WndProc(ref System.Windows.Forms.Message m).--
When switching between two open RDP windows in separated, the following messages were received by
AxMsRdpClient9NotSafeForScriptingEx.WndProc()in sequence:0x0119 (?)
wParam=10x0007 (
WM_SETFOCUS)0x0008 (
WM_KILLFOCUS)0x0119 (?)
wParam=0For the
WM_SETFOCUS, thewParamparameter appears to be the handle of the first child window of the Dragablz window.(In rare cases, however, it is the handle of the Dragablez window itself rather than that of a child window. I think this is just another glitch.)
--
When both RDP tabs were within the same Dragablz window, switching to the first tab caused
AxMsRdpClient9NotSafeForScriptingEx.WndProc()to receive the following messages in order:0x000A (
WM_ENABLE)wParam=10x001F (
WM_CANCELMODE)0x000A (
WM_ENABLE)wParam=00x000E (
WM_GETTEXTLENGTH)0x000D (
WM_GETTEXT).When switching to the second tab:
0x001F (
WM_CANCELMODE)0x000A (
WM_ENABLE)wParam=00x000A (
WM_ENABLE)wParam=10x000E (
WM_GETTEXTLENGTH)0x000D (
WM_GETTEXT).WM_GETTEXTLENGTHandWM_GETTEXTare probably caused by the processing of the change to the window title, and are unrelated to this issue.WM_CANCELMODEandWM_ENABLEare sent bychild.IsEnabled = isSelected;inDragblz.TabablzControl.UpdasteSelectedItem().If
isSelectedis false, thenWM_CANCELMODEis sent beforeWM_ENABLEwithwParam=0.If
isSelectedis true, thenWM_ENABLEis sent withwParam=1.In any case,
WM_SETFOCUSis not being received.Despite exhausting all possibilities with
AxMsRdpClient09Host.FocusOnMe().@VShawn commented on GitHub (Dec 29, 2025):
Then does it mean we can send WM_SETFOCUS to rdp object after a tab switching as a workaround?
BTW As I am an amateur UI software developer and not very familiar with windows message handles. May I ask how to
observe the m.Msg in AxMsRdpClient9NotSafeForScriptingEx.WndProc(ref System.Windows.Forms.Message m).?@itagagaki commented on GitHub (Dec 29, 2025):
Yeah, I did think so too, and tried that, but no luck so far.
How to observe the
m.Msg:I just used a simple way :-)
Of course, this merely observes messages sent to this window.
I think there's a chance that Win32 or Dragblz is sending WM_SETFOCUS to other targets when the tab is switched.
If there was a tool that could capture all the window messages flying around on the OS, we could probably figure that out. I reckon there's probably a tool like that out there, so I'm thinking of having a look for it.
I use this tool to view info about all windows. This lets me figure out which window m.HWnd is referring to.
GUIPropView - View and set Windows properties from command line or GUI
@itagagaki commented on GitHub (Dec 29, 2025):
Yeah, I did think so too, and tried that, but no luck so far.
How to observe the
m.Msg:I just used a simple way :-)
Of course, this merely observes messages sent to this window.
I think there's a chance that Win32 or Dragblz is sending WM_SETFOCUS to other targets when the tab is switched.
If there was a tool that could capture all the window messages flying around on the OS, we could probably figure that out. I reckon there's probably a tool like that out there, so I'm thinking of having a look for it.
I use this tool to view info about all windows. This lets me figure out which window m.HWnd is referring to.
GUIPropView - View and set Windows properties from command line or GUI
@itagagaki commented on GitHub (Jan 1, 2026):
I've found this and am using it for my investigation, but I haven't gained anything from it yet.
API Monitor: Spy on API Calls and COM Interfaces (Freeware 32-bit and 64-bit Versions!) | rohitab.com
@itagagaki commented on GitHub (Jan 1, 2026):
The investigation is still ongoing, but I've learned something.
When the mouse button is pressed on a tab, Dragablz reacts and the following sequence of calls proceeds:
DragablzItem.ThumbOnDragStarted()
DragablzItem.OnDragStarted()
TabablzControl.ItemDragStarted()
Then,
SelectedItem = item;statement in ItemDragStarted() triggers the setter for_1RM.View.Host.TabWindowViewModel.SelectedItem.In the current 1Remote implementation, it attempts to gain focus with
_selectedItem.Content.FocusOnMe();within this setter. However, this is too early. Because the tab switching process by Dragablz is still halfway through at this point.@itagagaki commented on GitHub (Jan 1, 2026):
Switching tabs also changes the window title of one of the child windows in the Dragablz window to the new title given to the Dragablz window itself via the
SelectedItemproperty setter of the_1RM.View.Host.TabWindowViewModel. Presumably, the switch is fully complete at this stage.However, it does not seem that Dragablz provides an event to notify this change. It also appears that Dragablz itself cannot determine the exact timing of this change.
Therefore, I am considering the following approach:
SelectedItemchanges