diff options
| author | Michael Soegtrop <MSoegtrop@yahoo.de> | 2017-06-05 13:01:17 +0000 |
|---|---|---|
| committer | Michael Soegtrop <MSoegtrop@yahoo.de> | 2017-06-05 13:01:17 +0000 |
| commit | e7248b2fa042f42a5c4dd14cd86ab6a5b4524059 (patch) | |
| tree | 9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/debug/log-display-config.cpp | |
| parent | updated to latest trunk (diff) | |
| parent | [Bug #1695016] Xaml export misses some radialGradients. (diff) | |
| download | inkscape-e7248b2fa042f42a5c4dd14cd86ab6a5b4524059.tar.gz inkscape-e7248b2fa042f42a5c4dd14cd86ab6a5b4524059.zip | |
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/debug/log-display-config.cpp')
| -rw-r--r-- | src/debug/log-display-config.cpp | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/debug/log-display-config.cpp b/src/debug/log-display-config.cpp index ecc05b7b7..1f436a708 100644 --- a/src/debug/log-display-config.cpp +++ b/src/debug/log-display-config.cpp @@ -27,9 +27,20 @@ typedef SimpleEvent<Event::CONFIGURATION> ConfigurationEvent; class Monitor : public ConfigurationEvent { public: - Monitor(GdkScreen *screen, gint monitor) : ConfigurationEvent("monitor") { +#if GTK_CHECK_VERSION(3,22,0) + Monitor(GdkMonitor *monitor) +#else + Monitor(GdkScreen *screen, gint monitor) +#endif + : ConfigurationEvent("monitor") { GdkRectangle area; + +#if GTK_CHECK_VERSION(3,22,0) + gdk_monitor_get_geometry(monitor, &area); +#else gdk_screen_get_monitor_geometry(screen, monitor, &area); +#endif + _addProperty("x", area.x); _addProperty("y", area.y); _addProperty("width", area.width); @@ -37,10 +48,13 @@ public: } }; +#if !GTK_CHECK_VERSION(3,22,0) +// We don't need this in newer Gtk+ versions as GdkMonitor information is now +// returned directly from GdkDisplay rather than needing GdkScreen first class Screen : public ConfigurationEvent { public: Screen(GdkScreen *s) : ConfigurationEvent("screen"), screen(s) { - _addProperty("width", gdk_screen_get_width(screen)); + _addProperty("width", gdk_screen_get_width(screen)); _addProperty("height", gdk_screen_get_height(screen)); } void generateChildEvents() const { @@ -53,21 +67,28 @@ public: private: GdkScreen *screen; }; +#endif class Display : public ConfigurationEvent { public: Display() : ConfigurationEvent("display") {} void generateChildEvents() const { GdkDisplay *display=gdk_display_get_default(); -#if GTK_CHECK_VERSION(3,10,0) - GdkScreen *screen = gdk_display_get_screen(display, 0); - Logger::write<Screen>(screen); -#else - 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); + +#if GTK_CHECK_VERSION(3,22,0) + gint const n_monitors = gdk_display_get_n_monitors(display); + + // Loop through all monitors and log their details + for (gint i_monitor = 0; i_monitor < n_monitors; ++i_monitor) { + GdkMonitor *monitor = gdk_display_get_monitor(display, i_monitor); + Logger::write<Monitor>(monitor); } +#else + // We used to find the number of screens, and log info for + // each of them. However, the number of screens is always + // one in Gtk+ 3 + GdkScreen *screen = gdk_display_get_default_screen(display); + Logger::write<Screen>(screen); #endif } }; |
