[haiku-bugs] Re: [Haiku] #15254: BWindow shouldn't dispatch messages on behalf of BView

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sat, 17 Aug 2019 09:01:22 -0000

#15254: BWindow shouldn't dispatch messages on behalf of BView
----------------------------------+----------------------------
   Reporter:  simonsouth          |      Owner:  nobody
       Type:  bug                 |     Status:  new
   Priority:  normal              |  Milestone:  Unscheduled
  Component:  Kits/Interface Kit  |    Version:  R1/Development
 Resolution:                      |   Keywords:
 Blocked By:                      |   Blocking:
Has a Patch:  0                   |   Platform:  All
----------------------------------+----------------------------

Comment (by pulkomandy):

 If BeOS did it like this, I don't see a reason to change it. It's worth
 documenting it in the Haiku book and that's about it.

 Otherwise I don't see how the existing trick to get the CurrentMessage
 would still work, which would break all apps trying to do that (pretty
 much anything that handles keyboard events). This pretty much requires
 that KeyDown is handled while the window is inside its MessageReceived
 call.

 This makes some sense:
 - The input server is only concerned with dispatching the event to a
 window. It does not know what the window wants to do with it. In some
 cases there aren't views at all in awindow (BDirectWindow), or none of
 them has keyboard focus, or simply key down events need to get through
 some global processing first (menu shortcuts, etc). So from here it makes
 sense to deliver to the window.
 - To forward the message to a view, one could call the view
 MessageReceived directly, but that breaks some invariants about it (for
 example, BView::CurrentMessage wouldn't work). It could re-send the
 message properly (through another run of the event loop) but that seems
 not so useful and will add latency. Sothe remaining option is direct
 delivery to the keydown callback.

-- 
Ticket URL: <https://dev.haiku-os.org/ticket/15254#comment:6>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: