--- deliantra/Deliantra-Client/DC/UI.pm 2006/04/25 10:30:48 1.173 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/04/25 11:18:49 1.174 @@ -26,8 +26,16 @@ $tip = $tip->($widget) if CODE:: eq ref $tip; $TOOLTIP->set_markup ($widget->{tooltip}); - $TOOLTIP->move ($widget->coord2global ($widget->{w}, 0)); + $TOOLTIP->show; + + my ($x, $y) = $widget->coord2global ($widget->{w}, 0); + + if ($x + $TOOLTIP->{w} > $::WIDTH) { + ($x, $y) = $widget->coord2global (-$TOOLTIP->{w}, 0); + } + + $TOOLTIP->move ($x, $y); } return; @@ -645,29 +653,27 @@ sub update { my ($self) = @_; - # we want to do this delayed... - $self->render_chld; + $ROOT->on_refresh ($self => sub { $self->render_child }); $self->SUPER::update; } -sub render_chld { +sub size_allocate { + my ($self, $w, $h) = @_; + + $self->SUPER::size_allocate ($w, $h); + $self->update; +} + +sub render_child { my ($self) = @_; $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { - glClearColor 0, 0, 0, 1; + glClearColor 0, 0, 0, 0; glClear GL_COLOR_BUFFER_BIT; $self->child->draw; }; } -sub size_allocate { - my ($self, $w, $h) = @_; - - $self->child->configure (0, 0, $w, $h); - - $self->render_chld; -} - sub _draw { my ($self) = @_; @@ -677,9 +683,10 @@ or return; glEnable GL_BLEND; - glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; + glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA; glEnable GL_TEXTURE_2D; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; + glColor 0, 0, 0, 1; $tex->draw_quad (0, 0, $w, $h);