@@ -301,9 +301,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
301
301
}
302
302
break ;
303
303
case WM_DESTROY :
304
- /* only kill the program if closing the actual toplevel, not the fake one */
305
- if (hwnd == the_output .toplevel )
306
- PostQuitMessage (0 );
304
+ PostQuitMessage (0 );
307
305
return 0 ;
308
306
case WM_SIZE : {
309
307
win_width = LOWORD (lparam );
414
412
output_windows (struct lstopo_output * loutput , const char * dummy __hwloc_attribute_unused )
415
413
{
416
414
WNDCLASS wndclass ;
417
- HWND toplevel , faketoplevel ;
415
+ HWND toplevel ;
418
416
unsigned width , height ;
419
417
HFONT font ;
420
418
MSG msg ;
@@ -425,9 +423,6 @@ output_windows (struct lstopo_output *loutput, const char *dummy __hwloc_attribu
425
423
loutput -> methods = & windows_draw_methods ;
426
424
loutput -> backend_data = & the_output ;
427
425
428
- /* make sure WM_DESTROY on the faketoplevel won't kill the program */
429
- the_output .toplevel = NULL ;
430
-
431
426
/* create the toplevel window, with random size for now */
432
427
memset (& wndclass , 0 , sizeof (wndclass ));
433
428
wndclass .hbrBackground = (HBRUSH ) GetStockObject (WHITE_BRUSH );
@@ -440,16 +435,15 @@ output_windows (struct lstopo_output *loutput, const char *dummy __hwloc_attribu
440
435
441
436
/* recurse once for preparing sizes and positions using a fake top level window */
442
437
loutput -> drawing = LSTOPO_DRAWING_PREPARE ;
443
- faketoplevel = CreateWindow ("lstopo" , loutput -> title , WS_OVERLAPPEDWINDOW ,
438
+ toplevel = CreateWindow ("lstopo" , loutput -> title , WS_OVERLAPPEDWINDOW ,
444
439
CW_USEDEFAULT , CW_USEDEFAULT ,
445
440
10 , 10 , NULL , NULL , NULL , NULL );
446
- BeginPaint (faketoplevel , & the_output .ps );
441
+ BeginPaint (toplevel , & the_output .ps );
447
442
font = CreateFont (loutput -> fontsize , 0 , 0 , 0 , 0 , FALSE, FALSE, FALSE, DEFAULT_CHARSET , OUT_DEFAULT_PRECIS , CLIP_DEFAULT_PRECIS , DEFAULT_QUALITY , DEFAULT_PITCH , NULL );
448
443
SelectObject (the_output .ps .hdc , (HGDIOBJ ) font );
449
444
output_draw (loutput );
450
445
DeleteObject (font );
451
- EndPaint (faketoplevel , & the_output .ps );
452
- DestroyWindow (faketoplevel );
446
+ EndPaint (toplevel , & the_output .ps );
453
447
loutput -> drawing = LSTOPO_DRAWING_DRAW ;
454
448
455
449
/* now create the actual toplevel with the sizes */
@@ -471,10 +465,9 @@ output_windows (struct lstopo_output *loutput, const char *dummy __hwloc_attribu
471
465
if (win_height > GetSystemMetrics (SM_CYFULLSCREEN ))
472
466
win_height = GetSystemMetrics (SM_CYFULLSCREEN );
473
467
474
- toplevel = CreateWindow ("lstopo" , loutput -> title , WS_OVERLAPPEDWINDOW ,
475
- CW_USEDEFAULT , CW_USEDEFAULT ,
476
- win_width , win_height , NULL , NULL , NULL , NULL );
477
- the_output .toplevel = toplevel ;
468
+ ignore_wm_size = 1 ;
469
+ SetWindowPos (toplevel , HWND_TOP , 0 , 0 , win_width , win_height , SWP_NOCOPYBITS |SWP_NOMOVE |SWP_NOOWNERZORDER |SWP_NOZORDER );
470
+ ignore_wm_size = 0 ;
478
471
479
472
the_width = width ;
480
473
the_height = height ;
@@ -488,16 +481,15 @@ output_windows (struct lstopo_output *loutput, const char *dummy __hwloc_attribu
488
481
needs_resize = 0 ;
489
482
ignore_wm_size = 0 ;
490
483
491
- /* and display the window */
492
- ShowWindow (toplevel , SW_SHOWDEFAULT );
493
-
494
- lstopo_show_interactive_help ();
495
-
496
484
/* ready */
497
485
declare_colors (loutput );
498
486
lstopo_prepare_custom_styles (loutput );
499
487
500
- UpdateWindow (the_output .toplevel );
488
+ lstopo_show_interactive_help ();
489
+ the_output .toplevel = toplevel ;
490
+ ShowWindow (toplevel , SW_SHOWDEFAULT );
491
+ UpdateWindow (toplevel );
492
+
501
493
while (!finish && GetMessage (& msg , NULL , 0 , 0 )) {
502
494
TranslateMessage (& msg );
503
495
DispatchMessage (& msg );
0 commit comments