Skip to content
Snippets Groups Projects
Commit df1f0c5a authored by Timur Pocheptsov's avatar Timur Pocheptsov
Browse files

Window title bar is a "dead zone" - there is no NSView<X11Window> objects there,

so it's possible, for example, to open a menu and move window (and menu bar will not receive
correct event and will "fell through" its main window.
Fix this - override -sendEvent: method for QuartzWindow and check if mouse event is "inside" titlebar.


git-svn-id: http://root.cern.ch/svn/root/trunk@43938 27541ba8-7e3a-0410-8455-c3a389f83636
parent 97595f70
No related branches found
No related tags found
No related merge requests found
......@@ -75,9 +75,10 @@ public:
//If it's a focus view, cancel focus.
void CheckUnmappedView(Window_t winID);
private:
bool HasPointerGrab()const;
private:
//Used both by grab and non-grab case.
void GenerateCrossingEvent(NSView<X11Window> *viewUnderPointer, NSEvent *theEvent, EXMagic detail);
void GenerateCrossingEventActiveGrab(NSView<X11Window> *eventView, NSEvent *theEvent);
......
......@@ -862,6 +862,36 @@ void print_mask_info(ULong_t mask)
[self orderOut : self];
}
//Events.
//______________________________________________________________________________
- (void) sendEvent : (NSEvent *) theEvent
{
assert(fContentView != nil && "sendEvent, content view is nil");
if (theEvent.type == NSLeftMouseDown || theEvent.type == NSRightMouseDown) {
const NSPoint windowPoint = [theEvent locationInWindow];
const NSPoint viewPoint = [fContentView convertPointFromBase : windowPoint];
if (viewPoint.y <= 0 && windowPoint.y >= 0) {
//Very special case: mouse is in a title bar.
//There are not NSView<X11Window> object in this area,
//this event will never go to any QuartzView, and this
//can be a problem: if drop-down menu is open and
//you move window using title-bar, ROOT's menu will
//"fell through" the main window, which is weird.
TGCocoa *vx = dynamic_cast<TGCocoa *>(gVirtualX);
assert(vx != nullptr && "sendEvent, gVirtualX is either null or not of TGCocoa type");
if (vx->GetEventTranslator()->HasPointerGrab())
vx->GetEventTranslator()->GenerateButtonReleaseEvent(fContentView, theEvent, theEvent.type == NSLeftMouseDown ? kButton1 : kButton3);//yes, button release???
}
}
//Always call default version.
[super sendEvent : theEvent];
}
//NSWindowDelegate's methods.
//______________________________________________________________________________
......
......@@ -1450,7 +1450,8 @@ void EventTranslator::GenerateButtonReleaseEventActiveGrab(NSView<X11Window> *ev
candidateView = Detail::FindViewToPropagateEvent(candidateView, kButtonReleaseMask, fButtonGrabView, fGrabEventMask);
if (candidateView)//We have such a view, send event to a corresponding ROOT's window.
Detail::SendButtonReleaseEvent(candidateView, theEvent, btn);
}
} else if (fGrabEventMask & kButtonReleaseMask)
Detail::SendButtonReleaseEvent(fButtonGrabView, theEvent, btn);
} else {//Report to the grab view, if it has a corresponding bit set.
if (fGrabEventMask & kButtonReleaseMask)
Detail::SendButtonReleaseEvent(fButtonGrabView, theEvent, btn);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment