Skip to content

Commit

Permalink
Attempt to fix wring sizing
Browse files Browse the repository at this point in the history
Issue: #44
  • Loading branch information
mina86 committed Feb 10, 2022
1 parent 5103117 commit 1b41aaf
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions tabbedex
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ sub configure {
my ($root) = @_;

my $tab = $root->{cur};
my $padding = 2 * $tab->int_bwidth;

# this is an extremely dirty way to force a configurenotify, but who cares
$tab->XMoveResizeWindow (
Expand Down Expand Up @@ -921,10 +922,26 @@ sub copy_properties {

# fix up size hints
if ($atom == $wm_normal_hints) {
# typedef struct {
# long flags; /* 0 */
# int x, y; /* 1, 2 */ /* Obsolete */
# int width, height; /* 3, 4 */ /* Obsolete */
# int min_width, min_height; /* 5, 6 */
# int max_width, max_height; /* 7, 8 */
# int width_inc, height_inc; /* 9, 10 */
# struct {
# int x; /* numerator */
# int y; /* denominator */
# } min_aspect, max_aspect; /* 11, 12, 13, 14 */
# int base_width, base_height; /* 15, 16 */
# int win_gravity; /* 17 */
# } XSizeHints;
#
# (Don’t ask me how this works with long and int types. Somehow it
# does – mina86).
my (@hints) = unpack "l!*", $items;

$hints[$_] += $root->{tabheight} for (4, 6, 16);

$hints[$_] += 2 * $tab->int_bwidth for (3, 5, 15);
$hints[$_] += 2 * $tab->int_bwidth + $root->{tabheight} for (4, 6, 16);
$items = pack "l!*", @hints;
}

Expand Down Expand Up @@ -1119,6 +1136,7 @@ sub parse_timeouts {
sub init {
my ($root) = @_;

$root->{padding} = 2 * $root->int_bwidth;
$root->{resource} = [map $root->resource ("+$_"),
0 .. urxvt::NUM_RESOURCES - 1];

Expand Down Expand Up @@ -1169,6 +1187,13 @@ _on start => sub {
$root->int_bwidth + $root->fheight + $root->lineSpace;
$root->{tabheight} = $root->{autohide} ? 0 : $root->{maxtabheight};

my $padding = delete $root->{padding};
if ($padding || $root->{tabheight}) {
my $w = $root->width + $padding;
my $h = $root->height + $padding + $root->{tabheight};
$root->XMoveResizeWindow($root->parent, 0, 0, $w, $h);
}

$root->cmd_parse(delete $root->{init_cmd});

my @argv = $root->argv;
Expand Down

0 comments on commit 1b41aaf

Please sign in to comment.