[haiku-3rdparty-dev] Re: Capturing control commands in Haiku

  • From: "Yashasvi A.C." <yashasviac@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Tue, 8 Sep 2009 11:49:22 +1200

>
> Zenja Solaja schrieb:
>
>> Hi Yash.
>>
>> Isn't each BControl message application specific?  Eg.  In my apps, I'd
>> create my own message associated with each BControl (eg. 'open', 'save'),
>> but this will always be app specific.   BTW - I'm quite sure that you know
>> that BeOS allows scripting of BMessages - have a look at Hey (
>> http://wiki.bebits.com/page/HeY).
>>
>> As far as I know, drawing commands are not sent via messages, instead the
>> app server directly invokes hook functions  - your derived BView class's
>> method Draw(BRect..).  This is different from say Win32 which sends a
>> WM_PAINT message.  Without looking at the source implementation, I'd suspect
>> BeInc did it this way to synchronise redraws and prevent screen tearing,
>> since the applications BHandler runs in a seperate thread, hence a lot of
>> time may pass until your app is scheduled to receive messages, and during
>> this time you will not actually update the screen.  A hook function allows
>> the app server to directly invoke screen updates.  I hope this makes sense,
>> otherwise I can write a lengthier explanation.
>>
> This information is incorrect. The drawing is performed asynchronously (in
> BeOS as in Haiku). The app_server sends repaint requests to the client
> windows, which would be similar to WM_PAINT, but in Haiku it's called
> _UPDATE_. The default BWindow DispatchMessage() implementation calls
> BView::Draw() hooks (in the window thread of course) of the affected views.
>
> You can intercept the _UPDATE_ messages in your own application, I am not
> sure if it's possible to intercept the messages of other applications.
>
> However, Yash, the best way to ask for help if probably if you describe
> more "high-level" what you are trying to do, rather than guess at the
> low-level implementation and ask about how to accomplish that. There may be
> a better low-level solution, if you explain your high-level goals.
>
> Best regards,
> -Stephan
>

Hi,
Well, the hypothesis of my Masters thesis is to validate the possibility of
developing an automated help system using a message-oriented operating
system such as Haiku. The help system interface sits on top of an existing
application and is called on hitting the "Alt-H" button.

Thus, I would like to capture/"listen to" any types of messages that are
passed to and fro the interface and Application Server. I would like to then
store these messages in a BFile format in a specific folder. Later on, when
the Help Interface is called, I would like to run a query on these message
attributes in the BFile and obtain "xyz" messages for displaying in the help
menu. How the message information will be converted into human readable form
is something I would have to look into later. :)

Well, I have been able to capture the basic messages like MouseDown _MDN,
and so on. However, when I spoke to my supervisor, Christof, he did mention
capturing a few more types of messages like the drawing commands and also
High-level commands like "Button 1 clicked" which would be more useful than
_MDN and so forth.

The way I have been able to capture the basic messages is using
message_print_hook(). Hope that explains what I am trying to do.

So, how do i capture the other 2 types of messages described above? I do
understand that the high-level commands need to be manually set by me but I
have no idea how or where.

Thanks,
Yash

Other related posts: