grid_defs.h
Go to the documentation of this file.
1 #ifndef NVIM_GRID_DEFS_H
2 #define NVIM_GRID_DEFS_H
3 
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include <stdint.h>
7 
8 #include "nvim/types.h"
9 
10 #define MAX_MCO 6 // fixed value for 'maxcombine'
11 
12 // The characters and attributes drawn on grids.
13 typedef char_u schar_T[(MAX_MCO+1) * 4 + 1];
14 typedef int sattr_T;
15 
16 enum {
22 };
23 
24 
47 typedef struct ScreenGrid ScreenGrid;
48 struct ScreenGrid {
50 
53  unsigned *line_offset;
55 
56  // last column that was drawn (not cleared with the default background).
57  // only used when "throttled" is set. Not allocated by grid_alloc!
58  int *dirty_col;
59 
60  // the size of the allocated grid.
61  int Rows;
62  int Columns;
63 
64  // The state of the grid is valid. Otherwise it needs to be redrawn.
65  bool valid;
66 
67  // only draw internally and don't send updates yet to the compositor or
68  // external UI.
69  bool throttled;
70 
71  // TODO(bfredl): maybe physical grids and "views" (i e drawing
72  // specifications) should be two separate types?
73  // offsets for the grid relative to another grid. Used for grids
74  // that are views into another, actually allocated grid 'target'
78 
79  // whether the compositor should blend the grid with the background grid
80  bool blending;
81 
82  // whether the grid can be focused with mouse clicks.
83  bool focusable;
84 
85  // z-index: the order in the stack of grids.
86  int zindex;
87 
88  // Below is state owned by the compositor. Should generally not be set/read
89  // outside this module, except for specific compatibility hacks
90 
91  // position of the grid on the composed screen.
92  int comp_row;
93  int comp_col;
94 
95  // Requested width and height of the grid upon resize. Used by
96  // `ui_compositor` to correctly determine which regions need to
97  // be redrawn.
100 
101  // z-index of the grid. Grids with higher index is draw on top.
102  // default_grid.comp_index is always zero.
103  size_t comp_index;
104 
105  // compositor should momentarily ignore the grid. Used internally when
106  // moving around grids etc.
108 };
109 
110 #define SCREEN_GRID_INIT { 0, NULL, NULL, NULL, NULL, NULL, 0, 0, false, \
111  false, 0, 0, NULL, false, true, 0, \
112  0, 0, 0, 0, 0, false }
113 
114 #endif // NVIM_GRID_DEFS_H
kZIndexMessages
@ kZIndexMessages
Definition: grid_defs.h:20
ScreenGrid::blending
bool blending
Definition: grid_defs.h:80
ScreenGrid::line_wraps
char_u * line_wraps
Definition: grid_defs.h:54
types.h
ScreenGrid::target
ScreenGrid * target
Definition: grid_defs.h:77
ScreenGrid::line_offset
unsigned * line_offset
Definition: grid_defs.h:53
ScreenGrid::comp_disabled
bool comp_disabled
Definition: grid_defs.h:107
ScreenGrid::chars
schar_T * chars
Definition: grid_defs.h:51
ScreenGrid::valid
bool valid
Definition: grid_defs.h:65
ScreenGrid::focusable
bool focusable
Definition: grid_defs.h:83
sattr_T
int sattr_T
Definition: grid_defs.h:14
ScreenGrid::Rows
int Rows
Definition: grid_defs.h:61
ScreenGrid::handle
handle_T handle
Definition: grid_defs.h:49
MAX_MCO
#define MAX_MCO
Definition: grid_defs.h:10
ScreenGrid::throttled
bool throttled
Definition: grid_defs.h:69
ScreenGrid::comp_col
int comp_col
Definition: grid_defs.h:93
kZIndexCmdlinePopupMenu
@ kZIndexCmdlinePopupMenu
Definition: grid_defs.h:21
schar_T
char_u schar_T[(MAX_MCO+1) *4+1]
Definition: grid_defs.h:13
ScreenGrid::zindex
int zindex
Definition: grid_defs.h:86
ScreenGrid::row_offset
int row_offset
Definition: grid_defs.h:75
kZIndexFloatDefault
@ kZIndexFloatDefault
Definition: grid_defs.h:18
ScreenGrid::attrs
sattr_T * attrs
Definition: grid_defs.h:52
ScreenGrid::comp_height
int comp_height
Definition: grid_defs.h:99
kZIndexDefaultGrid
@ kZIndexDefaultGrid
Definition: grid_defs.h:17
char_u
unsigned char char_u
Definition: types.h:12
ScreenGrid
Definition: grid_defs.h:48
handle_T
int handle_T
Definition: types.h:18
ScreenGrid::comp_width
int comp_width
Definition: grid_defs.h:98
ScreenGrid::comp_row
int comp_row
Definition: grid_defs.h:92
ScreenGrid::comp_index
size_t comp_index
Definition: grid_defs.h:103
ScreenGrid::Columns
int Columns
Definition: grid_defs.h:62
ScreenGrid::col_offset
int col_offset
Definition: grid_defs.h:76
ScreenGrid::dirty_col
int * dirty_col
Definition: grid_defs.h:58
kZIndexPopupMenu
@ kZIndexPopupMenu
Definition: grid_defs.h:19