mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Added SDL_SetWindowModalFor().
This is currently only implemented for X11. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
This commit is contained in:
parent
e497e46515
commit
d4aedf9951
@ -873,6 +873,16 @@ extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opac
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
|
extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Sets the window as a modal for another window (@TODO: reconsider this function and/or its name)
|
||||||
|
*
|
||||||
|
* \param modal_window The window that should be modal
|
||||||
|
* \param parent_window The parent window
|
||||||
|
*
|
||||||
|
* \return 0 on success, or -1 otherwise.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Explicitly sets input focus to the window.
|
* \brief Explicitly sets input focus to the window.
|
||||||
*
|
*
|
||||||
|
@ -602,3 +602,4 @@
|
|||||||
#define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL
|
#define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL
|
||||||
#define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL
|
#define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL
|
||||||
#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL
|
#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL
|
||||||
|
#define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL
|
||||||
|
@ -636,3 +636,4 @@ SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int
|
|||||||
SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return)
|
||||||
|
SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return)
|
||||||
|
@ -210,6 +210,7 @@ struct SDL_VideoDevice
|
|||||||
void (*SetWindowMaximumSize) (_THIS, SDL_Window * window);
|
void (*SetWindowMaximumSize) (_THIS, SDL_Window * window);
|
||||||
int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
||||||
int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity);
|
int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity);
|
||||||
|
int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
|
||||||
int (*SetWindowInputFocus) (_THIS, SDL_Window * window);
|
int (*SetWindowInputFocus) (_THIS, SDL_Window * window);
|
||||||
void (*ShowWindow) (_THIS, SDL_Window * window);
|
void (*ShowWindow) (_THIS, SDL_Window * window);
|
||||||
void (*HideWindow) (_THIS, SDL_Window * window);
|
void (*HideWindow) (_THIS, SDL_Window * window);
|
||||||
|
@ -2228,6 +2228,19 @@ SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window)
|
||||||
|
{
|
||||||
|
CHECK_WINDOW_MAGIC(modal_window, -1);
|
||||||
|
CHECK_WINDOW_MAGIC(parent_window, -1);
|
||||||
|
|
||||||
|
if (!_this->SetWindowModalFor) {
|
||||||
|
return SDL_Unsupported();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _this->SetWindowModalFor(_this, modal_window, parent_window);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SetWindowInputFocus(SDL_Window * window)
|
SDL_SetWindowInputFocus(SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
@ -234,6 +234,7 @@ X11_CreateDevice(int devindex)
|
|||||||
device->SetWindowMaximumSize = X11_SetWindowMaximumSize;
|
device->SetWindowMaximumSize = X11_SetWindowMaximumSize;
|
||||||
device->GetWindowBordersSize = X11_GetWindowBordersSize;
|
device->GetWindowBordersSize = X11_GetWindowBordersSize;
|
||||||
device->SetWindowOpacity = X11_SetWindowOpacity;
|
device->SetWindowOpacity = X11_SetWindowOpacity;
|
||||||
|
device->SetWindowModalFor = X11_SetWindowModalFor;
|
||||||
device->SetWindowInputFocus = X11_SetWindowInputFocus;
|
device->SetWindowInputFocus = X11_SetWindowInputFocus;
|
||||||
device->ShowWindow = X11_ShowWindow;
|
device->ShowWindow = X11_ShowWindow;
|
||||||
device->HideWindow = X11_HideWindow;
|
device->HideWindow = X11_HideWindow;
|
||||||
|
@ -942,6 +942,16 @@ X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window) {
|
||||||
|
SDL_WindowData *data = (SDL_WindowData *) modal_window->driverdata;
|
||||||
|
SDL_WindowData *parent_data = (SDL_WindowData *) parent_window->driverdata;
|
||||||
|
Display *display = data->videodata->display;
|
||||||
|
|
||||||
|
X11_XSetTransientForHint(display, data->xwindow, parent_data->xwindow);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_SetWindowInputFocus(_THIS, SDL_Window * window)
|
X11_SetWindowInputFocus(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
@ -81,6 +81,7 @@ extern void X11_SetWindowMinimumSize(_THIS, SDL_Window * window);
|
|||||||
extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window);
|
extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window);
|
||||||
extern int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
extern int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
||||||
extern int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
extern int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
||||||
|
extern int X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
|
||||||
extern int X11_SetWindowInputFocus(_THIS, SDL_Window * window);
|
extern int X11_SetWindowInputFocus(_THIS, SDL_Window * window);
|
||||||
extern void X11_SetWindowSize(_THIS, SDL_Window * window);
|
extern void X11_SetWindowSize(_THIS, SDL_Window * window);
|
||||||
extern void X11_ShowWindow(_THIS, SDL_Window * window);
|
extern void X11_ShowWindow(_THIS, SDL_Window * window);
|
||||||
|
Loading…
Reference in New Issue
Block a user