… | |
… | |
96 | my ($self) = @_; |
96 | my ($self) = @_; |
97 | my $tab = $self->{cur}; |
97 | my $tab = $self->{cur}; |
98 | |
98 | |
99 | my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS"); |
99 | my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS"); |
100 | |
100 | |
101 | my %our_props = map +($_ => undef), $self->XListProperties ($self->parent); |
101 | my $current = delete $self->{current_properties}; |
102 | |
102 | |
103 | delete $our_props{$self->XInternAtom ($_)} |
103 | # pass 1: copy over properties different or nonexisting |
104 | for qw(WM_STATE WM_ICON_SIZE |
|
|
105 | _NET_WM_VISIBLE_NAME _NET_WM_VISIBLE_ICON_NAME _NET_WM_ICON_GEOMETRY _NET_FRAME_EXTENTS); |
|
|
106 | |
|
|
107 | for my $atom ($tab->XListProperties ($tab->parent)) { |
104 | for my $atom ($tab->XListProperties ($tab->parent)) { |
108 | my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); |
105 | my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); |
109 | |
106 | |
110 | delete $our_props{$atom}; |
107 | # fix up size hints |
111 | |
|
|
112 | if ($atom == $wm_normal_hints) { |
108 | if ($atom == $wm_normal_hints) { |
113 | my (@hints) = unpack "l!*", $items; |
109 | my (@hints) = unpack "l!*", $items; |
114 | |
110 | |
115 | $hints[$_] += $self->{tabheight} for (4, 6, 16); |
111 | $hints[$_] += $self->{tabheight} for (4, 6, 16); |
116 | |
112 | |
117 | $items = pack "l!*", @hints; |
113 | $items = pack "l!*", @hints; |
118 | } |
114 | } |
119 | |
115 | |
120 | my ($dtype, $dformat, $ditems) = $self->XGetWindowProperty ($self->parent, $atom); |
116 | my $cur = delete $current->{$atom}; |
121 | |
117 | |
122 | if ($dtype != $type or $dformat != $format or $ditems ne $items) { |
118 | # update if changed, we assume empty items and zero type and format will not happen |
123 | $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items); |
119 | $self->XChangeProperty ($self->parent, $atom, $type, $format, $items) |
124 | } |
120 | if $cur->[0] != $type or $cur->[1] != $format or $cur->[2] ne $items; |
125 | } |
|
|
126 | |
121 | |
|
|
122 | $self->{current_properties}{$atom} = [$type, $format, $items]; |
|
|
123 | } |
|
|
124 | |
|
|
125 | # pass 2, delete all extraneous properties |
127 | $self->XDeleteProperty ($self->parent, $_) for keys %our_props; |
126 | $self->XDeleteProperty ($self->parent, $_) for keys %$current; |
128 | } |
127 | } |
129 | |
128 | |
130 | sub make_current { |
129 | sub make_current { |
131 | my ($self, $tab) = @_; |
130 | my ($self, $tab) = @_; |
132 | |
131 | |