comparison src/window.c @ 217:d44af0c54775 r20-4b7

Import from CVS: tag r20-4b7
author cvs
date Mon, 13 Aug 2007 10:08:34 +0200
parents 1f0dabaa0855
children 2c611d1463a6
comparison
equal deleted inserted replaced
216:43306a74e31c 217:d44af0c54775
66 static int window_char_height_to_pixel_height (struct window *w, 66 static int window_char_height_to_pixel_height (struct window *w,
67 int char_height, 67 int char_height,
68 int include_gutters_p); 68 int include_gutters_p);
69 static void change_window_height (struct window *w, int delta, int widthflag); 69 static void change_window_height (struct window *w, int delta, int widthflag);
70 70
71
72 #ifdef ENERGIZE
73 extern void energize_buffer_shown_hook ();
74 extern void energize_buffer_hidden_hook ();
75 extern void energize_window_selected_hook ();
76 extern void energize_window_deselected_hook ();
77 extern Lisp_Object desired_psheet_buffer ();
78 extern void make_psheets_desired ();
79 #endif /* ENERGIZE */
80 71
81 /* Thickness of shadow border around 3d modelines. */ 72 /* Thickness of shadow border around 3d modelines. */
82 Lisp_Object Vmodeline_shadow_thickness; 73 Lisp_Object Vmodeline_shadow_thickness;
83 74
84 /* Whether a modeline should be displayed. */ 75 /* Whether a modeline should be displayed. */
1571 Lisp_Object buf = w->buffer; 1562 Lisp_Object buf = w->buffer;
1572 1563
1573 if (XBUFFER (buf) != XMARKER (w->pointm[CURRENT_DISP])->buffer) 1564 if (XBUFFER (buf) != XMARKER (w->pointm[CURRENT_DISP])->buffer)
1574 abort (); 1565 abort ();
1575 1566
1576 #ifdef ENERGIZE
1577 energize_buffer_hidden_hook (w);
1578 #endif
1579
1580 /* FSF disables this check, so I'll do it too. I hope it won't 1567 /* FSF disables this check, so I'll do it too. I hope it won't
1581 break things. --ben */ 1568 break things. --ben */
1582 #if 0 1569 #if 0
1583 if (w == XWINDOW (Fselected_window (Qnil)) 1570 if (w == XWINDOW (Fselected_window (Qnil))
1584 || ! EQ (buf, XWINDOW (Fselected_window (Qnil))->buffer)) 1571 || ! EQ (buf, XWINDOW (Fselected_window (Qnil))->buffer))
3062 MARK_WINDOWS_CHANGED (w); 3049 MARK_WINDOWS_CHANGED (w);
3063 recompute_all_cached_specifiers_in_window (w); 3050 recompute_all_cached_specifiers_in_window (w);
3064 if (EQ (window, Fselected_window (Qnil))) 3051 if (EQ (window, Fselected_window (Qnil)))
3065 { 3052 {
3066 Fset_buffer (buffer); 3053 Fset_buffer (buffer);
3067 #ifdef ENERGIZE
3068 energize_buffer_shown_hook (w);
3069 #endif
3070 } 3054 }
3071 return Qnil; 3055 return Qnil;
3072 } 3056 }
3073 3057
3074 DEFUN ("select-window", Fselect_window, 1, 1, 0, /* 3058 DEFUN ("select-window", Fselect_window, 1, 1, 0, /*
3095 /* deselect the old window, if it exists (it might not exist if 3079 /* deselect the old window, if it exists (it might not exist if
3096 the selected device has no frames, which occurs at startup) */ 3080 the selected device has no frames, which occurs at startup) */
3097 if (!NILP (old_selected_window)) 3081 if (!NILP (old_selected_window))
3098 { 3082 {
3099 struct window *ow = XWINDOW (old_selected_window); 3083 struct window *ow = XWINDOW (old_selected_window);
3100
3101 #ifdef ENERGIZE
3102 if (! MINI_WINDOW_P (w))
3103 energize_window_deselected_hook (ow);
3104 #endif
3105 3084
3106 Fset_marker (ow->pointm[CURRENT_DISP], 3085 Fset_marker (ow->pointm[CURRENT_DISP],
3107 make_int (BUF_PT (XBUFFER (ow->buffer))), 3086 make_int (BUF_PT (XBUFFER (ow->buffer))),
3108 ow->buffer); 3087 ow->buffer);
3109 3088
3133 3112
3134 BUF_SET_PT (current_buffer, new_point); 3113 BUF_SET_PT (current_buffer, new_point);
3135 } 3114 }
3136 3115
3137 MARK_WINDOWS_CHANGED (w); 3116 MARK_WINDOWS_CHANGED (w);
3138
3139 #ifdef ENERGIZE
3140 if (! MINI_WINDOW_P (w))
3141 energize_window_selected_hook (w);
3142 #endif
3143 3117
3144 return window; 3118 return window;
3145 } 3119 }
3146 3120
3147 Lisp_Object 3121 Lisp_Object
4510 Lisp_Object minibuf_scroll_window; 4484 Lisp_Object minibuf_scroll_window;
4511 Lisp_Object root_window; 4485 Lisp_Object root_window;
4512 /* Record the values of window-min-width and window-min-height 4486 /* Record the values of window-min-width and window-min-height
4513 so that window sizes remain consistent with them. */ 4487 so that window sizes remain consistent with them. */
4514 int min_width, min_height; 4488 int min_width, min_height;
4515 #ifdef ENERGIZE
4516 /* The buffer whose p_sheets are visible */
4517 Lisp_Object p_sheet_buffer;
4518 #endif
4519 int saved_windows_count; 4489 int saved_windows_count;
4520 /* Zero-sized arrays aren't ANSI C */ 4490 /* Zero-sized arrays aren't ANSI C */
4521 struct saved_window saved_windows[1]; 4491 struct saved_window saved_windows[1];
4522 }; 4492 };
4523 #define SAVED_WINDOW_N(conf, n) (&((conf)->saved_windows[(n)])) 4493 #define SAVED_WINDOW_N(conf, n) (&((conf)->saved_windows[(n)]))
4546 int i; 4516 int i;
4547 ((markobj) (config->current_window)); 4517 ((markobj) (config->current_window));
4548 ((markobj) (config->current_buffer)); 4518 ((markobj) (config->current_buffer));
4549 ((markobj) (config->minibuf_scroll_window)); 4519 ((markobj) (config->minibuf_scroll_window));
4550 ((markobj) (config->root_window)); 4520 ((markobj) (config->root_window));
4551 #ifdef ENERGIZE 4521
4552 ((markobj) (config->p_sheet_buffer));
4553 #endif
4554 for (i = 0; i < config->saved_windows_count; i++) 4522 for (i = 0; i < config->saved_windows_count; i++)
4555 { 4523 {
4556 struct saved_window *s = SAVED_WINDOW_N (config, i); 4524 struct saved_window *s = SAVED_WINDOW_N (config, i);
4557 ((markobj) (s->window)); 4525 ((markobj) (s->window));
4558 ((markobj) (s->buffer)); 4526 ((markobj) (s->buffer));
4634 if (!((fig1->saved_windows_count == fig2->saved_windows_count) && 4602 if (!((fig1->saved_windows_count == fig2->saved_windows_count) &&
4635 EQ (fig1->current_window, fig2->current_window) && 4603 EQ (fig1->current_window, fig2->current_window) &&
4636 EQ (fig1->current_buffer, fig2->current_buffer) && 4604 EQ (fig1->current_buffer, fig2->current_buffer) &&
4637 EQ (fig1->root_window, fig2->root_window) && 4605 EQ (fig1->root_window, fig2->root_window) &&
4638 EQ (fig1->minibuf_scroll_window, fig2->minibuf_scroll_window) && 4606 EQ (fig1->minibuf_scroll_window, fig2->minibuf_scroll_window) &&
4639 #ifdef ENERGIZE
4640 EQ (fig1->p_sheet_buffer, fig2->p_sheet_buffer) &&
4641 #endif
4642 fig1->frame_width == fig2->frame_width && 4607 fig1->frame_width == fig2->frame_width &&
4643 fig1->frame_height == fig2->frame_height)) 4608 fig1->frame_height == fig2->frame_height))
4644 return 0; 4609 return 0;
4645 4610
4646 for (i = 0; i < fig1->saved_windows_count; i++) 4611 for (i = 0; i < fig1->saved_windows_count; i++)
4759 just want to do close to nothing instead. */ 4724 just want to do close to nothing instead. */
4760 4725
4761 if (FRAME_LIVE_P (f)) 4726 if (FRAME_LIVE_P (f))
4762 { 4727 {
4763 /* restore the frame characteristics */ 4728 /* restore the frame characteristics */
4764 #ifdef ENERGIZE
4765 if (FRAME_X_P (f))
4766 {
4767 Lisp_Object new_desired = config->p_sheet_buffer;
4768
4769 if (BUFFERP (new_desired) &&
4770 !BUFFER_LIVE_P (XBUFFER (new_desired)))
4771 new_desired = Qnil; /* the desired buffer was killed */
4772
4773 /* need to restore the desired buffer */
4774 if (!EQ (new_desired, desired_psheet_buffer (f)))
4775 make_psheets_desired (f, new_desired);
4776 }
4777 #endif
4778 4729
4779 new_current_buffer = config->current_buffer; 4730 new_current_buffer = config->current_buffer;
4780 if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer))) 4731 if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer)))
4781 new_current_buffer = Qnil; 4732 new_current_buffer = Qnil;
4782 4733
5022 Fselect_window (config->current_window); 4973 Fselect_window (config->current_window);
5023 if (!NILP (new_current_buffer)) 4974 if (!NILP (new_current_buffer))
5024 Fset_buffer (new_current_buffer); 4975 Fset_buffer (new_current_buffer);
5025 else 4976 else
5026 Fset_buffer (XWINDOW (Fselected_window (Qnil))->buffer); 4977 Fset_buffer (XWINDOW (Fselected_window (Qnil))->buffer);
5027 #ifdef ENERGIZE
5028 energize_buffer_shown_hook (XWINDOW (Fselected_window (Qnil)));
5029 #endif
5030 } 4978 }
5031 else 4979 else
5032 set_frame_selected_window (f, config->current_window); 4980 set_frame_selected_window (f, config->current_window);
5033 } 4981 }
5034 else 4982 else
5251 config->minibuf_scroll_window = Vminibuf_scroll_window; 5199 config->minibuf_scroll_window = Vminibuf_scroll_window;
5252 config->root_window = FRAME_ROOT_WINDOW (f); 5200 config->root_window = FRAME_ROOT_WINDOW (f);
5253 config->min_height = window_min_height; 5201 config->min_height = window_min_height;
5254 config->min_width = window_min_width; 5202 config->min_width = window_min_width;
5255 config->saved_windows_count = n_windows; 5203 config->saved_windows_count = n_windows;
5256 #ifdef ENERGIZE
5257 {
5258 config->p_sheet_buffer = desired_psheet_buffer (f);
5259 if (ZEROP (config->p_sheet_buffer)) /* #### necessaryp? */
5260 config->p_sheet_buffer = Qnil;
5261 }
5262 #endif
5263 save_window_save (FRAME_ROOT_WINDOW (f), config, 0); 5204 save_window_save (FRAME_ROOT_WINDOW (f), config, 0);
5264 return result; 5205 return result;
5265 } 5206 }
5266 5207
5267 Lisp_Object 5208 Lisp_Object