mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Add a new hint SDL_HINT_MAC_MOUSE_FOCUS_CLICKTHROUGH, which allows mouse click events to occur when clicking to focus a window in Mac OS X.
Fixes bug #3300.
This commit is contained in:
parent
5520ed9cc2
commit
88372277b7
@ -547,6 +547,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
|
#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Allow mouse click events when clicking to focus an SDL window
|
||||||
|
*
|
||||||
|
* This hint only applies to Mac OS X.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_MAC_MOUSE_FOCUS_CLICKTHROUGH "SDL_MAC_MOUSE_FOCUS_CLICKTHROUGH"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
|
* \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
|
||||||
*
|
*
|
||||||
|
@ -80,20 +80,20 @@
|
|||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)event
|
- (void)sendEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
[super sendEvent:event];
|
[super sendEvent:event];
|
||||||
|
|
||||||
if ([event type] != NSLeftMouseUp) {
|
if ([event type] != NSLeftMouseUp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
id delegate = [self delegate];
|
id delegate = [self delegate];
|
||||||
if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) {
|
if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([delegate isMoving]) {
|
if ([delegate isMoving]) {
|
||||||
[delegate windowDidFinishMoving];
|
[delegate windowDidFinishMoving];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We'll respond to selectors by doing nothing so we don't beep.
|
/* We'll respond to selectors by doing nothing so we don't beep.
|
||||||
@ -1093,6 +1093,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
|||||||
- (void)rightMouseDown:(NSEvent *)theEvent;
|
- (void)rightMouseDown:(NSEvent *)theEvent;
|
||||||
- (BOOL)mouseDownCanMoveWindow;
|
- (BOOL)mouseDownCanMoveWindow;
|
||||||
- (void)drawRect:(NSRect)dirtyRect;
|
- (void)drawRect:(NSRect)dirtyRect;
|
||||||
|
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SDLView
|
@implementation SDLView
|
||||||
@ -1132,6 +1133,12 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
|||||||
cursor:[NSCursor invisibleCursor]];
|
cursor:[NSCursor invisibleCursor]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
const char *hint = SDL_GetHint(SDL_HINT_MAC_MOUSE_FOCUS_CLICKTHROUGH);
|
||||||
|
return hint && *hint != '0';
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user