NeoMutt  2025-01-09-41-g086358
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mutt_window.c
Go to the documentation of this file.
1
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_ATTACHMENT", WT_DLG_ATTACHMENT },
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_POSTPONED", WT_DLG_POSTPONED },
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 *np = NULL;
153 TAILQ_FOREACH(np, &win->children, entries)
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 TAILQ_INIT(&win->children);
195 return win;
196}
197
202void mutt_window_free(struct MuttWindow **ptr)
203{
204 if (!ptr || !*ptr)
205 return;
206
207 struct MuttWindow *win = *ptr;
208
209 if (win->parent && (win->parent->focus == win))
210 win->parent->focus = NULL;
211
212 mutt_debug(LL_NOTIFY, "NT_WINDOW_DELETE: %s, %p\n", mutt_window_win_name(win),
213 (void *) win);
214 struct EventWindow ev_w = { win, WN_NO_FLAGS };
216
218
219 if (win->wdata_free && win->wdata)
220 win->wdata_free(win, &win->wdata); // Custom function to free private data
221
223
224 FREE(ptr);
225}
226
233{
234 mutt_window_move(win, row, 0);
236}
237
245{
246 if (!win || !stdscr)
247 return;
248
249 if ((win->state.col_offset + win->state.cols) == COLS)
250 {
251 clrtoeol();
252 }
253 else
254 {
255 int row = 0;
256 int col = 0;
257 getyx(stdscr, row, col);
258 int curcol = col;
259 while (curcol < (win->state.col_offset + win->state.cols))
260 {
261 addch(' ');
262 curcol++;
263 }
264 move(row, col);
265 }
266}
267
277void mutt_window_get_coords(struct MuttWindow *win, int *row, int *col)
278{
279 int x = 0;
280 int y = 0;
281
282 getyx(stdscr, y, x);
283 if (col)
284 *col = x - win->state.col_offset;
285 if (row)
286 *row = y - win->state.row_offset;
287}
288
297int mutt_window_move(struct MuttWindow *win, int row, int col)
298{
299 return move(win->state.row_offset + row, win->state.col_offset + col);
300}
301
307{
308 if (OptNoCurses)
309 return;
310
311 if (!win)
312 win = RootWindow;
313
316
317 // Allow Windows to resize themselves based on the first reflow
320
321#ifdef USE_DEBUG_WINDOW
323#endif
324}
325
334int mutt_window_wrap_cols(int width, short wrap)
335{
336 if (wrap < 0)
337 return (width > -wrap) ? (width + wrap) : width;
338 if (wrap)
339 return (wrap < width) ? wrap : width;
340 return width;
341}
342
350int mutt_window_addch(struct MuttWindow *win, int ch)
351{
352 return addch(ch);
353}
354
363int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
364{
365 if (!str)
366 return -1;
367
368 return addnstr(str, num);
369}
370
378int mutt_window_addstr(struct MuttWindow *win, const char *str)
379{
380 if (!str)
381 return -1;
382
383 return addstr(str);
384}
385
393int mutt_window_printf(struct MuttWindow *win, const char *fmt, ...)
394{
395 va_list ap;
396 va_start(ap, fmt);
397 int rc = vw_printw(stdscr, fmt, ap);
398 va_end(ap);
399
400 return rc;
401}
402
408void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
409{
410 if (!parent || !child)
411 return;
412
413 TAILQ_INSERT_TAIL(&parent->children, child, entries);
414 child->parent = parent;
415
416 notify_set_parent(child->notify, parent->notify);
417
418 mutt_debug(LL_NOTIFY, "NT_WINDOW_NEW: %s, %p\n", mutt_window_win_name(child),
419 (void *) child);
420 struct EventWindow ev_w = { child, WN_NO_FLAGS };
421 notify_send(child->notify, NT_WINDOW, NT_WINDOW_ADD, &ev_w);
422}
423
431{
432 if (!parent || !child)
433 return NULL;
434
435 // A notification will be sent when the Window is freed
436 TAILQ_REMOVE(&parent->children, child, entries);
437 child->parent = NULL;
438
439 if (parent->focus == child)
440 parent->focus = NULL;
441
442 notify_set_parent(child->notify, NULL);
443
444 return child;
445}
446
451void mutt_winlist_free(struct MuttWindowList *head)
452{
453 if (!head)
454 return;
455
456 struct MuttWindow *np = NULL;
457 struct MuttWindow *tmp = NULL;
458 TAILQ_FOREACH_SAFE(np, head, entries, tmp)
459 {
460 TAILQ_REMOVE(head, np, entries);
462 mutt_window_free(&np);
463 }
464}
465
475{
476 if (!win)
477 return false;
478
479 for (; win; win = win->parent)
480 {
481 if (!win->state.visible)
482 return false;
483 }
484
485 return true;
486}
487
496{
497 if (!win)
498 return NULL;
499 if (win->type == type)
500 return win;
501
502 struct MuttWindow *np = NULL;
503 struct MuttWindow *match = NULL;
504 TAILQ_FOREACH(np, &win->children, entries)
505 {
506 match = window_find_child(np, type);
507 if (match)
508 return match;
509 }
510
511 return NULL;
512}
513
521{
522 for (; win; win = win->parent)
523 {
524 if (win->type == type)
525 return win;
526 }
527
528 return NULL;
529}
530
535static void window_recalc(struct MuttWindow *win)
536{
537 if (!win || !win->state.visible)
538 return;
539
540 if (win->recalc && (win->actions & WA_RECALC))
541 win->recalc(win);
542 win->actions &= ~WA_RECALC;
543
544 struct MuttWindow *np = NULL;
545 TAILQ_FOREACH(np, &win->children, entries)
546 {
547 window_recalc(np);
548 }
549}
550
555static void window_repaint(struct MuttWindow *win)
556{
557 if (!win || !win->state.visible)
558 return;
559
560 if (win->repaint && (win->actions & WA_REPAINT))
561 win->repaint(win);
562 win->actions &= ~WA_REPAINT;
563
564 struct MuttWindow *np = NULL;
565 TAILQ_FOREACH(np, &win->children, entries)
566 {
567 window_repaint(np);
568 }
569}
570
577static void window_recursor(void)
578{
579 // Give the focussed window an opportunity to set the cursor position
580 struct MuttWindow *win = window_get_focus();
581 if (!win)
582 return;
583
584 if (win->recursor && win->recursor(win))
585 return;
586
588}
589
596void window_redraw(struct MuttWindow *win)
597{
598 if (!win)
599 win = RootWindow;
600
601 window_reflow(win);
603
604 window_recalc(win);
605 window_repaint(win);
607
608 mutt_refresh();
609}
610
616bool window_is_focused(const struct MuttWindow *win)
617{
618 if (!win)
619 return false;
620
621 struct MuttWindow *win_focus = window_get_focus();
622
623 return (win_focus == win);
624}
625
631{
632 struct MuttWindow *win = RootWindow;
633
634 while (win && win->focus)
635 win = win->focus;
636
637 return win;
638}
639
647{
648 if (!win)
649 return NULL;
650
651 struct MuttWindow *old_focus = window_get_focus();
652
653 struct MuttWindow *parent = win->parent;
654 struct MuttWindow *child = win;
655
656 // Set the chain of focus, all the way to the root
657 for (; parent; child = parent, parent = parent->parent)
658 parent->focus = child;
659
660 win->focus = NULL;
661
662 if (win == old_focus)
663 return NULL;
664
665 mutt_debug(LL_NOTIFY, "NT_WINDOW_FOCUS: %s, %p\n", mutt_window_win_name(win),
666 (void *) win);
667 struct EventWindow ev_w = { win, WN_NO_FLAGS };
669#ifdef USE_DEBUG_WINDOW
671#endif
672
673 return old_focus;
674}
675
683{
685 return;
686
687 for (int i = 0; i < win->state.rows; i++)
689}
690
697const char *mutt_window_win_name(const struct MuttWindow *win)
698{
699 if (!win)
700 return "UNKNOWN";
701
702 const char *name = mutt_map_get_name(win->type, WindowNames);
703 if (name)
704 return name;
705 return "UNKNOWN";
706}
707
712static void window_invalidate(struct MuttWindow *win)
713{
714 if (!win)
715 return;
716
718
719 struct MuttWindow *np = NULL;
720 TAILQ_FOREACH(np, &win->children, entries)
721 {
723 }
724}
725
730{
732 clearok(stdscr, true);
733 keypad(stdscr, true);
734}
735
746bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
747{
748 const bool c_status_on_top = cs_subset_bool(sub, "status_on_top");
749
750 struct MuttWindow *win = TAILQ_FIRST(&panel->children);
751
752 if ((c_status_on_top && (win->type == WT_STATUS_BAR)) ||
753 (!c_status_on_top && (win->type != WT_STATUS_BAR)))
754 {
755 return false;
756 }
757
758 if (c_status_on_top)
759 {
760 win = TAILQ_LAST(&panel->children, MuttWindowList);
761 TAILQ_REMOVE(&panel->children, win, entries);
762 TAILQ_INSERT_HEAD(&panel->children, win, entries);
763 }
764 else
765 {
766 TAILQ_REMOVE(&panel->children, win, entries);
767 TAILQ_INSERT_TAIL(&panel->children, win, entries);
768 }
769
770 mutt_window_reflow(panel);
772 return true;
773}
774
782bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1,
783 struct MuttWindow *win2)
784{
785 if (!parent || !win1 || !win2)
786 return false;
787
788 // ensure both windows are children of the parent
789 if (win1->parent != parent || win2->parent != parent)
790 return false;
791
792 struct MuttWindow *win1_next = TAILQ_NEXT(win1, entries);
793 if (win1_next == win2)
794 {
795 // win1 is directly in front of win2, move it behind
796 TAILQ_REMOVE(&parent->children, win1, entries);
797 TAILQ_INSERT_AFTER(&parent->children, win2, win1, entries);
798 return true;
799 }
800
801 struct MuttWindow *win2_next = TAILQ_NEXT(win2, entries);
802 if (win2_next == win1)
803 {
804 // win2 is directly in front of win1, move it behind
805 TAILQ_REMOVE(&parent->children, win2, entries);
806 TAILQ_INSERT_AFTER(&parent->children, win1, win2, entries);
807 return true;
808 }
809
810 TAILQ_REMOVE(&parent->children, win1, entries);
811 TAILQ_REMOVE(&parent->children, win2, entries);
812
813 if (win1_next)
814 TAILQ_INSERT_BEFORE(win1_next, win2, entries);
815 else
816 TAILQ_INSERT_TAIL(&parent->children, win2, entries);
817
818 if (win2_next)
819 TAILQ_INSERT_BEFORE(win2_next, win1, entries);
820 else
821 TAILQ_INSERT_TAIL(&parent->children, win1, entries);
822
823 return true;
824}
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)
Definition: window.c:96
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: globals.c:69
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
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)
Definition: memory.h:55
#define MUTT_MEM_CALLOC(n, type)
Definition: memory.h:40
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
static bool is_visible(struct Email *e)
Is the message visible?
Definition: mutt_thread.c:123
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:682
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:474
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:596
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:306
static void window_recursor(void)
Recursor the focussed Window.
Definition: mutt_window.c:577
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
Definition: mutt_window.c:520
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
Definition: mutt_window.c:145
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:746
static void window_notify(struct MuttWindow *win)
Notify observers of changes to a Window.
Definition: mutt_window.c:105
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
Definition: mutt_window.c:616
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.
Definition: mutt_window.c:202
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:408
const char * mutt_window_win_name(const struct MuttWindow *win)
Get the name of a Window.
Definition: mutt_window.c:697
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:393
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:182
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:630
static void window_invalidate(struct MuttWindow *win)
Mark a window as in need of repaint.
Definition: mutt_window.c:712
bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2)
Swap the position of two windows.
Definition: mutt_window.c:782
static void window_recalc(struct MuttWindow *win)
Recalculate a tree of Windows.
Definition: mutt_window.c:535
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:646
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:297
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
Definition: mutt_window.c:430
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:165
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.
Definition: mutt_window.c:277
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
Definition: mutt_window.c:334
void mutt_winlist_free(struct MuttWindowList *head)
Free a tree of Windows.
Definition: mutt_window.c:451
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:495
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:232
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
Definition: mutt_window.c:378
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:363
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:244
static void window_repaint(struct MuttWindow *win)
Repaint a tree of Windows.
Definition: mutt_window.c:555
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:729
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
Definition: mutt_window.c:350
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:214
uint8_t WindowNotifyFlags
Flags for Changes to a MuttWindow, e.g. WN_TALLER.
Definition: mutt_window.h:208
#define WN_WIDER
Window became wider.
Definition: mutt_window.h:212
WindowType
Type of Window.
Definition: mutt_window.h:71
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ WT_ROOT
Parent of All Windows.
Definition: mutt_window.h:73
@ WT_DLG_ALIAS
Alias Dialog, dlg_alias()
Definition: mutt_window.h:78
@ WT_ALL_DIALOGS
Container for All Dialogs (nested Windows)
Definition: mutt_window.h:75
@ WT_DLG_BROWSER
Browser Dialog, dlg_browser()
Definition: mutt_window.h:81
@ 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:86
@ WT_DLG_PGP
Pgp Dialog, dlg_pgp()
Definition: mutt_window.h:89
@ WT_CONTAINER
Invisible shaping container Window.
Definition: mutt_window.h:74
@ WT_DLG_CERTIFICATE
Certificate Dialog, dlg_certificate()
Definition: mutt_window.h:82
@ WT_DLG_COMPOSE
Compose Dialog, dlg_compose()
Definition: mutt_window.h:83
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition: mutt_window.h:87
@ WT_PAGER
A panel containing the Pager Window.
Definition: mutt_window.h:100
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
Definition: mutt_window.h:84
@ 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_POSTPONED
Postponed Dialog, dlg_postponed()
Definition: mutt_window.h:90
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ WT_DLG_ATTACHMENT
Attachment Dialog, dlg_attachment()
Definition: mutt_window.h:79
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
@ WT_DLG_PAGER
Pager Dialog, dlg_pager()
Definition: mutt_window.h:85
@ WT_DLG_AUTOCRYPT
Autocrypt Dialog, dlg_autocrypt()
Definition: mutt_window.h:80
@ 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:38
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:230
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:232
@ NT_WINDOW_ADD
New Window has been added.
Definition: mutt_window.h:228
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:215
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:216
#define WN_NO_FLAGS
No flags are set.
Definition: mutt_window.h:209
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
#define WN_TALLER
Window became taller.
Definition: mutt_window.h:210
MuttWindowSize
Control the allocation of Window space.
Definition: mutt_window.h:47
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:213
#define WN_SHORTER
Window became shorter.
Definition: mutt_window.h:211
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:782
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:792
#define TAILQ_INIT(head)
Definition: queue.h:822
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:866
#define TAILQ_FIRST(head)
Definition: queue.h:780
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:901
#define TAILQ_NEXT(elm, field)
Definition: queue.h:889
#define TAILQ_INSERT_BEFORE(listelm, elm, field)
Definition: queue.h:843
#define TAILQ_LAST(head, headname)
Definition: queue.h:876
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:853
#define TAILQ_INSERT_AFTER(head, listelm, elm, field)
Definition: queue.h:828
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:47
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:241
Mapping between user-readable string and a constant.
Definition: mapping.h:33
struct WindowState old
Previous state of the Window.
Definition: mutt_window.h:128
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:187
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:173
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Definition: mutt_window.h:159
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
bool(* recursor)(struct MuttWindow *win)
Definition: mutt_window.h:205
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:59
bool visible
Window is visible.
Definition: mutt_window.h:60
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:64
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:63
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:62