1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef _HAIKU_TERM_H_
20 #define _HAIKU_TERM_H_
21
22 #include <pthread.h>
23
24 #ifdef USE_BE_CAIRO
25 #include <cairo.h>
26 #endif
27
28 #include "haikugui.h"
29 #include "frame.h"
30 #include "character.h"
31 #include "dispextern.h"
32 #include "font.h"
33 #include "systime.h"
34
35 #define HAVE_CHAR_CACHE_MAX 65535
36
37
38 struct haiku_font_change_event;
39
40 extern int popup_activated_p;
41
42 struct haikufont_info
43 {
44 struct font font;
45 haiku be_font;
46 struct font_metrics **metrics;
47 short metrics_nrows;
48
49 unsigned short **glyphs;
50 };
51
52 struct haiku_bitmap_record
53 {
54 haiku img;
55 char *file;
56 int refcount;
57 int height, width, depth;
58
59 uint32_t stipple_foreground;
60 uint32_t stipple_background;
61 void *stipple_bits;
62 };
63
64 struct haiku_display_info
65 {
66
67 struct haiku_display_info *next;
68 struct terminal *terminal;
69
70 Lisp_Object name_list_element;
71 Lisp_Object color_map;
72
73 int n_fonts;
74
75 int smallest_char_width;
76 int smallest_font_height;
77
78 struct frame *focused_frame;
79 struct frame *focus_event_frame;
80 struct frame *last_mouse_glyph_frame;
81
82 struct haiku_bitmap_record *bitmaps;
83 ptrdiff_t bitmaps_size;
84 ptrdiff_t bitmaps_last;
85
86 int grabbed;
87 int n_planes;
88 int color_p;
89
90 Lisp_Object rdb;
91 Lisp_Object default_name;
92
93 Emacs_Cursor vertical_scroll_bar_cursor;
94 Emacs_Cursor horizontal_scroll_bar_cursor;
95
96 Mouse_HLInfo mouse_highlight;
97
98 struct frame *highlight_frame;
99 struct frame *last_mouse_frame;
100 struct frame *last_mouse_motion_frame;
101
102 int last_mouse_motion_x;
103 int last_mouse_motion_y;
104
105 struct haiku_rect last_mouse_glyph;
106
107 haiku display;
108
109 double resx, resy;
110
111 Time last_mouse_movement_time;
112
113 Window root_window;
114
115 Emacs_Cursor text_cursor;
116 Emacs_Cursor nontext_cursor;
117 Emacs_Cursor modeline_cursor;
118 Emacs_Cursor hand_cursor;
119 Emacs_Cursor hourglass_cursor;
120 Emacs_Cursor horizontal_drag_cursor;
121 Emacs_Cursor vertical_drag_cursor;
122 Emacs_Cursor left_edge_cursor;
123 Emacs_Cursor top_left_corner_cursor;
124 Emacs_Cursor top_edge_cursor;
125 Emacs_Cursor top_right_corner_cursor;
126 Emacs_Cursor right_edge_cursor;
127 Emacs_Cursor bottom_right_corner_cursor;
128 Emacs_Cursor bottom_edge_cursor;
129 Emacs_Cursor bottom_left_corner_cursor;
130 Emacs_Cursor no_cursor;
131 };
132
133 struct haiku_output
134 {
135 struct haiku_display_info *display_info;
136
137 Emacs_Cursor text_cursor;
138 Emacs_Cursor nontext_cursor;
139 Emacs_Cursor modeline_cursor;
140 Emacs_Cursor hand_cursor;
141 Emacs_Cursor hourglass_cursor;
142 Emacs_Cursor horizontal_drag_cursor;
143 Emacs_Cursor vertical_drag_cursor;
144 Emacs_Cursor left_edge_cursor;
145 Emacs_Cursor top_left_corner_cursor;
146 Emacs_Cursor top_edge_cursor;
147 Emacs_Cursor top_right_corner_cursor;
148 Emacs_Cursor right_edge_cursor;
149 Emacs_Cursor bottom_right_corner_cursor;
150 Emacs_Cursor bottom_edge_cursor;
151 Emacs_Cursor bottom_left_corner_cursor;
152 Emacs_Cursor no_cursor;
153 Emacs_Cursor current_cursor;
154
155 Emacs_Color cursor_color;
156
157 Window parent_desc;
158
159 haiku window;
160 haiku view;
161 haiku menubar;
162
163 int fontset;
164 int baseline_offset;
165
166
167
168 bool_bf hourglass_p : 1;
169
170
171 bool_bf menu_bar_open_p : 1;
172
173
174
175 bool_bf dirty_p : 1;
176
177
178
179 bool_bf complete_p : 1;
180
181 struct font *font;
182
183
184 int pending_top, pending_left;
185
186
187
188 bool configury_done;
189
190
191 uint32_t cursor_fg;
192
193
194 struct haiku_menu_bar_click_event *saved_menu_event;
195
196
197 int wait_for_event_type;
198
199
200 uint32_t black_relief_pixel;
201
202
203 uint32_t white_relief_pixel;
204
205
206
207
208 long relief_background;
209
210
211
212
213 int frame_x, frame_y;
214
215
216
217 int fullscreen_mode;
218 };
219
220 struct x_output
221 {
222
223 };
224
225 extern struct haiku_display_info *x_display_list;
226 extern struct font_driver const haikufont_driver;
227
228 extern Lisp_Object tip_frame;
229 extern Lisp_Object tip_dx;
230 extern Lisp_Object tip_dy;
231
232 extern struct frame *haiku_dnd_frame;
233 extern bool haiku_dnd_follow_tooltip;
234
235 extern frame_parm_handler haiku_frame_parm_handlers[];
236
237 struct scroll_bar
238 {
239
240 union vectorlike_header header;
241
242
243 Lisp_Object window;
244
245
246 Lisp_Object next, prev;
247
248
249
250
251
252 int top, left, width, height;
253
254
255 void *scroll_bar;
256
257
258
259 int dragging;
260
261
262
263 int update;
264
265
266 int position;
267
268
269 int total;
270
271
272 bool horizontal;
273
274
275
276 int page_size;
277 };
278
279 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
280
281 #define FRAME_DIRTY_P(f) (FRAME_OUTPUT_DATA (f)->dirty_p)
282 #define FRAME_COMPLETE_P(f) (FRAME_OUTPUT_DATA (f)->complete_p)
283 #define MAKE_FRAME_DIRTY(f) (FRAME_DIRTY_P (f) = 1)
284 #define FRAME_OUTPUT_DATA(f) ((f)->output_data.haiku)
285 #define FRAME_HAIKU_WINDOW(f) (FRAME_OUTPUT_DATA (f)->window)
286 #define FRAME_HAIKU_VIEW(f) (FRAME_OUTPUT_DATA (f)->view)
287 #define FRAME_HAIKU_DRAWABLE(f) ((MAKE_FRAME_DIRTY (f)), FRAME_HAIKU_VIEW (f))
288 #define FRAME_HAIKU_MENU_BAR(f) (FRAME_OUTPUT_DATA (f)->menubar)
289 #define FRAME_DISPLAY_INFO(f) (FRAME_OUTPUT_DATA (f)->display_info)
290 #define FRAME_FONT(f) (FRAME_OUTPUT_DATA (f)->font)
291 #define FRAME_FONTSET(f) (FRAME_OUTPUT_DATA (f)->fontset)
292 #define FRAME_NATIVE_WINDOW(f) (FRAME_OUTPUT_DATA (f)->window)
293 #define FRAME_BASELINE_OFFSET(f) (FRAME_OUTPUT_DATA (f)->baseline_offset)
294 #define FRAME_CURSOR_COLOR(f) (FRAME_OUTPUT_DATA (f)->cursor_color)
295
296 #ifdef USE_BE_CAIRO
297 #define FRAME_CR_CONTEXT(f) \
298 (FRAME_HAIKU_VIEW (f) \
299 ? EmacsView_cairo_context (FRAME_HAIKU_DRAWABLE (f)) \
300 : NULL)
301 #endif
302
303 extern void syms_of_haikuterm (void);
304 extern void syms_of_haikufns (void);
305 extern void syms_of_haikumenu (void);
306 extern void syms_of_haikufont (void);
307 extern void syms_of_haikuselect (void);
308 extern void init_haiku_select (void);
309
310 extern void haiku_iconify_frame (struct frame *);
311 extern void haiku_visualize_frame (struct frame *);
312 extern void haiku_unvisualize_frame (struct frame *);
313 extern void haiku_set_offset (struct frame *, int, int, int);
314 extern void haiku_set_frame_visible_invisible (struct frame *, bool);
315 extern void haiku_free_frame_resources (struct frame *);
316 extern void haiku_scroll_bar_remove (struct scroll_bar *);
317 extern void haiku_clear_under_internal_border (struct frame *);
318 extern void haiku_set_name (struct frame *, Lisp_Object, bool);
319 extern Lisp_Object haiku_message_to_lisp (void *);
320
321 extern struct haiku_display_info *haiku_term_init (void);
322
323 extern void mark_haiku_display (void);
324
325 extern int haiku_get_color (const char *, Emacs_Color *);
326 extern void haiku_set_background_color (struct frame *, Lisp_Object, Lisp_Object);
327 extern void haiku_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object);
328 extern void haiku_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object);
329 extern void haiku_set_internal_border_width (struct frame *, Lisp_Object, Lisp_Object);
330 extern void haiku_change_tab_bar_height (struct frame *, int);
331 extern void haiku_change_tool_bar_height (struct frame *, int);
332 extern void haiku_free_custom_cursors (struct frame *);
333
334 extern void haiku_query_color (uint32_t, Emacs_Color *);
335
336 extern unsigned long haiku_get_pixel (haiku, int, int);
337 extern void haiku_put_pixel (haiku, int, int, unsigned long);
338
339 extern Lisp_Object haiku_menu_show (struct frame *, int, int, int,
340 Lisp_Object, const char **);
341 extern Lisp_Object haiku_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
342 extern void haiku_activate_menubar (struct frame *);
343 extern void haiku_wait_for_event (struct frame *, int);
344 extern void haiku_note_drag_motion (void);
345 extern void haiku_note_drag_wheel (struct input_event *);
346
347 extern void initialize_frame_menubar (struct frame *);
348
349 extern void run_menu_bar_help_event (struct frame *, int);
350 extern void put_xrm_resource (Lisp_Object, Lisp_Object);
351
352 #ifdef HAVE_NATIVE_IMAGE_API
353 extern bool haiku_can_use_native_image_api (Lisp_Object);
354 extern int haiku_load_image (struct frame *, struct image *,
355 Lisp_Object, Lisp_Object);
356 extern void syms_of_haikuimage (void);
357 #endif
358
359 extern void haiku_draw_background_rect (struct glyph_string *, struct face *,
360 int, int, int, int);
361
362 #ifdef USE_BE_CAIRO
363 extern cairo_t *haiku_begin_cr_clip (struct frame *, struct glyph_string *);
364
365 extern void haiku_end_cr_clip (cairo_t *);
366 #endif
367
368 extern void haiku_merge_cursor_foreground (struct glyph_string *, unsigned long *,
369 unsigned long *);
370 extern void haiku_handle_selection_clear (struct input_event *);
371 extern void haiku_start_watching_selections (void);
372 extern void haiku_handle_font_change_event (struct haiku_font_change_event *,
373 struct input_event *);
374
375 #endif