aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2001-02-09 09:55:43 +0000
committerJason Rumney2001-02-09 09:55:43 +0000
commitdc2202434b5da0a6f1a4089e1422501d48c6bb89 (patch)
tree242751302dec8f5bb07323cf4fb1d13d7210ca40 /src
parent555e35d2dadf5ec85339f623470109c3410e7f98 (diff)
downloademacs-dc2202434b5da0a6f1a4089e1422501d48c6bb89.tar.gz
emacs-dc2202434b5da0a6f1a4089e1422501d48c6bb89.zip
(Fx_show_tip): Fix calls to make_number.
(x_set_font): If font hasn't changed, avoid recomputing faces and other things. (x_set_tool_bar_lines): Do nothing if frame is minibuffer-only, (Fx_create_frame): Add the tool bar height to the frame height. (x_create_tip_frame): Prevent changing the tooltip's background color by specifying a color for the default font in .Xdefaults. (Qcancel_timer): New variable. (syms_of_w32fns): Initialize and staticpro it. (Fx_hide_tip, Fx_show_tip): Use it. (Fx_show_tip): Make sure to set tip_timer to nil when canceling the timer. (toplevel): Lisp code for generating parts of syms_of_w32fns removed. (Fx_show_tip): Fix calls to make_number. (x_set_font): If font hasn't changed, avoid recomputing faces and other things. (x_set_tool_bar_lines): Do nothing if frame is minibuffer-only, (Fx_create_frame): Add the tool bar height to the frame height. (x_create_tip_frame): Prevent changing the tooltip's background color by specifying a color for the default font in .Xdefaults. (Qcancel_timer): New variable. (syms_of_w32fns): Initialize and staticpro it. (Fx_hide_tip, Fx_show_tip): Use it. (Fx_show_tip): Make sure to set tip_timer to nil when canceling the timer. (toplevel): Lisp code for generating parts of syms_of_w32fns removed.
Diffstat (limited to 'src')
-rw-r--r--src/w32fns.c158
1 files changed, 93 insertions, 65 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 5b8074ca7ab..efd9efa108c 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -196,42 +196,6 @@ Lisp_Object Vw32_charset_info_alist;
196#define VIETNAMESE_CHARSET 163 196#define VIETNAMESE_CHARSET 163
197#endif 197#endif
198 198
199
200/* Evaluate this expression to rebuild the section of syms_of_w32fns
201 that initializes and staticpros the symbols declared below. Note
202 that Emacs 18 has a bug that keeps C-x C-e from being able to
203 evaluate this expression.
204
205(progn
206 ;; Accumulate a list of the symbols we want to initialize from the
207 ;; declarations at the top of the file.
208 (goto-char (point-min))
209 (search-forward "/\*&&& symbols declared here &&&*\/\n")
210 (let (symbol-list)
211 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
212 (setq symbol-list
213 (cons (buffer-substring (match-beginning 1) (match-end 1))
214 symbol-list))
215 (forward-line 1))
216 (setq symbol-list (nreverse symbol-list))
217 ;; Delete the section of syms_of_... where we initialize the symbols.
218 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
219 (let ((start (point)))
220 (while (looking-at "^ Q")
221 (forward-line 2))
222 (kill-region start (point)))
223 ;; Write a new symbol initialization section.
224 (while symbol-list
225 (insert (format " %s = intern (\"" (car symbol-list)))
226 (let ((start (point)))
227 (insert (substring (car symbol-list) 1))
228 (subst-char-in-region start (point) ?_ ?-))
229 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
230 (setq symbol-list (cdr symbol-list)))))
231
232 */
233
234/*&&& symbols declared here &&&*/
235Lisp_Object Qauto_raise; 199Lisp_Object Qauto_raise;
236Lisp_Object Qauto_lower; 200Lisp_Object Qauto_lower;
237Lisp_Object Qbar; 201Lisp_Object Qbar;
@@ -264,6 +228,7 @@ Lisp_Object Quser_size;
264Lisp_Object Qscreen_gamma; 228Lisp_Object Qscreen_gamma;
265Lisp_Object Qline_spacing; 229Lisp_Object Qline_spacing;
266Lisp_Object Qcenter; 230Lisp_Object Qcenter;
231Lisp_Object Qcancel_timer;
267Lisp_Object Qhyper; 232Lisp_Object Qhyper;
268Lisp_Object Qsuper; 233Lisp_Object Qsuper;
269Lisp_Object Qmeta; 234Lisp_Object Qmeta;
@@ -2419,6 +2384,8 @@ x_set_font (f, arg, oldval)
2419 error ("The characters of the given font have varying widths"); 2384 error ("The characters of the given font have varying widths");
2420 else if (STRINGP (result)) 2385 else if (STRINGP (result))
2421 { 2386 {
2387 if (!NILP (Fequal (result, oldval)))
2388 return;
2422 store_frame_param (f, Qfont, result); 2389 store_frame_param (f, Qfont, result);
2423 recompute_basic_faces (f); 2390 recompute_basic_faces (f);
2424 } 2391 }
@@ -2577,6 +2544,10 @@ x_set_tool_bar_lines (f, value, oldval)
2577 int delta, nlines, root_height; 2544 int delta, nlines, root_height;
2578 Lisp_Object root_window; 2545 Lisp_Object root_window;
2579 2546
2547 /* Treat tool bars like menu bars. */
2548 if (FRAME_MINIBUF_ONLY_P (f))
2549 return;
2550
2580 /* Use VALUE only if an integer >= 0. */ 2551 /* Use VALUE only if an integer >= 0. */
2581 if (INTEGERP (value) && XINT (value) >= 0) 2552 if (INTEGERP (value) && XINT (value) >= 0)
2582 nlines = XFASTINT (value); 2553 nlines = XFASTINT (value);
@@ -5170,7 +5141,7 @@ This function is an internal primitive--use `make-frame' instead.")
5170 int minibuffer_only = 0; 5141 int minibuffer_only = 0;
5171 long window_prompting = 0; 5142 long window_prompting = 0;
5172 int width, height; 5143 int width, height;
5173 int count = specpdl_ptr - specpdl; 5144 int count = BINDING_STACK_SIZE ();
5174 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 5145 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
5175 Lisp_Object display; 5146 Lisp_Object display;
5176 struct w32_display_info *dpyinfo = NULL; 5147 struct w32_display_info *dpyinfo = NULL;
@@ -5427,6 +5398,35 @@ This function is an internal primitive--use `make-frame' instead.")
5427 f->height. */ 5398 f->height. */
5428 width = f->width; 5399 width = f->width;
5429 height = f->height; 5400 height = f->height;
5401
5402 /* Add the tool-bar height to the initial frame height so that the
5403 user gets a text display area of the size he specified with -g or
5404 via .Xdefaults. Later changes of the tool-bar height don't
5405 change the frame size. This is done so that users can create
5406 tall Emacs frames without having to guess how tall the tool-bar
5407 will get. */
5408 if (FRAME_TOOL_BAR_LINES (f))
5409 {
5410 int margin, relief, bar_height;
5411
5412 relief = (tool_bar_button_relief > 0
5413 ? tool_bar_button_relief
5414 : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
5415
5416 if (INTEGERP (Vtool_bar_button_margin)
5417 && XINT (Vtool_bar_button_margin) > 0)
5418 margin = XFASTINT (Vtool_bar_button_margin);
5419 else if (CONSP (Vtool_bar_button_margin)
5420 && INTEGERP (XCDR (Vtool_bar_button_margin))
5421 && XINT (XCDR (Vtool_bar_button_margin)) > 0)
5422 margin = XFASTINT (XCDR (Vtool_bar_button_margin));
5423 else
5424 margin = 0;
5425
5426 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief;
5427 height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
5428 }
5429
5430 f->height = 0; 5430 f->height = 0;
5431 SET_FRAME_WIDTH (f, 0); 5431 SET_FRAME_WIDTH (f, 0);
5432 change_frame_size (f, height, width, 1, 0, 0); 5432 change_frame_size (f, height, width, 1, 0, 0);
@@ -6724,7 +6724,11 @@ static Lisp_Object w32_list_synthesized_fonts (FRAME_PTR f,
6724 MAXNAMES sets a limit on how many fonts to match. */ 6724 MAXNAMES sets a limit on how many fonts to match. */
6725 6725
6726Lisp_Object 6726Lisp_Object
6727w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames ) 6727w32_list_fonts (f, pattern, size, maxnames)
6728 struct frame *f;
6729 Lisp_Object pattern;
6730 int size;
6731 int maxnames;
6728{ 6732{
6729 Lisp_Object patterns, key = Qnil, tem, tpat; 6733 Lisp_Object patterns, key = Qnil, tem, tpat;
6730 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil; 6734 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil;
@@ -12221,7 +12225,7 @@ show_busy_cursor (timer)
12221 BLOCK_INPUT; 12225 BLOCK_INPUT;
12222 12226
12223 FOR_EACH_FRAME (rest, frame) 12227 FOR_EACH_FRAME (rest, frame)
12224 if (FRAME_X_P (XFRAME (frame))) 12228 if (FRAME_W32_P (XFRAME (frame)))
12225 { 12229 {
12226 struct frame *f = XFRAME (frame); 12230 struct frame *f = XFRAME (frame);
12227 12231
@@ -12269,7 +12273,7 @@ hide_busy_cursor ()
12269 { 12273 {
12270 struct frame *f = XFRAME (frame); 12274 struct frame *f = XFRAME (frame);
12271 12275
12272 if (FRAME_X_P (f) 12276 if (FRAME_W32_P (f)
12273 /* Watch out for newly created frames. */ 12277 /* Watch out for newly created frames. */
12274 && f->output_data.x->busy_window) 12278 && f->output_data.x->busy_window)
12275 { 12279 {
@@ -12342,7 +12346,7 @@ x_create_tip_frame (dpyinfo, parms)
12342 Lisp_Object name; 12346 Lisp_Object name;
12343 long window_prompting = 0; 12347 long window_prompting = 0;
12344 int width, height; 12348 int width, height;
12345 int count = specpdl_ptr - specpdl; 12349 int count = BINDING_STACK_SIZE ();
12346 struct gcpro gcpro1, gcpro2, gcpro3; 12350 struct gcpro gcpro1, gcpro2, gcpro3;
12347 struct kboard *kb; 12351 struct kboard *kb;
12348 12352
@@ -12575,7 +12579,7 @@ x_create_tip_frame (dpyinfo, parms)
12575#ifdef TODO /* Tooltip support not complete. */ 12579#ifdef TODO /* Tooltip support not complete. */
12576DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, 12580DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
12577 "Show STRING in a \"tooltip\" window on frame FRAME.\n\ 12581 "Show STRING in a \"tooltip\" window on frame FRAME.\n\
12578A tooltip window is a small X window displaying a string.\n\ 12582A tooltip window is a small window displaying a string.\n\
12579\n\ 12583\n\
12580FRAME nil or omitted means use the selected frame.\n\ 12584FRAME nil or omitted means use the selected frame.\n\
12581\n\ 12585\n\
@@ -12591,7 +12595,7 @@ displayed at the mouse position, with offset DX added (default is 5 if\n\
12591DX isn't specified). Likewise for the y-position; if a `top' frame\n\ 12595DX isn't specified). Likewise for the y-position; if a `top' frame\n\
12592parameter is specified, it determines the y-position of the tooltip\n\ 12596parameter is specified, it determines the y-position of the tooltip\n\
12593window, otherwise it is displayed at the mouse position, with offset\n\ 12597window, otherwise it is displayed at the mouse position, with offset\n\
12594DY added (default is -5).") 12598DY added (default is 10).")
12595 (string, frame, parms, timeout, dx, dy) 12599 (string, frame, parms, timeout, dx, dy)
12596 Lisp_Object string, frame, parms, timeout, dx, dy; 12600 Lisp_Object string, frame, parms, timeout, dx, dy;
12597{ 12601{
@@ -12625,13 +12629,49 @@ DY added (default is -5).")
12625 CHECK_NUMBER (dx, 5); 12629 CHECK_NUMBER (dx, 5);
12626 12630
12627 if (NILP (dy)) 12631 if (NILP (dy))
12628 dy = make_number (-5); 12632 dy = make_number (-10);
12629 else 12633 else
12630 CHECK_NUMBER (dy, 6); 12634 CHECK_NUMBER (dy, 6);
12631 12635
12636 if (NILP (last_show_tip_args))
12637 last_show_tip_args = Fmake_vector (make_number (3), Qnil);
12638
12639 if (!NILP (tip_frame))
12640 {
12641 Lisp_Object last_string = AREF (last_show_tip_args, 0);
12642 Lisp_Object last_frame = AREF (last_show_tip_args, 1);
12643 Lisp_Object last_parms = AREF (last_show_tip_args, 2);
12644
12645 if (EQ (frame, last_frame)
12646 && !NILP (Fequal (last_string, string))
12647 && !NILP (Fequal (last_parms, parms)))
12648 {
12649 struct frame *f = XFRAME (tip_frame);
12650
12651 /* Only DX and DY have changed. */
12652 if (!NILP (tip_timer))
12653 {
12654 Lisp_Object timer = tip_timer;
12655 tip_timer = Qnil;
12656 call1 (Qcancel_timer, timer);
12657 }
12658
12659 BLOCK_INPUT;
12660 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
12661 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
12662 root_x, root_y - PIXEL_HEIGHT (f));
12663 UNBLOCK_INPUT;
12664 goto start_timer;
12665 }
12666 }
12667
12632 /* Hide a previous tip, if any. */ 12668 /* Hide a previous tip, if any. */
12633 Fx_hide_tip (); 12669 Fx_hide_tip ();
12634 12670
12671 ASET (last_show_tip_args, 0, string);
12672 ASET (last_show_tip_args, 1, frame);
12673 ASET (last_show_tip_args, 2, parms);
12674
12635 /* Add default values to frame parameters. */ 12675 /* Add default values to frame parameters. */
12636 if (NILP (Fassq (Qname, parms))) 12676 if (NILP (Fassq (Qname, parms)))
12637 parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms); 12677 parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms);
@@ -12655,8 +12695,8 @@ DY added (default is -5).")
12655 will loose. I don't think this is a realistic case. */ 12695 will loose. I don't think this is a realistic case. */
12656 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 12696 w = XWINDOW (FRAME_ROOT_WINDOW (f));
12657 w->left = w->top = make_number (0); 12697 w->left = w->top = make_number (0);
12658 w->width = 80; 12698 w->width = make_number (80);
12659 w->height = 40; 12699 w->height = make_number (40);
12660 adjust_glyphs (f); 12700 adjust_glyphs (f);
12661 w->pseudo_window_p = 1; 12701 w->pseudo_window_p = 1;
12662 12702
@@ -12666,7 +12706,7 @@ DY added (default is -5).")
12666 old_buffer = current_buffer; 12706 old_buffer = current_buffer;
12667 set_buffer_internal_1 (XBUFFER (buffer)); 12707 set_buffer_internal_1 (XBUFFER (buffer));
12668 Ferase_buffer (); 12708 Ferase_buffer ();
12669 Finsert (make_number (1), &string); 12709 Finsert (1, &string);
12670 clear_glyph_matrix (w->desired_matrix); 12710 clear_glyph_matrix (w->desired_matrix);
12671 clear_glyph_matrix (w->current_matrix); 12711 clear_glyph_matrix (w->current_matrix);
12672 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 12712 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -12706,26 +12746,11 @@ DY added (default is -5).")
12706 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); 12746 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
12707 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); 12747 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
12708 12748
12709 /* User-specified position? */
12710 left = Fcdr (Fassq (Qleft, parms));
12711 top = Fcdr (Fassq (Qtop, parms));
12712
12713 /* Move the tooltip window where the mouse pointer is. Resize and 12749 /* Move the tooltip window where the mouse pointer is. Resize and
12714 show it. */ 12750 show it. */
12715#if 0 /* TODO : W32 specifics */ 12751 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
12716 BLOCK_INPUT;
12717 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
12718 &root, &child, &root_x, &root_y, &win_x, &win_y, &pmask);
12719 UNBLOCK_INPUT;
12720 12752
12721 root_x += XINT (dx); 12753#if 0 /* TODO : W32 specifics */
12722 root_y += XINT (dy);
12723
12724 if (INTEGERP (left))
12725 root_x = XINT (left);
12726 if (INTEGERP (top))
12727 root_y = XINT (top);
12728
12729 BLOCK_INPUT; 12754 BLOCK_INPUT;
12730 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 12755 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
12731 root_x, root_y - height, width, height); 12756 root_x, root_y - height, width, height);
@@ -12741,6 +12766,7 @@ DY added (default is -5).")
12741 set_buffer_internal_1 (old_buffer); 12766 set_buffer_internal_1 (old_buffer);
12742 windows_or_buffers_changed = old_windows_or_buffers_changed; 12767 windows_or_buffers_changed = old_windows_or_buffers_changed;
12743 12768
12769 start_timer:
12744 /* Let the tip disappear after timeout seconds. */ 12770 /* Let the tip disappear after timeout seconds. */
12745 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, 12771 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
12746 intern ("x-hide-tip")); 12772 intern ("x-hide-tip"));
@@ -12773,7 +12799,7 @@ Value is t is tooltip was open, nil otherwise.")
12773 specbind (Qinhibit_quit, Qt); 12799 specbind (Qinhibit_quit, Qt);
12774 12800
12775 if (!NILP (timer)) 12801 if (!NILP (timer))
12776 call1 (intern ("cancel-timer"), timer); 12802 call1 (Qcancel_timer, timer);
12777 12803
12778 if (FRAMEP (frame)) 12804 if (FRAMEP (frame))
12779 { 12805 {
@@ -13432,6 +13458,8 @@ syms_of_w32fns ()
13432 staticpro (&Qline_spacing); 13458 staticpro (&Qline_spacing);
13433 Qcenter = intern ("center"); 13459 Qcenter = intern ("center");
13434 staticpro (&Qcenter); 13460 staticpro (&Qcenter);
13461 Qcancel_timer = intern ("cancel-timer");
13462 staticpro (&Qcancel_timer);
13435 /* This is the end of symbol initialization. */ 13463 /* This is the end of symbol initialization. */
13436 13464
13437 Qhyper = intern ("hyper"); 13465 Qhyper = intern ("hyper");