From: brennan@hal.com (Dave Brennan)
Newsgroups: comp.windows.x
Subject: Focus event weirdness
Date: 18 Aug 92 22:49:15 GMT
Organization: HaL Computer Systems, Austin, TX
NNTP-Posting-Host: yosemite.hal.com

Whilst writing a widget I noticed that in some cases when I move the
pointer into my window (using a WM with focus follows pointer) some
times I get one FocusIn event, and other times I get FocusOut events
followed by FocusIn events (one each for the toplevel window and
widget window).  Here's the two cases from an xmon point of view
with the window manager (twm) and the client program routed through
xmon.  Window 04800013 is the toplevel window, and window 04800014 is
the widget's window.  While the net result is the same, the extra events
result in a bunch of extra drawing request from the widget which gives
creates some ugly flashing, or worse if you're on a slow X Terminal.

Can anyone tell me what's going on here?  For some reason the server
has decided to send a different set of focus events, seemingly based on
the speed that that the pointer moved, as the SetInputFocus requests
from the window manager look the same in each case.

Case 1:

Move the pointer into the window nice and slowly, and get once FocusIn event.


         ............REQUEST: SetInputFocus
             sequence number: 13679
                   revert-to: PointerRoot
              request length: 0003
                       focus: WIN 04800013
                        time: TIM 4794d7f1
         ............REQUEST: GetInputFocus
             sequence number: 13680
              request length: 0001
                                         ..............REPLY: GetInputFocus
                                                   revert-to: PointerRoot
                                             sequence number: 3570
                                                reply length: 00000000
                                                       focus: WIN 04800013
                                         ..............EVENT: FocusIn
                                                      detail: Nonlinear
                                             sequence number: 0eb8
                                                       event: WIN 04800013
                                                        mode: Normal
         ............REQUEST: GetInputFocus
             sequence number: 13685
              request length: 0001
                                         ..............REPLY: GetInputFocus
                                                   revert-to: PointerRoot
                                             sequence number: 3575
                                                reply length: 00000000
                                                       focus: WIN 04800013



Case 2:

Move the pointer into the window quickly and get this mess of events:

         ............REQUEST: SetInputFocus
             sequence number: 13816
                   revert-to: PointerRoot
              request length: 0003
                       focus: WIN 04800013
                        time: TIM 479615e2
         ............REQUEST: GetInputFocus
             sequence number: 13817
              request length: 0001
                                         ..............REPLY: GetInputFocus
                                                   revert-to: PointerRoot
                                             sequence number: 35f9
                                                reply length: 00000000
                                                       focus: WIN 04800013
         ............REQUEST: GetInputFocus
             sequence number: 13822
              request length: 0001
                                         ..............EVENT: FocusOut
                                                      detail: Pointer
                                             sequence number: 0ec4
                                                       event: WIN 04800014
                                                        mode: Normal
                                         ..............EVENT: FocusOut
                                                      detail: Pointer
                                             sequence number: 0ec4
                                                       event: WIN 04800013
                                                        mode: Normal
                                         ..............EVENT: FocusIn
                                                      detail: Nonlinear
                                             sequence number: 0ec4
                                                       event: WIN 04800013
                                                        mode: Normal
                                         ..............EVENT: FocusIn
                                                      detail: Pointer
                                             sequence number: 0ec4
                                                       event: WIN 04800014
                                                        mode: Normal
                                         ..............REPLY: GetInputFocus
                                                   revert-to: PointerRoot
                                             sequence number: 35fe
                                                reply length: 00000000
                                                       focus: WIN 04800013


--
Dave Brennan                                      HaL Computer Systems
brennan@hal.com                                         (512) 794-2855

Visit the Emacs Lisp Archive: archive.cis.ohio-state.edu:pub/gnu/emacs