Skip to content

Commit

Permalink
Minor tweaks for smoother window resize on Windows. May help hrydgard…
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard authored and RadarNyan committed Jun 26, 2014
1 parent bcbcf8b commit bab3460
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions Windows/WndMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ namespace MainWindow {
//Register classes
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.style = CS_PARENTDC;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
Expand All @@ -161,12 +161,13 @@ namespace MainWindow {
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = (LPCWSTR)IDR_MENU1;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = (HICON)LoadImage(hInstance, (LPCTSTR)IDI_PPSSPP, IMAGE_ICON, 16,16,LR_SHARED);
wcex.hIconSm = (HICON)LoadImage(hInstance, (LPCTSTR)IDI_PPSSPP, IMAGE_ICON, 16, 16, LR_SHARED);
RegisterClassEx(&wcex);
}

void SavePosition() {
if (g_Config.bFullScreen) return;
if (g_Config.bFullScreen)
return;

WINDOWPLACEMENT placement;
GetWindowPlacement(hwndMain, &placement);
Expand Down Expand Up @@ -195,7 +196,6 @@ namespace MainWindow {
rcOuter.top = g_Config.iWindowY;
}


static void ShowScreenResolution() {
I18NCategory *g = GetI18NCategory("Graphics");
char message[256];
Expand Down Expand Up @@ -905,22 +905,25 @@ namespace MainWindow {
int wmId, wmEvent;
std::string fn;
static bool noFocusPause = false; // TOGGLE_PAUSE state to override pause on lost focus
static bool firstErase = true;

switch (message) {
case WM_SETFOCUS:
break;

case WM_SIZE:
SavePosition();
ResizeDisplay();
break;

case WM_ERASEBKGND:
return DefWindowProc(hWnd, message, wParam, lParam);
if (firstErase) {
firstErase = false;
// Paint black on first erase while OpenGL stuff is loading
return DefWindowProc(hWnd, message, wParam, lParam);
}
// Then never erase, let the OpenGL drawing take care of everything.
return 1;

// Poor man's touch - mouse input. We send the data both as an input_state pointer,
// and as asynchronous touch events for minimal latency.

case WM_LBUTTONDOWN:
if (!touchHandler.hasTouch() ||
(GetMessageExtraInfo() & MOUSEEVENTF_MASK_PLUS_PENTOUCH) != MOUSEEVENTF_FROMTOUCH_NOPEN)
Expand Down Expand Up @@ -1008,11 +1011,10 @@ namespace MainWindow {
}

case WM_PAINT:
return DefWindowProc(hWnd, message, wParam, lParam);
// Don't paint, we do that through OpenGL.
return 0;
// return DefWindowProc(hWnd, message, wParam, lParam);

case WM_CREATE:
break;

case WM_ACTIVATE:
{
bool pause = true;
Expand Down Expand Up @@ -1135,6 +1137,7 @@ namespace MainWindow {
NativeMessageReceived("reset", "");
Core_EnableStepping(false);
break;

case ID_EMULATION_SWITCH_UMD:
UmdSwitchAction();
break;
Expand Down

0 comments on commit bab3460

Please sign in to comment.