Mercurial > hg > xemacs-beta
comparison src/window.c @ 456:e7ef97881643 r21-2-43
Import from CVS: tag r21-2-43
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:41:24 +0200 |
parents | 98528da0b7fc |
children | c33ae14dd6d0 |
comparison
equal
deleted
inserted
replaced
455:5b97c1cd6ed0 | 456:e7ef97881643 |
---|---|
5004 Lisp_Object root_window; | 5004 Lisp_Object root_window; |
5005 int minibuf_height; /* 0 = no minibuffer, <0, size in lines, >0 in pixels */ | 5005 int minibuf_height; /* 0 = no minibuffer, <0, size in lines, >0 in pixels */ |
5006 /* Record the values of window-min-width and window-min-height | 5006 /* Record the values of window-min-width and window-min-height |
5007 so that window sizes remain consistent with them. */ | 5007 so that window sizes remain consistent with them. */ |
5008 int min_width, min_height; | 5008 int min_width, min_height; |
5009 int saved_windows_count; | 5009 unsigned int saved_windows_count; |
5010 /* Zero-sized arrays aren't ANSI C */ | 5010 /* Zero-sized arrays aren't ANSI C */ |
5011 struct saved_window saved_windows[1]; | 5011 struct saved_window saved_windows[1]; |
5012 }; | 5012 }; |
5013 | 5013 |
5014 #define SAVED_WINDOW_N(conf, n) (&((conf)->saved_windows[(n)])) | 5014 #define SAVED_WINDOW_N(conf, n) (&((conf)->saved_windows[(n)])) |
5019 | 5019 |
5020 static Lisp_Object | 5020 static Lisp_Object |
5021 mark_window_config (Lisp_Object obj) | 5021 mark_window_config (Lisp_Object obj) |
5022 { | 5022 { |
5023 struct window_config *config = XWINDOW_CONFIGURATION (obj); | 5023 struct window_config *config = XWINDOW_CONFIGURATION (obj); |
5024 int i; | 5024 unsigned int i; |
5025 mark_object (config->current_window); | 5025 mark_object (config->current_window); |
5026 mark_object (config->current_buffer); | 5026 mark_object (config->current_buffer); |
5027 mark_object (config->minibuffer_scroll_window); | 5027 mark_object (config->minibuffer_scroll_window); |
5028 mark_object (config->root_window); | 5028 mark_object (config->root_window); |
5029 | 5029 |
5048 #endif | 5048 #endif |
5049 } | 5049 } |
5050 return Qnil; | 5050 return Qnil; |
5051 } | 5051 } |
5052 | 5052 |
5053 static size_t | 5053 inline static size_t |
5054 sizeof_window_config_for_n_windows (int n) | 5054 sizeof_window_config_for_n_windows (unsigned int n) |
5055 { | 5055 { |
5056 return (sizeof (struct window_config) + | 5056 return FLEXIBLE_ARRAY_STRUCT_SIZEOF (struct window_config, |
5057 /* n - 1 because zero-sized arrays aren't ANSI C */ | 5057 struct saved_window, saved_windows, n); |
5058 (n - 1) *sizeof (struct saved_window)); | |
5059 } | 5058 } |
5060 | 5059 |
5061 static size_t | 5060 static size_t |
5062 sizeof_window_config (const void *h) | 5061 sizeof_window_config (const void *h) |
5063 { | 5062 { |
5118 are identical. */ | 5117 are identical. */ |
5119 static int | 5118 static int |
5120 window_config_equal (Lisp_Object conf1, Lisp_Object conf2) | 5119 window_config_equal (Lisp_Object conf1, Lisp_Object conf2) |
5121 { | 5120 { |
5122 struct window_config *fig1, *fig2; | 5121 struct window_config *fig1, *fig2; |
5123 int i; | 5122 unsigned int i; |
5124 | 5123 |
5125 /* First check if they are truly the same. */ | 5124 /* First check if they are truly the same. */ |
5126 if (EQ (conf1, conf2)) | 5125 if (EQ (conf1, conf2)) |
5127 return 1; | 5126 return 1; |
5128 | 5127 |
5173 | 5172 |
5174 /* Lisp_Object return value so it can be used in record_unwind_protect() */ | 5173 /* Lisp_Object return value so it can be used in record_unwind_protect() */ |
5175 static Lisp_Object | 5174 static Lisp_Object |
5176 free_window_configuration (Lisp_Object window_config) | 5175 free_window_configuration (Lisp_Object window_config) |
5177 { | 5176 { |
5178 int i; | 5177 unsigned int i; |
5179 struct window_config *config = XWINDOW_CONFIGURATION (window_config); | 5178 struct window_config *config = XWINDOW_CONFIGURATION (window_config); |
5180 | 5179 |
5181 /* Free all the markers. It's not completely necessary that | 5180 /* Free all the markers. It's not completely necessary that |
5182 we do this (window configs sitting in a free list aren't | 5181 we do this (window configs sitting in a free list aren't |
5183 marked normally so the markers wouldn't be marked anyway) | 5182 marked normally so the markers wouldn't be marked anyway) |
5225 { | 5224 { |
5226 struct window *w; | 5225 struct window *w; |
5227 struct window_config *config; | 5226 struct window_config *config; |
5228 struct saved_window *p; | 5227 struct saved_window *p; |
5229 Lisp_Object new_current_buffer; | 5228 Lisp_Object new_current_buffer; |
5230 int k; | 5229 unsigned int k; |
5231 Lisp_Object frame; | 5230 Lisp_Object frame; |
5232 struct frame *f; | 5231 struct frame *f; |
5233 struct gcpro gcpro1; | 5232 struct gcpro gcpro1; |
5234 Lisp_Object old_window_config; | 5233 Lisp_Object old_window_config; |
5235 /* int previous_frame_height; | 5234 /* int previous_frame_height; |
5723 | 5722 |
5724 mark_window_as_deleted (w); | 5723 mark_window_as_deleted (w); |
5725 } | 5724 } |
5726 | 5725 |
5727 | 5726 |
5728 static int | 5727 static unsigned int |
5729 count_windows (struct window *window) | 5728 count_windows (struct window *window) |
5730 { | 5729 { |
5731 return 1 + | 5730 return 1 + |
5732 (!NILP (window->next) ? count_windows (XWINDOW (window->next)) : 0) + | 5731 (!NILP (window->next) ? count_windows (XWINDOW (window->next)) : 0) + |
5733 (!NILP (window->vchild) ? count_windows (XWINDOW (window->vchild)) : 0) + | 5732 (!NILP (window->vchild) ? count_windows (XWINDOW (window->vchild)) : 0) + |
5838 (frame)) | 5837 (frame)) |
5839 { | 5838 { |
5840 Lisp_Object result; | 5839 Lisp_Object result; |
5841 struct frame *f = decode_frame (frame); | 5840 struct frame *f = decode_frame (frame); |
5842 struct window_config *config; | 5841 struct window_config *config; |
5843 int n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); | 5842 unsigned int n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
5844 int minibuf_height; | 5843 int minibuf_height; |
5845 int real_font_height; | 5844 int real_font_height; |
5846 | 5845 |
5847 if (n_windows <= countof (Vwindow_configuration_free_list)) | 5846 if (n_windows <= countof (Vwindow_configuration_free_list)) |
5848 config = XWINDOW_CONFIGURATION (allocate_managed_lcrecord | 5847 config = XWINDOW_CONFIGURATION (allocate_managed_lcrecord |
6150 } | 6149 } |
6151 | 6150 |
6152 void | 6151 void |
6153 reinit_vars_of_window (void) | 6152 reinit_vars_of_window (void) |
6154 { | 6153 { |
6155 int i; | 6154 unsigned int i; |
6156 /* Make sure all windows get marked */ | 6155 /* Make sure all windows get marked */ |
6157 minibuf_window = Qnil; | 6156 minibuf_window = Qnil; |
6158 staticpro_nodump (&minibuf_window); | 6157 staticpro_nodump (&minibuf_window); |
6159 | 6158 |
6160 for (i = 0; i < countof (Vwindow_configuration_free_list); i++) | 6159 for (i = 0; i < countof (Vwindow_configuration_free_list); i++) |