… | |
… | |
639 | # TODO: repeat texture not scale |
639 | # TODO: repeat texture not scale |
640 | my $rep_x = $cw / $bg->{w}; |
640 | my $rep_x = $cw / $bg->{w}; |
641 | my $rep_y = $ch / $bg->{h}; |
641 | my $rep_y = $ch / $bg->{h}; |
642 | |
642 | |
643 | glColor @{ $self->{bg} }; |
643 | glColor @{ $self->{bg} }; |
|
|
644 | |
|
|
645 | $bg->{s} = $rep_x; |
|
|
646 | $bg->{t} = $rep_y; |
|
|
647 | $bg->{wrap_mode} = 1; |
644 | $bg->draw_quad ($self->{border}, $self->{border}, $cw, $ch); |
648 | $bg->draw_quad ($self->{border}, $self->{border}, $cw, $ch); |
645 | |
649 | |
646 | glDisable GL_TEXTURE_2D; |
650 | glDisable GL_TEXTURE_2D; |
647 | glDisable GL_BLEND; |
651 | glDisable GL_BLEND; |
648 | |
652 | |
… | |
… | |
1023 | } |
1027 | } |
1024 | |
1028 | |
1025 | sub _set_text { |
1029 | sub _set_text { |
1026 | my ($self, $text) = @_; |
1030 | my ($self, $text) = @_; |
1027 | |
1031 | |
|
|
1032 | my $old_text = $self->{text}; |
|
|
1033 | |
1028 | $self->{last_activity} = $::NOW; |
1034 | $self->{last_activity} = $::NOW; |
1029 | |
1035 | |
1030 | $self->{text} = $text; |
1036 | $self->{text} = $text; |
1031 | $self->{layout}->set_width ($self->{w}); |
1037 | $self->{layout}->set_width ($self->{w}); |
1032 | $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{height}); |
1038 | $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{height}); |
… | |
… | |
1037 | |
1043 | |
1038 | $text = substr $text, 0, $self->{cursor}; |
1044 | $text = substr $text, 0, $self->{cursor}; |
1039 | utf8::encode $text; |
1045 | utf8::encode $text; |
1040 | |
1046 | |
1041 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); |
1047 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); |
|
|
1048 | |
|
|
1049 | $self->emit (changed => $self->{text}) # XXX: is this the right place to do this? |
|
|
1050 | if $old_text ne $self->{text}; |
1042 | } |
1051 | } |
1043 | |
1052 | |
1044 | sub size_request { |
1053 | sub size_request { |
1045 | my ($self) = @_; |
1054 | my ($self) = @_; |
1046 | |
1055 | |