[gnome-boxes] display-page: Only show size or actual resize



commit 3216e24b965ffd6cd79b4afad63c6e3c63d0d170
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Mar 5 13:32:05 2015 +0000

    display-page: Only show size or actual resize
    
    Just because new size has been allocated to widget, doesn't necessarily
    mean that the new size is different from the previous one.
    
    This fixes the issue of us showing size overlay on mouse
    entering/leaving the display widget.

 src/display-page.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/display-page.vala b/src/display-page.vala
index 37f8270..4b2a2ef 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -47,6 +47,9 @@ private class Boxes.DisplayPage: Gtk.Box {
     private ulong mouse_grabbed_id;
     private ulong keyboard_grabbed_id;
 
+    private int width = -1;
+    private int height = -1;
+
     public void setup_ui (AppWindow window) {
         this.window = window;
 
@@ -242,6 +245,12 @@ private class Boxes.DisplayPage: Gtk.Box {
 
     [GtkCallback]
     private void on_size_allocate (Gtk.Allocation allocation) {
+        if (width == allocation.width && height == allocation.height)
+            return;
+
+        width = allocation.width;
+        height = allocation.height;
+
         // Translators: Showing size of widget as WIDTHxHEIGHT here.
         size_label.label = _("%dx%d").printf (allocation.width, allocation.height);
         size_label.visible = true;


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