Bug 247149

Summary: KRDC shows wrong colors when connecting to Mac OS X Snow Leopard
Product: [Applications] krdc Reporter: Malte S. Stretz <mss>
Component: VNCAssignee: Urs Wolfer <uwolfer>
Status: RESOLVED FIXED    
Severity: normal CC: aelmalinka, alessandro-ghersi, bryan.sutherland, hotsoda, sberthelot, wouter_vanmeir
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot
RedHat login screen with obviously wrong colors (look at the RedHat logo)

Description Malte S. Stretz 2010-08-09 16:25:22 UTC
Version:           unspecified (using KDE 4.4.95) 
OS:                Linux

When I connect to a Mac OS X Snow Leopard, the colors are odd.  It looks like red and blue are swapped.  I'll attach a screenshot.

Debug output:

krdc(4968)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from  "/var/tmp/kdecache-mss/ksycoca4"
krdc(4968) MainWindow::loadAllPlugins: "### Plugin RDP found ###"
krdc(4968) MainWindow::loadAllPlugins: # Version: "1.0"
krdc(4968) MainWindow::loadAllPlugins: # Description: "Allows managing RDP sessions through KRDC"
krdc(4968) MainWindow::loadAllPlugins: # Author: "Urs Wolfer"
krdc(4968) MainWindow::loadAllPlugins: # Sorting: 60                                                                                                             
krdc(4968) MainWindow::loadAllPlugins: "### Plugin VNC found ###"                                                                                                
krdc(4968) MainWindow::loadAllPlugins: # Version: "1.0"                                                                                                          
krdc(4968) MainWindow::loadAllPlugins: # Description: "Allows managing VNC sessions through KRDC"                                                                
krdc(4968) MainWindow::loadAllPlugins: # Author: "Urs Wolfer"                                                                                                    
krdc(4968) MainWindow::loadAllPlugins: # Sorting: 20                                                                                                             
krdc(4968) MainWindow::loadAllPlugins: "# Plugin Test found, however it's not activated, skipping..."                                                            
krdc(4968) TubesManager::TubesManager: Initializing tubes manager                                                                                                
Telepathy-Qt4 (version 0.2.1) WARNING: Unable to register client: busName "org.freedesktop.Telepathy.Client.krdc_rfb_handler" already registered                 
registerWindow Invalid WindowMenu.Registrar!                                                                                                                     
krdc(4968) RemoteDesktopsModel::RemoteDesktopsModel: Browsing for zeroconf hosts.                                                                                
krdc(4968)/kdeui (kdelibs): Attempt to use QAction "remote_desktop_dockwidget" with KXMLGUIFactory!                                                              
krdc(4968) MainWindow::updateActionStatus: -1                                                                                                                    
krdc(4968)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0x84d05a8)                                                                               
krdc(4968)/kio (Scheduler) KIO::SchedulerPrivate::protoQ: creating ProtoQueue instance for "vnc"
krdc(4968)/kio (Scheduler) KIO::ProtoQueue::ProtoQueue: m_maxConnectionsTotal: 1 m_maxConnectionsPerHost: 1
krdc(4968)/kdecore (K*TimeZone*) KSystemTimeZonesPrivate::instance: instance(): ... initialised
krdc(4968)/kdecore (K*TimeZone*) KSystemTimeZonesPrivate::readConfig: readConfig(): local zone= "Europe/Berlin"
krdc(4968)/kdecore (K*TimeZone*) KSystemTimeZonesPrivate::readZoneTab: readZoneTab( "/usr/share/zoneinfo/zone.tab" )
krdc(4968) MainWindow::tabChanged: 0
krdc(4968) MainWindow::updateActionStatus: 0
krdc(4968) main: ########## KRDC ready: 1228 ms ##########
krdc(4968)/kio (Slave) KIO::Slave::createSlave: createSlave "vnc" for KUrl("vnc:/")
krdc(4968)/kio (KIOConnection) KIO::ConnectionServer::listenForRemote: Listening on  "local:/tmp/user/1000/ksocket-mss/krdcyJ4968.slave-socket"
krdc(4968): couldn't create slave: "Unable to create io-slave:
klauncher said: Error loading 'krdc '%u''.
" 
krdc(4968)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::StatJob(0x84d05a8) QObject(0x0)
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
QFileSystemWatcher: failed to add paths: /home/mss/.config/ibus/bus
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
krdc(4968) MainWindow::newConnection: "Found plugin to handle url (vnc://10.135.1.10/): VncView"
krdc(4968)/kdeui (kdelibs) QWidgetStackAccelManager::currentChanged: invalid index provided
krdc(4968) MainWindow::tabChanged: -1
krdc(4968) MainWindow::updateActionStatus: -1
krdc(4968)/krdc (VNC backend) VncView::scaleResize: 1118 715
krdc(4968) MainWindow::tabChanged: 0
krdc(4968) MainWindow::updateActionStatus: 0
krdc(4968) MainWindow::tabChanged: 0
krdc(4968) MainWindow::updateActionStatus: 0
krdc(4968) MainWindow::statusChanged: -2
krdc(4968) MainWindow::statusChanged: -1
krdc(4968) MainWindow::statusChanged: 0
krdc(4968)/krdc (VNC backend) VncClientThread::run: --------------------- trying init ---------------------
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "VNC server supports protocol version 3.889 (viewer 3.8)"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "We have 3 security types to read"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "0) Received security type 30"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "1) Received security type 2"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "Selecting security type 2 (1/3 in the list)"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "2) Received security type 35"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "Selected Security Scheme 2"
krdc(4968)/krdc (VNC backend) VncClientThread::passwdHandler: password request "[
0: /usr/lib/libkdecore.so.5(kRealBacktrace(int)+0x41) [0x7ab5871]
1: /usr/lib/kde4/krdc_vncplugin.so(+0xad6f) [0x77d5d6f]
2: /usr/lib/libvncclient.so.0(InitialiseRFBConnection+0x61f) [0x4ecbe6f]
3: /usr/lib/libvncclient.so.0(rfbInitClient+0x19a) [0x4ed5daa]
4: /usr/lib/kde4/krdc_vncplugin.so(+0xa361) [0x77d5361]
5: /usr/lib/libQtCore.so.4(+0x67e39) [0x3ec1e39]
6: /lib/tls/i686/cmov/libpthread.so.0(+0x596e) [0x51396e]
7: /lib/tls/i686/cmov/libc.so.6(clone+0x5e) [0x694a4e]
]
"
krdc(4968)/krdc (VNC backend) VncView::requestPassword: request password
krdc(4968) MainWindow::statusChanged: 1
krdc(4968) RemoteView::readWalletPassword: Wallet OK
krdc(4968) RemoteView::readWalletPassword: Password read OK
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "VNC authentication succeeded"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "Desktop name "MacMini""
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "Connected to VNC server, using protocol version 3.8"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "VNC server default format:"
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "32 bits per pixel."
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "Least significant byte first in each pixel."
krdc(4968)/krdc (VNC backend) VncClientThread::outputHandler: "TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0"
krdc(4968)/krdc (VNC backend) VncClientThread::newclient: Client created
krdc(4968)/krdc (VNC backend) VncClientThread::run: --------------------- Starting main VNC event loop ---------------------
krdc(4968)/krdc (VNC backend) VncClientThread::checkOutputErrorMessage: "INTERNAL:APPLE_VNC_COMPATIBILTY"
krdc(4968)/krdc (VNC backend) VncView::outputErrorMessage: "INTERNAL:APPLE_VNC_COMPATIBILTY"

Reproducible: Always




Qt: 4.7.0
KDE Development Platform: 4.4.92 (KDE 4.4.92 (KDE 4.5 RC2))
KRDC: 4.4.92 (KDE 4.4.92 (KDE 4.5 RC2))
OS: Linux (i686) release 2.6.32-24-generic
Compiler: cc
Comment 1 Malte S. Stretz 2010-08-09 16:27:59 UTC
Created attachment 49947 [details]
Screenshot

The flag next to the date is a German flag.  The top left button in the window title is the close button and should be red.  And the whole theme should be blueish instead of the brownish way it is displayed.
Comment 2 Stéphane Berthelot 2010-08-18 14:20:39 UTC
Created attachment 50697 [details]
RedHat login screen with obviously wrong colors (look at the RedHat logo)
Comment 3 Stéphane Berthelot 2010-08-18 14:21:12 UTC
I have the same kind of problem on completely different server.

I use a x86_64 host running qemu with vnc. Inside is a RedHat ES4 32bits (x86).
The client (krdc) is running slackware on x86_64 with kde 4.5.0

It clearly seems to be en endianness problem though I don't know where it comes from...

A blue RedHat logo is somewhat original (R<->B inversion)
Comment 4 Wouter Van Meir 2010-09-22 13:59:20 UTC
I noticed that with qemu as a VNC server the colors are wrong, but with
"normal" (non vnc server) qemu the colors are also wrong (unless using -vga
vmware). Is anyone besides Stéphane using qemu here?

PS: using -vga vmware when using -vnc doesn't solve the problem.
Comment 5 Michael Thomas 2010-09-30 20:47:48 UTC
I have this problem connecting from x86_64 linux, KDE 4.5.1 and to Windows XP Qemu/KVM, RealVNC 4.1.2, to Windows XP/Windows 7 Qemu/KVM, Qemu's internal vnc server.

I quickly tested from krdc 4.5.1 to krfb both x86_64 linux and it's correct.

At first glance it appears it could be related to qemu, I will try and get a test to a Windows 7, Real VNC 4.1.3 x86_64 later this afternoon, unfortunately I don't have a 32-bit Windows box laying around ATM.

If you need me to test other combinations or get more information from these connections let me know and I will do.

krdc --version
Qt: 4.6.3
KDE Development Platform: 4.5.1 (KDE 4.5.1)
KRDC: 4.5.1 (KDE 4.5.1)

krfb --version
Qt: 4.6.3
KDE Development Platform: 4.5.1 (KDE 4.5.1)
Desktop Sharing: 1.0
Comment 6 Wouter Van Meir 2010-10-01 00:53:06 UTC
The problem does occur when using qemu as a VNC server, but it also happens when connecting to Xvnc server. With previous KRDC versions the Xvnc connection was OK.
See this bug (looks like a dupe): https://bugs.kde.org/show_bug.cgi?id=250182

Haven't investigated yet why this is happening, but I'm planning to do it.

The problem doesn't occur with krfb and x11vnc as vnc server (both based on libvncserver).
Comment 7 Wouter Van Meir 2010-10-15 17:38:50 UTC
The problem exists in kde 4.5 krdc when connecting to qemu vnc and Xvnc (and probably OS X vnc). Krdc sends the wrong color info to the server. The problem did not occur with x11vnc and krfb as vnc server, probably because of a bug in these vnc servers (or libvncserver which they both use).

This bug was accidentally made by me (sorry) and was in an old patch to support intel amt kvm (vnc server in chipset).
A later patch by me fixed this again. This later patch also puts high quality to 32bit colors (like it was), medium to 16 bit and low to 8 bit. This saves lots of bandwidth but makes low quality ugly. The patch is has been in the trunk for some time.

Urs, could you merge this later patch in the kde 4.5 branch to fix this problem?
This merge fixes it:
svn merge -r r1152685:r1157496 svn://anonsvn.kde.org/home/kde/trunk/KDE/kdenetwork/krdc
If you don't want this in kde 4.5 then I can make a new small patch to only fix this specific problem.

The bug is more specifically that the wrong red shift, blue shift and green shift values are send to the server (initialized by rfbGetClient()), the correct values will be set (callback call to newclient()) after the "client set pixel format" packet was send. (in newer libvncclient newclient() is called sooner so this problem doesn't exist there). In the the trunk in revision r1157496 the colors are correctly initialized before they're used.
Comment 8 Urs Wolfer 2010-10-16 17:30:24 UTC
*** Bug 250182 has been marked as a duplicate of this bug. ***
Comment 9 Urs Wolfer 2010-10-16 17:30:28 UTC
*** Bug 254265 has been marked as a duplicate of this bug. ***
Comment 10 Urs Wolfer 2010-10-17 11:48:45 UTC
SVN commit 1186718 by uwolfer:

* Merging in KRDC VNC fixes which fix some bugs with wrong colors.
Fixes by Wouter Van Meir.

BUG:247149

 M  +3 -4      qtonly/README  
 M  +1 -2      qtonly/main.cpp  
 M  +55 -18    vncclientthread.cpp  
 M  +12 -3     vncclientthread.h  
 M  +0 -6      vncview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1186718
Comment 11 Urs Wolfer 2010-11-07 19:11:39 UTC
*** Bug 253167 has been marked as a duplicate of this bug. ***