diff options
| author | Chong Yidong | 2008-06-10 20:56:58 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-06-10 20:56:58 +0000 |
| commit | 9bf80974813dbad1f95dae3116e29bbaf42a213d (patch) | |
| tree | 5b958904976503de69283fd447248e1750069721 /src | |
| parent | 3402c0a6f1ced295fd038dd41d361024da087cfd (diff) | |
| download | emacs-9bf80974813dbad1f95dae3116e29bbaf42a213d.tar.gz emacs-9bf80974813dbad1f95dae3116e29bbaf42a213d.zip | |
(Fx_font_dialog): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/xfns.c b/src/xfns.c index 875c1599fe5..df350a36e93 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5628,6 +5628,47 @@ directories. */) | |||
| 5628 | return unbind_to (count, decoded_file); | 5628 | return unbind_to (count, decoded_file); |
| 5629 | } | 5629 | } |
| 5630 | 5630 | ||
| 5631 | |||
| 5632 | #ifdef HAVE_FREETYPE | ||
| 5633 | |||
| 5634 | DEFUN ("x-font-dialog", Fx_font_dialog, Sx_font_dialog, 0, 0, 0, | ||
| 5635 | doc: /* Read a font name using a font selection dialog. | ||
| 5636 | The font name is returned as a string. */) | ||
| 5637 | () | ||
| 5638 | { | ||
| 5639 | FRAME_PTR f = SELECTED_FRAME (); | ||
| 5640 | char *fontname; | ||
| 5641 | Lisp_Object font = Qnil; | ||
| 5642 | int count = SPECPDL_INDEX (); | ||
| 5643 | |||
| 5644 | check_x (); | ||
| 5645 | |||
| 5646 | if (popup_activated ()) | ||
| 5647 | error ("Trying to use a menu from within a menu-entry"); | ||
| 5648 | |||
| 5649 | /* Prevent redisplay. */ | ||
| 5650 | specbind (Qinhibit_redisplay, Qt); | ||
| 5651 | record_unwind_protect (clean_up_dialog, Qnil); | ||
| 5652 | |||
| 5653 | BLOCK_INPUT; | ||
| 5654 | |||
| 5655 | fontname = xg_get_font_name (f, NULL); | ||
| 5656 | |||
| 5657 | if (fontname) | ||
| 5658 | { | ||
| 5659 | font = build_string (fontname); | ||
| 5660 | xfree (fontname); | ||
| 5661 | } | ||
| 5662 | |||
| 5663 | UNBLOCK_INPUT; | ||
| 5664 | |||
| 5665 | if (NILP (font)) | ||
| 5666 | Fsignal (Qquit, Qnil); | ||
| 5667 | |||
| 5668 | return unbind_to (count, font); | ||
| 5669 | } | ||
| 5670 | #endif /* HAVE_FREETYPE */ | ||
| 5671 | |||
| 5631 | #endif /* USE_GTK */ | 5672 | #endif /* USE_GTK */ |
| 5632 | 5673 | ||
| 5633 | 5674 | ||
| @@ -5993,6 +6034,10 @@ the tool bar buttons. */); | |||
| 5993 | #if defined (USE_MOTIF) || defined (USE_GTK) | 6034 | #if defined (USE_MOTIF) || defined (USE_GTK) |
| 5994 | defsubr (&Sx_file_dialog); | 6035 | defsubr (&Sx_file_dialog); |
| 5995 | #endif | 6036 | #endif |
| 6037 | |||
| 6038 | #ifdef USE_GTK | ||
| 6039 | defsubr (&Sx_font_dialog); | ||
| 6040 | #endif | ||
| 5996 | } | 6041 | } |
| 5997 | 6042 | ||
| 5998 | #endif /* HAVE_X_WINDOWS */ | 6043 | #endif /* HAVE_X_WINDOWS */ |