NeoMutt  2021-10-29-225-gb9986f
Teaching an old dog new tricks
DOXYGEN
mutt_window.c
Go to the documentation of this file.
1 
29 #include "config.h"
30 #include <stdarg.h>
31 #include <string.h>
32 #include "mutt/lib.h"
33 #include "config/lib.h"
34 #include "mutt_window.h"
35 #include "curs_lib.h"
36 #include "mutt_curses.h"
37 #include "options.h"
38 #include "reflow.h"
39 #include "rootwin.h"
40 #ifdef USE_DEBUG_WINDOW
41 #include "debug/lib.h"
42 #endif
43 
45 static const struct Mapping WindowNames[] = {
46  // clang-format off
47  { "WT_ALL_DIALOGS", WT_ALL_DIALOGS },
48  { "WT_CONTAINER", WT_CONTAINER },
49  { "WT_CUSTOM", WT_CUSTOM },
50  { "WT_DLG_ALIAS", WT_DLG_ALIAS },
51  { "WT_DLG_ATTACH", WT_DLG_ATTACH },
52  { "WT_DLG_AUTOCRYPT", WT_DLG_AUTOCRYPT },
53  { "WT_DLG_BROWSER", WT_DLG_BROWSER },
54  { "WT_DLG_CERTIFICATE", WT_DLG_CERTIFICATE },
55  { "WT_DLG_COMPOSE", WT_DLG_COMPOSE },
56  { "WT_DLG_CRYPT_GPGME", WT_DLG_CRYPT_GPGME },
57  { "WT_DLG_DO_PAGER", WT_DLG_DO_PAGER },
58  { "WT_DLG_HISTORY", WT_DLG_HISTORY },
59  { "WT_DLG_INDEX", WT_DLG_INDEX },
60  { "WT_DLG_PGP", WT_DLG_PGP },
61  { "WT_DLG_POSTPONE", WT_DLG_POSTPONE },
62  { "WT_DLG_QUERY", WT_DLG_QUERY },
63  { "WT_DLG_REMAILER", WT_DLG_REMAILER },
64  { "WT_DLG_SMIME", WT_DLG_SMIME },
65  { "WT_HELP_BAR", WT_HELP_BAR },
66  { "WT_INDEX", WT_INDEX },
67  { "WT_MENU", WT_MENU },
68  { "WT_MESSAGE", WT_MESSAGE },
69  { "WT_PAGER", WT_PAGER },
70  { "WT_ROOT", WT_ROOT },
71  { "WT_SIDEBAR", WT_SIDEBAR },
72  { "WT_STATUS_BAR", WT_STATUS_BAR },
73  { NULL, 0 },
74  // clang-format on
75 };
76 
86 static bool window_was_visible(struct MuttWindow *win)
87 {
88  if (!win)
89  return false;
90 
91  for (; win; win = win->parent)
92  {
93  if (!win->old.visible)
94  return false;
95  }
96 
97  return true;
98 }
99 
104 static void window_notify(struct MuttWindow *win)
105 {
106  if (!win->notify)
107  return;
108 
109  const struct WindowState *old = &win->old;
110  const struct WindowState *state = &win->state;
112 
113  const bool was_visible = window_was_visible(win);
114  const bool is_visible = mutt_window_is_visible(win);
115  if (was_visible != is_visible)
116  flags |= is_visible ? WN_VISIBLE : WN_HIDDEN;
117 
118  if ((state->row_offset != old->row_offset) || (state->col_offset != old->col_offset))
119  flags |= WN_MOVED;
120 
121  if (state->rows > old->rows)
122  flags |= WN_TALLER;
123  else if (state->rows < old->rows)
124  flags |= WN_SHORTER;
125 
126  if (state->cols > old->cols)
127  flags |= WN_WIDER;
128  else if (state->cols < old->cols)
129  flags |= WN_NARROWER;
130 
131  if (flags == WN_NO_FLAGS)
132  return;
133 
134  mutt_debug(LL_NOTIFY, "NT_WINDOW_STATE: %s, %p\n", mutt_window_win_name(win), win);
135  struct EventWindow ev_w = { win, flags };
137 }
138 
144 {
145  if (!win)
146  win = RootWindow;
147 
149 
150  struct MuttWindow *np = NULL;
151  TAILQ_FOREACH(np, &win->children, entries)
152  {
153  window_notify_all(np);
154  }
155  win->old = win->state;
156 }
157 
163 void window_set_visible(struct MuttWindow *win, bool visible)
164 {
165  if (!win)
166  win = RootWindow;
167 
168  win->state.visible = visible;
169 }
170 
181  enum MuttWindowSize size, int cols, int rows)
182 {
183  struct MuttWindow *win = mutt_mem_calloc(1, sizeof(struct MuttWindow));
184 
185  win->type = type;
186  win->orient = orient;
187  win->size = size;
188  win->req_rows = rows;
189  win->req_cols = cols;
190  win->state.visible = true;
191  win->notify = notify_new();
192  TAILQ_INIT(&win->children);
193  return win;
194 }
195 
200 void mutt_window_free(struct MuttWindow **ptr)
201 {
202  if (!ptr || !*ptr)
203  return;
204 
205  struct MuttWindow *win = *ptr;
206 
207  if (win->parent && (win->parent->focus == win))
208  win->parent->focus = NULL;
209 
210  mutt_debug(LL_NOTIFY, "NT_WINDOW_DELETE: %s, %p\n", mutt_window_win_name(win), win);
211  struct EventWindow ev_w = { win, WN_NO_FLAGS };
213 
215 
216  if (win->wdata_free && win->wdata)
217  win->wdata_free(win, &win->wdata); // Custom function to free private data
218 
220 
221  FREE(ptr);
222 }
223 
229 void mutt_window_clearline(struct MuttWindow *win, int row)
230 {
231  mutt_window_move(win, 0, row);
233 }
234 
242 {
243  if (!win || !stdscr)
244  return;
245 
246  if ((win->state.col_offset + win->state.cols) == COLS)
247  clrtoeol();
248  else
249  {
250  int row = 0;
251  int col = 0;
252  getyx(stdscr, row, col);
253  int curcol = col;
254  while (curcol < (win->state.col_offset + win->state.cols))
255  {
256  addch(' ');
257  curcol++;
258  }
259  move(row, col);
260  }
261 }
262 
272 void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
273 {
274  int x = 0;
275  int y = 0;
276 
277  getyx(stdscr, y, x);
278  if (col)
279  *col = x - win->state.col_offset;
280  if (row)
281  *row = y - win->state.row_offset;
282 }
283 
292 int mutt_window_move(struct MuttWindow *win, int col, int row)
293 {
294  return move(win->state.row_offset + row, win->state.col_offset + col);
295 }
296 
306 int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
307 {
308  return mvaddstr(win->state.row_offset + row, win->state.col_offset + col, str);
309 }
310 
321 int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt, ...)
322 {
323  int rc = mutt_window_move(win, col, row);
324  if (rc == ERR)
325  return rc;
326 
327  va_list ap;
328  va_start(ap, fmt);
329  rc = vw_printw(stdscr, fmt, ap);
330  va_end(ap);
331 
332  return rc;
333 }
334 
340 {
341  if (OptNoCurses)
342  return;
343 
344  if (!win)
345  win = RootWindow;
346 
347  mutt_debug(LL_DEBUG2, "entering\n");
350 
351 #ifdef USE_DEBUG_WINDOW
352  debug_win_dump();
353 #endif
354 }
355 
364 int mutt_window_wrap_cols(int width, short wrap)
365 {
366  if (wrap < 0)
367  return (width > -wrap) ? (width + wrap) : width;
368  if (wrap)
369  return (wrap < width) ? wrap : width;
370  return width;
371 }
372 
380 int mutt_window_addch(struct MuttWindow *win, int ch)
381 {
382  return addch(ch);
383 }
384 
393 int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
394 {
395  if (!str)
396  return -1;
397 
398  return addnstr(str, num);
399 }
400 
408 int mutt_window_addstr(struct MuttWindow *win, const char *str)
409 {
410  if (!str)
411  return -1;
412 
413  return addstr(str);
414 }
415 
423 int mutt_window_printf(struct MuttWindow *win, const char *fmt, ...)
424 {
425  va_list ap;
426  va_start(ap, fmt);
427  int rc = vw_printw(stdscr, fmt, ap);
428  va_end(ap);
429 
430  return rc;
431 }
432 
438 void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
439 {
440  if (!parent || !child)
441  return;
442 
443  TAILQ_INSERT_TAIL(&parent->children, child, entries);
444  child->parent = parent;
445 
446  notify_set_parent(child->notify, parent->notify);
447 
448  mutt_debug(LL_NOTIFY, "NT_WINDOW_NEW: %s, %p\n", mutt_window_win_name(child), child);
449  struct EventWindow ev_w = { child, WN_NO_FLAGS };
450  notify_send(child->notify, NT_WINDOW, NT_WINDOW_ADD, &ev_w);
451 }
452 
460 {
461  if (!parent || !child)
462  return NULL;
463 
464  // A notification will be sent when the Window is freed
465  TAILQ_REMOVE(&parent->children, child, entries);
466  child->parent = NULL;
467 
468  notify_set_parent(child->notify, NULL);
469 
470  return child;
471 }
472 
477 void mutt_winlist_free(struct MuttWindowList *head)
478 {
479  if (!head)
480  return;
481 
482  struct MuttWindow *np = NULL;
483  struct MuttWindow *tmp = NULL;
484  TAILQ_FOREACH_SAFE(np, head, entries, tmp)
485  {
486  TAILQ_REMOVE(head, np, entries);
488  mutt_window_free(&np);
489  }
490 }
491 
501 {
502  if (!win)
503  return false;
504 
505  for (; win; win = win->parent)
506  {
507  if (!win->state.visible)
508  return false;
509  }
510 
511  return true;
512 }
513 
522 {
523  if (!win)
524  return NULL;
525  if (win->type == type)
526  return win;
527 
528  struct MuttWindow *np = NULL;
529  struct MuttWindow *match = NULL;
530  TAILQ_FOREACH(np, &win->children, entries)
531  {
532  match = window_find_child(np, type);
533  if (match)
534  return match;
535  }
536 
537  return NULL;
538 }
539 
547 {
548  for (; win; win = win->parent)
549  {
550  if (win->type == type)
551  return win;
552  }
553 
554  return NULL;
555 }
556 
561 static void window_recalc(struct MuttWindow *win)
562 {
563  if (!win || !win->state.visible)
564  return;
565 
566  if (win->recalc && (win->actions & WA_RECALC))
567  win->recalc(win);
568  win->actions &= ~WA_RECALC;
569 
570  struct MuttWindow *np = NULL;
571  TAILQ_FOREACH(np, &win->children, entries)
572  {
573  window_recalc(np);
574  }
575 }
576 
581 static void window_repaint(struct MuttWindow *win)
582 {
583  if (!win || !win->state.visible)
584  return;
585 
586  if (win->repaint && (win->actions & WA_REPAINT))
587  win->repaint(win);
588  win->actions &= ~WA_REPAINT;
589 
590  struct MuttWindow *np = NULL;
591  TAILQ_FOREACH(np, &win->children, entries)
592  {
593  window_repaint(np);
594  }
595 }
596 
603 void window_redraw(struct MuttWindow *win)
604 {
605  if (!win)
606  win = RootWindow;
607 
608  window_reflow(win);
609  window_notify_all(win);
610 
611  window_recalc(win);
612  window_repaint(win);
613  mutt_refresh();
614 }
615 
621 bool window_is_focused(struct MuttWindow *win)
622 {
623  if (!win)
624  return false;
625 
627 
628  return (win_focus == win);
629 }
630 
636 {
637  struct MuttWindow *win = RootWindow;
638 
639  while (win && win->focus)
640  win = win->focus;
641 
642  return win;
643 }
644 
652 {
653  if (!win)
654  return NULL;
655 
656  struct MuttWindow *old_focus = window_get_focus();
657 
658  struct MuttWindow *parent = win->parent;
659  struct MuttWindow *child = win;
660 
661  // Set the chain of focus, all the way to the root
662  for (; parent; child = parent, parent = parent->parent)
663  parent->focus = child;
664 
665  // Find the most focused Window
666  while (win && win->focus)
667  win = win->focus;
668 
669  if (win == old_focus)
670  return NULL;
671 
672  mutt_debug(LL_NOTIFY, "NT_WINDOW_FOCUS: %s, %p\n", mutt_window_win_name(win), win);
673  struct EventWindow ev_w = { win, WN_NO_FLAGS };
675 #ifdef USE_DEBUG_WINDOW
676  debug_win_dump();
677 #endif
678  return old_focus;
679 }
680 
688 {
690  return;
691 
692  for (int i = 0; i < win->state.rows; i++)
694 }
695 
702 const char *mutt_window_win_name(const struct MuttWindow *win)
703 {
704  if (!win)
705  return "UNKNOWN";
706 
707  const char *name = mutt_map_get_name(win->type, WindowNames);
708  if (name)
709  return name;
710  return "UNKNOWN";
711 }
712 
717 static void window_invalidate(struct MuttWindow *win)
718 {
719  if (!win)
720  return;
721 
722  win->actions |= WA_REPAINT;
723 
724  struct MuttWindow *np = NULL;
725  TAILQ_FOREACH(np, &win->children, entries)
726  {
727  window_invalidate(np);
728  }
729 }
730 
735 {
737  clearok(stdscr, true);
738  keypad(stdscr, true);
739 }
740 
751 bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
752 {
753  const bool c_status_on_top = cs_subset_bool(sub, "status_on_top");
754 
755  struct MuttWindow *win_first = TAILQ_FIRST(&panel->children);
756 
757  if ((c_status_on_top && (win_first->type == WT_STATUS_BAR)) ||
758  (!c_status_on_top && (win_first->type != WT_STATUS_BAR)))
759  {
760  return false;
761  }
762 
763  TAILQ_REMOVE(&panel->children, win_first, entries);
764  TAILQ_INSERT_TAIL(&panel->children, win_first, entries);
765 
766  mutt_window_reflow(panel);
767  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
768  return true;
769 }
Convenience wrapper for the config headers.
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:114
GUI miscellaneous curses (window drawing) routines.
Convenience wrapper for the debug headers.
void debug_win_dump(void)
Definition: window.c:91
static struct MuttWindow * win_focus
Definition: window.c:36
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
@ LL_DEBUG2
Log at debug level 2.
Definition: logging.h:41
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:40
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:60
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:93
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:73
Define wrapper functions around Curses.
static bool is_visible(struct Email *e)
Is the message visible?
Definition: mutt_thread.c:132
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:687
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:500
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:603
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:339
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
Definition: mutt_window.c:143
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:751
static void window_notify(struct MuttWindow *win)
Notify observers of changes to a Window.
Definition: mutt_window.c:104
static const struct Mapping WindowNames[]
Lookups for Window Names.
Definition: mutt_window.c:45
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
Definition: mutt_window.c:459
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:200
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:438
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:423
static void window_invalidate(struct MuttWindow *win)
Mark a window as in need of repaint.
Definition: mutt_window.c:717
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:292
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
Definition: mutt_window.c:180
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:635
static void window_recalc(struct MuttWindow *win)
Recalculate a tree of Windows.
Definition: mutt_window.c:561
const char * mutt_window_win_name(const struct MuttWindow *win)
Get the name of a Window.
Definition: mutt_window.c:702
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:651
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:521
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:163
static bool window_was_visible(struct MuttWindow *win)
Was the Window visible?
Definition: mutt_window.c:86
bool window_is_focused(struct MuttWindow *win)
Does the given Window have the focus?
Definition: mutt_window.c:621
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
Definition: mutt_window.c:272
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
Definition: mutt_window.c:364
void mutt_winlist_free(struct MuttWindowList *head)
Free a tree of Windows.
Definition: mutt_window.c:477
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
Definition: mutt_window.c:546
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:306
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:229
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
Definition: mutt_window.c:408
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:393
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:241
static void window_repaint(struct MuttWindow *win)
Repaint a tree of Windows.
Definition: mutt_window.c:581
int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt,...)
Move the cursor and write a formatted string to a Window.
Definition: mutt_window.c:321
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:734
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
Definition: mutt_window.c:380
Window management.
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
#define WN_MOVED
Window moved.
Definition: mutt_window.h:191
uint8_t WindowNotifyFlags
Flags for Changes to a MuttWindow, e.g. WN_TALLER.
Definition: mutt_window.h:185
#define WN_WIDER
Window became wider.
Definition: mutt_window.h:189
WindowType
Type of Window.
Definition: mutt_window.h:70
@ WT_DLG_REMAILER
Remailer Dialog, dlg_select_mixmaster_chain()
Definition: mutt_window.h:91
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ WT_ROOT
Parent of All Windows.
Definition: mutt_window.h:72
@ WT_DLG_ALIAS
Alias Dialog, dlg_select_alias()
Definition: mutt_window.h:77
@ WT_ALL_DIALOGS
Container for All Dialogs (nested Windows)
Definition: mutt_window.h:74
@ WT_DLG_BROWSER
Browser Dialog, mutt_buffer_select_file()
Definition: mutt_window.h:80
@ WT_MESSAGE
Window for messages/errors and command entry.
Definition: mutt_window.h:99
@ WT_DLG_SMIME
Smime Dialog, dlg_select_smime_key()
Definition: mutt_window.h:92
@ WT_DLG_QUERY
Query Dialog, dlg_select_query()
Definition: mutt_window.h:90
@ WT_DLG_HISTORY
History Dialog, dlg_select_history()
Definition: mutt_window.h:85
@ WT_DLG_PGP
Pgp Dialog, dlg_select_pgp_key()
Definition: mutt_window.h:88
@ WT_CONTAINER
Invisible shaping container Window.
Definition: mutt_window.h:73
@ WT_DLG_CERTIFICATE
Certificate Dialog, dlg_verify_certificate()
Definition: mutt_window.h:81
@ WT_DLG_COMPOSE
Compose Dialog, mutt_compose_menu()
Definition: mutt_window.h:82
@ WT_DLG_INDEX
Index Dialog, index_pager_init()
Definition: mutt_window.h:86
@ WT_PAGER
A panel containing the Pager Window.
Definition: mutt_window.h:100
@ WT_DLG_CRYPT_GPGME
Crypt-GPGME Dialog, dlg_select_gpgme_key()
Definition: mutt_window.h:83
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:96
@ WT_DLG_POSTPONE
Postpone Dialog, dlg_select_postponed_email()
Definition: mutt_window.h:89
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ WT_DLG_ATTACH
Attach Dialog, dlg_select_attachment()
Definition: mutt_window.h:78
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
@ WT_DLG_DO_PAGER
Pager Dialog, mutt_do_pager()
Definition: mutt_window.h:84
@ WT_DLG_AUTOCRYPT
Autocrypt Dialog, dlg_select_autocrypt_account()
Definition: mutt_window.h:79
@ WT_MENU
An Window containing a Menu.
Definition: mutt_window.h:98
MuttWindowOrientation
Which way does the Window expand?
Definition: mutt_window.h:37
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:207
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:206
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:209
@ NT_WINDOW_ADD
New Window has been added.
Definition: mutt_window.h:205
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:192
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:193
#define WN_NO_FLAGS
No flags are set.
Definition: mutt_window.h:186
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
#define WN_TALLER
Window became taller.
Definition: mutt_window.h:187
MuttWindowSize
Control the allocation of Window space.
Definition: mutt_window.h:46
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:190
#define WN_SHORTER
Window became shorter.
Definition: mutt_window.h:188
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:53
Handling of global boolean variables.
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:53
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:735
#define TAILQ_INIT(head)
Definition: queue.h:765
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:809
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition: reflow.c:222
Window management.
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:103
Root Window.
A set of inherited config items.
Definition: subset.h:47
An Event that happened to a Window.
Definition: mutt_window.h:216
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:217
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:218
Mapping between user-readable string and a constant.
Definition: mapping.h:32
struct WindowState old
Previous state of the Window.
Definition: mutt_window.h:128
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:182
short req_cols
Number of columns required.
Definition: mutt_window.h:124
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
void * wdata
Private data.
Definition: mutt_window.h:145
enum MuttWindowOrientation orient
Which direction the Window will expand.
Definition: mutt_window.h:130
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
short req_rows
Number of rows required.
Definition: mutt_window.h:125
int(* recalc)(struct MuttWindow *win)
Definition: mutt_window.h:171
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Definition: mutt_window.h:160
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:136
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:131
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
The current, or old, state of a Window.
Definition: mutt_window.h:58
bool visible
Window is visible.
Definition: mutt_window.h:59
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:63
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:62
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61