[gimp-gap/gap-2-8] fixed move path dialog resize problem



commit ab3b6acd2f58e52d1c4a5310f0b8950c1d8a9f98
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date:   Sat Sep 19 18:00:08 2015 +0200

    fixed move path dialog resize problem

 ChangeLog            |   10 ++++++++++
 gap/gap_mov_dialog.c |   41 +++++++++++++++++++++++++++++++++++++----
 2 files changed, 47 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 910722f..0619c4d 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-09-19 Wolfgang Hofer <hof gimp org>
+
+- Fix for resize problems of the MovePath Dialog window
+  by fast rendering of a black preview while the user is resizing the window,
+  and do the final rendering just once (200 ms after a series of multiple resize events in sequence)
+  (Multiple time consuming render operations often caused freeze of the dialog window 
+   in Windows7 environment)
+
+* gap/gap_mov_dialog.c
+
 2015-08-29 Wolfgang Hofer <hof gimp org>
 
 - use generic checks for required automake aclocal version
diff --git a/gap/gap_mov_dialog.c b/gap/gap_mov_dialog.c
index b988995..e43844f 100644
--- a/gap/gap_mov_dialog.c
+++ b/gap/gap_mov_dialog.c
@@ -146,14 +146,14 @@ extern      int gap_debug; /* ==0  ... dont print debug infos */
 #define ENTRY_GROUP_PATH_WIDTH 200
 
 
-/* instant apply is implemented via timer, configured to fire 10 times per second (100 msec)
+/* instant apply is implemented via timer, configured to fire 5 times per second (200 msec)
  * this collects instant_apply_requests set by other widget callbacks and events
  * and then update only once.
  * The timer is completely removed, when instant_apply is OFF
  * instant_apply requires much CPU and IO power especially on big images
  * and images with many layers
  */
-#define INSTANT_TIMERINTERVAL_MILLISEC  100
+#define INSTANT_TIMERINTERVAL_MILLISEC  200
 
 
 #ifdef MOVE_PATH_LAYOUT_BIG_PREVIEW
@@ -7243,11 +7243,27 @@ mov_pview_size_allocate_callback(GtkWidget *widget
                       );
   }
 
+  mov_remove_timer(mgp);  /* remove instant apply timer (when already running) 
+                           * to prevent rendering for the next interval of millisecs 
+                           * (because typical many resize events will occure as long as the user
+                           * drags the mouse to adjust windowsize.
+                           * while resize is still going on, full time consuming rendering shall be suspended
+                           * and a black preview is displayed
+                           * until no further resize events in fast sequence are detected.
+                           * (Then rendering shall be done )
+                           */
+  mov_install_timer(mgp); /* restart instant apply timer to trigger rendering just once for the final wanted 
size.
+                           * note that the instant apply timer may fire only once in case instant apply flag 
is OFF. 
+                           */
+
   if(((pheight / 6) == (mgp->pheight / 6))
   && ((pwidth / 6)  == (mgp->pwidth / 6)))
   {
     /* skip resize if equal size or no significant change (< 6 pixel) */
-    if(gap_debug) printf("RET\n");
+    if(gap_debug)
+    { 
+      printf("RET (ignore minimal resize)\n");
+    }
     return;
   }
 
@@ -7259,17 +7275,34 @@ mov_pview_size_allocate_callback(GtkWidget *widget
                   , mgp->pheight
                   , actual_check_size
                   );
-  mov_upvw_callback (NULL, mgp);
+  /* mov_upvw_callback (NULL, mgp); */
 
   if(fit_initial)
   {
     mov_fit_initial_shell_window(mgp);
   }
+  
+  /* render a black preview at new desired size */
+  gap_pview_render_from_buf (mgp->pv_ptr
+                 , NULL           /* *src_data NULL clears the preview to black */
+                 , mgp->pwidth    /* src_width */
+                 , mgp->pheight   /* src_height */
+                 , 3              /* src_bpp */
+                 , FALSE          /* do NOT allow_grab_src_data */
+                 );
+
+  /* set render request that triggers call to 
+   *     mov_upvw_callback (NULL, mgp); 
+   * after timer delay is done (and no further resize event occured so far.)
+   */
+  mov_set_instant_apply_request(mgp);
+
 
 }  /* end mov_pview_size_allocate_callback */
 
 
 
+
 /* -----------------------------------
  * gap_mov_dlg_move_dialog_singleframe
  * -----------------------------------


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