[gparted] Reduce flashing redraw from automatic partition selection (#696149)



commit 0fb8cce6992f238b78272b603b69e070cfd46a00
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Aug 23 10:41:42 2014 +0100

    Reduce flashing redraw from automatic partition selection (#696149)
    
    Automatic selection of the largest unallocated partition caused flashing
    redraw of the partition graphic and partition list.  Both the partition
    graphic and partition list were being drawn blank then redrawn fully
    populated.  This only happened on some distributions including:
    CentOS 5.10, 6.5, 7.0, Debian 6, Fedora 14, 20, Xubuntu 14.04 LTS.  Did
    not happen on: Kubuntu 12.04 LTS.
    
    This is a workaround, not a complete fix.  It moves automatic selection
    of the largest unallocated partition to after processing of the GTK
    Event loop in Refresh_Visual() which redraws the partition graphic and
    partition list.  These visuals are now drawn only once, fully populated,
    however this draws them without the selected partition.  The partition
    selection is then drawn afterwards which causes the selection to flash
    instead.  This is significant improvement to the whole partition graphic
    and partition list flashing when redrawn.
    
    Bug #696149 - Double refresh of display introduced with default
                  unallocated space

 src/Win_GParted.cc |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 73d0297..b971ac8 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -893,15 +893,21 @@ void Win_GParted::Refresh_Visual()
 
        set_valid_operations() ;
 
+       // Process Gtk events to redraw visuals with reloaded partition details
+       while ( Gtk::Main::events_pending() )
+               Gtk::Main::iteration();
+
        if ( largest_unalloc_size >= 0 )
        {
-               //Inform visuals of selection of the largest unallocated partition
+               // Flashing redraw work around.  Inform visuals of selection of the
+               // largest unallocated partition after drawing those visuals above.
                drawingarea_visualdisk .set_selected( selected_partition ) ;
                treeview_detail .set_selected( selected_partition ) ;
-       }
 
-       while ( Gtk::Main::events_pending() ) 
-               Gtk::Main::iteration() ;
+               // Process Gtk events to draw selection
+               while ( Gtk::Main::events_pending() )
+                       Gtk::Main::iteration();
+       }
 }
 
 bool Win_GParted::Quit_Check_Operations()


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