NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mutt_window.c
Go to the documentation of this file.
1
23
29
30#include "config.h"
31#include <stdarg.h>
32#include <string.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35#include "core/lib.h"
36#include "mutt_window.h"
37#include "curs_lib.h"
38#include "globals.h"
39#include "module_data.h"
40#include "mutt_curses.h"
41#include "reflow.h"
42#ifdef USE_DEBUG_WINDOW
43#include "debug/lib.h"
44#endif
45
47static const struct Mapping WindowNames[] = {
48 // clang-format off
49 { "WT_ALL_DIALOGS", WT_ALL_DIALOGS },
50 { "WT_CONTAINER", WT_CONTAINER },
51 { "WT_CUSTOM", WT_CUSTOM },
52 { "WT_DLG_ALIAS", WT_DLG_ALIAS },
53 { "WT_DLG_ATTACH", WT_DLG_ATTACH },
54 { "WT_DLG_AUTOCRYPT", WT_DLG_AUTOCRYPT },
55 { "WT_DLG_BROWSER", WT_DLG_BROWSER },
56 { "WT_DLG_CERTIFICATE", WT_DLG_CERTIFICATE },
57 { "WT_DLG_COMPOSE", WT_DLG_COMPOSE },
58 { "WT_DLG_GPGME", WT_DLG_GPGME },
59 { "WT_DLG_HISTORY", WT_DLG_HISTORY },
60 { "WT_DLG_INDEX", WT_DLG_INDEX },
61 { "WT_DLG_LIST", WT_DLG_LIST },
62 { "WT_DLG_PAGER", WT_DLG_PAGER },
63 { "WT_DLG_PATTERN", WT_DLG_PATTERN },
64 { "WT_DLG_PGP", WT_DLG_PGP },
65 { "WT_DLG_POSTPONE", WT_DLG_POSTPONE },
66 { "WT_DLG_QUERY", WT_DLG_QUERY },
67 { "WT_DLG_SMIME", WT_DLG_SMIME },
68 { "WT_HELP_BAR", WT_HELP_BAR },
69 { "WT_INDEX", WT_INDEX },
70 { "WT_MENU", WT_MENU },
71 { "WT_MESSAGE", WT_MESSAGE },
72 { "WT_PAGER", WT_PAGER },
73 { "WT_ROOT", WT_ROOT },
74 { "WT_SIDEBAR", WT_SIDEBAR },
75 { "WT_STATUS_BAR", WT_STATUS_BAR },
76 { NULL, 0 },
77 // clang-format on
78};
79
89static bool window_was_visible(struct MuttWindow *win)
90{
91 if (!win)
92 return false;
93
94 for (; win; win = win->parent)
95 {
96 if (!win->old.visible)
97 return false;
98 }
99
100 return true;
101}
102
107static void window_notify(struct MuttWindow *win)
108{
109 if (!win->notify)
110 return;
111
112 const struct WindowState *old = &win->old;
113 const struct WindowState *wstate = &win->state;
115
116 const bool was_visible = window_was_visible(win);
117 const bool is_visible = mutt_window_is_visible(win);
118 if (was_visible != is_visible)
119 flags |= is_visible ? WN_VISIBLE : WN_HIDDEN;
120
121 if ((wstate->row_offset != old->row_offset) || (wstate->col_offset != old->col_offset))
122 flags |= WN_MOVED;
123
124 if (wstate->rows > old->rows)
125 flags |= WN_TALLER;
126 else if (wstate->rows < old->rows)
127 flags |= WN_SHORTER;
128
129 if (wstate->cols > old->cols)
130 flags |= WN_WIDER;
131 else if (wstate->cols < old->cols)
132 flags |= WN_NARROWER;
133
134 if (flags == WN_NONE)
135 return;
136
137 mutt_debug(LL_NOTIFY, "NT_WINDOW_STATE: %s, %p\n", mutt_window_win_name(win),
138 (void *) win);
139 struct EventWindow ev_w = { win, flags };
141}
142
148{
149 if (!win)
150 {
152 win = mod_data ? mod_data->root_window : NULL;
153 }
154 if (!win)
155 return;
156
157 window_notify(win);
158
159 struct MuttWindow **wp = NULL;
160 ARRAY_FOREACH(wp, &win->children)
161 {
163 }
164 win->old = win->state;
165}
166
172void window_set_visible(struct MuttWindow *win, bool visible)
173{
174 if (!win)
175 {
177 win = mod_data ? mod_data->root_window : NULL;
178 }
179 if (!win)
180 return;
181
182 win->state.visible = visible;
183}
184
195 enum MuttWindowSize size, int cols, int rows)
196{
197 struct MuttWindow *win = MUTT_MEM_CALLOC(1, struct MuttWindow);
198
199 win->type = type;
200 win->orient = orient;
201 win->size = size;
202 win->req_rows = rows;
203 win->req_cols = cols;
204 win->state.visible = true;
205 win->notify = notify_new();
206 ARRAY_INIT(&win->children);
207
208 win->actions |= WA_RECALC | WA_REPAINT;
209
210 return win;
211}
212
217void mutt_window_free(struct MuttWindow **ptr)
218{
219 if (!ptr || !*ptr)
220 return;
221
222 struct MuttWindow *win = *ptr;
223
224 if (win->parent && (win->parent->focus == win))
225 win->parent->focus = NULL;
226
227 mutt_debug(LL_NOTIFY, "NT_WINDOW_DELETE: %s, %p\n", mutt_window_win_name(win),
228 (void *) win);
229 struct EventWindow ev_w = { win, WN_NONE };
231
233
234 if (win->wdata_free && win->wdata)
235 win->wdata_free(win, &win->wdata); // Custom function to free private data
236
238
239 FREE(ptr);
240}
241
248{
249 mutt_window_move(win, row, 0);
251}
252
260{
261 if (!win || !stdscr)
262 return;
263
264 if ((win->state.col_offset + win->state.cols) == COLS)
265 {
266 clrtoeol();
267 }
268 else
269 {
270 int row = 0;
271 int col = 0;
272 getyx(stdscr, row, col);
273 int curcol = col;
274 while (curcol < (win->state.col_offset + win->state.cols))
275 {
276 addch(' ');
277 curcol++;
278 }
279 move(row, col);
280 }
281}
282
292void mutt_window_get_coords(struct MuttWindow *win, int *row, int *col)
293{
294 int x = 0;
295 int y = 0;
296
297 getyx(stdscr, y, x);
298 if (col)
299 *col = x - win->state.col_offset;
300 if (row)
301 *row = y - win->state.row_offset;
302}
303
312int mutt_window_move(struct MuttWindow *win, int row, int col)
313{
314 return move(win->state.row_offset + row, win->state.col_offset + col);
315}
316
322{
323 if (!OptGui)
324 return;
325
326 if (!win)
327 {
329 win = mod_data ? mod_data->root_window : NULL;
330 }
331 if (!win)
332 return;
333
334 window_reflow(win);
336
337 // Allow Windows to resize themselves based on the first reflow
338 window_reflow(win);
340
341#ifdef USE_DEBUG_WINDOW
343#endif
344}
345
354int mutt_window_wrap_cols(int width, short wrap)
355{
356 if (wrap < 0)
357 return (width > -wrap) ? (width + wrap) : width;
358 if (wrap)
359 return (wrap < width) ? wrap : width;
360 return width;
361}
362
370int mutt_window_addch(struct MuttWindow *win, int ch)
371{
372 return addch(ch);
373}
374
383int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
384{
385 if (!str)
386 return -1;
387
388 return addnstr(str, num);
389}
390
398int mutt_window_addstr(struct MuttWindow *win, const char *str)
399{
400 if (!str)
401 return -1;
402
403 return addstr(str);
404}
405
413int mutt_window_printf(struct MuttWindow *win, const char *fmt, ...)
414{
415 va_list ap;
416 va_start(ap, fmt);
417 int rc = vw_printw(stdscr, fmt, ap);
418 va_end(ap);
419
420 return rc;
421}
422
428void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
429{
430 if (!parent || !child)
431 return;
432
433 ARRAY_ADD(&parent->children, child);
434 child->parent = parent;
435
436 notify_set_parent(child->notify, parent->notify);
437
438 mutt_debug(LL_NOTIFY, "NT_WINDOW_NEW: %s, %p\n", mutt_window_win_name(child),
439 (void *) child);
440 struct EventWindow ev_w = { child, WN_NONE };
441 notify_send(child->notify, NT_WINDOW, NT_WINDOW_ADD, &ev_w);
442}
443
451{
452 if (!parent || !child)
453 return NULL;
454
455 // A notification will be sent when the Window is freed
456 struct MuttWindow **wp = NULL;
458 {
459 if (*wp == child)
460 {
462 break;
463 }
464 }
465 child->parent = NULL;
466
467 if (parent->focus == child)
468 parent->focus = NULL;
469
470 notify_set_parent(child->notify, NULL);
471
472 return child;
473}
474
479void mutt_winlist_free(struct MuttWindowArray *wa)
480{
481 if (!wa)
482 return;
483
484 struct MuttWindow **wp = NULL;
485 ARRAY_FOREACH(wp, wa)
486 {
487 struct MuttWindow *win = *wp;
489 mutt_window_free(&win);
490 }
491 ARRAY_FREE(wa);
492}
493
503{
504 if (!win)
505 return false;
506
507 for (; win; win = win->parent)
508 {
509 if (!win->state.visible)
510 return false;
511 }
512
513 return true;
514}
515
524{
525 if (!win)
526 return NULL;
527 if (win->type == type)
528 return win;
529
530 struct MuttWindow **wp = NULL;
531 struct MuttWindow *match = NULL;
532 ARRAY_FOREACH(wp, &win->children)
533 {
534 match = window_find_child(*wp, type);
535 if (match)
536 return match;
537 }
538
539 return NULL;
540}
541
549{
550 for (; win; win = win->parent)
551 {
552 if (win->type == type)
553 return win;
554 }
555
556 return NULL;
557}
558
563static void window_recalc(struct MuttWindow *win)
564{
565 if (!win || !win->state.visible)
566 return;
567
568 if (win->recalc && (win->actions & WA_RECALC))
569 win->recalc(win);
570 win->actions &= ~WA_RECALC;
571
572 struct MuttWindow **wp = NULL;
573 ARRAY_FOREACH(wp, &win->children)
574 {
575 window_recalc(*wp);
576 }
577}
578
583static void window_repaint(struct MuttWindow *win)
584{
585 if (!win || !win->state.visible)
586 return;
587
588 if (win->repaint && (win->actions & WA_REPAINT))
589 win->repaint(win);
590 win->actions &= ~WA_REPAINT;
591
592 struct MuttWindow **wp = NULL;
593 ARRAY_FOREACH(wp, &win->children)
594 {
595 window_repaint(*wp);
596 }
597}
598
605static void window_recursor(void)
606{
607 // Give the focused window an opportunity to set the cursor position
608 struct MuttWindow *win = window_get_focus();
609 if (!win)
610 return;
611
612 if (win->recursor && win->recursor(win))
613 return;
614
616}
617
624void window_redraw(struct MuttWindow *win)
625{
626 if (!win)
627 {
629 win = mod_data ? mod_data->root_window : NULL;
630 }
631 if (!win)
632 return;
633
634 window_reflow(win);
636
637 window_recalc(win);
638 window_repaint(win);
640
641 mutt_refresh();
642}
643
649bool window_is_focused(const struct MuttWindow *win)
650{
651 if (!win)
652 return false;
653
654 struct MuttWindow *win_focus = window_get_focus();
655
656 return (win_focus == win);
657}
658
664{
666 struct MuttWindow *win = mod_data ? mod_data->root_window : NULL;
667
668 while (win && win->focus)
669 win = win->focus;
670
671 return win;
672}
673
681{
682 if (!win)
683 return NULL;
684
685 struct MuttWindow *old_focus = window_get_focus();
686
687 struct MuttWindow *parent = win->parent;
688 struct MuttWindow *child = win;
689
690 // Set the chain of focus, all the way to the root
691 for (; parent; child = parent, parent = parent->parent)
692 parent->focus = child;
693
694 win->focus = NULL;
695
696 if (win == old_focus)
697 return NULL;
698
699 mutt_debug(LL_NOTIFY, "NT_WINDOW_FOCUS: %s, %p\n", mutt_window_win_name(win),
700 (void *) win);
701 struct EventWindow ev_w = { win, WN_NONE };
703#ifdef USE_DEBUG_WINDOW
705#endif
706
707 return old_focus;
708}
709
717{
719 return;
720
721 for (int i = 0; i < win->state.rows; i++)
723}
724
731const char *mutt_window_win_name(const struct MuttWindow *win)
732{
733 if (!win)
734 return "UNKNOWN";
735
736 const char *name = mutt_map_get_name(win->type, WindowNames);
737 if (name)
738 return name;
739 return "UNKNOWN";
740}
741
746static void window_invalidate(struct MuttWindow *win)
747{
748 if (!win)
749 return;
750
752
753 struct MuttWindow **wp = NULL;
754 ARRAY_FOREACH(wp, &win->children)
755 {
757 }
758}
759
764{
766 window_invalidate(mod_data ? mod_data->root_window : NULL);
767 clearok(stdscr, true);
768 keypad(stdscr, true);
769}
770
781bool window_status_on_top(struct MuttWindow *panel, const struct ConfigSubset *sub)
782{
783 const bool c_status_on_top = cs_subset_bool(sub, "status_on_top");
784
785 struct MuttWindow **wp_first = ARRAY_FIRST(&panel->children);
786 if (!wp_first)
787 return false;
788
789 struct MuttWindow *win = *wp_first;
790
791 if ((c_status_on_top && (win->type == WT_STATUS_BAR)) ||
792 (!c_status_on_top && (win->type != WT_STATUS_BAR)))
793 {
794 return false;
795 }
796
797 if (c_status_on_top)
798 {
799 // Move last window to front
800 struct MuttWindow **wp_last = ARRAY_LAST(&panel->children);
801 if (wp_last)
802 {
803 win = *wp_last;
804 ARRAY_REMOVE(&panel->children, wp_last);
805 ARRAY_INSERT(&panel->children, 0, win);
806 }
807 }
808 else
809 {
810 // Move first window to end
811 ARRAY_REMOVE(&panel->children, wp_first);
812 ARRAY_ADD(&panel->children, win);
813 }
814
815 mutt_window_reflow(panel);
817 return true;
818}
819
827bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1,
828 struct MuttWindow *win2)
829{
830 if (!parent || !win1 || !win2)
831 return false;
832
833 // ensure both windows are children of the parent
834 if (win1->parent != parent || win2->parent != parent)
835 return false;
836
837 // Find indices of both windows
838 int idx1 = -1;
839 int idx2 = -1;
840 struct MuttWindow **wp = NULL;
841 int idx = 0;
843 {
844 if (*wp == win1)
845 idx1 = idx;
846 if (*wp == win2)
847 idx2 = idx;
848 if ((idx1 != -1) && (idx2 != -1))
849 break; // Early exit when both windows found
850 idx++;
851 }
852
853 if (idx1 == -1 || idx2 == -1)
854 return false;
855
856 // Swap the pointers in the array
857 struct MuttWindow **ptr1 = ARRAY_GET(&parent->children, idx1);
858 struct MuttWindow **ptr2 = ARRAY_GET(&parent->children, idx2);
859 if (ptr1 && ptr2)
860 {
861 struct MuttWindow *tmp = *ptr1;
862 *ptr1 = *ptr2;
863 *ptr2 = tmp;
864 }
865
866 return true;
867}
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition array.h:136
#define ARRAY_INSERT(head, idx, elem)
Insert an element into the, shifting up the subsequent entries.
Definition array.h:338
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:157
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_LAST(head)
Convenience method to get the last element.
Definition array.h:145
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
#define ARRAY_INIT(head)
Initialize an array.
Definition array.h:65
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
void mutt_refresh(void)
Force a refresh of the screen.
Definition curs_lib.c:79
GUI miscellaneous curses (window drawing) routines.
Convenience wrapper for the debug headers.
void debug_win_dump(void)
Dump all windows to debug output.
Definition window.c:116
bool OptGui
(pseudo) when the gui (and curses) are started
Definition globals.c:48
Global variables.
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
Gui private Module data.
static bool is_visible(struct Email *e)
Is the message visible?
Definition thread.c:120
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition mapping.c:42
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
enum MuttCursorState mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition mutt_curses.c:94
Define wrapper functions around Curses.
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
Definition mutt_curses.h:65
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
static void window_recursor(void)
Recursor the focused Window.
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
static void window_notify(struct MuttWindow *win)
Notify observers of changes to a Window.
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
static const struct Mapping WindowNames[]
Lookups for Window Names.
Definition mutt_window.c:47
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
const char * mutt_window_win_name(const struct MuttWindow *win)
Get the name of a Window.
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
static void window_invalidate(struct MuttWindow *win)
Mark a window as in need of repaint.
void mutt_winlist_free(struct MuttWindowArray *wa)
Free a tree of Windows.
bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2)
Swap the position of two windows.
static void window_recalc(struct MuttWindow *win)
Recalculate a tree of Windows.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
static bool window_was_visible(struct MuttWindow *win)
Was the Window visible?
Definition mutt_window.c:89
void mutt_window_get_coords(struct MuttWindow *win, int *row, int *col)
Get the cursor position in the Window.
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
static void window_repaint(struct MuttWindow *win)
Repaint a tree of Windows.
void window_invalidate_all(void)
Mark all windows as in need of repaint.
bool window_status_on_top(struct MuttWindow *panel, const struct ConfigSubset *sub)
Organise windows according to config variable.
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
Window management.
uint8_t WindowNotifyFlags
WindowType
Type of Window.
Definition mutt_window.h:70
@ WT_DLG_LIST
List Dialog, dlg_list()
Definition mutt_window.h:87
@ 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_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, dlg_browser()
Definition mutt_window.h:80
@ WT_MESSAGE
Window for messages/errors.
Definition mutt_window.h:99
@ WT_DLG_SMIME
Smime Dialog, dlg_smime()
Definition mutt_window.h:92
@ WT_DLG_QUERY
Query Dialog, dlg_query()
Definition mutt_window.h:91
@ WT_DLG_HISTORY
History Dialog, dlg_history()
Definition mutt_window.h:85
@ WT_DLG_PGP
Pgp Dialog, dlg_pgp()
Definition mutt_window.h:89
@ WT_CONTAINER
Invisible shaping container Window.
Definition mutt_window.h:73
@ WT_DLG_CERTIFICATE
Certificate Dialog, dlg_certificate()
Definition mutt_window.h:81
@ WT_DLG_COMPOSE
Compose Dialog, dlg_compose()
Definition mutt_window.h:82
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition mutt_window.h:86
@ WT_PAGER
A panel containing the Pager Window.
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
Definition mutt_window.h:83
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition mutt_window.h:96
@ WT_DLG_POSTPONE
Postpone Dialog, dlg_postpone()
Definition mutt_window.h:90
@ WT_INDEX
A panel containing the Index Window.
Definition mutt_window.h:97
@ WT_DLG_ATTACH
Attach Dialog, dlg_attach()
Definition mutt_window.h:78
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
@ WT_DLG_PAGER
Pager Dialog, dlg_pager()
Definition mutt_window.h:84
@ WT_DLG_AUTOCRYPT
Autocrypt Dialog, dlg_autocrypt()
Definition mutt_window.h:79
@ WT_MENU
An Window containing a Menu.
Definition mutt_window.h:98
@ WT_DLG_PATTERN
Pattern Dialog, dlg_pattern()
Definition mutt_window.h:88
MuttWindowOrientation
Which way does the Window expand?
Definition mutt_window.h:37
@ WA_REPAINT
Redraw the contents of the Window.
@ WA_RECALC
Recalculate the contents of the Window.
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
@ NT_WINDOW_DELETE
Window is about to be deleted.
@ NT_WINDOW_FOCUS
Window focus has changed.
@ NT_WINDOW_ADD
New Window has been added.
@ WN_WIDER
Window became wider.
@ WN_HIDDEN
Window became hidden.
@ WN_NARROWER
Window became narrower.
@ WN_VISIBLE
Window became visible.
@ WN_TALLER
Window became taller.
@ WN_MOVED
Window moved.
@ WN_SHORTER
Window became shorter.
@ WN_NONE
No flags are set.
MuttWindowSize
Control the allocation of Window space.
Definition mutt_window.h:46
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:58
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition reflow.c:234
Window management.
A set of inherited config items.
Definition subset.h:46
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
WindowNotifyFlags flags
Attributes of Window that changed.
Gui private Module data.
Definition module_data.h:32
struct MuttWindow * root_window
Parent of all Windows.
Definition module_data.h:41
Mapping between user-readable string and a constant.
Definition mapping.h:33
struct WindowState old
Previous state of the Window.
struct MuttWindowArray children
Children Windows.
int(* repaint)(struct MuttWindow *win)
short req_cols
Number of columns required.
struct WindowState state
Current state of the Window.
struct MuttWindow * focus
Focused Window.
void * wdata
Private data.
enum MuttWindowOrientation orient
Which direction the Window will expand.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
short req_rows
Number of rows required.
int(* recalc)(struct MuttWindow *win)
void(* wdata_free)(struct MuttWindow *win, void **ptr)
struct MuttWindow * parent
Parent Window.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
bool(* recursor)(struct MuttWindow *win)
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Container for Accounts, Notifications.
Definition neomutt.h:41
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