Mercurial > emacs
comparison src/macterm.c @ 60635:e45b939c1d93
(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.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Wed, 16 Mar 2005 08:08:06 +0000 |
parents | 5a3fa411c713 |
children | 441abfeebcb2 1830bcd0eec0 30ad2795fdab |
comparison
equal
deleted
inserted
replaced
60634:d936edb2f62e | 60635:e45b939c1d93 |
---|---|
127 use. */ | 127 use. */ |
128 | 128 |
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 |
138 /* This is display since Mac does not support multiple ones. */ | 141 /* This is display since Mac does not support multiple ones. */ |
139 struct mac_display_info one_mac_display_info; | 142 struct mac_display_info one_mac_display_info; |
6445 Lisp_Object newlist = Qnil, tem, key; | 6448 Lisp_Object newlist = Qnil, tem, key; |
6446 struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL; | 6449 struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL; |
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); |
6454 if (!NILP (newlist)) | 6457 if (!NILP (newlist)) |
6455 { | 6458 { |
6464 | 6467 |
6465 /* MAC_TODO: add code for matching outline fonts here */ | 6468 /* MAC_TODO: add code for matching outline fonts here */ |
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 |
6475 return newlist; | 6478 return newlist; |
6476 } | 6479 } |
9369 dpyinfo->mouse_face_window = Qnil; | 9372 dpyinfo->mouse_face_window = Qnil; |
9370 dpyinfo->mouse_face_overlay = Qnil; | 9373 dpyinfo->mouse_face_overlay = Qnil; |
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. | 9377 |
9375 The database is just a concatenation of C strings, finished by an additional | 9378 static XrmDatabase |
9376 \0. The string are submitted to some basic normalization, so | |
9377 | |
9378 [ *]option[ *]:[ *]value... | |
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; | 9383 |
9392 char ch; | 9384 database = xrm_get_preference_database (NULL); |
9393 int in_option = 1; | 9385 if (xrm_option) |
9394 int before_value = 0; | 9386 xrm_merge_string_database (database, xrm_option); |
9395 | 9387 |
9396 do { | 9388 return database; |
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 | |
9424 *current = '\0'; | |
9425 | |
9426 return buffer; | |
9427 } | 9389 } |
9428 | 9390 |
9429 struct mac_display_info * | 9391 struct mac_display_info * |
9430 mac_term_init (display_name, xrm_option, resource_name) | 9392 mac_term_init (display_name, xrm_option, resource_name) |
9431 Lisp_Object display_name; | 9393 Lisp_Object display_name; |
9447 | 9409 |
9448 mac_initialize_display_info (); | 9410 mac_initialize_display_info (); |
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 |
9463 UNBLOCK_INPUT; | 9426 UNBLOCK_INPUT; |
9464 | 9427 |