11# ABSTRACT: A top-level (full-screen) widget
22
3+ use nano;
4+
35use Terminal::Widgets::Events;
46use Terminal::Widgets::Layout;
57use Terminal::Widgets::Widget;
@@ -29,12 +31,12 @@ does Terminal::Widgets::Layout::WidgetBuilding {
2931 Terminal::Widgets::Events::EventPhase: D $ phase = TrickleDown) {
3032 my $ show-time = $ . debug && $ phase == TrickleDown;
3133 note ' ⚙️ Processing ' ~ $ event . gist if $ show-time ;
32- my $ t0 = now ;
34+ my $ t0 = nano ;
3335
3436 callsame ;
3537
3638 note sprintf (" ⏱️ Event #% d processed: %.3fms\n " ,
37- $ event . id, 1000 * (now - $ t0 )) if $ show-time ;
39+ $ event . id, (nano - $ t0 ) / 1_000_000 ) if $ show-time ;
3840 }
3941
4042 # | Add a widget to a named group
@@ -62,7 +64,7 @@ does Terminal::Widgets::Layout::WidgetBuilding {
6264 method focus-on (Terminal::Widgets::Widget: D $ target ,
6365 Bool : D : $ redraw = True ) {
6466 note " ⚙️ Processing top level focus-on for: { $ target . gist-name} " if $ . debug ;
65- my $ t0 = now ;
67+ my $ t0 = nano ;
6668
6769 # Determine if focus is *really* changing
6870 my $ prev = $ ! focused-widget ;
@@ -84,25 +86,25 @@ does Terminal::Widgets::Layout::WidgetBuilding {
8486 $ target . full-refresh if $ redraw ;
8587
8688 note sprintf (" ⏱️ focus-on processed for { $ target . gist-name} : %.3fms\n " ,
87- 1000 * (now - $ t0 )) if $ . debug ;
89+ (nano - $ t0 ) / 1_000_000 ) if $ . debug ;
8890 }
8991
9092 # | Redraw entire widget tree
9193 method redraw-all () {
9294 note " 🆕 Starting redraw-all of: { self . gist-name} " if $ . debug ;
93- my $ t0 = now ;
95+ my $ t0 = nano ;
9496
9597 my $ frame-info = Terminal::Widgets::FrameInfo. new ;
9698 self . do-frame($ frame-info );
9799
98100 note sprintf (" ⏱️ redraw-all of { self . gist-name} : %.3fms" ,
99- 1000 * (now - $ t0 )) if $ . debug ;
101+ (nano - $ t0 ) / 1_000_000 ) if $ . debug ;
100102 }
101103
102104 # | Relayout, redraw, and composite entire widget tree
103105 method relayout (Bool : D : $ focus = False ) {
104106 note ' ⚙️ Processing top level relayout request' if $ . debug ;
105- my $ t0 = now ;
107+ my $ t0 = nano ;
106108
107109 # Build the layout and then send a global event that layout has completed
108110 self . build-layout;
@@ -114,7 +116,7 @@ does Terminal::Widgets::Layout::WidgetBuilding {
114116 self . composite;
115117
116118 note sprintf (" ⏱️ Top level relayout request processed: %.3fms\n " ,
117- 1000 * (now - $ t0 )) if $ . debug ;
119+ (nano - $ t0 ) / 1_000_000 ) if $ . debug ;
118120 }
119121
120122 # XXXX: Allow terminal to be disconnected or switched?
0 commit comments