summaryrefslogtreecommitdiffstats
path: root/src/debug
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-05-10 01:18:46 +0000
committermental <mental@users.sourceforge.net>2007-05-10 01:18:46 +0000
commitfe85f7d284783c24c3fe3566721dda30e508aad9 (patch)
tree20dc789dc5b906d67c21921a458373d72e02aa1f /src/debug
parentreally fix formatting this time (diff)
downloadinkscape-fe85f7d284783c24c3fe3566721dda30e508aad9.tar.gz
inkscape-fe85f7d284783c24c3fe3566721dda30e508aad9.zip
add logging of basic display properties
(bzr r2994)
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/Makefile_insert1
-rw-r--r--src/debug/log-display-config.cpp89
-rw-r--r--src/debug/log-display-config.h37
3 files changed, 127 insertions, 0 deletions
diff --git a/src/debug/Makefile_insert b/src/debug/Makefile_insert
index 6205b5ca9..96a12f3f4 100644
--- a/src/debug/Makefile_insert
+++ b/src/debug/Makefile_insert
@@ -11,6 +11,7 @@ debug_libinkdebug_a_SOURCES = \
debug/heap.cpp debug/heap.h \
debug/gc-heap.h \
debug/logger.cpp debug/logger.h \
+ debug/log-display-config.cpp debug/log-display-config.h \
debug/simple-event.h \
debug/sysv-heap.cpp debug/sysv-heap.h \
debug/timestamp.cpp debug/timestamp.h
diff --git a/src/debug/log-display-config.cpp b/src/debug/log-display-config.cpp
new file mode 100644
index 000000000..0aeb71cf9
--- /dev/null
+++ b/src/debug/log-display-config.cpp
@@ -0,0 +1,89 @@
+/*
+ * Inkscape::Debug::log_display_config - log display configuration
+ *
+ * Authors:
+ * MenTaLguY <mental@rydia.net>
+ *
+ * Copyright (C) 2007 MenTaLguY
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <iostream>
+#include <gdk/gdkdisplay.h>
+#include <gdk/gdkscreen.h>
+#include "debug/event-tracker.h"
+#include "debug/logger.h"
+#include "debug/simple-event.h"
+#include "debug/log-display-config.h"
+
+namespace Inkscape {
+
+namespace Debug {
+
+namespace {
+
+typedef SimpleEvent<Event::CONFIGURATION> ConfigurationEvent;
+
+class Monitor : public ConfigurationEvent {
+public:
+ Monitor(GdkScreen *screen, gint monitor) : ConfigurationEvent("monitor") {
+ GdkRectangle area;
+ gdk_screen_get_monitor_geometry(screen, monitor, &area);
+ _addProperty("x", area.x);
+ _addProperty("y", area.y);
+ _addProperty("width", area.width);
+ _addProperty("height", area.height);
+ }
+};
+
+class Screen : public ConfigurationEvent {
+public:
+ Screen(GdkScreen *s) : ConfigurationEvent("screen"), screen(s) {
+ _addProperty("width", gdk_screen_get_width(screen));
+ _addProperty("height", gdk_screen_get_height(screen));
+ }
+ void generateChildEvents() const {
+ gint n_monitors = gdk_screen_get_n_monitors(screen);
+ for ( gint i = 0 ; i < n_monitors ; i++ ) {
+ Logger::write<Monitor>(screen, i);
+ }
+ }
+
+private:
+ GdkScreen *screen;
+};
+
+class Display : public ConfigurationEvent {
+public:
+ Display() : ConfigurationEvent("display") {}
+ void generateChildEvents() const {
+ GdkDisplay *display=gdk_display_get_default();
+ gint n_screens = gdk_display_get_n_screens(display);
+ for ( gint i = 0 ; i < n_screens ; i++ ) {
+ GdkScreen *screen = gdk_display_get_screen(display, i);
+ Logger::write<Screen>(screen);
+ }
+ }
+};
+
+}
+
+void log_display_config() {
+ Logger::write<Display>();
+}
+
+}
+
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/debug/log-display-config.h b/src/debug/log-display-config.h
new file mode 100644
index 000000000..ae64b0836
--- /dev/null
+++ b/src/debug/log-display-config.h
@@ -0,0 +1,37 @@
+/*
+ * Inkscape::Debug::log_display_config - log display configuration
+ *
+ * Authors:
+ * MenTaLguY <mental@rydia.net>
+ *
+ * Copyright (C) 2007 MenTaLguY
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef SEEN_INKSCAPE_DEBUG_LOG_DISPLAY_CONFIG_H
+#define SEEN_INKSCAPE_DEBUG_LOG_DISPLAY_CONFIG_H
+
+#include "util/share.h"
+
+namespace Inkscape {
+
+namespace Debug {
+
+void log_display_config();
+
+}
+
+}
+
+#endif
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :