summaryrefslogtreecommitdiffstats
path: root/src/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/Makefile_insert15
-rw-r--r--src/debug/log-display-config.cpp41
2 files changed, 31 insertions, 25 deletions
diff --git a/src/debug/Makefile_insert b/src/debug/Makefile_insert
deleted file mode 100644
index 47cc2b704..000000000
--- a/src/debug/Makefile_insert
+++ /dev/null
@@ -1,15 +0,0 @@
-## Makefile.am fragment sourced by src/Makefile.am.
-
-ink_common_sources += \
- debug/demangle.cpp debug/demangle.h \
- debug/event.h \
- debug/event-tracker.h \
- 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/gdk-event-latency-tracker.cpp debug/gdk-event-latency-tracker.h \
- debug/timestamp.cpp debug/timestamp.h
-
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
}
};