Mercurial > emacs
comparison src/frame.c @ 91375:4bb19b57806d
Merge unicode branch
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1037
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 01 Feb 2008 16:01:31 +0000 |
parents | c70e45a7acfd |
children | d17766001931 |
comparison
equal
deleted
inserted
replaced
88119:70ca9e418f5d | 91375:4bb19b57806d |
---|---|
21 | 21 |
22 #include <config.h> | 22 #include <config.h> |
23 | 23 |
24 #include <stdio.h> | 24 #include <stdio.h> |
25 #include "lisp.h" | 25 #include "lisp.h" |
26 #include "charset.h" | 26 #include "character.h" |
27 #ifdef HAVE_X_WINDOWS | 27 #ifdef HAVE_X_WINDOWS |
28 #include "xterm.h" | 28 #include "xterm.h" |
29 #endif | 29 #endif |
30 #ifdef WINDOWSNT | 30 #ifdef WINDOWSNT |
31 #include "w32term.h" | 31 #include "w32term.h" |
51 #include "dosfns.h" | 51 #include "dosfns.h" |
52 #endif | 52 #endif |
53 | 53 |
54 | 54 |
55 #ifdef HAVE_WINDOW_SYSTEM | 55 #ifdef HAVE_WINDOW_SYSTEM |
56 | |
57 #ifdef USE_FONT_BACKEND | |
58 #include "font.h" | |
59 #endif /* USE_FONT_BACKEND */ | |
56 | 60 |
57 /* The name we're using in resource queries. Most often "emacs". */ | 61 /* The name we're using in resource queries. Most often "emacs". */ |
58 | 62 |
59 Lisp_Object Vx_resource_name; | 63 Lisp_Object Vx_resource_name; |
60 | 64 |
110 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; | 114 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; |
111 Lisp_Object Qtty_color_mode; | 115 Lisp_Object Qtty_color_mode; |
112 Lisp_Object Qtty, Qtty_type; | 116 Lisp_Object Qtty, Qtty_type; |
113 | 117 |
114 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; | 118 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; |
119 #ifdef USE_FONT_BACKEND | |
120 Lisp_Object Qfont_backend; | |
121 #endif /* USE_FONT_BACKEND */ | |
115 | 122 |
116 Lisp_Object Qinhibit_face_set_after_frame_default; | 123 Lisp_Object Qinhibit_face_set_after_frame_default; |
117 Lisp_Object Qface_set_after_frame_default; | 124 Lisp_Object Qface_set_after_frame_default; |
118 | 125 |
119 Lisp_Object Vterminal_frame; | 126 Lisp_Object Vterminal_frame; |
324 #ifdef HAVE_WINDOW_SYSTEM | 331 #ifdef HAVE_WINDOW_SYSTEM |
325 f->want_fullscreen = FULLSCREEN_NONE; | 332 f->want_fullscreen = FULLSCREEN_NONE; |
326 #endif | 333 #endif |
327 f->size_hint_flags = 0; | 334 f->size_hint_flags = 0; |
328 f->win_gravity = 0; | 335 f->win_gravity = 0; |
336 #ifdef USE_FONT_BACKEND | |
337 f->font_driver_list = NULL; | |
338 f->font_data_list = NULL; | |
339 #endif /* USE_FONT_BACKEND */ | |
329 | 340 |
330 root_window = make_window (); | 341 root_window = make_window (); |
331 if (mini_p) | 342 if (mini_p) |
332 { | 343 { |
333 mini_window = make_window (); | 344 mini_window = make_window (); |
1462 This function must be called before the window tree of the | 1473 This function must be called before the window tree of the |
1463 frame is deleted because windows contain dynamically allocated | 1474 frame is deleted because windows contain dynamically allocated |
1464 memory. */ | 1475 memory. */ |
1465 free_glyphs (f); | 1476 free_glyphs (f); |
1466 | 1477 |
1478 #ifdef USE_FONT_BACKEND | |
1479 /* Give chance to each font driver to free a frame specific data. */ | |
1480 font_update_drivers (f, Qnil); | |
1481 #endif /* USE_FONT_BACKEND */ | |
1482 | |
1467 /* Mark all the windows that used to be on FRAME as deleted, and then | 1483 /* Mark all the windows that used to be on FRAME as deleted, and then |
1468 remove the reference to them. */ | 1484 remove the reference to them. */ |
1469 delete_all_subwindows (XWINDOW (f->root_window)); | 1485 delete_all_subwindows (XWINDOW (f->root_window)); |
1470 f->root_window = Qnil; | 1486 f->root_window = Qnil; |
1471 | 1487 |
2181 } | 2197 } |
2182 | 2198 |
2183 static int | 2199 static int |
2184 frame_name_fnn_p (str, len) | 2200 frame_name_fnn_p (str, len) |
2185 char *str; | 2201 char *str; |
2186 int len; | 2202 EMACS_INT len; |
2187 { | 2203 { |
2188 if (len > 1 && str[0] == 'F') | 2204 if (len > 1 && str[0] == 'F') |
2189 { | 2205 { |
2190 char *end_ptr; | 2206 char *end_ptr; |
2191 | 2207 |
2822 {"line-spacing", &Qline_spacing}, | 2838 {"line-spacing", &Qline_spacing}, |
2823 {"left-fringe", &Qleft_fringe}, | 2839 {"left-fringe", &Qleft_fringe}, |
2824 {"right-fringe", &Qright_fringe}, | 2840 {"right-fringe", &Qright_fringe}, |
2825 {"wait-for-wm", &Qwait_for_wm}, | 2841 {"wait-for-wm", &Qwait_for_wm}, |
2826 {"fullscreen", &Qfullscreen}, | 2842 {"fullscreen", &Qfullscreen}, |
2843 #ifdef USE_FONT_BACKEND | |
2844 {"font-backend", &Qfont_backend} | |
2845 #endif /* USE_FONT_BACKEND */ | |
2827 }; | 2846 }; |
2828 | 2847 |
2829 #ifdef HAVE_WINDOW_SYSTEM | 2848 #ifdef HAVE_WINDOW_SYSTEM |
2830 | 2849 |
2831 extern Lisp_Object Qbox; | 2850 extern Lisp_Object Qbox; |
3336 Lisp_Object result; | 3355 Lisp_Object result; |
3337 Lisp_Object fontset_name; | 3356 Lisp_Object fontset_name; |
3338 Lisp_Object frame; | 3357 Lisp_Object frame; |
3339 int old_fontset = FRAME_FONTSET(f); | 3358 int old_fontset = FRAME_FONTSET(f); |
3340 | 3359 |
3360 #ifdef USE_FONT_BACKEND | |
3361 if (enable_font_backend) | |
3362 { | |
3363 int fontset = -1; | |
3364 Lisp_Object font_object; | |
3365 | |
3366 /* ARG is a fontset name, a font name, or a font object. | |
3367 In the last case, this function never fail. */ | |
3368 if (STRINGP (arg)) | |
3369 { | |
3370 fontset = fs_query_fontset (arg, 0); | |
3371 if (fontset < 0) | |
3372 font_object = font_open_by_name (f, SDATA (arg)); | |
3373 else if (fontset > 0) | |
3374 { | |
3375 Lisp_Object ascii_font = fontset_ascii (fontset); | |
3376 | |
3377 font_object = font_open_by_name (f, SDATA (ascii_font)); | |
3378 } | |
3379 } | |
3380 else | |
3381 font_object = arg; | |
3382 | |
3383 if (fontset < 0 && ! NILP (font_object)) | |
3384 fontset = new_fontset_from_font (font_object); | |
3385 | |
3386 if (fontset == 0) | |
3387 /* Refuse the default fontset. */ | |
3388 result = Qt; | |
3389 else if (NILP (font_object)) | |
3390 result = Qnil; | |
3391 else | |
3392 result = x_new_fontset2 (f, fontset, font_object); | |
3393 } | |
3394 else | |
3395 { | |
3396 #endif /* USE_FONT_BACKEND */ | |
3341 CHECK_STRING (arg); | 3397 CHECK_STRING (arg); |
3342 | 3398 |
3343 fontset_name = Fquery_fontset (arg, Qnil); | 3399 fontset_name = Fquery_fontset (arg, Qnil); |
3344 | 3400 |
3345 BLOCK_INPUT; | 3401 BLOCK_INPUT; |
3346 result = (STRINGP (fontset_name) | 3402 result = (STRINGP (fontset_name) |
3347 ? x_new_fontset (f, SDATA (fontset_name)) | 3403 ? x_new_fontset (f, fontset_name) |
3348 : x_new_font (f, SDATA (arg))); | 3404 : x_new_fontset (f, arg)); |
3349 UNBLOCK_INPUT; | 3405 UNBLOCK_INPUT; |
3406 #ifdef USE_FONT_BACKEND | |
3407 } | |
3408 #endif | |
3350 | 3409 |
3351 if (EQ (result, Qnil)) | 3410 if (EQ (result, Qnil)) |
3352 error ("Font `%s' is not defined", SDATA (arg)); | 3411 error ("Font `%s' is not defined", SDATA (arg)); |
3353 else if (EQ (result, Qt)) | 3412 else if (EQ (result, Qt)) |
3354 error ("The characters of the given font have varying widths"); | 3413 error ("The default fontset can't be used for a frame font"); |
3355 else if (STRINGP (result)) | 3414 else if (STRINGP (result)) |
3356 { | 3415 { |
3357 set_default_ascii_font (result); | 3416 set_default_ascii_font (result); |
3358 if (STRINGP (fontset_name)) | 3417 if (STRINGP (fontset_name)) |
3359 { | 3418 { |
3360 /* Fontset names are built from ASCII font names, so the | 3419 /* Fontset names are built from ASCII font names, so the |
3361 names may be equal despite there was a change. */ | 3420 names may be equal despite there was a change. */ |
3362 if (old_fontset == FRAME_FONTSET (f)) | 3421 if (old_fontset == FRAME_FONTSET (f)) |
3363 return; | 3422 return; |
3364 } | 3423 } |
3365 else if (!NILP (Fequal (result, oldval))) | 3424 store_frame_param (f, Qfont, result); |
3425 | |
3426 if (!NILP (Fequal (result, oldval))) | |
3366 return; | 3427 return; |
3367 | 3428 |
3368 /* Recalculate toolbar height. */ | 3429 /* Recalculate toolbar height. */ |
3369 f->n_tool_bar_rows = 0; | 3430 f->n_tool_bar_rows = 0; |
3370 /* Ensure we redraw it. */ | 3431 /* Ensure we redraw it. */ |
3371 clear_current_matrices (f); | 3432 clear_current_matrices (f); |
3372 | 3433 |
3373 store_frame_param (f, Qfont, result); | |
3374 recompute_basic_faces (f); | 3434 recompute_basic_faces (f); |
3375 } | 3435 } |
3376 else | 3436 else |
3377 abort (); | 3437 abort (); |
3378 | 3438 |
3387 { | 3447 { |
3388 XSETFRAME (frame, f); | 3448 XSETFRAME (frame, f); |
3389 call1 (Qface_set_after_frame_default, frame); | 3449 call1 (Qface_set_after_frame_default, frame); |
3390 } | 3450 } |
3391 } | 3451 } |
3452 | |
3453 | |
3454 #ifdef USE_FONT_BACKEND | |
3455 void | |
3456 x_set_font_backend (f, new_value, old_value) | |
3457 struct frame *f; | |
3458 Lisp_Object new_value, old_value; | |
3459 { | |
3460 if (! NILP (new_value) | |
3461 && !CONSP (new_value)) | |
3462 { | |
3463 char *p0, *p1; | |
3464 | |
3465 CHECK_STRING (new_value); | |
3466 p0 = p1 = SDATA (new_value); | |
3467 new_value = Qnil; | |
3468 while (*p0) | |
3469 { | |
3470 while (*p1 && *p1 != ',') p1++; | |
3471 if (p0 < p1) | |
3472 new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil), | |
3473 new_value); | |
3474 if (*p1) | |
3475 p1++; | |
3476 p0 = p1; | |
3477 } | |
3478 new_value = Fnreverse (new_value); | |
3479 } | |
3480 | |
3481 if (! NILP (old_value) && ! NILP (Fequal (old_value, new_value))) | |
3482 return; | |
3483 | |
3484 if (FRAME_FONT_OBJECT (f)) | |
3485 free_all_realized_faces (Qnil); | |
3486 | |
3487 new_value = font_update_drivers (f, NILP (new_value) ? Qt : new_value); | |
3488 if (NILP (new_value)) | |
3489 { | |
3490 if (NILP (old_value)) | |
3491 error ("No font backend available"); | |
3492 font_update_drivers (f, old_value); | |
3493 error ("None of specified font backends are available"); | |
3494 } | |
3495 store_frame_param (f, Qfont_backend, new_value); | |
3496 | |
3497 if (FRAME_FONT_OBJECT (f)) | |
3498 { | |
3499 Lisp_Object frame; | |
3500 | |
3501 XSETFRAME (frame, f); | |
3502 x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); | |
3503 ++face_change_count; | |
3504 ++windows_or_buffers_changed; | |
3505 } | |
3506 } | |
3507 #endif /* USE_FONT_BACKEND */ | |
3392 | 3508 |
3393 | 3509 |
3394 void | 3510 void |
3395 x_set_fringe_width (f, new_value, old_value) | 3511 x_set_fringe_width (f, new_value, old_value) |
3396 struct frame *f; | 3512 struct frame *f; |