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