Code

Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in...
[inkscape.git] / src / debug / log-display-config.cpp
1 /*
2  * Inkscape::Debug::log_display_config - log display configuration
3  *
4  * Authors:
5  *   MenTaLguY <mental@rydia.net>
6  *
7  * Copyright (C) 2007 MenTaLguY
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #include <iostream>
13 #include <gdk/gdkdisplay.h>
14 #include <gdk/gdkscreen.h>
15 #include "debug/event-tracker.h"
16 #include "debug/logger.h"
17 #include "debug/simple-event.h"
18 #include "debug/log-display-config.h"
20 namespace Inkscape {
22 namespace Debug {
24 namespace {
26 typedef SimpleEvent<Event::CONFIGURATION> ConfigurationEvent;
28 class Monitor : public ConfigurationEvent {
29 public:
30     Monitor(GdkScreen *screen, gint monitor) : ConfigurationEvent("monitor") {
31         GdkRectangle area;
32         gdk_screen_get_monitor_geometry(screen, monitor, &area);
33         _addProperty("x", area.x);
34         _addProperty("y", area.y);
35         _addProperty("width", area.width);
36         _addProperty("height", area.height);
37     }
38 };
40 class Screen : public ConfigurationEvent {
41 public:
42     Screen(GdkScreen *s) : ConfigurationEvent("screen"), screen(s) {
43         _addProperty("width", gdk_screen_get_width(screen));
44         _addProperty("height", gdk_screen_get_height(screen));
45     }
46     void generateChildEvents() const {
47         gint n_monitors = gdk_screen_get_n_monitors(screen);
48         for ( gint i = 0 ; i < n_monitors ; i++ ) {
49             Logger::write<Monitor>(screen, i);
50         }
51     }
53 private:
54     GdkScreen *screen;
55 };
57 class Display : public ConfigurationEvent {
58 public:
59     Display() : ConfigurationEvent("display") {}
60     void generateChildEvents() const {
61         GdkDisplay *display=gdk_display_get_default();
62         gint n_screens = gdk_display_get_n_screens(display);
63         for ( gint i = 0 ; i < n_screens ; i++ ) {
64             GdkScreen *screen = gdk_display_get_screen(display, i);
65             Logger::write<Screen>(screen);
66         }
67     }
68 };
70 }
72 void log_display_config() {
73     Logger::write<Display>();
74 }
76 }
78 }
80 /*
81   Local Variables:
82   mode:c++
83   c-file-style:"stroustrup"
84   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
85   indent-tabs-mode:nil
86   fill-column:99
87   End:
88 */
89 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :