--- deliantra/Deliantra-Client/DC/UI.pm 2006/05/30 02:22:02 1.257 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/06/01 03:42:58 1.266 @@ -28,6 +28,8 @@ $win->{y} = ($_->{y} + $_->{h} * 0.5) / $::HEIGHT if $_->{y} =~ /^[0-9.]+$/; $win->{w} = $_->{w} / $::WIDTH if defined $_->{w}; $win->{h} = $_->{h} / $::HEIGHT if defined $_->{h}; + + $win->{show} = $_->{visible} && $_->{is_toplevel}; } $layout @@ -35,14 +37,16 @@ sub set_layout { my ($layout) = @_; + $LAYOUT = $layout; } sub check_tooltip { + return if $ENV{CFPLUS_DEBUG} & 8; + if (!$GRAB) { for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { if (length $widget->{tooltip}) { - if ($TOOLTIP->{owner} != $widget) { $TOOLTIP->hide; @@ -209,16 +213,6 @@ @_ }, $class; - if (my $layout = $CFClient::UI::LAYOUT->{$self->{name}}) { - $self->{x} = $layout->{x} * $CFClient::UI::ROOT->{w} if exists $layout->{x}; - $self->{y} = $layout->{y} * $CFClient::UI::ROOT->{h} if exists $layout->{y}; - $self->{force_w} = $layout->{w} * $CFClient::UI::ROOT->{w} if exists $layout->{w}; - $self->{force_h} = $layout->{h} * $CFClient::UI::ROOT->{h} if exists $layout->{h}; - - $self->{x} -= $self->{force_w} * 0.5 if exists $layout->{x}; - $self->{y} -= $self->{force_h} * 0.5 if exists $layout->{y}; - } - Scalar::Util::weaken ($CFClient::UI::WIDGET{$self+0} = $self); for (keys %$self) { @@ -227,6 +221,18 @@ } } + if (my $layout = $CFClient::UI::LAYOUT->{$self->{name}}) { + $self->{x} = $layout->{x} * $CFClient::UI::ROOT->{alloc_w} if exists $layout->{x}; + $self->{y} = $layout->{y} * $CFClient::UI::ROOT->{alloc_h} if exists $layout->{y}; + $self->{force_w} = $layout->{w} * $CFClient::UI::ROOT->{alloc_w} if exists $layout->{w}; + $self->{force_h} = $layout->{h} * $CFClient::UI::ROOT->{alloc_h} if exists $layout->{h}; + + $self->{x} -= $self->{force_w} * 0.5 if exists $layout->{x}; + $self->{y} -= $self->{force_h} * 0.5 if exists $layout->{y}; + + $self->show if $layout->{show}; + } + $self } @@ -352,10 +358,13 @@ $self->update; } - if ($self->{w} != $w || $self->{h} != $h) { + if ($self->{alloc_w} != $w || $self->{alloc_h} != $h) { return unless $self->{visible}; - $self->{root}->{size_alloc}{$self+0} = [$self, $w, $h]; + $self->{alloc_w} = $w; + $self->{alloc_h} = $h; + + $self->{root}{size_alloc}{$self+0} = $self; } } @@ -465,7 +474,6 @@ my ($self, $parent) = @_; Scalar::Util::weaken ($self->{parent} = $parent); - $self->set_visible if $parent->{visible}; } @@ -496,12 +504,13 @@ my ($self) = @_; if ($self->{visible}) { - return if $self->{root}{realloc}{$self}; + return if $self->{root}{realloc}{$self+0}; - $self->{root}{realloc}{$self} = $self; + $self->{root}{realloc}{$self+0} = $self; $self->{root}->update; } else { delete $self->{req_w}; + delete $self->{req_h}; } } @@ -544,7 +553,7 @@ glDisable GL_BLEND; } - if ($ENV{CFPLUS_DEBUG}) { + if ($ENV{CFPLUS_DEBUG} & 1) { glPushMatrix; glColor 1, 1, 0, 1; glTranslate $self->{x} + 0.375, $self->{y} + 0.375; @@ -763,7 +772,7 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; $self->{children}[0]->configure (0, 0, $w, $h); } @@ -790,11 +799,10 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; - $self->SUPER::size_allocate ($w, $h, $changed); - $self->update - if $changed; + $self->SUPER::size_allocate ($w, $h); + $self->update; } sub _render { @@ -848,7 +856,7 @@ sub size_request { my ($self) = @_; - my ($w, $h) = @$self{qw(child_w child_h)} = @{$self->child}{qw(req_w req_h)}; + my ($w, $h) = @{$self->child}{qw(req_w req_h)}; $w = 10 if $self->{scroll_x}; $h = 10 if $self->{scroll_y}; @@ -857,10 +865,12 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; - $w = $self->{child_w} if $self->{scroll_x} && $self->{child_w}; - $h = $self->{child_h} if $self->{scroll_y} && $self->{child_h}; + my $child = $self->child; + + $w = $child->{req_w} if $self->{scroll_x} && $child->{req_w}; + $h = $child->{req_h} if $self->{scroll_y} && $child->{req_h}; $self->child->configure (0, 0, $w, $h); $self->update; @@ -954,9 +964,9 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; - $self->SUPER::size_allocate ($w, $h, $changed); + $self->SUPER::size_allocate ($w, $h); my $child = $self->{vp}->child; $self->{slider}->set_range ([$self->{slider}{range}[0], 0, $child->{h}, $self->{vp}{h}, 1]); @@ -1029,6 +1039,8 @@ border_bg => [1, 1, 1, 1], border => 0.6, can_events => 1, + min_w => 16, + min_h => 16, @_ ); @@ -1057,9 +1069,7 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; - - return unless $changed; + my ($self, $w, $h) = @_; $h -= List::Util::max 0, $self->border * 2; $w -= List::Util::max 0, $self->border * 2; @@ -1241,7 +1251,7 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; my ($ws, $hs) = $self->get_wh; @@ -1329,7 +1339,7 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; my $space = $self->{vertical} ? $h : $w; my $children = $self->{children}; @@ -1422,7 +1432,8 @@ fontsize => 1, align => -1, valign => -1, - padding => 2, + padding_x => 2, + padding_y => 2, can_events => 0, %arg ); @@ -1508,17 +1519,14 @@ $h = List::Util::max $h, $h2; } - ( - $w + $self->{padding} * 2, - $h + $self->{padding} * 2, - ) + ($w, $h) } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; delete $self->{texture} - if $changed; + unless $w >= $self->{req_w} && $self->{old_w} >= $self->{req_w}; } sub set_fontsize { @@ -1545,12 +1553,12 @@ my $tex = new_from_layout CFClient::Texture $self->{layout}; - $self->{ox} = int ($self->{align} < 0 ? $self->{padding} - : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} + $self->{ox} = int ($self->{align} < 0 ? $self->{padding_x} + : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding_x} : ($self->{w} - $tex->{w}) * 0.5); - $self->{oy} = int ($self->{valign} < 0 ? $self->{padding} - : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} + $self->{oy} = int ($self->{valign} < 0 ? $self->{padding_y} + : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding_y} : ($self->{h} - $tex->{h}) * 0.5); $tex @@ -1799,7 +1807,8 @@ my $class = shift; $class->SUPER::new ( - padding => 4, + padding_x => 4, + padding_y => 4, fg => [1, 1, 1], active_fg => [0, 0, 1], can_hover => 1, @@ -1856,7 +1865,8 @@ my $class = shift; $class->SUPER::new ( - padding => 2, + padding_x => 2, + padding_y => 2, fg => [1, 1, 1], active_fg => [1, 1, 0], bg => [0, 0, 0, 0.2], @@ -1870,14 +1880,14 @@ sub size_request { my ($self) = @_; - ($self->{padding} * 2 + 6) x 2 + (6) x 2 } sub button_down { my ($self, $ev, $x, $y) = @_; - if ($x >= $self->{padding} && $x < $self->{w} - $self->{padding} - && $y >= $self->{padding} && $y < $self->{h} - $self->{padding}) { + if ($x >= $self->{padding_x} && $x < $self->{w} - $self->{padding_x} + && $y >= $self->{padding_y} && $y < $self->{h} - $self->{padding_y}) { $self->{state} = !$self->{state}; $self->_emit (changed => $self->{state}); } @@ -1888,9 +1898,11 @@ $self->SUPER::_draw; - glTranslate $self->{padding} + 0.375, $self->{padding} + 0.375, 0; + glTranslate $self->{padding_x} + 0.375, $self->{padding_y} + 0.375, 0; + + my ($w, $h) = @$self{qw(w h)}; - my $s = (List::Util::min @$self{qw(w h)}) - $self->{padding} * 2; + my $s = List::Util::min $w - $self->{padding_x} * 2, $h - $self->{padding_y} * 2; glColor @{ $FOCUS == $self ? $self->{active_fg} : $self->{fg} }; @@ -2376,11 +2388,9 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; - - $self->SUPER::size_allocate ($w, $h, $changed); + my ($self, $w, $h) = @_; - return unless $changed; + $self->SUPER::size_allocate ($w, $h); $self->{layout}->set_font ($self->{font}) if $self->{font}; $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); @@ -2613,8 +2623,17 @@ sub set_tooltip_from { my ($self, $widget) = @_; + my $tooltip = $widget->{tooltip}; + + if ($ENV{CFPLUS_DEBUG} & 2) { + $tooltip .= "\n\n" . (ref $widget) . "\n" + . "$widget->{x} $widget->{y} $widget->{w} $widget->{h}\n" + . "req $widget->{req_w} $widget->{req_h}\n" + . "visible $widget->{visible}"; + } + $self->add (new CFClient::UI::Label - markup => $widget->{tooltip}, + markup => $tooltip, max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH, fontsize => 0.8, fg => [0, 0, 0, 1], @@ -2632,11 +2651,9 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; - - return unless $changed; + my ($self, $w, $h) = @_; - $self->SUPER::size_allocate ($w - 4, $h - 4, $changed); + $self->SUPER::size_allocate ($w - 4, $h - 4); } sub visibility_change { @@ -2767,48 +2784,6 @@ ############################################################################# -package CFClient::UI::Inventory; - -our @ISA = CFClient::UI::ScrolledWindow::; - -sub new { - my $class = shift; - - my $self = $class->SUPER::new ( - scrolled => (new CFClient::UI::Table col_expand => [0, 1, 0]), - @_, - ); - - $self -} - -sub set_items { - my ($self, $items) = @_; - - $self->{scrolled}->clear; - return unless $items; - - my @items = sort { - ($a->{type} <=> $b->{type}) - or ($a->{name} cmp $b->{name}) - } @$items; - - $self->{real_items} = \@items; - - my $row = 0; - for my $item (@items) { - CFClient::Item::update_widgets $item; - - $self->{scrolled}->add (0, $row, $item->{face_widget}); - $self->{scrolled}->add (1, $row, $item->{desc_widget}); - $self->{scrolled}->add (2, $row, $item->{weight_widget}); - - $row++; - } -} - -############################################################################# - package CFClient::UI::Menu; our @ISA = CFClient::UI::FancyFrame::; @@ -2856,7 +2831,7 @@ $self->{button} = $ev->{button}; $self->show; - $self->move ($ev->{x} - $self->{w} * 0.5, $ev->{y} - $self->{h} * 0.5); + $self->move_abs ($ev->{x} - $self->{w} * 0.5, $ev->{y} - $self->{h} * 0.5); } sub mouse_motion { @@ -2991,39 +2966,314 @@ ############################################################################# -package CFClient::UI::Root; - -our @ISA = CFClient::UI::Container::; +package CFClient::UI::Inventory; -use CFClient::OpenGL; +our @ISA = CFClient::UI::ScrolledWindow::; sub new { my $class = shift; my $self = $class->SUPER::new ( - visible => 1, + scrolled => (new CFClient::UI::Table col_expand => [0, 1, 0]), @_, ); - Scalar::Util::weaken ($self->{root} = $self); + $self +} + +sub set_items { + my ($self, $items) = @_; + + $self->{scrolled}->clear; + return unless $items; + + my @items = sort { + ($a->{type} <=> $b->{type}) + or ($a->{name} cmp $b->{name}) + } @$items; + + $self->{real_items} = \@items; + + my $row = 0; + for my $item (@items) { + CFClient::Item::update_widgets $item; + + $self->{scrolled}->add (0, $row, $item->{face_widget}); + $self->{scrolled}->add (1, $row, $item->{desc_widget}); + $self->{scrolled}->add (2, $row, $item->{weight_widget}); + + $row++; + } +} + +############################################################################# + +package CFClient::UI::BindEditor; + +our @ISA = CFClient::UI::FancyFrame::; + +sub new { + my $class = shift; + + my $self = $class->SUPER::new (binding => [], commands => [], @_); + + $self->add (my $vb = new CFClient::UI::VBox); + + + $vb->add ($self->{rec_btn} = new CFClient::UI::Button + text => "start recording", + tooltip => "Start/Stops recording of actions." + ."All subsequent actions after the recording started will be captured." + ."The actions are displayed after the record was stopped." + ."To bind the action you have to click on the 'Bind' button", + on_activate => sub { + unless ($self->{recording}) { + $self->start; + } else { + $self->stop; + } + }); + + $vb->add (new CFClient::UI::Label text => "Actions:"); + $vb->add ($self->{cmdbox} = new CFClient::UI::VBox); + + $vb->add (new CFClient::UI::Label text => "Bound to: "); + $vb->add (my $hb = new CFClient::UI::HBox); + $hb->add ($self->{keylbl} = new CFClient::UI::Label expand => 1); + $hb->add (new CFClient::UI::Button + text => "bind", + tooltip => "This opens a query where you have to press the key combination to bind the recorded actions", + on_activate => sub { + $self->ask_for_bind; + }); + + $vb->add (my $hb = new CFClient::UI::HBox); + $hb->add (new CFClient::UI::Button + text => "ok", + expand => 1, + tooltip => "This closes the binding editor and saves the binding", + on_activate => sub { + $self->hide; + $self->commit; + }); + + $hb->add (new CFClient::UI::Button + text => "cancel", + expand => 1, + tooltip => "This closes the binding editor without saving", + on_activate => sub { + $self->hide; + $self->{binding_cancel}->() + if $self->{binding_cancel}; + }); + + $self->update_binding_widgets; $self } -sub configure { - my ($self, $x, $y, $w, $h) = @_; +sub commit { + my ($self) = @_; + my ($mod, $sym, $cmds) = $self->get_binding; + if ($sym != 0 && @$cmds > 0) { + $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym) + ."'. Don't forget 'Save Config'!"); + $self->{binding_change}->($mod, $sym, $cmds) + if $self->{binding_change}; + } else { + $::STATUSBOX->add ("No action bound, no key or action specified!"); + $self->{binding_cancel}->() + if $self->{binding_cancel}; + } +} - $self->{w} = $w; - $self->{h} = $h; +sub start { + my ($self) = @_; + + $self->{rec_btn}->set_text ("stop recording"); + $self->{recording} = 1; + $self->clear_command_list; + $::CONN->start_record if $::CONN; } -sub reconfigure { +sub stop { my ($self) = @_; - $self->SUPER::reconfigure; + $self->{rec_btn}->set_text ("start recording"); + $self->{recording} = 0; + + my $rec; + $rec = $::CONN->stop_record if $::CONN; + return unless ref $rec eq 'ARRAY'; + $self->set_command_list ($rec); +} + +# if $commit is true, the binding will be set after the user entered a key combo +sub ask_for_bind { + my ($self, $commit) = @_; - $self->size_allocate ($self->{w}, $self->{h}, 1) - if $self->{w}; + CFClient::Binder::open_binding_dialog (sub { + my ($mod, $sym) = @_; + $self->{binding} = [$mod, $sym]; # XXX: how to stop that memleak? + $self->update_binding_widgets; + $self->commit if $commit; + }); +} + +# $mod and $sym are the modifiers and key symbol +# $cmds is a array ref of strings (the commands) +# $cb is the callback that is executed on OK +# $ccb is the callback that is executed on CANCEL and +# when the binding was unsuccessful on OK +sub set_binding { + my ($self, $mod, $sym, $cmds, $cb, $ccb) = @_; + + $self->clear_command_list; + $self->{recording} = 0; + $self->{rec_btn}->set_text ("start recording"); + + $self->{binding} = [$mod, $sym]; + $self->{commands} = $cmds; + + $self->{binding_change} = $cb; + $self->{binding_cancel} = $ccb; + + $self->update_binding_widgets; +} + +# this is a shortcut method that asks for a binding +# and then just binds it. +sub do_quick_binding { + my ($self, $cmds) = @_; + $self->set_binding (undef, undef, $cmds, sub { + $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2]; + }); + $self->ask_for_bind (1); +} + +sub update_binding_widgets { + my ($self) = @_; + my ($mod, $sym, $cmds) = $self->get_binding; + $self->{keylbl}->set_text (CFClient::Binder::keycombo_to_name ($mod, $sym)); + $self->set_command_list ($cmds); +} + +sub get_binding { + my ($self) = @_; + return ( + $self->{binding}->[0], + $self->{binding}->[1], + [ grep { defined $_ } @{$self->{commands}} ] + ); +} + +sub clear_command_list { + my ($self) = @_; + $self->{cmdbox}->clear (); +} + +sub set_command_list { + my ($self, $cmds) = @_; + + $self->{cmdbox}->clear (); + $self->{commands} = $cmds; + + my $idx = 0; + + for (@$cmds) { + $self->{cmdbox}->add (my $hb = new CFClient::UI::HBox); + + my $i = $idx; + $hb->add (new CFClient::UI::Label text => $_); + $hb->add (new CFClient::UI::Button + text => "delete", + tooltip => "Deletes the action from the record", + on_activate => sub { + $self->{cmdbox}->remove ($hb); + $cmds->[$i] = undef; + }); + + + $idx++ + } +} + +############################################################################# + +package CFClient::UI::SpellList; + +our @ISA = CFClient::UI::FancyFrame::; + +sub new { + my $class = shift; + + my $self = $class->SUPER::new (binding => [], commands => [], @_); + + $self->add (new CFClient::UI::ScrolledWindow + scrolled => $self->{spellbox} = new CFClient::UI::Table); + + $self; +} + +# XXX: Do sorting? Argl... +sub add_spell { + my ($self, $spell) = @_; + $self->{spells}->{$spell->{name}} = $spell; + + $self->{spellbox}->add (0, $self->{tbl_idx}, new CFClient::UI::Face + face => $spell->{face}, + can_hover => 1, + can_events => 1, + tooltip => $spell->{message}); + + $self->{spellbox}->add (1, $self->{tbl_idx}, new CFClient::UI::Label + text => $spell->{name}, + can_hover => 1, + can_events => 1, + tooltip => $spell->{message}, + expand => 1); + + $self->{spellbox}->add (2, $self->{tbl_idx}, new CFClient::UI::Label + text => (sprintf "lvl: %2d sp: %2d dmg: %2d", + $spell->{level}, ($spell->{mana} || $spell->{grace}), $spell->{damage}), + expand => 1); + + $self->{spellbox}->add (3, $self->{tbl_idx}++, new CFClient::UI::Button + text => "bind to key", + on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }); +} + +sub rebuild_spell_list { + my ($self) = @_; + $self->{tbl_idx} = 0; + $self->add_spell ($_) for values %{$self->{spells}}; +} + +sub remove_spell { + my ($self, $spell) = @_; + delete $self->{spells}->{$spell->{name}}; + $self->rebuild_spell_list; +} + +############################################################################# + +package CFClient::UI::Root; + +our @ISA = CFClient::UI::Container::; + +use CFClient::OpenGL; + +sub new { + my $class = shift; + + my $self = $class->SUPER::new ( + visible => 1, + @_, + ); + + Scalar::Util::weaken ($self->{root} = $self); + + $self } sub size_request { @@ -3047,7 +3297,7 @@ } sub size_allocate { - my ($self, $w, $h, $changed) = @_; + my ($self, $w, $h) = @_; for my $child ($self->children) { my ($X, $Y, $W, $H) = @$child{qw(x y req_w req_h)}; @@ -3125,49 +3375,69 @@ } if ($self->{realloc}) { + my %queue; my @queue; + my $widget; + outer: while () { - if ($self->{realloc}) { - #TODO use array-of-depth approach + if (my $realloc = delete $self->{realloc}) { + for $widget (values %$realloc) { + $widget->{visible} or next; # do not resize invisible widgets + + $queue{$widget+0}++ and next; # duplicates are common - @queue = sort { $a->{visible} <=> $b->{visible} } - @queue, values %{delete $self->{realloc}}; + push @{ $queue[$widget->{visible}] }, $widget; + } } - my $widget = pop @queue || last; + while () { + @queue or last outer; + + $widget = pop @{ $queue[-1] || [] } + and last; + + pop @queue; + } - $widget->{visible} or last; # do not resize invisible widgets + delete $queue{$widget+0}; my ($w, $h) = $widget->size_request; - my $min_size = $widget->{is_toplevel} ? 16 : 0; - - $w = List::Util::max $widget->{min_w} || $widget->{is_toplevel} * 16, $w; - $h = List::Util::max $widget->{min_h} || $widget->{is_toplevel} * 16, $h; + $w = List::Util::max $widget->{min_w}, $w + $widget->{padding_x} * 2; + $h = List::Util::max $widget->{min_h}, $h + $widget->{padding_y} * 2; $w = $widget->{force_w} if exists $widget->{force_w}; $h = $widget->{force_h} if exists $widget->{force_h}; - $widget->{req_w} = $w; - $widget->{req_h} = $h; + if ($widget->{req_w} != $w || $widget->{req_h} != $h + || delete $widget->{force_realloc}) { + $widget->{req_w} = $w; + $widget->{req_h} = $h; + + $self->{size_alloc}{$widget+0} = $widget; + + if (my $parent = $widget->{parent}) { + $self->{realloc}{$parent+0} = $parent + unless $queue{$parent+0}; - $self->{size_alloc}{$widget} = [$widget, undef, undef]; + $parent->{force_size_alloc} = 1; + $self->{size_alloc}{$parent+0} = $parent; + } + } - push @queue, $widget->{parent} - if ($self->{w} != $w || $self->{h} != $h) && $widget->{parent}; + delete $self->{realloc}{$widget+0}; } } while (my $size_alloc = delete $self->{size_alloc}) { - my @queue = sort $b->[0]{visible} <=> $a->[0]{visible}, + my @queue = sort { $b->{visible} <=> $a->{visible} } values %$size_alloc; while () { - my ($widget, $w, $h) = @{ pop @queue or last }; + my $widget = pop @queue || last; - $w = $widget->{w} || $widget->{req_w} unless defined $w; - $h = $widget->{h} || $widget->{req_h} unless defined $h; + my ($w, $h) = @$widget{qw(alloc_w alloc_h)}; $w = 0 if $w < 0; $h = 0 if $h < 0; @@ -3175,12 +3445,15 @@ $w = int $w + 0.5; $h = int $h + 0.5; - my $changed = $widget->{w} != $w || $widget->{h} != $h; + if ($widget->{w} != $w || $widget->{h} != $h || delete $widget->{force_size_alloc}) { + $widget->{old_w} = $widget->{w}; + $widget->{old_h} = $widget->{h}; - $widget->{w} = $w; - $widget->{h} = $h; + $widget->{w} = $w; + $widget->{h} = $h; - $widget->emit (size_allocate => $w, $h, $changed); + $widget->emit (size_allocate => $w, $h); + } } } @@ -3189,6 +3462,7 @@ for values %{delete $self->{post_alloc_hook}}; } + glViewport 0, 0, $::WIDTH, $::HEIGHT; glClearColor +($::CFG->{fow_intensity}) x 3, 1; glClear GL_COLOR_BUFFER_BIT;