This source file includes following definitions.
- SELECTION_EVENT_DISPLAY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef _PGTKTERM_H_
21 #define _PGTKTERM_H_
22
23 #include "dispextern.h"
24 #include "frame.h"
25 #include "character.h"
26 #include "font.h"
27 #include "sysselect.h"
28
29 #ifdef HAVE_PGTK
30
31 #include <gtk/gtk.h>
32
33 #ifdef CAIRO_HAS_PDF_SURFACE
34 #include <cairo-pdf.h>
35 #endif
36 #ifdef CAIRO_HAS_PS_SURFACE
37 #include <cairo-ps.h>
38 #endif
39 #ifdef CAIRO_HAS_SVG_SURFACE
40 #include <cairo-svg.h>
41 #endif
42
43 struct pgtk_bitmap_record
44 {
45 void *img;
46 char *file;
47 int refcount;
48 int height, width, depth;
49 cairo_pattern_t *pattern;
50 };
51
52 struct pgtk_device_t
53 {
54 GdkSeat *seat;
55 GdkDevice *device;
56
57 Lisp_Object name;
58 struct pgtk_device_t *next;
59 };
60
61 #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
62 #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
63
64 #define ALPHA_FROM_ULONG(color) ((color) >> 24)
65 #define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
66 #define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
67 #define BLUE_FROM_ULONG(color) ((color) & 0xff)
68
69 struct scroll_bar
70 {
71
72 union vectorlike_header header;
73
74
75 Lisp_Object window;
76
77
78 Lisp_Object next, prev;
79
80
81
82
83 Window x_window;
84
85
86
87 int top, left, width, height;
88
89
90
91
92
93
94
95
96
97
98
99
100 int start, end;
101
102
103
104
105
106 int dragging;
107
108 #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
109
110 enum scroll_bar_part last_seen_part;
111 #endif
112
113 #if defined (USE_TOOLKIT_SCROLL_BARS) && !defined (USE_GTK)
114
115 int whole;
116 #endif
117
118
119 bool horizontal;
120 };
121
122 struct pgtk_display_info
123 {
124
125 struct pgtk_display_info *next;
126
127
128 struct terminal *terminal;
129
130 union
131 {
132
133 GdkDisplay *gdpy;
134
135
136 GdkDisplay *display;
137 };
138
139
140 Lisp_Object name_list_element;
141
142
143 int reference_count;
144
145
146 unsigned x_id;
147
148
149 char *x_id_name;
150
151
152 int n_fonts;
153
154
155 int smallest_char_width;
156
157
158 int smallest_font_height;
159
160 struct pgtk_bitmap_record *bitmaps;
161 ptrdiff_t bitmaps_size;
162 ptrdiff_t bitmaps_last;
163
164
165 double resx, resy;
166
167
168 int grabbed;
169
170 int n_planes;
171
172 int color_p;
173
174
175
176 ptrdiff_t icon_bitmap_id;
177
178 Window root_window;
179
180
181 XrmDatabase rdb;
182
183
184 Emacs_Cursor vertical_scroll_bar_cursor;
185
186
187 Emacs_Cursor horizontal_scroll_bar_cursor;
188
189
190
191 Mouse_HLInfo mouse_highlight;
192
193 struct frame *highlight_frame;
194 struct frame *x_focus_frame;
195
196
197
198
199
200 struct frame *x_focus_event_frame;
201
202
203 struct frame *last_mouse_frame;
204
205
206 struct frame *last_mouse_motion_frame;
207
208
209
210 int last_mouse_motion_x;
211 int last_mouse_motion_y;
212
213
214 XRectangle last_mouse_glyph;
215
216
217 Time last_mouse_movement_time;
218
219
220 guint32 last_user_time;
221
222
223 void *last_mouse_scroll_bar;
224
225
226 Emacs_Cursor invisible_cursor;
227
228
229 GdkCursor *xg_cursor;
230
231
232 struct pgtk_device_t *devices;
233
234
235 struct frame *last_mouse_glyph_frame;
236
237
238 GdkEvent *last_click_event;
239
240
241 struct
242 {
243 GtkIMContext *context;
244 struct frame *focused_frame;
245 } im;
246
247 struct
248 {
249 double acc_x, acc_y;
250 double x_per_char, y_per_line;
251 } scroll;
252
253 int connection;
254 };
255
256
257 extern struct pgtk_display_info *x_display_list;
258
259 struct pgtk_output
260 {
261 unsigned long foreground_color;
262 unsigned long background_color;
263 void *toolbar;
264
265
266
267
268
269
270 guint32 last_user_time;
271
272
273 Emacs_Cursor current_cursor;
274 Emacs_Cursor text_cursor;
275 Emacs_Cursor nontext_cursor;
276 Emacs_Cursor modeline_cursor;
277 Emacs_Cursor hand_cursor;
278 Emacs_Cursor hourglass_cursor;
279 Emacs_Cursor horizontal_drag_cursor;
280 Emacs_Cursor vertical_drag_cursor;
281 Emacs_Cursor left_edge_cursor;
282 Emacs_Cursor top_left_corner_cursor;
283 Emacs_Cursor top_edge_cursor;
284 Emacs_Cursor top_right_corner_cursor;
285 Emacs_Cursor right_edge_cursor;
286 Emacs_Cursor bottom_right_corner_cursor;
287 Emacs_Cursor bottom_edge_cursor;
288 Emacs_Cursor bottom_left_corner_cursor;
289
290
291 Emacs_Cursor current_pointer;
292
293
294 unsigned long border_pixel;
295 GtkCssProvider *border_color_css_provider;
296
297
298 GtkCssProvider *scrollbar_foreground_css_provider;
299 GtkCssProvider *scrollbar_background_css_provider;
300
301
302
303 GtkWidget *hourglass_widget;
304
305 Emacs_GC cursor_xgcv;
306
307
308 Window window_desc, parent_desc;
309 char explicit_parent;
310
311
312
313 ptrdiff_t icon_bitmap;
314
315 struct font *font;
316 int baseline_offset;
317
318
319
320 int fontset;
321
322 unsigned long mouse_color;
323 unsigned long cursor_color;
324 unsigned long cursor_foreground_color;
325
326 int icon_top;
327 int icon_left;
328
329
330
331 int vertical_scroll_bar_extra;
332
333
334 int titlebar_height;
335
336
337 int toolbar_height;
338
339
340 struct pgtk_display_info *display_info;
341
342
343 int zooming;
344
345
346 int in_animation;
347
348
349 GdkGeometry size_hints;
350 long hint_flags;
351 int preferred_width, preferred_height;
352
353
354 GtkWidget *widget;
355
356
357 GtkWidget *edit_widget;
358
359 GtkWidget *vbox_widget;
360
361 GtkWidget *hbox_widget;
362
363 GtkWidget *menubar_widget;
364
365 GtkWidget *toolbar_widget;
366
367 bool_bf toolbar_in_hbox : 1;
368 bool_bf toolbar_is_packed : 1;
369
370 GtkTooltip *ttip_widget;
371 GtkWidget *ttip_lbl;
372 GtkWindow *ttip_window;
373
374
375
376 int menubar_height;
377
378
379
380
381 int toolbar_top_height, toolbar_bottom_height;
382
383
384
385
386 int toolbar_left_width, toolbar_right_width;
387
388 #ifdef USE_CAIRO
389
390 cairo_t *cr_context, *cr_active;
391 int cr_surface_desired_width, cr_surface_desired_height;
392
393 cairo_surface_t *cr_surface_visible_bell;
394 #endif
395 struct atimer *atimer_visible_bell;
396
397 int has_been_visible;
398
399
400 struct relief
401 {
402 Emacs_GC xgcv;
403 unsigned long pixel;
404 }
405 black_relief, white_relief;
406
407
408
409 unsigned long relief_background;
410
411
412
413 bool_bf relief_background_valid_p : 1;
414
415
416
417
418 int focus_state;
419
420
421
422
423
424 double watched_scale_factor;
425 struct atimer *scale_factor_atimer;
426 };
427
428
429 struct x_output
430 {
431 int unused;
432 };
433
434 enum
435 {
436
437
438
439
440
441 FOCUS_NONE = 0,
442 FOCUS_IMPLICIT = 1,
443 FOCUS_EXPLICIT = 2
444 };
445
446
447 #define FRAME_X_OUTPUT(f) ((f)->output_data.pgtk)
448 #define FRAME_OUTPUT_DATA(f) FRAME_X_OUTPUT (f)
449
450 #define FRAME_DISPLAY_INFO(f) (FRAME_X_OUTPUT (f)->display_info)
451 #define FRAME_FOREGROUND_COLOR(f) (FRAME_X_OUTPUT (f)->foreground_color)
452 #define FRAME_BACKGROUND_COLOR(f) (FRAME_X_OUTPUT (f)->background_color)
453 #define FRAME_CURSOR_COLOR(f) (FRAME_X_OUTPUT (f)->cursor_color)
454 #define FRAME_POINTER_TYPE(f) (FRAME_X_OUTPUT (f)->current_pointer)
455 #define FRAME_FONT(f) (FRAME_X_OUTPUT (f)->font)
456 #define FRAME_GTK_OUTER_WIDGET(f) (FRAME_X_OUTPUT (f)->widget)
457 #define FRAME_GTK_WIDGET(f) (FRAME_X_OUTPUT (f)->edit_widget)
458 #define FRAME_WIDGET(f) (FRAME_GTK_OUTER_WIDGET (f) \
459 ? FRAME_GTK_OUTER_WIDGET (f) \
460 : FRAME_GTK_WIDGET (f))
461
462 #define FRAME_PGTK_VIEW(f) FRAME_GTK_WIDGET (f)
463 #define FRAME_X_WINDOW(f) FRAME_GTK_OUTER_WIDGET (f)
464 #define FRAME_NATIVE_WINDOW(f) GTK_WINDOW (FRAME_X_WINDOW (f))
465 #define FRAME_GDK_WINDOW(f) \
466 (gtk_widget_get_window (FRAME_GTK_WIDGET (f)))
467
468 #define FRAME_X_DISPLAY(f) (FRAME_DISPLAY_INFO (f)->gdpy)
469
470 #define DEFAULT_GDK_DISPLAY() gdk_display_get_default ()
471
472
473 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
474
475 #define FRAME_DEFAULT_FACE(f) FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID)
476 #define FRAME_MENUBAR_HEIGHT(f) (FRAME_X_OUTPUT (f)->menubar_height)
477 #define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.pgtk->toolbar_top_height)
478 #define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
479 ((f)->output_data.pgtk->toolbar_bottom_height)
480 #define FRAME_TOOLBAR_HEIGHT(f) \
481 (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
482 #define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.pgtk->toolbar_left_width)
483 #define FRAME_TOOLBAR_RIGHT_WIDTH(f) ((f)->output_data.pgtk->toolbar_right_width)
484 #define FRAME_TOOLBAR_WIDTH(f) \
485 (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f))
486
487 #define FRAME_FONTSET(f) (FRAME_X_OUTPUT (f)->fontset)
488
489 #define FRAME_BASELINE_OFFSET(f) (FRAME_X_OUTPUT (f)->baseline_offset)
490 #define BLACK_PIX_DEFAULT(f) 0x000000
491 #define WHITE_PIX_DEFAULT(f) 0xFFFFFF
492
493
494
495 #define FIRST_CHAR_POSITION(f) \
496 (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
497 : FRAME_SCROLL_BAR_COLS (f))
498
499 #define FRAME_CR_SURFACE_DESIRED_WIDTH(f) \
500 ((f)->output_data.pgtk->cr_surface_desired_width)
501 #define FRAME_CR_SURFACE_DESIRED_HEIGHT(f) \
502 ((f)->output_data.pgtk->cr_surface_desired_height)
503
504
505
506
507
508
509
510
511
512 struct selection_input_event
513 {
514 ENUM_BF (event_kind) kind : EVENT_KIND_WIDTH;
515 struct pgtk_display_info *dpyinfo;
516
517 GdkWindow *requestor;
518 GdkAtom selection, target, property;
519 guint32 time;
520 };
521
522
523 INLINE GdkDisplay *
524 SELECTION_EVENT_DISPLAY (struct selection_input_event *ev)
525 {
526 return ev->dpyinfo->display;
527 }
528 #define SELECTION_EVENT_DPYINFO(eventp) \
529 ((eventp)->dpyinfo)
530
531 #define SELECTION_EVENT_REQUESTOR(eventp) \
532 ((eventp)->requestor)
533 #define SELECTION_EVENT_SELECTION(eventp) \
534 ((eventp)->selection)
535 #define SELECTION_EVENT_TARGET(eventp) \
536 ((eventp)->target)
537 #define SELECTION_EVENT_PROPERTY(eventp) \
538 ((eventp)->property)
539 #define SELECTION_EVENT_TIME(eventp) \
540 ((eventp)->time)
541
542 extern void pgtk_handle_selection_event (struct selection_input_event *);
543 extern void pgtk_clear_frame_selections (struct frame *);
544 extern void pgtk_handle_property_notify (GdkEventProperty *);
545 extern void pgtk_handle_selection_notify (GdkEventSelection *);
546
547
548 extern struct pgtk_display_info *pgtk_term_init (Lisp_Object, char *);
549 extern void pgtk_term_shutdown (int);
550
551
552 extern void pgtk_clear_frame (struct frame *);
553 extern char *pgtk_xlfd_to_fontname (const char *);
554
555
556 extern void pgtk_set_doc_edited (void);
557 extern const char *pgtk_get_defaults_value (const char *);
558 extern const char *pgtk_get_string_resource (XrmDatabase, const char *, const char *);
559 extern void pgtk_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
560
561
562 extern bool pgtk_defined_color (struct frame *, const char *,
563 Emacs_Color *, bool, bool);
564 extern void pgtk_query_color (struct frame *, Emacs_Color *);
565 extern void pgtk_query_colors (struct frame *, Emacs_Color *, int);
566 extern int pgtk_parse_color (struct frame *, const char *, Emacs_Color *);
567
568
569 extern void pgtk_clear_area (struct frame *, int, int, int, int);
570 extern int pgtk_gtk_to_emacs_modifiers (struct pgtk_display_info *, int);
571 extern void pgtk_clear_under_internal_border (struct frame *);
572 extern void pgtk_set_event_handler (struct frame *);
573
574
575 extern int pgtk_display_pixel_height (struct pgtk_display_info *);
576 extern int pgtk_display_pixel_width (struct pgtk_display_info *);
577
578 extern void pgtk_destroy_window (struct frame *);
579 extern void pgtk_set_parent_frame (struct frame *, Lisp_Object, Lisp_Object);
580 extern void pgtk_set_no_focus_on_map (struct frame *, Lisp_Object, Lisp_Object);
581 extern void pgtk_set_no_accept_focus (struct frame *, Lisp_Object, Lisp_Object);
582 extern void pgtk_set_z_group (struct frame *, Lisp_Object, Lisp_Object);
583
584
585 extern void pgtk_cr_update_surface_desired_size (struct frame *, int, int, bool);
586 extern cairo_t *pgtk_begin_cr_clip (struct frame *);
587 extern void pgtk_end_cr_clip (struct frame *);
588 extern void pgtk_set_cr_source_with_gc_foreground (struct frame *, Emacs_GC *, bool);
589 extern void pgtk_set_cr_source_with_gc_background (struct frame *, Emacs_GC *, bool);
590 extern void pgtk_set_cr_source_with_color (struct frame *, unsigned long, bool);
591 extern void pgtk_cr_draw_frame (cairo_t *, struct frame *);
592 extern void pgtk_cr_destroy_frame_context (struct frame *);
593 extern Lisp_Object pgtk_cr_export_frames (Lisp_Object , cairo_surface_type_t);
594
595
596 extern Lisp_Object pgtk_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
597 extern Lisp_Object pgtk_dialog_show (struct frame *, Lisp_Object, Lisp_Object,
598 const char **);
599 extern void initialize_frame_menubar (struct frame *);
600
601
602
603 extern void syms_of_pgtkterm (void);
604 extern void syms_of_pgtkfns (void);
605 extern void syms_of_pgtkmenu (void);
606 extern void syms_of_pgtkselect (void);
607 extern void syms_of_pgtkim (void);
608
609
610 extern void mark_pgtkterm (void);
611 extern void pgtk_delete_terminal (struct terminal *);
612
613 extern void pgtk_make_frame_visible (struct frame *);
614 extern void pgtk_make_frame_invisible (struct frame *);
615 extern void pgtk_free_frame_resources (struct frame *);
616 extern void pgtk_iconify_frame (struct frame *);
617 extern void pgtk_focus_frame (struct frame *, bool);
618 extern void pgtk_set_scroll_bar_default_width (struct frame *);
619 extern void pgtk_set_scroll_bar_default_height (struct frame *);
620 extern Lisp_Object pgtk_get_focus_frame (struct frame *);
621
622 extern void pgtk_frame_rehighlight (struct pgtk_display_info *);
623
624 extern void pgtk_change_tab_bar_height (struct frame *, int);
625
626 extern struct pgtk_display_info *check_pgtk_display_info (Lisp_Object);
627
628 extern void pgtk_default_font_parameter (struct frame *, Lisp_Object);
629
630 extern void pgtk_menu_set_in_use (bool);
631
632
633 extern void pgtk_update_drop_status (Lisp_Object, Lisp_Object);
634 extern void pgtk_finish_drop (Lisp_Object, Lisp_Object, Lisp_Object);
635
636 extern void pgtk_enqueue_string (struct frame *, gchar *);
637 extern void pgtk_enqueue_preedit (struct frame *, Lisp_Object);
638 extern void pgtk_im_focus_in (struct frame *);
639 extern void pgtk_im_focus_out (struct frame *);
640 extern bool pgtk_im_filter_keypress (struct frame *, GdkEventKey *);
641 extern void pgtk_im_set_cursor_location (struct frame *, int, int,
642 int, int);
643 extern void pgtk_im_init (struct pgtk_display_info *);
644 extern void pgtk_im_finish (struct pgtk_display_info *);
645
646 extern bool xg_set_icon (struct frame *, Lisp_Object);
647 extern bool xg_set_icon_from_xpm_data (struct frame *, const char **);
648
649 extern bool pgtk_text_icon (struct frame *, const char *);
650
651 extern double pgtk_frame_scale_factor (struct frame *);
652 extern int pgtk_emacs_to_gtk_modifiers (struct pgtk_display_info *, int);
653
654 #endif
655 #endif