… | |
… | |
40 | |
40 | |
41 | $LAYOUT = $layout; |
41 | $LAYOUT = $layout; |
42 | } |
42 | } |
43 | |
43 | |
44 | sub check_tooltip { |
44 | sub check_tooltip { |
|
|
45 | return if $ENV{CFPLUS_DEBUG} & 8; |
|
|
46 | |
45 | if (!$GRAB) { |
47 | if (!$GRAB) { |
46 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
48 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
47 | if (length $widget->{tooltip}) { |
49 | if (length $widget->{tooltip}) { |
48 | |
|
|
49 | if ($TOOLTIP->{owner} != $widget) { |
50 | if ($TOOLTIP->{owner} != $widget) { |
50 | $TOOLTIP->hide; |
51 | $TOOLTIP->hide; |
51 | |
52 | |
52 | $TOOLTIP->{owner} = $widget; |
53 | $TOOLTIP->{owner} = $widget; |
53 | |
54 | |
… | |
… | |
170 | sub rescale_widgets { |
171 | sub rescale_widgets { |
171 | my ($sx, $sy) = @_; |
172 | my ($sx, $sy) = @_; |
172 | |
173 | |
173 | for my $widget (values %WIDGET) { |
174 | for my $widget (values %WIDGET) { |
174 | if ($widget->{is_toplevel}) { |
175 | if ($widget->{is_toplevel}) { |
175 | $widget->{x} += $widget->{w} * 0.5 if $widget->{x} =~ /^[0-9.]+$/; |
176 | $widget->{x} += int $widget->{w} * 0.5 if $widget->{x} =~ /^[0-9.]+$/; |
176 | $widget->{y} += $widget->{h} * 0.5 if $widget->{y} =~ /^[0-9.]+$/; |
177 | $widget->{y} += int $widget->{h} * 0.5 if $widget->{y} =~ /^[0-9.]+$/; |
177 | |
178 | |
178 | $widget->{x} = int 0.5 + $widget->{x} * $sx if $widget->{x} =~ /^[0-9.]+$/; |
179 | $widget->{x} = int 0.5 + $widget->{x} * $sx if $widget->{x} =~ /^[0-9.]+$/; |
179 | $widget->{w} = int 0.5 + $widget->{w} * $sx if exists $widget->{w}; |
180 | $widget->{w} = int 0.5 + $widget->{w} * $sx if exists $widget->{w}; |
180 | $widget->{force_w} = int 0.5 + $widget->{force_w} * $sx if exists $widget->{force_w}; |
181 | $widget->{force_w} = int 0.5 + $widget->{force_w} * $sx if exists $widget->{force_w}; |
181 | $widget->{y} = int 0.5 + $widget->{y} * $sy if $widget->{y} =~ /^[0-9.]+$/; |
182 | $widget->{y} = int 0.5 + $widget->{y} * $sy if $widget->{y} =~ /^[0-9.]+$/; |
182 | $widget->{h} = int 0.5 + $widget->{h} * $sy if exists $widget->{h}; |
183 | $widget->{h} = int 0.5 + $widget->{h} * $sy if exists $widget->{h}; |
183 | $widget->{force_h} = int 0.5 + $widget->{force_h} * $sy if exists $widget->{force_h}; |
184 | $widget->{force_h} = int 0.5 + $widget->{force_h} * $sy if exists $widget->{force_h}; |
184 | |
185 | |
185 | $widget->{x} -= $widget->{w} * 0.5 if $widget->{x} =~ /^[0-9.]+$/; |
186 | $widget->{x} -= int $widget->{w} * 0.5 if $widget->{x} =~ /^[0-9.]+$/; |
186 | $widget->{y} -= $widget->{h} * 0.5 if $widget->{y} =~ /^[0-9.]+$/; |
187 | $widget->{y} -= int $widget->{h} * 0.5 if $widget->{y} =~ /^[0-9.]+$/; |
187 | |
188 | |
188 | } |
189 | } |
189 | } |
190 | } |
190 | |
191 | |
191 | reconfigure_widgets; |
192 | reconfigure_widgets; |
… | |
… | |
449 | my ($self, $ev, $x, $y) = @_; |
450 | my ($self, $ev, $x, $y) = @_; |
450 | |
451 | |
451 | $self->focus_in; |
452 | $self->focus_in; |
452 | } |
453 | } |
453 | |
454 | |
454 | sub w { $_[0]{w} = $_[1] if @_ > 1; $_[0]{w} } |
|
|
455 | sub h { $_[0]{h} = $_[1] if @_ > 1; $_[0]{h} } |
|
|
456 | sub x { $_[0]{x} = $_[1] if @_ > 1; $_[0]{x} } |
|
|
457 | sub y { $_[0]{y} = $_[1] if @_ > 1; $_[0]{y} } |
|
|
458 | sub z { $_[0]{z} = $_[1] if @_ > 1; $_[0]{z} } |
|
|
459 | |
|
|
460 | sub find_widget { |
455 | sub find_widget { |
461 | my ($self, $x, $y) = @_; |
456 | my ($self, $x, $y) = @_; |
462 | |
457 | |
463 | return () unless $self->{can_events}; |
458 | return () unless $self->{can_events}; |
464 | |
459 | |
… | |
… | |
525 | |
520 | |
526 | $self->realloc; |
521 | $self->realloc; |
527 | $self->update; |
522 | $self->update; |
528 | } |
523 | } |
529 | |
524 | |
|
|
525 | # using global variables seems a bit hacky, but passing through all drawing |
|
|
526 | # functions seems pointless. |
|
|
527 | our ($draw_x, $draw_y, $draw_w, $draw_h); # screen rectangle being drawn |
|
|
528 | |
530 | sub draw { |
529 | sub draw { |
531 | my ($self) = @_; |
530 | my ($self) = @_; |
532 | |
531 | |
533 | return unless $self->{h} && $self->{w}; |
532 | return unless $self->{h} && $self->{w}; |
|
|
533 | |
|
|
534 | # update screen rectangle |
|
|
535 | local $draw_x = $draw_x + $self->{x}; |
|
|
536 | local $draw_y = $draw_y + $self->{y}; |
|
|
537 | local $draw_w = $draw_x + $self->{w}; |
|
|
538 | local $draw_h = $draw_y + $self->{h}; |
|
|
539 | |
|
|
540 | # skip widgets that are entirely outside the drawing area |
|
|
541 | return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w) |
|
|
542 | || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h); |
534 | |
543 | |
535 | glPushMatrix; |
544 | glPushMatrix; |
536 | glTranslate $self->{x}, $self->{y}, 0; |
545 | glTranslate $self->{x}, $self->{y}, 0; |
537 | $self->_draw; |
546 | $self->_draw; |
538 | glPopMatrix; |
547 | glPopMatrix; |
… | |
… | |
803 | $self->SUPER::size_allocate ($w, $h); |
812 | $self->SUPER::size_allocate ($w, $h); |
804 | $self->update; |
813 | $self->update; |
805 | } |
814 | } |
806 | |
815 | |
807 | sub _render { |
816 | sub _render { |
|
|
817 | my ($self) = @_; |
|
|
818 | |
808 | $_[0]{children}[0]->draw; |
819 | $self->{children}[0]->draw; |
809 | } |
820 | } |
810 | |
821 | |
811 | sub render_child { |
822 | sub render_child { |
812 | my ($self) = @_; |
823 | my ($self) = @_; |
813 | |
824 | |
814 | $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { |
825 | $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { |
815 | glClearColor 0, 0, 0, 0; |
826 | glClearColor 0, 0, 0, 0; |
816 | glClear GL_COLOR_BUFFER_BIT; |
827 | glClear GL_COLOR_BUFFER_BIT; |
817 | |
828 | |
|
|
829 | { |
|
|
830 | package CFClient::UI::Base; |
|
|
831 | |
|
|
832 | ($draw_x, $draw_y, $draw_w, $draw_h) = |
|
|
833 | (0, 0, $self->{w}, $self->{h}); |
|
|
834 | } |
|
|
835 | |
818 | $self->_render; |
836 | $self->_render; |
819 | }; |
837 | }; |
820 | } |
838 | } |
821 | |
839 | |
822 | sub _draw { |
840 | sub _draw { |
823 | my ($self) = @_; |
841 | my ($self) = @_; |
824 | |
842 | |
825 | my ($w, $h) = ($self->w, $self->h); |
843 | my ($w, $h) = @$self{qw(w h)}; |
826 | |
844 | |
827 | my $tex = $self->{texture} |
845 | my $tex = $self->{texture} |
828 | or return; |
846 | or return; |
829 | |
847 | |
830 | glEnable GL_TEXTURE_2D; |
848 | glEnable GL_TEXTURE_2D; |
… | |
… | |
912 | } |
930 | } |
913 | } |
931 | } |
914 | |
932 | |
915 | sub _render { |
933 | sub _render { |
916 | my ($self) = @_; |
934 | my ($self) = @_; |
|
|
935 | |
|
|
936 | local $CFClient::UI::Base::draw_x = $CFClient::UI::Base::draw_x - $self->{view_x}; |
|
|
937 | local $CFClient::UI::Base::draw_y = $CFClient::UI::Base::draw_y - $self->{view_y}; |
917 | |
938 | |
918 | CFClient::OpenGL::glTranslate -$self->{view_x}, -$self->{view_y}; |
939 | CFClient::OpenGL::glTranslate -$self->{view_x}, -$self->{view_y}; |
919 | |
940 | |
920 | $self->SUPER::_render; |
941 | $self->SUPER::_render; |
921 | } |
942 | } |
… | |
… | |
1029 | my @border = |
1050 | my @border = |
1030 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1051 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1031 | qw(d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); |
1052 | qw(d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); |
1032 | |
1053 | |
1033 | sub new { |
1054 | sub new { |
1034 | my $class = shift; |
1055 | my ($class, %arg) = @_; |
|
|
1056 | |
|
|
1057 | my $title = delete $arg{title}; |
1035 | |
1058 | |
1036 | my $self = $class->SUPER::new ( |
1059 | my $self = $class->SUPER::new ( |
1037 | bg => [1, 1, 1, 1], |
1060 | bg => [1, 1, 1, 1], |
1038 | border_bg => [1, 1, 1, 1], |
1061 | border_bg => [1, 1, 1, 1], |
1039 | border => 0.6, |
1062 | border => 0.6, |
1040 | can_events => 1, |
1063 | can_events => 1, |
1041 | min_w => 16, |
1064 | min_w => 16, |
1042 | min_h => 16, |
1065 | min_h => 16, |
1043 | @_ |
1066 | %arg, |
1044 | ); |
1067 | ); |
1045 | |
1068 | |
1046 | $self->{title} &&= new CFClient::UI::Label |
1069 | $self->{title} = new CFClient::UI::Label |
1047 | align => 0, |
1070 | align => 0, |
1048 | valign => 1, |
1071 | valign => 1, |
1049 | text => $self->{title}, |
1072 | text => $title, |
1050 | fontsize => $self->{border}; |
1073 | fontsize => $self->{border} |
|
|
1074 | if defined $title; |
1051 | |
1075 | |
1052 | $self |
1076 | $self |
|
|
1077 | } |
|
|
1078 | |
|
|
1079 | sub add { |
|
|
1080 | my ($self, @widgets) = @_; |
|
|
1081 | |
|
|
1082 | $self->SUPER::add (@widgets); |
|
|
1083 | $self->CFClient::UI::Container::add ($self->{title}) if $self->{title}; |
1053 | } |
1084 | } |
1054 | |
1085 | |
1055 | sub border { |
1086 | sub border { |
1056 | int $_[0]{border} * $::FONTSIZE |
1087 | int $_[0]{border} * $::FONTSIZE |
1057 | } |
1088 | } |
1058 | |
1089 | |
1059 | sub size_request { |
1090 | sub size_request { |
1060 | my ($self) = @_; |
1091 | my ($self) = @_; |
|
|
1092 | |
|
|
1093 | $self->{title}->size_request |
|
|
1094 | if $self->{title}; |
1061 | |
1095 | |
1062 | my ($w, $h) = $self->SUPER::size_request; |
1096 | my ($w, $h) = $self->SUPER::size_request; |
1063 | |
1097 | |
1064 | ( |
1098 | ( |
1065 | $w + $self->border * 2, |
1099 | $w + $self->border * 2, |
… | |
… | |
1068 | } |
1102 | } |
1069 | |
1103 | |
1070 | sub size_allocate { |
1104 | sub size_allocate { |
1071 | my ($self, $w, $h) = @_; |
1105 | my ($self, $w, $h) = @_; |
1072 | |
1106 | |
|
|
1107 | if ($self->{title}) { |
|
|
1108 | $self->{title}{w} = $w; |
|
|
1109 | $self->{title}{h} = $h; |
|
|
1110 | $self->{title}->size_allocate ($w, $h); |
|
|
1111 | } |
|
|
1112 | |
|
|
1113 | my $border = $self->border; |
|
|
1114 | |
1073 | $h -= List::Util::max 0, $self->border * 2; |
1115 | $h -= List::Util::max 0, $border * 2; |
1074 | $w -= List::Util::max 0, $self->border * 2; |
1116 | $w -= List::Util::max 0, $border * 2; |
1075 | |
1117 | |
1076 | $self->{title}->configure ($self->border, int $self->border - $::FONTSIZE * 2, $w, int $::FONTSIZE * 2) |
|
|
1077 | if $self->{title}; |
|
|
1078 | |
|
|
1079 | $self->child->configure ($self->border, $self->border, $w, $h); |
1118 | $self->child->configure ($border, $border, $w, $h); |
1080 | } |
1119 | } |
1081 | |
1120 | |
1082 | sub button_down { |
1121 | sub button_down { |
1083 | my ($self, $ev, $x, $y) = @_; |
1122 | my ($self, $ev, $x, $y) = @_; |
1084 | |
1123 | |
… | |
… | |
1136 | } |
1175 | } |
1137 | |
1176 | |
1138 | sub _draw { |
1177 | sub _draw { |
1139 | my ($self) = @_; |
1178 | my ($self) = @_; |
1140 | |
1179 | |
|
|
1180 | my $child = $self->{children}[0]; |
|
|
1181 | |
1141 | my ($w, $h ) = ($self->{w}, $self->{h}); |
1182 | my ($w, $h ) = ($self->{w}, $self->{h}); |
1142 | my ($cw, $ch) = ($self->child->{w}, $self->child->{h}); |
1183 | my ($cw, $ch) = ($child->{w}, $child->{h}); |
1143 | |
1184 | |
1144 | glEnable GL_TEXTURE_2D; |
1185 | glEnable GL_TEXTURE_2D; |
1145 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1186 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1146 | |
1187 | |
1147 | my $border = $self->border; |
1188 | my $border = $self->border; |
… | |
… | |
1162 | $bg->draw_quad_alpha ($border, $border, $cw, $ch); |
1203 | $bg->draw_quad_alpha ($border, $border, $cw, $ch); |
1163 | } |
1204 | } |
1164 | |
1205 | |
1165 | glDisable GL_TEXTURE_2D; |
1206 | glDisable GL_TEXTURE_2D; |
1166 | |
1207 | |
1167 | $self->{title}->draw if $self->{title}; |
|
|
1168 | |
|
|
1169 | $self->child->draw; |
1208 | $child->draw; |
|
|
1209 | |
|
|
1210 | if ($self->{title}) { |
|
|
1211 | glTranslate 0, $border - $self->{h}; |
|
|
1212 | $self->{title}->_draw; |
|
|
1213 | } |
1170 | } |
1214 | } |
1171 | |
1215 | |
1172 | ############################################################################# |
1216 | ############################################################################# |
1173 | |
1217 | |
1174 | package CFClient::UI::Table; |
1218 | package CFClient::UI::Table; |
… | |
… | |
1522 | } |
1566 | } |
1523 | |
1567 | |
1524 | sub size_allocate { |
1568 | sub size_allocate { |
1525 | my ($self, $w, $h) = @_; |
1569 | my ($self, $w, $h) = @_; |
1526 | |
1570 | |
|
|
1571 | delete $self->{ox}; |
|
|
1572 | |
1527 | delete $self->{texture} |
1573 | delete $self->{texture} |
1528 | ;#d# |
1574 | unless $w >= $self->{req_w} && $self->{old_w} >= $self->{req_w}; |
1529 | } |
1575 | } |
1530 | |
1576 | |
1531 | sub set_fontsize { |
1577 | sub set_fontsize { |
1532 | my ($self, $fontsize) = @_; |
1578 | my ($self, $fontsize) = @_; |
1533 | |
1579 | |
… | |
… | |
1548 | $self->{layout}->set_width ($self->{w}); |
1594 | $self->{layout}->set_width ($self->{w}); |
1549 | $self->{layout}->set_ellipsise ($self->{ellipsise}); |
1595 | $self->{layout}->set_ellipsise ($self->{ellipsise}); |
1550 | $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); |
1596 | $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); |
1551 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1597 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1552 | |
1598 | |
1553 | my $tex = new_from_layout CFClient::Texture $self->{layout}; |
1599 | new_from_layout CFClient::Texture $self->{layout} |
|
|
1600 | }; |
1554 | |
1601 | |
|
|
1602 | unless (exists $self->{ox}) { |
1555 | $self->{ox} = int ($self->{align} < 0 ? $self->{padding_x} |
1603 | $self->{ox} = int ($self->{align} < 0 ? $self->{padding_x} |
1556 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding_x} |
1604 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding_x} |
1557 | : ($self->{w} - $tex->{w}) * 0.5); |
1605 | : ($self->{w} - $tex->{w}) * 0.5); |
1558 | |
1606 | |
1559 | $self->{oy} = int ($self->{valign} < 0 ? $self->{padding_y} |
1607 | $self->{oy} = int ($self->{valign} < 0 ? $self->{padding_y} |
1560 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding_y} |
1608 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding_y} |
1561 | : ($self->{h} - $tex->{h}) * 0.5); |
1609 | : ($self->{h} - $tex->{h}) * 0.5); |
1562 | |
|
|
1563 | $tex |
|
|
1564 | }; |
1610 | }; |
1565 | |
1611 | |
1566 | glEnable GL_TEXTURE_2D; |
1612 | glEnable GL_TEXTURE_2D; |
1567 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1613 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1568 | |
1614 | |
… | |
… | |
3105 | $rec = $::CONN->stop_record if $::CONN; |
3151 | $rec = $::CONN->stop_record if $::CONN; |
3106 | return unless ref $rec eq 'ARRAY'; |
3152 | return unless ref $rec eq 'ARRAY'; |
3107 | $self->set_command_list ($rec); |
3153 | $self->set_command_list ($rec); |
3108 | } |
3154 | } |
3109 | |
3155 | |
3110 | # if $commit is true, the binding will be set after the user entered a key combo |
3156 | |
|
|
3157 | sub ask_for_bind_and_commit { |
|
|
3158 | my ($self) = @_; |
|
|
3159 | $self->ask_for_bind (1); |
|
|
3160 | } |
|
|
3161 | |
3111 | sub ask_for_bind { |
3162 | sub ask_for_bind { |
3112 | my ($self, $commit) = @_; |
3163 | my ($self, $commit) = @_; |
3113 | |
3164 | |
3114 | CFClient::Binder::open_binding_dialog (sub { |
3165 | CFClient::Binder::open_binding_dialog (sub { |
3115 | my ($mod, $sym) = @_; |
3166 | my ($mod, $sym) = @_; |
… | |
… | |
3372 | $_->() |
3423 | $_->() |
3373 | for values %{delete $self->{refresh_hook}}; |
3424 | for values %{delete $self->{refresh_hook}}; |
3374 | } |
3425 | } |
3375 | |
3426 | |
3376 | if ($self->{realloc}) { |
3427 | if ($self->{realloc}) { |
|
|
3428 | my %queue; |
3377 | my @queue; |
3429 | my @queue; |
|
|
3430 | my $widget; |
3378 | |
3431 | |
|
|
3432 | outer: |
3379 | while () { |
3433 | while () { |
3380 | if ($self->{realloc}) { |
3434 | if (my $realloc = delete $self->{realloc}) { |
3381 | #TODO use array-of-depth approach |
3435 | for $widget (values %$realloc) { |
|
|
3436 | $widget->{visible} or next; # do not resize invisible widgets |
3382 | |
3437 | |
3383 | use sort 'stable'; |
3438 | $queue{$widget+0}++ and next; # duplicates are common |
3384 | |
3439 | |
3385 | @queue = sort { $a->{visible} <=> $b->{visible} } |
3440 | push @{ $queue[$widget->{visible}] }, $widget; |
3386 | @queue, values %{delete $self->{realloc}}; |
3441 | } |
3387 | } |
3442 | } |
3388 | |
3443 | |
|
|
3444 | while () { |
|
|
3445 | @queue or last outer; |
|
|
3446 | |
3389 | my $widget = pop @queue || last; |
3447 | $widget = pop @{ $queue[-1] || [] } |
|
|
3448 | and last; |
|
|
3449 | |
|
|
3450 | pop @queue; |
|
|
3451 | } |
3390 | |
3452 | |
3391 | $widget->{visible} or last; # do not resize invisible widgets |
3453 | delete $queue{$widget+0}; |
3392 | |
3454 | |
3393 | my ($w, $h) = $widget->size_request; |
3455 | my ($w, $h) = $widget->size_request; |
3394 | |
3456 | |
3395 | $w = List::Util::max $widget->{min_w}, $w + $widget->{padding_x} * 2; |
3457 | $w = List::Util::max $widget->{min_w}, $w + $widget->{padding_x} * 2; |
3396 | $h = List::Util::max $widget->{min_h}, $h + $widget->{padding_y} * 2; |
3458 | $h = List::Util::max $widget->{min_h}, $h + $widget->{padding_y} * 2; |
… | |
… | |
3404 | $widget->{req_h} = $h; |
3466 | $widget->{req_h} = $h; |
3405 | |
3467 | |
3406 | $self->{size_alloc}{$widget+0} = $widget; |
3468 | $self->{size_alloc}{$widget+0} = $widget; |
3407 | |
3469 | |
3408 | if (my $parent = $widget->{parent}) { |
3470 | if (my $parent = $widget->{parent}) { |
3409 | $self->{realloc}{$parent+0} = $parent; |
3471 | $self->{realloc}{$parent+0} = $parent |
3410 | #unshift @queue, $parent; |
3472 | unless $queue{$parent+0}; |
|
|
3473 | |
3411 | $parent->{force_size_alloc} = 1; |
3474 | $parent->{force_size_alloc} = 1; |
3412 | $self->{size_alloc}{$parent+0} = $parent; |
3475 | $self->{size_alloc}{$parent+0} = $parent; |
3413 | } |
3476 | } |
3414 | } |
3477 | } |
3415 | |
3478 | |
… | |
… | |
3431 | |
3494 | |
3432 | $w = int $w + 0.5; |
3495 | $w = int $w + 0.5; |
3433 | $h = int $h + 0.5; |
3496 | $h = int $h + 0.5; |
3434 | |
3497 | |
3435 | if ($widget->{w} != $w || $widget->{h} != $h || delete $widget->{force_size_alloc}) { |
3498 | if ($widget->{w} != $w || $widget->{h} != $h || delete $widget->{force_size_alloc}) { |
|
|
3499 | $widget->{old_w} = $widget->{w}; |
|
|
3500 | $widget->{old_h} = $widget->{h}; |
|
|
3501 | |
3436 | $widget->{w} = $w; |
3502 | $widget->{w} = $w; |
3437 | $widget->{h} = $h; |
3503 | $widget->{h} = $h; |
3438 | |
3504 | |
3439 | $widget->emit (size_allocate => $w, $h); |
3505 | $widget->emit (size_allocate => $w, $h); |
3440 | } |
3506 | } |
… | |
… | |
3455 | glLoadIdentity; |
3521 | glLoadIdentity; |
3456 | glOrtho 0, $::WIDTH, $::HEIGHT, 0, -10000, 10000; |
3522 | glOrtho 0, $::WIDTH, $::HEIGHT, 0, -10000, 10000; |
3457 | glMatrixMode GL_MODELVIEW; |
3523 | glMatrixMode GL_MODELVIEW; |
3458 | glLoadIdentity; |
3524 | glLoadIdentity; |
3459 | |
3525 | |
|
|
3526 | { |
|
|
3527 | package CFClient::UI::Base; |
|
|
3528 | |
|
|
3529 | ($draw_x, $draw_y, $draw_w, $draw_h) = |
|
|
3530 | (0, 0, $self->{w}, $self->{h}); |
|
|
3531 | } |
|
|
3532 | |
3460 | $self->_draw; |
3533 | $self->_draw; |
3461 | } |
3534 | } |
3462 | |
3535 | |
3463 | ############################################################################# |
3536 | ############################################################################# |
3464 | |
3537 | |