FLTK logo

[fltk.coredev] Re: What do these functions in win32.H do?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: What do these functions in win32.H do? "'melcher.... Feb 02, 2023  
  As a user, you do not need to call it. As a core dev, see Fl_WIN32.cxx:

///////////////////////////////////////////////////////////////////////

//

//  The following routines help fix a problem with the leaking of Windows

//  Device Context (DC) objects. The 'proper' protocol is for a program to

//  acquire a DC, save its state, do the modifications needed for drawing,

//  perform the drawing, restore the initial state, and release the DC. In

//  FLTK, the save and restore steps have previously been omitted and DCs are

//  not properly released, leading to a great number of DC leaks. As some

//  Windows "OSs" will hang when any process exceeds roughly 10,000 GDI objects,

//  it is important to control GDI leaks, which are much more important than memory

//  leaks. The following struct, global variable, and routines help implement

//  the above protocol for those cases where the GetDC and RestoreDC are not in

//  the same routine. For each GetDC, fl_save_dc is used to create an entry in

//  a linked list that saves the window handle, the DC handle, and the initial

//  state. When the DC is to be released, 'fl_release_dc' is called. It restores

//  the initial state and releases the DC. When the program exits, 'fl_cleanup_dc_list'

//  frees any remaining nodes in the list.


--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/59569b5e-149f-4a43-b067-b05bf3e3802cn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.