Make window resize less lagged on Windows
This commit is contained in:
		
							parent
							
								
									f40dc661b3
								
							
						
					
					
						commit
						3dbf58c45f
					
				
					 1 changed files with 17 additions and 6 deletions
				
			
		|  | @ -244,6 +244,18 @@ void WindowHelper::setNativeFrame(bool enabled) { | ||||||
| 	updateMargins(); | 	updateMargins(); | ||||||
| 	updateWindowFrameColors(); | 	updateWindowFrameColors(); | ||||||
| 	fixMaximizedWindow(); | 	fixMaximizedWindow(); | ||||||
|  | 	SetWindowPos( | ||||||
|  | 		_handle, | ||||||
|  | 		0, | ||||||
|  | 		0, | ||||||
|  | 		0, | ||||||
|  | 		0, | ||||||
|  | 		0, | ||||||
|  | 		SWP_FRAMECHANGED | ||||||
|  | 			| SWP_NOMOVE | ||||||
|  | 			| SWP_NOSIZE | ||||||
|  | 			| SWP_NOZORDER | ||||||
|  | 			| SWP_NOACTIVATE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowHelper::initialShadowUpdate() { | void WindowHelper::initialShadowUpdate() { | ||||||
|  | @ -403,17 +415,14 @@ bool WindowHelper::handleNativeEvent( | ||||||
| 	} return true; | 	} return true; | ||||||
| 
 | 
 | ||||||
| 	case WM_NCCALCSIZE: { | 	case WM_NCCALCSIZE: { | ||||||
| 		if (_title->isHidden()) { | 		if (_title->isHidden() || !wParam) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		WINDOWPLACEMENT wp; | 		WINDOWPLACEMENT wp; | ||||||
| 		wp.length = sizeof(WINDOWPLACEMENT); | 		wp.length = sizeof(WINDOWPLACEMENT); | ||||||
| 		if (GetWindowPlacement(_handle, &wp) | 		if (GetWindowPlacement(_handle, &wp) | ||||||
| 			&& (wp.showCmd == SW_SHOWMAXIMIZED)) { | 			&& (wp.showCmd == SW_SHOWMAXIMIZED)) { | ||||||
| 			const auto params = (LPNCCALCSIZE_PARAMS)lParam; | 			const auto r = &((LPNCCALCSIZE_PARAMS)lParam)->rgrc[0]; | ||||||
| 			const auto r = (wParam == TRUE) |  | ||||||
| 				? ¶ms->rgrc[0] |  | ||||||
| 				: (LPRECT)lParam; |  | ||||||
| 			const auto hMonitor = MonitorFromPoint( | 			const auto hMonitor = MonitorFromPoint( | ||||||
| 				{ (r->left + r->right) / 2, (r->top + r->bottom) / 2 }, | 				{ (r->left + r->right) / 2, (r->top + r->bottom) / 2 }, | ||||||
| 				MONITOR_DEFAULTTONEAREST); | 				MONITOR_DEFAULTTONEAREST); | ||||||
|  | @ -433,8 +442,10 @@ bool WindowHelper::handleNativeEvent( | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} |  | ||||||
| 			if (result) *result = 0; | 			if (result) *result = 0; | ||||||
|  | 		} else { | ||||||
|  | 			if (result) *result = WVR_REDRAW; | ||||||
|  | 		} | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Ilya Fedin
						Ilya Fedin