|
@@ -98,9 +98,10 @@ GetWindowStyle(SDL_Window * window)
|
|
|
style |= STYLE_RESIZABLE;
|
|
|
}
|
|
|
|
|
|
- /* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */
|
|
|
- if ( window->flags & SDL_WINDOW_MINIMIZED )
|
|
|
- style |= WS_MINIMIZE;
|
|
|
+ /* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */
|
|
|
+ if (window->flags & SDL_WINDOW_MINIMIZED) {
|
|
|
+ style |= WS_MINIMIZE;
|
|
|
+ }
|
|
|
}
|
|
|
return style;
|
|
|
}
|
|
@@ -334,8 +335,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
|
|
|
/* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */
|
|
|
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
|
|
|
|
|
|
- if ( window->flags & SDL_WINDOW_MINIMIZED )
|
|
|
- ShowWindow( hwnd, SW_SHOWMINNOACTIVE );
|
|
|
+ if (window->flags & SDL_WINDOW_MINIMIZED) {
|
|
|
+ ShowWindow(hwnd, SW_SHOWMINNOACTIVE);
|
|
|
+ }
|
|
|
|
|
|
if (!(window->flags & SDL_WINDOW_OPENGL)) {
|
|
|
return 0;
|
|
@@ -409,13 +411,11 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
|
|
|
SDL_sscanf(hint, "%p", (void**)&otherWindow);
|
|
|
|
|
|
/* Do some error checking on the pointer */
|
|
|
- if (otherWindow != NULL && otherWindow->magic == &_this->window_magic)
|
|
|
- {
|
|
|
+ if (otherWindow != NULL && otherWindow->magic == &_this->window_magic) {
|
|
|
/* If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well */
|
|
|
- if (otherWindow->flags & SDL_WINDOW_OPENGL)
|
|
|
- {
|
|
|
+ if (otherWindow->flags & SDL_WINDOW_OPENGL) {
|
|
|
window->flags |= SDL_WINDOW_OPENGL;
|
|
|
- if(!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) {
|
|
|
+ if (!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
@@ -548,17 +548,17 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b
|
|
|
void
|
|
|
WIN_ShowWindow(_THIS, SDL_Window * window)
|
|
|
{
|
|
|
- DWORD style;
|
|
|
- HWND hwnd;
|
|
|
- int nCmdShow;
|
|
|
-
|
|
|
- hwnd = ( (SDL_WindowData *)window->driverdata )->hwnd;
|
|
|
- nCmdShow = SW_SHOW;
|
|
|
- style = GetWindowLong(hwnd, GWL_EXSTYLE);
|
|
|
- if ( style & WS_EX_NOACTIVATE )
|
|
|
- nCmdShow = SW_SHOWNOACTIVATE;
|
|
|
-
|
|
|
- ShowWindow(hwnd, nCmdShow );
|
|
|
+ DWORD style;
|
|
|
+ HWND hwnd;
|
|
|
+ int nCmdShow;
|
|
|
+
|
|
|
+ hwnd = ((SDL_WindowData *)window->driverdata)->hwnd;
|
|
|
+ nCmdShow = SW_SHOW;
|
|
|
+ style = GetWindowLong(hwnd, GWL_EXSTYLE);
|
|
|
+ if (style & WS_EX_NOACTIVATE) {
|
|
|
+ nCmdShow = SW_SHOWNOACTIVATE;
|
|
|
+ }
|
|
|
+ ShowWindow(hwnd, nCmdShow);
|
|
|
}
|
|
|
|
|
|
void
|
|
@@ -902,6 +902,7 @@ WIN_UpdateClipCursor(SDL_Window *window)
|
|
|
{
|
|
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
|
|
SDL_Mouse *mouse = SDL_GetMouse();
|
|
|
+ RECT rect;
|
|
|
|
|
|
if (data->focus_click_pending) {
|
|
|
return;
|
|
@@ -911,7 +912,6 @@ WIN_UpdateClipCursor(SDL_Window *window)
|
|
|
(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
|
|
if (mouse->relative_mode && !mouse->relative_mode_warp) {
|
|
|
LONG cx, cy;
|
|
|
- RECT rect;
|
|
|
GetWindowRect(data->hwnd, &rect);
|
|
|
|
|
|
cx = (rect.left + rect.right) / 2;
|
|
@@ -923,17 +923,21 @@ WIN_UpdateClipCursor(SDL_Window *window)
|
|
|
rect.top = cy - 1;
|
|
|
rect.bottom = cy + 1;
|
|
|
|
|
|
- ClipCursor(&rect);
|
|
|
+ if (ClipCursor(&rect)) {
|
|
|
+ data->cursor_clipped_rect = rect;
|
|
|
+ }
|
|
|
} else {
|
|
|
- RECT rect;
|
|
|
if (GetClientRect(data->hwnd, &rect) && !IsRectEmpty(&rect)) {
|
|
|
ClientToScreen(data->hwnd, (LPPOINT) & rect);
|
|
|
ClientToScreen(data->hwnd, (LPPOINT) & rect + 1);
|
|
|
- ClipCursor(&rect);
|
|
|
+ if (ClipCursor(&rect)) {
|
|
|
+ data->cursor_clipped_rect = rect;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect)) == 0) {
|
|
|
ClipCursor(NULL);
|
|
|
+ SDL_zero(data->cursor_clipped_rect);
|
|
|
}
|
|
|
}
|
|
|
|