mirror of
https://github.com/gryf/tabbedalt.git
synced 2026-09-02 11:57:45 +02:00
Compare commits
1
Commits
master
..
f57e535e64
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f57e535e64 |
+1
-1
@@ -266,7 +266,7 @@ additional resources that can be set. First one, disabled by default is::
|
|||||||
|
|
||||||
URxvt.tabbedalt.confirm-quit: false
|
URxvt.tabbedalt.confirm-quit: false
|
||||||
|
|
||||||
When set to ``true`` it will either execute a message program or will display
|
When set to ``true`` it will either execute a message program or will display
|
||||||
an urxvt overlay with the dialog directly on current tab. Note that overlay
|
an urxvt overlay with the dialog directly on current tab. Note that overlay
|
||||||
dialog will expect the user to either press:
|
dialog will expect the user to either press:
|
||||||
|
|
||||||
|
|||||||
@@ -170,25 +170,8 @@
|
|||||||
# 2026-04-21 18:34:16
|
# 2026-04-21 18:34:16
|
||||||
# - Make some more optimization on memory usage - remove data from destroyed
|
# - Make some more optimization on memory usage - remove data from destroyed
|
||||||
# tab and disable its hooks
|
# tab and disable its hooks
|
||||||
# - update tab property notifications, don't update it too often, clean up X
|
# - update tab property notifications, don't update it too often, clean up X
|
||||||
# properties variables after use, update only changed X properties
|
# properties variables after use, update only changed X properties
|
||||||
#
|
|
||||||
# 2026-08-10 17:20:53
|
|
||||||
# - remove variables in copy_properties to free memory
|
|
||||||
# - 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;
|
use Scalar::Util;
|
||||||
|
|
||||||
@@ -302,7 +285,10 @@ sub refresh {
|
|||||||
$self->{tabheight} = $self->{_tabheight};
|
$self->{tabheight} = $self->{_tabheight};
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->configure;
|
if ($old_tabheight != $self->{tabheight}) {
|
||||||
|
$self->configure;
|
||||||
|
$self->copy_properties;
|
||||||
|
}
|
||||||
|
|
||||||
my $ncol = $self->ncol;
|
my $ncol = $self->ncol;
|
||||||
|
|
||||||
@@ -428,8 +414,8 @@ sub copy_properties {
|
|||||||
my $current = delete $self->{current_properties};
|
my $current = delete $self->{current_properties};
|
||||||
|
|
||||||
# pass 1: copy over properties different or nonexisting
|
# pass 1: copy over properties different or nonexisting
|
||||||
for my $atom ($tab->XListProperties($tab->parent)) {
|
for my $atom ($tab->XListProperties ($tab->parent)) {
|
||||||
my ($type, $format, $items) = $self->XGetWindowProperty($tab->parent, $atom);
|
my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom);
|
||||||
|
|
||||||
# fix up size hints
|
# fix up size hints
|
||||||
if ($atom == $wm_normal_hints) {
|
if ($atom == $wm_normal_hints) {
|
||||||
@@ -441,29 +427,22 @@ sub copy_properties {
|
|||||||
$hints[$_] += $self->{tabheight} for (4, 6, 16);
|
$hints[$_] += $self->{tabheight} for (4, 6, 16);
|
||||||
|
|
||||||
$items = pack "l!*", @hints;
|
$items = pack "l!*", @hints;
|
||||||
undef @hints;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $cur = delete $current->{$atom};
|
my $cur = delete $current->{$atom};
|
||||||
|
|
||||||
# update if changed, we assume empty items and zero type and format will not happen
|
# update if changed, we assume empty items and zero type and format will not happen
|
||||||
$self->XChangeProperty($self->parent, $atom, $type, $format, $items)
|
$self->XChangeProperty ($self->parent, $atom, $type, $format, $items)
|
||||||
if $cur->[0] != $type or $cur->[1] != $format or $cur->[2] ne $items;
|
if $cur->[0] != $type or $cur->[1] != $format or $cur->[2] ne $items;
|
||||||
|
|
||||||
$self->{current_properties}{$atom} = [$type, $format, $items];
|
$self->{current_properties}{$atom} = [$type, $format, $items];
|
||||||
|
|
||||||
undef $type;
|
undef $type;
|
||||||
undef $format;
|
undef $format;
|
||||||
undef $items;
|
undef $items;
|
||||||
undef $atom;
|
|
||||||
undef $cur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# pass 2, delete all extraneous properties
|
# pass 2, delete all extraneous properties
|
||||||
$self->XDeleteProperty ($self->parent, $_) for keys %$current;
|
$self->XDeleteProperty ($self->parent, $_) for keys %$current;
|
||||||
|
|
||||||
undef $current;
|
|
||||||
undef $wm_normal_hints;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub make_current {
|
sub make_current {
|
||||||
@@ -487,6 +466,7 @@ sub make_current {
|
|||||||
$self->{cur} = $tab;
|
$self->{cur} = $tab;
|
||||||
$tab->enable_activity_hook(0);
|
$tab->enable_activity_hook(0);
|
||||||
|
|
||||||
|
$self->configure;
|
||||||
$self->copy_properties;
|
$self->copy_properties;
|
||||||
|
|
||||||
$tab->focus_out; # just in case, should be a nop
|
$tab->focus_out; # just in case, should be a nop
|
||||||
@@ -685,6 +665,7 @@ _on start => sub {
|
|||||||
_on configure_notify => sub {
|
_on configure_notify => sub {
|
||||||
my ($self, $event) = @_;
|
my ($self, $event) = @_;
|
||||||
|
|
||||||
|
$self->configure;
|
||||||
$self->refresh;
|
$self->refresh;
|
||||||
|
|
||||||
()
|
()
|
||||||
@@ -826,11 +807,16 @@ sub tab_property_notify {
|
|||||||
return () unless $event->{window} == $tab->parent;
|
return () unless $event->{window} == $tab->parent;
|
||||||
return () unless $tab == $self->{cur};
|
return () unless $tab == $self->{cur};
|
||||||
|
|
||||||
# update only the changed selected property instead of all properties
|
# skip if called too often (within 0.1s)
|
||||||
my $atom = $event->{atom};
|
my $now = urxvt::NOW;
|
||||||
my %allowed = map { $_ => 1 } qw(WM_NORMAL_HINTS _NET_WM_NAME WM_NAME);
|
my $last = $self->{last_property_update} // 0;
|
||||||
return () unless ($allowed{$self->XGetAtomName($atom)});
|
if ($now - $last < 0.1) {
|
||||||
|
return ();
|
||||||
|
}
|
||||||
|
$self->{last_property_update} = $now;
|
||||||
|
|
||||||
|
# update only the changed property instead of all properties
|
||||||
|
my $atom = $event->{atom};
|
||||||
my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom);
|
my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom);
|
||||||
|
|
||||||
my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS");
|
my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS");
|
||||||
@@ -846,7 +832,6 @@ sub tab_property_notify {
|
|||||||
$self->{current_properties}{$atom} = [$type, $format, $items];
|
$self->{current_properties}{$atom} = [$type, $format, $items];
|
||||||
|
|
||||||
# free memory from X properties
|
# free memory from X properties
|
||||||
undef $wm_normal_hints;
|
|
||||||
undef $type;
|
undef $type;
|
||||||
undef $format;
|
undef $format;
|
||||||
undef $items;
|
undef $items;
|
||||||
|
|||||||
Reference in New Issue
Block a user