home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / x / 15435 < prev    next >
Encoding:
Text File  |  1992-08-19  |  2.7 KB  |  74 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!centerline!noc.near.net!gateway!miki!oj
  3. From: oj@miki.pictel.com (Oliver Jones)
  4. Subject: Re: Focus event weirdness
  5. Message-ID: <1992Aug19.213435.1329@miki.pictel.com>
  6. Keywords: detail
  7. Organization: PictureTel Corporation
  8. References: <BRENNAN.92Aug18164915@yosemite.hal.com>
  9. Date: Wed, 19 Aug 1992 21:34:35 GMT
  10. Lines: 62
  11.  
  12. In article <BRENNAN.92Aug18164915@yosemite.hal.com> brennan@hal.com (Dave Brennan) writes:
  13. >Whilst writing a widget I noticed that in some cases when I move the
  14. >pointer into my window (using a WM with focus follows pointer) some
  15. >times I get one FocusIn event, and other times I get FocusOut events
  16. >followed by FocusIn events (one each for the toplevel window and
  17. >widget window).
  18.  
  19. >Can anyone tell me what's going on here? 
  20.  
  21. Yes, you have to look at the detail member of the Focus{In|Out} events
  22. to figure this out.
  23.  
  24. >          ..............EVENT: FocusOut
  25. >                       detail: Pointer
  26. >              sequence number: 0ec4
  27. >                        event: WIN 04800014
  28. >                         mode: Normal
  29.  
  30. This event gets delivered to your widget.  It's telling your
  31. widget that it is a pointer-containing inferior of the window which
  32. is actually losing the focus.
  33.  
  34. >          ..............EVENT: FocusOut
  35. >                       detail: Pointer
  36. >              sequence number: 0ec4
  37. >                        event: WIN 04800013
  38. >                         mode: Normal
  39.  
  40. This event gets delivered to your toplevel.   ditto.
  41.  
  42. The window actually losing the focus is the WM's wrapper, I guess.
  43.  
  44. >         ..............EVENT: FocusIn
  45. >                      detail: Nonlinear
  46. >             sequence number: 0ec4
  47. >                       event: WIN 04800013
  48. >                        mode: Normal
  49. This event gets delivered to your toplevel.  This one tells your toplevel
  50. that it has actually received the focus.
  51.  
  52. >         ..............EVENT: FocusIn
  53. >                      detail: Pointer
  54. >             sequence number: 0ec4
  55. >                       event: WIN 04800014
  56. >                        mode: Normal
  57.  
  58. This event gets delivered to your widget, and tells it that one of its
  59. ancestor windows received the focus WHILE the pointer was inside your
  60. widget's window.    You're in a race with something ... probably the
  61. window manager ... to see whether the pointer or the focus can get there
  62. first.
  63.  
  64. If your widget is monitoring whether it's going to receive KeyPress
  65. events or not (that is, if you're highlighting a data-entry field 
  66. or something similar), you need also to monitor EnterNotify and 
  67. LeaveNotify events. 
  68.  
  69. I don't usually do book plugs on usenet, but in this case I suggest
  70. you borrow a copy of Introduction to the X Window System
  71. (Prentice-Hall) from your local library and look at pp378 - 384.
  72.  
  73. Oliver Jones
  74.