This source file includes following definitions.
- fset_buffer_list
- fset_buried_buffer_list
- fset_condemned_scroll_bars
- fset_face_hash_table
- fset_parent_frame
- fset_focus_frame
- fset_icon_name
- fset_menu_bar_items
- fset_menu_bar_vector
- fset_menu_bar_window
- fset_name
- fset_param_alist
- fset_root_window
- fset_scroll_bars
- fset_selected_window
- fset_old_selected_window
- fset_title
- fset_tab_bar_items
- fset_tab_bar_window
- fset_current_tab_bar_string
- fset_desired_tab_bar_string
- fset_tool_bar_items
- fset_tool_bar_window
- fset_current_tool_bar_string
- fset_desired_tool_bar_string
- fset_tool_bar_position
- NUMVAL
- default_pixels_per_inch_x
- default_pixels_per_inch_y
- SET_FRAME_VISIBLE
- SET_FRAME_ICONIFIED
- window_system_available
- frame_dimension
- FRAME_FRINGE_COLS
- FRAME_LEFT_FRINGE_WIDTH
- FRAME_RIGHT_FRINGE_WIDTH
- FRAME_TOTAL_FRINGE_WIDTH
- FRAME_CHILD_FRAME_BORDER_WIDTH
- FRAME_INTERNAL_BORDER_WIDTH
- FRAME_RIGHT_DIVIDER_WIDTH
- FRAME_BOTTOM_DIVIDER_WIDTH
- FACE_FROM_ID
- FACE_FROM_ID_OR_NULL
- IMAGE_FROM_ID
- IMAGE_OPT_FROM_ID
- gui_set_bitmap_icon
- flush_frame
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef EMACS_FRAME_H
20 #define EMACS_FRAME_H
21
22 #include "termhooks.h"
23 #include "window.h"
24
25 INLINE_HEADER_BEGIN
26
27 enum vertical_scroll_bar_type
28 {
29 vertical_scroll_bar_none,
30 vertical_scroll_bar_left,
31 vertical_scroll_bar_right
32 };
33
34 #ifdef HAVE_WINDOW_SYSTEM
35
36 enum fullscreen_type
37 {
38 FULLSCREEN_NONE,
39 FULLSCREEN_WIDTH = 0x1,
40 FULLSCREEN_HEIGHT = 0x2,
41 FULLSCREEN_BOTH = 0x3,
42 FULLSCREEN_MAXIMIZED = 0x4,
43 #ifdef HAVE_NTGUI
44 FULLSCREEN_WAIT = 0x8
45 #endif
46 };
47
48 enum z_group
49 {
50 z_group_none,
51 z_group_above,
52 z_group_below,
53 z_group_above_suspended,
54 };
55
56 enum internal_border_part
57 {
58 INTERNAL_BORDER_NONE,
59 INTERNAL_BORDER_LEFT_EDGE,
60 INTERNAL_BORDER_TOP_LEFT_CORNER,
61 INTERNAL_BORDER_TOP_EDGE,
62 INTERNAL_BORDER_TOP_RIGHT_CORNER,
63 INTERNAL_BORDER_RIGHT_EDGE,
64 INTERNAL_BORDER_BOTTOM_RIGHT_CORNER,
65 INTERNAL_BORDER_BOTTOM_EDGE,
66 INTERNAL_BORDER_BOTTOM_LEFT_CORNER,
67 };
68
69 #ifdef NS_IMPL_COCOA
70 enum ns_appearance_type
71 {
72 ns_appearance_system_default,
73 ns_appearance_aqua,
74 ns_appearance_vibrant_dark
75 };
76 #endif
77 #endif
78
79 #ifdef HAVE_TEXT_CONVERSION
80
81 enum text_conversion_operation
82 {
83 TEXTCONV_START_BATCH_EDIT,
84 TEXTCONV_END_BATCH_EDIT,
85 TEXTCONV_COMMIT_TEXT,
86 TEXTCONV_FINISH_COMPOSING_TEXT,
87 TEXTCONV_SET_COMPOSING_TEXT,
88 TEXTCONV_SET_COMPOSING_REGION,
89 TEXTCONV_SET_POINT_AND_MARK,
90 TEXTCONV_DELETE_SURROUNDING_TEXT,
91 TEXTCONV_REQUEST_POINT_UPDATE,
92 TEXTCONV_BARRIER,
93 };
94
95
96
97
98
99 struct text_conversion_action
100 {
101
102 struct text_conversion_action *next;
103
104
105 Lisp_Object data;
106
107
108 enum text_conversion_operation operation;
109
110
111 unsigned long counter;
112 };
113
114
115
116
117 struct text_conversion_state
118 {
119
120 struct text_conversion_action *actions;
121
122
123 Lisp_Object compose_region_start, compose_region_end;
124
125
126 Lisp_Object compose_region_overlay;
127
128
129
130 int batch_edit_count;
131
132
133 int batch_edit_flags;
134 };
135
136 #endif
137
138
139
140 struct frame
141 {
142 union vectorlike_header header;
143
144
145
146
147
148
149 Lisp_Object name;
150
151
152
153 Lisp_Object icon_name;
154
155
156
157 Lisp_Object title;
158
159 #if defined (HAVE_WINDOW_SYSTEM)
160
161 Lisp_Object parent_frame;
162 #endif
163
164
165
166 Lisp_Object last_mouse_device;
167
168
169
170
171
172
173
174
175
176
177
178
179 Lisp_Object focus_frame;
180
181
182
183
184 Lisp_Object root_window;
185
186
187
188
189
190
191 Lisp_Object selected_window;
192
193
194
195 Lisp_Object old_selected_window;
196
197
198
199
200
201 Lisp_Object minibuffer_window;
202
203
204
205
206 Lisp_Object param_alist;
207
208
209
210
211
212
213
214
215 Lisp_Object scroll_bars;
216 Lisp_Object condemned_scroll_bars;
217
218
219
220
221
222
223 Lisp_Object menu_bar_items;
224
225
226 Lisp_Object face_hash_table;
227
228
229
230
231 Lisp_Object menu_bar_vector;
232
233
234 Lisp_Object buffer_predicate;
235
236
237 Lisp_Object buffer_list;
238
239
240
241 Lisp_Object buried_buffer_list;
242
243 #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR
244
245
246 Lisp_Object menu_bar_window;
247 #endif
248
249 #if defined (HAVE_WINDOW_SYSTEM)
250
251 Lisp_Object tab_bar_window;
252
253
254 Lisp_Object desired_tab_bar_string;
255 Lisp_Object current_tab_bar_string;
256 #endif
257
258 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
259
260 Lisp_Object tool_bar_window;
261
262
263 Lisp_Object desired_tool_bar_string;
264 Lisp_Object current_tool_bar_string;
265 #endif
266
267
268
269 Lisp_Object tool_bar_position;
270
271 #if defined (HAVE_XFT) || defined (HAVE_FREETYPE)
272
273 Lisp_Object font_data;
274 #endif
275
276
277 Lisp_Object tab_bar_items;
278
279
280 Lisp_Object tool_bar_items;
281
282
283
284 struct face_cache *face_cache;
285
286
287 int last_tab_bar_item;
288
289 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
290
291 int last_tool_bar_item;
292 #endif
293
294
295 int menu_bar_items_used;
296
297 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
298
299
300
301 char *namebuf;
302 #endif
303
304 #ifdef USE_X_TOOLKIT
305
306 char *shell_position;
307 #endif
308
309
310 struct glyph_pool *current_pool;
311 struct glyph_pool *desired_pool;
312 struct glyph_matrix *desired_matrix;
313 struct glyph_matrix *current_matrix;
314
315
316
317
318
319 bool_bf glyphs_initialized_p : 1;
320
321
322
323 bool_bf resized_p : 1;
324
325
326
327
328 bool_bf default_face_done_p : 1;
329
330
331
332 bool_bf already_hscrolled_p : 1;
333
334
335 bool_bf updated_p : 1;
336
337 #if defined (HAVE_WINDOW_SYSTEM)
338
339
340 bool_bf minimize_tab_bar_window_p : 1;
341 #endif
342
343 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
344
345
346 bool_bf minimize_tool_bar_window_p : 1;
347
348
349
350 bool_bf tool_bar_wraps_p : 1;
351 #endif
352
353 #ifdef HAVE_EXT_TOOL_BAR
354
355 bool_bf external_tool_bar : 1;
356 #endif
357
358
359
360 bool_bf fonts_changed : 1;
361
362
363 bool_bf cursor_type_changed : 1;
364
365
366 bool_bf redisplay : 1;
367
368 #ifdef HAVE_EXT_MENU_BAR
369
370 bool_bf external_menu_bar : 1;
371 #endif
372
373
374
375
376
377
378
379
380
381
382
383
384
385 unsigned visible : 2;
386
387
388
389 bool_bf iconified : 1;
390
391
392
393 bool_bf garbaged : 1;
394
395
396
397 bool_bf wants_modeline : 1;
398
399
400 bool_bf auto_raise : 1;
401
402
403 bool_bf auto_lower : 1;
404
405
406 bool_bf no_split : 1;
407
408
409
410
411
412 bool_bf explicit_name : 1;
413
414
415
416
417
418
419
420
421 bool_bf window_change : 1;
422
423
424
425 bool_bf window_state_change : 1;
426
427
428
429 bool_bf mouse_moved : 1;
430
431
432 bool_bf pointer_invisible : 1;
433
434
435
436 bool_bf frozen_window_starts : 1;
437
438
439
440
441 ENUM_BF (output_method) output_method : 4;
442
443 #ifdef HAVE_WINDOW_SYSTEM
444
445 bool_bf tooltip : 1;
446
447
448 ENUM_BF (fullscreen_type) want_fullscreen : 4;
449
450
451
452 ENUM_BF (vertical_scroll_bar_type) vertical_scroll_bar_type : 2;
453
454
455 bool_bf horizontal_scroll_bars : 1;
456
457
458 bool_bf undecorated : 1;
459
460 #ifndef HAVE_NTGUI
461
462 bool_bf override_redirect : 1;
463 #endif
464
465
466 bool_bf skip_taskbar : 1;
467
468
469
470 bool_bf no_focus_on_map : 1;
471
472
473
474 bool_bf no_accept_focus : 1;
475
476
477 ENUM_BF (z_group) z_group : 2;
478
479
480
481 bool_bf no_special_glyphs : 1;
482 #endif
483
484
485
486 bool_bf can_set_window_size : 1;
487
488
489 bool_bf after_make_frame : 1;
490
491
492
493
494
495
496
497
498 bool_bf tab_bar_redisplayed : 1;
499 bool_bf tab_bar_resized : 1;
500
501
502
503
504
505
506
507
508 bool_bf tool_bar_redisplayed : 1;
509 bool_bf tool_bar_resized : 1;
510
511
512 bool_bf inhibit_horizontal_resize : 1;
513 bool_bf inhibit_vertical_resize : 1;
514
515
516 bool_bf face_change : 1;
517
518
519
520 bool_bf inhibit_clear_image_cache : 1;
521
522
523
524
525 bool_bf new_size_p : 1;
526
527
528
529 bool_bf was_invisible : 1;
530
531
532
533
534
535 bool_bf select_mini_window_flag : 1;
536
537
538
539
540
541
542
543 int change_stamp;
544
545
546
547
548
549
550 ptrdiff_t number_of_windows;
551
552
553 int tab_bar_lines;
554
555
556 int tab_bar_height;
557
558 int n_tab_bar_rows;
559 int n_tab_bar_items;
560
561
562 int tool_bar_lines;
563
564
565 int tool_bar_height;
566
567 int n_tool_bar_rows;
568 int n_tool_bar_items;
569
570
571 char *decode_mode_spec_buffer;
572
573
574
575 int *insert_line_cost;
576
577 int *delete_line_cost;
578
579 int *insert_n_lines_cost;
580
581 int *delete_n_lines_cost;
582
583
584
585 int text_cols, text_lines;
586
587 int text_width, text_height;
588
589
590
591 int total_cols, total_lines;
592
593 int pixel_width, pixel_height;
594
595
596 int new_width, new_height;
597
598
599 int left_pos, top_pos;
600
601
602 int win_gravity;
603
604
605 int size_hint_flags;
606
607
608 int border_width;
609
610
611
612 int child_frame_border_width;
613
614
615
616
617 int internal_border_width;
618
619
620 int right_divider_width, bottom_divider_width;
621
622
623 int left_fringe_width, right_fringe_width;
624
625
626
627 int fringe_cols;
628
629
630 int menu_bar_lines;
631
632
633 int menu_bar_height;
634
635
636 int column_width;
637
638
639 int line_height;
640
641
642
643 struct terminal *terminal;
644
645
646
647
648 union output_data
649 {
650 struct tty_output *tty;
651 struct x_output *x;
652 struct w32_output *w32;
653 struct ns_output *ns;
654 struct pgtk_output *pgtk;
655 struct haiku_output *haiku;
656 struct android_output *android;
657 }
658 output_data;
659
660
661 struct font_driver_list *font_driver_list;
662
663 #if defined HAVE_X_WINDOWS || defined HAVE_ANDROID
664
665
666 int wait_event_type;
667 #endif
668
669
670
671 enum text_cursor_kinds desired_cursor;
672
673
674 int cursor_width;
675
676
677
678 enum text_cursor_kinds blink_off_cursor;
679
680
681 int blink_off_cursor_width;
682
683
684
685
686
687
688 int config_scroll_bar_width;
689 int config_scroll_bar_cols;
690
691
692
693
694
695
696 int config_scroll_bar_height;
697 int config_scroll_bar_lines;
698
699
700 intmax_t cost_calculation_baud_rate;
701
702
703
704
705
706 double alpha[2];
707
708
709 double alpha_background;
710
711
712
713
714 double gamma;
715
716
717 int extra_line_spacing;
718
719
720 unsigned long background_pixel;
721 unsigned long foreground_pixel;
722
723 #ifdef NS_IMPL_COCOA
724
725 enum ns_appearance_type ns_appearance;
726 bool_bf ns_transparent_titlebar;
727 #endif
728
729 #ifdef HAVE_TEXT_CONVERSION
730
731 struct text_conversion_state conversion;
732 #endif
733 } GCALIGNED_STRUCT;
734
735
736
737 INLINE void
738 fset_buffer_list (struct frame *f, Lisp_Object val)
739 {
740 f->buffer_list = val;
741 }
742 INLINE void
743 fset_buried_buffer_list (struct frame *f, Lisp_Object val)
744 {
745 f->buried_buffer_list = val;
746 }
747 INLINE void
748 fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
749 {
750 f->condemned_scroll_bars = val;
751 }
752 INLINE void
753 fset_face_hash_table (struct frame *f, Lisp_Object val)
754 {
755 f->face_hash_table = val;
756 }
757 #if defined (HAVE_WINDOW_SYSTEM)
758 INLINE void
759 fset_parent_frame (struct frame *f, Lisp_Object val)
760 {
761 f->parent_frame = val;
762 }
763 #endif
764 INLINE void
765 fset_focus_frame (struct frame *f, Lisp_Object val)
766 {
767 f->focus_frame = val;
768 }
769 INLINE void
770 fset_icon_name (struct frame *f, Lisp_Object val)
771 {
772 f->icon_name = val;
773 }
774 INLINE void
775 fset_menu_bar_items (struct frame *f, Lisp_Object val)
776 {
777 f->menu_bar_items = val;
778 }
779 INLINE void
780 fset_menu_bar_vector (struct frame *f, Lisp_Object val)
781 {
782 f->menu_bar_vector = val;
783 }
784 #if defined HAVE_WINDOW_SYSTEM && !defined HAVE_EXT_MENU_BAR
785 INLINE void
786 fset_menu_bar_window (struct frame *f, Lisp_Object val)
787 {
788 f->menu_bar_window = val;
789 }
790 #endif
791 INLINE void
792 fset_name (struct frame *f, Lisp_Object val)
793 {
794 f->name = val;
795 }
796 INLINE void
797 fset_param_alist (struct frame *f, Lisp_Object val)
798 {
799 f->param_alist = val;
800 }
801 INLINE void
802 fset_root_window (struct frame *f, Lisp_Object val)
803 {
804 f->root_window = val;
805 }
806 INLINE void
807 fset_scroll_bars (struct frame *f, Lisp_Object val)
808 {
809 f->scroll_bars = val;
810 }
811 INLINE void
812 fset_selected_window (struct frame *f, Lisp_Object val)
813 {
814 f->selected_window = val;
815 }
816 INLINE void
817 fset_old_selected_window (struct frame *f, Lisp_Object val)
818 {
819 f->old_selected_window = val;
820 }
821 INLINE void
822 fset_title (struct frame *f, Lisp_Object val)
823 {
824 f->title = val;
825 }
826 INLINE void
827 fset_tab_bar_items (struct frame *f, Lisp_Object val)
828 {
829 f->tab_bar_items = val;
830 }
831 #if defined (HAVE_WINDOW_SYSTEM)
832 INLINE void
833 fset_tab_bar_window (struct frame *f, Lisp_Object val)
834 {
835 f->tab_bar_window = val;
836 }
837 INLINE void
838 fset_current_tab_bar_string (struct frame *f, Lisp_Object val)
839 {
840 f->current_tab_bar_string = val;
841 }
842 INLINE void
843 fset_desired_tab_bar_string (struct frame *f, Lisp_Object val)
844 {
845 f->desired_tab_bar_string = val;
846 }
847 #endif
848 INLINE void
849 fset_tool_bar_items (struct frame *f, Lisp_Object val)
850 {
851 f->tool_bar_items = val;
852 }
853
854 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
855
856 INLINE void
857 fset_tool_bar_window (struct frame *f, Lisp_Object val)
858 {
859 f->tool_bar_window = val;
860 }
861 INLINE void
862 fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
863 {
864 f->current_tool_bar_string = val;
865 }
866 INLINE void
867 fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
868 {
869 f->desired_tool_bar_string = val;
870 }
871
872 #endif
873
874 INLINE void
875 fset_tool_bar_position (struct frame *f, Lisp_Object val)
876 {
877 f->tool_bar_position = val;
878 }
879
880 INLINE double
881 NUMVAL (Lisp_Object x)
882 {
883 return NUMBERP (x) ? XFLOATINT (x) : -1;
884 }
885
886 INLINE double
887 default_pixels_per_inch_x (void)
888 {
889 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
890 ? XCAR (Vdisplay_pixels_per_inch)
891 : Vdisplay_pixels_per_inch);
892 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
893 }
894
895 INLINE double
896 default_pixels_per_inch_y (void)
897 {
898 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
899 ? XCDR (Vdisplay_pixels_per_inch)
900 : Vdisplay_pixels_per_inch);
901 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
902 }
903
904 #define FRAME_KBOARD(f) ((f)->terminal->kboard)
905
906
907 #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
908
909 #define XFRAME(p) \
910 (eassert (FRAMEP (p)), XUNTAG (p, Lisp_Vectorlike, struct frame))
911 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
912
913
914 #define WINDOW_FRAME(w) ((w)->frame)
915
916
917 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
918 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
919 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
920 #ifndef HAVE_NTGUI
921 #define FRAME_W32_P(f) false
922 #else
923 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
924 #endif
925 #ifndef MSDOS
926 #define FRAME_MSDOS_P(f) false
927 #else
928 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
929 #endif
930 #ifndef HAVE_NS
931 #define FRAME_NS_P(f) false
932 #else
933 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
934 #endif
935 #ifndef HAVE_PGTK
936 #define FRAME_PGTK_P(f) false
937 #else
938 #define FRAME_PGTK_P(f) ((f)->output_method == output_pgtk)
939 #endif
940 #ifndef HAVE_HAIKU
941 #define FRAME_HAIKU_P(f) false
942 #else
943 #define FRAME_HAIKU_P(f) ((f)->output_method == output_haiku)
944 #endif
945 #ifndef HAVE_ANDROID
946 #define FRAME_ANDROID_P(f) false
947 #else
948 #define FRAME_ANDROID_P(f) ((f)->output_method == output_android)
949 #endif
950
951
952
953 #ifdef HAVE_X_WINDOWS
954 #define FRAME_WINDOW_P(f) FRAME_X_P (f)
955 #endif
956 #ifdef HAVE_NTGUI
957 #define FRAME_WINDOW_P(f) FRAME_W32_P (f)
958 #endif
959 #ifdef HAVE_NS
960 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
961 #endif
962 #ifdef HAVE_PGTK
963 #define FRAME_WINDOW_P(f) FRAME_PGTK_P(f)
964 #endif
965 #ifdef HAVE_HAIKU
966 #define FRAME_WINDOW_P(f) FRAME_HAIKU_P (f)
967 #endif
968 #ifdef HAVE_ANDROID
969 #define FRAME_WINDOW_P(f) FRAME_ANDROID_P (f)
970 #endif
971 #ifndef FRAME_WINDOW_P
972 #define FRAME_WINDOW_P(f) ((void) (f), false)
973 #endif
974
975
976
977 #ifdef HAVE_WINDOW_SYSTEM
978
979 #define FRAME_RES_X(f) \
980 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resx)
981 #define FRAME_RES_Y(f) \
982 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resy)
983
984 #ifdef HAVE_ANDROID
985
986
987
988
989 #define FRAME_RES(f) \
990 (eassert (FRAME_WINDOW_P (f)), \
991 FRAME_DISPLAY_INFO (f)->font_resolution)
992
993 #else
994 #define FRAME_RES(f) (FRAME_RES_Y (f))
995 #endif
996
997 #else
998
999
1000
1001 #define FRAME_RES_X(f) default_pixels_per_inch_x ()
1002 #define FRAME_RES_Y(f) default_pixels_per_inch_y ()
1003 #define FRAME_RES(f) default_pixels_per_inch_y ()
1004
1005 #endif
1006
1007
1008
1009
1010
1011 #ifdef HAVE_WINDOW_SYSTEM
1012 #ifndef HAVE_ANDROID
1013 # define MOUSE_HL_INFO(F) \
1014 (FRAME_WINDOW_P (F) \
1015 ? &FRAME_DISPLAY_INFO(F)->mouse_highlight \
1016 : &(F)->output_data.tty->display_info->mouse_highlight)
1017 #else
1018
1019 # define MOUSE_HL_INFO(F) \
1020 (&FRAME_DISPLAY_INFO(F)->mouse_highlight)
1021 #endif
1022 #else
1023 # define MOUSE_HL_INFO(F) \
1024 (&(F)->output_data.tty->display_info->mouse_highlight)
1025 #endif
1026
1027
1028 #define FRAME_LIVE_P(f) ((f)->terminal != 0)
1029
1030
1031 #define FRAME_MINIBUF_ONLY_P(f) \
1032 EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
1033
1034
1035
1036 #define FRAME_HAS_MINIBUF_P(f) \
1037 (WINDOWP (f->minibuffer_window) \
1038 && XFRAME (XWINDOW (f->minibuffer_window)->frame) == f)
1039
1040
1041 #if defined HAVE_NS
1042 # define FRAME_SCALE_FACTOR(f) (FRAME_NS_P (f) ? ns_frame_scale_factor (f) : 1)
1043 #elif defined HAVE_PGTK
1044 # define FRAME_SCALE_FACTOR(f) (FRAME_PGTK_P (f) ? pgtk_frame_scale_factor (f) : 1)
1045 #else
1046 # define FRAME_SCALE_FACTOR(f) 1
1047 #endif
1048
1049
1050
1051 #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width)
1052 #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height)
1053 #define FRAME_TOTAL_COLS(f) ((f)->total_cols)
1054 #define FRAME_TOTAL_LINES(f) ((f)->total_lines)
1055
1056
1057
1058 #define FRAME_TEXT_WIDTH(f) (f)->text_width
1059 #define FRAME_TEXT_HEIGHT(f) (f)->text_height
1060 #define FRAME_COLS(f) ((f)->text_cols)
1061 #define FRAME_LINES(f) ((f)->text_lines)
1062
1063
1064 #ifdef HAVE_EXT_MENU_BAR
1065 #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
1066 #else
1067 #define FRAME_EXTERNAL_MENU_BAR(f) false
1068 #endif
1069
1070
1071 #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
1072 #define FRAME_MENU_BAR_HEIGHT(f) (f)->menu_bar_height
1073
1074
1075 #define FRAME_TAB_BAR_LINES(f) (f)->tab_bar_lines
1076 #define FRAME_TAB_BAR_HEIGHT(f) (f)->tab_bar_height
1077
1078
1079 #ifdef HAVE_EXT_TOOL_BAR
1080 #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
1081 #else
1082 #define FRAME_EXTERNAL_TOOL_BAR(f) false
1083 #endif
1084
1085
1086
1087
1088
1089 #define FRAME_TOOL_BAR_POSITION(f) (f)->tool_bar_position
1090
1091
1092 #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
1093 #define FRAME_TOOL_BAR_HEIGHT(f) (f)->tool_bar_height
1094
1095
1096
1097
1098 #define FRAME_TOOL_BAR_TOP_HEIGHT(f) \
1099 ((BASE_EQ ((f)->tool_bar_position, Qtop)) \
1100 ? (f)->tool_bar_height : 0)
1101
1102 #define FRAME_TOOL_BAR_TOP_LINES(f) \
1103 ((BASE_EQ ((f)->tool_bar_position, Qtop)) \
1104 ? (f)->tool_bar_lines : 0)
1105
1106
1107
1108 #define FRAME_TOOL_BAR_BOTTOM_HEIGHT(f) \
1109 ((BASE_EQ ((f)->tool_bar_position, Qbottom)) \
1110 ? (f)->tool_bar_height : 0)
1111
1112 #define FRAME_TOOL_BAR_BOTTOM_LINES(f) \
1113 ((BASE_EQ ((f)->tool_bar_position, Qbottom)) \
1114 ? (f)->tool_bar_lines : 0)
1115
1116
1117 #define FRAME_TOP_MARGIN(F) \
1118 (FRAME_MENU_BAR_LINES (F) \
1119 + FRAME_TAB_BAR_LINES (F) \
1120 + FRAME_TOOL_BAR_TOP_LINES (F))
1121
1122
1123
1124 #define FRAME_TOP_MARGIN_HEIGHT(F) \
1125 (FRAME_MENU_BAR_HEIGHT (F) \
1126 + FRAME_TAB_BAR_HEIGHT (F) \
1127 + FRAME_TOOL_BAR_TOP_HEIGHT (F))
1128
1129
1130
1131 #define FRAME_BOTTOM_MARGIN(f) \
1132 (FRAME_TOOL_BAR_BOTTOM_LINES (f))
1133
1134
1135
1136 #define FRAME_BOTTOM_MARGIN_HEIGHT(f) \
1137 (FRAME_TOOL_BAR_BOTTOM_HEIGHT (f))
1138
1139
1140
1141 #define FRAME_MARGINS(F) \
1142 (FRAME_MENU_BAR_LINES (F) \
1143 + FRAME_TAB_BAR_LINES (F) \
1144 + FRAME_TOOL_BAR_LINES (F))
1145
1146 #define FRAME_MARGIN_HEIGHT(F) \
1147 (FRAME_MENU_BAR_HEIGHT (F) \
1148 + FRAME_TAB_BAR_HEIGHT (F) \
1149 + FRAME_TOOL_BAR_HEIGHT (F))
1150
1151
1152 #define FRAME_VISIBLE_P(f) (f)->visible
1153
1154
1155
1156
1157
1158
1159
1160 #ifndef HAVE_X_WINDOWS
1161 #define FRAME_REDISPLAY_P(f) (FRAME_VISIBLE_P (f))
1162 #else
1163 #define FRAME_REDISPLAY_P(f) (FRAME_VISIBLE_P (f) \
1164 || (FRAME_X_P (f) \
1165 && FRAME_X_VISIBLE (f)))
1166 #endif
1167
1168
1169 #define FRAME_OBSCURED_P(f) ((f)->visible > 1)
1170
1171
1172 #define FRAME_ICONIFIED_P(f) (f)->iconified
1173
1174
1175 #define SET_FRAME_GARBAGED(f) \
1176 (frame_garbaged = true, fset_redisplay (f), f->garbaged = true)
1177
1178
1179 #define FRAME_GARBAGED_P(f) (f)->garbaged
1180
1181
1182 #define FRAME_NO_SPLIT_P(f) (f)->no_split
1183
1184
1185 #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
1186
1187
1188
1189 #define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
1190
1191
1192
1193 #define FRAME_WINDOW_CHANGE(f) (f)->window_change
1194
1195
1196
1197 #define FRAME_WINDOW_STATE_CHANGE(f) (f)->window_state_change
1198
1199
1200 #define FRAME_MINIBUF_WINDOW(f) f->minibuffer_window
1201
1202
1203 #define FRAME_ROOT_WINDOW(f) f->root_window
1204
1205
1206 #define FRAME_SELECTED_WINDOW(f) f->selected_window
1207
1208 #define FRAME_OLD_SELECTED_WINDOW(f) f->old_selected_window
1209
1210 #define FRAME_INSERT_COST(f) (f)->insert_line_cost
1211 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
1212 #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
1213 #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
1214 #define FRAME_FOCUS_FRAME(f) f->focus_frame
1215
1216 #ifdef HAVE_WINDOW_SYSTEM
1217
1218
1219 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
1220 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
1221 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
1222 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
1223 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
1224 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
1225 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
1226 #else
1227
1228 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) \
1229 ((void) (f), vertical_scroll_bar_none)
1230 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) (f), 0)
1231 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) (f), 0)
1232 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) (f), 0)
1233 #endif
1234
1235 #if defined (HAVE_WINDOW_SYSTEM)
1236 #define FRAME_UNDECORATED(f) ((f)->undecorated)
1237 #ifdef HAVE_NTGUI
1238 #define FRAME_OVERRIDE_REDIRECT(f) ((void) (f), 0)
1239 #else
1240 #define FRAME_OVERRIDE_REDIRECT(f) ((f)->override_redirect)
1241 #endif
1242 #define FRAME_PARENT_FRAME(f) \
1243 (NILP ((f)->parent_frame) \
1244 ? NULL \
1245 : XFRAME ((f)->parent_frame))
1246 #define FRAME_SKIP_TASKBAR(f) ((f)->skip_taskbar)
1247 #define FRAME_NO_FOCUS_ON_MAP(f) ((f)->no_focus_on_map)
1248 #define FRAME_NO_ACCEPT_FOCUS(f) ((f)->no_accept_focus)
1249 #define FRAME_NO_SPECIAL_GLYPHS(f) ((f)->no_special_glyphs)
1250 #define FRAME_Z_GROUP(f) ((f)->z_group)
1251 #define FRAME_Z_GROUP_NONE(f) ((f)->z_group == z_group_none)
1252 #define FRAME_Z_GROUP_ABOVE(f) ((f)->z_group == z_group_above)
1253 #define FRAME_Z_GROUP_ABOVE_SUSPENDED(f) \
1254 ((f)->z_group == z_group_above_suspended)
1255 #define FRAME_Z_GROUP_BELOW(f) ((f)->z_group == z_group_below)
1256 #define FRAME_TOOLTIP_P(f) ((f)->tooltip)
1257 #ifdef NS_IMPL_COCOA
1258 #define FRAME_NS_APPEARANCE(f) ((f)->ns_appearance)
1259 #define FRAME_NS_TRANSPARENT_TITLEBAR(f) ((f)->ns_transparent_titlebar)
1260 #endif
1261 #else
1262 #define FRAME_UNDECORATED(f) ((void) (f), 0)
1263 #define FRAME_OVERRIDE_REDIRECT(f) ((void) (f), 0)
1264 #define FRAME_PARENT_FRAME(f) ((void) (f), NULL)
1265 #define FRAME_SKIP_TASKBAR(f) ((void) (f), 0)
1266 #define FRAME_NO_FOCUS_ON_MAP(f) ((void) (f), 0)
1267 #define FRAME_NO_ACCEPT_FOCUS(f) ((void) (f), 0)
1268 #define FRAME_NO_SPECIAL_GLYPHS(f) ((void) (f), 0)
1269 #define FRAME_Z_GROUP(f) ((void) (f), z_group_none)
1270 #define FRAME_Z_GROUP_NONE(f) ((void) (f), true)
1271 #define FRAME_Z_GROUP_ABOVE(f) ((void) (f), false)
1272 #define FRAME_Z_GROUP_BELOW(f) ((void) (f), false)
1273 #define FRAME_TOOLTIP_P(f) ((void) f, false)
1274 #endif
1275
1276
1277 #if USE_HORIZONTAL_SCROLL_BARS
1278 #define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
1279 ((f)->horizontal_scroll_bars)
1280 #else
1281 #define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) ((void) (f), 0)
1282 #endif
1283
1284
1285
1286
1287 #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
1288
1289
1290
1291
1292 #define FRAME_CONFIG_SCROLL_BAR_HEIGHT(f) ((f)->config_scroll_bar_height)
1293
1294
1295
1296
1297 #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
1298
1299
1300
1301
1302 #define FRAME_CONFIG_SCROLL_BAR_LINES(f) ((f)->config_scroll_bar_lines)
1303
1304
1305 #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \
1306 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
1307 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
1308 : 0)
1309
1310
1311 #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \
1312 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
1313 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
1314 : 0)
1315
1316
1317
1318
1319
1320 #define FRAME_LEFT_SCROLL_BAR_COLS(f) \
1321 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
1322 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
1323 : 0)
1324
1325
1326
1327
1328
1329 #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \
1330 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
1331 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
1332 : 0)
1333
1334
1335
1336 #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \
1337 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
1338 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
1339 : 0)
1340
1341
1342
1343 #define FRAME_SCROLL_BAR_AREA_HEIGHT(f) \
1344 (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \
1345 ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \
1346 : 0)
1347
1348
1349 #define FRAME_SCROLL_BAR_COLS(f) \
1350 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
1351 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
1352 : 0)
1353
1354
1355 #define FRAME_SCROLL_BAR_LINES(f) \
1356 (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \
1357 ? FRAME_CONFIG_SCROLL_BAR_LINES (f) \
1358 : 0)
1359
1360
1361 #define FRAME_CURSOR_X_LIMIT(f) \
1362 (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
1363
1364
1365 #define FRAME_SCROLL_BARS(f) (f->scroll_bars)
1366 #define FRAME_CONDEMNED_SCROLL_BARS(f) (f->condemned_scroll_bars)
1367
1368 #define FRAME_MENU_BAR_ITEMS(f) (f->menu_bar_items)
1369 #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
1370
1371 #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor)
1372 #define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor)
1373 #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width)
1374 #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width)
1375
1376 #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
1377 #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
1378
1379
1380 #define FRAME_FACE_CACHE(F) (F)->face_cache
1381
1382
1383
1384
1385
1386 #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
1387
1388 #define CHECK_FRAME(x) \
1389 CHECK_TYPE (FRAMEP (x), Qframep, x)
1390
1391 #define CHECK_LIVE_FRAME(x) \
1392 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405 #define FOR_EACH_FRAME(list_var, frame_var) \
1406 for ((list_var) = Vframe_list; \
1407 (CONSP (list_var) \
1408 && (frame_var = XCAR (list_var), true)); \
1409 list_var = XCDR (list_var))
1410
1411
1412 #define FRAME_MOUSE_UPDATE(frame) \
1413 do { \
1414 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
1415 if (frame == hlinfo->mouse_face_mouse_frame) \
1416 { \
1417 block_input (); \
1418 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
1419 hlinfo->mouse_face_mouse_x, \
1420 hlinfo->mouse_face_mouse_y); \
1421 unblock_input (); \
1422 } \
1423 } while (false)
1424
1425
1426 #define AUTO_FRAME_ARG(name, parameter, value) \
1427 AUTO_LIST1 (name, AUTO_CONS_EXPR (parameter, value))
1428
1429
1430 extern bool frame_garbaged;
1431
1432
1433
1434
1435
1436 INLINE void
1437 SET_FRAME_VISIBLE (struct frame *f, int v)
1438 {
1439 eassert (0 <= v && v <= 2);
1440 if (v)
1441 {
1442 if (v == 1 && f->visible != 1)
1443 redisplay_other_windows ();
1444 if (FRAME_GARBAGED_P (f))
1445 frame_garbaged = true;
1446 }
1447 f->visible = v;
1448 }
1449
1450
1451 INLINE void
1452 SET_FRAME_ICONIFIED (struct frame *f, int i)
1453 {
1454 #ifdef HAVE_WINDOW_SYSTEM
1455 Lisp_Object frame;
1456 #endif
1457
1458 eassert (0 <= (i) && (i) <= 1);
1459
1460 f->iconified = i;
1461
1462 #ifdef HAVE_WINDOW_SYSTEM
1463
1464
1465
1466
1467 XSETFRAME (frame, f);
1468
1469 if (FRAME_WINDOW_P (f))
1470 gui_consider_frame_title (frame);
1471 #endif
1472 }
1473
1474 extern Lisp_Object selected_frame;
1475 extern Lisp_Object old_selected_frame;
1476
1477 extern int frame_default_tab_bar_height;
1478
1479 #ifndef HAVE_EXT_TOOL_BAR
1480 extern int frame_default_tool_bar_height;
1481 #endif
1482
1483 #ifdef HAVE_WINDOW_SYSTEM
1484 # define WINDOW_SYSTEM_RETURN
1485 #else
1486 # define WINDOW_SYSTEM_RETURN _Noreturn ATTRIBUTE_COLD
1487 #endif
1488
1489 extern WINDOW_SYSTEM_RETURN struct frame *
1490 decode_window_system_frame (Lisp_Object);
1491 extern struct frame *decode_live_frame (Lisp_Object);
1492 extern struct frame *decode_any_frame (Lisp_Object);
1493 extern struct frame *make_initial_frame (void);
1494 extern struct frame *make_frame (bool);
1495 #ifdef HAVE_WINDOW_SYSTEM
1496 extern struct frame *make_minibuffer_frame (void);
1497 extern struct frame *make_frame_without_minibuffer (Lisp_Object,
1498 struct kboard *,
1499 Lisp_Object);
1500 extern bool display_available (void);
1501 #endif
1502
1503 INLINE bool
1504 window_system_available (struct frame *f)
1505 {
1506 #ifdef HAVE_WINDOW_SYSTEM
1507 return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : display_available ();
1508 #else
1509 return false;
1510 #endif
1511 }
1512
1513 extern WINDOW_SYSTEM_RETURN void check_window_system (struct frame *);
1514 extern void frame_make_pointer_invisible (struct frame *);
1515 extern void frame_make_pointer_visible (struct frame *);
1516 extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
1517 extern bool frame_inhibit_resize (struct frame *, bool, Lisp_Object);
1518 extern void adjust_frame_size (struct frame *, int, int, int, bool,
1519 Lisp_Object);
1520 extern Lisp_Object mouse_position (bool);
1521 extern void frame_size_history_plain (struct frame *, Lisp_Object);
1522 extern void frame_size_history_extra (struct frame *, Lisp_Object,
1523 int, int, int, int, int, int);
1524 extern Lisp_Object Vframe_list;
1525
1526
1527
1528
1529 #define SELECTED_FRAME() \
1530 ((FRAMEP (selected_frame) \
1531 && FRAME_LIVE_P (XFRAME (selected_frame))) \
1532 ? XFRAME (selected_frame) \
1533 : (emacs_abort (), (struct frame *) 0))
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543 #define FRAME_LINE_HEIGHT(F) ((F)->line_height)
1544
1545
1546
1547 #define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
1548
1549
1550
1551 INLINE int
1552 frame_dimension (int x)
1553 {
1554 #ifdef HAVE_WINDOW_SYSTEM
1555 return x;
1556 #else
1557 return 0;
1558 #endif
1559 }
1560
1561
1562
1563
1564
1565
1566 INLINE int
1567 FRAME_FRINGE_COLS (struct frame *f)
1568 {
1569 return frame_dimension (f->fringe_cols);
1570 }
1571
1572
1573
1574 INLINE int
1575 FRAME_LEFT_FRINGE_WIDTH (struct frame *f)
1576 {
1577 return frame_dimension (f->left_fringe_width);
1578 }
1579 INLINE int
1580 FRAME_RIGHT_FRINGE_WIDTH (struct frame *f)
1581 {
1582 return frame_dimension (f->right_fringe_width);
1583 }
1584
1585
1586
1587 INLINE int
1588 FRAME_TOTAL_FRINGE_WIDTH (struct frame *f)
1589 {
1590 return FRAME_LEFT_FRINGE_WIDTH (f) + FRAME_RIGHT_FRINGE_WIDTH (f);
1591 }
1592
1593 INLINE int
1594 FRAME_CHILD_FRAME_BORDER_WIDTH (struct frame *f)
1595 {
1596 return frame_dimension (f->child_frame_border_width);
1597 }
1598
1599
1600
1601
1602 INLINE int
1603 FRAME_INTERNAL_BORDER_WIDTH (struct frame *f)
1604 {
1605 #ifdef HAVE_WINDOW_SYSTEM
1606 return (FRAME_PARENT_FRAME(f)
1607 ? (FRAME_CHILD_FRAME_BORDER_WIDTH(f) >= 0
1608 ? FRAME_CHILD_FRAME_BORDER_WIDTH(f)
1609 : frame_dimension (f->internal_border_width))
1610 : frame_dimension (f->internal_border_width));
1611 #else
1612 return frame_dimension (f->internal_border_width);
1613 #endif
1614 }
1615
1616
1617 INLINE int
1618 FRAME_RIGHT_DIVIDER_WIDTH (struct frame *f)
1619 {
1620 return frame_dimension (f->right_divider_width);
1621 }
1622
1623 INLINE int
1624 FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
1625 {
1626 return frame_dimension (f->bottom_divider_width);
1627 }
1628
1629
1630
1631 INLINE struct face *
1632 FACE_FROM_ID (struct frame *f, int id)
1633 {
1634 eassert (0 <= id && id < FRAME_FACE_CACHE (f)->used);
1635 return FRAME_FACE_CACHE (f)->faces_by_id[id];
1636 }
1637
1638
1639
1640
1641 INLINE struct face *
1642 FACE_FROM_ID_OR_NULL (struct frame *f, int id)
1643 {
1644 int used = FRAME_FACE_CACHE (f)->used;
1645 eassume (0 <= used);
1646 return 0 <= id && id < used ? FRAME_FACE_CACHE (f)->faces_by_id[id] : NULL;
1647 }
1648
1649 #ifdef HAVE_WINDOW_SYSTEM
1650
1651
1652
1653 INLINE struct image *
1654 IMAGE_FROM_ID (struct frame *f, int id)
1655 {
1656 eassert (0 <= id && id < FRAME_IMAGE_CACHE (f)->used);
1657 return FRAME_IMAGE_CACHE (f)->images[id];
1658 }
1659
1660
1661
1662
1663 INLINE struct image *
1664 IMAGE_OPT_FROM_ID (struct frame *f, int id)
1665 {
1666 int used = FRAME_IMAGE_CACHE (f)->used;
1667 eassume (0 <= used);
1668 return 0 <= id && id < used ? FRAME_IMAGE_CACHE (f)->images[id] : NULL;
1669 }
1670 #endif
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683 #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
1684 ((int) (XFLOATINT (X) * FRAME_COLUMN_WIDTH (F)))
1685
1686
1687
1688
1689 #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
1690 ((int) (XFLOATINT (Y) * FRAME_LINE_HEIGHT (F)))
1691
1692
1693
1694
1695
1696 #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \
1697 ((X) % FRAME_COLUMN_WIDTH (F) != 0 \
1698 ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \
1699 : make_fixnum ((X) / FRAME_COLUMN_WIDTH (F)))
1700
1701
1702
1703
1704
1705 #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \
1706 ((Y) % FRAME_LINE_HEIGHT (F) \
1707 ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \
1708 : make_fixnum ((Y) / FRAME_LINE_HEIGHT (F)))
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718 #define FRAME_LINE_TO_PIXEL_Y(f, row) \
1719 (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
1720 + (row) * FRAME_LINE_HEIGHT (f))
1721
1722 #define FRAME_COL_TO_PIXEL_X(f, col) \
1723 (FRAME_INTERNAL_BORDER_WIDTH (f) \
1724 + (col) * FRAME_COLUMN_WIDTH (f))
1725
1726
1727
1728 #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \
1729 ((cols) * FRAME_COLUMN_WIDTH (f) \
1730 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1731 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1732 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1733
1734 #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \
1735 ((lines) * FRAME_LINE_HEIGHT (f) \
1736 + FRAME_TOP_MARGIN_HEIGHT (f) \
1737 + FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1738 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1739
1740
1741
1742 #define FRAME_PIXEL_Y_TO_LINE(f, y) \
1743 (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
1744 ? (y) \
1745 : ((y) < (FRAME_TOP_MARGIN_HEIGHT (f) \
1746 + FRAME_INTERNAL_BORDER_WIDTH (f)) \
1747 ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) \
1748 + FRAME_INTERNAL_BORDER_WIDTH (f) \
1749 \
1750 + FRAME_LINE_HEIGHT (f) - 1) \
1751 : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
1752 / FRAME_LINE_HEIGHT (f))
1753
1754 #define FRAME_PIXEL_X_TO_COL(f, x) \
1755 (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \
1756 / FRAME_COLUMN_WIDTH (f))
1757
1758
1759
1760 #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \
1761 (((width) \
1762 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1763 - FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1764 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) \
1765 / FRAME_COLUMN_WIDTH (f))
1766
1767 #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \
1768 (((height) \
1769 - FRAME_MARGIN_HEIGHT (f) \
1770 - FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1771 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) \
1772 / FRAME_LINE_HEIGHT (f))
1773
1774
1775
1776 #define FRAME_TEXT_TO_PIXEL_WIDTH(f, width) \
1777 ((width) \
1778 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1779 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1780 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1781
1782 #define FRAME_TEXT_TO_PIXEL_HEIGHT(f, height) \
1783 ((height) \
1784 + FRAME_MARGIN_HEIGHT (f) \
1785 + FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1786 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1787
1788
1789
1790 #define FRAME_PIXEL_TO_TEXT_WIDTH(f, width) \
1791 ((width) \
1792 - FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1793 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1794 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1795
1796 #define FRAME_PIXEL_TO_TEXT_HEIGHT(f, height) \
1797 ((height) \
1798 - FRAME_MARGIN_HEIGHT (f) \
1799 - FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1800 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1801
1802 #define FRAME_INNER_WIDTH(f) \
1803 (FRAME_PIXEL_WIDTH (f) \
1804 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1805
1806 #define FRAME_INNER_HEIGHT(f) \
1807 (FRAME_PIXEL_HEIGHT (f) \
1808 - FRAME_MARGIN_HEIGHT (f) \
1809 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1810
1811
1812 #define FRAME_SMALLEST_CHAR_WIDTH(f) \
1813 FRAME_DISPLAY_INFO (f)->smallest_char_width
1814
1815
1816 #define FRAME_SMALLEST_FONT_HEIGHT(f) \
1817 FRAME_DISPLAY_INFO (f)->smallest_font_height
1818
1819
1820
1821
1822
1823 #ifdef HAVE_WINDOW_SYSTEM
1824
1825
1826 #define EMACS_CLASS "Emacs"
1827
1828 extern void gui_set_frame_parameters_1 (struct frame *, Lisp_Object, bool);
1829 extern void gui_set_frame_parameters (struct frame *, Lisp_Object);
1830 extern void gui_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object);
1831 extern void gui_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object);
1832 extern void gui_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object);
1833 extern void gui_set_font (struct frame *, Lisp_Object, Lisp_Object);
1834 extern void gui_set_font_backend (struct frame *, Lisp_Object, Lisp_Object);
1835 extern void gui_set_left_fringe (struct frame *, Lisp_Object, Lisp_Object);
1836 extern void gui_set_right_fringe (struct frame *, Lisp_Object, Lisp_Object);
1837 extern void gui_set_border_width (struct frame *, Lisp_Object, Lisp_Object);
1838 extern void gui_set_right_divider_width (struct frame *, Lisp_Object,
1839 Lisp_Object);
1840 extern void gui_set_bottom_divider_width (struct frame *, Lisp_Object,
1841 Lisp_Object);
1842 extern void gui_set_visibility (struct frame *, Lisp_Object, Lisp_Object);
1843 extern void gui_set_autoraise (struct frame *, Lisp_Object, Lisp_Object);
1844 extern void gui_set_autolower (struct frame *, Lisp_Object, Lisp_Object);
1845 extern void gui_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object);
1846 extern void gui_set_vertical_scroll_bars (struct frame *, Lisp_Object, Lisp_Object);
1847 extern void gui_set_horizontal_scroll_bars (struct frame *, Lisp_Object, Lisp_Object);
1848 extern void gui_set_scroll_bar_width (struct frame *, Lisp_Object, Lisp_Object);
1849 extern void gui_set_scroll_bar_height (struct frame *, Lisp_Object, Lisp_Object);
1850
1851 extern long gui_figure_window_size (struct frame *, Lisp_Object, bool, bool);
1852
1853 extern void gui_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
1854 extern void gui_set_alpha_background (struct frame *, Lisp_Object, Lisp_Object);
1855 extern void gui_set_no_special_glyphs (struct frame *, Lisp_Object, Lisp_Object);
1856
1857 extern void validate_x_resource_name (void);
1858
1859 extern Lisp_Object gui_display_get_resource (Display_Info *,
1860 Lisp_Object attribute,
1861 Lisp_Object class,
1862 Lisp_Object component,
1863 Lisp_Object subclass);
1864
1865 extern void set_frame_menubar (struct frame *f, bool deep_p);
1866 extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1867 extern void free_frame_menubar (struct frame *);
1868 extern bool frame_ancestor_p (struct frame *af, struct frame *df);
1869 extern enum internal_border_part frame_internal_border_part (struct frame *f, int x, int y);
1870
1871 #if defined HAVE_X_WINDOWS
1872 extern void x_wm_set_icon_position (struct frame *, int, int);
1873 #if !defined USE_X_TOOLKIT
1874 extern const char *x_get_resource_string (const char *, const char *);
1875 #endif
1876 #endif
1877
1878 #if !defined (HAVE_NS) && !defined (HAVE_PGTK)
1879
1880
1881
1882 INLINE void
1883 gui_set_bitmap_icon (struct frame *f)
1884 {
1885 Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist);
1886
1887 if (CONSP (obj) && !NILP (XCDR (obj))
1888 && FRAME_TERMINAL (f)->set_bitmap_icon_hook)
1889 FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj));
1890 }
1891
1892 #endif
1893 #endif
1894
1895 INLINE void
1896 flush_frame (struct frame *f)
1897 {
1898 struct redisplay_interface *rif = FRAME_RIF (f);
1899
1900 if (rif && rif->flush_display)
1901 rif->flush_display (f);
1902 }
1903
1904
1905
1906
1907
1908 #ifdef HAVE_WINDOW_SYSTEM
1909
1910 struct MonitorInfo {
1911 Emacs_Rectangle geom, work;
1912 int mm_width, mm_height;
1913 char *name;
1914 #ifdef HAVE_PGTK
1915 double scale_factor;
1916 #endif
1917 };
1918
1919 extern void free_monitors (struct MonitorInfo *monitors, int n_monitors);
1920 extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors,
1921 int n_monitors,
1922 int primary_monitor,
1923 Lisp_Object monitor_frames,
1924 const char *source);
1925
1926 #endif
1927
1928
1929 INLINE_HEADER_END
1930
1931
1932
1933
1934 #if ! USE_HORIZONTAL_SCROLL_BARS && GNUC_PREREQ (4, 6, 0)
1935 # pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
1936 #endif
1937
1938 #endif