Subject: xsrc/35938: DO NOT CLOSE! HELP FIX IT!!! Xsun* from xsrc/xc/xfree has problems with focus-follows-keyboard with various window managers
To: None <xsrc-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Greg A. Woods <woods@planix.com>
List: netbsd-bugs
Date: 03/07/2007 04:25:01
>Number:         35938
>Category:       xsrc
>Synopsis:       DO NOT CLOSE!  HELP FIX IT!!!  Xsun* from xsrc/xc/xfree has problems with focus-follows-keyboard with various window managers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 07 04:25:00 +0000 2007
>Originator:     Greg A. Woods
>Release:        NetBSD xsrc-current
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD
Architecture: sparc
Machine: sparc
>Description:

NOTE!!! This is NOT about the OS revision -- this is xsrc-current!

If you can't reproduce the problem with the same programs built from
xsrc-current then show exactly what's different in your environment!

	Xsun and XsunMono (and presumably Xsun24) from xsrc/xfree/xc
	have some kind of adverse affect on the ability of a standard
	window manager, such as the twm binary also built from the same
	sources, or ctwm-3.7 and ctwm-3.8a, to control keyboard focus
	with the normal focus-follows-mouse mode of operation.

	Xsun and XsunMono from xsrc/xc worked as expected.

	Note that the window manager correctly identifies the window it
	thinks is active when the mouse cursor moves (e.g. by
	highlighting the window title bar, etc.)

	In ctwm the keyboard focus stays with the workspace manager
	window after workspaces are changed by clicking into the
	workspace manager (note that normally with ctwm "click-to-focus"
	requires the meta modifier key to be pressed when clicking on
	the target window, or for the target's title bar to be clicked
	on)

	In any case this, along with other regressions in Xserver
	functions (such as the screensaver botch), is a very serious
	regression in support for Sun Sparc systems since the move to
	xfree/xc.  I don't expect xorg/xc will be any better given its
	apparent heritage, but if I can figure out how to get it to
	build on sparc I'll give it a go.  Mean while I'm back to the
	XsunMono binary from the last xsrc/xc before it was marked dead
	for the time being.  This has cost me several days already all
	told.

	Note also that the problem may be somewhat random too -- once
	after a power outage early in February the subsequent reboot and
	start-up left keyboard focus suddenly working properly.
	Following a power outage yesterday it failed again and I've
	rebooted dozens of times, restarted the Xserver even more times,
	and restarted the window manager uncountable times, played with
	three different window managers (all twm based), all with no
	success or change in mis-behaviour.

$ xdpyinfo -ext all
name of display:    very.weird.com:0.0
version number:    11.0
vendor string:    The XFree86 Project, Inc
vendor release number:    40500000
XFree86 version: 4.5.0
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, MSBFirst, 32
image byte order:    MSBFirst
number of supported pixmap formats:    1
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
keycode range:    minimum 8, maximum 132
focus:  window 0x2e0001c, revert to PointerRoot
number of extensions:    20
    BIG-REQUESTS
    DEC-XTRAP
    DOUBLE-BUFFER
    DPMS
    Extended-Visual-Information
    FontCache
    LBX
    MIT-SCREEN-SAVER
    MIT-SHM
    MIT-SUNDRY-NONSTANDARD
    RECORD
    SECURITY
    SHAPE
    SYNC
    TOG-CUP
    X-Resource
    XC-APPGROUP
    XC-MISC
    XKEYBOARD
    XTEST
default screen number:    0
number of screens:    1

screen #0:
  dimensions:    1600x1280 pixels (452x361 millimeters)
  resolution:    90x90 dots per inch
  depths (1):    1
  root window id:    0x24
  depth of root window:    1 plane
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x21
  default number of colormap cells:    2
  preallocated pixels:    black 1, white 0
  options:    backing-store NO, save-unders NO
  largest cursor:    1600x1280
  current input event mask:    0xd0001d
    KeyPressMask             ButtonPressMask          ButtonReleaseMask        
    EnterWindowMask          SubstructureRedirectMask PropertyChangeMask       
    ColormapChangeMask       
  number of visuals:    1
  default visual id:  0x20
  visual:
    visual id:    0x20
    class:    StaticGray
    depth:    1 plane
    available colormap entries:    2
    red, green, blue masks:    0x0, 0x0, 0x0
    significant bits in color specification:    1 bits

MIT-SHM version 1.1 opcode: 129, base event: 65, base error: 128
  shared pixmaps: yes, format: 2

XKEYBOARD version 1.0 opcode: 137, base event: 70, base error: 140

SHAPE version 1.0 opcode: 128, base event: 64

SYNC version 3.0 opcode: 136, base event: 68, base error: 138
  system counters: 1
    SERVERTIME  id: 0x00000022  resolution_lo: 4  resolution_hi: 0

Xlib:  extension "XFree86-VidModeExtension" missing on display "very.weird.com:0.0".
XFree86-VidModeExtension extension not supported by server

Xlib:  extension "XFree86-Misc" missing on display "very.weird.com:0.0".
XFree86-Misc extension not supported by server

XTEST version 2.2 opcode: 131

DOUBLE-BUFFER version 1.0 opcode: 141, base error: 143
  Double-buffered visuals on screen 0
    visual id 0x20  depth 1  perflevel 0

RECORD version 1.13 opcode: 139, base error: 141

Xlib:  extension "XInputExtension" missing on display "very.weird.com:0.0".
XInputExtension extension not supported by server

RENDER extension not supported by server

Xlib:  extension "XINERAMA" missing on display "very.weird.com:0.0".
XINERAMA extension not supported by server

DMX extension not supported by server


$ xset q
Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  auto repeat delay:  500    repeat rate:  62
  auto repeating keys:  00ffeffbfeffffff
                        fffff6fffff8df3f
                        1d00000000000000
                        0000000000000000
  bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  10/1    threshold:  5
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  0    cycle:  600
Colors:
  default colormap:  0x21    BlackPixel:  1    WhitePixel:  0
Font Path:
  /usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/Speedo/,/usr/X11R6/lib/X11/fonts/Type1/,/usr/pkg/lib/X11/fonts/intlfonts/,/usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/pkg/lib/X11/fonts/Mozilla/,/usr/pkg/lib/X11/fonts/freefont/,/usr/pkg/lib/X11/fonts/jmk/
Bug Mode: compatibility mode is disabled
DPMS (Energy Star):
  Display is not capable of DPMS
Font cache:
  hi-mark (KB): 5120  low-mark (KB): 3840  balance (%): 70


>How-To-Repeat:

	start Xsun or XsunMono in failsafe mode (i.e. without a window
	manager), e.g. from xdm by pressing F1 after entering your
	password

	start a second xterm

	observe that keyboard focus follows the mouse as you move the
	mouse cursor over each xterm window and press keys

	start twm

	observe that keyboard focus no longer follows the mouse cursor

	kill twm

	observe that keyboard focus once again follows the mouse cursor

>Fix:

	unknown -- I don't even know where to begin to look in the
	sources for where/how the window manager interacts with the
	Xserver to control keyboard focus