This source file includes following definitions.
- SELECTION_EVENT_DISPLAY
- x_make_truecolor_pixel
- x_mutable_colormap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef XTERM_H
21 #define XTERM_H
22
23 #include <X11/Xlib.h>
24 #include <X11/cursorfont.h>
25
26
27
28
29 #include <X11/keysym.h>
30 #include <X11/Xutil.h>
31
32 #include <X11/Xatom.h>
33 #include <X11/Xresource.h>
34
35 #ifdef HAVE_XINPUT2
36 #include <X11/extensions/XInput2.h>
37 #endif
38
39 #ifdef USE_X_TOOLKIT
40 #include <X11/StringDefs.h>
41 #include <X11/IntrinsicP.h>
42 #include <X11/CoreP.h>
43
44
45 #ifdef X_TOOLKIT_EDITRES
46 #include <X11/Xmu/Editres.h>
47 #endif
48
49 typedef Widget xt_or_gtk_widget;
50 #endif
51
52 #ifdef USE_GTK
53 #include <gtk/gtk.h>
54 #include <gdk/gdkx.h>
55 #endif
56
57 #ifndef USE_GTK
58 #define GTK_CHECK_VERSION(i, j, k) false
59 #endif
60
61 #ifdef HAVE_XRENDER
62 #include <X11/extensions/Xrender.h>
63 #endif
64
65 #ifdef USE_GTK
66
67 typedef GtkWidget *xt_or_gtk_widget;
68 #undef XSync
69
70 #if GTK_CHECK_VERSION (3, 22, 0)
71 #define XSync(d, b) do { XSync ((d), (b)); } while (false)
72 #else
73 #define XSync(d, b) do { gdk_window_process_all_updates (); \
74 XSync (d, b); } while (false)
75 #endif
76 #endif
77
78
79 #define N_FAILABLE_REQUESTS 128
80
81 #ifdef USE_CAIRO
82 #include <cairo-xlib.h>
83 #ifdef CAIRO_HAS_PDF_SURFACE
84 #include <cairo-pdf.h>
85 #endif
86 #ifdef CAIRO_HAS_PS_SURFACE
87 #include <cairo-ps.h>
88 #endif
89 #ifdef CAIRO_HAS_SVG_SURFACE
90 #include <cairo-svg.h>
91 #endif
92 #ifdef USE_CAIRO_XCB
93 #include <cairo-xcb.h>
94 #endif
95 #endif
96
97 #ifdef HAVE_X_I18N
98 #include <X11/Xlocale.h>
99 #endif
100
101 #ifdef USE_XCB
102 #include <X11/Xlib-xcb.h>
103 #endif
104
105 #ifdef HAVE_XKB
106 #include <X11/XKBlib.h>
107 #endif
108
109 #ifdef HAVE_XSYNC
110 #include <X11/extensions/sync.h>
111 #endif
112
113 #include "dispextern.h"
114 #include "termhooks.h"
115
116 INLINE_HEADER_BEGIN
117
118
119 #define BLACK_PIX_DEFAULT(f) \
120 BlackPixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))
121 #define WHITE_PIX_DEFAULT(f) \
122 WhitePixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))
123
124
125
126
127
128 #define STANDARD_EVENT_SET \
129 (KeyPressMask \
130 | ExposureMask \
131 | ButtonPressMask \
132 | ButtonReleaseMask \
133 | PointerMotionMask \
134 | StructureNotifyMask \
135 | FocusChangeMask \
136 | LeaveWindowMask \
137 | EnterWindowMask \
138 | PropertyChangeMask \
139 | VisibilityChangeMask)
140
141 #ifdef HAVE_X11R6_XIM
142
143 struct xim_inst_t
144 {
145 struct x_display_info *dpyinfo;
146 char *resource_name;
147 };
148 #endif
149
150 #ifdef HAVE_XINPUT2
151 #if HAVE_XISCROLLCLASSINFO_TYPE && defined XIScrollClass
152 #define HAVE_XINPUT2_1
153 #endif
154 #if HAVE_XITOUCHCLASSINFO_TYPE && defined XITouchClass
155 #define HAVE_XINPUT2_2
156 #endif
157 #if HAVE_XIBARRIERRELEASEPOINTERINFO_DEVICEID && defined XIBarrierPointerReleased
158 #define HAVE_XINPUT2_3
159 #endif
160 #if HAVE_XIGESTURECLASSINFO_TYPE && defined XIGestureClass
161 #define HAVE_XINPUT2_4
162 #endif
163 #endif
164
165
166
167
168 struct x_bitmap_record
169 {
170 #ifdef USE_CAIRO
171 cairo_pattern_t *stipple;
172 #endif
173 Pixmap pixmap;
174 bool have_mask;
175 Pixmap mask;
176 char *file;
177 int refcount;
178
179 int height, width, depth;
180 };
181
182 #if defined USE_CAIRO || defined HAVE_XRENDER
183 struct x_gc_ext_data
184 {
185 #define MAX_CLIP_RECTS 2
186
187 int n_clip_rects;
188
189
190 XRectangle clip_rects[MAX_CLIP_RECTS];
191 };
192 #endif
193
194 #ifdef USE_CAIRO
195 extern cairo_pattern_t *x_bitmap_stipple (struct frame *, Pixmap);
196 #endif
197
198
199 struct color_name_cache_entry
200 {
201 struct color_name_cache_entry *next;
202
203
204 XColor rgb;
205
206
207 char *name;
208
209
210 bool_bf valid : 1;
211 };
212
213 #ifdef HAVE_XINPUT2
214
215 #ifdef HAVE_XINPUT2_1
216
217 struct xi_scroll_valuator_t
218 {
219
220 int number;
221
222
223 bool_bf horizontal : 1;
224
225
226 bool_bf invalid_p : 1;
227
228
229 double current_value;
230
231
232 double emacs_value;
233
234
235 double increment;
236 };
237
238 #endif
239
240 #ifdef HAVE_XINPUT2_2
241
242 struct xi_touch_point_t
243 {
244 struct xi_touch_point_t *next;
245
246 int number;
247 double x, y;
248 };
249
250 #endif
251
252 struct xi_device_t
253 {
254
255 int device_id;
256
257 #ifdef HAVE_XINPUT2_1
258
259 int scroll_valuator_count;
260 #endif
261
262
263 int grab, use;
264
265
266
267 int attachment;
268
269 #ifdef HAVE_XINPUT2_2
270
271 bool direct_p;
272 #endif
273
274 #ifdef HAVE_XINPUT2_1
275
276 struct xi_scroll_valuator_t *valuators;
277 #endif
278
279 #ifdef HAVE_XINPUT2_2
280
281 struct xi_touch_point_t *touchpoints;
282 #endif
283
284
285 Lisp_Object name;
286
287
288
289 Time focus_frame_time;
290
291
292
293 struct frame *focus_frame;
294
295
296
297 Time focus_implicit_time;
298
299
300
301 struct frame *focus_implicit_frame;
302
303
304 Window last_motion_window;
305
306
307 int last_motion_x, last_motion_y;
308 };
309 #endif
310
311 extern Status x_parse_color (struct frame *, const char *, XColor *);
312
313 struct x_failable_request
314 {
315
316 unsigned long start;
317
318
319
320 unsigned long end;
321 };
322
323 #ifdef HAVE_XFIXES
324
325 struct x_monitored_selection
326 {
327
328 Atom name;
329
330
331 Window owner;
332 };
333
334
335 #define X_INVALID_WINDOW 0xffffffff
336
337 #endif
338
339
340
341
342
343 struct x_display_info
344 {
345
346 struct x_display_info *next;
347
348
349 struct terminal *terminal;
350
351
352 Display *display;
353
354
355 int connection;
356
357
358 Lisp_Object name_list_element;
359
360
361 int reference_count;
362
363
364 Screen *screen;
365
366
367 double resx, resy;
368
369
370 Visual *visual;
371
372
373 XVisualInfo visual_info;
374
375 #ifdef HAVE_XRENDER
376
377 XRenderPictFormat *pict_format;
378 #endif
379
380
381 Colormap cmap;
382
383
384 int n_planes;
385
386
387 int grabbed;
388
389
390
391 ptrdiff_t icon_bitmap_id;
392
393
394 Window root_window;
395
396
397 Window client_leader_window;
398
399
400 Cursor vertical_scroll_bar_cursor;
401
402
403 Cursor horizontal_scroll_bar_cursor;
404
405
406
407 Cursor invisible_cursor;
408
409 #ifdef HAVE_XFIXES
410
411 bool fixes_pointer_blanking;
412 #endif
413
414 #ifdef USE_GTK
415
416 GdkCursor *xg_cursor;
417 #endif
418
419
420 XrmDatabase rdb;
421
422
423 int smallest_char_width;
424
425
426 int smallest_font_height;
427
428
429 GC scratch_cursor_gc;
430
431
432
433 Mouse_HLInfo mouse_highlight;
434
435
436 unsigned x_id;
437
438
439 char *x_id_name;
440
441
442 int n_fonts;
443
444
445 struct x_bitmap_record *bitmaps;
446
447
448 ptrdiff_t bitmaps_size;
449
450
451 ptrdiff_t bitmaps_last;
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472 unsigned int meta_mod_mask, shift_lock_mask;
473
474
475 unsigned alt_mod_mask, super_mod_mask, hyper_mod_mask;
476
477
478 Atom Xatom_wm_protocols;
479
480
481 Atom Xatom_wm_take_focus;
482 Atom Xatom_wm_save_yourself;
483 Atom Xatom_wm_delete_window;
484
485
486 Atom Xatom_wm_change_state;
487 Atom Xatom_wm_state;
488
489
490 Atom Xatom_wm_configure_denied;
491 Atom Xatom_wm_window_moved;
492 Atom Xatom_wm_client_leader;
493 Atom Xatom_wm_transient_for;
494
495
496
497 Atom Xatom_editres;
498
499
500 Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
501 Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING,
502 Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
503 Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER,
504 Xatom_EMACS_SERVER_TIME_PROP;
505
506
507
508 Atom Xatom_PIXEL_SIZE, Xatom_AVERAGE_WIDTH,
509 Xatom_MULE_BASELINE_OFFSET, Xatom_MULE_RELATIVE_COMPOSE,
510 Xatom_MULE_DEFAULT_ASCENT;
511
512
513 Atom Xatom_DONE, Xatom_PAGE;
514
515
516 Atom Xatom_Scrollbar, Xatom_Horizontal_Scrollbar;
517
518
519 Atom Xatom_XEMBED, Xatom_XEMBED_INFO;
520
521
522 Atom Xatom_NET_WM_CM_Sn;
523
524
525 Atom Xatom_MOTIF_WM_HINTS, Xatom_MOTIF_DRAG_WINDOW,
526 Xatom_MOTIF_DRAG_TARGETS, Xatom_MOTIF_DRAG_AND_DROP_MESSAGE,
527 Xatom_MOTIF_DRAG_INITIATOR_INFO, Xatom_MOTIF_DRAG_RECEIVER_INFO;
528
529
530 Atom Xatom_EMACS_DRAG_ATOM;
531
532
533
534 Atom Xatom_XmTRANSFER_SUCCESS, Xatom_XmTRANSFER_FAILURE;
535
536
537
538 Atom Xatom_DndProtocol, Xatom_DND_PROTOCOL;
539
540
541
542
543
544
545 struct frame *x_focus_frame;
546
547
548
549
550
551
552
553
554 struct frame *x_focus_event_frame;
555
556
557
558
559
560
561 struct frame *highlight_frame;
562
563
564 struct frame *x_pending_autoraise_frame;
565
566
567 struct frame *last_mouse_frame;
568
569
570 struct frame *last_mouse_glyph_frame;
571
572
573 struct frame *last_mouse_motion_frame;
574
575
576 struct scroll_bar *last_mouse_scroll_bar;
577
578
579
580 Time last_user_time;
581
582
583
584
585
586 int last_mouse_motion_x;
587 int last_mouse_motion_y;
588
589
590
591 XRectangle last_mouse_glyph;
592
593
594
595
596
597
598
599 Time last_mouse_movement_time;
600
601
602 bool last_mouse_movement_time_send_event;
603
604
605 Pixmap gray;
606
607 #ifdef HAVE_X_I18N
608
609 XIM xim;
610 XIMStyles *xim_styles;
611 struct xim_inst_t *xim_callback_data;
612 XIMStyle preferred_xim_style;
613
614
615 Lisp_Object xim_coding;
616 #endif
617
618
619 struct color_name_cache_entry **color_names;
620
621
622 ptrdiff_t *color_names_length;
623
624
625 int color_names_size;
626
627
628
629 XColor *color_cells;
630 int ncolor_cells;
631
632
633 int red_bits, blue_bits, green_bits, alpha_bits;
634 int red_offset, blue_offset, green_offset, alpha_offset;
635 unsigned long alpha_mask;
636
637
638
639
640
641
642
643 enum
644 {
645 X_WMTYPE_UNKNOWN,
646 X_WMTYPE_A,
647 X_WMTYPE_B
648 } wm_type;
649
650
651
652 Atom *x_dnd_atoms;
653 ptrdiff_t x_dnd_atoms_size;
654 ptrdiff_t x_dnd_atoms_length;
655
656
657
658 Atom motif_drag_atom;
659
660
661 char motif_drag_atom_name[sizeof "_EMACS_ATOM_%lu" - 3
662 + INT_STRLEN_BOUND (unsigned long)];
663
664
665 Time motif_drag_atom_time;
666
667
668 struct frame *motif_drag_atom_owner;
669
670
671 Window motif_drag_window;
672
673
674
675 Atom Xatom_net_supported, Xatom_net_supporting_wm_check;
676 Atom *net_supported_atoms;
677 int nr_net_supported_atoms;
678 Window net_supported_window;
679 Atom Xatom_net_window_type, Xatom_net_window_type_tooltip;
680 Atom Xatom_net_active_window;
681
682
683 Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen,
684 Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert,
685 Xatom_net_wm_state_sticky, Xatom_net_wm_state_above, Xatom_net_wm_state_below,
686 Xatom_net_wm_state_hidden, Xatom_net_wm_state_skip_taskbar,
687 Xatom_net_wm_state_shaded, Xatom_net_frame_extents, Xatom_net_current_desktop,
688 Xatom_net_workarea, Xatom_net_wm_opaque_region, Xatom_net_wm_ping,
689 Xatom_net_wm_sync_request, Xatom_net_wm_sync_request_counter,
690 Xatom_net_wm_sync_fences, Xatom_net_wm_frame_drawn, Xatom_net_wm_frame_timings,
691 Xatom_net_wm_user_time, Xatom_net_wm_user_time_window,
692 Xatom_net_client_list_stacking, Xatom_net_wm_pid,
693 Xatom_net_wm_bypass_compositor;
694
695
696 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
697 Window xsettings_window;
698
699
700 Atom Xatom_net_wm_name, Xatom_net_wm_icon_name;
701
702 Atom Xatom_net_wm_window_opacity;
703
704
705 Atom Xatom_SM_CLIENT_ID;
706
707
708 Atom Xatom_XdndAware, Xatom_XdndSelection, Xatom_XdndTypeList,
709 Xatom_XdndActionCopy, Xatom_XdndActionMove, Xatom_XdndActionLink,
710 Xatom_XdndActionAsk, Xatom_XdndActionPrivate, Xatom_XdndActionList,
711 Xatom_XdndActionDescription, Xatom_XdndProxy, Xatom_XdndEnter,
712 Xatom_XdndPosition, Xatom_XdndStatus, Xatom_XdndLeave, Xatom_XdndDrop,
713 Xatom_XdndFinished;
714
715
716 Atom Xatom_XdndDirectSave0, Xatom_XdndActionDirectSave, Xatom_text_plain;
717
718 #ifdef HAVE_XKB
719
720 Atom Xatom_Meta, Xatom_Super, Xatom_Hyper, Xatom_ShiftLock, Xatom_Alt;
721 #endif
722
723
724 XModifierKeymap *modmap;
725
726 #ifdef HAVE_XRANDR
727 bool xrandr_supported_p;
728 int xrandr_event_base;
729 int xrandr_error_base;
730 int xrandr_major_version;
731 int xrandr_minor_version;
732 #endif
733
734 #if defined HAVE_XRANDR || defined USE_GTK
735
736
737 Lisp_Object last_monitor_attributes_list;
738 #endif
739
740 #if defined USE_CAIRO || defined HAVE_XRENDER
741 XExtCodes *ext_codes;
742 #endif
743
744 #ifdef USE_XCB
745 xcb_connection_t *xcb_connection;
746 xcb_visualtype_t *xcb_visual;
747 #endif
748
749 #ifdef HAVE_XDBE
750 bool supports_xdbe;
751 #endif
752
753 #ifdef HAVE_XINPUT2
754 bool supports_xi2;
755
756
757
758 int xi2_version;
759
760
761 int xi2_opcode;
762
763
764 int num_devices;
765
766
767
768 struct xi_device_t *devices;
769
770
771 Time pending_keystroke_time;
772
773
774
775
776 int pending_keystroke_source;
777
778 #if defined USE_GTK && !defined HAVE_GTK3
779
780
781
782
783 bool pending_keystroke_time_special_p;
784 #endif
785
786
787
788 int client_pointer_device;
789 #endif
790
791 #ifdef HAVE_XKB
792 bool supports_xkb;
793 int xkb_event_type;
794 XkbDescPtr xkb_desc;
795 #endif
796
797 #ifdef USE_GTK
798 bool prefer_native_input;
799 #endif
800
801 #ifdef HAVE_XRENDER
802 bool xrender_supported_p;
803 int xrender_major;
804 int xrender_minor;
805 #endif
806
807 #ifdef HAVE_XFIXES
808 bool xfixes_supported_p;
809 int xfixes_major;
810 int xfixes_minor;
811 int xfixes_event_base;
812 #endif
813
814 #ifdef HAVE_XSYNC
815 bool xsync_supported_p;
816 int xsync_major;
817 int xsync_minor;
818 #endif
819
820 #ifdef HAVE_XINERAMA
821 bool xinerama_supported_p;
822 #endif
823
824 #ifdef HAVE_XCOMPOSITE
825 bool composite_supported_p;
826 int composite_major;
827 int composite_minor;
828 #endif
829
830 #ifdef HAVE_XSHAPE
831 bool xshape_supported_p;
832 int xshape_major;
833 int xshape_minor;
834 int xshape_event_base;
835 int xshape_error_base;
836 #endif
837
838 #ifdef USE_TOOLKIT_SCROLL_BARS
839 Lisp_Object *protected_windows;
840 int n_protected_windows;
841 int protected_windows_max;
842 #endif
843
844
845
846
847 int screen_width;
848 int screen_height;
849
850
851
852 int screen_mm_width;
853 int screen_mm_height;
854
855
856
857 struct x_failable_request failable_requests[N_FAILABLE_REQUESTS];
858
859
860 struct x_failable_request *next_failable_request;
861
862 #ifdef HAVE_XFIXES
863
864 struct x_monitored_selection *monitored_selections;
865
866
867 Window selection_tracking_window;
868
869
870 int n_monitored_selections;
871 #endif
872
873
874
875 Time pending_dnd_time;
876
877 #if defined HAVE_XSYNC && !defined USE_GTK && defined HAVE_CLOCK_GETTIME
878
879
880 bool server_time_monotonic_p;
881
882
883
884
885 int_fast64_t server_time_offset;
886 #endif
887 };
888
889 #ifdef HAVE_X_I18N
890
891 extern bool use_xim;
892 #endif
893
894 #ifdef HAVE_XINPUT2
895
896 extern int popup_activated_flag;
897 #endif
898
899
900 extern struct x_display_info *x_display_list;
901
902 extern struct x_display_info *x_display_info_for_display (Display *);
903 extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
904 extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
905 extern bool x_display_ok (const char *);
906
907 extern void select_visual (struct x_display_info *);
908
909 extern Window tip_window;
910 extern Lisp_Object tip_dx;
911 extern Lisp_Object tip_dy;
912 extern Lisp_Object tip_frame;
913
914
915
916
917
918 struct x_output
919 {
920 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
921
922
923 int menubar_height;
924 #endif
925
926
927
928
929 int toolbar_top_height, toolbar_bottom_height;
930
931
932
933
934 int toolbar_left_width, toolbar_right_width;
935
936
937 Pixmap border_tile;
938
939
940 GC normal_gc;
941 GC reverse_gc;
942 GC cursor_gc;
943
944
945
946
947 Window window_desc;
948
949
950
951
952 Drawable draw_desc;
953
954 #ifdef HAVE_XRENDER
955
956
957
958 Picture picture;
959 #endif
960
961
962
963 Window icon_desc;
964
965
966
967
968
969 Window parent_desc;
970
971 #ifdef USE_X_TOOLKIT
972
973 Widget widget;
974
975 Widget column_widget;
976
977
978 Widget edit_widget;
979
980 Widget menubar_widget;
981 #endif
982
983 #ifndef USE_GTK
984
985
986 Window user_time_window;
987 #endif
988
989 #ifdef USE_GTK
990
991 GtkWidget *widget;
992
993
994 GtkWidget *edit_widget;
995
996 GtkWidget *vbox_widget;
997
998 GtkWidget *hbox_widget;
999
1000 GtkWidget *menubar_widget;
1001
1002 GtkWidget *toolbar_widget;
1003
1004 bool_bf toolbar_in_hbox : 1;
1005 bool_bf toolbar_is_packed : 1;
1006
1007
1008 GdkGeometry size_hints;
1009 long hint_flags;
1010
1011 GtkTooltip *ttip_widget;
1012 GtkWidget *ttip_lbl;
1013 GtkWindow *ttip_window;
1014
1015 GtkIMContext *im_context;
1016
1017 #ifdef HAVE_GTK3
1018
1019
1020 GtkCssProvider *scrollbar_foreground_css_provider;
1021 GtkCssProvider *scrollbar_background_css_provider;
1022 #endif
1023 #endif
1024
1025
1026
1027 ptrdiff_t icon_bitmap;
1028
1029
1030 struct font *font;
1031
1032
1033 int baseline_offset;
1034
1035
1036
1037 int fontset;
1038
1039 unsigned long cursor_pixel;
1040 unsigned long border_pixel;
1041 unsigned long mouse_pixel;
1042 unsigned long cursor_foreground_pixel;
1043
1044
1045
1046 unsigned long scroll_bar_foreground_pixel;
1047
1048
1049
1050
1051 unsigned long scroll_bar_background_pixel;
1052
1053 #if defined (USE_LUCID) && defined (USE_TOOLKIT_SCROLL_BARS)
1054
1055
1056 unsigned long scroll_bar_top_shadow_pixel;
1057 unsigned long scroll_bar_bottom_shadow_pixel;
1058 #endif
1059
1060
1061 Cursor text_cursor;
1062 Cursor nontext_cursor;
1063 Cursor modeline_cursor;
1064 Cursor hand_cursor;
1065 Cursor hourglass_cursor;
1066 Cursor horizontal_drag_cursor;
1067 Cursor vertical_drag_cursor;
1068 Cursor current_cursor;
1069 Cursor left_edge_cursor;
1070 Cursor top_left_corner_cursor;
1071 Cursor top_edge_cursor;
1072 Cursor top_right_corner_cursor;
1073 Cursor right_edge_cursor;
1074 Cursor bottom_right_corner_cursor;
1075 Cursor bottom_edge_cursor;
1076 Cursor bottom_left_corner_cursor;
1077
1078
1079
1080 Window hourglass_window;
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093 XWMHints wm_hints;
1094
1095
1096 struct x_display_info *display_info;
1097
1098
1099
1100 XEvent *saved_menu_event;
1101
1102
1103 #ifdef USE_X_TOOLKIT
1104 int id;
1105 #endif
1106
1107
1108 bool_bf hourglass_p : 1;
1109
1110
1111
1112 bool_bf explicit_parent : 1;
1113
1114
1115 bool_bf asked_for_visible : 1;
1116
1117
1118 bool_bf has_been_visible : 1;
1119
1120
1121
1122
1123
1124
1125 bool_bf wait_for_wm : 1;
1126
1127
1128
1129 bool_bf alpha_identical_p : 1;
1130
1131 #ifdef HAVE_XDBE
1132
1133
1134
1135 bool_bf need_buffer_flip : 1;
1136
1137
1138
1139
1140 bool_bf complete : 1;
1141 #endif
1142
1143 #ifdef HAVE_X_I18N
1144
1145 XIC xic;
1146 XIMStyle xic_style;
1147 XFontSet xic_xfs;
1148 #endif
1149
1150 #ifdef HAVE_XSYNC
1151
1152 XSyncCounter basic_frame_counter;
1153
1154
1155 XSyncCounter extended_frame_counter;
1156
1157
1158 XSyncValue pending_basic_counter_value;
1159
1160
1161 XSyncValue current_extended_counter_value;
1162
1163
1164 XSyncValue resize_counter_value;
1165
1166
1167 bool_bf sync_end_pending_p : 1;
1168
1169
1170
1171 bool_bf ext_sync_end_pending_p : 1;
1172
1173 #ifdef HAVE_GTK3
1174
1175 bool_bf xg_sync_end_pending_p : 1;
1176 #endif
1177
1178
1179
1180 bool_bf waiting_for_frame_p : 1;
1181
1182
1183
1184 bool_bf draw_just_hung_p : 1;
1185
1186 #if !defined USE_GTK && defined HAVE_CLOCK_GETTIME
1187
1188
1189 bool_bf use_vsync_p : 1;
1190
1191
1192 uint_fast64_t last_frame_time;
1193
1194
1195 uint_fast64_t temp_frame_time;
1196
1197 #ifdef HAVE_XSYNCTRIGGERFENCE
1198
1199
1200
1201 XSyncFence sync_fences[2];
1202 #endif
1203 #endif
1204 #endif
1205
1206
1207 struct relief
1208 {
1209 GC gc;
1210 unsigned long pixel;
1211 }
1212 black_relief, white_relief;
1213
1214
1215
1216 unsigned long relief_background;
1217
1218
1219
1220
1221
1222
1223 int focus_state;
1224
1225
1226 int move_offset_top;
1227 int move_offset_left;
1228
1229
1230 #define X_SHRT_MAX 0x7fff
1231 #define X_SHRT_MIN (-1 - X_SHRT_MAX)
1232 #define X_LONG_MAX 0x7fffffff
1233 #define X_LONG_MIN (-1 - X_LONG_MAX)
1234 #define X_ULONG_MAX 0xffffffffUL
1235
1236 #ifdef USE_CAIRO
1237
1238 cairo_t *cr_context;
1239
1240
1241 int cr_surface_desired_width, cr_surface_desired_height;
1242 #endif
1243
1244 #ifdef HAVE_X_I18N
1245 ptrdiff_t preedit_size;
1246 char *preedit_chars;
1247 bool preedit_active;
1248 int preedit_caret;
1249 #endif
1250
1251 #ifdef HAVE_XINPUT2
1252 XIEventMask *xi_masks;
1253 int num_xi_masks;
1254 #endif
1255
1256
1257
1258 bool window_offset_certain_p;
1259
1260
1261
1262
1263 int root_x, root_y;
1264 };
1265
1266 enum
1267 {
1268
1269
1270
1271
1272
1273 FOCUS_NONE = 0,
1274 FOCUS_IMPLICIT = 1,
1275 FOCUS_EXPLICIT = 2
1276 };
1277
1278
1279 #define FRAME_X_OUTPUT(f) ((f)->output_data.x)
1280 #define FRAME_OUTPUT_DATA(f) FRAME_X_OUTPUT (f)
1281
1282
1283 #define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc)
1284 #define FRAME_NATIVE_WINDOW(f) FRAME_X_WINDOW (f)
1285
1286
1287 #define FRAME_X_RAW_DRAWABLE(f) ((f)->output_data.x->draw_desc)
1288
1289 extern void x_mark_frame_dirty (struct frame *f);
1290
1291
1292
1293
1294
1295 #define FRAME_X_DRAWABLE(f) \
1296 (x_mark_frame_dirty ((f)), FRAME_X_RAW_DRAWABLE ((f)))
1297
1298 #ifdef HAVE_XDBE
1299 #define FRAME_X_DOUBLE_BUFFERED_P(f) \
1300 (FRAME_X_WINDOW (f) != FRAME_X_RAW_DRAWABLE (f))
1301
1302
1303 #define FRAME_X_NEED_BUFFER_FLIP(f) ((f)->output_data.x->need_buffer_flip)
1304
1305
1306
1307 #define FRAME_X_COMPLETE_P(f) ((f)->output_data.x->complete)
1308 #endif
1309
1310
1311 #ifdef USE_X_TOOLKIT
1312 #define FRAME_OUTER_WINDOW(f) ((f)->output_data.x->widget ? \
1313 XtWindow ((f)->output_data.x->widget) : \
1314 FRAME_X_WINDOW (f))
1315 #else
1316 #ifdef USE_GTK
1317
1318 #ifdef HAVE_GTK3
1319 #define DEFAULT_GDK_DISPLAY() \
1320 gdk_x11_display_get_xdisplay (gdk_display_get_default ())
1321 #else
1322 #undef GDK_WINDOW_XID
1323 #define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w)
1324 #define DEFAULT_GDK_DISPLAY() GDK_DISPLAY ()
1325 #define gtk_widget_get_preferred_size(a, ign, b) \
1326 gtk_widget_size_request (a, b)
1327 #endif
1328
1329 #define GTK_WIDGET_TO_X_WIN(w) \
1330 ((w) && gtk_widget_get_window (w) \
1331 ? GDK_WINDOW_XID (gtk_widget_get_window (w)) : 0)
1332
1333 #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
1334 #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)
1335 #define FRAME_OUTER_WINDOW(f) \
1336 (FRAME_GTK_OUTER_WIDGET (f) ? \
1337 GTK_WIDGET_TO_X_WIN (FRAME_GTK_OUTER_WIDGET (f)) : \
1338 FRAME_X_WINDOW (f))
1339
1340 #else
1341 #define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
1342 #endif
1343 #endif
1344
1345 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
1346 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
1347 #else
1348 #define FRAME_MENUBAR_HEIGHT(f) ((void) f, 0)
1349 #endif
1350
1351 #define FRAME_FONT(f) ((f)->output_data.x->font)
1352 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
1353 #define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.x->toolbar_top_height)
1354 #define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
1355 ((f)->output_data.x->toolbar_bottom_height)
1356 #define FRAME_TOOLBAR_HEIGHT(f) \
1357 (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
1358 #define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.x->toolbar_left_width)
1359 #define FRAME_TOOLBAR_RIGHT_WIDTH(f) ((f)->output_data.x->toolbar_right_width)
1360 #define FRAME_TOOLBAR_WIDTH(f) \
1361 (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f))
1362 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset)
1363
1364
1365 #define FRAME_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
1366
1367
1368 #define FRAME_X_DISPLAY(f) (FRAME_DISPLAY_INFO (f)->display)
1369
1370
1371 #define FRAME_X_SCREEN(f) (FRAME_DISPLAY_INFO (f)->screen)
1372
1373
1374 #define FRAME_X_SCREEN_NUMBER(f) XScreenNumberOfScreen (FRAME_X_SCREEN (f))
1375
1376
1377 #define FRAME_X_VISUAL(f) FRAME_DISPLAY_INFO (f)->visual
1378
1379
1380 #define FRAME_X_VISUAL_INFO(f) (&FRAME_DISPLAY_INFO (f)->visual_info)
1381
1382 #ifdef HAVE_XRENDER
1383 #define FRAME_X_PICTURE_FORMAT(f) FRAME_DISPLAY_INFO (f)->pict_format
1384 #define FRAME_X_PICTURE(f) ((f)->output_data.x->picture)
1385 #define FRAME_CHECK_XR_VERSION(f, major, minor) \
1386 (FRAME_DISPLAY_INFO (f)->xrender_supported_p \
1387 && ((FRAME_DISPLAY_INFO (f)->xrender_major == (major) \
1388 && FRAME_DISPLAY_INFO (f)->xrender_minor >= (minor)) \
1389 || (FRAME_DISPLAY_INFO (f)->xrender_major > (major))))
1390 #endif
1391
1392 #ifdef HAVE_XSYNC
1393 #define FRAME_X_BASIC_COUNTER(f) \
1394 FRAME_X_OUTPUT (f)->basic_frame_counter
1395 #define FRAME_X_EXTENDED_COUNTER(f) \
1396 FRAME_X_OUTPUT (f)->extended_frame_counter
1397 #define FRAME_X_WAITING_FOR_DRAW(f) \
1398 FRAME_X_OUTPUT (f)->waiting_for_frame_p
1399 #define FRAME_X_DRAW_JUST_HUNG(f) \
1400 FRAME_X_OUTPUT (f)->draw_just_hung_p
1401 #define FRAME_X_COUNTER_VALUE(f) \
1402 FRAME_X_OUTPUT (f)->current_extended_counter_value
1403 #endif
1404
1405
1406 #define FRAME_X_COLORMAP(f) FRAME_DISPLAY_INFO (f)->cmap
1407
1408 #define FRAME_XIC(f) ((f)->output_data.x->xic)
1409 #define FRAME_X_XIM(f) (FRAME_DISPLAY_INFO (f)->xim)
1410 #define FRAME_X_XIM_STYLES(f) (FRAME_DISPLAY_INFO (f)->xim_styles)
1411 #define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
1412 #define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
1413 #define FRAME_X_XIM_CODING(f) \
1414 (SYMBOLP (Vx_input_coding_system) \
1415 ? Vx_input_coding_system \
1416 : (!NILP (FRAME_DISPLAY_INFO (f)->xim_coding) \
1417 ? FRAME_DISPLAY_INFO(f)->xim_coding \
1418 : Vlocale_coding_system))
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430 struct scroll_bar
1431 {
1432
1433 union vectorlike_header header;
1434
1435
1436 Lisp_Object window;
1437
1438
1439 Lisp_Object next, prev;
1440
1441
1442
1443
1444 Window x_window;
1445
1446
1447
1448 int top, left, width, height;
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461 int start, end;
1462
1463
1464
1465
1466
1467 int dragging;
1468
1469 #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
1470
1471 enum scroll_bar_part last_seen_part;
1472 #endif
1473
1474 #if defined (USE_TOOLKIT_SCROLL_BARS) && !defined (USE_GTK)
1475
1476 int whole;
1477 #endif
1478
1479
1480 bool horizontal;
1481 } GCALIGNED_STRUCT;
1482
1483
1484 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
1485
1486 #ifdef USE_X_TOOLKIT
1487
1488
1489
1490
1491
1492 #define SCROLL_BAR_X_WIDGET(dpy, ptr) \
1493 XtWindowToWidget (dpy, ptr->x_window)
1494
1495
1496
1497 #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
1498 do { \
1499 Window window = XtWindow (w); \
1500 ptr->x_window = window; \
1501 } while (false)
1502
1503 #endif
1504
1505
1506
1507 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
1508 ((width) \
1509 - VERTICAL_SCROLL_BAR_LEFT_BORDER \
1510 - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
1511
1512
1513
1514
1515
1516
1517
1518
1519 #define VERTICAL_SCROLL_BAR_TOP_RANGE(f, height) \
1520 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
1521
1522
1523
1524 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
1525 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
1526
1527
1528
1529 #define HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
1530 ((height) \
1531 - HORIZONTAL_SCROLL_BAR_TOP_BORDER \
1532 - HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER)
1533
1534
1535
1536
1537
1538
1539
1540
1541 #define HORIZONTAL_SCROLL_BAR_LEFT_RANGE(f, width) \
1542 (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH (f, width) - HORIZONTAL_SCROLL_BAR_MIN_HANDLE)
1543
1544
1545
1546 #define HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
1547 ((width) - HORIZONTAL_SCROLL_BAR_LEFT_BORDER - HORIZONTAL_SCROLL_BAR_LEFT_BORDER)
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
1562 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (2)
1563 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
1564 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
1565
1566 #define HORIZONTAL_SCROLL_BAR_LEFT_BORDER (2)
1567 #define HORIZONTAL_SCROLL_BAR_RIGHT_BORDER (2)
1568 #define HORIZONTAL_SCROLL_BAR_TOP_BORDER (2)
1569 #define HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER (2)
1570
1571
1572 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
1573 #define HORIZONTAL_SCROLL_BAR_MIN_HANDLE (5)
1574
1575
1576
1577
1578
1579
1580
1581
1582 struct selection_input_event
1583 {
1584 ENUM_BF (event_kind) kind : EVENT_KIND_WIDTH;
1585 struct x_display_info *dpyinfo;
1586
1587 Window requestor;
1588 Atom selection, target, property;
1589 Time time;
1590 };
1591
1592
1593 INLINE Display *
1594 SELECTION_EVENT_DISPLAY (struct selection_input_event *ev)
1595 {
1596 return ev->dpyinfo->display;
1597 }
1598 #define SELECTION_EVENT_DPYINFO(eventp) \
1599 ((eventp)->dpyinfo)
1600
1601 #define SELECTION_EVENT_REQUESTOR(eventp) \
1602 ((eventp)->requestor)
1603 #define SELECTION_EVENT_SELECTION(eventp) \
1604 ((eventp)->selection)
1605 #define SELECTION_EVENT_TARGET(eventp) \
1606 ((eventp)->target)
1607 #define SELECTION_EVENT_PROPERTY(eventp) \
1608 ((eventp)->property)
1609 #define SELECTION_EVENT_TIME(eventp) \
1610 ((eventp)->time)
1611
1612
1613
1614 extern void x_free_gcs (struct frame *);
1615 extern void x_relative_mouse_position (struct frame *, int *, int *);
1616 extern void x_real_pos_and_offsets (struct frame *, int *, int *, int *,
1617 int *, int *, int *, int *, int *,
1618 int *);
1619 extern void x_default_font_parameter (struct frame *, Lisp_Object);
1620
1621
1622
1623 extern XrmDatabase x_load_resources (Display *, const char *, const char *,
1624 const char *);
1625 extern const char *x_get_string_resource (void *, const char *, const char *);
1626
1627
1628
1629 typedef void (*x_special_error_handler) (Display *, XErrorEvent *, char *,
1630 void *);
1631
1632 extern bool x_text_icon (struct frame *, const char *);
1633 extern void x_catch_errors (Display *);
1634 extern void x_catch_errors_with_handler (Display *, x_special_error_handler,
1635 void *);
1636 extern void x_catch_errors_for_lisp (struct x_display_info *);
1637 extern void x_uncatch_errors_for_lisp (struct x_display_info *);
1638 extern void x_check_errors_for_lisp (struct x_display_info *,
1639 const char *)
1640 ATTRIBUTE_FORMAT_PRINTF (2, 0);
1641 extern void x_check_errors (Display *, const char *)
1642 ATTRIBUTE_FORMAT_PRINTF (2, 0);
1643 extern bool x_had_errors_p (Display *);
1644 extern void x_unwind_errors_to (int);
1645 extern void x_uncatch_errors (void);
1646 extern void x_uncatch_errors_after_check (void);
1647 extern void x_ignore_errors_for_next_request (struct x_display_info *);
1648 extern void x_stop_ignoring_errors (struct x_display_info *);
1649 extern void x_clear_errors (Display *);
1650 extern void x_set_window_size (struct frame *, bool, int, int);
1651 extern void x_set_last_user_time_from_lisp (struct x_display_info *, Time);
1652 extern void x_make_frame_visible (struct frame *);
1653 extern void x_make_frame_invisible (struct frame *);
1654 extern void x_iconify_frame (struct frame *);
1655 extern void x_free_frame_resources (struct frame *);
1656 extern void x_wm_set_size_hint (struct frame *, long, bool);
1657 #if defined HAVE_XSYNCTRIGGERFENCE && !defined USE_GTK \
1658 && defined HAVE_CLOCK_GETTIME
1659 extern void x_sync_init_fences (struct frame *);
1660 #endif
1661 extern bool x_embed_frame (struct x_display_info *, struct frame *);
1662
1663 extern void x_delete_terminal (struct terminal *);
1664 extern Cursor x_create_font_cursor (struct x_display_info *, int);
1665 extern unsigned long x_copy_color (struct frame *, unsigned long);
1666 #ifdef USE_X_TOOLKIT
1667 extern XtAppContext Xt_app_con;
1668 extern void x_activate_timeout_atimer (void);
1669 #endif
1670 #ifdef USE_LUCID
1671 extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
1672 unsigned long *,
1673 double, int);
1674 #endif
1675 extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
1676 extern void x_query_colors (struct frame *f, XColor *, int);
1677 extern void x_clear_area (struct frame *f, int, int, int, int);
1678 #if (defined USE_LUCID && defined HAVE_XINPUT2) \
1679 || (!defined USE_X_TOOLKIT && !defined USE_GTK)
1680 extern void x_mouse_leave (struct x_display_info *);
1681 #endif
1682 extern void x_wait_for_cell_change (Lisp_Object, struct timespec);
1683
1684 #ifndef USE_GTK
1685 extern int x_dispatch_event (XEvent *, Display *);
1686 #endif
1687 extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
1688 extern int x_emacs_to_x_modifiers (struct x_display_info *, intmax_t);
1689 #ifdef USE_CAIRO
1690 extern void x_cr_destroy_frame_context (struct frame *);
1691 extern void x_cr_update_surface_desired_size (struct frame *, int, int);
1692 extern cairo_t *x_begin_cr_clip (struct frame *, GC);
1693 extern void x_end_cr_clip (struct frame *);
1694 extern void x_set_cr_source_with_gc_foreground (struct frame *, GC, bool);
1695 extern void x_set_cr_source_with_gc_background (struct frame *, GC, bool);
1696 extern void x_cr_draw_frame (cairo_t *, struct frame *);
1697 extern Lisp_Object x_cr_export_frames (Lisp_Object, cairo_surface_type_t);
1698 #endif
1699
1700 #ifdef HAVE_XFIXES
1701 extern Window x_find_selection_owner (struct x_display_info *, Atom);
1702 #endif
1703
1704 #ifdef HAVE_XRENDER
1705 extern void x_xrender_color_from_gc_background (struct frame *, GC,
1706 XRenderColor *, bool);
1707 extern void x_xr_ensure_picture (struct frame *);
1708 extern void x_xr_apply_ext_clip (struct frame *, GC);
1709 extern void x_xr_reset_ext_clip (struct frame *);
1710 #endif
1711
1712 extern void x_translate_coordinates (struct frame *, int, int, int *, int *);
1713 extern void x_translate_coordinates_to_root (struct frame *, int, int,
1714 int *, int *);
1715 extern Lisp_Object x_handle_translate_coordinates (struct frame *, Lisp_Object,
1716 int, int);
1717
1718 extern Bool x_query_pointer (Display *, Window, Window *, Window *, int *,
1719 int *, int *, int *, unsigned int *);
1720
1721 #ifdef HAVE_GTK3
1722 extern void x_scroll_bar_configure (GdkEvent *);
1723 #endif
1724
1725 #define DEFER_SELECTIONS \
1726 x_defer_selection_requests (); \
1727 record_unwind_protect_void (x_release_selection_requests_and_flush)
1728
1729 extern void x_defer_selection_requests (void);
1730 extern void x_release_selection_requests_and_flush (void);
1731 extern void x_handle_pending_selection_requests (void);
1732 extern bool x_detect_pending_selection_requests (void);
1733 extern Lisp_Object x_dnd_begin_drag_and_drop (struct frame *, Time, Atom,
1734 Lisp_Object, Atom *, const char **,
1735 size_t, bool, Atom *, int,
1736 Lisp_Object, bool);
1737 extern void x_dnd_do_unsupported_drop (struct x_display_info *, Lisp_Object,
1738 Lisp_Object, Lisp_Object, Window, int,
1739 int, Time);
1740
1741 extern int x_display_pixel_height (struct x_display_info *);
1742 extern int x_display_pixel_width (struct x_display_info *);
1743
1744 INLINE unsigned long
1745 x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
1746 {
1747 unsigned long pr, pg, pb, pa = dpyinfo->alpha_mask;
1748
1749
1750
1751
1752 pr = (r >> (16 - dpyinfo->red_bits)) << dpyinfo->red_offset;
1753 pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
1754 pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
1755
1756
1757 return pr | pg | pb | pa;
1758 }
1759
1760
1761
1762
1763
1764 INLINE bool
1765 x_mutable_colormap (XVisualInfo *visual)
1766 {
1767 int class = visual->class;
1768 return (class != StaticColor && class != StaticGray && class != TrueColor);
1769 }
1770
1771 extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
1772 extern void x_set_shaded (struct frame *, Lisp_Object, Lisp_Object);
1773 extern void x_set_skip_taskbar (struct frame *, Lisp_Object, Lisp_Object);
1774 extern void x_set_z_group (struct frame *, Lisp_Object, Lisp_Object);
1775 extern bool x_wm_supports (struct frame *, Atom);
1776 extern bool x_wm_supports_1 (struct x_display_info *, Atom);
1777 extern void x_wait_for_event (struct frame *, int);
1778 extern void x_clear_under_internal_border (struct frame *f);
1779
1780 extern void tear_down_x_back_buffer (struct frame *f);
1781 extern void initial_set_up_x_back_buffer (struct frame *f);
1782
1783
1784 extern void x_real_positions (struct frame *, int *, int *);
1785 extern void x_change_tab_bar_height (struct frame *, int);
1786 extern void x_change_tool_bar_height (struct frame *, int);
1787 extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
1788 extern void x_set_scroll_bar_default_width (struct frame *);
1789 extern void x_set_scroll_bar_default_height (struct frame *);
1790 #ifdef USE_LUCID
1791 extern void xlw_monitor_dimensions_at_pos (Display *, Screen *, int, int,
1792 int *, int *, int *, int *);
1793 #endif
1794
1795
1796
1797 extern void x_handle_property_notify (const XPropertyEvent *);
1798 extern void x_handle_selection_notify (const XSelectionEvent *);
1799 extern void x_handle_selection_event (struct selection_input_event *);
1800 extern void x_clear_frame_selections (struct frame *);
1801 extern Lisp_Object x_atom_to_symbol (struct x_display_info *, Atom);
1802 extern Atom symbol_to_x_atom (struct x_display_info *, Lisp_Object);
1803
1804 extern bool x_handle_dnd_message (struct frame *,
1805 const XClientMessageEvent *,
1806 struct x_display_info *,
1807 struct input_event *,
1808 bool, int, int);
1809 extern int x_check_property_data (Lisp_Object);
1810 extern void x_fill_property_data (Display *,
1811 Lisp_Object,
1812 void *,
1813 int,
1814 int);
1815 extern Lisp_Object x_property_data_to_lisp (struct frame *,
1816 const unsigned char *,
1817 Atom,
1818 int,
1819 unsigned long);
1820 extern void x_clipboard_manager_save_frame (Lisp_Object);
1821 extern void x_clipboard_manager_save_all (void);
1822
1823 extern Lisp_Object x_timestamp_for_selection (struct x_display_info *,
1824 Lisp_Object);
1825 extern void x_own_selection (Lisp_Object, Lisp_Object, Lisp_Object,
1826 Lisp_Object, Time);
1827 extern Atom x_intern_cached_atom (struct x_display_info *, const char *,
1828 bool);
1829 extern char *x_get_atom_name (struct x_display_info *, Atom, bool *)
1830 ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC_FREE;
1831
1832 #ifdef USE_GTK
1833 extern bool xg_set_icon (struct frame *, Lisp_Object);
1834 extern bool xg_set_icon_from_xpm_data (struct frame *, const char **);
1835 #endif
1836
1837 extern void xic_free_xfontset (struct frame *);
1838 extern void create_frame_xic (struct frame *);
1839 extern void destroy_frame_xic (struct frame *);
1840 extern void xic_set_preeditarea (struct window *, int, int);
1841 extern void xic_set_statusarea (struct frame *);
1842 extern void xic_set_xfontset (struct frame *, const char *);
1843 extern bool x_defined_color (struct frame *, const char *, Emacs_Color *,
1844 bool, bool);
1845 extern void x_preserve_selections (struct x_display_info *, Lisp_Object,
1846 Lisp_Object);
1847 extern Lisp_Object x_get_keyboard_modifiers (struct x_display_info *);
1848 #ifdef HAVE_X_I18N
1849 extern void free_frame_xic (struct frame *);
1850 # if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
1851 extern char *xic_create_fontsetname (const char *, bool);
1852 # endif
1853 #endif
1854
1855
1856
1857 #ifdef USE_X_TOOLKIT
1858 extern void x_free_dpy_colors (Display *, Screen *, Colormap,
1859 unsigned long *, int);
1860 #endif
1861
1862
1863
1864 #if defined USE_X_TOOLKIT || defined USE_GTK
1865 extern Lisp_Object xw_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
1866 #endif
1867
1868 #if defined USE_GTK || defined USE_MOTIF
1869 extern void x_menu_set_in_use (bool);
1870 #endif
1871 extern void x_menu_wait_for_event (void *data);
1872 extern void initialize_frame_menubar (struct frame *);
1873
1874
1875 #ifdef HAVE_X_SM
1876 extern void x_session_initialize (struct x_display_info *dpyinfo);
1877 extern bool x_session_have_connection (void);
1878 extern void x_session_close (void);
1879 #endif
1880
1881 #ifdef HAVE_X_I18N
1882 #define STYLE_OFFTHESPOT (XIMPreeditArea | XIMStatusArea)
1883 #define STYLE_OVERTHESPOT (XIMPreeditPosition | XIMStatusNothing)
1884 #define STYLE_ROOT (XIMPreeditNothing | XIMStatusNothing)
1885 #define STYLE_CALLBACK (XIMPreeditCallbacks | XIMStatusNothing)
1886 #define STYLE_NONE (XIMPreeditNothing | XIMStatusNothing)
1887 #endif
1888
1889 #ifdef USE_GTK
1890 extern struct input_event xg_pending_quit_event;
1891 #endif
1892
1893 extern bool x_dnd_in_progress;
1894 extern bool x_dnd_waiting_for_finish;
1895 extern struct frame *x_dnd_frame;
1896 extern struct frame *x_dnd_finish_frame;
1897 extern int x_error_message_count;
1898
1899 #ifdef HAVE_XINPUT2
1900 extern struct xi_device_t *xi_device_from_id (struct x_display_info *, int);
1901 extern bool xi_frame_selected_for (struct frame *, unsigned long);
1902 #ifndef USE_GTK
1903 extern unsigned int xi_convert_event_state (XIDeviceEvent *);
1904 #endif
1905 #endif
1906
1907 extern void mark_xterm (void);
1908
1909
1910
1911 #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT (f)->explicit_parent != 0)
1912
1913 #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \
1914 ((nr).x = (rx), \
1915 (nr).y = (ry), \
1916 (nr).width = (rwidth), \
1917 (nr).height = (rheight))
1918
1919 INLINE_HEADER_END
1920
1921 #endif