NeoMutt  2020-06-26-250-g349c94
Teaching an old dog new tricks
DOXYGEN
window.c File Reference

Dump the details of the nested Windows. More...

#include "config.h"
#include "mutt/lib.h"
#include "gui/lib.h"
#include "lib.h"
+ Include dependency graph for window.c:

Go to the source code of this file.

Functions

static const char * win_size (const struct MuttWindow *win)
 
static void win_dump (struct MuttWindow *win, int indent)
 
static void win_serialise (struct MuttWindow *win, struct Buffer *buf)
 
void debug_win_dump (void)
 

Variables

struct MuttWindowRootWindow
 Parent of all Windows. More...
 

Detailed Description

Dump the details of the nested Windows.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file window.c.

Function Documentation

◆ win_size()

static const char* win_size ( const struct MuttWindow win)
static

Definition at line 36 of file window.c.

37 {
38  if (!win)
39  return "???";
40 
41  switch (win->size)
42  {
44  return "FIX";
46  return "MAX";
48  return "MIN";
49  }
50 
51  return "???";
52 }
Window has a fixed size.
Definition: mutt_window.h:44
Window size depends on its children.
Definition: mutt_window.h:46
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:124
Window wants as much space as possible.
Definition: mutt_window.h:45
+ Here is the caller graph for this function:

◆ win_dump()

static void win_dump ( struct MuttWindow win,
int  indent 
)
static

Definition at line 54 of file window.c.

55 {
56  bool visible = mutt_window_is_visible(win);
57 
58  mutt_debug(LL_DEBUG1, "%*s%s[%d,%d] %s-%c \033[1;33m%s\033[0m (%d,%d)%s\n",
59  indent, "", visible ? "✓" : "✗\033[1;30m", win->state.col_offset,
60  win->state.row_offset, win_size(win),
61  (win->orient == MUTT_WIN_ORIENT_VERTICAL) ? 'V' : 'H', win_name(win),
62  win->state.cols, win->state.rows, visible ? "" : "\033[0m");
63 
64  struct MuttWindow *np = NULL;
65  TAILQ_FOREACH(np, &win->children, entries)
66  {
67  win_dump(np, indent + 4);
68  }
69 }
enum MuttWindowOrientation orient
Which direction the Window will expand.
Definition: mutt_window.h:123
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
Window uses all available vertical space.
Definition: mutt_window.h:35
A division of the screen.
Definition: mutt_window.h:115
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:59
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:667
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:60
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
static const char * win_size(const struct MuttWindow *win)
Definition: window.c:36
static void win_dump(struct MuttWindow *win, int indent)
Definition: window.c:54
Log at debug level 1.
Definition: logging.h:40
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:129
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
const char * win_name(const struct MuttWindow *win)
Definition: common.c:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ win_serialise()

static void win_serialise ( struct MuttWindow win,
struct Buffer buf 
)
static

Definition at line 71 of file window.c.

72 {
73  if (!mutt_window_is_visible(win))
74  return;
75 
76  mutt_buffer_add_printf(buf, "<%s {%dx,%dy} [%dC,%dR]", win_size(win),
77  win->state.col_offset, win->state.row_offset,
78  win->state.cols, win->state.rows);
79  struct MuttWindow *np = NULL;
80  TAILQ_FOREACH(np, &win->children, entries)
81  {
82  win_serialise(np, buf);
83  }
84  mutt_buffer_addstr(buf, ">");
85 }
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
static void win_serialise(struct MuttWindow *win, struct Buffer *buf)
Definition: window.c:71
A division of the screen.
Definition: mutt_window.h:115
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:59
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:203
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:667
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:60
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
static const char * win_size(const struct MuttWindow *win)
Definition: window.c:36
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:129
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debug_win_dump()

void debug_win_dump ( void  )

Definition at line 87 of file window.c.

88 {
89  mutt_debug(LL_DEBUG1, "\n");
90  win_dump(RootWindow, 0);
91  mutt_debug(LL_DEBUG1, "\n");
92  struct Buffer buf = mutt_buffer_make(1024);
94  mutt_debug(LL_DEBUG1, "%s\n", mutt_b2s(&buf));
95  mutt_buffer_dealloc(&buf);
96 }
static void win_serialise(struct MuttWindow *win, struct Buffer *buf)
Definition: window.c:71
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: mutt_window.c:45
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
#define mutt_b2s(buf)
Definition: buffer.h:41
static void win_dump(struct MuttWindow *win, int indent)
Definition: window.c:54
Log at debug level 1.
Definition: logging.h:40
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
+ Here is the call graph for this function:

Variable Documentation

◆ RootWindow

struct MuttWindow* RootWindow

Parent of all Windows.

Definition at line 45 of file mutt_window.c.