Compare commits

...
2 Commits
Author SHA1 Message Date
gryf 6ea8e56fae Update only selected properties, not all.
That should slightly decrease memory consumption.
2026-08-12 20:47:09 +02:00
gryf 5cbd393022 Removed unnecesary calls for configure and copy_properties 2026-08-12 20:40:35 +02:00
+16 -7
View File
@@ -178,6 +178,17 @@
# - call configure() every time on refresh
# - removed throttling to suppress tab property notifications, as they need to
# be applied as every call there is different atom to process.
#
# 2026-08-11 18:42:45
# - removed call copy_properties() call from refresh() to avoid unnecessary
# Xlib interaction (to spare memory as the consequence) and rely only on
# notifications.
# - removed call for configure() from places, which will call refresh() as in
# refresh() configure will be called anyway.
#
# 2026-08-12 20:40:54
# - narrow down X properties which will be updated during tab_property_notify,
# which should slightly improve memory consumption.
use Scalar::Util;
@@ -293,10 +304,6 @@ sub refresh {
$self->configure;
if ($old_tabheight != $self->{tabheight}) {
$self->copy_properties;
}
my $ncol = $self->ncol;
my $text = " " x $ncol;
@@ -480,7 +487,6 @@ sub make_current {
$self->{cur} = $tab;
$tab->enable_activity_hook(0);
$self->configure;
$self->copy_properties;
$tab->focus_out; # just in case, should be a nop
@@ -679,7 +685,6 @@ _on start => sub {
_on configure_notify => sub {
my ($self, $event) = @_;
$self->configure;
$self->refresh;
()
@@ -821,8 +826,11 @@ sub tab_property_notify {
return () unless $event->{window} == $tab->parent;
return () unless $tab == $self->{cur};
# update only the changed property instead of all properties
# update only the changed selected property instead of all properties
my $atom = $event->{atom};
my %allowed = map { $_ => 1 } qw(WM_NORMAL_HINTS _NET_WM_NAME WM_NAME);
return () unless ($allowed{$self->XGetAtomName($atom)});
my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom);
my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS");
@@ -838,6 +846,7 @@ sub tab_property_notify {
$self->{current_properties}{$atom} = [$type, $format, $items];
# free memory from X properties
undef $wm_normal_hints;
undef $type;
undef $format;
undef $items;