ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.120 by elmex, Sun Apr 16 17:43:17 2006 UTC vs.
Revision 1.127 by root, Mon Apr 17 21:03:31 2006 UTC

225 glPopMatrix; 225 glPopMatrix;
226 226
227 if ($self == $HOVER && $self->{can_hover}) { 227 if ($self == $HOVER && $self->{can_hover}) {
228 my ($x, $y) = @$self{qw(x y)}; 228 my ($x, $y) = @$self{qw(x y)};
229 229
230 glColor 0, 0, 1, 0.2; 230 glColor 1, 0.8, 0.5, 0.2;
231 glEnable GL_BLEND; 231 glEnable GL_BLEND;
232 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 232 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
233 glBegin GL_QUADS; 233 glBegin GL_QUADS;
234 glVertex $x , $y; 234 glVertex $x , $y;
235 glVertex $x + $self->{w}, $y; 235 glVertex $x + $self->{w}, $y;
260 my ($self, $parent) = @_; 260 my ($self, $parent) = @_;
261 261
262 Scalar::Util::weaken ($self->{parent} = $parent); 262 Scalar::Util::weaken ($self->{parent} = $parent);
263} 263}
264 264
265sub check_size {
266 my ($self) = @_;
267
268 my ($w, $h) = $self->size_request;
269
270 if ($w != $self->{req_w} || $h != $self->{req_h}) {
271 $self->{req_w} = $w;
272 $self->{req_h} = $h;
273
274 $self->{parent}->check_size
275 if $self->{parent};
276 }
277}
278
265sub update { 279sub update {
266 my ($self) = @_; 280 my ($self) = @_;
267 281
268 $self->{parent}->update 282 $self->{parent}->update
269 if $self->{parent}; 283 if $self->{parent};
368 sort { $a->{z} <=> $b->{z} } 382 sort { $a->{z} <=> $b->{z} }
369 @{$self->{children}}, $child 383 @{$self->{children}}, $child
370 ]; 384 ];
371 385
372 $self->{w} = $self->{h} = -1; 386 $self->{w} = $self->{h} = -1;
373 $self->update; 387
388 $child->check_size;
374} 389}
375 390
376sub remove { 391sub remove {
377 my ($self, $widget) = @_; 392 my ($self, $widget) = @_;
378 393
379 $self->{children} = [ grep $_ != $widget, @{ $self->{children} } ]; 394 $self->{children} = [ grep $_ != $widget, @{ $self->{children} } ];
380 395
381 $self->size_allocate (0, 0, $self->{w}, $self->{h}); 396 $self->check_size;
382} 397}
383 398
384sub find_widget { 399sub find_widget {
385 my ($self, $x, $y) = @_; 400 my ($self, $x, $y) = @_;
386 401
506 $tex->draw_quad (0, 0, $w, $h); 521 $tex->draw_quad (0, 0, $w, $h);
507 522
508 glDisable GL_BLEND; 523 glDisable GL_BLEND;
509 glDisable GL_TEXTURE_2D; 524 glDisable GL_TEXTURE_2D;
510} 525}
526
527#############################################################################
528
529package CFClient::UI::ViewPort;
530
531our @ISA = CFClient::UI::Window::;
532
533sub new { die }
534
535sub size_request {
536 my ($self) = @_;
537
538 @$self{qw(child_w child_h)} = $self->child->size_request;
539 $self->child->size_allocate (0, 0, @$self{qw(child_w child_h)});
540
541 @$self{qw(child_w child_h)}
542}
543
544sub size_allocate {
545 my ($self, $x, $y, $w, $h) = @_;
546
547 $self->_size_allocate ($x, $y, $w, $h) or return;
548}
549
550sub _draw {
551 my ($self) = @_;
552
553 $self->{children}[1]->draw;
554}
555
511 556
512############################################################################# 557#############################################################################
513 558
514package CFClient::UI::Frame; 559package CFClient::UI::Frame;
515 560
710 755
711 $child->set_parent ($self); 756 $child->set_parent ($self);
712 $self->{children}[$y][$x] = $child; 757 $self->{children}[$y][$x] = $child;
713 758
714 $self->{w} = $self->{h} = -1; 759 $self->{w} = $self->{h} = -1;
715 $self->update; 760
761 $child->check_size;
716} 762}
717 763
718# TODO: move to container class maybe? send childs a signal on removal? 764# TODO: move to container class maybe? send childs a signal on removal?
719sub clear { 765sub clear {
720 my ($self) = @_; 766 my ($self) = @_;
846} 892}
847 893
848sub size_allocate { 894sub size_allocate {
849 my ($self, $x, $y, $w, $h) = @_; 895 my ($self, $x, $y, $w, $h) = @_;
850 896
851 $self->_size_allocate ($x, $y, $w, $h); 897 $self->_size_allocate ($x, $y, $w, $h) or return;
852 898
853 ($h, $w) = ($w, $h); 899 ($h, $w) = ($w, $h);
854 900
855 my $children = $self->{children}; 901 my $children = $self->{children};
856 902
882 my $h = $h[$_]; 928 my $h = $h[$_];
883 $child->size_allocate ($y, 0, $h, $w); 929 $child->size_allocate ($y, 0, $h, $w);
884 930
885 $y += $h; 931 $y += $h;
886 } 932 }
933
934 1
887} 935}
888 936
889############################################################################# 937#############################################################################
890 938
891package CFClient::UI::VBox; 939package CFClient::UI::VBox;
906} 954}
907 955
908sub size_allocate { 956sub size_allocate {
909 my ($self, $x, $y, $w, $h) = @_; 957 my ($self, $x, $y, $w, $h) = @_;
910 958
911 $self->_size_allocate ($x, $y, $w, $h); 959 $self->_size_allocate ($x, $y, $w, $h) or return;
912 960
913 my $children = $self->{children}; 961 my $children = $self->{children};
914 962
915 my @h = map +($_->size_request)[1], @$children; 963 my @h = map +($_->size_request)[1], @$children;
916 964
938 my $h = $h[$_]; 986 my $h = $h[$_];
939 $child->size_allocate (0, $y, $w, $h); 987 $child->size_allocate (0, $y, $w, $h);
940 988
941 $y += $h; 989 $y += $h;
942 } 990 }
991
992 1
943} 993}
944 994
945############################################################################# 995#############################################################################
946 996
947package CFClient::UI::Label; 997package CFClient::UI::Label;
962 padding => 2, 1012 padding => 2,
963 layout => new CFClient::Layout, 1013 layout => new CFClient::Layout,
964 %arg 1014 %arg
965 ); 1015 );
966 1016
967 $self->set_text ($self->{text}); 1017 $self->{xxx}++ if $self->{text} eq "Client Setup" && $self->{align};#d#
1018
1019 $self->set_text (delete $self->{text}) if exists $self->{text};
1020 $self->set_markup (delete $self->{markup}) if exists $self->{markup};
968 1021
969 $self 1022 $self
970} 1023}
971 1024
972sub escape_text { 1025sub escape_text {
980} 1033}
981 1034
982sub set_text { 1035sub set_text {
983 my ($self, $text) = @_; 1036 my ($self, $text) = @_;
984 1037
985 $self->{text} = $text;
986 $self->{layout}->set_markup ($text); 1038 $self->{layout}->set_text ($text);
987 1039
988 delete $self->{texture}; 1040 delete $self->{texture};
989# $self->{w} = $self->{h} = -1;
990 $self->update; 1041 $self->update;
991} 1042}
992 1043
993sub get_text { 1044sub set_markup {
994 my ($self, $text) = @_; 1045 my ($self, $markup) = @_;
995 1046
996 $self->{text} 1047 $self->{layout}->set_markup ($markup);
1048
1049 delete $self->{texture};
1050 $self->update;
997} 1051}
998 1052
999sub size_request { 1053sub size_request {
1000 my ($self) = @_; 1054 my ($self) = @_;
1001 1055
1002 $self->{layout}->set_width; 1056 $self->{layout}->set_width;
1003 $self->{layout}->set_height ($self->{fontsize}); 1057 $self->{layout}->set_height ($self->{fontsize});
1058
1004 my ($w, $h) = $self->{layout}->size; 1059 my ($w, $h) = $self->{layout}->size;
1005 1060
1006 ( 1061 (
1007 $w + $self->{padding} * 2, 1062 $w + $self->{padding} * 2,
1008 $h + $self->{padding} * 2, 1063 $h + $self->{padding} * 2,
1027sub _draw { 1082sub _draw {
1028 my ($self) = @_; 1083 my ($self) = @_;
1029 1084
1030 my $tex = $self->{texture} ||= do { 1085 my $tex = $self->{texture} ||= do {
1031 $self->{layout}->set_width ($self->{w}); 1086 $self->{layout}->set_width ($self->{w});
1032 $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{fontsize}); 1087 $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize});
1033 new_from_layout CFClient::Texture $self->{layout} 1088 new_from_layout CFClient::Texture $self->{layout}
1034 }; 1089 };
1035 1090
1036 glEnable GL_BLEND; 1091 glEnable GL_BLEND;
1037 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1092 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1038 glEnable GL_TEXTURE_2D; 1093 glEnable GL_TEXTURE_2D;
1039 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1094 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1040 1095
1041 glColor @{$self->{fg}}; 1096 glColor @{$self->{fg}};
1042 1097
1043 my $x = 1098 $self->{ox} = int (
1044 $self->{align} < 0 ? $self->{padding} 1099 $self->{align} < 0 ? $self->{padding}
1045 : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} 1100 : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding}
1046 : ($self->{w} - $tex->{w}) * 0.5; 1101 : ($self->{w} - $tex->{w}) * 0.5
1102 );
1047 1103
1048 my $y = 1104 $self->{oy} = int (
1049 $self->{valign} < 0 ? $self->{padding} 1105 $self->{valign} < 0 ? $self->{padding}
1050 : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} 1106 : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding}
1051 : ($self->{h} - $tex->{h}) * 0.5; 1107 : ($self->{h} - $tex->{h}) * 0.5
1108 );
1052 1109
1053 $tex->draw_quad (int $x, int $y); 1110 $tex->draw_quad ($self->{ox}, $self->{oy});
1054 1111
1055 glDisable GL_TEXTURE_2D; 1112 glDisable GL_TEXTURE_2D;
1056 glDisable GL_BLEND; 1113 glDisable GL_BLEND;
1057} 1114}
1058 1115
1059############################################################################# 1116#############################################################################
1060 1117
1061package CFClient::UI::Entry; 1118package CFClient::UI::EntryBase;
1062 1119
1063our @ISA = CFClient::UI::Label::; 1120our @ISA = CFClient::UI::Label::;
1064 1121
1065use SDL; 1122use SDL;
1066use SDL::OpenGL; 1123use SDL::OpenGL;
1081} 1138}
1082 1139
1083sub _set_text { 1140sub _set_text {
1084 my ($self, $text) = @_; 1141 my ($self, $text) = @_;
1085 1142
1086 my $old_text = $self->{text}; 1143 delete $self->{cur_h};
1144
1145 return if $self->{text} eq $text;
1087 1146
1088 $self->{last_activity} = $::NOW; 1147 $self->{last_activity} = $::NOW;
1089
1090 $self->{text} = $text; 1148 $self->{text} = $text;
1091 $self->{layout}->set_width ($self->{w});
1092 $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{fontsize});
1093 1149
1094 $text =~ s/./*/g if $self->{hidden}; 1150 $text =~ s/./*/g if $self->{hidden};
1151 $self->{layout}->set_text ("$text ");
1095 1152
1096 $self->{layout}->set_markup ($self->escape_text ($text) . " "); 1153 $self->emit (changed => $self->{text});
1154}
1097 1155
1098 $text = substr $text, 0, $self->{cursor}; 1156sub get_text {
1099 utf8::encode $text; 1157 $_[0]{text}
1100
1101 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text);
1102
1103 $self->emit (changed => $self->{text}) # XXX: is this the right place to do this?
1104 if $old_text ne $self->{text};
1105} 1158}
1106 1159
1107sub size_request { 1160sub size_request {
1108 my ($self) = @_; 1161 my ($self) = @_;
1109 1162
1113} 1166}
1114 1167
1115sub size_allocate { 1168sub size_allocate {
1116 my ($self, $x, $y, $w, $h) = @_; 1169 my ($self, $x, $y, $w, $h) = @_;
1117 1170
1118 $self->SUPER::size_allocate ($x, $y, $w, $h); 1171 $self->SUPER::size_allocate ($x, $y, $w, $h) or return;
1119 1172
1120 $self->_set_text ($self->{text}); 1173 $self->_set_text ($self->{text});
1121} 1174}
1122 1175
1123sub set_text { 1176sub set_text {
1213 1266
1214 $self->SUPER::_draw; 1267 $self->SUPER::_draw;
1215 1268
1216 #TODO: force update every cursor change :( 1269 #TODO: force update every cursor change :(
1217 if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) { 1270 if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) {
1271
1272 unless (exists $self->{cur_h}) {
1273 my $text = substr $self->{text}, 0, $self->{cursor};
1274 utf8::encode $text;
1275
1276 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text)
1277 }
1278
1218 glColor @{$self->{fg}}; 1279 glColor @{$self->{fg}};
1219 glBegin GL_LINES; 1280 glBegin GL_LINES;
1220 glVertex $self->{cur_x}, $self->{cur_y};
1221 glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h}; 1281 glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy};
1282 glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h};
1222 glEnd; 1283 glEnd;
1223 } 1284 }
1224} 1285}
1225 1286
1226package CFClient::UI::LineEntry; 1287package CFClient::UI::Entry;
1227 1288
1228our @ISA = CFClient::UI::Entry::; 1289our @ISA = CFClient::UI::EntryBase::;
1229 1290
1230use SDL; 1291use SDL;
1231use SDL::OpenGL; 1292use SDL::OpenGL;
1232 1293
1233sub key_down { 1294sub key_down {
1263 1324
1264 $class->SUPER::new ( 1325 $class->SUPER::new (
1265 padding => 4, 1326 padding => 4,
1266 fg => [1, 1, 1], 1327 fg => [1, 1, 1],
1267 bg => [1, 1, 1, 0.2], 1328 bg => [1, 1, 1, 0.2],
1268 active_fg => [1, 1, 0], 1329 active_fg => [0, 0, 1],
1269 can_hover => 1, 1330 can_hover => 1,
1331 align => 0,
1332 valign => 0,
1270 @_ 1333 @_
1271 ) 1334 )
1272} 1335}
1273 1336
1274sub button_up { 1337sub button_up {
1336} 1399}
1337 1400
1338sub size_allocate { 1401sub size_allocate {
1339 my ($self, $x, $y, $w, $h) = @_; 1402 my ($self, $x, $y, $w, $h) = @_;
1340 1403
1341 $self->_size_allocate ($x, $y, $w, $h); 1404 $self->_size_allocate ($x, $y, $w, $h) or return;
1342} 1405}
1343 1406
1344sub button_down { 1407sub button_down {
1345 my ($self, $ev, $x, $y) = @_; 1408 my ($self, $ev, $x, $y) = @_;
1346 1409
1370 1433
1371 $tex->draw_quad (0, 0, $s, $s); 1434 $tex->draw_quad (0, 0, $s, $s);
1372 1435
1373 glDisable GL_TEXTURE_2D; 1436 glDisable GL_TEXTURE_2D;
1374 glDisable GL_BLEND; 1437 glDisable GL_BLEND;
1438}
1439
1440#############################################################################
1441
1442package CFClient::UI::VGauge;
1443
1444our @ISA = CFClient::UI::Base::;
1445
1446use SDL::OpenGL;
1447
1448my %tex = (
1449 food => [
1450 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1451 qw/g1_food_gauge_empty.png g1_food_gauge_full.png/
1452 ],
1453 grace => [
1454 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1455 qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/
1456 ],
1457 hp => [
1458 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1459 qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/
1460 ],
1461 mana => [
1462 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1463 qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/
1464 ],
1465);
1466
1467# eg. VGauge->new (gauge => 'food'), default gauge: food
1468sub new {
1469 my $class = shift;
1470
1471 my $self = $class->SUPER::new (gauge => 'food', @_);
1472
1473 $self
1474}
1475
1476sub size_request {
1477 my ($self) = @_;
1478
1479 my $tex = $tex{$self->{gauge}}[0];
1480
1481 @$tex{qw(w h)}
1482}
1483
1484sub set_max {
1485 my ($self, $max) = @_;
1486
1487 $self->{max_val} = $max;
1488}
1489
1490sub set_value {
1491 my ($self, $val, $max) = @_;
1492
1493 $self->set_max ($max)
1494 if defined $max;
1495
1496 $max = $self->{max_val};
1497 $self->{val} = $val;
1498
1499 $self->update;
1500}
1501
1502sub _draw {
1503 my ($self) = @_;
1504
1505 my $tex = $tex{$self->{gauge}};
1506
1507 my ($w, $h) = ($self->{w}, $self->{h});
1508
1509 my $ycut = $self->{val} / ($self->{max_val} || 1);
1510 $ycut = 1 if $self->{val} > $self->{max_val};
1511
1512 my $t1 = $tex->[0];
1513 my $t2 = $tex->[1];
1514
1515 glEnable GL_BLEND;
1516 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1517 glEnable GL_TEXTURE_2D;
1518 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1519
1520 my $h1 = $self->{h} - $ycut * $self->{h};
1521 my $h2 = $ycut * $self->{h};
1522
1523 my $yp = 0;
1524
1525 glBindTexture (GL_TEXTURE_2D, $t1->{name});
1526 glBegin (GL_QUADS);
1527 glTexCoord (0, 0); glVertex (0 , $yp);
1528 glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp + $h1);
1529 glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp + $h1);
1530 glTexCoord (1, 0); glVertex (0 + $w, $yp);
1531 glEnd ();
1532
1533 $yp += $h1;
1534
1535 glBindTexture (GL_TEXTURE_2D, $t2->{name});
1536 glBegin (GL_QUADS);
1537 glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp);
1538 glTexCoord (0, 1); glVertex (0 , $yp + $h2);
1539 glTexCoord (1, 1); glVertex (0 + $w, $yp + $h2);
1540 glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp);
1541 glEnd ();
1542
1543 glDisable GL_BLEND;
1544 glDisable GL_TEXTURE_2D;
1375} 1545}
1376 1546
1377############################################################################# 1547#############################################################################
1378 1548
1379package CFClient::UI::Slider; 1549package CFClient::UI::Slider;
1575} 1745}
1576 1746
1577sub size_allocate { 1747sub size_allocate {
1578 my ($self, $x, $y, $w, $h) = @_; 1748 my ($self, $x, $y, $w, $h) = @_;
1579 1749
1580 $self->SUPER::size_allocate ($x, $y, $w, $h); 1750 $self->SUPER::size_allocate ($x, $y, $w, $h) or return;
1581 1751
1582 $self->{layout}->set_height ($self->{fontsize}); 1752 $self->{layout}->set_height ($self->{fontsize});
1583 $self->{layout}->set_width ($self->{w}); 1753 $self->{layout}->set_width ($self->{w});
1584 1754
1585 $self->reflow; 1755 $self->reflow;
1756 $self->update;
1586} 1757}
1587 1758
1588sub add_paragraph { 1759sub add_paragraph {
1589 my ($self, $color, $text) = @_; 1760 my ($self, $color, $text) = @_;
1590 1761
1875 2046
1876 my $mod = $ev->key_mod; 2047 my $mod = $ev->key_mod;
1877 my $sym = $ev->key_sym; 2048 my $sym = $ev->key_sym;
1878 2049
1879 if ($sym == SDLK_KP5) { 2050 if ($sym == SDLK_KP5) {
1880 $::CONN->user_send ("command stay fire"); 2051 $::CONN->user_send ("stay fire");
1881 } elsif ($sym == SDLK_a) { 2052 } elsif ($sym == SDLK_a) {
1882 $::CONN->user_send ("command apply"); 2053 $::CONN->user_send ("apply");
1883 } elsif ($sym == SDLK_QUOTE) { 2054 } elsif ($sym == SDLK_QUOTE) {
1884 $self->emit ('activate_console'); 2055 $self->emit ('activate_console');
1885 } elsif ($sym == SDLK_SLASH) { 2056 } elsif ($sym == SDLK_SLASH) {
1886 $self->emit ('activate_console' => '/'); 2057 $self->emit ('activate_console' => '/');
1887 } elsif (exists $DIR{$sym}) { 2058 } elsif (exists $DIR{$sym}) {
1888 if ($mod & KMOD_SHIFT) { 2059 if ($mod & KMOD_SHIFT) {
1889 $self->{shft}++; 2060 $self->{shft}++;
1890 $::CONN->user_send ("command fire $DIR{$sym}[0]"); 2061 $::CONN->user_send ("fire $DIR{$sym}[0]");
1891 } elsif ($mod & KMOD_CTRL) { 2062 } elsif ($mod & KMOD_CTRL) {
1892 $self->{ctrl}++; 2063 $self->{ctrl}++;
1893 $::CONN->user_send ("command run $DIR{$sym}[0]"); 2064 $::CONN->user_send ("run $DIR{$sym}[0]");
1894 } else { 2065 } else {
1895 $::CONN->user_send ("command $DIR{$sym}[1]"); 2066 $::CONN->user_send ("$DIR{$sym}[1]");
1896 } 2067 }
1897 } 2068 }
1898} 2069}
1899 2070
1900sub key_up { 2071sub key_up {
1902 2073
1903 my $mod = $ev->key_mod; 2074 my $mod = $ev->key_mod;
1904 my $sym = $ev->key_sym; 2075 my $sym = $ev->key_sym;
1905 2076
1906 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { 2077 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) {
1907 $::CONN->user_send ("command fire_stop"); 2078 $::CONN->user_send ("fire_stop");
1908 } 2079 }
1909 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { 2080 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) {
1910 $::CONN->user_send ("command run_stop"); 2081 $::CONN->user_send ("run_stop");
1911 } 2082 }
1912} 2083}
1913 2084
1914############################################################################# 2085#############################################################################
1915 2086
1998 2169
1999our @ISA = CFClient::UI::Container::; 2170our @ISA = CFClient::UI::Container::;
2000 2171
2001use SDL::OpenGL; 2172use SDL::OpenGL;
2002 2173
2174sub check_size {
2175 my ($self) = @_;
2176
2177 $self->size_allocate (0, 0, $::WITH, $::HEIGHT);
2178}
2179
2003sub size_request { 2180sub size_request {
2004 ($::WIDTH, $::HEIGHT) 2181 ($::WIDTH, $::HEIGHT)
2005} 2182}
2006 2183
2007sub size_allocate { 2184sub size_allocate {
2020} 2197}
2021 2198
2022sub update { 2199sub update {
2023 my ($self) = @_; 2200 my ($self) = @_;
2024 2201
2025 $self->size_allocate (0, 0, $::WIDTH, $::HEIGHT); 2202 $self->check_size;
2026 ::refresh (); 2203 ::refresh ();
2027} 2204}
2028 2205
2029sub add { 2206sub add {
2030 my ($self, $widget) = @_; 2207 my ($self, $widget) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines