History log of /haiku/src/kits/app/Looper.cpp
Revision Date Author Comments
# ebb0db62 04-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kits: Only export private dummy copy constructors for R5 ABI.

Fixes #546 (after all these years!)


# 151343eb 27-Nov-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

BLooper: API to hijack existing thread.

I need this to use loopers in WebKit, which spawns threads and expects
to be able to turn them into event loops later on.

This is the pattern already used in BApplication, we may as well make it
available elsewhere.

Change-Id: I5939ca89d33cb3bcc92567b302c2038d976af598
Reviewed-on: https://review.haiku-os.org/735
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 16af9b4c 05-Nov-2017 Humdinger <humdingerb@gmail.com>

Style, no functional changes

Make termination consistant with that last commit hrev51521.
As wished and proof-read by waddlesplash. Hope all's well...


# 7d407a1e 08-Aug-2015 Augustin Cavalier <waddlesplash@gmail.com>

BLooper: Fix inverted check that was causing a port leak.

Fixes #12286. Thanks to ttcoder & jackburton for investigating!


# 798ad3db 23-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

BLooper: don't delete a launch_daemon port.

* Unless the service is really to be quit, the port should stay around;
but that decision is to be made by the launch_daemon, not the service
itself.


# 1480e5da 02-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

The beginnings of a launch_daemon for Haiku.

* This will be heavily inspired by Apple's launchd, as well as
systemd -- for now it really doesn't do a whole lot, though.
* What works so far: the configuration files are read, parsed, and
the jobs created.
* The jobs are even initialized, and their message ports created.
* BApplication now retrieves a previously created port from the
launch_daemon for use with BServer.
* Only the registrar actually uses this for now.


# 446d4dca 30-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

Looper.cpp: fixed include order.


# be902ac4 11-Jun-2014 John Scipione <jscipione@gmail.com>

App Kit: style changes.

No functional change intended.

Focused on documented classes only.

* Update copyright information.
* whitespace fixes.
* pointer style
* Rename some variables, msg => message, form => what
* Need consistent variable names to make documentation easier,
allows us to use \copydoc or \copydetails instead of repeating
ourselves over and over again.


# 5d7f782d 20-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BLooper: Add DispatchExternalMessage()

* This is primarily a service method for ports of widget tool kits
that require single-threaded GUI. DispatchExternalMessage() calls
DispatchMessage(), but also sets fLastMessage, so that
[Detach]CurrentMessage() work correctly. This allows to detach a
message in DispatchMessage() when called from the window thread,
add it to a global queue, and later process the queued messages in
a different thread that calls DispatchExternalMessage().
* BLooper/BWindow: Make sure fLastMessage is accessed only when locked.


# fd5c87d5 26-Oct-2013 Axel Dörfler <axeld@pinc-software.de>

BLooper: removed superfluous locking and code in PostMessage().

* The code duplicated the code found in the BMessenger constructor that
it called a few lines below. This should improve PostMessage()
performance a tiny bit.


# 9be774b5 30-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compilation and 64-bit fixes to libbe.so sources.

Fixed the usual issues - printf format strings, uint32 instead of
addr_t, etc. One thing that isn't so nice is several places where
BList is used to store (u)int32, these require a double cast to addr_t
then void* to silence a warning on x86_64.


# 4bbb27e3 12-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

More 'GCC4.6 variable set but not used' fixes.


# edbfa1c7 29-Oct-2011 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42978 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f47952f7 29-May-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

If the looper is B_QUIT_REQUESTED synchronously. First quit and then send the reply message. Please check if this is the
correct semantics. I expected that the looper is dead when SendMessage returned. This should fix #7559 where the looper
destructor has to be called before continuing the cleanup.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41821 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18cd67c7 22-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

Add missing headers (malloc/free, string functions, memcpy, etc. undeclared).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f72ed717 07-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

The previous loop to remove all the BHandlers in the destructor was really quite
inefficient. And while it did check if the handler was not NULL, it would have
resulted in an endless loop if it was. I think we can safely assume we have no
NULL BHandlers in that list though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26870 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2805ca9 06-Jul-2008 Karsten Heimrich <host.haiku@gmx.de>

* Archive the thread priority as well, it can be found in an R5 archive if Run() was called.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26276 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8417b8d8 18-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a comment in _InitData() to make it more obvious when the looper is
locked.
* Removed some long and useless comments.
* Other minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24445 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd6a90a7 04-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

_PostMessage() was holding the BLooperList lock while calling
BMessenger::SendMessage(), which could lead to deadlocks (as in bug
#1745).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 616e68e7 21-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* IsLocked() now also uses the fCachedStack method that check_lock() is
already using.
* We don't have to try posting _QUIT_ more than once, as it cannot block; the
looper is local, so direct message passing is used in this case.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1260fa65 08-Aug-2007 Axel Dörfler <axeld@pinc-software.de>

fCachedStack needs to be initialized and reset when the looper is unlocked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21864 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eaad52e8 08-Aug-2007 Axel Dörfler <axeld@pinc-software.de>

Now uses the cache stack trick for a cheaper check_lock() version as suggested by stippi.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21863 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b2ec438 26-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the AutoLocker class out of the kernel/utils/AutoLock.h header
into its own shared/AutoLocker.h. It can be used by userland code too.
* Removed headers/private/shared/ObjectLocker.h and replaced all uses of
BObjectLocker by AutoLocker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20432 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9dbe170a 26-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Implemented direct message passing for local targets; this fixes a deadlock
with PostMessage() in case the message queue is full.
Some notes:
* for synchronous replies, we don't use this mechanism yet, but it could be
extended to do that as well.
* the code looks so complicated because we need a way to access the looper's
queue without locking it (to prevent deadlocks); like Dano's solution, I've
abused BTokenSpace to store a BDirectMessageTarget with a BHandler.
* we also need to decouple the lifetime of a looper's queue from its target,
as we cannot lock the looper, and therefore, can't guarantee it stays valid
as long as we're accessing it outside of BLooper.
* init_clipboard() now needs to be done after the global constructors have
been called - since sending messages now needs gDefaultTokens to be initialized.
Since this is done per image, it shouldn't cause any troubles, though.
* some minor cleanup, removed unused _msg_cache_cleanup_() and friends.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19968 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c01f349e 25-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Cleanup:
* Got rid of unused BLooper members
* renamed fTaskID to fThread
* Removed private and deprecated AddLooper()/RemoveLooper()/... stuff; BLooper is now
directly calling BLooperList methods.
* Got rid of extensive and useless comments
* Made a few TODOs more clear
* Merged InitData() and InitData(...) to _InitData(...)
* BLooper::Team() now uses BPrivate::current_team(), sTeamID is gone now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19966 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ca9b9188 25-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a Dano extension to BMessageQueue: IsNextMessage().
* BLooper::AddMessage() is now using this method to determine wether or not to
update its looper thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19956 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ddcab3b5 13-Jun-2006 Jérôme Duval <korli@users.berlios.de>

also check for GetCurrentSpecifier status instead of just the index


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17821 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e91315aa 11-Jun-2006 Jérôme Duval <korli@users.berlios.de>

scripting in BApplication is mostly fixed
BLooper had a be-handler named suite
BWindow is now exposing Active
scripting to BViews isn't working yet


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17797 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f4fc3d62 05-Jun-2006 Jérôme Duval <korli@users.berlios.de>

* fixed some more GetSupportedSuites implementations
* fixed some local variables names
* fixed the case of some message attribute names


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17734 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 791b9c21 07-Apr-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

in case DEBUG is defined, BLooper don't use the benaphore style lock. Useful for debugging

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17045 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 68ead3ea 22-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BLooper uses a benaphore style lock, should save some cycles. I hope this wasn't left out on purpose

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16864 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9bee75b 11-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

fix a problem in case the port id was indeed 0, which is very unlikely though

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16714 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 69904185 23-Feb-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed some more bugs in the message passing by area
* Reordered some functions
* Area messages can now be unflattened instead of using the private _Reference and a special port code

Passing by area is now mostly working but it's not yet enabled. I will have to conduct performance tests first to see if and starting at what messagesize the overhead is reasonable.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16500 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38b52de9 18-Feb-2006 Michael Lotz <mmlr@mlotz.ch>

Hopefully fixed the build when not using Message4. As Message4 works well and is less broken than the older implementation we should maybe switch to it completely.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16461 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 721a0fe3 17-Feb-2006 Michael Lotz <mmlr@mlotz.ch>

Started implementing message passing by area. This will be needed for drag & drop messages and will probably be used for large messages instead of sending them through a port. Not yet finished and not enabled. Cleaned up a part of BLooper - this class should probably be cleaned up completely.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16459 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7c686564 25-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* Don't trust a message that we got goes to a handler that belongs to us.
* when we terminate gracefully and in the looper's thread, we no longer
unlock ourselves.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15155 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 43ca7765 23-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* applied the logic from BWindow::task_looper() to BLooper as well (messages to
invalid target handlers are dropped).
* B_PREFERRED messages now go to the looper if there is no other preferred handler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 85606ee1 22-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed DetachCurrentMessage():
* the current message is not part of the queue when it's dispatched, so it
doesn't make any sense to try to remove it.
* it's only to be called during message processing - and at that time, the
looper is locked, anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15079 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14d02d22 21-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Huge cleanup and fixes:
* attachView() is now called _CreateSelf() and creates the app_server
view counterpart for itself, and no longer for a child view.
* removed superfluous deleteView().
* moved drawing from BWindow::DoUpdate() to BView::_Draw().
* made the recursive hook call functions consistent.
* fixed BWindow::DispatchMessage() to send public messages to the intended
target (instead of always handling them itself directly).
* DispatchMessage() no longer eats unmapped key events that were targeted
at the window directly.
* B_KEY_DOWN and B_KEY_UP events are now send to the target view as well
(this couldn't work before as BMessages were broken with B_PREFERRED_TOKEN).
* the default button is now correctly targeted by BWindow::_DetermineTarget()
(previously, the enter key was hacked to get through via _HandleKeyDown()).
* removing a view now also makes sure it won't have focus any longer.
* also, the DetachedFromWindow() hooks are now called first, so that any
changes made there cannot mess up our window anymore.
* removed BView::SetPattern(); _UpdatePattern() now does its job.
* renamend private methods to match our preferred style.
* removed unused methods and variables.
* more consistent naming overall.
* removed _PR3_COMPATIBLE_ stuff - there is definitely no need for us to be
compatible to that one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15060 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ace01f86 19-Nov-2005 Adi Oanca <adioanca@nowhere.fake>

Removed BWindow::_DetermineTarget(). BWindow's task_looper() just calls BLooper's one. Took Message4 stuff from BWindow's task_looper() and put it in BLooper::task_looper() - guess this is wanted...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15037 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0139f287 19-Nov-2005 Adi Oanca <adioanca@nowhere.fake>

Following recent changes (Axel's token stuff or Message4 impl) I could not launch a single application/window in app_server. This fixes the problem. Note I always test with DEBUG=1. Am I the only one who had this problem?

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15033 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cf10934e 13-Nov-2005 Michael Lotz <mmlr@mlotz.ch>

Introducing Message4. The changes to the related sources are ifdefed with USING_MESSAGE4 which is defined in Message4.h. To use Message4 the Message4.cpp, Message4.h, MessageUtils4.cpp, MessageUtils4.h and MessagePrivate4.h have to be linked to their counterparts without 4 suffix. Then MessageBody.cpp and MessageField.cpp have to be commented out in the app kit Jamfile and r5_message.cpp has to be added. There remain some bugs to be found. Feel free to change that.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14882 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b93d2480 05-Jul-2005 Axel Dörfler <axeld@pinc-software.de>

Now drops into the debugger if the window/looper is still locked in task_looper().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13480 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b2086a9b 05-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

just in case someone continues in the debugger

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7089b0e3 04-Jul-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

If a filter was added to a handler which belonged to a looper, the filter's looper was never initialized. BHandler::SetLooper() now also sets the looper for every filter (moved from BLooper::AddHandler)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13426 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f903d78 04-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed the handling of B_QUIT_REQUESTED in BApplication::DispatchMessage().
It's already done in BLooper. Now we additionally send a reply to it, when
the message comes from the registrar on shutdown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13419 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 837261c6 16-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

This removes the "error: looper must be locked when quit" message.
I haven't yet fully investigated the looper quitting mechanism in
detail, so there might be more bugs left.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13184 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 410d5c37 15-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Implemented BLooper::check_lock().
Use AssertLock() more often instead of varying debugger messages.
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13167 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 683be71e 05-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Added stuff for AddMessage() and _AddMessagePriv() - mostly comments
on what they should.
More cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12960 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3cd9c864 04-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Quit() when called from another thread, never posted _QUIT_ to the looper,
and therefore waited indefinitely for its demise.
Run() had the usual "if error != my special error -> everything fine" that
seems to be everywhere in the Application Kit.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12956 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dd3d1f72 28-May-2005 Axel Dörfler <axeld@pinc-software.de>

BLooper::InitData() will now choose a default name ("anonymous looper") in case
no name was specified on creation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fde1c7aa 06-Feb-2005 Adi Oanca <adioanca@nowhere.fake>

Sorry I did not know about BMessage::Private::SetTarget()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11280 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecb03027 06-Feb-2005 Adi Oanca <adioanca@nowhere.fake>

implemented _set_message_target_()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bcab07ad 14-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* More sophisticated debug output macro.
* Fixed BLooper::ReadMessageFromPort(). If ReadRawFromPort() failed,
there was nevertheless a message created and dispatched.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10738 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5c962d4 11-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Enhanced debugging output to print also the thread ID.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10676 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3339a96b 04-Mar-2004 Axel Dörfler <axeld@pinc-software.de>

Fixed ReadFromRawPort(); it was severly broken (the missing B_RELATIVE_TIMEOUT
flag was reported by Bill Hayden).
I fixed only this method, and nothing else, but please have a look at how
I did it, and apply the same fixes, thanks!


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6902 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3638a5ea 12-Jan-2004 Adi Oanca <adioanca@nowhere.fake>

just a simple variable set to true....


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6047 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b07c31a7 17-Oct-2003 ejakowatz <ejakowatz@nowhere.fake>

Finished up some scripting-related items.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5080 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17e6de7a 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 36535a17 11-Jul-2003 haydentech <haydentech@nowhere.fake>

Fix use of uninitialized variable


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3956 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e9a7f0c 11-Jun-2003 haydentech <haydentech@nowhere.fake>

Fix unintended code path when debug macros are turned off


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3474 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7bb1eb82 03-Sep-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed BLooper::UnlockFully(): It assumed benaphore style locking whereas semaphore style is used.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@977 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 77a6586a 25-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Another test with minor tweaks to BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@874 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb5b0f6d 24-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixed SetCommonFilterList() so that the same list can't be added to more
than one looper.
Implemented UnlockFully(), and changed destructor and Quit() to use it.
Reordered the destructor slightly so as to delete fLockSem *after* the call
to UnlockFully().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@869 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d008c62d 23-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixed a narsty little bug that suddenly started rearing its ugly head in
IsMessageWaiting() test #3. fLastMessage wasn't getting initialized to
NULL on construction, and the random value was finally biting me. All
better now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@856 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff1ade6b 21-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests and fixes for bugs exposed by them. Also removed spurious
instantiation of BRoster from BArchivable, line 323, as per Tyler's
mention. =)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@852 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e2e159a 05-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Work on ResolveSpecifier().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@599 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a757163 04-Aug-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Added TODO items in the destructor.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c26a5cea 04-Aug-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

* The destructor doesn't kill the looper thread any more, as this doesn't
work very well with BApplication and has some issue with plain loopers
too.
* DispatchMessage(): _QUIT_ doesn't delete the object any longer. The
looper thread simply falls through the dispatching loop and deletes
the object.
* Caused by not killing the looper thread in the destructor, Quit() had
to be adjusted. When called from the looper thread the thread exists.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@576 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 752c4971 04-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

The last remnants of the Old Repub ... er, static looper list data has been
removed. The old static BLooper functions for managing the looper list are
still there, but they are officially deprecated. The approved interface
for this information is BPrivate::BLooperList, accessible via the global
BPrivate::gLooperList variable. Being as it lives in BPrivate, it is for
API-internal use *ONLY*. User apps use it to their own risk.
Also added a small test to make sure that the size of BLooper stays the
same. I will probably add this to other classes as well; doesn't hurt to
be safe. =)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@572 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0b55d664 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests, more fixes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@528 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7bf6c069 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests with fixes to BLooper so it will pass those tests.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@527 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b1698c8e 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Mostly fixes for silly compile error, plus an additional test.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@524 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 822cdddb 28-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed bug in AddHandler(): SetNextHandler() must not be invoked on the looper itself.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@522 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2284462c 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Scripting-related changes. Also indulged in some unwarrented formatting
anality. =P


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@519 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 92180c47 26-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Get the current team not using fTaskID, the looper thread, but find_thread(NULL) instead. In InitData() the thread has not been spawned yet.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@456 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 459de0d7 23-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixed stupid syntax errors generated by my property_info dump tool. Now to
fix the tool ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@402 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec9673bf 22-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Added/tweaked tests for BLooper; fixes to BLooper stemming from those tests


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@389 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 30304f2d 21-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed warnings.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@379 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76858a33 19-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

BLooper::LockWithTimeout() was always using B_INFINITE_TIMEOUT.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@344 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 19ba51b7 17-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More BLooper tests and minor tweaks.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 04de1897 17-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests for BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@286 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38f5ceca 17-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Some more BLooper unit tests, with some minor resulting tweaks to BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@264 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e3684651 16-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Finally figured out why the first assert in IsMessageWaiting5() always
worked under R5 but only sometimes for OBOS. Answer: the OBOS
implementation of BLooper was attempting to lock itself prior to fetching
the message from the queue. I moved the lock attempt after the fetch and
it worked the same. I realized that if the system was loaded heavily
enough, the assert might still fail simply because the looper would not had
enough time to get to the fetch (thereby emptying the queue), making the
assert pretty useless. Given that it was originally there as a probing
test (rather than as an integral part of the unit test), there is no real
need for it anyway, so it is no longer used.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@250 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abb57933 15-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Tweaks to deal with new repository hierarchy and use of unified CppUnit;
some bug fixes and a couple of new tests for BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@242 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 865f9d8e 11-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixes in BLooper and its tests.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@84 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d407a1e99e9c375aaa1f9cb577401b6b52735ae 08-Aug-2015 Augustin Cavalier <waddlesplash@gmail.com>

BLooper: Fix inverted check that was causing a port leak.

Fixes #12286. Thanks to ttcoder & jackburton for investigating!


# 798ad3db303ec486d507f32915193f3456bfca86 23-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

BLooper: don't delete a launch_daemon port.

* Unless the service is really to be quit, the port should stay around;
but that decision is to be made by the launch_daemon, not the service
itself.


# 1480e5da6fc4a2926c3da1a973e39927ac2171ae 02-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

The beginnings of a launch_daemon for Haiku.

* This will be heavily inspired by Apple's launchd, as well as
systemd -- for now it really doesn't do a whole lot, though.
* What works so far: the configuration files are read, parsed, and
the jobs created.
* The jobs are even initialized, and their message ports created.
* BApplication now retrieves a previously created port from the
launch_daemon for use with BServer.
* Only the registrar actually uses this for now.


# 446d4dca66299b1938b73ca3023d66175f26f299 30-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

Looper.cpp: fixed include order.


# be902ac4db5c9d0be72f6d54aa67b66e3dcc7eca 11-Jun-2014 John Scipione <jscipione@gmail.com>

App Kit: style changes.

No functional change intended.

Focused on documented classes only.

* Update copyright information.
* whitespace fixes.
* pointer style
* Rename some variables, msg => message, form => what
* Need consistent variable names to make documentation easier,
allows us to use \copydoc or \copydetails instead of repeating
ourselves over and over again.


# 5d7f782d4e505cb5788cdfb2abf7bdd174af084e 20-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BLooper: Add DispatchExternalMessage()

* This is primarily a service method for ports of widget tool kits
that require single-threaded GUI. DispatchExternalMessage() calls
DispatchMessage(), but also sets fLastMessage, so that
[Detach]CurrentMessage() work correctly. This allows to detach a
message in DispatchMessage() when called from the window thread,
add it to a global queue, and later process the queued messages in
a different thread that calls DispatchExternalMessage().
* BLooper/BWindow: Make sure fLastMessage is accessed only when locked.


# fd5c87d53c6e1952c48326ce77443b468091f915 26-Oct-2013 Axel Dörfler <axeld@pinc-software.de>

BLooper: removed superfluous locking and code in PostMessage().

* The code duplicated the code found in the BMessenger constructor that
it called a few lines below. This should improve PostMessage()
performance a tiny bit.


# 9be774b553296a712704078314f2291ae5fc352c 30-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compilation and 64-bit fixes to libbe.so sources.

Fixed the usual issues - printf format strings, uint32 instead of
addr_t, etc. One thing that isn't so nice is several places where
BList is used to store (u)int32, these require a double cast to addr_t
then void* to silence a warning on x86_64.


# 4bbb27e3ccf0b1e38ee4a63ca9ec765e167a72bd 12-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

More 'GCC4.6 variable set but not used' fixes.


# edbfa1c70bca24f1d903e8bcfcabfa26014bc43e 29-Oct-2011 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42978 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f47952f72339c14c443a793b54802ebd084626ef 29-May-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

If the looper is B_QUIT_REQUESTED synchronously. First quit and then send the reply message. Please check if this is the
correct semantics. I expected that the looper is dead when SendMessage returned. This should fix #7559 where the looper
destructor has to be called before continuing the cleanup.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41821 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18cd67c76072f825c4a7ba58414771d47fd1bfa2 22-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

Add missing headers (malloc/free, string functions, memcpy, etc. undeclared).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f72ed717b41c14c0c13f71d5490c58867fcff421 07-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

The previous loop to remove all the BHandlers in the destructor was really quite
inefficient. And while it did check if the handler was not NULL, it would have
resulted in an endless loop if it was. I think we can safely assume we have no
NULL BHandlers in that list though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26870 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2805ca9aa30fe656f41eabf19d253c68f4387a5 06-Jul-2008 Karsten Heimrich <host.haiku@gmx.de>

* Archive the thread priority as well, it can be found in an R5 archive if Run() was called.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26276 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8417b8d87f509f5bf49a2985c0b87ab83d8b7912 18-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a comment in _InitData() to make it more obvious when the looper is
locked.
* Removed some long and useless comments.
* Other minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24445 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd6a90a7e25424ad5739fd98c80139d9c93772fc 04-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

_PostMessage() was holding the BLooperList lock while calling
BMessenger::SendMessage(), which could lead to deadlocks (as in bug
#1745).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 616e68e76ca5e60cade14430cef37b30358309a6 21-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* IsLocked() now also uses the fCachedStack method that check_lock() is
already using.
* We don't have to try posting _QUIT_ more than once, as it cannot block; the
looper is local, so direct message passing is used in this case.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1260fa65958a65b93a6d3397a7dd5a29eb5c922b 08-Aug-2007 Axel Dörfler <axeld@pinc-software.de>

fCachedStack needs to be initialized and reset when the looper is unlocked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21864 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eaad52e8d72af216e4b306cd34323e30bb976130 08-Aug-2007 Axel Dörfler <axeld@pinc-software.de>

Now uses the cache stack trick for a cheaper check_lock() version as suggested by stippi.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21863 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b2ec4382a637811afeb5a4fa812052aef2779c6 26-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the AutoLocker class out of the kernel/utils/AutoLock.h header
into its own shared/AutoLocker.h. It can be used by userland code too.
* Removed headers/private/shared/ObjectLocker.h and replaced all uses of
BObjectLocker by AutoLocker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20432 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9dbe170a694e59988263a752b746b6a82a5ff277 26-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Implemented direct message passing for local targets; this fixes a deadlock
with PostMessage() in case the message queue is full.
Some notes:
* for synchronous replies, we don't use this mechanism yet, but it could be
extended to do that as well.
* the code looks so complicated because we need a way to access the looper's
queue without locking it (to prevent deadlocks); like Dano's solution, I've
abused BTokenSpace to store a BDirectMessageTarget with a BHandler.
* we also need to decouple the lifetime of a looper's queue from its target,
as we cannot lock the looper, and therefore, can't guarantee it stays valid
as long as we're accessing it outside of BLooper.
* init_clipboard() now needs to be done after the global constructors have
been called - since sending messages now needs gDefaultTokens to be initialized.
Since this is done per image, it shouldn't cause any troubles, though.
* some minor cleanup, removed unused _msg_cache_cleanup_() and friends.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19968 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c01f349e6d41177d7be185b217eac237bcee621f 25-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Cleanup:
* Got rid of unused BLooper members
* renamed fTaskID to fThread
* Removed private and deprecated AddLooper()/RemoveLooper()/... stuff; BLooper is now
directly calling BLooperList methods.
* Got rid of extensive and useless comments
* Made a few TODOs more clear
* Merged InitData() and InitData(...) to _InitData(...)
* BLooper::Team() now uses BPrivate::current_team(), sTeamID is gone now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19966 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ca9b91886d763fed3bdc32530cd052ff0b7fef6b 25-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a Dano extension to BMessageQueue: IsNextMessage().
* BLooper::AddMessage() is now using this method to determine wether or not to
update its looper thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19956 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ddcab3b57da9673c1aafe224137989c609c1abcb 13-Jun-2006 Jérôme Duval <korli@users.berlios.de>

also check for GetCurrentSpecifier status instead of just the index


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17821 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e91315aa2da185db26644ce0adad61bdde18108e 11-Jun-2006 Jérôme Duval <korli@users.berlios.de>

scripting in BApplication is mostly fixed
BLooper had a be-handler named suite
BWindow is now exposing Active
scripting to BViews isn't working yet


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17797 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f4fc3d626a425bf59886cd5773fd2f64ff285b10 05-Jun-2006 Jérôme Duval <korli@users.berlios.de>

* fixed some more GetSupportedSuites implementations
* fixed some local variables names
* fixed the case of some message attribute names


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17734 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 791b9c2141bc1eba84a930e28b5dbbf36ca88a32 07-Apr-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

in case DEBUG is defined, BLooper don't use the benaphore style lock. Useful for debugging

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17045 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 68ead3ea064920f7f4ede7491f06653522689c0b 22-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BLooper uses a benaphore style lock, should save some cycles. I hope this wasn't left out on purpose

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16864 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9bee75b3ee9cfee38b19f4db30706ca987f8dae 11-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

fix a problem in case the port id was indeed 0, which is very unlikely though

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16714 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 69904185194cae567421c9fedc1cb041e7f0aa45 23-Feb-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed some more bugs in the message passing by area
* Reordered some functions
* Area messages can now be unflattened instead of using the private _Reference and a special port code

Passing by area is now mostly working but it's not yet enabled. I will have to conduct performance tests first to see if and starting at what messagesize the overhead is reasonable.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16500 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38b52de9378736ef4fb269e9be65253edbcdb497 18-Feb-2006 Michael Lotz <mmlr@mlotz.ch>

Hopefully fixed the build when not using Message4. As Message4 works well and is less broken than the older implementation we should maybe switch to it completely.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16461 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 721a0fe3e435bb37d7109a9f5a8998e4e2d1e8e1 17-Feb-2006 Michael Lotz <mmlr@mlotz.ch>

Started implementing message passing by area. This will be needed for drag & drop messages and will probably be used for large messages instead of sending them through a port. Not yet finished and not enabled. Cleaned up a part of BLooper - this class should probably be cleaned up completely.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16459 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7c6865642c9d63f98875742a47e9f28b281f3653 25-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* Don't trust a message that we got goes to a handler that belongs to us.
* when we terminate gracefully and in the looper's thread, we no longer
unlock ourselves.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15155 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 43ca7765639a4413378cf3fd4454602f4bd204e9 23-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* applied the logic from BWindow::task_looper() to BLooper as well (messages to
invalid target handlers are dropped).
* B_PREFERRED messages now go to the looper if there is no other preferred handler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 85606ee1dec9fe9f3fdfa3d151bf9e4849331645 22-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed DetachCurrentMessage():
* the current message is not part of the queue when it's dispatched, so it
doesn't make any sense to try to remove it.
* it's only to be called during message processing - and at that time, the
looper is locked, anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15079 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14d02d22f66d08946519ad2b073be23fa78fc0c3 21-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Huge cleanup and fixes:
* attachView() is now called _CreateSelf() and creates the app_server
view counterpart for itself, and no longer for a child view.
* removed superfluous deleteView().
* moved drawing from BWindow::DoUpdate() to BView::_Draw().
* made the recursive hook call functions consistent.
* fixed BWindow::DispatchMessage() to send public messages to the intended
target (instead of always handling them itself directly).
* DispatchMessage() no longer eats unmapped key events that were targeted
at the window directly.
* B_KEY_DOWN and B_KEY_UP events are now send to the target view as well
(this couldn't work before as BMessages were broken with B_PREFERRED_TOKEN).
* the default button is now correctly targeted by BWindow::_DetermineTarget()
(previously, the enter key was hacked to get through via _HandleKeyDown()).
* removing a view now also makes sure it won't have focus any longer.
* also, the DetachedFromWindow() hooks are now called first, so that any
changes made there cannot mess up our window anymore.
* removed BView::SetPattern(); _UpdatePattern() now does its job.
* renamend private methods to match our preferred style.
* removed unused methods and variables.
* more consistent naming overall.
* removed _PR3_COMPATIBLE_ stuff - there is definitely no need for us to be
compatible to that one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15060 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ace01f864b2b7923d770d6af1331cfc3adc05eee 19-Nov-2005 Adi Oanca <adioanca@nowhere.fake>

Removed BWindow::_DetermineTarget(). BWindow's task_looper() just calls BLooper's one. Took Message4 stuff from BWindow's task_looper() and put it in BLooper::task_looper() - guess this is wanted...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15037 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0139f287b400e0a4d6601f8250910ac28c2ee6f7 19-Nov-2005 Adi Oanca <adioanca@nowhere.fake>

Following recent changes (Axel's token stuff or Message4 impl) I could not launch a single application/window in app_server. This fixes the problem. Note I always test with DEBUG=1. Am I the only one who had this problem?

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15033 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cf10934e5fde37c267f7fb3bec89a8e9f5d9c476 13-Nov-2005 Michael Lotz <mmlr@mlotz.ch>

Introducing Message4. The changes to the related sources are ifdefed with USING_MESSAGE4 which is defined in Message4.h. To use Message4 the Message4.cpp, Message4.h, MessageUtils4.cpp, MessageUtils4.h and MessagePrivate4.h have to be linked to their counterparts without 4 suffix. Then MessageBody.cpp and MessageField.cpp have to be commented out in the app kit Jamfile and r5_message.cpp has to be added. There remain some bugs to be found. Feel free to change that.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14882 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b93d2480cc97e6d3c3ff2e69062e6cddc45dd1fc 05-Jul-2005 Axel Dörfler <axeld@pinc-software.de>

Now drops into the debugger if the window/looper is still locked in task_looper().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13480 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b2086a9ba0c71e99eb025c0753c4d104cbb08cc6 05-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

just in case someone continues in the debugger

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7089b0e3dcc8f8f523375aed0ce0e5051207505c 04-Jul-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

If a filter was added to a handler which belonged to a looper, the filter's looper was never initialized. BHandler::SetLooper() now also sets the looper for every filter (moved from BLooper::AddHandler)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13426 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f903d78cf3b640dc22f16b085530fe6efa68c5f 04-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed the handling of B_QUIT_REQUESTED in BApplication::DispatchMessage().
It's already done in BLooper. Now we additionally send a reply to it, when
the message comes from the registrar on shutdown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13419 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 837261c6bbda16f77bc6cd5d69703d4a5c2906db 16-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

This removes the "error: looper must be locked when quit" message.
I haven't yet fully investigated the looper quitting mechanism in
detail, so there might be more bugs left.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13184 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 410d5c37d57ed16263815a011413018c4fae8e50 15-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Implemented BLooper::check_lock().
Use AssertLock() more often instead of varying debugger messages.
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13167 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 683be71e08f0bc08c68430452ea590a41157559a 05-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Added stuff for AddMessage() and _AddMessagePriv() - mostly comments
on what they should.
More cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12960 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3cd9c864536f6308111b54a951e408e0fc9ef963 04-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Quit() when called from another thread, never posted _QUIT_ to the looper,
and therefore waited indefinitely for its demise.
Run() had the usual "if error != my special error -> everything fine" that
seems to be everywhere in the Application Kit.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12956 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dd3d1f72acf4e32430623aed865a1336d4db9a58 28-May-2005 Axel Dörfler <axeld@pinc-software.de>

BLooper::InitData() will now choose a default name ("anonymous looper") in case
no name was specified on creation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fde1c7aa305a906edcfc36008c4a6c7295ad035e 06-Feb-2005 Adi Oanca <adioanca@nowhere.fake>

Sorry I did not know about BMessage::Private::SetTarget()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11280 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecb03027eb7c7e111a9cdfcee24df50e35a1f9f1 06-Feb-2005 Adi Oanca <adioanca@nowhere.fake>

implemented _set_message_target_()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bcab07add0512a547028cb0a6a11b0085f1ee4ec 14-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* More sophisticated debug output macro.
* Fixed BLooper::ReadMessageFromPort(). If ReadRawFromPort() failed,
there was nevertheless a message created and dispatched.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10738 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5c962d426deeb5068a294ae118351bdec713664 11-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Enhanced debugging output to print also the thread ID.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10676 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3339a96ba664439a591e757a296645a5418e4f46 04-Mar-2004 Axel Dörfler <axeld@pinc-software.de>

Fixed ReadFromRawPort(); it was severly broken (the missing B_RELATIVE_TIMEOUT
flag was reported by Bill Hayden).
I fixed only this method, and nothing else, but please have a look at how
I did it, and apply the same fixes, thanks!


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6902 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3638a5ea21af1644de5415e325ff50b18cb4bb89 12-Jan-2004 Adi Oanca <adioanca@nowhere.fake>

just a simple variable set to true....


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6047 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b07c31a73fa621d0e407e0912e016dbf1f4b4d73 17-Oct-2003 ejakowatz <ejakowatz@nowhere.fake>

Finished up some scripting-related items.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5080 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17e6de7a37c5c61f45eb724de108daa70905cb8f 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 36535a172872e275ed1ddfb47af4cdff319aaed5 11-Jul-2003 haydentech <haydentech@nowhere.fake>

Fix use of uninitialized variable


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3956 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e9a7f0c993d0ac49002d66778545d329d5afbd7 11-Jun-2003 haydentech <haydentech@nowhere.fake>

Fix unintended code path when debug macros are turned off


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3474 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7bb1eb8242fe3721fc858bba0dbade1c15e472b7 03-Sep-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed BLooper::UnlockFully(): It assumed benaphore style locking whereas semaphore style is used.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@977 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 77a6586a2e7fac126a666d922463276bef239277 25-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Another test with minor tweaks to BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@874 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb5b0f6d5878ded1495111e1c000ba25e7196307 24-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixed SetCommonFilterList() so that the same list can't be added to more
than one looper.
Implemented UnlockFully(), and changed destructor and Quit() to use it.
Reordered the destructor slightly so as to delete fLockSem *after* the call
to UnlockFully().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@869 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d008c62d5372b2f2de6838a4bc70100d687f3b1b 23-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixed a narsty little bug that suddenly started rearing its ugly head in
IsMessageWaiting() test #3. fLastMessage wasn't getting initialized to
NULL on construction, and the random value was finally biting me. All
better now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@856 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff1ade6b3d1195d3065cd2ecd1b6064e06f9e17f 21-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests and fixes for bugs exposed by them. Also removed spurious
instantiation of BRoster from BArchivable, line 323, as per Tyler's
mention. =)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@852 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e2e159adc643005fee6c7d69082c2cb66ab07cf 05-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

Work on ResolveSpecifier().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@599 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a75716301764676b53402f54e4d483d09b525aa 04-Aug-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Added TODO items in the destructor.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c26a5cea919b34060b675414ee2dd48173b970b9 04-Aug-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

* The destructor doesn't kill the looper thread any more, as this doesn't
work very well with BApplication and has some issue with plain loopers
too.
* DispatchMessage(): _QUIT_ doesn't delete the object any longer. The
looper thread simply falls through the dispatching loop and deletes
the object.
* Caused by not killing the looper thread in the destructor, Quit() had
to be adjusted. When called from the looper thread the thread exists.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@576 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 752c497115c3496af9dad28de8c27276e3382a7a 04-Aug-2002 ejakowatz <ejakowatz@nowhere.fake>

The last remnants of the Old Repub ... er, static looper list data has been
removed. The old static BLooper functions for managing the looper list are
still there, but they are officially deprecated. The approved interface
for this information is BPrivate::BLooperList, accessible via the global
BPrivate::gLooperList variable. Being as it lives in BPrivate, it is for
API-internal use *ONLY*. User apps use it to their own risk.
Also added a small test to make sure that the size of BLooper stays the
same. I will probably add this to other classes as well; doesn't hurt to
be safe. =)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@572 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0b55d6648fcc366172730f4e26cd38915e011c09 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests, more fixes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@528 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7bf6c069361d8cc90da7487b7c39adc98da19fb7 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests with fixes to BLooper so it will pass those tests.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@527 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b1698c8e74d85bcd43c784832988c988b58eec78 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Mostly fixes for silly compile error, plus an additional test.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@524 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 822cdddb68ac2f00424712e0f866a18d012b1fed 28-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed bug in AddHandler(): SetNextHandler() must not be invoked on the looper itself.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@522 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2284462ccf18d4e502b12bf015a3d1800dd4e85c 28-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Scripting-related changes. Also indulged in some unwarrented formatting
anality. =P


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@519 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 92180c47a3c27b733d05aeef2a841e0eb49e33df 26-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Get the current team not using fTaskID, the looper thread, but find_thread(NULL) instead. In InitData() the thread has not been spawned yet.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@456 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 459de0d777a0dcaaf017afdbd3f1d659a8bfbf4a 23-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixed stupid syntax errors generated by my property_info dump tool. Now to
fix the tool ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@402 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec9673bf488423a5fd66aea059111a384ee40a81 22-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Added/tweaked tests for BLooper; fixes to BLooper stemming from those tests


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@389 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 30304f2da422d30c33d8b194398bbb8a53c54590 21-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed warnings.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@379 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76858a334d98216bff4aa816b8e51617807a2679 19-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

BLooper::LockWithTimeout() was always using B_INFINITE_TIMEOUT.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@344 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 19ba51b74d07be386affa52b38dde867edf16b88 17-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More BLooper tests and minor tweaks.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 04de1897ed2fed28e8f7a722a0b310fbc64bc225 17-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

More tests for BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@286 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38f5ceca01595f09deac7d10fafd4534a05b16f4 17-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Some more BLooper unit tests, with some minor resulting tweaks to BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@264 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e3684651de580f55a08b07322b49fe99a92c3975 16-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Finally figured out why the first assert in IsMessageWaiting5() always
worked under R5 but only sometimes for OBOS. Answer: the OBOS
implementation of BLooper was attempting to lock itself prior to fetching
the message from the queue. I moved the lock attempt after the fetch and
it worked the same. I realized that if the system was loaded heavily
enough, the assert might still fail simply because the looper would not had
enough time to get to the fetch (thereby emptying the queue), making the
assert pretty useless. Given that it was originally there as a probing
test (rather than as an integral part of the unit test), there is no real
need for it anyway, so it is no longer used.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@250 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abb579331f280333b113728756d2f79c03e3acbc 15-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Tweaks to deal with new repository hierarchy and use of unified CppUnit;
some bug fixes and a couple of new tests for BLooper.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@242 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 865f9d8e38ddac8c5d36d624b1607a43faee979b 11-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

Fixes in BLooper and its tests.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@84 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96