Mercurial > hg > xemacs-beta
comparison src/frame.c @ 438:84b14dcb0985 r21-2-27
Import from CVS: tag r21-2-27
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:32:25 +0200 |
parents | 3ecd8885ac67 |
children | 8de8e3f6228a |
comparison
equal
deleted
inserted
replaced
437:e2a4e8b94b82 | 438:84b14dcb0985 |
---|---|
114 other way of getting it if it isn't the selected frame. */ | 114 other way of getting it if it isn't the selected frame. */ |
115 Lisp_Object Vframe_being_created; | 115 Lisp_Object Vframe_being_created; |
116 Lisp_Object Qframe_being_created; | 116 Lisp_Object Qframe_being_created; |
117 | 117 |
118 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); | 118 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); |
119 static struct display_line title_string_display_line; | |
120 /* Used by generate_title_string. Global because they get used so much that | |
121 the dynamic allocation time adds up. */ | |
122 static Emchar_dynarr *title_string_emchar_dynarr; | |
119 | 123 |
120 EXFUN (Fset_frame_properties, 2); | 124 EXFUN (Fset_frame_properties, 2); |
121 | 125 |
122 | 126 |
123 static Lisp_Object | 127 static Lisp_Object |
2672 else | 2676 else |
2673 default_face_height_and_width_1 (frame, &cph, &cpw); | 2677 default_face_height_and_width_1 (frame, &cph, &cpw); |
2674 | 2678 |
2675 window = FRAME_SELECTED_WINDOW (f); | 2679 window = FRAME_SELECTED_WINDOW (f); |
2676 | 2680 |
2677 egw = max (glyph_width (Vcontinuation_glyph, Vdefault_face, 0, window), | 2681 egw = max (glyph_width (Vcontinuation_glyph, window), |
2678 glyph_width (Vtruncation_glyph, Vdefault_face, 0, window)); | 2682 glyph_width (Vtruncation_glyph, window)); |
2679 egw = max (egw, cpw); | 2683 egw = max (egw, cpw); |
2680 bdr = 2 * f->internal_border_width; | 2684 bdr = 2 * f->internal_border_width; |
2681 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) + | 2685 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) + |
2682 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) + | 2686 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) + |
2683 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) + | 2687 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) + |
2848 /* Adjust the width for the end glyph which may be a different width | 2852 /* Adjust the width for the end glyph which may be a different width |
2849 than the default character width. */ | 2853 than the default character width. */ |
2850 { | 2854 { |
2851 int adjustment, trunc_width, cont_width; | 2855 int adjustment, trunc_width, cont_width; |
2852 | 2856 |
2853 trunc_width = glyph_width (Vtruncation_glyph, Vdefault_face, 0, | 2857 trunc_width = glyph_width (Vtruncation_glyph, |
2854 FRAME_SELECTED_WINDOW (f)); | 2858 FRAME_SELECTED_WINDOW (f)); |
2855 cont_width = glyph_width (Vcontinuation_glyph, Vdefault_face, 0, | 2859 cont_width = glyph_width (Vcontinuation_glyph, |
2856 FRAME_SELECTED_WINDOW (f)); | 2860 FRAME_SELECTED_WINDOW (f)); |
2857 adjustment = max (trunc_width, cont_width); | 2861 adjustment = max (trunc_width, cont_width); |
2858 adjustment = max (adjustment, font_width); | 2862 adjustment = max (adjustment, font_width); |
2859 | 2863 |
2860 new_pixwidth += adjustment; | 2864 new_pixwidth += adjustment; |
2965 else | 2969 else |
2966 change_frame_size_1 (f, newheight, newwidth); | 2970 change_frame_size_1 (f, newheight, newwidth); |
2967 } | 2971 } |
2968 | 2972 |
2969 | 2973 |
2974 /* The caller is responsible for freeing the returned string. */ | |
2975 static Bufbyte * | |
2976 generate_title_string (struct window *w, Lisp_Object format_str, | |
2977 face_index findex, int type) | |
2978 { | |
2979 struct display_line *dl; | |
2980 struct display_block *db; | |
2981 int elt = 0; | |
2982 | |
2983 dl = &title_string_display_line; | |
2984 db = get_display_block_from_line (dl, TEXT); | |
2985 Dynarr_reset (db->runes); | |
2986 | |
2987 generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0, | |
2988 -1, type); | |
2989 | |
2990 Dynarr_reset (title_string_emchar_dynarr); | |
2991 while (elt < Dynarr_length (db->runes)) | |
2992 { | |
2993 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) | |
2994 Dynarr_add (title_string_emchar_dynarr, | |
2995 Dynarr_atp (db->runes, elt)->object.chr.ch); | |
2996 elt++; | |
2997 } | |
2998 | |
2999 return | |
3000 convert_emchar_string_into_malloced_string | |
3001 (Dynarr_atp (title_string_emchar_dynarr, 0), | |
3002 Dynarr_length (title_string_emchar_dynarr), 0); | |
3003 } | |
3004 | |
2970 void | 3005 void |
2971 update_frame_title (struct frame *f) | 3006 update_frame_title (struct frame *f) |
2972 { | 3007 { |
2973 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 3008 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
2974 Lisp_Object title_format; | 3009 Lisp_Object title_format; |
2988 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer); | 3023 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer); |
2989 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer); | 3024 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer); |
2990 | 3025 |
2991 if (HAS_FRAMEMETH_P (f, set_title_from_bufbyte)) | 3026 if (HAS_FRAMEMETH_P (f, set_title_from_bufbyte)) |
2992 { | 3027 { |
2993 title = generate_formatted_string (w, title_format, Qnil, | 3028 title = generate_title_string (w, title_format, |
2994 DEFAULT_INDEX, CURRENT_DISP); | 3029 DEFAULT_INDEX, CURRENT_DISP); |
2995 FRAMEMETH (f, set_title_from_bufbyte, (f, title)); | 3030 FRAMEMETH (f, set_title_from_bufbyte, (f, title)); |
2996 } | 3031 } |
2997 | 3032 |
2998 if (HAS_FRAMEMETH_P (f, set_icon_name_from_bufbyte)) | 3033 if (HAS_FRAMEMETH_P (f, set_icon_name_from_bufbyte)) |
2999 { | 3034 { |
3000 if (!EQ (icon_format, title_format) || !title) | 3035 if (!EQ (icon_format, title_format) || !title) |
3001 { | 3036 { |
3002 if (title) | 3037 if (title) |
3003 xfree (title); | 3038 xfree (title); |
3004 | 3039 |
3005 title = generate_formatted_string (w, icon_format, Qnil, | 3040 title = generate_title_string (w, icon_format, |
3006 DEFAULT_INDEX, CURRENT_DISP); | 3041 DEFAULT_INDEX, CURRENT_DISP); |
3007 } | 3042 } |
3008 FRAMEMETH (f, set_icon_name_from_bufbyte, (f, title)); | 3043 FRAMEMETH (f, set_icon_name_from_bufbyte, (f, title)); |
3009 } | 3044 } |
3010 | 3045 |
3011 if (title) | 3046 if (title) |
3060 { | 3095 { |
3061 MARK_ICON_CHANGED; | 3096 MARK_ICON_CHANGED; |
3062 } | 3097 } |
3063 | 3098 |
3064 | 3099 |
3100 /***************************************************************************/ | |
3101 /* */ | |
3102 /* initialization */ | |
3103 /* */ | |
3104 /***************************************************************************/ | |
3105 | |
3106 void | |
3107 init_frame (void) | |
3108 { | |
3109 #ifndef PDUMP | |
3110 if (!initialized) | |
3111 #endif | |
3112 { | |
3113 title_string_emchar_dynarr = Dynarr_new (Emchar); | |
3114 xzero (title_string_display_line); | |
3115 } | |
3116 } | |
3117 | |
3065 void | 3118 void |
3066 syms_of_frame (void) | 3119 syms_of_frame (void) |
3067 { | 3120 { |
3068 defsymbol (&Qdelete_frame_hook, "delete-frame-hook"); | 3121 defsymbol (&Qdelete_frame_hook, "delete-frame-hook"); |
3069 defsymbol (&Qselect_frame_hook, "select-frame-hook"); | 3122 defsymbol (&Qselect_frame_hook, "select-frame-hook"); |