diff options
-rw-r--r-- | uisimulator/win32/uisw32.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/uisimulator/win32/uisw32.c b/uisimulator/win32/uisw32.c index 8fb2ae1d9d..39ab709a20 100644 --- a/uisimulator/win32/uisw32.c +++ b/uisimulator/win32/uisw32.c | |||
@@ -124,7 +124,7 @@ LRESULT CALLBACK GUIWndProc ( | |||
124 | break; | 124 | break; |
125 | case WMSZ_BOTTOMRIGHT: | 125 | case WMSZ_BOTTOMRIGHT: |
126 | GetWindowRect (hWnd, &r2); | 126 | GetWindowRect (hWnd, &r2); |
127 | if (abs(r2.right - r->right) > abs(r2.bottom - r->bottom)) | 127 | if (r2.right - r->right > r2.bottom - r->bottom) |
128 | v = (r->right - r->left) / (UI_WIDTH / 5); | 128 | v = (r->right - r->left) / (UI_WIDTH / 5); |
129 | else | 129 | else |
130 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); | 130 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); |
@@ -135,7 +135,7 @@ LRESULT CALLBACK GUIWndProc ( | |||
135 | break; | 135 | break; |
136 | case WMSZ_BOTTOMLEFT: | 136 | case WMSZ_BOTTOMLEFT: |
137 | GetWindowRect (hWnd, &r2); | 137 | GetWindowRect (hWnd, &r2); |
138 | if (abs(r2.left - r->left) > abs(r2.bottom - r->bottom)) | 138 | if (-(r2.left - r->left) > r2.bottom - r->bottom) |
139 | v = (r->right - r->left) / (UI_WIDTH / 5); | 139 | v = (r->right - r->left) / (UI_WIDTH / 5); |
140 | else | 140 | else |
141 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); | 141 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); |
@@ -146,7 +146,7 @@ LRESULT CALLBACK GUIWndProc ( | |||
146 | break; | 146 | break; |
147 | case WMSZ_TOPRIGHT: | 147 | case WMSZ_TOPRIGHT: |
148 | GetWindowRect (hWnd, &r2); | 148 | GetWindowRect (hWnd, &r2); |
149 | if (abs(r2.right - r->right) > abs(r2.top - r->top)) | 149 | if (r2.right - r->right > -(r2.top - r->top)) |
150 | v = (r->right - r->left) / (UI_WIDTH / 5); | 150 | v = (r->right - r->left) / (UI_WIDTH / 5); |
151 | else | 151 | else |
152 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); | 152 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); |
@@ -157,7 +157,7 @@ LRESULT CALLBACK GUIWndProc ( | |||
157 | break; | 157 | break; |
158 | case WMSZ_TOPLEFT: | 158 | case WMSZ_TOPLEFT: |
159 | GetWindowRect (hWnd, &r2); | 159 | GetWindowRect (hWnd, &r2); |
160 | if (abs(r2.left - r->left) > abs(r2.top - r->top)) | 160 | if (-(r2.left - r->left) > -(r2.top - r->top)) |
161 | v = (r->right - r->left) / (UI_WIDTH / 5); | 161 | v = (r->right - r->left) / (UI_WIDTH / 5); |
162 | else | 162 | else |
163 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); | 163 | v = (r->bottom - r->top) / (UI_HEIGHT / 5); |
@@ -168,7 +168,7 @@ LRESULT CALLBACK GUIWndProc ( | |||
168 | break; | 168 | break; |
169 | } | 169 | } |
170 | 170 | ||
171 | wsprintf (s, UI_TITLE " @%d%%", | 171 | wsprintf (s, UI_TITLE " @%d%%", |
172 | (r->right - r->left - GetSystemMetrics (SM_CXSIZEFRAME) * 2 -4) | 172 | (r->right - r->left - GetSystemMetrics (SM_CXSIZEFRAME) * 2 -4) |
173 | * 100 / UI_WIDTH); | 173 | * 100 / UI_WIDTH); |
174 | SetWindowText (hWnd, s); | 174 | SetWindowText (hWnd, s); |
@@ -177,15 +177,13 @@ LRESULT CALLBACK GUIWndProc ( | |||
177 | } | 177 | } |
178 | case WM_ERASEBKGND: | 178 | case WM_ERASEBKGND: |
179 | { | 179 | { |
180 | PAINTSTRUCT ps; | 180 | HDC hDc = (HDC) wParam; |
181 | HDC hDc = BeginPaint (hWnd, &ps); | ||
182 | RECT r; | 181 | RECT r; |
183 | 182 | ||
184 | GetClientRect (hWnd, &r); | 183 | GetClientRect (hWnd, &r); |
185 | // blit background image to screen | 184 | // blit background image to screen |
186 | StretchBlt (hDc, 0, 0, r.right, r.bottom, | 185 | StretchBlt (hDc, 0, 0, r.right, r.bottom, |
187 | hMemDc, 0, 0, UI_WIDTH, UI_HEIGHT, SRCCOPY); | 186 | hMemDc, 0, 0, UI_WIDTH, UI_HEIGHT, SRCCOPY); |
188 | EndPaint (hWnd, &ps); | ||
189 | return TRUE; | 187 | return TRUE; |
190 | } | 188 | } |
191 | case WM_PAINT: | 189 | case WM_PAINT: |