diff options
| author | Kim F. Storm | 2003-03-31 20:36:21 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2003-03-31 20:36:21 +0000 |
| commit | 7c0d3ed81fad98f402c73530334c589976ab8dd1 (patch) | |
| tree | 24bc4f4793ef5e2c7f0fcc103cede70fb3531f05 /src | |
| parent | b5bcda6db2215381c7d31d4bfbe06dde1f1ed9b8 (diff) | |
| download | emacs-7c0d3ed81fad98f402c73530334c589976ab8dd1.tar.gz emacs-7c0d3ed81fad98f402c73530334c589976ab8dd1.zip | |
The following changes consolidates the common code related to
frame-parameter handling from the xfns.c, w32fns.c, and macfns.c
files into frame.c.
* xfns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
parameters now defined in frame.h and frame.c.
(Vx_resource_name): Remove. Use generic var.
(enum x_frame_parms): Remove (bogus, unused enum).
(check_x_display_info): Make non-static (for frame.c).
(struct x_frame_parm_table, x_frame_parms): Remove.
(init_x_parm_symbols, x_set_frame_parameters, x_report_frame_params)
(x_set_line_spacing, x_set_screen_gamma, x_icon_type, x_set_font)
(x_set_border_width, x_set_internal_border_width, x_set_visibility)
(x_change_window_heights, x_set_autoraise, x_set_autolower)
(x_set_vertical_scroll_bars, x_set_scroll_bar_width)
(validate_x_resource_name, Fx_get_resource, x_get_resource_string)
(x_default_parameter, Fx_parse_geometry, x_figure_window_size):
Remove. Use generic functions instead.
(enum resource_types): Remove.
(x_set_scroll_bar_default_width): New global function (for frame.c).
(Fx_create_frame): Depend on x_figure_window_size to add space for
toolbar and setup size_hint_flags.
(x_frame_parm_handlers): New table for redisplay_interface.
(syms_of_xfns): Don't intern/staticpro removed vars.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 1680 |
1 files changed, 83 insertions, 1597 deletions
diff --git a/src/xfns.c b/src/xfns.c index 68002e458c5..3a4ac07a1d6 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -139,15 +139,6 @@ int gray_bitmap_width = gray_width; | |||
| 139 | int gray_bitmap_height = gray_height; | 139 | int gray_bitmap_height = gray_height; |
| 140 | char *gray_bitmap_bits = gray_bits; | 140 | char *gray_bitmap_bits = gray_bits; |
| 141 | 141 | ||
| 142 | /* The name we're using in resource queries. Most often "emacs". */ | ||
| 143 | |||
| 144 | Lisp_Object Vx_resource_name; | ||
| 145 | |||
| 146 | /* The application class we're using in resource queries. | ||
| 147 | Normally "Emacs". */ | ||
| 148 | |||
| 149 | Lisp_Object Vx_resource_class; | ||
| 150 | |||
| 151 | /* Non-zero means we're allowed to display an hourglass cursor. */ | 142 | /* Non-zero means we're allowed to display an hourglass cursor. */ |
| 152 | 143 | ||
| 153 | int display_hourglass_p; | 144 | int display_hourglass_p; |
| @@ -187,55 +178,17 @@ Lisp_Object Vx_bitmap_file_path; | |||
| 187 | 178 | ||
| 188 | Lisp_Object Vx_pixel_size_width_font_regexp; | 179 | Lisp_Object Vx_pixel_size_width_font_regexp; |
| 189 | 180 | ||
| 190 | Lisp_Object Qauto_raise; | ||
| 191 | Lisp_Object Qauto_lower; | ||
| 192 | Lisp_Object Qborder_color; | ||
| 193 | Lisp_Object Qborder_width; | ||
| 194 | extern Lisp_Object Qbox; | ||
| 195 | Lisp_Object Qcursor_color; | ||
| 196 | Lisp_Object Qcursor_type; | ||
| 197 | Lisp_Object Qgeometry; | ||
| 198 | Lisp_Object Qicon_left; | ||
| 199 | Lisp_Object Qicon_top; | ||
| 200 | Lisp_Object Qicon_type; | ||
| 201 | Lisp_Object Qicon_name; | ||
| 202 | Lisp_Object Qinternal_border_width; | ||
| 203 | Lisp_Object Qleft; | ||
| 204 | Lisp_Object Qright; | ||
| 205 | Lisp_Object Qmouse_color; | ||
| 206 | Lisp_Object Qnone; | 181 | Lisp_Object Qnone; |
| 207 | Lisp_Object Qouter_window_id; | ||
| 208 | Lisp_Object Qparent_id; | ||
| 209 | Lisp_Object Qscroll_bar_width; | ||
| 210 | Lisp_Object Qsuppress_icon; | 182 | Lisp_Object Qsuppress_icon; |
| 211 | extern Lisp_Object Qtop; | ||
| 212 | Lisp_Object Qundefined_color; | 183 | Lisp_Object Qundefined_color; |
| 213 | Lisp_Object Qvertical_scroll_bars; | 184 | Lisp_Object Qcenter; |
| 214 | Lisp_Object Qvisibility; | ||
| 215 | Lisp_Object Qwindow_id; | ||
| 216 | Lisp_Object Qx_frame_parameter; | ||
| 217 | Lisp_Object Qx_resource_name; | ||
| 218 | Lisp_Object Quser_position; | ||
| 219 | Lisp_Object Quser_size; | ||
| 220 | extern Lisp_Object Qdisplay; | ||
| 221 | Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; | ||
| 222 | Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter; | ||
| 223 | Lisp_Object Qcompound_text, Qcancel_timer; | 185 | Lisp_Object Qcompound_text, Qcancel_timer; |
| 224 | Lisp_Object Qwait_for_wm; | ||
| 225 | Lisp_Object Qfullscreen; | ||
| 226 | Lisp_Object Qfullwidth; | ||
| 227 | Lisp_Object Qfullheight; | ||
| 228 | Lisp_Object Qfullboth; | ||
| 229 | |||
| 230 | /* The below are defined in frame.c. */ | ||
| 231 | 186 | ||
| 232 | extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; | 187 | /* In dispnew.c */ |
| 233 | extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; | ||
| 234 | extern Lisp_Object Qtool_bar_lines; | ||
| 235 | 188 | ||
| 236 | extern Lisp_Object Vwindow_system_version; | 189 | extern Lisp_Object Vwindow_system_version; |
| 237 | 190 | ||
| 238 | Lisp_Object Qface_set_after_frame_default; | 191 | /* The below are defined in frame.c. */ |
| 239 | 192 | ||
| 240 | #if GLYPH_DEBUG | 193 | #if GLYPH_DEBUG |
| 241 | int image_cache_refcount, dpyinfo_refcount; | 194 | int image_cache_refcount, dpyinfo_refcount; |
| @@ -283,7 +236,7 @@ check_x_frame (frame) | |||
| 283 | nil stands for the selected frame--or, if that is not an X frame, | 236 | nil stands for the selected frame--or, if that is not an X frame, |
| 284 | the first X display on the list. */ | 237 | the first X display on the list. */ |
| 285 | 238 | ||
| 286 | static struct x_display_info * | 239 | struct x_display_info * |
| 287 | check_x_display_info (frame) | 240 | check_x_display_info (frame) |
| 288 | Lisp_Object frame; | 241 | Lisp_Object frame; |
| 289 | { | 242 | { |
| @@ -655,6 +608,8 @@ x_create_bitmap_from_data (f, bits, width, height) | |||
| 655 | bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 608 | bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 656 | bits, width, height); | 609 | bits, width, height); |
| 657 | 610 | ||
| 611 | |||
| 612 | |||
| 658 | if (! bitmap) | 613 | if (! bitmap) |
| 659 | return -1; | 614 | return -1; |
| 660 | 615 | ||
| @@ -765,27 +720,13 @@ x_destroy_all_bitmaps (dpyinfo) | |||
| 765 | dpyinfo->bitmaps_last = 0; | 720 | dpyinfo->bitmaps_last = 0; |
| 766 | } | 721 | } |
| 767 | 722 | ||
| 768 | /* Connect the frame-parameter names for X frames | ||
| 769 | to the ways of passing the parameter values to the window system. | ||
| 770 | |||
| 771 | The name of a parameter, as a Lisp symbol, | ||
| 772 | has an `x-frame-parameter' property which is an integer in Lisp | ||
| 773 | that is an index in this table. */ | ||
| 774 | |||
| 775 | struct x_frame_parm_table | ||
| 776 | { | ||
| 777 | char *name; | ||
| 778 | void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 779 | }; | ||
| 780 | 723 | ||
| 781 | static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); | 724 | static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
| 782 | static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); | 725 | static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
| 783 | static void x_change_window_heights P_ ((Lisp_Object, int)); | ||
| 784 | static void x_disable_image P_ ((struct frame *, struct image *)); | 726 | static void x_disable_image P_ ((struct frame *, struct image *)); |
| 727 | |||
| 785 | void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 728 | void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 786 | static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 787 | static void x_set_wait_for_wm P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 729 | static void x_set_wait_for_wm P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 788 | static void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 789 | void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 730 | void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 790 | void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 731 | void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 791 | void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 732 | void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| @@ -793,21 +734,9 @@ void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |||
| 793 | void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 734 | void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 794 | void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 735 | void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 795 | void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 736 | void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 796 | static void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 797 | void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 798 | void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 799 | void x_set_internal_border_width P_ ((struct frame *, Lisp_Object, | ||
| 800 | Lisp_Object)); | ||
| 801 | void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 737 | void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 802 | void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 803 | void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 804 | void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object, | ||
| 805 | Lisp_Object)); | ||
| 806 | void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 807 | void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 738 | void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 808 | void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 809 | void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 739 | void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 810 | void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 811 | void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 740 | void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 812 | void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object, | 741 | void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object, |
| 813 | Lisp_Object)); | 742 | Lisp_Object)); |
| @@ -818,7 +747,6 @@ static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *, | |||
| 818 | Lisp_Object, | 747 | Lisp_Object, |
| 819 | char *, char *, | 748 | char *, char *, |
| 820 | int)); | 749 | int)); |
| 821 | static void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object)); | ||
| 822 | static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, | 750 | static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, |
| 823 | Lisp_Object)); | 751 | Lisp_Object)); |
| 824 | static void init_color_table P_ ((void)); | 752 | static void init_color_table P_ ((void)); |
| @@ -829,369 +757,8 @@ static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p)); | |||
| 829 | 757 | ||
| 830 | 758 | ||
| 831 | 759 | ||
| 832 | static struct x_frame_parm_table x_frame_parms[] = | ||
| 833 | { | ||
| 834 | {"auto-raise", x_set_autoraise}, | ||
| 835 | {"auto-lower", x_set_autolower}, | ||
| 836 | {"background-color", x_set_background_color}, | ||
| 837 | {"border-color", x_set_border_color}, | ||
| 838 | {"border-width", x_set_border_width}, | ||
| 839 | {"cursor-color", x_set_cursor_color}, | ||
| 840 | {"cursor-type", x_set_cursor_type}, | ||
| 841 | {"font", x_set_font}, | ||
| 842 | {"foreground-color", x_set_foreground_color}, | ||
| 843 | {"icon-name", x_set_icon_name}, | ||
| 844 | {"icon-type", x_set_icon_type}, | ||
| 845 | {"internal-border-width", x_set_internal_border_width}, | ||
| 846 | {"menu-bar-lines", x_set_menu_bar_lines}, | ||
| 847 | {"mouse-color", x_set_mouse_color}, | ||
| 848 | {"name", x_explicitly_set_name}, | ||
| 849 | {"scroll-bar-width", x_set_scroll_bar_width}, | ||
| 850 | {"title", x_set_title}, | ||
| 851 | {"unsplittable", x_set_unsplittable}, | ||
| 852 | {"vertical-scroll-bars", x_set_vertical_scroll_bars}, | ||
| 853 | {"visibility", x_set_visibility}, | ||
| 854 | {"tool-bar-lines", x_set_tool_bar_lines}, | ||
| 855 | {"scroll-bar-foreground", x_set_scroll_bar_foreground}, | ||
| 856 | {"scroll-bar-background", x_set_scroll_bar_background}, | ||
| 857 | {"screen-gamma", x_set_screen_gamma}, | ||
| 858 | {"line-spacing", x_set_line_spacing}, | ||
| 859 | {"left-fringe", x_set_fringe_width}, | ||
| 860 | {"right-fringe", x_set_fringe_width}, | ||
| 861 | {"wait-for-wm", x_set_wait_for_wm}, | ||
| 862 | {"fullscreen", x_set_fullscreen}, | ||
| 863 | |||
| 864 | }; | ||
| 865 | |||
| 866 | /* Attach the `x-frame-parameter' properties to | ||
| 867 | the Lisp symbol names of parameters relevant to X. */ | ||
| 868 | |||
| 869 | void | ||
| 870 | init_x_parm_symbols () | ||
| 871 | { | ||
| 872 | int i; | ||
| 873 | |||
| 874 | for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) | ||
| 875 | Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | ||
| 876 | make_number (i)); | ||
| 877 | } | ||
| 878 | 760 | ||
| 879 | 761 | ||
| 880 | /* Really try to move where we want to be in case of fullscreen. Some WMs | ||
| 881 | moves the window where we tell them. Some (mwm, twm) moves the outer | ||
| 882 | window manager window there instead. | ||
| 883 | Try to compensate for those WM here. */ | ||
| 884 | static void | ||
| 885 | x_fullscreen_move (f, new_top, new_left) | ||
| 886 | struct frame *f; | ||
| 887 | int new_top; | ||
| 888 | int new_left; | ||
| 889 | { | ||
| 890 | if (new_top != f->output_data.x->top_pos | ||
| 891 | || new_left != f->output_data.x->left_pos) | ||
| 892 | { | ||
| 893 | int move_x = new_left + f->output_data.x->x_pixels_outer_diff; | ||
| 894 | int move_y = new_top + f->output_data.x->y_pixels_outer_diff; | ||
| 895 | |||
| 896 | f->output_data.x->want_fullscreen |= FULLSCREEN_MOVE_WAIT; | ||
| 897 | x_set_offset (f, move_x, move_y, 1); | ||
| 898 | } | ||
| 899 | } | ||
| 900 | |||
| 901 | /* Change the parameters of frame F as specified by ALIST. | ||
| 902 | If a parameter is not specially recognized, do nothing special; | ||
| 903 | otherwise call the `x_set_...' function for that parameter. | ||
| 904 | Except for certain geometry properties, always call store_frame_param | ||
| 905 | to store the new value in the parameter alist. */ | ||
| 906 | |||
| 907 | void | ||
| 908 | x_set_frame_parameters (f, alist) | ||
| 909 | FRAME_PTR f; | ||
| 910 | Lisp_Object alist; | ||
| 911 | { | ||
| 912 | Lisp_Object tail; | ||
| 913 | |||
| 914 | /* If both of these parameters are present, it's more efficient to | ||
| 915 | set them both at once. So we wait until we've looked at the | ||
| 916 | entire list before we set them. */ | ||
| 917 | int width, height; | ||
| 918 | |||
| 919 | /* Same here. */ | ||
| 920 | Lisp_Object left, top; | ||
| 921 | |||
| 922 | /* Same with these. */ | ||
| 923 | Lisp_Object icon_left, icon_top; | ||
| 924 | |||
| 925 | /* Record in these vectors all the parms specified. */ | ||
| 926 | Lisp_Object *parms; | ||
| 927 | Lisp_Object *values; | ||
| 928 | int i, p; | ||
| 929 | int left_no_change = 0, top_no_change = 0; | ||
| 930 | int icon_left_no_change = 0, icon_top_no_change = 0; | ||
| 931 | int fullscreen_is_being_set = 0; | ||
| 932 | |||
| 933 | struct gcpro gcpro1, gcpro2; | ||
| 934 | |||
| 935 | i = 0; | ||
| 936 | for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | ||
| 937 | i++; | ||
| 938 | |||
| 939 | parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | ||
| 940 | values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | ||
| 941 | |||
| 942 | /* Extract parm names and values into those vectors. */ | ||
| 943 | |||
| 944 | i = 0; | ||
| 945 | for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | ||
| 946 | { | ||
| 947 | Lisp_Object elt; | ||
| 948 | |||
| 949 | elt = Fcar (tail); | ||
| 950 | parms[i] = Fcar (elt); | ||
| 951 | values[i] = Fcdr (elt); | ||
| 952 | i++; | ||
| 953 | } | ||
| 954 | /* TAIL and ALIST are not used again below here. */ | ||
| 955 | alist = tail = Qnil; | ||
| 956 | |||
| 957 | GCPRO2 (*parms, *values); | ||
| 958 | gcpro1.nvars = i; | ||
| 959 | gcpro2.nvars = i; | ||
| 960 | |||
| 961 | /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP, | ||
| 962 | because their values appear in VALUES and strings are not valid. */ | ||
| 963 | top = left = Qunbound; | ||
| 964 | icon_left = icon_top = Qunbound; | ||
| 965 | |||
| 966 | /* Provide default values for HEIGHT and WIDTH. */ | ||
| 967 | if (FRAME_NEW_WIDTH (f)) | ||
| 968 | width = FRAME_NEW_WIDTH (f); | ||
| 969 | else | ||
| 970 | width = FRAME_WIDTH (f); | ||
| 971 | |||
| 972 | if (FRAME_NEW_HEIGHT (f)) | ||
| 973 | height = FRAME_NEW_HEIGHT (f); | ||
| 974 | else | ||
| 975 | height = FRAME_HEIGHT (f); | ||
| 976 | |||
| 977 | /* Process foreground_color and background_color before anything else. | ||
| 978 | They are independent of other properties, but other properties (e.g., | ||
| 979 | cursor_color) are dependent upon them. */ | ||
| 980 | /* Process default font as well, since fringe widths depends on it. */ | ||
| 981 | /* Also, process fullscreen, width and height depend upon that */ | ||
| 982 | for (p = 0; p < i; p++) | ||
| 983 | { | ||
| 984 | Lisp_Object prop, val; | ||
| 985 | |||
| 986 | prop = parms[p]; | ||
| 987 | val = values[p]; | ||
| 988 | if (EQ (prop, Qforeground_color) | ||
| 989 | || EQ (prop, Qbackground_color) | ||
| 990 | || EQ (prop, Qfont) | ||
| 991 | || EQ (prop, Qfullscreen)) | ||
| 992 | { | ||
| 993 | register Lisp_Object param_index, old_value; | ||
| 994 | |||
| 995 | old_value = get_frame_param (f, prop); | ||
| 996 | fullscreen_is_being_set |= EQ (prop, Qfullscreen); | ||
| 997 | |||
| 998 | if (NILP (Fequal (val, old_value))) | ||
| 999 | { | ||
| 1000 | store_frame_param (f, prop, val); | ||
| 1001 | |||
| 1002 | param_index = Fget (prop, Qx_frame_parameter); | ||
| 1003 | if (NATNUMP (param_index) | ||
| 1004 | && (XFASTINT (param_index) | ||
| 1005 | < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | ||
| 1006 | (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); | ||
| 1007 | } | ||
| 1008 | } | ||
| 1009 | } | ||
| 1010 | |||
| 1011 | /* Now process them in reverse of specified order. */ | ||
| 1012 | for (i--; i >= 0; i--) | ||
| 1013 | { | ||
| 1014 | Lisp_Object prop, val; | ||
| 1015 | |||
| 1016 | prop = parms[i]; | ||
| 1017 | val = values[i]; | ||
| 1018 | |||
| 1019 | if (EQ (prop, Qwidth) && NUMBERP (val)) | ||
| 1020 | width = XFASTINT (val); | ||
| 1021 | else if (EQ (prop, Qheight) && NUMBERP (val)) | ||
| 1022 | height = XFASTINT (val); | ||
| 1023 | else if (EQ (prop, Qtop)) | ||
| 1024 | top = val; | ||
| 1025 | else if (EQ (prop, Qleft)) | ||
| 1026 | left = val; | ||
| 1027 | else if (EQ (prop, Qicon_top)) | ||
| 1028 | icon_top = val; | ||
| 1029 | else if (EQ (prop, Qicon_left)) | ||
| 1030 | icon_left = val; | ||
| 1031 | else if (EQ (prop, Qforeground_color) | ||
| 1032 | || EQ (prop, Qbackground_color) | ||
| 1033 | || EQ (prop, Qfont) | ||
| 1034 | || EQ (prop, Qfullscreen)) | ||
| 1035 | /* Processed above. */ | ||
| 1036 | continue; | ||
| 1037 | else | ||
| 1038 | { | ||
| 1039 | register Lisp_Object param_index, old_value; | ||
| 1040 | |||
| 1041 | old_value = get_frame_param (f, prop); | ||
| 1042 | |||
| 1043 | store_frame_param (f, prop, val); | ||
| 1044 | |||
| 1045 | param_index = Fget (prop, Qx_frame_parameter); | ||
| 1046 | if (NATNUMP (param_index) | ||
| 1047 | && (XFASTINT (param_index) | ||
| 1048 | < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | ||
| 1049 | (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); | ||
| 1050 | } | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | /* Don't die if just one of these was set. */ | ||
| 1054 | if (EQ (left, Qunbound)) | ||
| 1055 | { | ||
| 1056 | left_no_change = 1; | ||
| 1057 | if (f->output_data.x->left_pos < 0) | ||
| 1058 | left = Fcons (Qplus, Fcons (make_number (f->output_data.x->left_pos), Qnil)); | ||
| 1059 | else | ||
| 1060 | XSETINT (left, f->output_data.x->left_pos); | ||
| 1061 | } | ||
| 1062 | if (EQ (top, Qunbound)) | ||
| 1063 | { | ||
| 1064 | top_no_change = 1; | ||
| 1065 | if (f->output_data.x->top_pos < 0) | ||
| 1066 | top = Fcons (Qplus, Fcons (make_number (f->output_data.x->top_pos), Qnil)); | ||
| 1067 | else | ||
| 1068 | XSETINT (top, f->output_data.x->top_pos); | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | /* If one of the icon positions was not set, preserve or default it. */ | ||
| 1072 | if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | ||
| 1073 | { | ||
| 1074 | icon_left_no_change = 1; | ||
| 1075 | icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | ||
| 1076 | if (NILP (icon_left)) | ||
| 1077 | XSETINT (icon_left, 0); | ||
| 1078 | } | ||
| 1079 | if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | ||
| 1080 | { | ||
| 1081 | icon_top_no_change = 1; | ||
| 1082 | icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | ||
| 1083 | if (NILP (icon_top)) | ||
| 1084 | XSETINT (icon_top, 0); | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) | ||
| 1088 | { | ||
| 1089 | /* If the frame is visible already and the fullscreen parameter is | ||
| 1090 | being set, it is too late to set WM manager hints to specify | ||
| 1091 | size and position. | ||
| 1092 | Here we first get the width, height and position that applies to | ||
| 1093 | fullscreen. We then move the frame to the appropriate | ||
| 1094 | position. Resize of the frame is taken care of in the code after | ||
| 1095 | this if-statement. */ | ||
| 1096 | int new_left, new_top; | ||
| 1097 | |||
| 1098 | x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); | ||
| 1099 | x_fullscreen_move (f, new_top, new_left); | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | /* Don't set these parameters unless they've been explicitly | ||
| 1103 | specified. The window might be mapped or resized while we're in | ||
| 1104 | this function, and we don't want to override that unless the lisp | ||
| 1105 | code has asked for it. | ||
| 1106 | |||
| 1107 | Don't set these parameters unless they actually differ from the | ||
| 1108 | window's current parameters; the window may not actually exist | ||
| 1109 | yet. */ | ||
| 1110 | { | ||
| 1111 | Lisp_Object frame; | ||
| 1112 | |||
| 1113 | check_frame_size (f, &height, &width); | ||
| 1114 | |||
| 1115 | XSETFRAME (frame, f); | ||
| 1116 | |||
| 1117 | if (width != FRAME_WIDTH (f) | ||
| 1118 | || height != FRAME_HEIGHT (f) | ||
| 1119 | || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f)) | ||
| 1120 | Fset_frame_size (frame, make_number (width), make_number (height)); | ||
| 1121 | |||
| 1122 | if ((!NILP (left) || !NILP (top)) | ||
| 1123 | && ! (left_no_change && top_no_change) | ||
| 1124 | && ! (NUMBERP (left) && XINT (left) == f->output_data.x->left_pos | ||
| 1125 | && NUMBERP (top) && XINT (top) == f->output_data.x->top_pos)) | ||
| 1126 | { | ||
| 1127 | int leftpos = 0; | ||
| 1128 | int toppos = 0; | ||
| 1129 | |||
| 1130 | /* Record the signs. */ | ||
| 1131 | f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); | ||
| 1132 | if (EQ (left, Qminus)) | ||
| 1133 | f->output_data.x->size_hint_flags |= XNegative; | ||
| 1134 | else if (INTEGERP (left)) | ||
| 1135 | { | ||
| 1136 | leftpos = XINT (left); | ||
| 1137 | if (leftpos < 0) | ||
| 1138 | f->output_data.x->size_hint_flags |= XNegative; | ||
| 1139 | } | ||
| 1140 | else if (CONSP (left) && EQ (XCAR (left), Qminus) | ||
| 1141 | && CONSP (XCDR (left)) | ||
| 1142 | && INTEGERP (XCAR (XCDR (left)))) | ||
| 1143 | { | ||
| 1144 | leftpos = - XINT (XCAR (XCDR (left))); | ||
| 1145 | f->output_data.x->size_hint_flags |= XNegative; | ||
| 1146 | } | ||
| 1147 | else if (CONSP (left) && EQ (XCAR (left), Qplus) | ||
| 1148 | && CONSP (XCDR (left)) | ||
| 1149 | && INTEGERP (XCAR (XCDR (left)))) | ||
| 1150 | { | ||
| 1151 | leftpos = XINT (XCAR (XCDR (left))); | ||
| 1152 | } | ||
| 1153 | |||
| 1154 | if (EQ (top, Qminus)) | ||
| 1155 | f->output_data.x->size_hint_flags |= YNegative; | ||
| 1156 | else if (INTEGERP (top)) | ||
| 1157 | { | ||
| 1158 | toppos = XINT (top); | ||
| 1159 | if (toppos < 0) | ||
| 1160 | f->output_data.x->size_hint_flags |= YNegative; | ||
| 1161 | } | ||
| 1162 | else if (CONSP (top) && EQ (XCAR (top), Qminus) | ||
| 1163 | && CONSP (XCDR (top)) | ||
| 1164 | && INTEGERP (XCAR (XCDR (top)))) | ||
| 1165 | { | ||
| 1166 | toppos = - XINT (XCAR (XCDR (top))); | ||
| 1167 | f->output_data.x->size_hint_flags |= YNegative; | ||
| 1168 | } | ||
| 1169 | else if (CONSP (top) && EQ (XCAR (top), Qplus) | ||
| 1170 | && CONSP (XCDR (top)) | ||
| 1171 | && INTEGERP (XCAR (XCDR (top)))) | ||
| 1172 | { | ||
| 1173 | toppos = XINT (XCAR (XCDR (top))); | ||
| 1174 | } | ||
| 1175 | |||
| 1176 | |||
| 1177 | /* Store the numeric value of the position. */ | ||
| 1178 | f->output_data.x->top_pos = toppos; | ||
| 1179 | f->output_data.x->left_pos = leftpos; | ||
| 1180 | |||
| 1181 | f->output_data.x->win_gravity = NorthWestGravity; | ||
| 1182 | |||
| 1183 | /* Actually set that position, and convert to absolute. */ | ||
| 1184 | x_set_offset (f, leftpos, toppos, -1); | ||
| 1185 | } | ||
| 1186 | |||
| 1187 | if ((!NILP (icon_left) || !NILP (icon_top)) | ||
| 1188 | && ! (icon_left_no_change && icon_top_no_change)) | ||
| 1189 | x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); | ||
| 1190 | } | ||
| 1191 | |||
| 1192 | UNGCPRO; | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | /* Store the screen positions of frame F into XPTR and YPTR. | 762 | /* Store the screen positions of frame F into XPTR and YPTR. |
| 1196 | These are the positions of the containing window manager window, | 763 | These are the positions of the containing window manager window, |
| 1197 | not Emacs's own window. */ | 764 | not Emacs's own window. */ |
| @@ -1312,75 +879,6 @@ x_real_positions (f, xptr, yptr) | |||
| 1312 | *yptr = real_y; | 879 | *yptr = real_y; |
| 1313 | } | 880 | } |
| 1314 | 881 | ||
| 1315 | /* Insert a description of internally-recorded parameters of frame X | ||
| 1316 | into the parameter alist *ALISTPTR that is to be given to the user. | ||
| 1317 | Only parameters that are specific to the X window system | ||
| 1318 | and whose values are not correctly recorded in the frame's | ||
| 1319 | param_alist need to be considered here. */ | ||
| 1320 | |||
| 1321 | void | ||
| 1322 | x_report_frame_params (f, alistptr) | ||
| 1323 | struct frame *f; | ||
| 1324 | Lisp_Object *alistptr; | ||
| 1325 | { | ||
| 1326 | char buf[16]; | ||
| 1327 | Lisp_Object tem; | ||
| 1328 | |||
| 1329 | /* Represent negative positions (off the top or left screen edge) | ||
| 1330 | in a way that Fmodify_frame_parameters will understand correctly. */ | ||
| 1331 | XSETINT (tem, f->output_data.x->left_pos); | ||
| 1332 | if (f->output_data.x->left_pos >= 0) | ||
| 1333 | store_in_alist (alistptr, Qleft, tem); | ||
| 1334 | else | ||
| 1335 | store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); | ||
| 1336 | |||
| 1337 | XSETINT (tem, f->output_data.x->top_pos); | ||
| 1338 | if (f->output_data.x->top_pos >= 0) | ||
| 1339 | store_in_alist (alistptr, Qtop, tem); | ||
| 1340 | else | ||
| 1341 | store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); | ||
| 1342 | |||
| 1343 | store_in_alist (alistptr, Qborder_width, | ||
| 1344 | make_number (f->output_data.x->border_width)); | ||
| 1345 | store_in_alist (alistptr, Qinternal_border_width, | ||
| 1346 | make_number (f->output_data.x->internal_border_width)); | ||
| 1347 | store_in_alist (alistptr, Qleft_fringe, | ||
| 1348 | make_number (f->output_data.x->left_fringe_width)); | ||
| 1349 | store_in_alist (alistptr, Qright_fringe, | ||
| 1350 | make_number (f->output_data.x->right_fringe_width)); | ||
| 1351 | store_in_alist (alistptr, Qscroll_bar_width, | ||
| 1352 | (! FRAME_HAS_VERTICAL_SCROLL_BARS (f) | ||
| 1353 | ? make_number (0) | ||
| 1354 | : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | ||
| 1355 | ? make_number (FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | ||
| 1356 | /* nil means "use default width" | ||
| 1357 | for non-toolkit scroll bar. | ||
| 1358 | ruler-mode.el depends on this. */ | ||
| 1359 | : Qnil)); | ||
| 1360 | sprintf (buf, "%ld", (long) FRAME_X_WINDOW (f)); | ||
| 1361 | store_in_alist (alistptr, Qwindow_id, | ||
| 1362 | build_string (buf)); | ||
| 1363 | #ifdef USE_X_TOOLKIT | ||
| 1364 | /* Tooltip frame may not have this widget. */ | ||
| 1365 | if (f->output_data.x->widget) | ||
| 1366 | #endif | ||
| 1367 | sprintf (buf, "%ld", (long) FRAME_OUTER_WINDOW (f)); | ||
| 1368 | store_in_alist (alistptr, Qouter_window_id, | ||
| 1369 | build_string (buf)); | ||
| 1370 | store_in_alist (alistptr, Qicon_name, f->icon_name); | ||
| 1371 | FRAME_SAMPLE_VISIBILITY (f); | ||
| 1372 | store_in_alist (alistptr, Qvisibility, | ||
| 1373 | (FRAME_VISIBLE_P (f) ? Qt | ||
| 1374 | : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | ||
| 1375 | store_in_alist (alistptr, Qdisplay, | ||
| 1376 | XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); | ||
| 1377 | |||
| 1378 | if (f->output_data.x->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) | ||
| 1379 | tem = Qnil; | ||
| 1380 | else | ||
| 1381 | XSETFASTINT (tem, f->output_data.x->parent_desc); | ||
| 1382 | store_in_alist (alistptr, Qparent_id, tem); | ||
| 1383 | } | ||
| 1384 | 882 | ||
| 1385 | 883 | ||
| 1386 | 884 | ||
| @@ -1465,26 +963,6 @@ x_decode_color (f, color_name, mono_color) | |||
| 1465 | 963 | ||
| 1466 | 964 | ||
| 1467 | 965 | ||
| 1468 | /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is | ||
| 1469 | the previous value of that parameter, NEW_VALUE is the new value. */ | ||
| 1470 | |||
| 1471 | static void | ||
| 1472 | x_set_line_spacing (f, new_value, old_value) | ||
| 1473 | struct frame *f; | ||
| 1474 | Lisp_Object new_value, old_value; | ||
| 1475 | { | ||
| 1476 | if (NILP (new_value)) | ||
| 1477 | f->extra_line_spacing = 0; | ||
| 1478 | else if (NATNUMP (new_value)) | ||
| 1479 | f->extra_line_spacing = XFASTINT (new_value); | ||
| 1480 | else | ||
| 1481 | Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"), | ||
| 1482 | Fcons (new_value, Qnil))); | ||
| 1483 | if (FRAME_VISIBLE_P (f)) | ||
| 1484 | redraw_frame (f); | ||
| 1485 | } | ||
| 1486 | |||
| 1487 | |||
| 1488 | /* Change the `wait-for-wm' frame parameter of frame F. OLD_VALUE is | 966 | /* Change the `wait-for-wm' frame parameter of frame F. OLD_VALUE is |
| 1489 | the previous value of that parameter, NEW_VALUE is the new value. | 967 | the previous value of that parameter, NEW_VALUE is the new value. |
| 1490 | See also the comment of wait_for_wm in struct x_output. */ | 968 | See also the comment of wait_for_wm in struct x_output. */ |
| @@ -1498,47 +976,6 @@ x_set_wait_for_wm (f, new_value, old_value) | |||
| 1498 | } | 976 | } |
| 1499 | 977 | ||
| 1500 | 978 | ||
| 1501 | /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is | ||
| 1502 | the previous value of that parameter, NEW_VALUE is the new value. */ | ||
| 1503 | |||
| 1504 | static void | ||
| 1505 | x_set_fullscreen (f, new_value, old_value) | ||
| 1506 | struct frame *f; | ||
| 1507 | Lisp_Object new_value, old_value; | ||
| 1508 | { | ||
| 1509 | if (NILP (new_value)) | ||
| 1510 | f->output_data.x->want_fullscreen = FULLSCREEN_NONE; | ||
| 1511 | else if (EQ (new_value, Qfullboth)) | ||
| 1512 | f->output_data.x->want_fullscreen = FULLSCREEN_BOTH; | ||
| 1513 | else if (EQ (new_value, Qfullwidth)) | ||
| 1514 | f->output_data.x->want_fullscreen = FULLSCREEN_WIDTH; | ||
| 1515 | else if (EQ (new_value, Qfullheight)) | ||
| 1516 | f->output_data.x->want_fullscreen = FULLSCREEN_HEIGHT; | ||
| 1517 | } | ||
| 1518 | |||
| 1519 | |||
| 1520 | /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is | ||
| 1521 | the previous value of that parameter, NEW_VALUE is the new | ||
| 1522 | value. */ | ||
| 1523 | |||
| 1524 | static void | ||
| 1525 | x_set_screen_gamma (f, new_value, old_value) | ||
| 1526 | struct frame *f; | ||
| 1527 | Lisp_Object new_value, old_value; | ||
| 1528 | { | ||
| 1529 | if (NILP (new_value)) | ||
| 1530 | f->gamma = 0; | ||
| 1531 | else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0) | ||
| 1532 | /* The value 0.4545 is the normal viewing gamma. */ | ||
| 1533 | f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); | ||
| 1534 | else | ||
| 1535 | Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"), | ||
| 1536 | Fcons (new_value, Qnil))); | ||
| 1537 | |||
| 1538 | clear_face_cache (0); | ||
| 1539 | } | ||
| 1540 | |||
| 1541 | |||
| 1542 | /* Functions called only from `x_set_frame_param' | 979 | /* Functions called only from `x_set_frame_param' |
| 1543 | to set individual parameters. | 980 | to set individual parameters. |
| 1544 | 981 | ||
| @@ -1847,30 +1284,6 @@ x_set_cursor_color (f, arg, oldval) | |||
| 1847 | update_face_from_frame_parameter (f, Qcursor_color, arg); | 1284 | update_face_from_frame_parameter (f, Qcursor_color, arg); |
| 1848 | } | 1285 | } |
| 1849 | 1286 | ||
| 1850 | /* Set the border-color of frame F to value described by ARG. | ||
| 1851 | ARG can be a string naming a color. | ||
| 1852 | The border-color is used for the border that is drawn by the X server. | ||
| 1853 | Note that this does not fully take effect if done before | ||
| 1854 | F has an x-window; it must be redone when the window is created. | ||
| 1855 | |||
| 1856 | Note: this is done in two routines because of the way X10 works. | ||
| 1857 | |||
| 1858 | Note: under X11, this is normally the province of the window manager, | ||
| 1859 | and so emacs' border colors may be overridden. */ | ||
| 1860 | |||
| 1861 | void | ||
| 1862 | x_set_border_color (f, arg, oldval) | ||
| 1863 | struct frame *f; | ||
| 1864 | Lisp_Object arg, oldval; | ||
| 1865 | { | ||
| 1866 | int pix; | ||
| 1867 | |||
| 1868 | CHECK_STRING (arg); | ||
| 1869 | pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | ||
| 1870 | x_set_border_pixel (f, pix); | ||
| 1871 | update_face_from_frame_parameter (f, Qborder_color, arg); | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | /* Set the border-color of frame F to pixel value PIX. | 1287 | /* Set the border-color of frame F to pixel value PIX. |
| 1875 | Note that this does not fully take effect if done before | 1288 | Note that this does not fully take effect if done before |
| 1876 | F has an x-window. */ | 1289 | F has an x-window. */ |
| @@ -1895,6 +1308,29 @@ x_set_border_pixel (f, pix) | |||
| 1895 | } | 1308 | } |
| 1896 | } | 1309 | } |
| 1897 | 1310 | ||
| 1311 | /* Set the border-color of frame F to value described by ARG. | ||
| 1312 | ARG can be a string naming a color. | ||
| 1313 | The border-color is used for the border that is drawn by the X server. | ||
| 1314 | Note that this does not fully take effect if done before | ||
| 1315 | F has an x-window; it must be redone when the window is created. | ||
| 1316 | |||
| 1317 | Note: this is done in two routines because of the way X10 works. | ||
| 1318 | |||
| 1319 | Note: under X11, this is normally the province of the window manager, | ||
| 1320 | and so emacs' border colors may be overridden. */ | ||
| 1321 | |||
| 1322 | void | ||
| 1323 | x_set_border_color (f, arg, oldval) | ||
| 1324 | struct frame *f; | ||
| 1325 | Lisp_Object arg, oldval; | ||
| 1326 | { | ||
| 1327 | int pix; | ||
| 1328 | |||
| 1329 | CHECK_STRING (arg); | ||
| 1330 | pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | ||
| 1331 | x_set_border_pixel (f, pix); | ||
| 1332 | update_face_from_frame_parameter (f, Qborder_color, arg); | ||
| 1333 | } | ||
| 1898 | 1334 | ||
| 1899 | 1335 | ||
| 1900 | void | 1336 | void |
| @@ -1942,21 +1378,6 @@ x_set_icon_type (f, arg, oldval) | |||
| 1942 | UNBLOCK_INPUT; | 1378 | UNBLOCK_INPUT; |
| 1943 | } | 1379 | } |
| 1944 | 1380 | ||
| 1945 | /* Return non-nil if frame F wants a bitmap icon. */ | ||
| 1946 | |||
| 1947 | Lisp_Object | ||
| 1948 | x_icon_type (f) | ||
| 1949 | FRAME_PTR f; | ||
| 1950 | { | ||
| 1951 | Lisp_Object tem; | ||
| 1952 | |||
| 1953 | tem = assq_no_quit (Qicon_type, f->param_alist); | ||
| 1954 | if (CONSP (tem)) | ||
| 1955 | return XCDR (tem); | ||
| 1956 | else | ||
| 1957 | return Qnil; | ||
| 1958 | } | ||
| 1959 | |||
| 1960 | void | 1381 | void |
| 1961 | x_set_icon_name (f, arg, oldval) | 1382 | x_set_icon_name (f, arg, oldval) |
| 1962 | struct frame *f; | 1383 | struct frame *f; |
| @@ -1995,163 +1416,8 @@ x_set_icon_name (f, arg, oldval) | |||
| 1995 | XFlush (FRAME_X_DISPLAY (f)); | 1416 | XFlush (FRAME_X_DISPLAY (f)); |
| 1996 | UNBLOCK_INPUT; | 1417 | UNBLOCK_INPUT; |
| 1997 | } | 1418 | } |
| 1998 | |||
| 1999 | void | ||
| 2000 | x_set_font (f, arg, oldval) | ||
| 2001 | struct frame *f; | ||
| 2002 | Lisp_Object arg, oldval; | ||
| 2003 | { | ||
| 2004 | Lisp_Object result; | ||
| 2005 | Lisp_Object fontset_name; | ||
| 2006 | Lisp_Object frame; | ||
| 2007 | int old_fontset = f->output_data.x->fontset; | ||
| 2008 | |||
| 2009 | CHECK_STRING (arg); | ||
| 2010 | |||
| 2011 | fontset_name = Fquery_fontset (arg, Qnil); | ||
| 2012 | |||
| 2013 | BLOCK_INPUT; | ||
| 2014 | result = (STRINGP (fontset_name) | ||
| 2015 | ? x_new_fontset (f, SDATA (fontset_name)) | ||
| 2016 | : x_new_font (f, SDATA (arg))); | ||
| 2017 | UNBLOCK_INPUT; | ||
| 2018 | |||
| 2019 | if (EQ (result, Qnil)) | ||
| 2020 | error ("Font `%s' is not defined", SDATA (arg)); | ||
| 2021 | else if (EQ (result, Qt)) | ||
| 2022 | error ("The characters of the given font have varying widths"); | ||
| 2023 | else if (STRINGP (result)) | ||
| 2024 | { | ||
| 2025 | if (STRINGP (fontset_name)) | ||
| 2026 | { | ||
| 2027 | /* Fontset names are built from ASCII font names, so the | ||
| 2028 | names may be equal despite there was a change. */ | ||
| 2029 | if (old_fontset == f->output_data.x->fontset) | ||
| 2030 | return; | ||
| 2031 | } | ||
| 2032 | else if (!NILP (Fequal (result, oldval))) | ||
| 2033 | return; | ||
| 2034 | |||
| 2035 | store_frame_param (f, Qfont, result); | ||
| 2036 | recompute_basic_faces (f); | ||
| 2037 | } | ||
| 2038 | else | ||
| 2039 | abort (); | ||
| 2040 | |||
| 2041 | do_pending_window_change (0); | ||
| 2042 | |||
| 2043 | /* Don't call `face-set-after-frame-default' when faces haven't been | ||
| 2044 | initialized yet. This is the case when called from | ||
| 2045 | Fx_create_frame. In that case, the X widget or window doesn't | ||
| 2046 | exist either, and we can end up in x_report_frame_params with a | ||
| 2047 | null widget which gives a segfault. */ | ||
| 2048 | if (FRAME_FACE_CACHE (f)) | ||
| 2049 | { | ||
| 2050 | XSETFRAME (frame, f); | ||
| 2051 | call1 (Qface_set_after_frame_default, frame); | ||
| 2052 | } | ||
| 2053 | } | ||
| 2054 | |||
| 2055 | static void | ||
| 2056 | x_set_fringe_width (f, new_value, old_value) | ||
| 2057 | struct frame *f; | ||
| 2058 | Lisp_Object new_value, old_value; | ||
| 2059 | { | ||
| 2060 | compute_fringe_widths (f, 1); | ||
| 2061 | } | ||
| 2062 | |||
| 2063 | void | ||
| 2064 | x_set_border_width (f, arg, oldval) | ||
| 2065 | struct frame *f; | ||
| 2066 | Lisp_Object arg, oldval; | ||
| 2067 | { | ||
| 2068 | CHECK_NUMBER (arg); | ||
| 2069 | |||
| 2070 | if (XINT (arg) == f->output_data.x->border_width) | ||
| 2071 | return; | ||
| 2072 | |||
| 2073 | if (FRAME_X_WINDOW (f) != 0) | ||
| 2074 | error ("Cannot change the border width of a window"); | ||
| 2075 | |||
| 2076 | f->output_data.x->border_width = XINT (arg); | ||
| 2077 | } | ||
| 2078 | |||
| 2079 | void | ||
| 2080 | x_set_internal_border_width (f, arg, oldval) | ||
| 2081 | struct frame *f; | ||
| 2082 | Lisp_Object arg, oldval; | ||
| 2083 | { | ||
| 2084 | int old = f->output_data.x->internal_border_width; | ||
| 2085 | |||
| 2086 | CHECK_NUMBER (arg); | ||
| 2087 | f->output_data.x->internal_border_width = XINT (arg); | ||
| 2088 | if (f->output_data.x->internal_border_width < 0) | ||
| 2089 | f->output_data.x->internal_border_width = 0; | ||
| 2090 | |||
| 2091 | #ifdef USE_X_TOOLKIT | ||
| 2092 | if (f->output_data.x->edit_widget) | ||
| 2093 | widget_store_internal_border (f->output_data.x->edit_widget); | ||
| 2094 | #endif | ||
| 2095 | |||
| 2096 | if (f->output_data.x->internal_border_width == old) | ||
| 2097 | return; | ||
| 2098 | |||
| 2099 | if (FRAME_X_WINDOW (f) != 0) | ||
| 2100 | { | ||
| 2101 | x_set_window_size (f, 0, f->width, f->height); | ||
| 2102 | SET_FRAME_GARBAGED (f); | ||
| 2103 | do_pending_window_change (0); | ||
| 2104 | } | ||
| 2105 | else | ||
| 2106 | SET_FRAME_GARBAGED (f); | ||
| 2107 | } | ||
| 2108 | |||
| 2109 | void | ||
| 2110 | x_set_visibility (f, value, oldval) | ||
| 2111 | struct frame *f; | ||
| 2112 | Lisp_Object value, oldval; | ||
| 2113 | { | ||
| 2114 | Lisp_Object frame; | ||
| 2115 | XSETFRAME (frame, f); | ||
| 2116 | |||
| 2117 | if (NILP (value)) | ||
| 2118 | Fmake_frame_invisible (frame, Qt); | ||
| 2119 | else if (EQ (value, Qicon)) | ||
| 2120 | Ficonify_frame (frame); | ||
| 2121 | else | ||
| 2122 | Fmake_frame_visible (frame); | ||
| 2123 | } | ||
| 2124 | 1419 | ||
| 2125 | 1420 | ||
| 2126 | /* Change window heights in windows rooted in WINDOW by N lines. */ | ||
| 2127 | |||
| 2128 | static void | ||
| 2129 | x_change_window_heights (window, n) | ||
| 2130 | Lisp_Object window; | ||
| 2131 | int n; | ||
| 2132 | { | ||
| 2133 | struct window *w = XWINDOW (window); | ||
| 2134 | |||
| 2135 | XSETFASTINT (w->top, XFASTINT (w->top) + n); | ||
| 2136 | XSETFASTINT (w->height, XFASTINT (w->height) - n); | ||
| 2137 | |||
| 2138 | if (INTEGERP (w->orig_top)) | ||
| 2139 | XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n); | ||
| 2140 | if (INTEGERP (w->orig_height)) | ||
| 2141 | XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n); | ||
| 2142 | |||
| 2143 | /* Handle just the top child in a vertical split. */ | ||
| 2144 | if (!NILP (w->vchild)) | ||
| 2145 | x_change_window_heights (w->vchild, n); | ||
| 2146 | |||
| 2147 | /* Adjust all children in a horizontal split. */ | ||
| 2148 | for (window = w->hchild; !NILP (window); window = w->next) | ||
| 2149 | { | ||
| 2150 | w = XWINDOW (window); | ||
| 2151 | x_change_window_heights (window, n); | ||
| 2152 | } | ||
| 2153 | } | ||
| 2154 | |||
| 2155 | void | 1421 | void |
| 2156 | x_set_menu_bar_lines (f, value, oldval) | 1422 | x_set_menu_bar_lines (f, value, oldval) |
| 2157 | struct frame *f; | 1423 | struct frame *f; |
| @@ -2196,7 +1462,7 @@ x_set_menu_bar_lines (f, value, oldval) | |||
| 2196 | } | 1462 | } |
| 2197 | #else /* not USE_X_TOOLKIT && not USE_GTK */ | 1463 | #else /* not USE_X_TOOLKIT && not USE_GTK */ |
| 2198 | FRAME_MENU_BAR_LINES (f) = nlines; | 1464 | FRAME_MENU_BAR_LINES (f) = nlines; |
| 2199 | x_change_window_heights (f->root_window, nlines - olines); | 1465 | change_window_heights (f->root_window, nlines - olines); |
| 2200 | #endif /* not USE_X_TOOLKIT */ | 1466 | #endif /* not USE_X_TOOLKIT */ |
| 2201 | adjust_glyphs (f); | 1467 | adjust_glyphs (f); |
| 2202 | } | 1468 | } |
| @@ -2261,7 +1527,7 @@ x_set_tool_bar_lines (f, value, oldval) | |||
| 2261 | } | 1527 | } |
| 2262 | 1528 | ||
| 2263 | FRAME_TOOL_BAR_LINES (f) = nlines; | 1529 | FRAME_TOOL_BAR_LINES (f) = nlines; |
| 2264 | x_change_window_heights (root_window, delta); | 1530 | change_window_heights (root_window, delta); |
| 2265 | adjust_glyphs (f); | 1531 | adjust_glyphs (f); |
| 2266 | 1532 | ||
| 2267 | /* We also have to make sure that the internal border at the top of | 1533 | /* We also have to make sure that the internal border at the top of |
| @@ -2685,483 +1951,30 @@ x_set_title (f, name, old_name) | |||
| 2685 | UNBLOCK_INPUT; | 1951 | UNBLOCK_INPUT; |
| 2686 | } | 1952 | } |
| 2687 | } | 1953 | } |
| 2688 | |||
| 2689 | void | ||
| 2690 | x_set_autoraise (f, arg, oldval) | ||
| 2691 | struct frame *f; | ||
| 2692 | Lisp_Object arg, oldval; | ||
| 2693 | { | ||
| 2694 | f->auto_raise = !EQ (Qnil, arg); | ||
| 2695 | } | ||
| 2696 | |||
| 2697 | void | ||
| 2698 | x_set_autolower (f, arg, oldval) | ||
| 2699 | struct frame *f; | ||
| 2700 | Lisp_Object arg, oldval; | ||
| 2701 | { | ||
| 2702 | f->auto_lower = !EQ (Qnil, arg); | ||
| 2703 | } | ||
| 2704 | |||
| 2705 | void | ||
| 2706 | x_set_unsplittable (f, arg, oldval) | ||
| 2707 | struct frame *f; | ||
| 2708 | Lisp_Object arg, oldval; | ||
| 2709 | { | ||
| 2710 | f->no_split = !NILP (arg); | ||
| 2711 | } | ||
| 2712 | |||
| 2713 | void | ||
| 2714 | x_set_vertical_scroll_bars (f, arg, oldval) | ||
| 2715 | struct frame *f; | ||
| 2716 | Lisp_Object arg, oldval; | ||
| 2717 | { | ||
| 2718 | if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) | ||
| 2719 | || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) | ||
| 2720 | || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | ||
| 2721 | || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))) | ||
| 2722 | { | ||
| 2723 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) | ||
| 2724 | = (NILP (arg) | ||
| 2725 | ? vertical_scroll_bar_none | ||
| 2726 | : EQ (Qright, arg) | ||
| 2727 | ? vertical_scroll_bar_right | ||
| 2728 | : vertical_scroll_bar_left); | ||
| 2729 | |||
| 2730 | /* We set this parameter before creating the X window for the | ||
| 2731 | frame, so we can get the geometry right from the start. | ||
| 2732 | However, if the window hasn't been created yet, we shouldn't | ||
| 2733 | call x_set_window_size. */ | ||
| 2734 | if (FRAME_X_WINDOW (f)) | ||
| 2735 | x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); | ||
| 2736 | do_pending_window_change (0); | ||
| 2737 | } | ||
| 2738 | } | ||
| 2739 | 1954 | ||
| 2740 | void | 1955 | void |
| 2741 | x_set_scroll_bar_width (f, arg, oldval) | 1956 | x_set_scroll_bar_default_width (f) |
| 2742 | struct frame *f; | 1957 | struct frame *f; |
| 2743 | Lisp_Object arg, oldval; | ||
| 2744 | { | 1958 | { |
| 2745 | int wid = FONT_WIDTH (f->output_data.x->font); | 1959 | int wid = FONT_WIDTH (f->output_data.x->font); |
| 2746 | 1960 | ||
| 2747 | if (NILP (arg)) | ||
| 2748 | { | ||
| 2749 | #ifdef USE_TOOLKIT_SCROLL_BARS | 1961 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 2750 | /* A minimum width of 14 doesn't look good for toolkit scroll bars. */ | 1962 | /* A minimum width of 14 doesn't look good for toolkit scroll bars. */ |
| 2751 | int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM; | 1963 | int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM; |
| 2752 | FRAME_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid; | 1964 | FRAME_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid; |
| 2753 | FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = width; | 1965 | FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = width; |
| 2754 | #else | 1966 | #else |
| 2755 | /* Make the actual width at least 14 pixels and a multiple of a | 1967 | /* Make the actual width at least 14 pixels and a multiple of a |
| 2756 | character width. */ | 1968 | character width. */ |
| 2757 | FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; | 1969 | FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; |
| 2758 | 1970 | ||
| 2759 | /* Use all of that space (aside from required margins) for the | 1971 | /* Use all of that space (aside from required margins) for the |
| 2760 | scroll bar. */ | 1972 | scroll bar. */ |
| 2761 | FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; | 1973 | FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; |
| 2762 | #endif | 1974 | #endif |
| 2763 | |||
| 2764 | if (FRAME_X_WINDOW (f)) | ||
| 2765 | x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); | ||
| 2766 | do_pending_window_change (0); | ||
| 2767 | } | ||
| 2768 | else if (INTEGERP (arg) && XINT (arg) > 0 | ||
| 2769 | && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | ||
| 2770 | { | ||
| 2771 | if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM) | ||
| 2772 | XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1); | ||
| 2773 | |||
| 2774 | FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg); | ||
| 2775 | FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid; | ||
| 2776 | if (FRAME_X_WINDOW (f)) | ||
| 2777 | x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); | ||
| 2778 | } | ||
| 2779 | |||
| 2780 | change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0); | ||
| 2781 | XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; | ||
| 2782 | XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; | ||
| 2783 | } | 1975 | } |
| 2784 | 1976 | ||
| 2785 | |||
| 2786 | 1977 | ||
| 2787 | /* Subroutines of creating an X frame. */ | ||
| 2788 | |||
| 2789 | /* Make sure that Vx_resource_name is set to a reasonable value. | ||
| 2790 | Fix it up, or set it to `emacs' if it is too hopeless. */ | ||
| 2791 | |||
| 2792 | static void | ||
| 2793 | validate_x_resource_name () | ||
| 2794 | { | ||
| 2795 | int len = 0; | ||
| 2796 | /* Number of valid characters in the resource name. */ | ||
| 2797 | int good_count = 0; | ||
| 2798 | /* Number of invalid characters in the resource name. */ | ||
| 2799 | int bad_count = 0; | ||
| 2800 | Lisp_Object new; | ||
| 2801 | int i; | ||
| 2802 | |||
| 2803 | if (!STRINGP (Vx_resource_class)) | ||
| 2804 | Vx_resource_class = build_string (EMACS_CLASS); | ||
| 2805 | |||
| 2806 | if (STRINGP (Vx_resource_name)) | ||
| 2807 | { | ||
| 2808 | unsigned char *p = SDATA (Vx_resource_name); | ||
| 2809 | int i; | ||
| 2810 | |||
| 2811 | len = SBYTES (Vx_resource_name); | ||
| 2812 | |||
| 2813 | /* Only letters, digits, - and _ are valid in resource names. | ||
| 2814 | Count the valid characters and count the invalid ones. */ | ||
| 2815 | for (i = 0; i < len; i++) | ||
| 2816 | { | ||
| 2817 | int c = p[i]; | ||
| 2818 | if (! ((c >= 'a' && c <= 'z') | ||
| 2819 | || (c >= 'A' && c <= 'Z') | ||
| 2820 | || (c >= '0' && c <= '9') | ||
| 2821 | || c == '-' || c == '_')) | ||
| 2822 | bad_count++; | ||
| 2823 | else | ||
| 2824 | good_count++; | ||
| 2825 | } | ||
| 2826 | } | ||
| 2827 | else | ||
| 2828 | /* Not a string => completely invalid. */ | ||
| 2829 | bad_count = 5, good_count = 0; | ||
| 2830 | |||
| 2831 | /* If name is valid already, return. */ | ||
| 2832 | if (bad_count == 0) | ||
| 2833 | return; | ||
| 2834 | |||
| 2835 | /* If name is entirely invalid, or nearly so, use `emacs'. */ | ||
| 2836 | if (good_count == 0 | ||
| 2837 | || (good_count == 1 && bad_count > 0)) | ||
| 2838 | { | ||
| 2839 | Vx_resource_name = build_string ("emacs"); | ||
| 2840 | return; | ||
| 2841 | } | ||
| 2842 | |||
| 2843 | /* Name is partly valid. Copy it and replace the invalid characters | ||
| 2844 | with underscores. */ | ||
| 2845 | |||
| 2846 | Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); | ||
| 2847 | |||
| 2848 | for (i = 0; i < len; i++) | ||
| 2849 | { | ||
| 2850 | int c = SREF (new, i); | ||
| 2851 | if (! ((c >= 'a' && c <= 'z') | ||
| 2852 | || (c >= 'A' && c <= 'Z') | ||
| 2853 | || (c >= '0' && c <= '9') | ||
| 2854 | || c == '-' || c == '_')) | ||
| 2855 | SSET (new, i, '_'); | ||
| 2856 | } | ||
| 2857 | } | ||
| 2858 | |||
| 2859 | |||
| 2860 | extern char *x_get_string_resource (); | ||
| 2861 | |||
| 2862 | DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0, | ||
| 2863 | doc: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database. | ||
| 2864 | This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the | ||
| 2865 | class, where INSTANCE is the name under which Emacs was invoked, or | ||
| 2866 | the name specified by the `-name' or `-rn' command-line arguments. | ||
| 2867 | |||
| 2868 | The optional arguments COMPONENT and SUBCLASS add to the key and the | ||
| 2869 | class, respectively. You must specify both of them or neither. | ||
| 2870 | If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE' | ||
| 2871 | and the class is `Emacs.CLASS.SUBCLASS'. */) | ||
| 2872 | (attribute, class, component, subclass) | ||
| 2873 | Lisp_Object attribute, class, component, subclass; | ||
| 2874 | { | ||
| 2875 | register char *value; | ||
| 2876 | char *name_key; | ||
| 2877 | char *class_key; | ||
| 2878 | |||
| 2879 | check_x (); | ||
| 2880 | |||
| 2881 | CHECK_STRING (attribute); | ||
| 2882 | CHECK_STRING (class); | ||
| 2883 | |||
| 2884 | if (!NILP (component)) | ||
| 2885 | CHECK_STRING (component); | ||
| 2886 | if (!NILP (subclass)) | ||
| 2887 | CHECK_STRING (subclass); | ||
| 2888 | if (NILP (component) != NILP (subclass)) | ||
| 2889 | error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | ||
| 2890 | |||
| 2891 | validate_x_resource_name (); | ||
| 2892 | |||
| 2893 | /* Allocate space for the components, the dots which separate them, | ||
| 2894 | and the final '\0'. Make them big enough for the worst case. */ | ||
| 2895 | name_key = (char *) alloca (SBYTES (Vx_resource_name) | ||
| 2896 | + (STRINGP (component) | ||
| 2897 | ? SBYTES (component) : 0) | ||
| 2898 | + SBYTES (attribute) | ||
| 2899 | + 3); | ||
| 2900 | |||
| 2901 | class_key = (char *) alloca (SBYTES (Vx_resource_class) | ||
| 2902 | + SBYTES (class) | ||
| 2903 | + (STRINGP (subclass) | ||
| 2904 | ? SBYTES (subclass) : 0) | ||
| 2905 | + 3); | ||
| 2906 | |||
| 2907 | /* Start with emacs.FRAMENAME for the name (the specific one) | ||
| 2908 | and with `Emacs' for the class key (the general one). */ | ||
| 2909 | strcpy (name_key, SDATA (Vx_resource_name)); | ||
| 2910 | strcpy (class_key, SDATA (Vx_resource_class)); | ||
| 2911 | |||
| 2912 | strcat (class_key, "."); | ||
| 2913 | strcat (class_key, SDATA (class)); | ||
| 2914 | |||
| 2915 | if (!NILP (component)) | ||
| 2916 | { | ||
| 2917 | strcat (class_key, "."); | ||
| 2918 | strcat (class_key, SDATA (subclass)); | ||
| 2919 | |||
| 2920 | strcat (name_key, "."); | ||
| 2921 | strcat (name_key, SDATA (component)); | ||
| 2922 | } | ||
| 2923 | |||
| 2924 | strcat (name_key, "."); | ||
| 2925 | strcat (name_key, SDATA (attribute)); | ||
| 2926 | |||
| 2927 | value = x_get_string_resource (check_x_display_info (Qnil)->xrdb, | ||
| 2928 | name_key, class_key); | ||
| 2929 | |||
| 2930 | if (value != (char *) 0) | ||
| 2931 | return build_string (value); | ||
| 2932 | else | ||
| 2933 | return Qnil; | ||
| 2934 | } | ||
| 2935 | |||
| 2936 | /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */ | ||
| 2937 | |||
| 2938 | Lisp_Object | ||
| 2939 | display_x_get_resource (dpyinfo, attribute, class, component, subclass) | ||
| 2940 | struct x_display_info *dpyinfo; | ||
| 2941 | Lisp_Object attribute, class, component, subclass; | ||
| 2942 | { | ||
| 2943 | register char *value; | ||
| 2944 | char *name_key; | ||
| 2945 | char *class_key; | ||
| 2946 | |||
| 2947 | CHECK_STRING (attribute); | ||
| 2948 | CHECK_STRING (class); | ||
| 2949 | |||
| 2950 | if (!NILP (component)) | ||
| 2951 | CHECK_STRING (component); | ||
| 2952 | if (!NILP (subclass)) | ||
| 2953 | CHECK_STRING (subclass); | ||
| 2954 | if (NILP (component) != NILP (subclass)) | ||
| 2955 | error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | ||
| 2956 | |||
| 2957 | validate_x_resource_name (); | ||
| 2958 | |||
| 2959 | /* Allocate space for the components, the dots which separate them, | ||
| 2960 | and the final '\0'. Make them big enough for the worst case. */ | ||
| 2961 | name_key = (char *) alloca (SBYTES (Vx_resource_name) | ||
| 2962 | + (STRINGP (component) | ||
| 2963 | ? SBYTES (component) : 0) | ||
| 2964 | + SBYTES (attribute) | ||
| 2965 | + 3); | ||
| 2966 | |||
| 2967 | class_key = (char *) alloca (SBYTES (Vx_resource_class) | ||
| 2968 | + SBYTES (class) | ||
| 2969 | + (STRINGP (subclass) | ||
| 2970 | ? SBYTES (subclass) : 0) | ||
| 2971 | + 3); | ||
| 2972 | |||
| 2973 | /* Start with emacs.FRAMENAME for the name (the specific one) | ||
| 2974 | and with `Emacs' for the class key (the general one). */ | ||
| 2975 | strcpy (name_key, SDATA (Vx_resource_name)); | ||
| 2976 | strcpy (class_key, SDATA (Vx_resource_class)); | ||
| 2977 | |||
| 2978 | strcat (class_key, "."); | ||
| 2979 | strcat (class_key, SDATA (class)); | ||
| 2980 | |||
| 2981 | if (!NILP (component)) | ||
| 2982 | { | ||
| 2983 | strcat (class_key, "."); | ||
| 2984 | strcat (class_key, SDATA (subclass)); | ||
| 2985 | |||
| 2986 | strcat (name_key, "."); | ||
| 2987 | strcat (name_key, SDATA (component)); | ||
| 2988 | } | ||
| 2989 | |||
| 2990 | strcat (name_key, "."); | ||
| 2991 | strcat (name_key, SDATA (attribute)); | ||
| 2992 | |||
| 2993 | value = x_get_string_resource (dpyinfo->xrdb, name_key, class_key); | ||
| 2994 | |||
| 2995 | if (value != (char *) 0) | ||
| 2996 | return build_string (value); | ||
| 2997 | else | ||
| 2998 | return Qnil; | ||
| 2999 | } | ||
| 3000 | |||
| 3001 | /* Used when C code wants a resource value. */ | ||
| 3002 | |||
| 3003 | char * | ||
| 3004 | x_get_resource_string (attribute, class) | ||
| 3005 | char *attribute, *class; | ||
| 3006 | { | ||
| 3007 | char *name_key; | ||
| 3008 | char *class_key; | ||
| 3009 | struct frame *sf = SELECTED_FRAME (); | ||
| 3010 | |||
| 3011 | /* Allocate space for the components, the dots which separate them, | ||
| 3012 | and the final '\0'. */ | ||
| 3013 | name_key = (char *) alloca (SBYTES (Vinvocation_name) | ||
| 3014 | + strlen (attribute) + 2); | ||
| 3015 | class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | ||
| 3016 | + strlen (class) + 2); | ||
| 3017 | |||
| 3018 | sprintf (name_key, "%s.%s", | ||
| 3019 | SDATA (Vinvocation_name), | ||
| 3020 | attribute); | ||
| 3021 | sprintf (class_key, "%s.%s", EMACS_CLASS, class); | ||
| 3022 | |||
| 3023 | return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb, | ||
| 3024 | name_key, class_key); | ||
| 3025 | } | ||
| 3026 | |||
| 3027 | /* Types we might convert a resource string into. */ | ||
| 3028 | enum resource_types | ||
| 3029 | { | ||
| 3030 | RES_TYPE_NUMBER, | ||
| 3031 | RES_TYPE_FLOAT, | ||
| 3032 | RES_TYPE_BOOLEAN, | ||
| 3033 | RES_TYPE_STRING, | ||
| 3034 | RES_TYPE_SYMBOL | ||
| 3035 | }; | ||
| 3036 | |||
| 3037 | /* Return the value of parameter PARAM. | ||
| 3038 | |||
| 3039 | First search ALIST, then Vdefault_frame_alist, then the X defaults | ||
| 3040 | database, using ATTRIBUTE as the attribute name and CLASS as its class. | ||
| 3041 | |||
| 3042 | Convert the resource to the type specified by desired_type. | ||
| 3043 | |||
| 3044 | If no default is specified, return Qunbound. If you call | ||
| 3045 | x_get_arg, make sure you deal with Qunbound in a reasonable way, | ||
| 3046 | and don't let it get stored in any Lisp-visible variables! */ | ||
| 3047 | |||
| 3048 | static Lisp_Object | ||
| 3049 | x_get_arg (dpyinfo, alist, param, attribute, class, type) | ||
| 3050 | struct x_display_info *dpyinfo; | ||
| 3051 | Lisp_Object alist, param; | ||
| 3052 | char *attribute; | ||
| 3053 | char *class; | ||
| 3054 | enum resource_types type; | ||
| 3055 | { | ||
| 3056 | register Lisp_Object tem; | ||
| 3057 | |||
| 3058 | tem = Fassq (param, alist); | ||
| 3059 | if (EQ (tem, Qnil)) | ||
| 3060 | tem = Fassq (param, Vdefault_frame_alist); | ||
| 3061 | if (EQ (tem, Qnil)) | ||
| 3062 | { | ||
| 3063 | |||
| 3064 | if (attribute) | ||
| 3065 | { | ||
| 3066 | tem = display_x_get_resource (dpyinfo, | ||
| 3067 | build_string (attribute), | ||
| 3068 | build_string (class), | ||
| 3069 | Qnil, Qnil); | ||
| 3070 | |||
| 3071 | if (NILP (tem)) | ||
| 3072 | return Qunbound; | ||
| 3073 | |||
| 3074 | switch (type) | ||
| 3075 | { | ||
| 3076 | case RES_TYPE_NUMBER: | ||
| 3077 | return make_number (atoi (SDATA (tem))); | ||
| 3078 | |||
| 3079 | case RES_TYPE_FLOAT: | ||
| 3080 | return make_float (atof (SDATA (tem))); | ||
| 3081 | |||
| 3082 | case RES_TYPE_BOOLEAN: | ||
| 3083 | tem = Fdowncase (tem); | ||
| 3084 | if (!strcmp (SDATA (tem), "on") | ||
| 3085 | || !strcmp (SDATA (tem), "true")) | ||
| 3086 | return Qt; | ||
| 3087 | else | ||
| 3088 | return Qnil; | ||
| 3089 | |||
| 3090 | case RES_TYPE_STRING: | ||
| 3091 | return tem; | ||
| 3092 | |||
| 3093 | case RES_TYPE_SYMBOL: | ||
| 3094 | /* As a special case, we map the values `true' and `on' | ||
| 3095 | to Qt, and `false' and `off' to Qnil. */ | ||
| 3096 | { | ||
| 3097 | Lisp_Object lower; | ||
| 3098 | lower = Fdowncase (tem); | ||
| 3099 | if (!strcmp (SDATA (lower), "on") | ||
| 3100 | || !strcmp (SDATA (lower), "true")) | ||
| 3101 | return Qt; | ||
| 3102 | else if (!strcmp (SDATA (lower), "off") | ||
| 3103 | || !strcmp (SDATA (lower), "false")) | ||
| 3104 | return Qnil; | ||
| 3105 | else | ||
| 3106 | return Fintern (tem, Qnil); | ||
| 3107 | } | ||
| 3108 | |||
| 3109 | default: | ||
| 3110 | abort (); | ||
| 3111 | } | ||
| 3112 | } | ||
| 3113 | else | ||
| 3114 | return Qunbound; | ||
| 3115 | } | ||
| 3116 | return Fcdr (tem); | ||
| 3117 | } | ||
| 3118 | |||
| 3119 | /* Like x_get_arg, but also record the value in f->param_alist. */ | ||
| 3120 | |||
| 3121 | static Lisp_Object | ||
| 3122 | x_get_and_record_arg (f, alist, param, attribute, class, type) | ||
| 3123 | struct frame *f; | ||
| 3124 | Lisp_Object alist, param; | ||
| 3125 | char *attribute; | ||
| 3126 | char *class; | ||
| 3127 | enum resource_types type; | ||
| 3128 | { | ||
| 3129 | Lisp_Object value; | ||
| 3130 | |||
| 3131 | value = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param, | ||
| 3132 | attribute, class, type); | ||
| 3133 | if (! NILP (value)) | ||
| 3134 | store_frame_param (f, param, value); | ||
| 3135 | |||
| 3136 | return value; | ||
| 3137 | } | ||
| 3138 | |||
| 3139 | /* Record in frame F the specified or default value according to ALIST | ||
| 3140 | of the parameter named PROP (a Lisp symbol). | ||
| 3141 | If no value is specified for PROP, look for an X default for XPROP | ||
| 3142 | on the frame named NAME. | ||
| 3143 | If that is not found either, use the value DEFLT. */ | ||
| 3144 | |||
| 3145 | static Lisp_Object | ||
| 3146 | x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | ||
| 3147 | struct frame *f; | ||
| 3148 | Lisp_Object alist; | ||
| 3149 | Lisp_Object prop; | ||
| 3150 | Lisp_Object deflt; | ||
| 3151 | char *xprop; | ||
| 3152 | char *xclass; | ||
| 3153 | enum resource_types type; | ||
| 3154 | { | ||
| 3155 | Lisp_Object tem; | ||
| 3156 | |||
| 3157 | tem = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, prop, xprop, xclass, type); | ||
| 3158 | if (EQ (tem, Qunbound)) | ||
| 3159 | tem = deflt; | ||
| 3160 | x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | ||
| 3161 | return tem; | ||
| 3162 | } | ||
| 3163 | |||
| 3164 | |||
| 3165 | /* Record in frame F the specified or default value according to ALIST | 1978 | /* Record in frame F the specified or default value according to ALIST |
| 3166 | of the parameter named PROP (a Lisp symbol). If no value is | 1979 | of the parameter named PROP (a Lisp symbol). If no value is |
| 3167 | specified for PROP, look for an X default for XPROP on the frame | 1980 | specified for PROP, look for an X default for XPROP on the frame |
| @@ -3216,209 +2029,6 @@ x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass, | |||
| 3216 | } | 2029 | } |
| 3217 | 2030 | ||
| 3218 | 2031 | ||
| 3219 | |||
| 3220 | DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, | ||
| 3221 | doc: /* Parse an X-style geometry string STRING. | ||
| 3222 | Returns an alist of the form ((top . TOP), (left . LEFT) ... ). | ||
| 3223 | The properties returned may include `top', `left', `height', and `width'. | ||
| 3224 | The value of `left' or `top' may be an integer, | ||
| 3225 | or a list (+ N) meaning N pixels relative to top/left corner, | ||
| 3226 | or a list (- N) meaning -N pixels relative to bottom/right corner. */) | ||
| 3227 | (string) | ||
| 3228 | Lisp_Object string; | ||
| 3229 | { | ||
| 3230 | int geometry, x, y; | ||
| 3231 | unsigned int width, height; | ||
| 3232 | Lisp_Object result; | ||
| 3233 | |||
| 3234 | CHECK_STRING (string); | ||
| 3235 | |||
| 3236 | geometry = XParseGeometry ((char *) SDATA (string), | ||
| 3237 | &x, &y, &width, &height); | ||
| 3238 | |||
| 3239 | #if 0 | ||
| 3240 | if (!!(geometry & XValue) != !!(geometry & YValue)) | ||
| 3241 | error ("Must specify both x and y position, or neither"); | ||
| 3242 | #endif | ||
| 3243 | |||
| 3244 | result = Qnil; | ||
| 3245 | if (geometry & XValue) | ||
| 3246 | { | ||
| 3247 | Lisp_Object element; | ||
| 3248 | |||
| 3249 | if (x >= 0 && (geometry & XNegative)) | ||
| 3250 | element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); | ||
| 3251 | else if (x < 0 && ! (geometry & XNegative)) | ||
| 3252 | element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | ||
| 3253 | else | ||
| 3254 | element = Fcons (Qleft, make_number (x)); | ||
| 3255 | result = Fcons (element, result); | ||
| 3256 | } | ||
| 3257 | |||
| 3258 | if (geometry & YValue) | ||
| 3259 | { | ||
| 3260 | Lisp_Object element; | ||
| 3261 | |||
| 3262 | if (y >= 0 && (geometry & YNegative)) | ||
| 3263 | element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); | ||
| 3264 | else if (y < 0 && ! (geometry & YNegative)) | ||
| 3265 | element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | ||
| 3266 | else | ||
| 3267 | element = Fcons (Qtop, make_number (y)); | ||
| 3268 | result = Fcons (element, result); | ||
| 3269 | } | ||
| 3270 | |||
| 3271 | if (geometry & WidthValue) | ||
| 3272 | result = Fcons (Fcons (Qwidth, make_number (width)), result); | ||
| 3273 | if (geometry & HeightValue) | ||
| 3274 | result = Fcons (Fcons (Qheight, make_number (height)), result); | ||
| 3275 | |||
| 3276 | return result; | ||
| 3277 | } | ||
| 3278 | |||
| 3279 | /* Calculate the desired size and position of this window, | ||
| 3280 | and return the flags saying which aspects were specified. | ||
| 3281 | |||
| 3282 | This function does not make the coordinates positive. */ | ||
| 3283 | |||
| 3284 | #define DEFAULT_ROWS 40 | ||
| 3285 | #define DEFAULT_COLS 80 | ||
| 3286 | |||
| 3287 | static int | ||
| 3288 | x_figure_window_size (f, parms) | ||
| 3289 | struct frame *f; | ||
| 3290 | Lisp_Object parms; | ||
| 3291 | { | ||
| 3292 | register Lisp_Object tem0, tem1, tem2; | ||
| 3293 | long window_prompting = 0; | ||
| 3294 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 3295 | |||
| 3296 | /* Default values if we fall through. | ||
| 3297 | Actually, if that happens we should get | ||
| 3298 | window manager prompting. */ | ||
| 3299 | SET_FRAME_WIDTH (f, DEFAULT_COLS); | ||
| 3300 | f->height = DEFAULT_ROWS; | ||
| 3301 | /* Window managers expect that if program-specified | ||
| 3302 | positions are not (0,0), they're intentional, not defaults. */ | ||
| 3303 | f->output_data.x->top_pos = 0; | ||
| 3304 | f->output_data.x->left_pos = 0; | ||
| 3305 | |||
| 3306 | tem0 = x_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER); | ||
| 3307 | tem1 = x_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER); | ||
| 3308 | tem2 = x_get_arg (dpyinfo, parms, Quser_size, 0, 0, RES_TYPE_NUMBER); | ||
| 3309 | if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | ||
| 3310 | { | ||
| 3311 | if (!EQ (tem0, Qunbound)) | ||
| 3312 | { | ||
| 3313 | CHECK_NUMBER (tem0); | ||
| 3314 | f->height = XINT (tem0); | ||
| 3315 | } | ||
| 3316 | if (!EQ (tem1, Qunbound)) | ||
| 3317 | { | ||
| 3318 | CHECK_NUMBER (tem1); | ||
| 3319 | SET_FRAME_WIDTH (f, XINT (tem1)); | ||
| 3320 | } | ||
| 3321 | if (!NILP (tem2) && !EQ (tem2, Qunbound)) | ||
| 3322 | window_prompting |= USSize; | ||
| 3323 | else | ||
| 3324 | window_prompting |= PSize; | ||
| 3325 | } | ||
| 3326 | |||
| 3327 | f->output_data.x->vertical_scroll_bar_extra | ||
| 3328 | = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) | ||
| 3329 | ? 0 | ||
| 3330 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); | ||
| 3331 | |||
| 3332 | compute_fringe_widths (f, 0); | ||
| 3333 | |||
| 3334 | f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); | ||
| 3335 | f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); | ||
| 3336 | |||
| 3337 | tem0 = x_get_arg (dpyinfo, parms, Qtop, 0, 0, RES_TYPE_NUMBER); | ||
| 3338 | tem1 = x_get_arg (dpyinfo, parms, Qleft, 0, 0, RES_TYPE_NUMBER); | ||
| 3339 | tem2 = x_get_arg (dpyinfo, parms, Quser_position, 0, 0, RES_TYPE_NUMBER); | ||
| 3340 | if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | ||
| 3341 | { | ||
| 3342 | if (EQ (tem0, Qminus)) | ||
| 3343 | { | ||
| 3344 | f->output_data.x->top_pos = 0; | ||
| 3345 | window_prompting |= YNegative; | ||
| 3346 | } | ||
| 3347 | else if (CONSP (tem0) && EQ (XCAR (tem0), Qminus) | ||
| 3348 | && CONSP (XCDR (tem0)) | ||
| 3349 | && INTEGERP (XCAR (XCDR (tem0)))) | ||
| 3350 | { | ||
| 3351 | f->output_data.x->top_pos = - XINT (XCAR (XCDR (tem0))); | ||
| 3352 | window_prompting |= YNegative; | ||
| 3353 | } | ||
| 3354 | else if (CONSP (tem0) && EQ (XCAR (tem0), Qplus) | ||
| 3355 | && CONSP (XCDR (tem0)) | ||
| 3356 | && INTEGERP (XCAR (XCDR (tem0)))) | ||
| 3357 | { | ||
| 3358 | f->output_data.x->top_pos = XINT (XCAR (XCDR (tem0))); | ||
| 3359 | } | ||
| 3360 | else if (EQ (tem0, Qunbound)) | ||
| 3361 | f->output_data.x->top_pos = 0; | ||
| 3362 | else | ||
| 3363 | { | ||
| 3364 | CHECK_NUMBER (tem0); | ||
| 3365 | f->output_data.x->top_pos = XINT (tem0); | ||
| 3366 | if (f->output_data.x->top_pos < 0) | ||
| 3367 | window_prompting |= YNegative; | ||
| 3368 | } | ||
| 3369 | |||
| 3370 | if (EQ (tem1, Qminus)) | ||
| 3371 | { | ||
| 3372 | f->output_data.x->left_pos = 0; | ||
| 3373 | window_prompting |= XNegative; | ||
| 3374 | } | ||
| 3375 | else if (CONSP (tem1) && EQ (XCAR (tem1), Qminus) | ||
| 3376 | && CONSP (XCDR (tem1)) | ||
| 3377 | && INTEGERP (XCAR (XCDR (tem1)))) | ||
| 3378 | { | ||
| 3379 | f->output_data.x->left_pos = - XINT (XCAR (XCDR (tem1))); | ||
| 3380 | window_prompting |= XNegative; | ||
| 3381 | } | ||
| 3382 | else if (CONSP (tem1) && EQ (XCAR (tem1), Qplus) | ||
| 3383 | && CONSP (XCDR (tem1)) | ||
| 3384 | && INTEGERP (XCAR (XCDR (tem1)))) | ||
| 3385 | { | ||
| 3386 | f->output_data.x->left_pos = XINT (XCAR (XCDR (tem1))); | ||
| 3387 | } | ||
| 3388 | else if (EQ (tem1, Qunbound)) | ||
| 3389 | f->output_data.x->left_pos = 0; | ||
| 3390 | else | ||
| 3391 | { | ||
| 3392 | CHECK_NUMBER (tem1); | ||
| 3393 | f->output_data.x->left_pos = XINT (tem1); | ||
| 3394 | if (f->output_data.x->left_pos < 0) | ||
| 3395 | window_prompting |= XNegative; | ||
| 3396 | } | ||
| 3397 | |||
| 3398 | if (!NILP (tem2) && ! EQ (tem2, Qunbound)) | ||
| 3399 | window_prompting |= USPosition; | ||
| 3400 | else | ||
| 3401 | window_prompting |= PPosition; | ||
| 3402 | } | ||
| 3403 | |||
| 3404 | if (f->output_data.x->want_fullscreen != FULLSCREEN_NONE) | ||
| 3405 | { | ||
| 3406 | int left, top; | ||
| 3407 | int width, height; | ||
| 3408 | |||
| 3409 | /* It takes both for some WM:s to place it where we want */ | ||
| 3410 | window_prompting = USPosition | PPosition; | ||
| 3411 | x_fullscreen_adjust (f, &width, &height, &top, &left); | ||
| 3412 | f->width = width; | ||
| 3413 | f->height = height; | ||
| 3414 | f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); | ||
| 3415 | f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); | ||
| 3416 | f->output_data.x->left_pos = left; | ||
| 3417 | f->output_data.x->top_pos = top; | ||
| 3418 | } | ||
| 3419 | |||
| 3420 | return window_prompting; | ||
| 3421 | } | ||
| 3422 | 2032 | ||
| 3423 | #if !defined (HAVE_X11R4) && !defined (HAVE_XSETWMPROTOCOLS) | 2033 | #if !defined (HAVE_X11R4) && !defined (HAVE_XSETWMPROTOCOLS) |
| 3424 | 2034 | ||
| @@ -4195,8 +2805,8 @@ x_icon (f, parms) | |||
| 4195 | 2805 | ||
| 4196 | /* Set the position of the icon. Note that twm groups all | 2806 | /* Set the position of the icon. Note that twm groups all |
| 4197 | icons in an icon window. */ | 2807 | icons in an icon window. */ |
| 4198 | icon_x = x_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); | 2808 | icon_x = x_frame_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); |
| 4199 | icon_y = x_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); | 2809 | icon_y = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); |
| 4200 | if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) | 2810 | if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
| 4201 | { | 2811 | { |
| 4202 | CHECK_NUMBER (icon_x); | 2812 | CHECK_NUMBER (icon_x); |
| @@ -4659,53 +3269,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4659 | 3269 | ||
| 4660 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; | 3270 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
| 4661 | 3271 | ||
| 4662 | /* Add the tool-bar height to the initial frame height so that the | ||
| 4663 | user gets a text display area of the size he specified with -g or | ||
| 4664 | via .Xdefaults. Later changes of the tool-bar height don't | ||
| 4665 | change the frame size. This is done so that users can create | ||
| 4666 | tall Emacs frames without having to guess how tall the tool-bar | ||
| 4667 | will get. */ | ||
| 4668 | if (FRAME_TOOL_BAR_LINES (f)) | ||
| 4669 | { | ||
| 4670 | int margin, relief, bar_height; | ||
| 4671 | |||
| 4672 | relief = (tool_bar_button_relief >= 0 | ||
| 4673 | ? tool_bar_button_relief | ||
| 4674 | : DEFAULT_TOOL_BAR_BUTTON_RELIEF); | ||
| 4675 | |||
| 4676 | if (INTEGERP (Vtool_bar_button_margin) | ||
| 4677 | && XINT (Vtool_bar_button_margin) > 0) | ||
| 4678 | margin = XFASTINT (Vtool_bar_button_margin); | ||
| 4679 | else if (CONSP (Vtool_bar_button_margin) | ||
| 4680 | && INTEGERP (XCDR (Vtool_bar_button_margin)) | ||
| 4681 | && XINT (XCDR (Vtool_bar_button_margin)) > 0) | ||
| 4682 | margin = XFASTINT (XCDR (Vtool_bar_button_margin)); | ||
| 4683 | else | ||
| 4684 | margin = 0; | ||
| 4685 | |||
| 4686 | bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; | ||
| 4687 | f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); | ||
| 4688 | } | ||
| 4689 | |||
| 4690 | /* Compute the size of the X window. */ | 3272 | /* Compute the size of the X window. */ |
| 4691 | window_prompting = x_figure_window_size (f, parms); | 3273 | window_prompting = x_figure_window_size (f, parms, 1); |
| 4692 | |||
| 4693 | if (window_prompting & XNegative) | ||
| 4694 | { | ||
| 4695 | if (window_prompting & YNegative) | ||
| 4696 | f->output_data.x->win_gravity = SouthEastGravity; | ||
| 4697 | else | ||
| 4698 | f->output_data.x->win_gravity = NorthEastGravity; | ||
| 4699 | } | ||
| 4700 | else | ||
| 4701 | { | ||
| 4702 | if (window_prompting & YNegative) | ||
| 4703 | f->output_data.x->win_gravity = SouthWestGravity; | ||
| 4704 | else | ||
| 4705 | f->output_data.x->win_gravity = NorthWestGravity; | ||
| 4706 | } | ||
| 4707 | |||
| 4708 | f->output_data.x->size_hint_flags = window_prompting; | ||
| 4709 | 3274 | ||
| 4710 | tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); | 3275 | tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
| 4711 | f->no_split = minibuffer_only || EQ (tem, Qt); | 3276 | f->no_split = minibuffer_only || EQ (tem, Qt); |
| @@ -11216,24 +9781,9 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 11216 | init_frame_faces (f); | 9781 | init_frame_faces (f); |
| 11217 | 9782 | ||
| 11218 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; | 9783 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
| 11219 | window_prompting = x_figure_window_size (f, parms); | ||
| 11220 | 9784 | ||
| 11221 | if (window_prompting & XNegative) | 9785 | window_prompting = x_figure_window_size (f, parms, 0); |
| 11222 | { | ||
| 11223 | if (window_prompting & YNegative) | ||
| 11224 | f->output_data.x->win_gravity = SouthEastGravity; | ||
| 11225 | else | ||
| 11226 | f->output_data.x->win_gravity = NorthEastGravity; | ||
| 11227 | } | ||
| 11228 | else | ||
| 11229 | { | ||
| 11230 | if (window_prompting & YNegative) | ||
| 11231 | f->output_data.x->win_gravity = SouthWestGravity; | ||
| 11232 | else | ||
| 11233 | f->output_data.x->win_gravity = NorthWestGravity; | ||
| 11234 | } | ||
| 11235 | 9786 | ||
| 11236 | f->output_data.x->size_hint_flags = window_prompting; | ||
| 11237 | { | 9787 | { |
| 11238 | XSetWindowAttributes attrs; | 9788 | XSetWindowAttributes attrs; |
| 11239 | unsigned long mask; | 9789 | unsigned long mask; |
| @@ -11973,6 +10523,42 @@ usual X keysyms. */) | |||
| 11973 | Initialization | 10523 | Initialization |
| 11974 | ***********************************************************************/ | 10524 | ***********************************************************************/ |
| 11975 | 10525 | ||
| 10526 | /* Keep this list in the same order as frame_parms in frame.c. | ||
| 10527 | Use 0 for unsupported frame parameters. */ | ||
| 10528 | |||
| 10529 | frame_parm_handler x_frame_parm_handlers[] = | ||
| 10530 | { | ||
| 10531 | x_set_autoraise, | ||
| 10532 | x_set_autolower, | ||
| 10533 | x_set_background_color, | ||
| 10534 | x_set_border_color, | ||
| 10535 | x_set_border_width, | ||
| 10536 | x_set_cursor_color, | ||
| 10537 | x_set_cursor_type, | ||
| 10538 | x_set_font, | ||
| 10539 | x_set_foreground_color, | ||
| 10540 | x_set_icon_name, | ||
| 10541 | x_set_icon_type, | ||
| 10542 | x_set_internal_border_width, | ||
| 10543 | x_set_menu_bar_lines, | ||
| 10544 | x_set_mouse_color, | ||
| 10545 | x_explicitly_set_name, | ||
| 10546 | x_set_scroll_bar_width, | ||
| 10547 | x_set_title, | ||
| 10548 | x_set_unsplittable, | ||
| 10549 | x_set_vertical_scroll_bars, | ||
| 10550 | x_set_visibility, | ||
| 10551 | x_set_tool_bar_lines, | ||
| 10552 | x_set_scroll_bar_foreground, | ||
| 10553 | x_set_scroll_bar_background, | ||
| 10554 | x_set_screen_gamma, | ||
| 10555 | x_set_line_spacing, | ||
| 10556 | x_set_fringe_width, | ||
| 10557 | x_set_fringe_width, | ||
| 10558 | x_set_wait_for_wm, | ||
| 10559 | x_set_fullscreen, | ||
| 10560 | }; | ||
| 10561 | |||
| 11976 | void | 10562 | void |
| 11977 | syms_of_xfns () | 10563 | syms_of_xfns () |
| 11978 | { | 10564 | { |
| @@ -11982,86 +10568,18 @@ syms_of_xfns () | |||
| 11982 | /* The section below is built by the lisp expression at the top of the file, | 10568 | /* The section below is built by the lisp expression at the top of the file, |
| 11983 | just above where these variables are declared. */ | 10569 | just above where these variables are declared. */ |
| 11984 | /*&&& init symbols here &&&*/ | 10570 | /*&&& init symbols here &&&*/ |
| 11985 | Qauto_raise = intern ("auto-raise"); | ||
| 11986 | staticpro (&Qauto_raise); | ||
| 11987 | Qauto_lower = intern ("auto-lower"); | ||
| 11988 | staticpro (&Qauto_lower); | ||
| 11989 | Qborder_color = intern ("border-color"); | ||
| 11990 | staticpro (&Qborder_color); | ||
| 11991 | Qborder_width = intern ("border-width"); | ||
| 11992 | staticpro (&Qborder_width); | ||
| 11993 | Qcursor_color = intern ("cursor-color"); | ||
| 11994 | staticpro (&Qcursor_color); | ||
| 11995 | Qcursor_type = intern ("cursor-type"); | ||
| 11996 | staticpro (&Qcursor_type); | ||
| 11997 | Qgeometry = intern ("geometry"); | ||
| 11998 | staticpro (&Qgeometry); | ||
| 11999 | Qicon_left = intern ("icon-left"); | ||
| 12000 | staticpro (&Qicon_left); | ||
| 12001 | Qicon_top = intern ("icon-top"); | ||
| 12002 | staticpro (&Qicon_top); | ||
| 12003 | Qicon_type = intern ("icon-type"); | ||
| 12004 | staticpro (&Qicon_type); | ||
| 12005 | Qicon_name = intern ("icon-name"); | ||
| 12006 | staticpro (&Qicon_name); | ||
| 12007 | Qinternal_border_width = intern ("internal-border-width"); | ||
| 12008 | staticpro (&Qinternal_border_width); | ||
| 12009 | Qleft = intern ("left"); | ||
| 12010 | staticpro (&Qleft); | ||
| 12011 | Qright = intern ("right"); | ||
| 12012 | staticpro (&Qright); | ||
| 12013 | Qmouse_color = intern ("mouse-color"); | ||
| 12014 | staticpro (&Qmouse_color); | ||
| 12015 | Qnone = intern ("none"); | 10571 | Qnone = intern ("none"); |
| 12016 | staticpro (&Qnone); | 10572 | staticpro (&Qnone); |
| 12017 | Qparent_id = intern ("parent-id"); | ||
| 12018 | staticpro (&Qparent_id); | ||
| 12019 | Qscroll_bar_width = intern ("scroll-bar-width"); | ||
| 12020 | staticpro (&Qscroll_bar_width); | ||
| 12021 | Qsuppress_icon = intern ("suppress-icon"); | 10573 | Qsuppress_icon = intern ("suppress-icon"); |
| 12022 | staticpro (&Qsuppress_icon); | 10574 | staticpro (&Qsuppress_icon); |
| 12023 | Qundefined_color = intern ("undefined-color"); | 10575 | Qundefined_color = intern ("undefined-color"); |
| 12024 | staticpro (&Qundefined_color); | 10576 | staticpro (&Qundefined_color); |
| 12025 | Qvertical_scroll_bars = intern ("vertical-scroll-bars"); | ||
| 12026 | staticpro (&Qvertical_scroll_bars); | ||
| 12027 | Qvisibility = intern ("visibility"); | ||
| 12028 | staticpro (&Qvisibility); | ||
| 12029 | Qwindow_id = intern ("window-id"); | ||
| 12030 | staticpro (&Qwindow_id); | ||
| 12031 | Qouter_window_id = intern ("outer-window-id"); | ||
| 12032 | staticpro (&Qouter_window_id); | ||
| 12033 | Qx_frame_parameter = intern ("x-frame-parameter"); | ||
| 12034 | staticpro (&Qx_frame_parameter); | ||
| 12035 | Qx_resource_name = intern ("x-resource-name"); | ||
| 12036 | staticpro (&Qx_resource_name); | ||
| 12037 | Quser_position = intern ("user-position"); | ||
| 12038 | staticpro (&Quser_position); | ||
| 12039 | Quser_size = intern ("user-size"); | ||
| 12040 | staticpro (&Quser_size); | ||
| 12041 | Qscroll_bar_foreground = intern ("scroll-bar-foreground"); | ||
| 12042 | staticpro (&Qscroll_bar_foreground); | ||
| 12043 | Qscroll_bar_background = intern ("scroll-bar-background"); | ||
| 12044 | staticpro (&Qscroll_bar_background); | ||
| 12045 | Qscreen_gamma = intern ("screen-gamma"); | ||
| 12046 | staticpro (&Qscreen_gamma); | ||
| 12047 | Qline_spacing = intern ("line-spacing"); | ||
| 12048 | staticpro (&Qline_spacing); | ||
| 12049 | Qcenter = intern ("center"); | 10577 | Qcenter = intern ("center"); |
| 12050 | staticpro (&Qcenter); | 10578 | staticpro (&Qcenter); |
| 12051 | Qcompound_text = intern ("compound-text"); | 10579 | Qcompound_text = intern ("compound-text"); |
| 12052 | staticpro (&Qcompound_text); | 10580 | staticpro (&Qcompound_text); |
| 12053 | Qcancel_timer = intern ("cancel-timer"); | 10581 | Qcancel_timer = intern ("cancel-timer"); |
| 12054 | staticpro (&Qcancel_timer); | 10582 | staticpro (&Qcancel_timer); |
| 12055 | Qwait_for_wm = intern ("wait-for-wm"); | ||
| 12056 | staticpro (&Qwait_for_wm); | ||
| 12057 | Qfullscreen = intern ("fullscreen"); | ||
| 12058 | staticpro (&Qfullscreen); | ||
| 12059 | Qfullwidth = intern ("fullwidth"); | ||
| 12060 | staticpro (&Qfullwidth); | ||
| 12061 | Qfullheight = intern ("fullheight"); | ||
| 12062 | staticpro (&Qfullheight); | ||
| 12063 | Qfullboth = intern ("fullboth"); | ||
| 12064 | staticpro (&Qfullboth); | ||
| 12065 | /* This is the end of symbol initialization. */ | 10583 | /* This is the end of symbol initialization. */ |
| 12066 | 10584 | ||
| 12067 | /* Text property `display' should be nonsticky by default. */ | 10585 | /* Text property `display' should be nonsticky by default. */ |
| @@ -12084,16 +10602,11 @@ syms_of_xfns () | |||
| 12084 | QCmask = intern (":mask"); | 10602 | QCmask = intern (":mask"); |
| 12085 | staticpro (&QCmask); | 10603 | staticpro (&QCmask); |
| 12086 | 10604 | ||
| 12087 | Qface_set_after_frame_default = intern ("face-set-after-frame-default"); | ||
| 12088 | staticpro (&Qface_set_after_frame_default); | ||
| 12089 | |||
| 12090 | Fput (Qundefined_color, Qerror_conditions, | 10605 | Fput (Qundefined_color, Qerror_conditions, |
| 12091 | Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | 10606 | Fcons (Qundefined_color, Fcons (Qerror, Qnil))); |
| 12092 | Fput (Qundefined_color, Qerror_message, | 10607 | Fput (Qundefined_color, Qerror_message, |
| 12093 | build_string ("Undefined color")); | 10608 | build_string ("Undefined color")); |
| 12094 | 10609 | ||
| 12095 | init_x_parm_symbols (); | ||
| 12096 | |||
| 12097 | DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, | 10610 | DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, |
| 12098 | doc: /* Non-nil means always draw a cross over disabled images. | 10611 | doc: /* Non-nil means always draw a cross over disabled images. |
| 12099 | Disabled images are those having an `:conversion disabled' property. | 10612 | Disabled images are those having an `:conversion disabled' property. |
| @@ -12110,30 +10623,6 @@ Changing the value does not affect existing frames | |||
| 12110 | unless you set the mouse color. */); | 10623 | unless you set the mouse color. */); |
| 12111 | Vx_pointer_shape = Qnil; | 10624 | Vx_pointer_shape = Qnil; |
| 12112 | 10625 | ||
| 12113 | DEFVAR_LISP ("x-resource-name", &Vx_resource_name, | ||
| 12114 | doc: /* The name Emacs uses to look up X resources. | ||
| 12115 | `x-get-resource' uses this as the first component of the instance name | ||
| 12116 | when requesting resource values. | ||
| 12117 | Emacs initially sets `x-resource-name' to the name under which Emacs | ||
| 12118 | was invoked, or to the value specified with the `-name' or `-rn' | ||
| 12119 | switches, if present. | ||
| 12120 | |||
| 12121 | It may be useful to bind this variable locally around a call | ||
| 12122 | to `x-get-resource'. See also the variable `x-resource-class'. */); | ||
| 12123 | Vx_resource_name = Qnil; | ||
| 12124 | |||
| 12125 | DEFVAR_LISP ("x-resource-class", &Vx_resource_class, | ||
| 12126 | doc: /* The class Emacs uses to look up X resources. | ||
| 12127 | `x-get-resource' uses this as the first component of the instance class | ||
| 12128 | when requesting resource values. | ||
| 12129 | |||
| 12130 | Emacs initially sets `x-resource-class' to "Emacs". | ||
| 12131 | |||
| 12132 | Setting this variable permanently is not a reasonable thing to do, | ||
| 12133 | but binding this variable locally around a call to `x-get-resource' | ||
| 12134 | is a reasonable practice. See also the variable `x-resource-name'. */); | ||
| 12135 | Vx_resource_class = build_string (EMACS_CLASS); | ||
| 12136 | |||
| 12137 | #if 0 /* This doesn't really do anything. */ | 10626 | #if 0 /* This doesn't really do anything. */ |
| 12138 | DEFVAR_LISP ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, | 10627 | DEFVAR_LISP ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, |
| 12139 | doc: /* The shape of the pointer when not over text. | 10628 | doc: /* The shape of the pointer when not over text. |
| @@ -12224,8 +10713,6 @@ meaning don't clear the cache. */); | |||
| 12224 | #endif /* USE_MOTIF */ | 10713 | #endif /* USE_MOTIF */ |
| 12225 | #endif /* USE_X_TOOLKIT */ | 10714 | #endif /* USE_X_TOOLKIT */ |
| 12226 | 10715 | ||
| 12227 | defsubr (&Sx_get_resource); | ||
| 12228 | |||
| 12229 | /* X window properties. */ | 10716 | /* X window properties. */ |
| 12230 | defsubr (&Sx_change_window_property); | 10717 | defsubr (&Sx_change_window_property); |
| 12231 | defsubr (&Sx_delete_window_property); | 10718 | defsubr (&Sx_delete_window_property); |
| @@ -12248,7 +10735,6 @@ meaning don't clear the cache. */); | |||
| 12248 | defsubr (&Sx_display_visual_class); | 10735 | defsubr (&Sx_display_visual_class); |
| 12249 | defsubr (&Sx_display_backing_store); | 10736 | defsubr (&Sx_display_backing_store); |
| 12250 | defsubr (&Sx_display_save_under); | 10737 | defsubr (&Sx_display_save_under); |
| 12251 | defsubr (&Sx_parse_geometry); | ||
| 12252 | defsubr (&Sx_create_frame); | 10738 | defsubr (&Sx_create_frame); |
| 12253 | defsubr (&Sx_open_connection); | 10739 | defsubr (&Sx_open_connection); |
| 12254 | defsubr (&Sx_close_connection); | 10740 | defsubr (&Sx_close_connection); |