* Introduced a new view event mask flag: B_FULL_POINTER_HISTORY which,

when set, prevents any old mouse moved message discarding.
* BWindow::DispatchMessage(B_MOUSE_MOVED) checks the event time of the
  message and discards too old events, but only if there is another event
  in the queue and the view does not specify B_FULL_POINTER_HISTORY.
* BView::GetMouse() ignores the checkHistory flag passed to the function
  in case the event mask specifies B_NO_POINTER_HISTORY.
  B_FULL_POINTER_HISTORY on the other hand prevents the dropping of old
  messages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26341 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-07-09 14:13:03 +00:00
parent 191a03fd11
commit bb73c05fd7
3 changed files with 28 additions and 13 deletions

View File

@ -43,7 +43,11 @@ enum {
enum {
B_LOCK_WINDOW_FOCUS = 0x00000001,
B_SUSPEND_VIEW_FOCUS = 0x00000002,
B_NO_POINTER_HISTORY = 0x00000004
B_NO_POINTER_HISTORY = 0x00000004,
// new in Haiku (unless this flag is
// specified, both BWindow and BView::GetMouse()
// will filter out older mouse moved messages)
B_FULL_POINTER_HISTORY = 0x00000008
};
enum {

View File

@ -1393,7 +1393,11 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
{
_CheckOwnerLockAndSwitchCurrent();
if (checkMessageQueue) {
uint32 eventOptions = fEventOptions | fMouseEventOptions;
bool noHistory = eventOptions & B_NO_POINTER_HISTORY;
bool fullHistory = eventOptions & B_FULL_POINTER_HISTORY;
if (checkMessageQueue && !noHistory) {
Window()->UpdateIfNeeded();
BMessageQueue *queue = Window()->MessageQueue();
queue->Lock();
@ -1410,7 +1414,7 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
if (!Window()->_StealMouseMessage(message, deleteMessage))
continue;
if (message->what == B_MOUSE_MOVED) {
if (!fullHistory && message->what == B_MOUSE_MOVED) {
// Check if the message is too old. Some applications
// check the message queue in such a way that mouse
// messages *must* pile up. This check makes them work

View File

@ -1092,8 +1092,20 @@ FrameMoved(origin);
case B_MOUSE_MOVED:
{
if (BView *view = dynamic_cast<BView *>(target)) {
if (((view->fEventOptions | view->fMouseEventOptions)
& B_NO_POINTER_HISTORY) != 0) {
uint32 eventOptions = view->fEventOptions
| view->fMouseEventOptions;
bool noHistory = eventOptions & B_NO_POINTER_HISTORY;
bool fullHistory = eventOptions & B_FULL_POINTER_HISTORY;
bigtime_t eventTime;
if (noHistory
|| msg->FindInt64("when", (int64*)&eventTime) < B_OK) {
eventTime = system_time();
}
if (noHistory || (!fullHistory
&& (system_time() - eventTime > 20000))) {
// filter out older mouse moved messages in the queue
_DequeueAll();
BMessageQueue *queue = MessageQueue();
@ -1102,6 +1114,9 @@ FrameMoved(origin);
BMessage *moved;
for (int32 i = 0; (moved = queue->FindMessage(i)) != NULL; i++) {
if (moved != msg && moved->what == B_MOUSE_MOVED) {
// there is a newer mouse moved message in the
// queue, just ignore the current one, the newer one
// will be handled here eventually
queue->Unlock();
return;
}
@ -1116,14 +1131,6 @@ FrameMoved(origin);
msg->FindInt32("buttons", (int32*)&buttons);
msg->FindInt32("be:transit", (int32*)&transit);
#if 0
bigtime_t when;
if (msg->FindInt64("when", (int64*)&when) < B_OK)
printf("BWindow B_MOUSE_MOVED no when\n");
else if (system_time() - when > 5000)
printf("BWindow B_MOUSE_MOVED lagging behind\n");
#endif
BMessage* dragMessage = NULL;
if (msg->HasMessage("be:drag_message")) {
dragMessage = new BMessage();