NeoMutt  2025-12-11-694-ga89709
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 "mutt_window.h"
36#include "curs_lib.h"
37#include "globals.h"
38#include "mutt_curses.h"
39#include "reflow.h"
40#include "rootwin.h"
41#ifdef USE_DEBUG_WINDOW
42#include "debug/lib.h"
43#endif
44
46static const struct Mapping WindowNames[] = {
47 // clang-format off
48 { "WT_ALL_DIALOGS", WT_ALL_DIALOGS },
49 { "WT_CONTAINER", WT_CONTAINER },
50 { "WT_CUSTOM", WT_CUSTOM },
51 { "WT_DLG_ALIAS", WT_DLG_ALIAS },
52 { "WT_DLG_ATTACH", WT_DLG_ATTACH },
53 { "WT_DLG_AUTOCRYPT", WT_DLG_AUTOCRYPT },
54 { "WT_DLG_BROWSER", WT_DLG_BROWSER },
55 { "WT_DLG_CERTIFICATE", WT_DLG_CERTIFICATE },
56 { "WT_DLG_COMPOSE", WT_DLG_COMPOSE },
57 { "WT_DLG_GPGME", WT_DLG_GPGME },
58 { "WT_DLG_HISTORY", WT_DLG_HISTORY },
59 { "WT_DLG_INDEX", WT_DLG_INDEX },
60 { "WT_DLG_PAGER", WT_DLG_PAGER },
61 { "WT_DLG_PATTERN", WT_DLG_PATTERN },
62 { "WT_DLG_PGP", WT_DLG_PGP },
63 { "WT_DLG_POSTPONE", WT_DLG_POSTPONE },
64 { "WT_DLG_QUERY", WT_DLG_QUERY },
65 { "WT_DLG_SMIME", WT_DLG_SMIME },
66 { "WT_HELP_BAR", WT_HELP_BAR },
67 { "WT_INDEX", WT_INDEX },
68 { "WT_MENU", WT_MENU },
69 { "WT_MESSAGE", WT_MESSAGE },
70 { "WT_PAGER", WT_PAGER },
71 { "WT_ROOT", WT_ROOT },
72 { "WT_SIDEBAR", WT_SIDEBAR },
73 { "WT_STATUS_BAR", WT_STATUS_BAR },
74 { NULL, 0 },
75 // clang-format on
76};
77
87static bool window_was_visible(struct MuttWindow *win)
88{
89 if (!win)
90 return false;
91
92 for (; win; win = win->parent)
93 {
94 if (!win->old.visible)
95 return false;
96 }
97
98 return true;
99}
100
105static void window_notify(struct MuttWindow *win)
106{
107 if (!win->notify)
108 return;
109
110 const struct WindowState *old = &win->old;
111 const struct WindowState *wstate = &win->state;
113
114 const bool was_visible = window_was_visible(win);
115 const bool is_visible = mutt_window_is_visible(win);
116 if (was_visible != is_visible)
117 flags |= is_visible ? WN_VISIBLE : WN_HIDDEN;
118
119 if ((wstate->row_offset != old->row_offset) || (wstate->col_offset != old->col_offset))
120 flags |= WN_MOVED;
121
122 if (wstate->rows > old->rows)
123 flags |= WN_TALLER;
124 else if (wstate->rows < old->rows)
125 flags |= WN_SHORTER;
126
127 if (wstate->cols > old->cols)
128 flags |= WN_WIDER;
129 else if (wstate->cols < old->cols)
130 flags |= WN_NARROWER;
131
132 if (flags == WN_NO_FLAGS)
133 return;
134
135 mutt_debug(LL_NOTIFY, "NT_WINDOW_STATE: %s, %p\n", mutt_window_win_name(win),
136 (void *) win);
137 struct EventWindow ev_w = { win, flags };
139}
140
146{
147 if (!win)
148 win = RootWindow;
149
151
152 struct MuttWindow **wp = NULL;
153 ARRAY_FOREACH(wp, &win->children)
154 {
156 }
157 win->old = win->state;
158}
159
165void window_set_visible(struct MuttWindow *win, bool visible)
166{
167 if (!win)
168 win = RootWindow;
169
170 win->state.visible = visible;
171}
172
183 enum MuttWindowSize size, int cols, int rows)
184{
185 struct MuttWindow *win = MUTT_MEM_CALLOC(1, struct MuttWindow);
186
187 win->type = type;
188 win->orient = orient;
189 win->size = size;
190 win->req_rows = rows;
191 win->req_cols = cols;
192 win->state.visible = true;
193 win->notify = notify_new();
194 ARRAY_INIT(&win->children);
195
196 win->actions |= WA_RECALC | WA_REPAINT;
197
198 return win;
199}
200
205void mutt_window_free(struct MuttWindow **ptr)
206{
207 if (!ptr || !*ptr)
208 return;
209
210 struct MuttWindow *win = *ptr;
211
212 if (win->parent && (win->parent->focus == win))
213 win->parent->focus = NULL;
214
215 mutt_debug(LL_NOTIFY, "NT_WINDOW_DELETE: %s, %p\n", mutt_window_win_name(win),
216 (void *) win);
217 struct EventWindow ev_w = { win, WN_NO_FLAGS };
219
221
222 if (win->wdata_free && win->wdata)
223 win->wdata_free(win, &win->wdata); // Custom function to free private data
224
226
227 FREE(ptr);
228}
229
236{
237 mutt_window_move(win, row, 0);
239}
240
248{
249 if (!win || !stdscr)
250 return;
251
252 if ((win->state.col_offset + win->state.cols) == COLS)
253 {
254 clrtoeol();
255 }
256 else
257 {
258 int row = 0;
259 int col = 0;
260 getyx(stdscr, row, col);
261 int curcol = col;
262 while (curcol < (win->state.col_offset + win->state.cols))
263 {
264 addch(' ');
265 curcol++;
266 }
267 move(row, col);
268 }
269}
270
280void mutt_window_get_coords(struct MuttWindow *win, int *row, int *col)
281{
282 int x = 0;
283 int y = 0;
284
285 getyx(stdscr, y, x);
286 if (col)
287 *col = x - win->state.col_offset;
288 if (row)
289 *row = y - win->state.row_offset;
290}
291
300int mutt_window_move(struct MuttWindow *win, int row, int col)
301{
302 return move(win->state.row_offset + row, win->state.col_offset + col);
303}
304
310{
311 if (!OptGui)
312 return;
313
314 if (!win)
315 win = RootWindow;
316
319
320 // Allow Windows to resize themselves based on the first reflow
323
324#ifdef USE_DEBUG_WINDOW
326#endif
327}
328
337int mutt_window_wrap_cols(int width, short wrap)
338{
339 if (wrap < 0)
340 return (width > -wrap) ? (width + wrap) : width;
341 if (wrap)
342 return (wrap < width) ? wrap : width;
343 return width;
344}
345
353int mutt_window_addch(struct MuttWindow *win, int ch)
354{
355 return addch(ch);
356}
357
366int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
367{
368 if (!str)
369 return -1;
370
371 return addnstr(str, num);
372}
373
381int mutt_window_addstr(struct MuttWindow *win, const char *str)
382{
383 if (!str)
384 return -1;
385
386 return addstr(str);
387}
388
396int mutt_window_printf(struct MuttWindow *win, const char *fmt, ...)
397{
398 va_list ap;
399 va_start(ap, fmt);
400 int rc = vw_printw(stdscr, fmt, ap);
401 va_end(ap);
402
403 return rc;
404}
405
411void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
412{
413 if (!parent || !child)
414 return;
415
416 ARRAY_ADD(&parent->children, child);
417 child->parent = parent;
418
419 notify_set_parent(child->notify, parent->notify);
420
421 mutt_debug(LL_NOTIFY, "NT_WINDOW_NEW: %s, %p\n", mutt_window_win_name(child),
422 (void *) child);
423 struct EventWindow ev_w = { child, WN_NO_FLAGS };
424 notify_send(child->notify, NT_WINDOW, NT_WINDOW_ADD, &ev_w);
425}
426
434{
435 if (!parent || !child)
436 return NULL;
437
438 // A notification will be sent when the Window is freed
439 struct MuttWindow **wp = NULL;
441 {
442 if (*wp == child)
443 {
445 break;
446 }
447 }
448 child->parent = NULL;
449
450 if (parent->focus == child)
451 parent->focus = NULL;
452
453 notify_set_parent(child->notify, NULL);
454
455 return child;
456}
457
462void mutt_winlist_free(struct MuttWindowArray *wa)
463{
464 if (!wa)
465 return;
466
467 struct MuttWindow **wp = NULL;
468 ARRAY_FOREACH(wp, wa)
469 {
470 struct MuttWindow *win = *wp;
472 mutt_window_free(&win);
473 }
474 ARRAY_FREE(wa);
475}
476
486{
487 if (!win)
488 return false;
489
490 for (; win; win = win->parent)
491 {
492 if (!win->state.visible)
493 return false;
494 }
495
496 return true;
497}
498
507{
508 if (!win)
509 return NULL;
510 if (win->type == type)
511 return win;
512
513 struct MuttWindow **wp = NULL;
514 struct MuttWindow *match = NULL;
515 ARRAY_FOREACH(wp, &win->children)
516 {
517 match = window_find_child(*wp, type);
518 if (match)
519 return match;
520 }
521
522 return NULL;
523}
524
532{
533 for (; win; win = win->parent)
534 {
535 if (win->type == type)
536 return win;
537 }
538
539 return NULL;
540}
541
546static void window_recalc(struct MuttWindow *win)
547{
548 if (!win || !win->state.visible)
549 return;
550
551 if (win->recalc && (win->actions & WA_RECALC))
552 win->recalc(win);
553 win->actions &= ~WA_RECALC;
554
555 struct MuttWindow **wp = NULL;
556 ARRAY_FOREACH(wp, &win->children)
557 {
558 window_recalc(*wp);
559 }
560}
561
566static void window_repaint(struct MuttWindow *win)
567{
568 if (!win || !win->state.visible)
569 return;
570
571 if (win->repaint && (win->actions & WA_REPAINT))
572 win->repaint(win);
573 win->actions &= ~WA_REPAINT;
574
575 struct MuttWindow **wp = NULL;
576 ARRAY_FOREACH(wp, &win->children)
577 {
578 window_repaint(*wp);
579 }
580}
581
588static void window_recursor(void)
589{
590 // Give the focused window an opportunity to set the cursor position
591 struct MuttWindow *win = window_get_focus();
592 if (!win)
593 return;
594
595 if (win->recursor && win->recursor(win))
596 return;
597
599}
600
607void window_redraw(struct MuttWindow *win)
608{
609 if (!win)
610 win = RootWindow;
611
612 window_reflow(win);
614
615 window_recalc(win);
616 window_repaint(win);
618
619 mutt_refresh();
620}
621
627bool window_is_focused(const struct MuttWindow *win)
628{
629 if (!win)
630 return false;
631
632 struct MuttWindow *win_focus = window_get_focus();
633
634 return (win_focus == win);
635}
636
642{
643 struct MuttWindow *win = RootWindow;
644
645 while (win && win->focus)
646 win = win->focus;
647
648 return win;
649}
650
658{
659 if (!win)
660 return NULL;
661
662 struct MuttWindow *old_focus = window_get_focus();
663
664 struct MuttWindow *parent = win->parent;
665 struct MuttWindow *child = win;
666
667 // Set the chain of focus, all the way to the root
668 for (; parent; child = parent, parent = parent->parent)
669 parent->focus = child;
670
671 win->focus = NULL;
672
673 if (win == old_focus)
674 return NULL;
675
676 mutt_debug(LL_NOTIFY, "NT_WINDOW_FOCUS: %s, %p\n", mutt_window_win_name(win),
677 (void *) win);
678 struct EventWindow ev_w = { win, WN_NO_FLAGS };
680#ifdef USE_DEBUG_WINDOW
682#endif
683
684 return old_focus;
685}
686
694{
696 return;
697
698 for (int i = 0; i < win->state.rows; i++)
700}
701
708const char *mutt_window_win_name(const struct MuttWindow *win)
709{
710 if (!win)
711 return "UNKNOWN";
712
713 const char *name = mutt_map_get_name(win->type, WindowNames);
714 if (name)
715 return name;
716 return "UNKNOWN";
717}
718
723static void window_invalidate(struct MuttWindow *win)
724{
725 if (!win)
726 return;
727
729
730 struct MuttWindow **wp = NULL;
731 ARRAY_FOREACH(wp, &win->children)
732 {
734 }
735}
736
741{
743 clearok(stdscr, true);
744 keypad(stdscr, true);
745}
746
757bool window_status_on_top(struct MuttWindow *panel, const struct ConfigSubset *sub)
758{
759 const bool c_status_on_top = cs_subset_bool(sub, "status_on_top");
760
761 struct MuttWindow **wp_first = ARRAY_FIRST(&panel->children);
762 if (!wp_first)
763 return false;
764
765 struct MuttWindow *win = *wp_first;
766
767 if ((c_status_on_top && (win->type == WT_STATUS_BAR)) ||
768 (!c_status_on_top && (win->type != WT_STATUS_BAR)))
769 {
770 return false;
771 }
772
773 if (c_status_on_top)
774 {
775 // Move last window to front
776 struct MuttWindow **wp_last = ARRAY_LAST(&panel->children);
777 if (wp_last)
778 {
779 win = *wp_last;
780 ARRAY_REMOVE(&panel->children, wp_last);
781 ARRAY_INSERT(&panel->children, 0, win);
782 }
783 }
784 else
785 {
786 // Move first window to end
787 ARRAY_REMOVE(&panel->children, wp_first);
788 ARRAY_ADD(&panel->children, win);
789 }
790
791 mutt_window_reflow(panel);
793 return true;
794}
795
803bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1,
804 struct MuttWindow *win2)
805{
806 if (!parent || !win1 || !win2)
807 return false;
808
809 // ensure both windows are children of the parent
810 if (win1->parent != parent || win2->parent != parent)
811 return false;
812
813 // Find indices of both windows
814 int idx1 = -1;
815 int idx2 = -1;
816 struct MuttWindow **wp = NULL;
817 int idx = 0;
819 {
820 if (*wp == win1)
821 idx1 = idx;
822 if (*wp == win2)
823 idx2 = idx;
824 if ((idx1 != -1) && (idx2 != -1))
825 break; // Early exit when both windows found
826 idx++;
827 }
828
829 if (idx1 == -1 || idx2 == -1)
830 return false;
831
832 // Swap the pointers in the array
833 struct MuttWindow **ptr1 = ARRAY_GET(&parent->children, idx1);
834 struct MuttWindow **ptr2 = ARRAY_GET(&parent->children, idx2);
835 if (ptr1 && ptr2)
836 {
837 struct MuttWindow *tmp = *ptr1;
838 *ptr1 = *ptr2;
839 *ptr2 = tmp;
840 }
841
842 return true;
843}
#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.
void mutt_refresh(void)
Force a refresh of the screen.
Definition curs_lib.c:78
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:114
bool OptGui
(pseudo) when the gui (and curses) are started
Definition globals.c:48
Global variables.
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
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
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:46
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:87
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.
#define WA_RECALC
Recalculate the contents of the Window.
#define WN_MOVED
Window moved.
uint8_t WindowNotifyFlags
Flags for Changes to a MuttWindow, e.g. WN_TALLER.
#define WN_WIDER
Window became wider.
WindowType
Type of Window.
Definition mutt_window.h:70
@ WT_CUSTOM
Window with a custom drawing function.
Definition mutt_window.h:94
@ 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:98
@ WT_DLG_SMIME
Smime Dialog, dlg_smime()
Definition mutt_window.h:91
@ WT_DLG_QUERY
Query Dialog, dlg_query()
Definition mutt_window.h:90
@ WT_DLG_HISTORY
History Dialog, dlg_history()
Definition mutt_window.h:85
@ WT_DLG_PGP
Pgp Dialog, dlg_pgp()
Definition mutt_window.h:88
@ 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.
Definition mutt_window.h:99
@ 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:95
@ WT_DLG_POSTPONE
Postpone Dialog, dlg_postpone()
Definition mutt_window.h:89
@ WT_INDEX
A panel containing the Index Window.
Definition mutt_window.h:96
@ 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:97
@ WT_DLG_PATTERN
Pattern Dialog, dlg_pattern()
Definition mutt_window.h:87
MuttWindowOrientation
Which way does the Window expand?
Definition mutt_window.h:37
@ 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.
#define WN_VISIBLE
Window became visible.
#define WN_HIDDEN
Window became hidden.
#define WN_NO_FLAGS
No flags are set.
#define WA_REPAINT
Redraw the contents of the Window.
#define WN_TALLER
Window became taller.
MuttWindowSize
Control the allocation of Window space.
Definition mutt_window.h:46
#define WN_NARROWER
Window became narrower.
#define WN_SHORTER
Window became shorter.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:57
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition reflow.c:220
Window management.
struct MuttWindow * RootWindow
Parent of all Windows.
Definition rootwin.c:106
Root Window.
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.
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.
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