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.116 by root, Sat Apr 15 21:16:50 2006 UTC vs.
Revision 1.124 by elmex, Mon Apr 17 20:29:37 2006 UTC

112 $self 112 $self
113} 113}
114 114
115sub move { 115sub move {
116 my ($self, $x, $y, $z) = @_; 116 my ($self, $x, $y, $z) = @_;
117 $self->{x} = $x; 117 $self->{x} = int $x;
118 $self->{y} = $y; 118 $self->{y} = int $y;
119 $self->{z} = $z if defined $z; 119 $self->{z} = $z if defined $z;
120} 120}
121 121
122sub needs_redraw { 122sub needs_redraw {
123 0 123 0
176 176
177 return if $FOCUS == $self; 177 return if $FOCUS == $self;
178 return unless $self->{can_focus}; 178 return unless $self->{can_focus};
179 179
180 my $focus = $FOCUS; $FOCUS = $self; 180 my $focus = $FOCUS; $FOCUS = $self;
181
182 $self->emit (focus_in => $focus);
183
181 $focus->update if $focus; 184 $focus->update if $focus;
182 $FOCUS->update; 185 $FOCUS->update;
183} 186}
184 187
185sub focus_out { 188sub focus_out {
186 my ($self) = @_; 189 my ($self) = @_;
187 190
188 return unless $FOCUS == $self; 191 return unless $FOCUS == $self;
189 192
190 my $focus = $FOCUS; undef $FOCUS; 193 my $focus = $FOCUS; undef $FOCUS;
194
195 $self->emit (focus_out => $focus);
196
191 $focus->update if $focus; #? 197 $focus->update if $focus; #?
192} 198}
193 199
194sub mouse_motion { } 200sub mouse_motion { }
195sub button_up { } 201sub button_up { }
219 glPopMatrix; 225 glPopMatrix;
220 226
221 if ($self == $HOVER && $self->{can_hover}) { 227 if ($self == $HOVER && $self->{can_hover}) {
222 my ($x, $y) = @$self{qw(x y)}; 228 my ($x, $y) = @$self{qw(x y)};
223 229
224 glColor 0, 0, 1, 0.2; 230 glColor 1, 0.8, 0.5, 0.2;
225 glEnable GL_BLEND; 231 glEnable GL_BLEND;
226 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 232 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
227 glBegin GL_QUADS; 233 glBegin GL_QUADS;
228 glVertex $x , $y; 234 glVertex $x , $y;
229 glVertex $x + $self->{w}, $y; 235 glVertex $x + $self->{w}, $y;
565 # TODO: user_x, user_y, overwrite moveto? 571 # TODO: user_x, user_y, overwrite moveto?
566 572
567 $class->SUPER::new ( 573 $class->SUPER::new (
568 bg => [1, 1, 1, 1], 574 bg => [1, 1, 1, 1],
569 border_bg => [1, 1, 1, 1], 575 border_bg => [1, 1, 1, 1],
570 border => $::FONTSIZE * 0.8, 576 border => int $::FONTSIZE * 0.8,
571 @_ 577 @_
572 ) 578 )
573} 579}
574 580
575sub size_request { 581sub size_request {
956 padding => 2, 962 padding => 2,
957 layout => new CFClient::Layout, 963 layout => new CFClient::Layout,
958 %arg 964 %arg
959 ); 965 );
960 966
961 $self->set_text ($self->{text}); 967 $self->{xxx}++ if $self->{text} eq "Client Setup" && $self->{align};#d#
968
969 $self->set_text (delete $self->{text}) if exists $self->{text};
970 $self->set_markup (delete $self->{markup}) if exists $self->{markup};
962 971
963 $self 972 $self
964} 973}
965 974
966sub escape_text { 975sub escape_text {
974} 983}
975 984
976sub set_text { 985sub set_text {
977 my ($self, $text) = @_; 986 my ($self, $text) = @_;
978 987
979 $self->{text} = $text;
980 $self->{layout}->set_markup ($text); 988 $self->{layout}->set_text ($text);
981 989
982 delete $self->{texture}; 990 delete $self->{texture};
983# $self->{w} = $self->{h} = -1;
984 $self->update; 991 $self->update;
985} 992}
986 993
987sub get_text { 994sub set_markup {
988 my ($self, $text) = @_; 995 my ($self, $markup) = @_;
989 996
990 $self->{text} 997 $self->{layout}->set_markup ($markup);
998
999 delete $self->{texture};
1000 $self->update;
991} 1001}
992 1002
993sub size_request { 1003sub size_request {
994 my ($self) = @_; 1004 my ($self) = @_;
995 1005
996 $self->{layout}->set_width; 1006 $self->{layout}->set_width;
997 $self->{layout}->set_height ($self->{fontsize}); 1007 $self->{layout}->set_height ($self->{fontsize});
1008
998 my ($w, $h) = $self->{layout}->size; 1009 my ($w, $h) = $self->{layout}->size;
999 1010
1000 ( 1011 (
1001 $w + $self->{padding} * 2, 1012 $w + $self->{padding} * 2,
1002 $h + $self->{padding} * 2, 1013 $h + $self->{padding} * 2,
1021sub _draw { 1032sub _draw {
1022 my ($self) = @_; 1033 my ($self) = @_;
1023 1034
1024 my $tex = $self->{texture} ||= do { 1035 my $tex = $self->{texture} ||= do {
1025 $self->{layout}->set_width ($self->{w}); 1036 $self->{layout}->set_width ($self->{w});
1026 $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{fontsize}); 1037 $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize});
1027 new_from_layout CFClient::Texture $self->{layout} 1038 new_from_layout CFClient::Texture $self->{layout}
1028 }; 1039 };
1029 1040
1030 glEnable GL_BLEND; 1041 glEnable GL_BLEND;
1031 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1042 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1032 glEnable GL_TEXTURE_2D; 1043 glEnable GL_TEXTURE_2D;
1033 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1044 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1034 1045
1035 glColor @{$self->{fg}}; 1046 glColor @{$self->{fg}};
1036 1047
1037 my $x = 1048 $self->{ox} = int (
1038 $self->{align} < 0 ? $self->{padding} 1049 $self->{align} < 0 ? $self->{padding}
1039 : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} 1050 : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding}
1040 : ($self->{w} - $tex->{w}) * 0.5; 1051 : ($self->{w} - $tex->{w}) * 0.5
1052 );
1041 1053
1042 my $y = 1054 $self->{oy} = int (
1043 $self->{valign} < 0 ? $self->{padding} 1055 $self->{valign} < 0 ? $self->{padding}
1044 : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} 1056 : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding}
1045 : ($self->{h} - $tex->{h}) * 0.5; 1057 : ($self->{h} - $tex->{h}) * 0.5
1058 );
1046 1059
1047 $tex->draw_quad (int $x, int $y); 1060 $tex->draw_quad ($self->{ox}, $self->{oy});
1048 1061
1049 glDisable GL_TEXTURE_2D; 1062 glDisable GL_TEXTURE_2D;
1050 glDisable GL_BLEND; 1063 glDisable GL_BLEND;
1051} 1064}
1052 1065
1053############################################################################# 1066#############################################################################
1054 1067
1055package CFClient::UI::Entry; 1068package CFClient::UI::EntryBase;
1056 1069
1057our @ISA = CFClient::UI::Label::; 1070our @ISA = CFClient::UI::Label::;
1058 1071
1059use SDL; 1072use SDL;
1060use SDL::OpenGL; 1073use SDL::OpenGL;
1075} 1088}
1076 1089
1077sub _set_text { 1090sub _set_text {
1078 my ($self, $text) = @_; 1091 my ($self, $text) = @_;
1079 1092
1080 my $old_text = $self->{text}; 1093 delete $self->{cur_h};
1094
1095 return if $self->{text} eq $text;
1081 1096
1082 $self->{last_activity} = $::NOW; 1097 $self->{last_activity} = $::NOW;
1083
1084 $self->{text} = $text; 1098 $self->{text} = $text;
1085 $self->{layout}->set_width ($self->{w});
1086 $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{fontsize});
1087 1099
1088 $text =~ s/./*/g if $self->{hidden}; 1100 $text =~ s/./*/g if $self->{hidden};
1101 $self->{layout}->set_text ("$text ");
1089 1102
1090 $self->{layout}->set_markup ($self->escape_text ($text) . " "); 1103 $self->emit (changed => $self->{text});
1104}
1091 1105
1092 $text = substr $text, 0, $self->{cursor}; 1106sub get_text {
1093 utf8::encode $text; 1107 $_[0]{text}
1094
1095 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text);
1096
1097 $self->emit (changed => $self->{text}) # XXX: is this the right place to do this?
1098 if $old_text ne $self->{text};
1099} 1108}
1100 1109
1101sub size_request { 1110sub size_request {
1102 my ($self) = @_; 1111 my ($self) = @_;
1103 1112
1207 1216
1208 $self->SUPER::_draw; 1217 $self->SUPER::_draw;
1209 1218
1210 #TODO: force update every cursor change :( 1219 #TODO: force update every cursor change :(
1211 if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) { 1220 if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) {
1221
1222 unless (exists $self->{cur_h}) {
1223 my $text = substr $self->{text}, 0, $self->{cursor};
1224 utf8::encode $text;
1225
1226 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text)
1227 }
1228
1212 glColor @{$self->{fg}}; 1229 glColor @{$self->{fg}};
1213 glBegin GL_LINES; 1230 glBegin GL_LINES;
1214 glVertex $self->{cur_x}, $self->{cur_y};
1215 glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h}; 1231 glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy};
1232 glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h};
1216 glEnd; 1233 glEnd;
1217 } 1234 }
1218} 1235}
1219 1236
1220package CFClient::UI::LineEntry; 1237package CFClient::UI::Entry;
1221 1238
1222our @ISA = CFClient::UI::Entry::; 1239our @ISA = CFClient::UI::EntryBase::;
1223 1240
1224use SDL; 1241use SDL;
1225use SDL::OpenGL; 1242use SDL::OpenGL;
1226 1243
1227sub key_down { 1244sub key_down {
1257 1274
1258 $class->SUPER::new ( 1275 $class->SUPER::new (
1259 padding => 4, 1276 padding => 4,
1260 fg => [1, 1, 1], 1277 fg => [1, 1, 1],
1261 bg => [1, 1, 1, 0.2], 1278 bg => [1, 1, 1, 0.2],
1262 active_fg => [1, 1, 0], 1279 active_fg => [0, 0, 1],
1263 can_hover => 1, 1280 can_hover => 1,
1264 @_ 1281 @_
1265 ) 1282 )
1266} 1283}
1267 1284
1276 1293
1277sub _draw { 1294sub _draw {
1278 my ($self) = @_; 1295 my ($self) = @_;
1279 1296
1280 local $self->{fg} = $self->{fg}; 1297 local $self->{fg} = $self->{fg};
1281 my $tex = $tex[0];
1282
1283 glEnable GL_BLEND;
1284 glEnable GL_TEXTURE_2D;
1285 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1286 1298
1287 if ($GRAB == $self) { 1299 if ($GRAB == $self) {
1288 $self->{fg} = $self->{active_fg}; 1300 $self->{fg} = $self->{active_fg};
1289 } 1301 }
1290 1302
1291 glBindTexture GL_TEXTURE_2D, $tex->{name}; 1303 glEnable GL_BLEND;
1304 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1305 glEnable GL_TEXTURE_2D;
1292 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1306 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1307 glColor 0, 0, 0, 1;
1293 1308
1294 $tex->draw_quad (0, 0, $self->{w}, $self->{h}); 1309 $tex[0]->draw_quad (0, 0, $self->{w}, $self->{h});
1295 1310
1296 glDisable GL_TEXTURE_2D; 1311 glDisable GL_TEXTURE_2D;
1297 glDisable GL_BLEND; 1312 glDisable GL_BLEND;
1298 1313
1299 $self->SUPER::_draw; 1314 $self->SUPER::_draw;
1366 1381
1367 $tex->draw_quad (0, 0, $s, $s); 1382 $tex->draw_quad (0, 0, $s, $s);
1368 1383
1369 glDisable GL_TEXTURE_2D; 1384 glDisable GL_TEXTURE_2D;
1370 glDisable GL_BLEND; 1385 glDisable GL_BLEND;
1386}
1387
1388#############################################################################
1389
1390package CFClient::UI::VGauge;
1391
1392our @ISA = CFClient::UI::Base::;
1393
1394use SDL::OpenGL;
1395
1396my %tex = (
1397 food => [
1398 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1399 qw/g1_food_gauge_empty.png g1_food_gauge_full.png/
1400 ],
1401 grace => [
1402 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1403 qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/
1404 ],
1405 hp => [
1406 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1407 qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/
1408 ],
1409 mana => [
1410 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1411 qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/
1412 ],
1413);
1414
1415# eg. VGauge->new (gauge => 'food'), default gauge: food
1416sub new {
1417 my $class = shift;
1418
1419 my $self = $class->SUPER::new (gauge => 'food', @_);
1420
1421 $self
1422}
1423
1424sub size_request {
1425 my ($self) = @_;
1426
1427 ($self->{w}, $self->{h})
1428}
1429
1430sub set_max {
1431 my ($self, $max) = @_;
1432 $self->{max_val} = $max;
1433}
1434
1435sub set_value {
1436 my ($self, $val, $max) = @_;
1437
1438 $self->set_max ($max)
1439 if defined $max;
1440
1441 $max = $self->{max_val};
1442 $self->{val} = $val;
1443
1444 $self->update;
1445}
1446
1447sub _draw {
1448 my ($self) = @_;
1449
1450 my $tex = $tex{$self->{gauge}};
1451
1452 my ($w, $h) = ($self->{w}, $self->{h});
1453
1454 my $ycut = $self->{val} / ($self->{max_val} || 1);
1455 $ycut = 1 if $self->{val} > $self->{max_val};
1456
1457 my $t1 = $tex->[0];
1458 my $t2 = $tex->[1];
1459
1460 glEnable GL_BLEND;
1461 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1462 glEnable GL_TEXTURE_2D;
1463 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1464
1465 my $h1 = $self->{h} - $ycut * $self->{h};
1466 my $h2 = $ycut * $self->{h};
1467
1468 my $yp = 0;
1469
1470 glBindTexture (GL_TEXTURE_2D, $t1->{name});
1471 glBegin (GL_QUADS);
1472 glTexCoord (0, 0); glVertex (0 , $yp);
1473 glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp + $h1);
1474 glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp + $h1);
1475 glTexCoord (1, 0); glVertex (0 + $w, $yp);
1476 glEnd ();
1477
1478 $yp += $h1;
1479
1480 glBindTexture (GL_TEXTURE_2D, $t2->{name});
1481 glBegin (GL_QUADS);
1482 glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp);
1483 glTexCoord (0, 1); glVertex (0 , $yp + $h2);
1484 glTexCoord (1, 1); glVertex (0 + $w, $yp + $h2);
1485 glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp);
1486 glEnd ();
1487
1488 glDisable GL_BLEND;
1489 glDisable GL_TEXTURE_2D;
1371} 1490}
1372 1491
1373############################################################################# 1492#############################################################################
1374 1493
1375package CFClient::UI::Slider; 1494package CFClient::UI::Slider;
1781 0.1, 0.1, 0.1, 1900 0.1, 0.1, 0.1,
1782 ; 1901 ;
1783 glEnable GL_CONVOLUTION_2D; 1902 glEnable GL_CONVOLUTION_2D;
1784 } 1903 }
1785 1904
1786 my $tex = new CFClient::Texture 1905 $self->{fow_texture} = new CFClient::Texture
1787 w => $w, 1906 w => $w,
1788 h => $h, 1907 h => $h,
1789 data => $data, 1908 data => $data,
1790 internalformat => GL_ALPHA, 1909 internalformat => GL_ALPHA,
1791 format => GL_ALPHA; 1910 format => GL_ALPHA;
1796 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1915 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1797 glEnable GL_TEXTURE_2D; 1916 glEnable GL_TEXTURE_2D;
1798 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 1917 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
1799 1918
1800 glColor +($::CFG->{fow_intensity}) x 3, 1; 1919 glColor +($::CFG->{fow_intensity}) x 3, 1;
1801 $tex->draw_quad (0, 0, $w * 32, $h * 32); 1920 $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32);
1802 1921
1803 glDisable GL_TEXTURE_2D; 1922 glDisable GL_TEXTURE_2D;
1804 glDisable GL_BLEND; 1923 glDisable GL_BLEND;
1805 } 1924 }
1806 1925
1812 glEnable GL_BLEND; 1931 glEnable GL_BLEND;
1813 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1932 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1814 glEnable GL_TEXTURE_2D; 1933 glEnable GL_TEXTURE_2D;
1815 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1934 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1816 1935
1936 $self->{mapmap_texture} =
1817 CFClient::Texture->new ( 1937 new CFClient::Texture
1818 w => $w, 1938 w => $w,
1819 h => $h, 1939 h => $h,
1820 data => $::MAP->mapmap ($w, $h), 1940 data => $::MAP->mapmap ($w, $h),
1821 type => GL_UNSIGNED_INT_8_8_8_8_REV 1941 type => GL_UNSIGNED_INT_8_8_8_8_REV;
1822 )->draw_quad (100, 100); 1942
1943 $self->{mapmap_texture}->draw_quad (100, 100);
1823 1944
1824 glDisable GL_TEXTURE_2D; 1945 glDisable GL_TEXTURE_2D;
1825 glDisable GL_BLEND; 1946 glDisable GL_BLEND;
1826 } 1947 }
1827 # HACK END 1948 # HACK END
1869 1990
1870 my $mod = $ev->key_mod; 1991 my $mod = $ev->key_mod;
1871 my $sym = $ev->key_sym; 1992 my $sym = $ev->key_sym;
1872 1993
1873 if ($sym == SDLK_KP5) { 1994 if ($sym == SDLK_KP5) {
1874 $::CONN->user_send ("command stay fire"); 1995 $::CONN->user_send ("stay fire");
1875 } elsif ($sym == SDLK_a) { 1996 } elsif ($sym == SDLK_a) {
1876 $::CONN->user_send ("command apply"); 1997 $::CONN->user_send ("apply");
1877 } elsif ($sym == SDLK_QUOTE) { 1998 } elsif ($sym == SDLK_QUOTE) {
1878 $self->emit ('activate_console'); 1999 $self->emit ('activate_console');
1879 } elsif ($sym == SDLK_SLASH) { 2000 } elsif ($sym == SDLK_SLASH) {
1880 $self->emit ('activate_console' => '/'); 2001 $self->emit ('activate_console' => '/');
1881 } elsif (exists $DIR{$sym}) { 2002 } elsif (exists $DIR{$sym}) {
1882 if ($mod & KMOD_SHIFT) { 2003 if ($mod & KMOD_SHIFT) {
1883 $self->{shft}++; 2004 $self->{shft}++;
1884 $::CONN->user_send ("command fire $DIR{$sym}[0]"); 2005 $::CONN->user_send ("fire $DIR{$sym}[0]");
1885 } elsif ($mod & KMOD_CTRL) { 2006 } elsif ($mod & KMOD_CTRL) {
1886 $self->{ctrl}++; 2007 $self->{ctrl}++;
1887 $::CONN->user_send ("command run $DIR{$sym}[0]"); 2008 $::CONN->user_send ("run $DIR{$sym}[0]");
1888 } else { 2009 } else {
1889 $::CONN->user_send ("command $DIR{$sym}[1]"); 2010 $::CONN->user_send ("$DIR{$sym}[1]");
1890 } 2011 }
1891 } 2012 }
1892} 2013}
1893 2014
1894sub key_up { 2015sub key_up {
1896 2017
1897 my $mod = $ev->key_mod; 2018 my $mod = $ev->key_mod;
1898 my $sym = $ev->key_sym; 2019 my $sym = $ev->key_sym;
1899 2020
1900 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { 2021 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) {
1901 $::CONN->user_send ("command fire_stop"); 2022 $::CONN->user_send ("fire_stop");
1902 } 2023 }
1903 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { 2024 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) {
1904 $::CONN->user_send ("command run_stop"); 2025 $::CONN->user_send ("run_stop");
1905 } 2026 }
1906} 2027}
1907 2028
1908############################################################################# 2029#############################################################################
1909 2030
2023sub add { 2144sub add {
2024 my ($self, $widget) = @_; 2145 my ($self, $widget) = @_;
2025 2146
2026 $self->SUPER::add ($widget); 2147 $self->SUPER::add ($widget);
2027 2148
2028 $widget->size_allocate ($widget->{x}, $widget->{y}, $widget->size_request); 2149 $widget->size_allocate (int $widget->{x}, int $widget->{y}, $widget->size_request);
2029} 2150}
2030 2151
2031sub on_refresh { 2152sub on_refresh {
2032 my ($self, $id, $cb) = @_; 2153 my ($self, $id, $cb) = @_;
2033 2154

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines