@@ -409,7 +409,7 @@ impl WndProc for MyWndProc {
409
409
WM_PAINT => unsafe {
410
410
if let Ok ( mut s) = self . state . try_borrow_mut ( ) {
411
411
let mut rect: RECT = mem:: zeroed ( ) ;
412
- GetUpdateRect ( hwnd, & mut rect, 0 ) ;
412
+ GetUpdateRect ( hwnd, & mut rect, FALSE ) ;
413
413
let s = s. as_mut ( ) . unwrap ( ) ;
414
414
if s. render_target . is_none ( ) {
415
415
let rt = paint:: create_render_target ( & self . d2d_factory , hwnd) ;
@@ -445,8 +445,11 @@ impl WndProc for MyWndProc {
445
445
let s = s. as_mut ( ) . unwrap ( ) ;
446
446
if s. dcomp_state . is_some ( ) {
447
447
let mut rect: RECT = mem:: zeroed ( ) ;
448
- if GetClientRect ( hwnd, & mut rect) == 0 {
449
- warn ! ( "GetClientRect failed." ) ;
448
+ if GetClientRect ( hwnd, & mut rect) == FALSE {
449
+ log:: warn!(
450
+ "GetClientRect failed: {}" ,
451
+ Error :: Hr ( HRESULT_FROM_WIN32 ( GetLastError ( ) ) )
452
+ ) ;
450
453
return None ;
451
454
}
452
455
let rt = paint:: create_render_target ( & self . d2d_factory , hwnd) ;
@@ -477,8 +480,11 @@ impl WndProc for MyWndProc {
477
480
let s = s. as_mut ( ) . unwrap ( ) ;
478
481
if s. dcomp_state . is_some ( ) {
479
482
let mut rect: RECT = mem:: zeroed ( ) ;
480
- if GetClientRect ( hwnd, & mut rect) == 0 {
481
- warn ! ( "GetClientRect failed." ) ;
483
+ if GetClientRect ( hwnd, & mut rect) == FALSE {
484
+ log:: warn!(
485
+ "GetClientRect failed: {}" ,
486
+ Error :: Hr ( HRESULT_FROM_WIN32 ( GetLastError ( ) ) )
487
+ ) ;
482
488
return None ;
483
489
}
484
490
let width = ( rect. right - rect. left ) as u32 ;
@@ -1258,11 +1264,16 @@ impl WindowHandle {
1258
1264
}
1259
1265
1260
1266
pub fn invalidate_rect ( & self , rect : Rect ) {
1261
- let r = self . px_to_rect ( rect) ;
1267
+ let rect = self . px_to_rect ( rect) ;
1262
1268
if let Some ( w) = self . state . upgrade ( ) {
1263
1269
let hwnd = w. hwnd . get ( ) ;
1264
1270
unsafe {
1265
- InvalidateRect ( hwnd, & r as * const _ , FALSE ) ;
1271
+ if InvalidateRect ( hwnd, & rect, FALSE ) == FALSE {
1272
+ log:: warn!(
1273
+ "InvalidateRect failed: {}" ,
1274
+ Error :: Hr ( HRESULT_FROM_WIN32 ( GetLastError ( ) ) )
1275
+ ) ;
1276
+ }
1266
1277
}
1267
1278
}
1268
1279
}
0 commit comments