diff options
| author | YAMAMOTO Mitsuharu | 2005-03-16 08:08:06 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2005-03-16 08:08:06 +0000 |
| commit | b298e813e5b7bcfb33b0dcbe5ec03f28fbdc107b (patch) | |
| tree | fc6d8e8966fb2f9042d0091cf2b2ce9a8d7aa061 /src | |
| parent | e7474cdda81b597b32ddffe6e20040c08e3abadf (diff) | |
| download | emacs-b298e813e5b7bcfb33b0dcbe5ec03f28fbdc107b.tar.gz emacs-b298e813e5b7bcfb33b0dcbe5ec03f28fbdc107b.zip | |
(x_list_fonts): FONT-LIST-CACHE is now cadr part of name_list_element.
(mac_make_rdb): Create resource database from preferences and argument
string.
(mac_term_init): Save resource database to cddr part of
name_list_element.
Diffstat (limited to 'src')
| -rw-r--r-- | src/macterm.c | 73 |
1 files changed, 18 insertions, 55 deletions
diff --git a/src/macterm.c b/src/macterm.c index 9af39dcb1fd..67a3f1e0107 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -129,9 +129,12 @@ int x_use_underline_position_properties; | |||
| 129 | struct x_display_info *x_display_list; | 129 | struct x_display_info *x_display_list; |
| 130 | 130 | ||
| 131 | /* This is a list of cons cells, each of the form (NAME | 131 | /* This is a list of cons cells, each of the form (NAME |
| 132 | . FONT-LIST-CACHE), one for each element of x_display_list and in | 132 | FONT-LIST-CACHE . RESOURCE-DATABASE), one for each element of |
| 133 | the same order. NAME is the name of the frame. FONT-LIST-CACHE | 133 | x_display_list and in the same order. NAME is the name of the |
| 134 | records previous values returned by x-list-fonts. */ | 134 | frame. FONT-LIST-CACHE records previous values returned by |
| 135 | x-list-fonts. RESOURCE-DATABASE preserves the X Resource Database | ||
| 136 | equivalent, which is implemented with a Lisp object, for the | ||
| 137 | display. */ | ||
| 135 | 138 | ||
| 136 | Lisp_Object x_display_name_list; | 139 | Lisp_Object x_display_name_list; |
| 137 | 140 | ||
| @@ -6447,7 +6450,7 @@ x_list_fonts (struct frame *f, | |||
| 6447 | 6450 | ||
| 6448 | if (dpyinfo) | 6451 | if (dpyinfo) |
| 6449 | { | 6452 | { |
| 6450 | tem = XCDR (dpyinfo->name_list_element); | 6453 | tem = XCAR (XCDR (dpyinfo->name_list_element)); |
| 6451 | key = Fcons (pattern, make_number (maxnames)); | 6454 | key = Fcons (pattern, make_number (maxnames)); |
| 6452 | 6455 | ||
| 6453 | newlist = Fassoc (key, tem); | 6456 | newlist = Fassoc (key, tem); |
| @@ -6466,9 +6469,9 @@ x_list_fonts (struct frame *f, | |||
| 6466 | 6469 | ||
| 6467 | if (dpyinfo) | 6470 | if (dpyinfo) |
| 6468 | { | 6471 | { |
| 6469 | XSETCDR (dpyinfo->name_list_element, | 6472 | XSETCAR (XCDR (dpyinfo->name_list_element), |
| 6470 | Fcons (Fcons (key, newlist), | 6473 | Fcons (Fcons (key, newlist), |
| 6471 | XCDR (dpyinfo->name_list_element))); | 6474 | XCAR (XCDR (dpyinfo->name_list_element)))); |
| 6472 | } | 6475 | } |
| 6473 | label_cached: | 6476 | label_cached: |
| 6474 | 6477 | ||
| @@ -9371,59 +9374,18 @@ mac_initialize_display_info () | |||
| 9371 | dpyinfo->mouse_face_hidden = 0; | 9374 | dpyinfo->mouse_face_hidden = 0; |
| 9372 | } | 9375 | } |
| 9373 | 9376 | ||
| 9374 | /* Create an xrdb-style database of resources to supercede registry settings. | ||
| 9375 | The database is just a concatenation of C strings, finished by an additional | ||
| 9376 | \0. The string are submitted to some basic normalization, so | ||
| 9377 | 9377 | ||
| 9378 | [ *]option[ *]:[ *]value... | 9378 | static XrmDatabase |
| 9379 | |||
| 9380 | becomes | ||
| 9381 | |||
| 9382 | option:value... | ||
| 9383 | |||
| 9384 | but any whitespace following value is not removed. */ | ||
| 9385 | |||
| 9386 | static char * | ||
| 9387 | mac_make_rdb (xrm_option) | 9379 | mac_make_rdb (xrm_option) |
| 9388 | char *xrm_option; | 9380 | char *xrm_option; |
| 9389 | { | 9381 | { |
| 9390 | char *buffer = xmalloc (strlen (xrm_option) + 2); | 9382 | XrmDatabase database; |
| 9391 | char *current = buffer; | ||
| 9392 | char ch; | ||
| 9393 | int in_option = 1; | ||
| 9394 | int before_value = 0; | ||
| 9395 | |||
| 9396 | do { | ||
| 9397 | ch = *xrm_option++; | ||
| 9398 | |||
| 9399 | if (ch == '\n') | ||
| 9400 | { | ||
| 9401 | *current++ = '\0'; | ||
| 9402 | in_option = 1; | ||
| 9403 | before_value = 0; | ||
| 9404 | } | ||
| 9405 | else if (ch != ' ') | ||
| 9406 | { | ||
| 9407 | *current++ = ch; | ||
| 9408 | if (in_option && (ch == ':')) | ||
| 9409 | { | ||
| 9410 | in_option = 0; | ||
| 9411 | before_value = 1; | ||
| 9412 | } | ||
| 9413 | else if (before_value) | ||
| 9414 | { | ||
| 9415 | before_value = 0; | ||
| 9416 | } | ||
| 9417 | } | ||
| 9418 | else if (!(in_option || before_value)) | ||
| 9419 | { | ||
| 9420 | *current++ = ch; | ||
| 9421 | } | ||
| 9422 | } while (ch); | ||
| 9423 | 9383 | ||
| 9424 | *current = '\0'; | 9384 | database = xrm_get_preference_database (NULL); |
| 9385 | if (xrm_option) | ||
| 9386 | xrm_merge_string_database (database, xrm_option); | ||
| 9425 | 9387 | ||
| 9426 | return buffer; | 9388 | return database; |
| 9427 | } | 9389 | } |
| 9428 | 9390 | ||
| 9429 | struct mac_display_info * | 9391 | struct mac_display_info * |
| @@ -9449,14 +9411,15 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 9449 | 9411 | ||
| 9450 | dpyinfo = &one_mac_display_info; | 9412 | dpyinfo = &one_mac_display_info; |
| 9451 | 9413 | ||
| 9452 | dpyinfo->xrdb = xrm_option ? mac_make_rdb (xrm_option) : NULL; | 9414 | dpyinfo->xrdb = mac_make_rdb (xrm_option); |
| 9453 | 9415 | ||
| 9454 | /* Put this display on the chain. */ | 9416 | /* Put this display on the chain. */ |
| 9455 | dpyinfo->next = x_display_list; | 9417 | dpyinfo->next = x_display_list; |
| 9456 | x_display_list = dpyinfo; | 9418 | x_display_list = dpyinfo; |
| 9457 | 9419 | ||
| 9458 | /* Put it on x_display_name_list. */ | 9420 | /* Put it on x_display_name_list. */ |
| 9459 | x_display_name_list = Fcons (Fcons (display_name, Qnil), | 9421 | x_display_name_list = Fcons (Fcons (display_name, |
| 9422 | Fcons (Qnil, dpyinfo->xrdb)), | ||
| 9460 | x_display_name_list); | 9423 | x_display_name_list); |
| 9461 | dpyinfo->name_list_element = XCAR (x_display_name_list); | 9424 | dpyinfo->name_list_element = XCAR (x_display_name_list); |
| 9462 | 9425 | ||