2 #include "display_private.h"
10 void Display::add_window(Window &wnd)
12 priv->windows[wnd.get_private().window] = &wnd;
15 void Display::remove_window(Window &wnd)
17 priv->windows.erase(wnd.get_private().window);
20 const VideoMode &Display::get_desktop_mode() const
22 if(!primary_monitor || !primary_monitor->desktop_mode)
23 throw logic_error("no desktop mode");
24 return *primary_monitor->desktop_mode;
27 void Display::restore_mode()
29 for(list<Monitor>::const_iterator i=monitors.begin(); i!=monitors.end(); ++i)
31 set_mode(*i->desktop_mode, false);
34 const VideoMode *Display::find_mode(const VideoMode &mode) const
36 for(list<VideoMode>::const_iterator i=modes.begin(); i!=modes.end(); ++i)
38 if(mode.monitor && i->monitor!=mode.monitor)
40 if(mode.rate && i->rate!=mode.rate)
42 if(i->width==mode.width && i->height==mode.height)
49 const VideoMode *Display::find_mode(unsigned width, unsigned height) const
51 return find_mode(VideoMode(width, height));
58 while(process_events()) ;
61 } // namespace Graphics