minor tidy-up.

Ozkan Sezer 2023-02-18 11:29:10 +03:00
parent c88becc87a
commit b5a7bd72df
2 changed files with 9 additions and 11 deletions

View File

@ -630,7 +630,6 @@ void WIN_SetWindowTitle(_THIS, SDL_Window *window)
int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
{
int retVal = 0;
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
HWND hwnd = window->driverdata->hwnd;
HICON hicon = NULL;
@ -639,6 +638,7 @@ int WIN_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
BITMAPINFOHEADER *bmi;
Uint8 *dst;
SDL_bool isstack;
int retval = 0;
/* Create temporary buffer for ICONIMAGE structure */
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);
if (hicon == NULL) {
SDL_SetError("SetWindowIcon() failed, error %08X", (unsigned int)GetLastError());
retVal = -1;
retval = SDL_SetError("SetWindowIcon() failed, error %08X", (unsigned int)GetLastError());
}
/* 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?) */
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon);
return retval;
#else
retVal = SDL_Unsupported();
return SDL_Unsupported();
#endif
return retVal;
}
void WIN_SetWindowPosition(_THIS, SDL_Window *window)

View File

@ -753,14 +753,13 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
SDL_WindowData *data = window->driverdata;
Display *display = data->videodata->display;
Atom _NET_WM_ICON = data->videodata->_NET_WM_ICON;
int retVal = 0;
int rc = 0;
int (*prevHandler)(Display *, XErrorEvent *) = NULL;
if (icon) {
int x, y;
int propsize;
long *propdata;
int x, y;
Uint32 *src;
long *dst;
@ -772,6 +771,7 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
if (!propdata) {
return SDL_OutOfMemory();
}
X11_XSync(display, False);
prevHandler = X11_XSetErrorHandler(X11_CatchAnyError);
@ -792,9 +792,8 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
SDL_free(propdata);
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);
@ -804,7 +803,7 @@ int X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
caught_x11_error = SDL_FALSE;
}
return retVal;
return rc;
}
void X11_SetWindowPosition(_THIS, SDL_Window *window)