mirror of https://github.com/encounter/SDL.git
Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
This commit is contained in:
parent
09d1cea733
commit
e1c3a25034
|
@ -1440,6 +1440,15 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION"
|
#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Controls the number of times a window flashes with SDL_FlashWindow()
|
||||||
|
*
|
||||||
|
* On Windows, if this variable is set, the SDL_FlashWindow() call will flash
|
||||||
|
* the specified number of times. Otherwise the window will flash until it
|
||||||
|
* becomes the foreground window.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_WINDOW_FLASH_COUNT "SDL_WINDOW_FLASH_COUNT"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
|
* \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
|
||||||
* The 0x406D1388 Exception is a trick used to inform Visual Studio of a
|
* The 0x406D1388 Exception is a trick used to inform Visual Studio of a
|
||||||
|
|
|
@ -1510,14 +1510,11 @@ extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
|
||||||
/**
|
/**
|
||||||
* Request a window to demand attention from the user.
|
* Request a window to demand attention from the user.
|
||||||
*
|
*
|
||||||
* \param window the window to request the flashing for
|
* \param window the window to be flashed
|
||||||
* \param flash_count number of times the window gets flashed on systems that
|
|
||||||
* support flashing the window multiple times, like
|
|
||||||
* Windows, else it is ignored
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, Uint32 flash_count);
|
extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a window.
|
* Destroy a window.
|
||||||
|
|
|
@ -876,6 +876,6 @@ SDL_DYNAPI_PROC(int,SDL_AndroidShowToast,(const char *a, int b, int c, int d, in
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetAudioDeviceSpec,(int a, int b, SDL_AudioSpec *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetAudioDeviceSpec,(int a, int b, SDL_AudioSpec *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(void,SDL_TLSCleanup,(void),(),)
|
SDL_DYNAPI_PROC(void,SDL_TLSCleanup,(void),(),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),)
|
SDL_DYNAPI_PROC(void,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),)
|
||||||
SDL_DYNAPI_PROC(int,SDL_FlashWindow,(SDL_Window *a, Uint32 b),(a, b),return)
|
SDL_DYNAPI_PROC(int,SDL_FlashWindow,(SDL_Window *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSendEffect,(SDL_GameController *a, const void *b, int c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GameControllerSendEffect,(SDL_GameController *a, const void *b, int c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_JoystickSendEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_JoystickSendEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return)
|
||||||
|
|
|
@ -1958,6 +1958,15 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
|
||||||
SDL_free(text);
|
SDL_free(text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SDLK_f:
|
||||||
|
if (withControl) {
|
||||||
|
/* Ctrl-F flash the window */
|
||||||
|
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
|
||||||
|
if (window) {
|
||||||
|
SDL_FlashWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SDLK_g:
|
case SDLK_g:
|
||||||
if (withControl) {
|
if (withControl) {
|
||||||
/* Ctrl-G toggle mouse grab */
|
/* Ctrl-G toggle mouse grab */
|
||||||
|
|
|
@ -240,7 +240,7 @@ struct SDL_VideoDevice
|
||||||
int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects);
|
int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects);
|
||||||
void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window);
|
void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window);
|
||||||
void (*OnWindowEnter) (_THIS, SDL_Window * window);
|
void (*OnWindowEnter) (_THIS, SDL_Window * window);
|
||||||
int (*FlashWindow) (_THIS, SDL_Window * window, Uint32 flash_count);
|
int (*FlashWindow) (_THIS, SDL_Window * window);
|
||||||
|
|
||||||
/* * * */
|
/* * * */
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2793,12 +2793,12 @@ SDL_GetGrabbedWindow(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_FlashWindow(SDL_Window * window, Uint32 flash_count)
|
SDL_FlashWindow(SDL_Window * window)
|
||||||
{
|
{
|
||||||
CHECK_WINDOW_MAGIC(window, -1);
|
CHECK_WINDOW_MAGIC(window, -1);
|
||||||
|
|
||||||
if (_this->FlashWindow) {
|
if (_this->FlashWindow) {
|
||||||
return _this->FlashWindow(_this, window, flash_count);
|
return _this->FlashWindow(_this, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
|
|
|
@ -151,7 +151,7 @@ extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window);
|
||||||
extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info);
|
extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info);
|
||||||
extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||||
extern void Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
extern void Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
||||||
extern int Cocoa_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count);
|
extern int Cocoa_FlashWindow(_THIS, SDL_Window * window);
|
||||||
|
|
||||||
#endif /* SDL_cocoawindow_h_ */
|
#endif /* SDL_cocoawindow_h_ */
|
||||||
|
|
||||||
|
|
|
@ -2117,7 +2117,7 @@ Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_FlashWindow(_THIS, SDL_Window *window, Uint32 flash_count)
|
Cocoa_FlashWindow(_THIS, SDL_Window *window)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
/* Note that this is app-wide and not window-specific! */
|
/* Note that this is app-wide and not window-specific! */
|
||||||
|
|
|
@ -920,7 +920,7 @@ Wayland_RaiseWindow(_THIS, SDL_Window *window)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Wayland_FlashWindow(_THIS, SDL_Window *window, Uint32 flash_count)
|
Wayland_FlashWindow(_THIS, SDL_Window *window)
|
||||||
{
|
{
|
||||||
Wayland_activate_window(_this->driverdata,
|
Wayland_activate_window(_this->driverdata,
|
||||||
window->driverdata,
|
window->driverdata,
|
||||||
|
|
|
@ -113,7 +113,7 @@ extern void Wayland_SuspendScreenSaver(_THIS);
|
||||||
extern SDL_bool
|
extern SDL_bool
|
||||||
Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
|
Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
|
||||||
extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||||
extern int Wayland_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count);
|
extern int Wayland_FlashWindow(_THIS, SDL_Window * window);
|
||||||
|
|
||||||
extern void Wayland_HandlePendingResize(SDL_Window *window);
|
extern void Wayland_HandlePendingResize(SDL_Window *window);
|
||||||
|
|
||||||
|
|
|
@ -1064,17 +1064,20 @@ WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
WIN_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count)
|
WIN_FlashWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
|
||||||
FLASHWINFO desc;
|
FLASHWINFO desc;
|
||||||
|
const char *hint = SDL_GetHint(SDL_HINT_WINDOW_FLASH_COUNT);
|
||||||
|
|
||||||
hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
|
SDL_zero(desc);
|
||||||
desc.cbSize = sizeof(desc);
|
desc.cbSize = sizeof(desc);
|
||||||
desc.hwnd = hwnd;
|
desc.hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
|
||||||
desc.dwFlags = FLASHW_TRAY;
|
desc.dwFlags = FLASHW_TRAY;
|
||||||
desc.uCount = flash_count; /* flash x times */
|
if (hint && *hint) {
|
||||||
desc.dwTimeout = 0;
|
desc.uCount = SDL_atoi(hint);
|
||||||
|
} else {
|
||||||
|
desc.dwFlags |= FLASHW_TIMERNOFG;
|
||||||
|
}
|
||||||
|
|
||||||
FlashWindowEx(&desc);
|
FlashWindowEx(&desc);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ extern void WIN_OnWindowEnter(_THIS, SDL_Window * window);
|
||||||
extern void WIN_UpdateClipCursor(SDL_Window *window);
|
extern void WIN_UpdateClipCursor(SDL_Window *window);
|
||||||
extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||||
extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
||||||
extern int WIN_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count);
|
extern int WIN_FlashWindow(_THIS, SDL_Window * window);
|
||||||
|
|
||||||
#endif /* SDL_windowswindow_h_ */
|
#endif /* SDL_windowswindow_h_ */
|
||||||
|
|
||||||
|
|
|
@ -1749,7 +1749,7 @@ X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count)
|
X11_FlashWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||||
|
|
|
@ -107,7 +107,7 @@ extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||||
struct SDL_SysWMinfo *info);
|
struct SDL_SysWMinfo *info);
|
||||||
extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||||
extern void X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
extern void X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
||||||
extern int X11_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count);
|
extern int X11_FlashWindow(_THIS, SDL_Window * window);
|
||||||
|
|
||||||
#endif /* SDL_x11window_h_ */
|
#endif /* SDL_x11window_h_ */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue