Bug#964439: gtkmm: Muliple unnecessary redraws when mouse hovers over button
John Jowett
jowettj at xtra.co.nz
Tue Jul 7 11:13:49 BST 2020
Package: libgtkmm-3.0-dev
Version: 3.24.0-2
Severity: normal
File: gtkmm
Dear Maintainer,
Before writing a program involving what seemed a computationally intensive
on_redraw method for a Gtk::DrawingArea, I investigated the circumstances in
which it would or would not be called, using a simpler program. This seems to
have led to a can of worms. I wrote a simple window with a drawing area and two
buttons.
I found that I could move the mouse over my whole screen, including the drawing
area, without causing a redraw, EXCEPT when I moved it over a button, which
caused the drawing area to be redrawn unnecessarily many times (14 for a short
movement). Clicking a button (even though it was not connected to a signal)
caused 16 redraws of the drawing area.
I have cut down the test program to the bare essentials to demonstrate the
fault, and attach the source, together what a more comprehensive description of
the program and what happened when I ran it.
-- System Information:
Debian Release: 10.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.19.0-9-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_NZ.utf8, LC_CTYPE=en_NZ.utf8 (charmap=UTF-8), LANGUAGE=en_NZ:en
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libgtkmm-3.0-dev:amd64 depends on:
ii libatkmm-1.6-dev 2.28.0-2
ii libcairomm-1.0-dev 1.12.2-4
ii libgdk-pixbuf2.0-dev 2.38.1+dfsg-1
ii libglibmm-2.4-dev 2.58.0-2
ii libgtk-3-dev 3.24.5-1
ii libgtkmm-3.0-1v5 3.24.0-2
ii libpangomm-1.4-dev 2.42.0-2
libgtkmm-3.0-dev:amd64 recommends no packages.
Versions of packages libgtkmm-3.0-dev:amd64 suggests:
ii libgtkmm-3.0-doc 3.24.0-2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source.zip
Type: application/zip
Size: 2301 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-gnome-maintainers/attachments/20200707/98682aef/attachment-0001.zip>
-------------- next part --------------
Summary of fault investigation.
A simple program was written in gtkmm to show a window with a drawing area on the right and two buttons on the left, called "Dummy" and "Quit". Quit closed the window, ending the program. Dummy did nothing. The drawing area was derived from Gtk::DrawingArea, with an additional member variable added to record a count of the number of times the on_draw function had so far been called. The on_draw function incremented the count, printed the count on std::cout and coloured the drawing area green.
The program was then run with the following results:
1. The program was started, displaying the window. This resulted in two redraws.
2. The mouse was moved all over the screen, inside and outside the window,
EXCEPT over the two buttons. This resulted in no redraws.
3. The mouse was moved from outside the window on the left, to a point over the centre of the Dummy button. This resulted in 14 redraws of the drawing area.
4. The Dummy button was clicked without moving the mouse. 16 redraws.
5. The mouse was moved off the dummy button to the left of the window. 14 redraws.
6. 2 above was repeated: again no redraws.
7. The mouse was moved from the left to the centre of the Quit button. 14 redraws.
8. The Quit button was clicked. 4 redraws.
Overall, 64 redraws, of which 2 at most seem justifiable.
More information about the pkg-gnome-maintainers
mailing list