Configuring X.org on FreeBSD guests running in VirtualBox

Configuring X11 is more or less a dark art, and you must almost be a wizard of the Slytherine House to get modern X.org 1.14.7 working on a FreeBSD guest in VirtualBox.

Nonetheless, through lots of experimentation this evening, have I finally arrived at this configuration file:

Section "InputClass"
  Identifier      "Keyboard Defaults"
  Driver          "keyboard"
  MatchIsKeyboard "on"
  Option          "XkbLayout" "no"
EndSection

Section "InputClass"
  Identifier      "Mouse Defaults"
  Driver          "mouse"
  MatchIsPointer  "on"
EndSection

Section "InputDevice"
  Identifier      "Mouse0"
  Driver          "vboxmouse"
  Option          "CorePointer" "on"
EndSection

Somehow, you need both the InputClass and the InputDevice sections to get the mouse working as it did in previous versions of X.org. The option CorePointer is also key to the success.

Not only have I achieved Norwegian keyboard layout, the mouse sends its events to the X Server, and the mouse cursor is able to leave the FreeBSD guest whenever I want.

Maybe I’m the next Voldemort afterall. :P