From 13ac70e6f4288cb6e1dda2cf17457026f888d565 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 26 Jul 2019 18:33:37 +0100 Subject: [PATCH] window: dump --- mutt_window.c | 35 +++++++++++++++++++++++++++++++++++ mutt_window.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/mutt_window.c b/mutt_window.c index bc36ae66a..5d6d2b118 100644 --- a/mutt_window.c +++ b/mutt_window.c @@ -238,6 +238,20 @@ void mutt_window_init(void) 1, MUTT_WIN_SIZE_UNLIMITED); RootWindow = w1; + RootWindow->name = "r1"; + + w2->name = "w2"; + w3->name = "w3"; + w4->name = "w4"; + w5->name = "w5"; + w6->name = "w6"; + MuttHelpWindow->name = "Help"; + MuttIndexWindow->name = "Index"; + MuttMessageWindow->name = "Message"; + MuttPagerBarWindow->name = "PagerBar"; + MuttPagerWindow->name = "Pager"; + MuttSidebarWindow->name = "Sidebar"; + MuttStatusWindow->name = "Status"; mutt_window_add_child(w1, w2); mutt_window_add_child(w1, MuttMessageWindow); @@ -412,6 +426,7 @@ void mutt_window_reflow(struct MuttWindow *win) mutt_menu_set_current_redraw_full(); /* the pager menu needs this flag set to recalc line_info */ mutt_menu_set_current_redraw(REDRAW_FLOW); + win_dump(); } /** @@ -592,3 +607,23 @@ void mutt_window_set_root(int rows, int cols) mutt_window_reflow(RootWindow); } } + +void dump(struct MuttWindow *win, int indent) +{ + if (!win->state.visible) + return; + + mutt_debug(LL_DEBUG1, "%*s[%d,%d] %s (%d,%d)\n", indent, "", win->state.col_offset, + win->state.row_offset, win->name, win->state.cols, win->state.rows); + + struct MuttWindow *np = NULL; + TAILQ_FOREACH(np, &win->children, entries) + { + dump(np, indent + 4); + } +} + +void win_dump(void) +{ + dump(RootWindow, 0); +} diff --git a/mutt_window.h b/mutt_window.h index 30e95b289..30477826f 100644 --- a/mutt_window.h +++ b/mutt_window.h @@ -79,6 +79,7 @@ struct MuttWindow TAILQ_ENTRY(MuttWindow) entries; ///< Linked list struct MuttWindow *parent; ///< Parent Window struct MuttWindowList children; ///< Children Windows + const char *name; }; extern struct MuttWindow *MuttHelpWindow; @@ -119,5 +120,6 @@ int mutt_window_mvprintw (struct MuttWindow *win, int row, int col, const char int mutt_window_printf (const char *format, ...); void mutt_winlist_free (struct MuttWindowList *head); +void win_dump(void); #endif /* MUTT_MUTT_WINDOW_H */ -- 2.40.0