NeoMutt  2021-02-05-329-g9e03b7
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 "core/lib.h"
35 #include "mutt_window.h"
36 #include "helpbar/lib.h"
37 #include "keymap.h"
38 #include "mutt_curses.h"
39 #include "opcodes.h"
40 #include "options.h"
41 #include "reflow.h"
42 
43 struct MuttWindow *RootWindow = NULL;
44 struct MuttWindow *AllDialogsWindow = NULL;
45 struct MuttWindow *MessageWindow = NULL;
46 
48 static const struct Mapping EditorHelp[] = {
49  // clang-format off
50  { N_("Complete"), OP_EDITOR_COMPLETE },
51  { N_("Hist Up"), OP_EDITOR_HISTORY_UP },
52  { N_("Hist Down"), OP_EDITOR_HISTORY_DOWN },
53  { N_("Hist Search"), OP_EDITOR_HISTORY_SEARCH },
54  { N_("Begin Line"), OP_EDITOR_BOL },
55  { N_("End Line"), OP_EDITOR_EOL },
56  { N_("Kill Line"), OP_EDITOR_KILL_LINE },
57  { N_("Kill Word"), OP_EDITOR_KILL_WORD },
58  { NULL, 0 },
59  // clang-format off
60 };
61 
71 static bool window_was_visible(struct MuttWindow *win)
72 {
73  if (!win)
74  return false;
75 
76  for (; win; win = win->parent)
77  {
78  if (!win->old.visible)
79  return false;
80  }
81 
82  return true;
83 }
84 
89 static void window_notify(struct MuttWindow *win)
90 {
91  if (!win->notify)
92  return;
93 
94  const struct WindowState *old = &win->old;
95  const struct WindowState *state = &win->state;
97 
98  const bool was_visible = window_was_visible(win);
99  const bool is_visible = mutt_window_is_visible(win);
100  if (was_visible != is_visible)
101  flags |= is_visible ? WN_VISIBLE : WN_HIDDEN;
102 
103  if ((state->row_offset != old->row_offset) || (state->col_offset != old->col_offset))
104  flags |= WN_MOVED;
105 
106  if (state->rows > old->rows)
107  flags |= WN_TALLER;
108  else if (state->rows < old->rows)
109  flags |= WN_SHORTER;
110 
111  if (state->cols > old->cols)
112  flags |= WN_WIDER;
113  else if (state->cols < old->cols)
114  flags |= WN_NARROWER;
115 
116  if (flags == WN_NO_FLAGS)
117  return;
118 
119  struct EventWindow ev_w = { win, flags };
121 }
122 
128 {
129  if (!win)
130  win = RootWindow;
131 
132  window_notify(win);
133 
134  struct MuttWindow *np = NULL;
135  TAILQ_FOREACH(np, &win->children, entries)
136  {
137  window_notify_all(np);
138  }
139  win->old = win->state;
140 }
141 
147 void window_set_visible(struct MuttWindow *win, bool visible)
148 {
149  if (!win)
150  win = RootWindow;
151 
152  win->state.visible = visible;
153 }
154 
165  enum MuttWindowSize size, int cols, int rows)
166 {
167  struct MuttWindow *win = mutt_mem_calloc(1, sizeof(struct MuttWindow));
168 
169  win->type = type;
170  win->orient = orient;
171  win->size = size;
172  win->req_rows = rows;
173  win->req_cols = cols;
174  win->state.visible = true;
175  win->notify = notify_new();
176  TAILQ_INIT(&win->children);
177  return win;
178 }
179 
184 void mutt_window_free(struct MuttWindow **ptr)
185 {
186  if (!ptr || !*ptr)
187  return;
188 
189  struct MuttWindow *win = *ptr;
190 
191  if (win->parent && (win->parent->focus == win))
192  win->parent->focus = NULL;
193 
194  struct EventWindow ev_w = { win, WN_NO_FLAGS };
196 
198 
199  if (win->wdata && win->wdata_free)
200  win->wdata_free(win, &win->wdata); // Custom function to free private data
201 
202  notify_free(&win->notify);
203 
204  FREE(ptr);
205 }
206 
207 #ifdef USE_SLANG_CURSES
208 
215 static int vw_printw(SLcurses_Window_Type *win, const char *fmt, va_list ap)
216 {
217  char buf[1024];
218 
219  (void) SLvsnprintf(buf, sizeof(buf), (char *) fmt, ap);
220  SLcurses_waddnstr(win, buf, -1);
221  return 0;
222 }
223 #endif
224 
230 void mutt_window_clearline(struct MuttWindow *win, int row)
231 {
232  mutt_window_move(win, 0, row);
234 }
235 
243 {
244  if (!win || !stdscr)
245  return;
246 
247  if (win->state.col_offset + win->state.cols == COLS)
248  clrtoeol();
249  else
250  {
251  int row = 0;
252  int col = 0;
253  getyx(stdscr, row, col);
254  int curcol = col;
255  while (curcol < (win->state.col_offset + win->state.cols))
256  {
257  addch(' ');
258  curcol++;
259  }
260  move(row, col);
261  }
262 }
263 
268 {
269  if (!nc->event_data || !nc->global_data)
270  return -1;
271  if (nc->event_type != NT_CONFIG)
272  return 0;
273 
274  struct EventConfig *ec = nc->event_data;
275  struct MuttWindow *root_win = nc->global_data;
276 
277  if (mutt_str_equal(ec->name, "status_on_top"))
278  {
279  struct MuttWindow *first = TAILQ_FIRST(&root_win->children);
280  if (!first)
281  return -1;
282 
283  const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
284  if ((c_status_on_top && (first->type == WT_HELP_BAR)) ||
285  (!c_status_on_top && (first->type != WT_HELP_BAR)))
286  {
287  // Swap the HelpLine and the Dialogs Container
288  struct MuttWindow *next = TAILQ_NEXT(first, entries);
289  if (!next)
290  return -1;
291  TAILQ_REMOVE(&root_win->children, next, entries);
292  TAILQ_INSERT_HEAD(&root_win->children, next, entries);
293  }
294  }
295 
296  mutt_window_reflow(root_win);
297  return 0;
298 }
299 
304 {
305  if (NeoMutt)
307  AllDialogsWindow = NULL;
308  MessageWindow = NULL;
309  mutt_window_free(&RootWindow);
310 }
311 
321 void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
322 {
323  int x = 0;
324  int y = 0;
325 
326  getyx(stdscr, y, x);
327  if (col)
328  *col = x - win->state.col_offset;
329  if (row)
330  *row = y - win->state.row_offset;
331 }
332 
339 {
340  if (RootWindow)
341  return;
342 
343  RootWindow =
345  notify_set_parent(RootWindow->notify, NeoMutt->notify);
346 
347  struct MuttWindow *win_helpbar = helpbar_create();
348 
352 
355  MessageWindow->help_data = EditorHelp;
356  MessageWindow->help_menu = MENU_EDITOR;
357 
358  const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
359  if (c_status_on_top)
360  {
361  mutt_window_add_child(RootWindow, AllDialogsWindow);
362  mutt_window_add_child(RootWindow, win_helpbar);
363  }
364  else
365  {
366  mutt_window_add_child(RootWindow, win_helpbar);
367  mutt_window_add_child(RootWindow, AllDialogsWindow);
368  }
369 
370  mutt_window_add_child(RootWindow, MessageWindow);
372 }
373 
382 int mutt_window_move(struct MuttWindow *win, int col, int row)
383 {
384  return move(win->state.row_offset + row, win->state.col_offset + col);
385 }
386 
396 int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
397 {
398 #ifdef USE_SLANG_CURSES
399  return mvaddstr(win->state.row_offset + row, win->state.col_offset + col, (char *) str);
400 #else
401  return mvaddstr(win->state.row_offset + row, win->state.col_offset + col, str);
402 #endif
403 }
404 
415 int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt, ...)
416 {
417  int rc = mutt_window_move(win, col, row);
418  if (rc == ERR)
419  return rc;
420 
421  va_list ap;
422  va_start(ap, fmt);
423  rc = vw_printw(stdscr, fmt, ap);
424  va_end(ap);
425 
426  return rc;
427 }
428 
434 {
435  if (OptNoCurses)
436  return;
437 
438  if (!win)
439  win = RootWindow;
440 
441  mutt_debug(LL_DEBUG2, "entering\n");
442  window_reflow(win);
443  window_notify_all(win);
444 
445 #ifdef USE_DEBUG_WINDOW
446  debug_win_dump();
447 #endif
448 }
449 
457 {
458  MessageWindow->req_rows = mw_rows;
459  mutt_window_reflow(MessageWindow->parent);
460 
461  /* We don't also set REDRAW_FLOW because this function only
462  * changes rows and is a temporary adjustment. */
463  window_redraw(RootWindow, true);
464 }
465 
474 int mutt_window_wrap_cols(int width, short wrap)
475 {
476  if (wrap < 0)
477  return (width > -wrap) ? (width + wrap) : width;
478  if (wrap)
479  return (wrap < width) ? wrap : width;
480  return width;
481 }
482 
489 int mutt_window_addch(int ch)
490 {
491  return addch(ch);
492 }
493 
501 int mutt_window_addnstr(const char *str, int num)
502 {
503  if (!str)
504  return -1;
505 
506 #ifdef USE_SLANG_CURSES
507  return addnstr((char *) str, num);
508 #else
509  return addnstr(str, num);
510 #endif
511 }
512 
519 int mutt_window_addstr(const char *str)
520 {
521  if (!str)
522  return -1;
523 
524 #ifdef USE_SLANG_CURSES
525  return addstr((char *) str);
526 #else
527  return addstr(str);
528 #endif
529 }
530 
536 void mutt_window_move_abs(int col, int row)
537 {
538  move(row, col);
539 }
540 
547 int mutt_window_printf(const char *fmt, ...)
548 {
549  va_list ap;
550  va_start(ap, fmt);
551  int rc = vw_printw(stdscr, fmt, ap);
552  va_end(ap);
553 
554  return rc;
555 }
556 
562 void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
563 {
564  if (!parent || !child)
565  return;
566 
567  TAILQ_INSERT_TAIL(&parent->children, child, entries);
568  child->parent = parent;
569 
570  notify_set_parent(child->notify, parent->notify);
571 
572  struct EventWindow ev_w = { child, WN_NO_FLAGS };
573  notify_send(child->notify, NT_WINDOW, NT_WINDOW_NEW, &ev_w);
574 }
575 
582 {
583  if (!parent || !child)
584  return NULL;
585 
586  struct EventWindow ev_w = { child, WN_NO_FLAGS };
587  notify_send(child->notify, NT_WINDOW, NT_WINDOW_DELETE, &ev_w);
588 
589  TAILQ_REMOVE(&parent->children, child, entries);
590  child->parent = NULL;
591 
592  notify_set_parent(child->notify, NULL);
593 
594  return child;
595 }
596 
601 void mutt_winlist_free(struct MuttWindowList *head)
602 {
603  if (!head)
604  return;
605 
606  struct MuttWindow *np = NULL;
607  struct MuttWindow *tmp = NULL;
608  TAILQ_FOREACH_SAFE(np, head, entries, tmp)
609  {
610  TAILQ_REMOVE(head, np, entries);
612  mutt_window_free(&np);
613  }
614 }
615 
621 void mutt_window_set_root(int cols, int rows)
622 {
623  if (!RootWindow)
624  return;
625 
626  bool changed = false;
627 
628  if (RootWindow->state.rows != rows)
629  {
630  RootWindow->state.rows = rows;
631  changed = true;
632  }
633 
634  if (RootWindow->state.cols != cols)
635  {
636  RootWindow->state.cols = cols;
637  changed = true;
638  }
639 
640  if (changed)
641  {
642  mutt_window_reflow(RootWindow);
643  }
644 }
645 
655 {
656  if (!win)
657  return false;
658 
659  for (; win; win = win->parent)
660  {
661  if (!win->state.visible)
662  return false;
663  }
664 
665  return true;
666 }
667 
676 {
677  if (!root)
678  return NULL;
679  if (root->type == type)
680  return root;
681 
682  struct MuttWindow *np = NULL;
683  struct MuttWindow *match = NULL;
684  TAILQ_FOREACH(np, &root->children, entries)
685  {
686  match = mutt_window_find(np, type);
687  if (match)
688  return match;
689  }
690 
691  return NULL;
692 }
693 
698 static void window_recalc(struct MuttWindow *win)
699 {
700  if (!win)
701  return;
702 
703  if (win->recalc)
704  {
705  win->recalc(win);
706  win->actions &= ~WA_RECALC;
707  }
708 
709  struct MuttWindow *np = NULL;
710  TAILQ_FOREACH(np, &win->children, entries)
711  {
712  window_recalc(np);
713  }
714 }
715 
721 static void window_repaint(struct MuttWindow *win, bool force)
722 {
723  if (!win)
724  return;
725 
726  if (win->repaint && (force || (win->actions & WA_REPAINT)))
727  {
728  win->repaint(win);
729  win->actions &= ~WA_REPAINT;
730  }
731 
732  struct MuttWindow *np = NULL;
733  TAILQ_FOREACH(np, &win->children, entries)
734  {
735  window_repaint(np, force);
736  }
737 }
738 
744 void window_redraw(struct MuttWindow *win, bool force)
745 {
746  if (!win)
747  return;
748 
749  window_reflow(win);
750  window_notify_all(win);
751 
752  window_recalc(win);
753  window_repaint(win, force);
754 }
755 
760 void window_set_focus(struct MuttWindow *win)
761 {
762  if (!win)
763  return;
764 
765  struct MuttWindow *parent = win->parent;
766  struct MuttWindow *child = win;
767 
768  // Set the chain of focus, all the way to the root
769  for (; parent; child = parent, parent = parent->parent)
770  parent->focus = child;
771 
772  // Find the most focussed Window
773  while (win && win->focus)
774  win = win->focus;
775 
776  struct EventWindow ev_w = { win, WN_NO_FLAGS };
778 #ifdef USE_DEBUG_WINDOW
779  debug_win_dump();
780 #endif
781 }
782 
788 {
789  struct MuttWindow *win = RootWindow;
790 
791  while (win && win->focus)
792  win = win->focus;
793 
794  return win;
795 }
796 
802 {
803  if (!AllDialogsWindow)
804  return NULL;
805 
806  struct MuttWindow *np = NULL;
807  TAILQ_FOREACH(np, &AllDialogsWindow->children, entries)
808  {
809  if (mutt_window_is_visible(np))
810  return np;
811  }
812 
813  return NULL;
814 }
815 
822 void mutt_window_clear(struct MuttWindow *win)
823 {
824  if (!mutt_window_is_visible(win))
825  return;
826 
827  for (int i = 0; i < win->state.rows; i++)
828  mutt_window_clearline(win, i);
829 }
830 
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
static int mutt_dlg_rootwin_observer(struct NotifyCallback *nc)
Listen for config changes affecting the Root Window - Implements observer_t.
Definition: mutt_window.c:267
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:171
Manage keymappings.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Define wrapper functions around Curses/Slang.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:71
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
Definition: mutt_window.c:581
enum MuttWindowOrientation orient
Which direction the Window will expand.
Definition: mutt_window.h:125
#define TAILQ_FIRST(head)
Definition: queue.h:716
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Free the private data attached to the MuttWindow.
Definition: mutt_window.h:147
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:110
Data passed to a notification function.
Definition: observer.h:39
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:195
void mutt_window_init(void)
Create the default Windows.
Definition: mutt_window.c:338
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
Window management.
void window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:760
An Event that happened to a Window.
Definition: mutt_window.h:193
Window for messages/errors and command entry.
Definition: mutt_window.h:98
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:136
Window uses all available vertical space.
Definition: mutt_window.h:36
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:62
static bool is_visible(struct Email *e)
Is the message visible?
Definition: mutt_thread.c:62
void mutt_window_free_all(void)
Free all the default Windows.
Definition: mutt_window.c:303
struct MuttWindow * mutt_window_find(struct MuttWindow *root, enum WindowType type)
Find a Window of a given type.
Definition: mutt_window.c:675
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:242
static bool window_was_visible(struct MuttWindow *win)
Was the Window visible?
Definition: mutt_window.c:71
#define WN_NO_FLAGS
No flags are set.
Definition: mutt_window.h:167
WindowType
Type of Window.
Definition: mutt_window.h:67
MuttWindowOrientation
Which way does the Window expand?
Definition: mutt_window.h:34
A config-change event.
Definition: subset.h:70
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:728
Parent of All Windows.
Definition: mutt_window.h:70
struct MuttWindow * window_get_dialog(void)
Get the currently active Dialog.
Definition: mutt_window.c:801
#define WN_WIDER
Window became wider.
Definition: mutt_window.h:170
static const struct Mapping EditorHelp[]
Help Bar for the Command Line Editor.
Definition: mutt_window.c:48
Window is about to be deleted.
Definition: mutt_window.h:184
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:48
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:174
Window focus has changed.
Definition: mutt_window.h:187
A division of the screen.
Definition: mutt_window.h:117
void mutt_window_move_abs(int col, int row)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:536
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:60
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:396
All user-callable functions.
Container for Accounts, Notifications.
Definition: neomutt.h:36
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:51
Convenience wrapper for the config headers.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:382
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:184
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
struct MuttWindow * focus
Focussed Window.
Definition: mutt_window.h:135
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:127
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:501
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:822
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:133
static void window_repaint(struct MuttWindow *win, bool force)
Repaint a tree of Windows.
Definition: mutt_window.c:721
Log at debug level 2.
Definition: logging.h:41
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:230
struct MuttWindow * window_get_focus(void)
Get the currently focussed Window.
Definition: mutt_window.c:787
Convenience wrapper for the core headers.
New Window has been added.
Definition: mutt_window.h:183
void mutt_winlist_free(struct MuttWindowList *head)
Free a tree of Windows.
Definition: mutt_window.c:601
struct MuttWindow * helpbar_create(void)
Create the Help Bar Window.
Definition: helpbar.c:263
#define TAILQ_INIT(head)
Definition: queue.h:758
Help Bar Convenience wrapper for the Help Bar headers.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:173
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
Window has a fixed size.
Definition: mutt_window.h:45
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
void mutt_window_reflow_message_rows(int mw_rows)
Resize the Message Window.
Definition: mutt_window.c:456
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:185
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:49
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition: reflow.c:222
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
Definition: mutt_window.c:321
void mutt_window_set_root(int cols, int rows)
Set the dimensions of the Root Window.
Definition: mutt_window.c:621
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:122
#define WN_TALLER
Window became taller.
Definition: mutt_window.h:168
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: mutt_window.c:43
bool visible
Window is visible.
Definition: mutt_window.h:57
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:654
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:61
static void window_recalc(struct MuttWindow *win)
Recalculate a tree of Windows.
Definition: mutt_window.c:698
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:50
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:59
uint8_t WindowNotifyFlags
Changes to a MuttWindow.
Definition: mutt_window.h:166
static void window_notify(struct MuttWindow *win)
Notify observers of changes to a Window.
Definition: mutt_window.c:89
const struct Mapping * help_data
Data for the Help Bar.
Definition: mutt_window.h:137
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:94
#define WN_SHORTER
Window became shorter.
Definition: mutt_window.h:169
struct WindowState old
Previous state of the Window.
Definition: mutt_window.h:123
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
Definition: mutt_window.c:474
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:802
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:126
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
Container for All Dialogs (nested Windows)
Definition: mutt_window.h:72
void * event_data
Data from notify_send()
Definition: observer.h:44
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:562
Window management.
The current, or old, state of a Window.
Definition: mutt_window.h:55
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
Definition: mutt_window.c:127
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:41
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:789
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:547
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:489
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:147
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:433
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:130
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:173
int(* repaint)(struct MuttWindow *win)
Repaint the Window.
Definition: mutt_window.h:163
#define FREE(x)
Definition: memory.h:40
Mapping between user-readable string and a constant.
Definition: mapping.h:31
MuttWindowSize
Control the allocation of Window space.
Definition: mutt_window.h:43
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:131
short req_rows
Number of rows required.
Definition: mutt_window.h:120
Text entry area.
Definition: keymap.h:77
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:212
void window_redraw(struct MuttWindow *win, bool force)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:744
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:415
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:82
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:519
#define TAILQ_NEXT(elm, field)
Definition: queue.h:825
int(* recalc)(struct MuttWindow *win)
Recalculate the Window data.
Definition: mutt_window.h:155
void debug_win_dump(void)
Definition: window.c:90
Handling of global boolean variables.
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
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:164
Convenience wrapper for the library headers.
Window wants as much space as possible.
Definition: mutt_window.h:46
void * wdata
Private data.
Definition: mutt_window.h:140
#define N_(a)
Definition: message.h:32
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:139
const char * name
Name of config item that changed.
Definition: subset.h:73
#define WN_MOVED
Window moved.
Definition: mutt_window.h:172
short req_cols
Number of columns required.
Definition: mutt_window.h:119
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:156
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:109