Donate Share

synergy

Tracker: Bugs

5 VMware hack does not alway work. - ID: 1545361
Last Update: Comment added ( marlonrodriguez )

Submitting anonymously, but you can followup to
matthew@canonical.org if you wish.

A previous version of Synergy2 included a VMware hack that checks if
the modifier map is empty, and if so, uses a previously non-empty
modifier map.

However, I have verified that with VMware Server Console 1.0.0
build-28343 (which AFAIK is very recent) that VMware does *not* clear
the modifier map but rather just deletes things from it.

The end result is that it appears the fix did not take hold (i.e. the
modifiers do not work when the VM has focus). I hacked
CXWindowsKeyState::hasModifiersXKB() to produce some extra logging
info (printing the keycode, group, and type fields (e.g. i, group, and j))

and also showing what action->type was. I had it iterate through the
full map every time so I could see everything inside of it. (extra
debugging output included at the bottom of this report).

Basically, AFAICT VMware deletes the modifiers for the following
keycodes: 37, 50, 62, 66, 77, 78, and 109. Which, for my keyboard,
are Control_L, Shift_L, Shift_R, Caps_Lock, Num_Lock, Scroll_Lock, and
Control_R. It keeps other modifiers (like those for Alt).

I hacked hasModifiersXKB() to return false if the modifier map doesn't
at least have Control_L and Shift_L. This makes things work for me,
but I imagine the hack is not something that could be folded back into
the code as that's a crazy assumption to make (I think).

Specs:

Synergy2 Server: 1.3.1 running on OS X (Intel) 10.4.7
Synergy2 Client: 1.3.1 running on Ubuntu Dapper
VMware: VMware Server Console 1.0.0 build-28343
Keyboard: USB Apple keyboard

Here is the debugging output I generated from hasModifiersXKB().
(line numbers may be off b/c I added additional debugging lines while I
was trying to suss out the issue).

# Client takes focus for the first time
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=37,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=50,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=62,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=64,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=64,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,789: VMware hack. keycode=66,
group=0, type=-1 (lockmods)
DEBUG1: CXWindowsKeyState.cpp,789: VMware hack. keycode=77,
group=0, type=-1 (lockmods)
DEBUG1: CXWindowsKeyState.cpp,789: VMware hack. keycode=78,
group=0, type=-1 (lockmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=109,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=113,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=113,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=115,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=124,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=125,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=127,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=128,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=156,
group=0, type=0 (setmods)

# VMware takes focus
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=64,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=64,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=113,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=113,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=115,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=124,
group=0, type=-1 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=125,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=127,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=128,
group=0, type=0 (setmods)
DEBUG1: CXWindowsKeyState.cpp,784: VMware hack. keycode=156,
group=0, type=0 (setmods)


Nobody/Anonymous ( nobody ) - 2006-08-23 15:13

5

Open

None

Chris Schoeneman

X Windows

v1.3.1

Public


Comments ( 5 )

Date: 2007-11-19 18:54
Sender: marlonrodriguez


Using Kubuntu Gutsy as host OS with VMWARE Workstation 6 for Linux.
Windows XP guest OS.
It was working fine on the clean install of Gutsy but after some updates
(something about QT3) it stopped working correctly. After applying this
fix and recompiling it's working again. BTW Bug# 1101403 seems to be the
same issue.


Date: 2007-07-03 10:28
Sender: tai


Same problem on Synergy 1.3.1 with VMware Server Console 1.0.2
build-39867.
I was able to workaround it with the patch posted here - worked perfectly
(thanks!).



Date: 2006-09-25 13:33
Sender: nobody

Logged In: NO

I can also confirm that this problem exists for me, on
almost exactly the same setup:

Server 1.3.1 on OSX 10.4.7 (PPC), client 1.3.1 on Ubuntu
Dapper x86, VMWare Player using WinXP Pro as guest OS.


Date: 2006-08-23 15:36
Sender: nobody

Logged In: NO

(Sending comment again, SF gave me a 500 error).

Here's a link to a patch that gets things to work for me, I suspect this
patch is
not good enough to include but hopefully it adds to the conversation:

http://panacea.canonical.org/~matthew/vmware-hack.patch

Here's the patch inline (can't figure out how to attach files, sorry):

diff -ruN synergy-1.3.1.orig/lib/platform/CXWindowsKeyState.cpp
synergy-1.3.1/lib/platform/CXWindowsKeyState.cpp
--- synergy-1.3.1.orig/lib/platform/CXWindowsKeyState.cpp 2006-04-02
12:16:39.000000000 -0700
+++ synergy-1.3.1/lib/platform/CXWindowsKeyState.cpp 2006-08-23
08:30:43.000000000 -0700
@@ -773,7 +773,16 @@
XkbKeyActionEntry(m_xkb, keycode, level,
group);
if (action->type == XkbSA_SetMods ||
action->type == XkbSA_LockMods) {
- return true;
+ // Modifier map is empty if
at
+ // least some Control or
Shift key
+ // is not in it.
+ switch (i) {
+ case 37: // Control_L
+ case 50: // Shift_L
+ case 62: // Shift_R
+ case 109: // Control_R
+ return true;
+ }
}
}
}



Date: 2006-08-23 15:35
Sender: nobody

Logged In: NO

Here's a link to a patch that gets things to work for me, I suspect this
patch is
not good enough to include but hopefully it adds to the conversation:

http://panacea.canonical.org/~matthew/vmware-hack.patch

Here's the patch inline (can't figure out how to attach files, sorry):

diff -ruN synergy-1.3.1.orig/lib/platform/CXWindowsKeyState.cpp
synergy-1.3.1/lib/platform/CXWindowsKeyState.cpp
--- synergy-1.3.1.orig/lib/platform/CXWindowsKeyState.cpp 2006-04-02
12:16:39.000000000 -0700
+++ synergy-1.3.1/lib/platform/CXWindowsKeyState.cpp 2006-08-23
08:30:43.000000000 -0700
@@ -773,7 +773,16 @@
XkbKeyActionEntry(m_xkb, keycode, level,
group);
if (action->type == XkbSA_SetMods ||
action->type == XkbSA_LockMods) {
- return true;
+ // Modifier map is empty if
at
+ // least some Control or
Shift key
+ // is not in it.
+ switch (i) {
+ case 37: // Control_L
+ case 50: // Shift_L
+ case 62: // Shift_R
+ case 109: // Control_R
+ return true;
+ }
}
}
}



Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.