mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 23:31:45 +00:00
minor tidy-up.
This commit is contained in:
@@ -630,7 +630,6 @@ void WIN_SetWindowTitle(_THIS, SDL_Window *window)
|
|||||||
|
|
||||||
int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
||||||
{
|
{
|
||||||
int retVal = 0;
|
|
||||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||||
HWND hwnd = window->driverdata->hwnd;
|
HWND hwnd = window->driverdata->hwnd;
|
||||||
HICON hicon = NULL;
|
HICON hicon = NULL;
|
||||||
@@ -639,6 +638,7 @@ int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
BITMAPINFOHEADER *bmi;
|
BITMAPINFOHEADER *bmi;
|
||||||
Uint8 *dst;
|
Uint8 *dst;
|
||||||
SDL_bool isstack;
|
SDL_bool isstack;
|
||||||
|
int retval = 0;
|
||||||
|
|
||||||
/* Create temporary buffer for ICONIMAGE structure */
|
/* Create temporary buffer for ICONIMAGE structure */
|
||||||
SDL_COMPILE_TIME_ASSERT(WIN_SetWindowIcon_uses_BITMAPINFOHEADER_to_prepare_an_ICONIMAGE, sizeof(BITMAPINFOHEADER) == 40);
|
SDL_COMPILE_TIME_ASSERT(WIN_SetWindowIcon_uses_BITMAPINFOHEADER_to_prepare_an_ICONIMAGE, sizeof(BITMAPINFOHEADER) == 40);
|
||||||
@@ -679,8 +679,7 @@ int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
SDL_small_free(icon_bmp, isstack);
|
SDL_small_free(icon_bmp, isstack);
|
||||||
|
|
||||||
if (hicon == NULL) {
|
if (hicon == NULL) {
|
||||||
SDL_SetError("SetWindowIcon() failed, error %08X", (unsigned int)GetLastError());
|
retval = SDL_SetError("SetWindowIcon() failed, error %08X", (unsigned int)GetLastError());
|
||||||
retVal = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the icon for the window */
|
/* Set the icon for the window */
|
||||||
@@ -688,10 +687,10 @@ int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
|
|
||||||
/* Set the icon in the task manager (should we do this?) */
|
/* Set the icon in the task manager (should we do this?) */
|
||||||
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon);
|
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon);
|
||||||
|
return retval;
|
||||||
#else
|
#else
|
||||||
retVal = SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
#endif
|
#endif
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WIN_SetWindowPosition(_THIS, SDL_Window *window)
|
void WIN_SetWindowPosition(_THIS, SDL_Window *window)
|
||||||
|
@@ -753,14 +753,13 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->driverdata;
|
||||||
Display *display = data->videodata->display;
|
Display *display = data->videodata->display;
|
||||||
Atom _NET_WM_ICON = data->videodata->_NET_WM_ICON;
|
Atom _NET_WM_ICON = data->videodata->_NET_WM_ICON;
|
||||||
int retVal = 0;
|
int rc = 0;
|
||||||
int (*prevHandler)(Display *, XErrorEvent *) = NULL;
|
int (*prevHandler)(Display *, XErrorEvent *) = NULL;
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
|
int x, y;
|
||||||
int propsize;
|
int propsize;
|
||||||
long *propdata;
|
long *propdata;
|
||||||
|
|
||||||
int x, y;
|
|
||||||
Uint32 *src;
|
Uint32 *src;
|
||||||
long *dst;
|
long *dst;
|
||||||
|
|
||||||
@@ -772,6 +771,7 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
if (!propdata) {
|
if (!propdata) {
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
X11_XSync(display, False);
|
X11_XSync(display, False);
|
||||||
prevHandler = X11_XSetErrorHandler(X11_CatchAnyError);
|
prevHandler = X11_XSetErrorHandler(X11_CatchAnyError);
|
||||||
|
|
||||||
@@ -792,9 +792,8 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
SDL_free(propdata);
|
SDL_free(propdata);
|
||||||
|
|
||||||
if (caught_x11_error) {
|
if (caught_x11_error) {
|
||||||
retVal = SDL_SetError("An error occurred while trying to set the window's icon");
|
rc = SDL_SetError("An error occurred while trying to set the window's icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
X11_XFlush(display);
|
X11_XFlush(display);
|
||||||
@@ -804,7 +803,7 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
|
|||||||
caught_x11_error = SDL_FALSE;
|
caught_x11_error = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11_SetWindowPosition(_THIS, SDL_Window *window)
|
void X11_SetWindowPosition(_THIS, SDL_Window *window)
|
||||||
|
Reference in New Issue
Block a user