diff options
Diffstat (limited to 'src/ui/dialog/dialog.cpp')
| -rw-r--r-- | src/ui/dialog/dialog.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index e50824c7b..3d949a8c9 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -20,7 +20,7 @@ #include "dialog-manager.h" #include <gtkmm/dialog.h> -#if WITH_GTKMM_3_22 +#if GTKMM_CHECK_VERSION(3,22,0) # include <gdkmm/monitor.h> #endif @@ -166,11 +166,16 @@ void Dialog::read_geometry() resize(w, h); } -#if WITH_GTKMM_3_22 +#if GTKMM_CHECK_VERSION(3,22,0) auto const display = Gdk::Display::get_default(); - auto const monitor = display->get_primary_monitor(); + auto monitor = display->get_primary_monitor(); + + // If user hasn't configured a primary monitor, nullptr is returned so try first monitor. + if (!monitor) { + std::cerr << "Dialog::read_geometry: no primary monitor configured!" << std::endl; + monitor = display->get_monitor(0); + } - // If user hasn't configured a primary monitor, nullptr is returned. Gdk::Rectangle screen_geometry; if (monitor) { monitor->get_geometry(screen_geometry); @@ -179,7 +184,7 @@ void Dialog::read_geometry() auto const screen_height = screen_geometry.get_height(); #else auto const screen_width = gdk_screen_width(); - auto const screen_height = gdk_screen_width(); + auto const screen_height = gdk_screen_height(); #endif // If there are stored values for where the dialog should be |
