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