From: mental Date: Thu, 10 May 2007 01:18:46 +0000 (+0000) Subject: add logging of basic display properties X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=aa6c6b7b32ff7c408ff0d7062e086e7c549b1ab8;p=inkscape.git add logging of basic display properties --- 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 + * + * Copyright (C) 2007 MenTaLguY + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include +#include +#include +#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 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(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); + } + } +}; + +} + +void log_display_config() { + Logger::write(); +} + +} + +} + +/* + 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 + * + * 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 : diff --git a/src/main.cpp b/src/main.cpp index 3849be4fa..87913a801 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,6 +77,7 @@ #include "io/sys.h" #include "debug/logger.h" +#include "debug/log-display-config.h" #include "helper/png-write.h" @@ -630,6 +631,8 @@ sp_main_gui(int argc, char const **argv) inkscape_gtk_stock_init(); + Inkscape::Debug::log_display_config(); + /* Set default icon */ gchar *filename = (gchar *) g_build_filename (INKSCAPE_APPICONDIR, "inkscape.png", NULL); if (Inkscape::IO::file_test(filename, (GFileTest)(G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))) {