! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Panel gets redrawn constantly and consuming CPU with GTK3
Status:
RESOLVED: FIXED
Product:
Xfce4-panel

Comments

Description Viktor Semykin 2018-03-28 21:09:21 CEST
Created attachment 7651 
Patch that solves the problem.

In GTK version 3 default state for CSS context style is GTK_STATE_FLAG_DIR_LTR [1].
This causes every call to gtk_style_context_get_color with GTK_STATE_NORMAL change its state internally and queue redraw.
This call in panel_window_draw [2] makes it queue redraw on each redraw. This makes panel window get redrawn on every frame.
This consumes about 40% of my CPU.

The solution is to call gtk_style_context_get_color with actual node style. Patch is attached.

[1] https://github.com/GNOME/gtk/blob/e6d104bfa06c82630215d8ecba6d644976d99ac5/gtk/gtkstylecontext.c#L469
[2] https://git.xfce.org/xfce/xfce4-panel/tree/panel/panel-window.c?id=72be2b1ef798bcb5673ed45c5368955fb94974d4#n847
Comment 1 Git Bot editbugs 2018-03-29 00:00:31 CEST
Viktor Semykin referenced this bugreport in commit c5e59cb2e28568629d62d5485ce97e9711b3ad84

Get the actual widget state flags to avoid constant redraws (Bug #14307)

https://git.xfce.org/xfce/xfce4-panel/commit?id=c5e59cb2e28568629d62d5485ce97e9711b3ad84
Comment 2 Simon Steinbeiss editbugs 2018-03-29 00:01:06 CEST
Thanks for the patch, that makes a lot of sense!

Bug #14307

Reported by:
Viktor Semykin
Reported on: 2018-03-28
Last modified on: 2018-03-29

People

Assignee:
Nick Schermer
CC List:
1 user

Version

Version:
Unspecified

Attachments

Patch that solves the problem. (829 bytes, patch)
2018-03-28 21:09 CEST , Viktor Semykin
no flags

Additional information