comparison src/device-x.c @ 388:aabb7f5b1c81 r21-2-9

Import from CVS: tag r21-2-9
author cvs
date Mon, 13 Aug 2007 11:09:42 +0200
parents bbff43aa5eb7
children 7d59cb494b73
comparison
equal deleted inserted replaced
387:f892a9d0bb8d 388:aabb7f5b1c81
1647 Display *dpy = get_x_display (device); 1647 Display *dpy = get_x_display (device);
1648 XUngrabKeyboard (dpy, CurrentTime); 1648 XUngrabKeyboard (dpy, CurrentTime);
1649 return Qnil; 1649 return Qnil;
1650 } 1650 }
1651 1651
1652 DEFUN ("x-get-font-path", Fx_get_font_path, 0, 1, 0, /*
1653 Get the X Server's font path.
1654
1655 See also `x-set-font-path'.
1656 */
1657 (device))
1658 {
1659 Display *dpy = get_x_display (device);
1660 int ndirs_return;
1661 CONST char **directories = (CONST char **) XGetFontPath (dpy, &ndirs_return);
1662 Lisp_Object font_path = Qnil;
1663
1664 if (!directories)
1665 signal_simple_error ("Can't get X font path", device);
1666
1667 while (ndirs_return--)
1668 font_path = Fcons (build_ext_string (directories[ndirs_return],
1669 FORMAT_FILENAME), font_path);
1670
1671 return font_path;
1672 }
1673
1674 DEFUN ("x-set-font-path", Fx_set_font_path, 1, 2, 0, /*
1675 Set the X Server's font path to FONT-PATH.
1676
1677 There is only one font path per server, not one per client. Use this
1678 sparingly. It uncaches all of the X server's font information.
1679
1680 Font directories should end in the path separator and should contain
1681 a file called fonts.dir usually created with the program mkfontdir.
1682
1683 Setting the FONT-PATH to nil tells the X server to use the default
1684 font path.
1685
1686 See also `x-get-font-path'.
1687 */
1688 (font_path, device))
1689 {
1690 Display *dpy = get_x_display (device);
1691 Lisp_Object path_entry;
1692 CONST char **directories;
1693 int i=0,ndirs=0;
1694
1695 EXTERNAL_LIST_LOOP (path_entry, font_path)
1696 {
1697 CHECK_STRING (XCAR (path_entry));
1698 ndirs++;
1699 }
1700
1701 directories = alloca_array (CONST char *, ndirs);
1702
1703 EXTERNAL_LIST_LOOP (path_entry, font_path)
1704 {
1705 GET_C_STRING_FILENAME_DATA_ALLOCA (XCAR (path_entry), directories[i++]);
1706 }
1707
1708 expect_x_error (dpy);
1709 XSetFontPath (dpy, (char **) directories, ndirs);
1710 signal_if_x_error (dpy, 1/*resumable_p*/);
1711
1712 return Qnil;
1713 }
1714
1652 1715
1653 /************************************************************************/ 1716 /************************************************************************/
1654 /* initialization */ 1717 /* initialization */
1655 /************************************************************************/ 1718 /************************************************************************/
1656 1719
1674 1737
1675 DEFSUBR (Fx_grab_pointer); 1738 DEFSUBR (Fx_grab_pointer);
1676 DEFSUBR (Fx_ungrab_pointer); 1739 DEFSUBR (Fx_ungrab_pointer);
1677 DEFSUBR (Fx_grab_keyboard); 1740 DEFSUBR (Fx_grab_keyboard);
1678 DEFSUBR (Fx_ungrab_keyboard); 1741 DEFSUBR (Fx_ungrab_keyboard);
1742
1743 DEFSUBR (Fx_get_font_path);
1744 DEFSUBR (Fx_set_font_path);
1679 1745
1680 defsymbol (&Qx_error, "x-error"); 1746 defsymbol (&Qx_error, "x-error");
1681 defsymbol (&Qinit_pre_x_win, "init-pre-x-win"); 1747 defsymbol (&Qinit_pre_x_win, "init-pre-x-win");
1682 defsymbol (&Qinit_post_x_win, "init-post-x-win"); 1748 defsymbol (&Qinit_post_x_win, "init-post-x-win");
1683 } 1749 }