4 // This would just be called "Window", but that conflicts with XWindow's type
10 #include <X11/Xft/Xft.h>
28 void resized(unsigned int new_width
, unsigned int new_height
);
29 void set_title(const char* title
);
38 XSetWindowAttributes attributes
;
42 FontSet
* regular_font
= nullptr;
43 FontSet
* line_drawing_font
= nullptr;
44 FontSet
* monospace_font
= nullptr;
45 unsigned int width
, height
;
46 double font_size_override
= 0;
47 bool use_monospace_font
= false;
51 struct SelectionPoint
{
56 : line(-1), column(0) {}
57 SelectionPoint(int64_t line_in
, int column_in
)
58 : line(line_in
), column(column_in
) {}
59 bool operator<(SelectionPoint
& other
) {
62 (line
== other
.line
&& column
< other
.column
);
64 bool operator>=(SelectionPoint
& other
) {
65 return !(*this < other
);
68 SelectionPoint selection_start
, selection_end
;
69 bool has_selection() { return selection_start
.line
>= 0; }
71 NotSelecting
, SelectingForward
, SelectingBackward
,
75 SelectingByChar
, SelectingByWord
, SelectingByLine
,
78 struct timespec last_click_time
;
79 std::string selected_text
;
80 void clear_selection() {
81 selection_start
.line
= selection_end
.line
= -1;
84 Atom wm_delete_window_atom
;
96 bool check_special_key(
97 KeySym key_sym
, unsigned int state
,
98 const KeyMapping
* key_mappings
, int num_key_mappings
);
100 XftFont
* xft_font_for(const Style
& style
) {
102 (use_monospace_font
? monospace_font
:
103 ((style
.line_drawing
? line_drawing_font
: regular_font
)))->xft_font_for(style
);
107 void cleanup_fonts();
108 void screen_size_changed();
109 void key_down(XKeyEvent
* event
);
110 void mouse_button_down(XButtonEvent
* event
);
111 void mouse_moved(XMotionEvent
* event
);
112 void mouse_button_up(XButtonEvent
* event
);
113 void selection_requested(XSelectionRequestEvent
* event
);
114 void property_changed(XEvent
* event
);
115 void received_selection(XEvent
* event
);
116 int displayed_lines() { return (height
- 2 * settings
.border
) / regular_font
->height(); }
117 void scroll_to_bottom() { top_line
= -1; }
118 void decorate_run(Style style
, int x
, int width
, int y
);
122 int column_for_pixel(int64_t which_line
, int x
);
123 int64_t calc_effective_top_line();
124 SelectionPoint
start_of_word(SelectionPoint point
);
125 SelectionPoint
end_of_word(SelectionPoint point
);
128 void recalc_elastic_columns(int64_t initial_line
);
129 void update_elastic_columns_for(Line
* line
);
133 #endif // !TermWindow_h