statusbar->cursor_label, when updated causes full canvas redraw
Environment/Versions
- GIMP version: 2.99.9
- Package: local build
- Operating System: macOS (although the problem is generic, it seems to impact macOS Retina displays especially because of the impact on drawing speed)
Description of the bug
Every time the cursor location in the status bar is updated, this causes the full canvas to be redrawn (may be mac exclusive). This causes very slow drawing on macbooks due to HiDPI (retina) displays.
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Open an blank image on a retina display on a mac (this would be all recent macs
- Disable rulers: View->Show rulers
- Run Quartz Debug (available from Apple) and enable 'Flash screen updates'
- Draw on the canvas
…
Expected result: Yellow boxes should only flash encompassing cursor and status box (as well as some just on cursor)
Actual result: Yellow boxes regularly flash over whole canvas (as well as some just on cursor)
Additional information
This appears to be due to the fact that gtk label recalculates it's size every time text is put in it.
gtk_label_set_text
calls gtk_label_recalculate
which calls gtk_widget_queue_resize
which results in the full canvas being damaged, even though no change in size has occurred.
Here is a discussion of this: https://www.titanwolf.org/Network/q/14b94607-cabd-42e0-8b61-e02735f26453/y
The solution described there is:
- "You should put
GtkTextView
intoGtkScrolledWindow
with "hscrollbar-policy
" and "vscrollbar-policy
" properties set to "automatic
"."
But:
- "Even inside
GtkScrolledWindow
withGTK_POLICY_NONE
GtkTextView
resizes itself while adding text. That's pretty nasty - impossible to haveGtkTextView
without scrollbars."
Related to #7690 (closed).