Skip to content

Commit

Permalink
Generalized the hint for whether the application gets a mouse event w…
Browse files Browse the repository at this point in the history
…hen clicking on the window to activate it, and is now named SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH.

The behavior is defined to not receive the click event, and this hint allows you to override that.
  • Loading branch information
slouken committed Sep 29, 2016
1 parent 8ddb432 commit a13da2f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
34 changes: 19 additions & 15 deletions include/SDL_hints.h
Expand Up @@ -233,16 +233,27 @@ extern "C" {
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"

/**
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
*
* This variable can be set to the following values:
* "0" - Relative mouse mode uses raw input
* "1" - Relative mouse mode uses mouse warping
*
* By default SDL will use raw input for relative mouse mode
*/
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
*
* This variable can be set to the following values:
* "0" - Relative mouse mode uses raw input
* "1" - Relative mouse mode uses mouse warping
*
* By default SDL will use raw input for relative mouse mode
*/
#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP"

/**
* \brief Allow mouse click events when clicking to focus an SDL window
*
* This variable can be set to the following values:
* "0" - Ignore mouse clicks that activate a window
* "1" - Generate events for mouse clicks that activate a window
*
* By default SDL will ignore mouse clicks that activate a window
*/
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"

/**
* \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
*
Expand Down Expand Up @@ -575,13 +586,6 @@ extern "C" {
*/
#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.
*
Expand Down
6 changes: 5 additions & 1 deletion src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -1118,7 +1118,11 @@ - (void)resetCursorRects

- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
const char *hint = SDL_GetHint(SDL_HINT_MAC_MOUSE_FOCUS_CLICKTHROUGH);
const char *hint = SDL_GetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH);
if (!hint) {
/* Check older hint for backwards compatibility */
hint = SDL_GetHint("SDL_MAC_MOUSE_FOCUS_CLICKTHROUGH");
}
return hint && *hint != '0';
}
@end
Expand Down

0 comments on commit a13da2f

Please sign in to comment.