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.194 by root, Thu May 11 23:41:47 2006 UTC vs.
Revision 1.197 by root, Fri May 12 01:47:04 2006 UTC

24 24
25 my $tip = $widget->{tooltip}; 25 my $tip = $widget->{tooltip};
26 26
27 $tip = $tip->($widget) if CODE:: eq ref $tip; 27 $tip = $tip->($widget) if CODE:: eq ref $tip;
28 28
29 $TOOLTIP->set_markup ($widget->{tooltip}); 29 $TOOLTIP->set_tooltip_from ($widget);
30
31 $TOOLTIP->show; 30 $TOOLTIP->show;
32 31
33 my ($x, $y) = $widget->coord2global ($widget->{w}, 0); 32 my ($x, $y) = $widget->coord2global ($widget->{w}, 0);
34 33
35 if ($x + $TOOLTIP->{w} > $::WIDTH) { 34 if ($x + $TOOLTIP->{w} > $::WIDTH) {
36 ($x, $y) = $widget->coord2global (-$TOOLTIP->{w}, 0); 35 ($x, $y) = $widget->coord2global (-$TOOLTIP->{w}, 0);
37 } 36 }
38 37
39 $TOOLTIP->move ($x, $y); 38 $TOOLTIP->move ($x, $y);
39 $TOOLTIP->check_size;
40 $TOOLTIP->update;
40 } 41 }
41 42
42 return; 43 return;
43 } 44 }
44 } 45 }
388 $self->check_size 389 $self->check_size
389 unless exists $self->{req_w}; 390 unless exists $self->{req_w};
390} 391}
391 392
392sub check_size { 393sub check_size {
393 my ($self) = @_; 394 my ($self, $forced) = @_;
394 395
396 $self->{force_alloc} = 1 if $forced;
395 $CFClient::UI::ROOT->{check_size}{$self} = $self; 397 $CFClient::UI::ROOT->{check_size}{$self} = $self;
396} 398}
397 399
398sub update { 400sub update {
399 my ($self) = @_; 401 my ($self) = @_;
509 $self->{children} = [ 511 $self->{children} = [
510 sort { $a->{z} <=> $b->{z} } 512 sort { $a->{z} <=> $b->{z} }
511 @{$self->{children}}, @widgets 513 @{$self->{children}}, @widgets
512 ]; 514 ];
513 515
514 $self->check_size; 516 $self->check_size (1);
515 $self->update; 517 $self->update;
516} 518}
517 519
518sub children { 520sub children {
519 @{ $_[0]{children} } 521 @{ $_[0]{children} }
785 787
786our @ISA = CFClient::UI::Bin::; 788our @ISA = CFClient::UI::Bin::;
787 789
788use CFClient::OpenGL; 790use CFClient::OpenGL;
789 791
790sub new {
791 my $class = shift;
792
793 my $self = $class->SUPER::new (
794 bg => [1, 1, 1, 1],
795 border_bg => [1, 1, 1, 1],
796 border => 0.8,
797 @_
798 );
799
800 $self
801}
802
803sub _draw {
804 my ($self) = @_;
805
806 my ($w, $h) = ($self->{w}, $self->{h});
807
808 glEnable GL_BLEND;
809 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
810 glEnable GL_TEXTURE_2D;
811 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
812
813# glBegin GL_QUADS;
814# glColor 0, 0, 0, 0;
815# glVertex 0 , 0;
816# glVertex 0 , $h;
817# glVertex $w, $h;
818# glVertex $w, 0;
819# glEnd;
820
821
822 $self->child->draw;
823 glDisable GL_BLEND;
824 glDisable GL_TEXTURE_2D;
825}
826
827############################################################################# 792#############################################################################
828 793
829package CFClient::UI::FancyFrame; 794package CFClient::UI::FancyFrame;
830 795
831our @ISA = CFClient::UI::Bin::; 796our @ISA = CFClient::UI::Bin::;
945 my ($self) = @_; 910 my ($self) = @_;
946 911
947 my ($w, $h ) = ($self->{w}, $self->{h}); 912 my ($w, $h ) = ($self->{w}, $self->{h});
948 my ($cw, $ch) = ($self->child->{w}, $self->child->{h}); 913 my ($cw, $ch) = ($self->child->{w}, $self->child->{h});
949 914
950 glEnable GL_BLEND;
951 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
952 glEnable GL_TEXTURE_2D; 915 glEnable GL_TEXTURE_2D;
953 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 916 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
954 917
955 my $border = $self->border; 918 my $border = $self->border;
956 919
957 glColor @{ $self->{border_bg} }; 920 glColor @{ $self->{border_bg} };
958 $tex[1]->draw_quad (0, 0, $w, $border); 921 $tex[1]->draw_quad_alpha (0, 0, $w, $border);
959 $tex[3]->draw_quad (0, $border, $border, $ch); 922 $tex[3]->draw_quad_alpha (0, $border, $border, $ch);
960 $tex[2]->draw_quad ($w - $border, $border, $border, $ch); 923 $tex[2]->draw_quad_alpha ($w - $border, $border, $border, $ch);
961 $tex[4]->draw_quad (0, $h - $border, $w, $border); 924 $tex[4]->draw_quad_alpha (0, $h - $border, $w, $border);
962 925
963 if (@{$self->{bg}} < 4 || $self->{bg}[3]) { 926 if (@{$self->{bg}} < 4 || $self->{bg}[3]) {
964 my $bg = $tex[0]; 927 my $bg = $tex[0];
965 928
966 # TODO: repeat texture not scale 929 # TODO: repeat texture not scale
970 glColor @{ $self->{bg} }; 933 glColor @{ $self->{bg} };
971 934
972 $bg->{s} = $rep_x; 935 $bg->{s} = $rep_x;
973 $bg->{t} = $rep_y; 936 $bg->{t} = $rep_y;
974 $bg->{wrap_mode} = 1; 937 $bg->{wrap_mode} = 1;
975 $bg->draw_quad ($border, $border, $cw, $ch); 938 $bg->draw_quad_alpha ($border, $border, $cw, $ch);
939 }
976 940
977 glDisable GL_TEXTURE_2D; 941 glDisable GL_TEXTURE_2D;
978 glDisable GL_BLEND;
979 }
980 942
981 $self->{title}->draw if $self->{title}; 943 $self->{title}->draw if $self->{title};
982 944
983 $self->child->draw; 945 $self->child->draw;
984} 946}
1672 1634
1673 if ($GRAB == $self) { 1635 if ($GRAB == $self) {
1674 $self->{fg} = $self->{active_fg}; 1636 $self->{fg} = $self->{active_fg};
1675 } 1637 }
1676 1638
1677 glEnable GL_BLEND;
1678 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1679 glEnable GL_TEXTURE_2D; 1639 glEnable GL_TEXTURE_2D;
1680 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1640 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1681 glColor 0, 0, 0, 1; 1641 glColor 0, 0, 0, 1;
1682 1642
1683 $tex[0]->draw_quad (0, 0, $self->{w}, $self->{h}); 1643 $tex[0]->draw_quad_alpha (0, 0, $self->{w}, $self->{h});
1684 1644
1685 glDisable GL_TEXTURE_2D; 1645 glDisable GL_TEXTURE_2D;
1686 glDisable GL_BLEND;
1687 1646
1688 $self->SUPER::_draw; 1647 $self->SUPER::_draw;
1689} 1648}
1690 1649
1691############################################################################# 1650#############################################################################
1738 1697
1739 my $s = (List::Util::min @$self{qw(w h)}) - $self->{padding} * 2; 1698 my $s = (List::Util::min @$self{qw(w h)}) - $self->{padding} * 2;
1740 1699
1741 glColor @{ $FOCUS == $self ? $self->{active_fg} : $self->{fg} }; 1700 glColor @{ $FOCUS == $self ? $self->{active_fg} : $self->{fg} };
1742 1701
1743 glEnable GL_BLEND; 1702 my $tex = $self->{state} ? $tex[1] : $tex[0];
1703
1744 glEnable GL_TEXTURE_2D; 1704 glEnable GL_TEXTURE_2D;
1745 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1746
1747 my $tex = $self->{state} ? $tex[1] : $tex[0];
1748
1749 $tex->draw_quad (0, 0, $s, $s); 1705 $tex->draw_quad_alpha (0, 0, $s, $s);
1750
1751 glDisable GL_TEXTURE_2D; 1706 glDisable GL_TEXTURE_2D;
1752 glDisable GL_BLEND;
1753} 1707}
1754 1708
1755############################################################################# 1709#############################################################################
1756 1710
1757package CFClient::UI::Image; 1711package CFClient::UI::Image;
1800 glTranslate 0, -$self->{w}, 0; 1754 glTranslate 0, -$self->{w}, 0;
1801 1755
1802 ($w, $h) = ($h, $w); 1756 ($w, $h) = ($h, $w);
1803 } 1757 }
1804 1758
1805 glEnable GL_BLEND;
1806 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1807 glEnable GL_TEXTURE_2D; 1759 glEnable GL_TEXTURE_2D;
1808 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1760 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1809 1761
1810 $tex->draw_quad (0, 0, $w, $h); 1762 $tex->draw_quad_alpha (0, 0, $w, $h);
1811 1763
1812 glDisable GL_BLEND;
1813 glDisable GL_TEXTURE_2D; 1764 glDisable GL_TEXTURE_2D;
1814} 1765}
1815 1766
1816############################################################################# 1767#############################################################################
1817 1768
2109 $page ||= 2; 2060 $page ||= 2;
2110 2061
2111 my $knob_a = $inner_pad_px + ($value - $page * 0.5); 2062 my $knob_a = $inner_pad_px + ($value - $page * 0.5);
2112 my $knob_b = $inner_pad_px + ($value + $page * 0.5); 2063 my $knob_b = $inner_pad_px + ($value + $page * 0.5);
2113 2064
2114 glEnable GL_BLEND;
2115 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
2116 glEnable GL_TEXTURE_2D; 2065 glEnable GL_TEXTURE_2D;
2117 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2066 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2118 2067
2119 # draw background 2068 # draw background
2120 $tex[1]->draw_quad (0, 0, $w, $h); 2069 $tex[1]->draw_quad_alpha (0, 0, $w, $h);
2121 2070
2122 # draw handle 2071 # draw handle
2123 $tex[0]->draw_quad ($knob_a, 0, $knob_b - $knob_a, $h); 2072 $tex[0]->draw_quad_alpha ($knob_a, 0, $knob_b - $knob_a, $h);
2124 2073
2125 glDisable GL_BLEND;
2126 glDisable GL_TEXTURE_2D; 2074 glDisable GL_TEXTURE_2D;
2127} 2075}
2128 2076
2129############################################################################# 2077#############################################################################
2130 2078
2141 fontsize => 1, 2089 fontsize => 1,
2142 can_events => 0, 2090 can_events => 0,
2143 #font => default_font 2091 #font => default_font
2144 @_, 2092 @_,
2145 2093
2146 layout => (new CFClient::Layout), 2094 layout => (new CFClient::Layout 1),
2147 par => [], 2095 par => [],
2148 height => 0, 2096 height => 0,
2149 children => [ 2097 children => [
2150 (new CFClient::UI::Empty expand => 1), 2098 (new CFClient::UI::Empty expand => 1),
2151 (new CFClient::UI::Slider vertical => 1), 2099 (new CFClient::UI::Slider vertical => 1),
2169 2117
2170 my $layout = $self->{layout}; 2118 my $layout = $self->{layout};
2171 2119
2172 $layout->set_height ($self->{fontsize} * $::FONTSIZE); 2120 $layout->set_height ($self->{fontsize} * $::FONTSIZE);
2173 $layout->set_width ($self->{children}[0]{w}); 2121 $layout->set_width ($self->{children}[0]{w});
2174 $layout->set_text ($text); 2122 $layout->set_markup ($text);
2175 2123
2176 ($layout->size)[1] 2124 ($layout->size)[1]
2177} 2125}
2178 2126
2179sub reflow { 2127sub reflow {
2235 2183
2236 $self->{texture} ||= new_from_opengl CFClient::Texture $self->{children}[0]{w}, $self->{children}[0]{h}, sub { 2184 $self->{texture} ||= new_from_opengl CFClient::Texture $self->{children}[0]{w}, $self->{children}[0]{h}, sub {
2237 glClearColor 0, 0, 0, 0; 2185 glClearColor 0, 0, 0, 0;
2238 glClear GL_COLOR_BUFFER_BIT; 2186 glClear GL_COLOR_BUFFER_BIT;
2239 2187
2240 glEnable GL_BLEND;
2241 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
2242 glEnable GL_TEXTURE_2D; 2188 glEnable GL_TEXTURE_2D;
2243 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2189 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2244 2190
2245 my $top = int $self->{children}[1]{range}[0]; 2191 my $top = int $self->{children}[1]{range}[0];
2246 2192
2255 2201
2256 for my $par (@{$self->{par}}) { 2202 for my $par (@{$self->{par}}) {
2257 my $h = $par->[0]; 2203 my $h = $par->[0];
2258 2204
2259 if ($y0 < $y + $h && $y < $y1) { 2205 if ($y0 < $y + $h && $y < $y1) {
2206 $layout->set_foreground (@{ $par->[1] });
2260 $layout->set_text ($par->[2]); 2207 $layout->set_markup ($par->[2]);
2261 2208
2262 glColor @{ $par->[1] };
2263 my ($W, $H) = $layout->size; 2209 my ($W, $H) = $layout->size;
2264 CFClient::Texture->new_from_layout ($layout)->draw_quad (0, $y - $y0); 2210 CFClient::Texture->new_from_layout ($layout)->draw_quad_alpha_premultiplied (0, $y - $y0);
2265 } 2211 }
2266 2212
2267 $y += $h; 2213 $y += $h;
2268 } 2214 }
2269 2215
2270 glDisable GL_TEXTURE_2D; 2216 glDisable GL_TEXTURE_2D;
2271 glDisable GL_BLEND;
2272 }; 2217 };
2273 }); 2218 });
2274} 2219}
2275 2220
2276sub _draw { 2221sub _draw {
2277 my ($self) = @_; 2222 my ($self) = @_;
2278 2223
2279 glEnable GL_BLEND;
2280 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
2281 glEnable GL_TEXTURE_2D; 2224 glEnable GL_TEXTURE_2D;
2282 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2225 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2283 glColor 1, 1, 1, 1; 2226 glColor 1, 1, 1, 1;
2284 $self->{texture}->draw_quad (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); 2227 $self->{texture}->draw_quad_alpha_premultiplied (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h});
2285 glDisable GL_TEXTURE_2D; 2228 glDisable GL_TEXTURE_2D;
2286 glDisable GL_BLEND;
2287 2229
2288 $self->{children}[1]->draw; 2230 $self->{children}[1]->draw;
2289 2231
2290} 2232}
2291 2233
2385 @_, 2327 @_,
2386 can_events => 0, 2328 can_events => 0,
2387 ) 2329 )
2388} 2330}
2389 2331
2390sub set_markup { 2332sub set_tooltip_from {
2391 my ($self, $text) = @_; 2333 my ($self, $widget) = @_;
2392 2334
2393 $self->{label} ||= new CFClient::UI::Label fontsize => 0.8, fg => [0, 0, 0]; 2335 $self->add (new CFClient::UI::Label
2394 $self->{label}->set_markup ($text); 2336 markup => $widget->{tooltip},
2395 $self->add ($self->{label}); 2337 max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH,
2338 fontsize => 0.8,
2339 fg => [0, 0, 0, 1],
2340 font => ($widget->{tooltip_font} || $::FONT_PROP),
2341 );
2396} 2342}
2397 2343
2398sub size_request { 2344sub size_request {
2399 my ($self) = @_; 2345 my ($self) = @_;
2400
2401 $self->child->set_max_size ($::WIDTH * 0.3);
2402 2346
2403 my ($w, $h) = @{$self->child}{qw(req_w req_h)}; 2347 my ($w, $h) = @{$self->child}{qw(req_w req_h)};
2404 2348
2405 ($w + 4, $h + 4) 2349 ($w + 4, $h + 4)
2406} 2350}
2412} 2356}
2413 2357
2414sub _draw { 2358sub _draw {
2415 my ($self) = @_; 2359 my ($self) = @_;
2416 2360
2417 glPushMatrix;
2418 glTranslate 0.375, 0.375; 2361 glTranslate 0.375, 0.375;
2419 2362
2420 my ($w, $h) = @$self{qw(w h)}; 2363 my ($w, $h) = @$self{qw(w h)};
2421 2364
2422 glColor 1, 0.8, 0.4; 2365 glColor 1, 0.8, 0.4;
2433 glVertex 0 , $h; 2376 glVertex 0 , $h;
2434 glVertex $w, $h; 2377 glVertex $w, $h;
2435 glVertex $w, 0; 2378 glVertex $w, 0;
2436 glEnd; 2379 glEnd;
2437 2380
2438 glPopMatrix; 2381 glTranslate 2 - 0.375, 2 - 0.375;
2439
2440 glTranslate 2, 2;
2441 $self->SUPER::_draw; 2382 $self->SUPER::_draw;
2442} 2383}
2443 2384
2444############################################################################# 2385#############################################################################
2445 2386
2468 return unless $::CONN;#d# manage and cache textures differently 2409 return unless $::CONN;#d# manage and cache textures differently
2469 my $tex = $::CONN->{texture}[$::CONN->{faceid}[$self->{face}]]; 2410 my $tex = $::CONN->{texture}[$::CONN->{faceid}[$self->{face}]];
2470 2411
2471 # TODO animation 2412 # TODO animation
2472 if ($tex) { 2413 if ($tex) {
2473 glEnable GL_BLEND;
2474 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
2475 glEnable GL_TEXTURE_2D; 2414 glEnable GL_TEXTURE_2D;
2476 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2415 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2477 glColor 1, 1, 1, 1; 2416 glColor 1, 1, 1, 1;
2478 $tex->draw_quad (0, 0, $self->{w}, $self->{h}); 2417 $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h});
2479 glDisable GL_TEXTURE_2D; 2418 glDisable GL_TEXTURE_2D;
2480 glDisable GL_BLEND;
2481 } 2419 }
2482} 2420}
2483 2421
2484############################################################################# 2422#############################################################################
2485 2423
2675 while (my ($k, $v) = each %{ $self->{item} }) { 2613 while (my ($k, $v) = each %{ $self->{item} }) {
2676 delete $self->{item}{$k} if $v->{timeout} < $NOW; 2614 delete $self->{item}{$k} if $v->{timeout} < $NOW;
2677 } 2615 }
2678 2616
2679 my @widgets; 2617 my @widgets;
2680 my @items = sort { $a->{time} <=> $b->{time} } values %{ $self->{item} }; 2618
2619 my @items = sort {
2620 $a->{pri} <=> $b->{pri}
2621 or $b->{id} <=> $a->{id}
2622 } values %{ $self->{item} };
2623
2681 my $count = 10 + 1; 2624 my $count = 10 + 1;
2682 for my $item (@items) { 2625 for my $item (@items) {
2683 last unless --$count; 2626 last unless --$count;
2684 2627
2685 push @widgets, $item->{label} ||= do { 2628 push @widgets, $item->{label} ||= do {
2686 # TODO: doesn't handle markup well (read as: at all) 2629 # TODO: doesn't handle markup well (read as: at all)
2687 my $short = delete $item->{text}; 2630 my $short = $item->{count} > 1
2631 ? "<b>$item->{count} ×</b> $item->{text}"
2632 : $item->{text};
2633
2688 for ($short) { 2634 for ($short) {
2689 s/^\s+//; 2635 s/^\s+//;
2690 s/\012.*//s; 2636 s/\012.*//s;
2691 my $len = int 30 / $item->{fontsize}; 2637 my $len = int 30 / $item->{fontsize};
2692 substr $_, $len, length, "…" if $len < length; 2638 substr $_, $len, length, "…" if $len < length;
2693 } 2639 }
2694 2640
2695 new CFClient::UI::Label 2641 new CFClient::UI::Label
2696 markup => $short, 2642 markup => $short,
2697 tooltip => delete $item->{tooltip}, 2643 tooltip => $item->{tooltip},
2644 tooltip_font => $::FONT_PROP,
2645 tooltip_width => 0.67,
2698 fontsize => delete $item->{fontsize}, 2646 fontsize => $item->{fontsize},
2699 color => delete $item->{color}, 2647 color => $item->{color},
2700 can_events => 1, 2648 can_events => 1,
2701 can_hover => 1, 2649 can_hover => 1
2702 }; 2650 };
2703 } 2651 }
2704 2652
2705 $self->clear; 2653 $self->clear;
2706 $self->SUPER::add (@widgets); 2654 $self->SUPER::add (reverse @widgets);
2707} 2655}
2708 2656
2709sub add { 2657sub add {
2710 my ($self, $text, %arg) = @_; 2658 my ($self, $text, %arg) = @_;
2711 2659
2712 my $item = { 2660 my $timeout = time + ((delete $arg{timeout}) || 60);
2713 time => time, 2661
2662 my $group = exists $arg{group} ? $arg{group} : ++$self->{id};
2663
2664 if (my $item = $self->{item}{$group}) {
2665 if ($item->{text} eq $text) {
2666 $item->{count}++;
2667 } else {
2668 $item->{count} = 1;
2669 $item->{text} = $item->{tooltip} = $text;
2670 }
2671 $item->{timeout} = $timeout;
2672 delete $item->{label};
2673 } else {
2674 $self->{item}{$group} = {
2675 id => ++$self->{id},
2714 text => $text, 2676 text => $text,
2715 timeout => 60, 2677 timeout => $timeout,
2716 tooltip => $text, 2678 tooltip => $text,
2717 fontsize => 0.8, 2679 fontsize => 0.8,
2718 color => [0.8, 0.8, 0.8, 0.8], 2680 color => [0.8, 0.8, 0.8, 0.8],
2681 pri => 0,
2682 count => 1,
2719 %arg, 2683 %arg,
2684 };
2720 }; 2685 }
2721
2722 $item->{timeout} += time;
2723 $item->{group} ||= $item+0;
2724
2725 $item = $self->{item}{$item->{group}} ||= $item;
2726 2686
2727 $self->reorder; 2687 $self->reorder;
2728} 2688}
2729 2689
2730############################################################################# 2690#############################################################################
2846 2806
2847 my ($w, $h) = $widget->{user_w} && $widget->{user_h} 2807 my ($w, $h) = $widget->{user_w} && $widget->{user_h}
2848 ? @$widget{qw(user_w user_h)} 2808 ? @$widget{qw(user_w user_h)}
2849 : $widget->size_request; 2809 : $widget->size_request;
2850 2810
2811 if (delete $widget->{force_alloc}
2851 if ($w != $widget->{req_w} || $h != $widget->{req_h}) { 2812 or $w != $widget->{req_w} or $h != $widget->{req_h}) {
2852 Carp::confess "$widget: size_request is negative" if $w < 0 || $h < 0;#d# 2813 Carp::confess "$widget: size_request is negative" if $w < 0 || $h < 0;#d#
2853 2814
2854 $widget->{req_w} = $w; 2815 $widget->{req_w} = $w;
2855 $widget->{req_h} = $h; 2816 $widget->{req_h} = $h;
2856 2817
2857 $self->{size_alloc}{$widget} = [$widget, $widget->{w}, $widget->{h}]; 2818 $self->{size_alloc}{$widget} = [$widget, $widget->{w} || $w, $widget->{h} || $h];
2858 2819
2859 $widget->{parent}->check_size 2820 $widget->{parent}->check_size
2860 if $widget->{parent}; 2821 if $widget->{parent};
2861 } 2822 }
2862 } 2823 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines