tags:

views:

163

answers:

3

VendorString() doesn't work, it's always Sun Microsystems, even if it is Xorg built for Solaris.

A: 

It's possibly a little hacky, but if you look at the list of extensions returned from Xsun and Xorg you should see that Xorg has a few extra XFree86-derived extensions.

xdpyinfo can be used to list the extensions via the command-line to check for differences; programmatically you can use XListExtensions() or XQueryExtension().

(I haven't got a Xsun X Server to hand but I'm pretty sure when I've looked in the past they have differed quite abit).

Dave Rigby
Only Xsun will have Adobe-DPS - Sun is not including that in our Xorg port.
alanc
+1  A: 
$ xdpyinfo | grep vendor
vendor string:    The X.Org Foundation
vendor release number:    10601901

This is xorg-server 1.6.1 on Linux. Hopefully XOrg and XSun on Solaris will differ here.

To output these two fields, xdpyinfo calls the ServerVendor macro to determine the vendor, then parses the return of the VendorRelease macro differently depending on what ServerVendor was.

By the way, what's VendorString()? I don't have a function or macro by that name...

ephemient
A: 

Thank you! Oops, VendorRelease() string it is. Anyway, unfortunately we cannot bet on this string. It changes often enough to have a trouble, for Xsun as well as for Xorg. I have found a solution working (hopefully) for them and for various other (derived) servers like Xvfb, Xnest etc.

Xsun does use a third value in an array of the keysyms for KP_ (numpad) keycodes. Xorg uses 1-st or 2-nd. A sniffer should first, obtain a keycode for a KP_ keysym, for instance XK_KP_7, second, sniff what is in the XKeycodeToKeysym(d,keycode, [0-3]). Our XK_KP_7 will be on the index 2 for Xsun.

Wow, that's feels like an even uglier hack than Dave's solution, but as long as it works... !
ephemient
This seems like a good place to write a unit test!
Kevin Panko