[gnome-games/wip/exalm/rsvg] gamepad-view: Stop accessing Rsvg.Handle fields



commit 3c33d1aa3b2e177ed055e6865b3fc6229cf911d6
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Feb 25 19:20:32 2019 +0500

    gamepad-view: Stop accessing Rsvg.Handle fields
    
    Use Rsvg.Handle.get_geometry_sub() instead, preventing a compile-time
    warning.
    
    Fixes #155

 src/ui/gamepad-view.vala | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/ui/gamepad-view.vala b/src/ui/gamepad-view.vala
index f917f785..86494130 100644
--- a/src/ui/gamepad-view.vala
+++ b/src/ui/gamepad-view.vala
@@ -26,7 +26,11 @@ private class Games.GamepadView : Gtk.DrawingArea {
                                critical ("Could not set up gamepad view: %s", e.message);
                        }
 
-                       set_size_request (handle.width, handle.height);
+                       Rsvg.Rectangle rect = {};
+                       if (!handle.get_geometry_sub (null, out rect, null))
+                               assert_not_reached ();
+
+                       set_size_request ((int) rect.width, (int) rect.height);
                        input_highlights = new bool[value.input_paths.length];
 
                        reset ();
@@ -101,9 +105,13 @@ private class Games.GamepadView : Gtk.DrawingArea {
                double w = get_allocated_width ();
                double h = get_allocated_height ();
 
-               scale = double.min (h / handle.height, w / handle.width);
+               Rsvg.Rectangle rect = {};
+               if (!handle.get_geometry_sub (null, out rect, null))
+                       assert_not_reached ();
+
+               scale = double.min (h / rect.height, w / rect.width);
 
-               x = (w - handle.width * scale) / 2;
-               y = (h - handle.height * scale) / 2;
+               x = (w - rect.width * scale) / 2;
+               y = (h - rect.height * scale) / 2;
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]