History log of /haiku/src/servers/app/EventDispatcher.cpp
Revision Date Author Comments
# 779ab335 09-Dec-2020 X512 <danger_mail@list.ru>

use .IsSet() instead if .Get() != NULL

Change-Id: Ia2b7a719fd398e78cc3b11d4f7b02cb81179f65f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3488
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# d99d8dbd 27-Aug-2020 X512 <danger_mail@list.ru>

app_server memory management: use ObjectDeleter to mark ownership

Make object ownership explicit by use of ObjectDeleter where possible.

Change-Id: I499a00aa3390d1510ae284419e73faffa5166430
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2695
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 60d30785 27-Aug-2020 X512 <danger_mail@list.ru>

app_server memory management fixes: use BReference

Use BReference for more automated reference counting in app_server,
fixing some use-after-free and other problems.

Extracted from https://review.haiku-os.org/c/haiku/+/2695

Change-Id: I141bb248229405896b29feff3338447f7257b0b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3175
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# a48ef9e8 11-Aug-2015 Stefano Ceccherini <stefano.ceccherini@gmail.com>

AppServer: check for NULL bitmap.
Consistently check for NULL the ServerBitmap pointer.
There seems to be cases where BView::DragMessage could pass an invalid
Bitmap token to app_server.
Maybe it's when a client only bitmap is passed, I don't know.
Anyway, this is defensive programming, and at least we check for NULL
consistently now.
This fixes #11681.
Note that SuperFreeCell still crashes, but at least app_server doesn't crash.


# dd0bdb49 13-Dec-2013 John Scipione <jscipione@gmail.com>

Fix a bug retreiving tooltips

Noticed this in Time prefs was displaying wrong time zone tool tip,
dug deeper...

hrev46290 introduced this bug because it passes fLastCursorPosition
into the “be:view_where” parameter of the B_MOUSE_IDLE message.
The problem is that fLastCursorPosition is in the screen’s coordinate
system, not the view’s and BView expects “be:view_where” to be in the
view’s coordinate system.

So, to fix this I pass fLastCursorPosition in the “screen_where” parameter
instead which I’ve instructed BView to interpret as the point in the screen’s
coordinate system which is then dutifully converted back the the view’s
coordinate system.

I tried to follow the naming scheme of other code, not sure if screen_where
should be namespaced with the be: predicate or not.


# 8f5d92f9 12-Dec-2013 John Scipione <jscipione@gmail.com>

EventDispatcher: Style fixes


# 057c8708 26-Oct-2013 Julian Harnath <julian.harnath@rwth-aachen.de>

Move B_MOUSE_IDLE generation to app_server.

* BWindow used to generate the B_MOUSE_IDLE events by sending a
delayed message with a one-shot BMessageRunner to itself.
Every creation and deletion of BMessageRunners causes synchronous
messaging between the application under the mouse cursor and the
registrar. This creates large amounts of calls to set_port_owner()
in the kernel whenever moving the mouse.

* Now, B_MOUSE_IDLE is sent by the cursor loop inside the app_server
instead. When the mouse wasn't moved for the tooltip delay time,
it inserts a B_MOUSE_IDLE message into the event stream.

* The tooltip delay thus becomes a system-wide constant and is not
configurable per-application anymore (no code currently in the
Haiku repo makes use of that anyhow).


# 8e165582 28-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

CID 10229: fDraggingMessage was not initialized, potentially sending out drag
messages where there shouldn't have been any.


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


# 4b0459b2 04-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Refactored ServerBitmap a bit: it now inherits from Referenceable instead of
roling its own solution.
* Also removed BitmapManager::DeleteBitmap() - you only call
ServerBitmap::RemoveReference(), and that one will notify the manager if
needed.
* Some more cleanup.


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


# 04caac4a 14-Mar-2009 Ryan Leavengood <leavengood@gmail.com>

Renamed the new "_fake" mouse moved boolean to "be:transit_only", as suggested
by Axel.


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


# 1674584b 13-Mar-2009 Ryan Leavengood <leavengood@gmail.com>

Add a boolean "_fake" parameter to fake mouse moves in case views care that the
app_server generated it.

For now used by screen_blanker, in my next commit.


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


# 95530739 17-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Reworked EventDispatcher::SendFakeMouseMoved() after an idea by Stephan
that solves most app_server locking headaches: it now works asynchronously,
and therefore doesn't need to lock the EventDispatcher anymore.
* EventStreams now allow to inject messages into the stream to allow the above
functionality.
* InputServerStream::GetNextEvent() no longer returns when there is no event.
* Desktop::ActivateWindow() now locks all windows before checking the
workspaces of the windows, fixing a race condition that could lead to
Window::Foremost() being called for a window that isn't on the current
workspace, leading to a crash.
* I currently cannot access Trac, but I recall there should be an open bug
report about this.


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


# f6bffd4e 14-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Whitespace cleanup.


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


# 350b87c7 13-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

zooey + axeld + stippi:
Fixed a problem with dispatching B_MOUSE_MOVED messages to views which need
the transit event:
* If the app_server decided to send a B_MOUSE_MOVED to the previous mouse
containing window, it forgot to add the _feed_focus flag, which was a problem
if the message actually happened to contain tokens (views that registered
for events.) On the client side, only those views would receive the message,
while the regular last mouse moved view would not be notified at all.
* On the client side, never change fLastMouseMovedView if the message is not
targeted at the preferred handler. In the above situation, any "registered
for events views" would receive the message first, but viewUnderMouse would
be NULL and then when the regular last mouse moved view received it, it
resulted in the wrong transit (B_OUTSIDE_VIEW instead of B_EXITED_VIEW).


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


# c4d14314 25-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* fDragBitmap was never initialized, leading to occasional crashes after the
first mouse click.
* Minor cleanup.


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


# 41d99cab 29-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* SetDragMessage() could be called when the mouse button was already released.
* Since it didn't check if any mouse button was pressed at the time it was
called, it would still initiate a drag, and thus caused bug #1710.


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


# 6ae06ef8 29-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

Implemented AS_IDLE_TIME, this closes bug #1593.


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


# 4d1c4228 02-Oct-2007 Stephan Aßmus <superstippi@gmx.de>

* added a way for the ServerWindow message loop to determine the required type
of locking before processing the message (single/all window lock)
-> in most message cases, I could comment out the unlocking/locking which
switched to the different lock, because the required lock is now already held,
this removes some race conditions which were commented in the code already
* EventDispatcher::SetDragMessage() didn't lock the object, this would have
been bad if multiple windows tried to set a drag bitmap at once
* the Desktop object keeps track of mouse position and pressed buttons, so
that it doesn't need to lock the EventDispatcher for sending fake mouse
moves to windows on show/hide of windows (solves some cases of possible
dead locks with the new locking strategy)
* the keyboard EventFilter switches the current workspace asynchrnously from
the Desktop thread (another source of possible deadlocks)
* the "reader is trying to become writer" check in MultiLocker is only used
in DEBUG mode now

As a summary: It would be nice if ServerWindow used a readlock for all messages
it processes itself, and forwards all messages for which it needs a write lock
to the Desktop thread. All cases where either the Desktop or the ServerWindow
mess with the EventDispatcher are possible sources of deadlocks. This is solved
right now by making sure that the lock is released before using the
EventDispatcher.

I have not observed any deadlocks while switching workspaces and launching
many apps anymore, neither crashes. But I have not tested extensively except
for in the test environment. That being said, I could reproduce the problems
on first try before in Haiku.


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


# 6869c8a5 23-Dec-2006 Ryan Leavengood <leavengood@gmail.com>

The app_server now starts and restarts (if needed) the input_server. The use of
a debugger call in _LaunchInputServer may be overkill, but at least you could
conceivably cleanly restart the machine in the debugger (I think.) Because
without the input_server the machine is pretty useless.


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


# 8e963d88 30-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

The app_server did not reset keyboard focus on B_INPUT_METHOD_EVENT messages.
This should fix bug #658.


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


# 5c87242e 24-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

Improved the fake mouse-moved mechanism quite a bit:
* EventDispatcher now adopts the cursor position from the HWInterface upon
assignment, so that even the initial cursor reports match the on screen
visuals.
* The message was never sent because "target" in Desktop::_SendFakeMouseMoved()
was never set.
* EventDispatcher::SendFakeMouseMoved() now accepts an EventTarget and no
longer a BMessenger (fits better to the rest of the API).
* EventDispatcher::SendFakeMouseMoved() now sends out the exit transit message
to the previous target directly (doesn't wait until the next actual mouse
move), and updates the previous target as well, so that scrolling now
works in that new window.
* This only partially fixes bug #762, though, as GetMouse() can still steal
this mouse message (BTextViews do that in WindowActivated()).


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


# 93d04158 11-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* If a BView::SetMouseEventMask() arrived in the app_server after the mouse buttons
have already been released again, the temporary listener was still added.
This fixes bug #727.
* No longer removes temporary listeners if there are mouse buttons left pressed; ie.
if you press two buttons at once, the listeners are now only removed after you've
released them both. This is not only more logical, it's also how BeOS behaves :-)


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


# 604c8038 16-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Since the keyboard filter compared targets by their pointers, it could happen
that it didn't reset the EventDispatcher's focus target even though the object
underneath that same pointer had change, which caused the EventDispatcher to
drop the event.
This fixes bug #416, and should fix bug #409, too.


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


# 39cdae74 10-Apr-2006 Michael Lotz <mmlr@mlotz.ch>

First steps at getting drag & drop to work properly. Simple drag & drop (draging Tracker items) should work now. Not sure about the negotiated version (with mimetype exchange). Fixed left behind drag bitmaps. Some cleanup.

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


# a1a04a47 01-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* A fake B_MOUSE_MOVED message is now send on workspace change, and when
a window is closed, too (only happened when a new window was shown
before). This is done via the new Desktop::_SendFakeMouseMoved()
method. This fixes bug #342.
* The MouseFilter now always sets Desktop::fWindowUnderMouse, so that
one can differentiate between no window under mouse, and decorator
under mouse.
* EventDispatcher::SendFakeMouseMoved() now expects a BMessenger instead
of an EventTarget as target - this guarantees that it can safely be
called with any window now (instead of only the current window).


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


# 1e766d46 10-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

Moved the ViewUnderMouse() functionality from the EventDispatcher to the Desktop;
this saves us some locking headaches and solves a possible deadlock in
ServerApp::Activate().


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


# 907e89c6 08-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

* The EventDispatcher takes care of reference counting the ServerBitmap
used for the drag bitmap, see NOTEs on why that is...
* moved reference counting of the ServerCursor from Desktop into
HWInterface where it is actually used
* I hope to have fixed the problems with _DrawCursor when dragging
something. At least the reference counting of the ServerCursor was
for real, since the HWInterface rejected changes to the cursor while
something was dragged, which caused the old cursor to be Released() and
deleted each time the mouse moved...


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


# 4aaa5aa1 26-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* added a way to retrieve the view under the mouse
via token

(coded by axeld)



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


# 4ea667a0 17-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed possible crashing bug for B_NO_POINTER_HISTORY views.


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


# 92b292f5 10-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented B_NO_POINTER_HISTORY. Window moving/resizing uses this mechanism
as well now, and makes quite a difference in Qemu.
Not tested for standard BViews, though.


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


# 40be0d55 10-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Quick fix to make the Qemu experience less bad :-)


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


# 5143d99b 10-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Removed timeout in the EventDispatcher, clarified TODO about the message queue
of messages that failed to be sent.


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


# 7afc7c50 08-Jan-2006 Stephan Aßmus <superstippi@gmx.de>

ServerFont:
* fixed weird pointer conversion in SetStyle()
* fixed a potential mix up in operator=() in case the
other ServerFont has fStyle == NULL

ServerWindow:
* the WindowLayer fTopLayer cannot be deleted by
client request, just for safety reasons
* the link is flushed if there is no drawing engine,
but this case is theoretical only
* deleting the ServerWindow object syncs with the
client, so that when BBitmaps are deleted, they
can be sure there are no pending messages (which
would be executed in a nother thread)
* there is no timeout anymore when sending messages
to the client, which made absolutely no sense

AGGTextRenderer:
* renamed fFontManager to fFontCache, because that's
what it really is
* fLastFamilyAndStyle defaulted to the system plain
font and therefor that font was never loaded when
the font never changed meanwhile

DrawingMode:
* I'm not quite sure but I think there was the
potential of a division by zero, at least I
had crashes with "divide error"

HWInterface:
* fix update when the cursor shape changed in
double buffered mode

ViewLayer:
* since the top layer is never really deleted
before its time has come, it is not necessary
to set it to NULL in the ViewLayer destructor

ViewLayer/WindowLayer:
* added a function to collect the view tokens
that are affected by an update session

EventDispatcher:
* use the importance of the message for the timeout
in _SendMessage()
* drop mouse moved events in the server if we're
lagging behind more than 5 ms (Axel, maybe review)

View:
* there were some problems with the locking
of the BWindow looper in RemoveSelf(), since
this is called from the window destructor,
also of BWindows from BBitmaps, which have
never been run (this might need review), at
least I seem to have solved the crashing
problems introduced by actually deleting the
view hirarchy in the BWindow destructor
* fixed _Draw() for being used non-recursively,
temporarily disabled DrawAfterChildren, which
didn't work yet anyways (because views cannot
draw over children in the server yet)

Window:
* small cleanup when deleting shortcuts
* sync with the server when having send
AS_DELETE_WINDOW (see ServerWindow above)
* fixed locking in Begin/EndViewTransaction()
* removed folding of _UPDATE_ messages, since
there is only one ever in the queue
* set the fInTransaction flag during an update,
I plan to use this in BView later to
flush the link when drawing outside of an
update
* BView::_Draw() is now called by view token,
this gives the next leap forward in speed,
the overhead because of drawing clean views
was considerable



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


# 9aad1a57 30-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed some problems of the EventDispatcher I introduced since I've played
with the "EventMask" test app the last time:
* The focus view didn't get any mouse messages anymore if there was a permanent
B_POINTER_EVENTS view.
* B_KEYBOARD_EVENTS now works again.
* B_MOUSE_WHEEL_CHANGED messages no do arrive their targets without prior
keyboard input.
* Added TODO item that other focus messages don't go through to the app without
keyboard input (fix only works for B_MOUSE_WHEEL_CHANGED).


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


# 9d909e25 25-Dec-2005 Stephan Aßmus <superstippi@gmx.de>

first simplistic implementation of drag bitmaps, drawing modes need more work, drawing text into offscreen bitmaps seems to be broken for some weird reason, B_OP_COPY actually copies the alpha value of the color as well

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


# e83820ed 07-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

Merged app_server_new_clipping branch changes r15290 to 15418 back into trunk.
Also fixed Jamfile for the test environment.


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


# 92766f93 30-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

EventDispatcher::_Unset() did not wait for the event looper thread under BeOS, as
wait_for_thread() always returns B_BAD_ADDRESS when the second argument is NULL
(it works fine under Haiku).
Instead of enqueuing a B_QUIT_REQUESTED message, InputStream now directly quits
when the 'quit' code is read from the port (B_QUIT_REQUESTED was never handled
by the event loop either, it just didn't get noticed because of the wrong
wait_for_thread() usage).


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


# 15918e4f 30-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* new windows now get a fake B_MOUSE_MOVED message in case they are opened
directly under the mouse cursor.
* Added Desktop::ShowWindow() and HideWindow().


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


# a9b83b75 29-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Added a bit of documentation to the EventDispatcher.


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


# f89b4c9a 29-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...


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


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

Added temporary hack so that windows don't get mouse messages if the cursor
is not over them - this should be better integrated with the rest of the
code (later, when we don't rely on RootLayer for everything anymore).


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


# 85d98137 24-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Quick fix for our broken locking model:
The mouse filter needs to lock RootLayer, but the event dispatcher lock is held
during that time, too, so that the focus cannot change in the mean time.
On the other side, ServerWindow needs to lock the event dispatcher when adding
or removing a listener, or for AS_GET_MOUSE - but since it always helds the
root layer lock during message dispatching this easily resulted in a deadlock.


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


# 0a9634a6 24-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup: removed unused stuff.


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


# 5afc0648 24-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

In anticipation of Stippi's new clipping code, I refactored the EventDispatcher
a bit:
* listeners are now managed per target (ie. per messenger) (by the Target class)
* therefore, the fFocusTokens/fLastFocusTokens lists are no longer needed; every
Target knows its listeners already.
* this also fixes the obvious bug that the focus window's views would get both
keyboard and pointer events, no matter which of them they originally wanted.
* renamed event_target to event_listener (there was actually a mix up in naming
before - to the outside it was "listener", and internally, "target" was used)
* WinBorder::MouseMoved()/MouseUp() now also add the view token to the message;
the messages weren't received by the target before (unless the view used
tracking via BView::SetMouseEventMask()...) - maybe the client should only
update fLastMouseMoved on B_MOUSE_MOVED events, and direct B_MOUSE_UP/DOWN
(plus wheel changes) always to fLastMouseMoved...
* some cleanup.


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


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

* removed adding "be:transit" stuff in the EventDispatcher - this is now only done
client side (or will be, with the next commit).
* added GetMouse() functionality.


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


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

* changed the way a message is forwarded to the focus view (instead of adding
a suspend focus field to the message, there is now a "feed focus" field in
case the message should be forwarded).
* added a comment to the BPoint version of _FindView() (since it's broken)
* _DistributeMessage() is now called after _DetermineTarget() - so that it
can prevent sending the message twice to the focus view.
* removed BWindow::DoUpdate() as it's no longer used.


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


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

* now all event targets of the focus window get into the focus list - that
way, we always send only one message per event, no matter how many targets
there are in the window (the focus event list was not always maintained
correctly before, too).
* the current mouse filter eats all B_MOUSE_UP events, and therefore, the
temporary event targets were never removed.
* changed the way BWindow::_DistributeMessage() recognizes if it should forward
the event - not yet final, though.
* naming is now more consistent (events -> event_mask).
* some minor cleanup.


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


# ae3ba51f 20-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Some minor fixes.


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


# 55d6d70e 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* EventDispatcher::AddListener() now honors the BView semantics and will only
update the options in case the specified eventMask was zero.
* Added missing EventDispatcher::RemoveTemporaryTarget().
* Layers setting their event mask are now added to the EventDispatcher.
* The RootLayer is no longer contacted for SetEventMask() - it still handles
SetMouseEventMask(), tough - as a result, SetEventMask() temporarily doesn't
work anymore.
* Added Layer::ViewToken() method.


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


# fa26723b 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* Moved workspace keyboard switch and dump screen capability from RootLayer
into a Desktop keyboard filter.
* Removed keyboard handling code from RootLayer and Layer.
* Renamed Desktop::ActiveRootLayer() to RootLayer() as there is only one
root layer per desktop.


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


# f6859878 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* the keyboard events are now using the new EventDispatcher, B_KEYBOARD_EVENTS don't
work yet, though, as the dispatcher is not yet notified about those.
* no more mouse cursor jumping - the cursor will now start in the middle of the screen;
this should be part of the initial input_server handshake, though.
* ServerWindow can now return a BMessenger of its client window.


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


# f7598223 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* the new input event dispatcher is now actually used, although it doesn't
distribute any messages to the clients yet.
* removed the working thread from RootLayer - for now, its event handlers are
still called using input filters in the new event dispatcher, though (to
get things started).
* ServerApp is now using a BMessenger to identify its client, and no longer
stores the port/token separately.
* the input_server handshake is a bit simpler now, as it can now just reply
to the app_server message, removed unused code from ServerProtocol.h
* calmed down the MultiLocker (it always printed thread statistics on startup,
because it's compiled in debug mode).
* removed the cursor thread stuff from AppServer.cpp
* the new event dispatcher now uses a cursor thread when supported (only in
native mode, not in the test environment), although it improves cursor
movement under Qemu, the effect is not as good as expected - this might
need some more investigations (might just be a thread priority problem).


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


# 0307fbb1 17-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Implemented support for Set[Mouse]EventMask() functionality - still untested, though.
Also supports the B_SUSPEND_VIEW_FOCUS options, B_NO_POINTER_HISTORY is not yet there,
and B_LOCK_WINDOW_FOCUS has to be implemented somewhere else (its outside of the
scope of this class).


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


# afe5450a 17-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* Fixed the most obvious copy&paste bugs.
* no longer allocates focus messengers on the heap but keeps them around.


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


# 08f35604 17-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

The basics of the new event handling - not yet connected to anything, and therefore
neither used nor tested. It's not even complete yet (support for Set[Mouse]EventMask()
is missing), but it will get there :)


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


# a48ef9e817eccd46437c6748246623ea5cb44e84 11-Aug-2015 Stefano Ceccherini <stefano.ceccherini@gmail.com>

AppServer: check for NULL bitmap.
Consistently check for NULL the ServerBitmap pointer.
There seems to be cases where BView::DragMessage could pass an invalid
Bitmap token to app_server.
Maybe it's when a client only bitmap is passed, I don't know.
Anyway, this is defensive programming, and at least we check for NULL
consistently now.
This fixes #11681.
Note that SuperFreeCell still crashes, but at least app_server doesn't crash.


# dd0bdb49dc5d2fdb37f29dd687cd2a406fd34ab7 13-Dec-2013 John Scipione <jscipione@gmail.com>

Fix a bug retreiving tooltips

Noticed this in Time prefs was displaying wrong time zone tool tip,
dug deeper...

hrev46290 introduced this bug because it passes fLastCursorPosition
into the “be:view_where” parameter of the B_MOUSE_IDLE message.
The problem is that fLastCursorPosition is in the screen’s coordinate
system, not the view’s and BView expects “be:view_where” to be in the
view’s coordinate system.

So, to fix this I pass fLastCursorPosition in the “screen_where” parameter
instead which I’ve instructed BView to interpret as the point in the screen’s
coordinate system which is then dutifully converted back the the view’s
coordinate system.

I tried to follow the naming scheme of other code, not sure if screen_where
should be namespaced with the be: predicate or not.


# 8f5d92f98d963afd3dcc85609b62189ddaf196a8 12-Dec-2013 John Scipione <jscipione@gmail.com>

EventDispatcher: Style fixes


# 057c8708f216514c6874b7c49f6ca170760b3cf0 26-Oct-2013 Julian Harnath <julian.harnath@rwth-aachen.de>

Move B_MOUSE_IDLE generation to app_server.

* BWindow used to generate the B_MOUSE_IDLE events by sending a
delayed message with a one-shot BMessageRunner to itself.
Every creation and deletion of BMessageRunners causes synchronous
messaging between the application under the mouse cursor and the
registrar. This creates large amounts of calls to set_port_owner()
in the kernel whenever moving the mouse.

* Now, B_MOUSE_IDLE is sent by the cursor loop inside the app_server
instead. When the mouse wasn't moved for the tooltip delay time,
it inserts a B_MOUSE_IDLE message into the event stream.

* The tooltip delay thus becomes a system-wide constant and is not
configurable per-application anymore (no code currently in the
Haiku repo makes use of that anyhow).


# 8e165582f1ab91dd310a7d9baf263ec7fdc1f446 28-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

CID 10229: fDraggingMessage was not initialized, potentially sending out drag
messages where there shouldn't have been any.


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


# 4b0459b2eef38f07b8c0c4426860dccb61a1134a 04-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Refactored ServerBitmap a bit: it now inherits from Referenceable instead of
roling its own solution.
* Also removed BitmapManager::DeleteBitmap() - you only call
ServerBitmap::RemoveReference(), and that one will notify the manager if
needed.
* Some more cleanup.


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


# 04caac4ad128873077bb1949ce2898065f6b8e0b 14-Mar-2009 Ryan Leavengood <leavengood@gmail.com>

Renamed the new "_fake" mouse moved boolean to "be:transit_only", as suggested
by Axel.


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


# 1674584bb9c0e1eb4d0945a0a5e433a83c0bc125 13-Mar-2009 Ryan Leavengood <leavengood@gmail.com>

Add a boolean "_fake" parameter to fake mouse moves in case views care that the
app_server generated it.

For now used by screen_blanker, in my next commit.


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


# 955307393fad754aaff5d372cb1cc139e6c4159c 17-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Reworked EventDispatcher::SendFakeMouseMoved() after an idea by Stephan
that solves most app_server locking headaches: it now works asynchronously,
and therefore doesn't need to lock the EventDispatcher anymore.
* EventStreams now allow to inject messages into the stream to allow the above
functionality.
* InputServerStream::GetNextEvent() no longer returns when there is no event.
* Desktop::ActivateWindow() now locks all windows before checking the
workspaces of the windows, fixing a race condition that could lead to
Window::Foremost() being called for a window that isn't on the current
workspace, leading to a crash.
* I currently cannot access Trac, but I recall there should be an open bug
report about this.


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


# f6bffd4e5be49f439ce04504e1cbd7e43b7bf777 14-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Whitespace cleanup.


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


# 350b87c7d22c9fccaecd4950e6424fb83563877c 13-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

zooey + axeld + stippi:
Fixed a problem with dispatching B_MOUSE_MOVED messages to views which need
the transit event:
* If the app_server decided to send a B_MOUSE_MOVED to the previous mouse
containing window, it forgot to add the _feed_focus flag, which was a problem
if the message actually happened to contain tokens (views that registered
for events.) On the client side, only those views would receive the message,
while the regular last mouse moved view would not be notified at all.
* On the client side, never change fLastMouseMovedView if the message is not
targeted at the preferred handler. In the above situation, any "registered
for events views" would receive the message first, but viewUnderMouse would
be NULL and then when the regular last mouse moved view received it, it
resulted in the wrong transit (B_OUTSIDE_VIEW instead of B_EXITED_VIEW).


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


# c4d143146c295e81c1fac2ec7f4c02447f55d1b9 25-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* fDragBitmap was never initialized, leading to occasional crashes after the
first mouse click.
* Minor cleanup.


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


# 41d99cab60910c35ba940a58bdb1f9b0698610ca 29-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* SetDragMessage() could be called when the mouse button was already released.
* Since it didn't check if any mouse button was pressed at the time it was
called, it would still initiate a drag, and thus caused bug #1710.


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


# 6ae06ef86a9612a2fb6ce22d177c48722b28a9a3 29-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

Implemented AS_IDLE_TIME, this closes bug #1593.


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


# 4d1c4228028075b8982d13c645cd206a28419df7 02-Oct-2007 Stephan Aßmus <superstippi@gmx.de>

* added a way for the ServerWindow message loop to determine the required type
of locking before processing the message (single/all window lock)
-> in most message cases, I could comment out the unlocking/locking which
switched to the different lock, because the required lock is now already held,
this removes some race conditions which were commented in the code already
* EventDispatcher::SetDragMessage() didn't lock the object, this would have
been bad if multiple windows tried to set a drag bitmap at once
* the Desktop object keeps track of mouse position and pressed buttons, so
that it doesn't need to lock the EventDispatcher for sending fake mouse
moves to windows on show/hide of windows (solves some cases of possible
dead locks with the new locking strategy)
* the keyboard EventFilter switches the current workspace asynchrnously from
the Desktop thread (another source of possible deadlocks)
* the "reader is trying to become writer" check in MultiLocker is only used
in DEBUG mode now

As a summary: It would be nice if ServerWindow used a readlock for all messages
it processes itself, and forwards all messages for which it needs a write lock
to the Desktop thread. All cases where either the Desktop or the ServerWindow
mess with the EventDispatcher are possible sources of deadlocks. This is solved
right now by making sure that the lock is released before using the
EventDispatcher.

I have not observed any deadlocks while switching workspaces and launching
many apps anymore, neither crashes. But I have not tested extensively except
for in the test environment. That being said, I could reproduce the problems
on first try before in Haiku.


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


# 6869c8a59ad386b82f039a82239ac8f6a3587edf 23-Dec-2006 Ryan Leavengood <leavengood@gmail.com>

The app_server now starts and restarts (if needed) the input_server. The use of
a debugger call in _LaunchInputServer may be overkill, but at least you could
conceivably cleanly restart the machine in the debugger (I think.) Because
without the input_server the machine is pretty useless.


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


# 8e963d88f0545935bdb5a4b0cf20c1310c79f56d 30-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

The app_server did not reset keyboard focus on B_INPUT_METHOD_EVENT messages.
This should fix bug #658.


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


# 5c87242ea3e9024f22ae6ac9f59b2a3beff009ed 24-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

Improved the fake mouse-moved mechanism quite a bit:
* EventDispatcher now adopts the cursor position from the HWInterface upon
assignment, so that even the initial cursor reports match the on screen
visuals.
* The message was never sent because "target" in Desktop::_SendFakeMouseMoved()
was never set.
* EventDispatcher::SendFakeMouseMoved() now accepts an EventTarget and no
longer a BMessenger (fits better to the rest of the API).
* EventDispatcher::SendFakeMouseMoved() now sends out the exit transit message
to the previous target directly (doesn't wait until the next actual mouse
move), and updates the previous target as well, so that scrolling now
works in that new window.
* This only partially fixes bug #762, though, as GetMouse() can still steal
this mouse message (BTextViews do that in WindowActivated()).


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


# 93d0415885252965d56606173eb72cb86da98058 11-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* If a BView::SetMouseEventMask() arrived in the app_server after the mouse buttons
have already been released again, the temporary listener was still added.
This fixes bug #727.
* No longer removes temporary listeners if there are mouse buttons left pressed; ie.
if you press two buttons at once, the listeners are now only removed after you've
released them both. This is not only more logical, it's also how BeOS behaves :-)


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


# 604c8038ff4dee882edbcb6170d80a27e9dd638f 16-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Since the keyboard filter compared targets by their pointers, it could happen
that it didn't reset the EventDispatcher's focus target even though the object
underneath that same pointer had change, which caused the EventDispatcher to
drop the event.
This fixes bug #416, and should fix bug #409, too.


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


# 39cdae74a7fc098db3a59a3e9db03b6ad57ab991 10-Apr-2006 Michael Lotz <mmlr@mlotz.ch>

First steps at getting drag & drop to work properly. Simple drag & drop (draging Tracker items) should work now. Not sure about the negotiated version (with mimetype exchange). Fixed left behind drag bitmaps. Some cleanup.

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


# a1a04a47421178983ce94aa6050922b23f57cbff 01-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* A fake B_MOUSE_MOVED message is now send on workspace change, and when
a window is closed, too (only happened when a new window was shown
before). This is done via the new Desktop::_SendFakeMouseMoved()
method. This fixes bug #342.
* The MouseFilter now always sets Desktop::fWindowUnderMouse, so that
one can differentiate between no window under mouse, and decorator
under mouse.
* EventDispatcher::SendFakeMouseMoved() now expects a BMessenger instead
of an EventTarget as target - this guarantees that it can safely be
called with any window now (instead of only the current window).


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


# 1e766d4688da9cbaea73b0f10564fb0b3d708806 10-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

Moved the ViewUnderMouse() functionality from the EventDispatcher to the Desktop;
this saves us some locking headaches and solves a possible deadlock in
ServerApp::Activate().


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


# 907e89c6e83770685f47219bb625d411602c4694 08-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

* The EventDispatcher takes care of reference counting the ServerBitmap
used for the drag bitmap, see NOTEs on why that is...
* moved reference counting of the ServerCursor from Desktop into
HWInterface where it is actually used
* I hope to have fixed the problems with _DrawCursor when dragging
something. At least the reference counting of the ServerCursor was
for real, since the HWInterface rejected changes to the cursor while
something was dragged, which caused the old cursor to be Released() and
deleted each time the mouse moved...


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


# 4aaa5aa1008af3c44f3b505ffefd56ee9a1c3972 26-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* added a way to retrieve the view under the mouse
via token

(coded by axeld)



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


# 4ea667a0b0de41d27dced59df7c67402deb73a6b 17-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed possible crashing bug for B_NO_POINTER_HISTORY views.


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


# 92b292f540c9d73b8fe35519a82ad2b86f8974ab 10-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented B_NO_POINTER_HISTORY. Window moving/resizing uses this mechanism
as well now, and makes quite a difference in Qemu.
Not tested for standard BViews, though.


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


# 40be0d5583b3fa240745ead953d97000ef53b182 10-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Quick fix to make the Qemu experience less bad :-)


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


# 5143d99bb08c7dc8d66c67e0d480181aef032db1 10-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Removed timeout in the EventDispatcher, clarified TODO about the message queue
of messages that failed to be sent.


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


# 7afc7c5074c2a3382be788d22fe999040c582ccb 08-Jan-2006 Stephan Aßmus <superstippi@gmx.de>

ServerFont:
* fixed weird pointer conversion in SetStyle()
* fixed a potential mix up in operator=() in case the
other ServerFont has fStyle == NULL

ServerWindow:
* the WindowLayer fTopLayer cannot be deleted by
client request, just for safety reasons
* the link is flushed if there is no drawing engine,
but this case is theoretical only
* deleting the ServerWindow object syncs with the
client, so that when BBitmaps are deleted, they
can be sure there are no pending messages (which
would be executed in a nother thread)
* there is no timeout anymore when sending messages
to the client, which made absolutely no sense

AGGTextRenderer:
* renamed fFontManager to fFontCache, because that's
what it really is
* fLastFamilyAndStyle defaulted to the system plain
font and therefor that font was never loaded when
the font never changed meanwhile

DrawingMode:
* I'm not quite sure but I think there was the
potential of a division by zero, at least I
had crashes with "divide error"

HWInterface:
* fix update when the cursor shape changed in
double buffered mode

ViewLayer:
* since the top layer is never really deleted
before its time has come, it is not necessary
to set it to NULL in the ViewLayer destructor

ViewLayer/WindowLayer:
* added a function to collect the view tokens
that are affected by an update session

EventDispatcher:
* use the importance of the message for the timeout
in _SendMessage()
* drop mouse moved events in the server if we're
lagging behind more than 5 ms (Axel, maybe review)

View:
* there were some problems with the locking
of the BWindow looper in RemoveSelf(), since
this is called from the window destructor,
also of BWindows from BBitmaps, which have
never been run (this might need review), at
least I seem to have solved the crashing
problems introduced by actually deleting the
view hirarchy in the BWindow destructor
* fixed _Draw() for being used non-recursively,
temporarily disabled DrawAfterChildren, which
didn't work yet anyways (because views cannot
draw over children in the server yet)

Window:
* small cleanup when deleting shortcuts
* sync with the server when having send
AS_DELETE_WINDOW (see ServerWindow above)
* fixed locking in Begin/EndViewTransaction()
* removed folding of _UPDATE_ messages, since
there is only one ever in the queue
* set the fInTransaction flag during an update,
I plan to use this in BView later to
flush the link when drawing outside of an
update
* BView::_Draw() is now called by view token,
this gives the next leap forward in speed,
the overhead because of drawing clean views
was considerable



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


# 9aad1a575499242848fdf932d10d5979c0178506 30-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed some problems of the EventDispatcher I introduced since I've played
with the "EventMask" test app the last time:
* The focus view didn't get any mouse messages anymore if there was a permanent
B_POINTER_EVENTS view.
* B_KEYBOARD_EVENTS now works again.
* B_MOUSE_WHEEL_CHANGED messages no do arrive their targets without prior
keyboard input.
* Added TODO item that other focus messages don't go through to the app without
keyboard input (fix only works for B_MOUSE_WHEEL_CHANGED).


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


# 9d909e25560c098447fd4dddbed7ed48ae8c9748 25-Dec-2005 Stephan Aßmus <superstippi@gmx.de>

first simplistic implementation of drag bitmaps, drawing modes need more work, drawing text into offscreen bitmaps seems to be broken for some weird reason, B_OP_COPY actually copies the alpha value of the color as well

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


# e83820ed5720395d39a1ff809991b4fd76326548 07-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

Merged app_server_new_clipping branch changes r15290 to 15418 back into trunk.
Also fixed Jamfile for the test environment.


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


# 92766f93e2c9bed157a32589ab01a566d9e14468 30-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

EventDispatcher::_Unset() did not wait for the event looper thread under BeOS, as
wait_for_thread() always returns B_BAD_ADDRESS when the second argument is NULL
(it works fine under Haiku).
Instead of enqueuing a B_QUIT_REQUESTED message, InputStream now directly quits
when the 'quit' code is read from the port (B_QUIT_REQUESTED was never handled
by the event loop either, it just didn't get noticed because of the wrong
wait_for_thread() usage).


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


# 15918e4fa5bcbea5fc7ed8c77b7858374621308f 30-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* new windows now get a fake B_MOUSE_MOVED message in case they are opened
directly under the mouse cursor.
* Added Desktop::ShowWindow() and HideWindow().


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


# a9b83b752c0889650853d2e0bf366d8413311ec1 29-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Added a bit of documentation to the EventDispatcher.


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


# f89b4c9a23a12a1bae426cc920dccfb6b0d022db 29-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...


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


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

Added temporary hack so that windows don't get mouse messages if the cursor
is not over them - this should be better integrated with the rest of the
code (later, when we don't rely on RootLayer for everything anymore).


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


# 85d981378a48b19a49cc0dadf80288b68b4e6447 24-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Quick fix for our broken locking model:
The mouse filter needs to lock RootLayer, but the event dispatcher lock is held
during that time, too, so that the focus cannot change in the mean time.
On the other side, ServerWindow needs to lock the event dispatcher when adding
or removing a listener, or for AS_GET_MOUSE - but since it always helds the
root layer lock during message dispatching this easily resulted in a deadlock.


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


# 0a9634a6f4a5988a606973517ee1f06ea47fbedb 24-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup: removed unused stuff.


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


# 5afc0648313fdc72d216da5a864ce88d04ba1339 24-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

In anticipation of Stippi's new clipping code, I refactored the EventDispatcher
a bit:
* listeners are now managed per target (ie. per messenger) (by the Target class)
* therefore, the fFocusTokens/fLastFocusTokens lists are no longer needed; every
Target knows its listeners already.
* this also fixes the obvious bug that the focus window's views would get both
keyboard and pointer events, no matter which of them they originally wanted.
* renamed event_target to event_listener (there was actually a mix up in naming
before - to the outside it was "listener", and internally, "target" was used)
* WinBorder::MouseMoved()/MouseUp() now also add the view token to the message;
the messages weren't received by the target before (unless the view used
tracking via BView::SetMouseEventMask()...) - maybe the client should only
update fLastMouseMoved on B_MOUSE_MOVED events, and direct B_MOUSE_UP/DOWN
(plus wheel changes) always to fLastMouseMoved...
* some cleanup.


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


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

* removed adding "be:transit" stuff in the EventDispatcher - this is now only done
client side (or will be, with the next commit).
* added GetMouse() functionality.


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


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

* changed the way a message is forwarded to the focus view (instead of adding
a suspend focus field to the message, there is now a "feed focus" field in
case the message should be forwarded).
* added a comment to the BPoint version of _FindView() (since it's broken)
* _DistributeMessage() is now called after _DetermineTarget() - so that it
can prevent sending the message twice to the focus view.
* removed BWindow::DoUpdate() as it's no longer used.


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


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

* now all event targets of the focus window get into the focus list - that
way, we always send only one message per event, no matter how many targets
there are in the window (the focus event list was not always maintained
correctly before, too).
* the current mouse filter eats all B_MOUSE_UP events, and therefore, the
temporary event targets were never removed.
* changed the way BWindow::_DistributeMessage() recognizes if it should forward
the event - not yet final, though.
* naming is now more consistent (events -> event_mask).
* some minor cleanup.


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


# ae3ba51fc108483e85d62ebc08f102c63df7d329 20-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Some minor fixes.


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


# 55d6d70ee59eb2e2473c2195b5e6b26ee29380d3 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* EventDispatcher::AddListener() now honors the BView semantics and will only
update the options in case the specified eventMask was zero.
* Added missing EventDispatcher::RemoveTemporaryTarget().
* Layers setting their event mask are now added to the EventDispatcher.
* The RootLayer is no longer contacted for SetEventMask() - it still handles
SetMouseEventMask(), tough - as a result, SetEventMask() temporarily doesn't
work anymore.
* Added Layer::ViewToken() method.


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


# fa26723bb29d97b4bcb3437a60da21d59cd266b1 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* Moved workspace keyboard switch and dump screen capability from RootLayer
into a Desktop keyboard filter.
* Removed keyboard handling code from RootLayer and Layer.
* Renamed Desktop::ActiveRootLayer() to RootLayer() as there is only one
root layer per desktop.


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


# f68598780e4aa2a311b1fc8fce0b89b871bc9a9d 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* the keyboard events are now using the new EventDispatcher, B_KEYBOARD_EVENTS don't
work yet, though, as the dispatcher is not yet notified about those.
* no more mouse cursor jumping - the cursor will now start in the middle of the screen;
this should be part of the initial input_server handshake, though.
* ServerWindow can now return a BMessenger of its client window.


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


# f7598223274c44c551f1ed581030e6ed5268fe68 18-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* the new input event dispatcher is now actually used, although it doesn't
distribute any messages to the clients yet.
* removed the working thread from RootLayer - for now, its event handlers are
still called using input filters in the new event dispatcher, though (to
get things started).
* ServerApp is now using a BMessenger to identify its client, and no longer
stores the port/token separately.
* the input_server handshake is a bit simpler now, as it can now just reply
to the app_server message, removed unused code from ServerProtocol.h
* calmed down the MultiLocker (it always printed thread statistics on startup,
because it's compiled in debug mode).
* removed the cursor thread stuff from AppServer.cpp
* the new event dispatcher now uses a cursor thread when supported (only in
native mode, not in the test environment), although it improves cursor
movement under Qemu, the effect is not as good as expected - this might
need some more investigations (might just be a thread priority problem).


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


# 0307fbb17d2de81f23804cb71a5c43ef1a67b877 17-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Implemented support for Set[Mouse]EventMask() functionality - still untested, though.
Also supports the B_SUSPEND_VIEW_FOCUS options, B_NO_POINTER_HISTORY is not yet there,
and B_LOCK_WINDOW_FOCUS has to be implemented somewhere else (its outside of the
scope of this class).


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


# afe5450a833231122ba24c78d2b5a5a6c3b8fc1d 17-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* Fixed the most obvious copy&paste bugs.
* no longer allocates focus messengers on the heap but keeps them around.


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


# 08f35604b00adf5e47a170f586fa91ee5d53c4a5 17-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

The basics of the new event handling - not yet connected to anything, and therefore
neither used nor tested. It's not even complete yet (support for Set[Mouse]EventMask()
is missing), but it will get there :)


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