FIX for fvwm burning CPU on resize/move unresizable/unmovable windows

Hi Thomas, FVWM Workers,

here's a fix for the issue that fvwm and Xorg produce  

    ~ 100% CPU load on a Pentium 4 / ATi X550
    ~ 50% CPU load on a core i5-3550

while 
    *trying to resize UNRESIZABLE windows* 

while  
    *trying to move UNMOVABLE windows* 

using the Functions "Move-or-Raise" and "Resize-or-Lower".


This applies to windows such as 
  - Gnome Editor preferences window (no resizeable), 
  - and FvwmPager configured with:
    Style "FvwmPager" Sticky, NoHandles, BorderWidth 1, !Iconifiable, \
      !Maximizable, FixedSize, FixedPosition, !Closable, !WindowListSkip

Ho to reproduce: 
  While you are trying to resize/move such windows,
  watch CPU load using top.


FIX: (see attached file if lines below are garbled by mail client)


*** fvwm-2.6.5/fvwm/events.c_orig       2012-09-22 12:54:50.838388626 +0200
--- fvwm-2.6.5/fvwm/events.c    2012-09-22 12:55:00.818388316 +0200
***************
*** 4729,4736 ****
                                 * okay here */
                        }
                        mask &= DEFAULT_ALL_BUTTONS_MASK;
!                       usleep(1);
!               }
                if (use_wait_cursor == 0 && count == 20)
                {
                        GrabEm(CRS_WAIT, GRAB_NORMAL);
--- 4729,4738 ----
                                 * okay here */
                        }
                        mask &= DEFAULT_ALL_BUTTONS_MASK;
!                       usleep(10000); /* fixes 50% to 100% (P4) CPU load when 
trying */ 
!             /* to move/resize unmovable/unresizable windows. Tested on */
!             /* P4 3GHz/HT, ATi X550, and core i5-3550. Axel Rohde Sep. 22 
2012 */
!               }                  
                if (use_wait_cursor == 0 && count == 20)
                {
                        GrabEm(CRS_WAIT, GRAB_NORMAL);


Note: I haven't tested this with mouse devices found on notebooks.
      On my two desktop systems - one vintage, the other modern - 
      above patch works flawlessly.

Regards,
 Axel 

Attachment: events.c.diff.gz
Description: application/gzip

Reply via email to