Monday, June 29, 2015

CLX on Microsoft Windows - Xming and Cygwin - Notes

As at least a novelty in in development of graphical user interface (GUI) applications, it's possible to develop applications of CLX on Microsoft Windows platforms, using one of the X Window server implementations available on the same platform -- such as Xming or one of the Cygwin  xorg-server implementations.

When Xming installed and initialized, the appropriate display address for the CLX OPEN-DISPLAY function can be determined from the Xming log file. The log file is available via the context menu provided by the Xming icon in the Microsoft Windows system tray

Example: Xming.0.log

Welcome to the Xming X Server
Vendor: Colin Harrison
Release: 6.9.0.31
FreeType2: 2.3.4
Contact: http://sourceforge.net/forum/?group_id=156984

C:\Program Files (x86)\Xming\Xming.exe :0 -clipboard 
 -multiwindow

XdmcpRegisterConnection: newAddress 192.168.56.1
winCheckDisplayNumber - Xming is already running on display 0

Fatal server error:
InitOutput - Duplicate invocation on display number: 0.  Exiting.

winDeinitMultiWindowWM - Noting shutdown in progress

Although, in this example,  some of the content of the log file might seem somewhat ambiguous, as to whether there is or is not an X server initialized on the host, but in observing the IPv4 address that is indicated as the newAddress value -- in this example, 192.168.56.1, an IP address on a local area network -- that address may be applied as the display address to the CLX OPEN-DISPLAY function. Alternately, an address may be provided when Xming is initialized, with the Xming '-from' argument -- for example, as the target value in a Microsoft Windows shortcut object, with some additional command line options provided:
Example: Xming launch command

"C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow -from 127.0.0.1 -logverbose 1

Subsequently, the address 127.0.0.1 may be provided to CLX.

With Xming initialized to the loopback address, 127.0.0.1, of course that would allow XLib requests from XLib client peers that may bind to the loopback address on the same operating system. This configuration does not require XAUTHORITY configuration. It may be suitable for application in CLX development, in non-networked applications.

SSH may be applied, furthermore, for transport layer security in networked applications of XMing in -- consulting XMing documentation (cached by Google).

Example: CLX "Hello World"

(let* ((clx-sys (asdf:find-system '#:clx))
       (clx-p (asdf:component-pathname clx-sys)))
  (setf (logical-pathname-translations "clx")
        (list (list "**;*.*.*" 
                    (merge-pathnames
                     (make-pathname :directory
                                    '(:relative :wild-inferiors)
                                    :name :wild
                                    ::type :wild
                                    :version :newest)
                     clx-p
                     ))))
  (asdf:operate 'asdf:load-op clx-sys)
  (load "clx:demo;hello")
  (xlib::hello-world "127.0.0.1"))

When working with Cygwin, an X server may be installed with the Cygwin 'xorg-server' package. Documentation is available in the Cygwin 'xorg-docs' package.The X server installed from the 'xorg-server' package may then be initialized with the shell command, 'X'. For information about the implementation of the X server in Cygwin, the reader may also wish to refer to the Cygwin/X Contributor’s Guide.