From 0fb8cce6992f238b78272b603b69e070cfd46a00 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sat, 23 Aug 2014 10:41:42 +0100 Subject: [PATCH] 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 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 73d0297d..b971ac89 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()