|
68 | 68 | #define VK_OEM_NEC_EQUAL 0x92 |
69 | 69 | #endif |
70 | 70 |
|
| 71 | +// Undocumented window messages |
| 72 | +#ifndef WM_NCUAHDRAWCAPTION |
| 73 | +#define WM_NCUAHDRAWCAPTION 0xAE |
| 74 | +#endif |
| 75 | +#ifndef WM_NCUAHDRAWFRAME |
| 76 | +#define WM_NCUAHDRAWFRAME 0xAF |
| 77 | +#endif |
| 78 | + |
71 | 79 | /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */ |
72 | 80 | #ifndef WM_XBUTTONDOWN |
73 | 81 | #define WM_XBUTTONDOWN 0x020B |
@@ -805,6 +813,24 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
805 | 813 | actually being the foreground window, but this appears to get called in all cases where |
806 | 814 | the global foreground window changes to and from this window. */ |
807 | 815 | WIN_UpdateFocus(data->window, !!wParam); |
| 816 | + |
| 817 | + /* Handle borderless windows; this event is intended for drawing the titlebar, so we need |
| 818 | + to stop that from happening. */ |
| 819 | + if (data->window->flags & SDL_WINDOW_BORDERLESS) { |
| 820 | + lParam = -1; // According to MSDN, DefWindowProc will draw a title bar if lParam != -1 |
| 821 | + } |
| 822 | + } break; |
| 823 | + |
| 824 | + case WM_NCUAHDRAWCAPTION: |
| 825 | + case WM_NCUAHDRAWFRAME: |
| 826 | + { |
| 827 | + /* These messages are undocumented. They are responsible for redrawing the window frame and |
| 828 | + caption. Notably, WM_NCUAHDRAWCAPTION is sent when calling SetWindowText on a window. |
| 829 | + For borderless windows, we don't want to draw a frame or caption, so we should stop |
| 830 | + that from happening. */ |
| 831 | + if (data->window->flags & SDL_WINDOW_BORDERLESS) { |
| 832 | + returnCode = 0; |
| 833 | + } |
808 | 834 | } break; |
809 | 835 |
|
810 | 836 | case WM_ACTIVATE: |
|
0 commit comments