]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/cocoa/display.cpp
Streamline iterators and loop constructs
[libs/gui.git] / source / graphics / cocoa / display.cpp
1 #include <stdexcept>
2 #include "cocoadisplay.h"
3 #include "display.h"
4 #include "display_private.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace Graphics {
10
11 Display::Display(const string &):
12         primary_monitor(0),
13         priv(new Private),
14         focus_window(0)
15 {
16         static ErrorDialog err_dlg(0);
17
18         priv->display = create_display();
19 }
20
21 Display::~Display()
22 {
23         destroy_display(priv->display);
24         delete priv;
25 }
26
27 void Display::set_mode(const VideoMode &, bool)
28 {
29         throw runtime_error("video mode switching not supported");
30 }
31
32 bool Display::process_events()
33 {
34         Window::Event event;
35         if(!get_event(priv->display, &event.cevent))
36                 return false;
37
38         auto i = priv->windows.find(event.cevent.any.window);
39         if(i!=priv->windows.end())
40                 i->second->event(event);
41
42         return true;
43 }
44
45 void Display::check_error()
46 {
47 }
48
49 } // namespace Graphics
50 } // namespace Msp