mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-10-07 09:33:28 +00:00
Actually propagate setAcceptsMouseMovedEvents to XSelectInput()
X11Display already has the code to drop mouse moved events in case the window does not want them; but we weren't getting the events in the first place because they were filtered out on the server side. Fixes, among other things, NSMenu not reacting to clicks properly, because it was assuming the clicked item was not the selected one as it could not see the mouse hovering over it.
This commit is contained in:
parent
1403e9700b
commit
c95aecf2a3
@ -976,6 +976,7 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
|
||||
|
||||
-(void)setAcceptsMouseMovedEvents:(BOOL)flag {
|
||||
_acceptsMouseMovedEvents=flag;
|
||||
[_platformWindow syncDelegateProperties];
|
||||
}
|
||||
|
||||
-(void)setExcludedFromWindowsMenu:(BOOL)value {
|
||||
|
@ -95,8 +95,7 @@
|
||||
(_visualInfo==NULL)?CopyFromParent:_visualInfo->visual,
|
||||
xattr_mask, &xattr);
|
||||
|
||||
XSelectInput(_display, _window, ExposureMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask |
|
||||
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | VisibilityChangeMask | FocusChangeMask | SubstructureRedirectMask );
|
||||
[self syncDelegateProperties];
|
||||
|
||||
Atom atm=XInternAtom(_display, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols(_display, _window, &atm , 1);
|
||||
@ -157,12 +156,27 @@
|
||||
|
||||
-(void)setDelegate:delegate {
|
||||
_delegate=delegate;
|
||||
[self syncDelegateProperties];
|
||||
}
|
||||
|
||||
-delegate {
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
- (void) syncDelegateProperties {
|
||||
long mask = KeyPressMask | KeyReleaseMask |
|
||||
ExposureMask | StructureNotifyMask |
|
||||
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
|
||||
VisibilityChangeMask | FocusChangeMask | SubstructureRedirectMask;
|
||||
|
||||
if ([_delegate acceptsMouseMovedEvents]) {
|
||||
mask |= PointerMotionMask;
|
||||
}
|
||||
XSelectInput(_display, _window, mask);
|
||||
|
||||
// TODO: background color
|
||||
}
|
||||
|
||||
-(void) invalidate {
|
||||
// This is essentially dealloc; we release our contexts
|
||||
// and windows, but unlike dealloc, this method can be called
|
||||
|
@ -23,6 +23,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
O2InvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
- (void) syncDelegateProperties {
|
||||
O2InvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
|
||||
-(O2Context *)cgContext {
|
||||
O2InvalidAbstractInvocation();
|
||||
|
@ -25,6 +25,7 @@ typedef enum {
|
||||
- delegate;
|
||||
|
||||
- (void)invalidate;
|
||||
- (void)syncDelegateProperties;
|
||||
|
||||
- (O2Context *)cgContext;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user