Skip to content

Commit

Permalink
Fix Gdk.Screen deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBnm committed May 30, 2020
1 parent 6409d04 commit b26970c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ namespace Nasc {
if (x != -1 && y != -1) {
move (x, y);
} else {
x = (Gdk.Screen.width () - default_width) / 2;
y = (Gdk.Screen.height () - default_height) / 2;
var display = Gdk.Display.get_default ();
var monitor = display.get_primary_monitor ();
var geometry = monitor.get_geometry ();
var scale_factor = monitor.get_scale_factor ();
var width = scale_factor * geometry.width;
var height = scale_factor * geometry.height;
x = (width - default_width) / 2;
y = (height - default_height) / 2;
move (x, y);
}

Expand Down

0 comments on commit b26970c

Please sign in to comment.