mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 678481 - Send a mouse move event after switiching into or out of drawintitlebar mode so that Gecko knows about the changed mouse position relative to the Gecko content area. r=josh
This commit is contained in:
parent
15d2e2f7bc
commit
c8586cbbf2
@ -364,9 +364,11 @@ public:
|
||||
static void MouseExitedWindow(NSEvent* aEvent);
|
||||
static void MouseEnteredWindow(NSEvent* aEvent);
|
||||
static void ReEvaluateMouseEnterState(NSEvent* aEvent = nil);
|
||||
static void ResendLastMouseMoveEvent();
|
||||
static ChildView* ViewForEvent(NSEvent* aEvent);
|
||||
|
||||
static ChildView* sLastMouseEventView;
|
||||
static NSEvent* sLastMouseMoveEvent;
|
||||
static NSWindow* sWindowUnderMouse;
|
||||
};
|
||||
|
||||
|
@ -126,6 +126,7 @@ PRBool gChildViewMethodsSwizzled = PR_FALSE;
|
||||
extern nsISupportsArray *gDraggedTransferables;
|
||||
|
||||
ChildView* ChildViewMouseTracker::sLastMouseEventView = nil;
|
||||
NSEvent* ChildViewMouseTracker::sLastMouseMoveEvent = nil;
|
||||
NSWindow* ChildViewMouseTracker::sWindowUnderMouse = nil;
|
||||
|
||||
#ifdef INVALIDATE_DEBUGGING
|
||||
@ -4900,6 +4901,8 @@ ChildViewMouseTracker::OnDestroyView(ChildView* aView)
|
||||
{
|
||||
if (sLastMouseEventView == aView) {
|
||||
sLastMouseEventView = nil;
|
||||
[sLastMouseMoveEvent release];
|
||||
sLastMouseMoveEvent = nil;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4945,11 +4948,23 @@ ChildViewMouseTracker::ReEvaluateMouseEnterState(NSEvent* aEvent)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ChildViewMouseTracker::ResendLastMouseMoveEvent()
|
||||
{
|
||||
if (sLastMouseMoveEvent) {
|
||||
MouseMoved(sLastMouseMoveEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ChildViewMouseTracker::MouseMoved(NSEvent* aEvent)
|
||||
{
|
||||
MouseEnteredWindow(aEvent);
|
||||
[sLastMouseEventView handleMouseMoved:aEvent];
|
||||
if (sLastMouseMoveEvent != aEvent) {
|
||||
[sLastMouseMoveEvent release];
|
||||
sLastMouseMoveEvent = [aEvent retain];
|
||||
}
|
||||
}
|
||||
|
||||
ChildView*
|
||||
|
@ -2301,6 +2301,14 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton";
|
||||
// Re-layout our contents.
|
||||
geckoWindow->ReportSizeEvent();
|
||||
}
|
||||
|
||||
// Resizing the content area causes a reflow which would send a synthesized
|
||||
// mousemove event to the old mouse position relative to the top left
|
||||
// corner of the content area. But the mouse has shifted relative to the
|
||||
// content area, so that event would have wrong position information. So
|
||||
// we'll send a mouse move event with the correct new position.
|
||||
ChildViewMouseTracker::ResendLastMouseMoveEvent();
|
||||
|
||||
[self setTitlebarNeedsDisplayInRect:[self titlebarRect]];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user