comparison src/faces.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 83b3d10dcba9
children c5d627a313b1
comparison
equal deleted inserted replaced
268:6ced69ccd85f 269:b2472a1930f2
38 #include "glyphs.h" 38 #include "glyphs.h"
39 #include "hash.h" 39 #include "hash.h"
40 #include "objects.h" 40 #include "objects.h"
41 #include "specifier.h" 41 #include "specifier.h"
42 #include "window.h" 42 #include "window.h"
43
44 #ifdef HAVE_X_WINDOWS
45 #include "console-x.h"
46 #include "objects-x.h"
47 #include "EmacsFrame.h"
48 #endif /* HAVE_X_WINDOWS */
49 43
50 /* Qfont, Qdoc_string, Qface defined in general.c */ 44 /* Qfont, Qdoc_string, Qface defined in general.c */
51 Lisp_Object Qfacep; 45 Lisp_Object Qfacep;
52 Lisp_Object Qforeground, Qbackground, Qdisplay_table; 46 Lisp_Object Qforeground, Qbackground, Qdisplay_table;
53 /* Qhighlight, Qreverse defined in general.c */ 47 /* Qhighlight, Qreverse defined in general.c */
725 void 719 void
726 default_face_height_and_width (Lisp_Object domain, 720 default_face_height_and_width (Lisp_Object domain,
727 int *height, int *width) 721 int *height, int *width)
728 { 722 {
729 default_face_font_info (domain, 0, 0, height, width, 0); 723 default_face_font_info (domain, 0, 0, height, width, 0);
724 }
725
726 void
727 default_face_height_and_width_1 (Lisp_Object domain,
728 int *height, int *width)
729 {
730 if (window_system_pixelated_geometry (domain))
731 {
732 if (height)
733 *height = 1;
734 if (width)
735 *width = 1;
736 }
737 else
738 default_face_height_and_width (domain, height, width);
730 } 739 }
731 740
732 DEFUN ("face-list", Fface_list, 0, 1, 0, /* 741 DEFUN ("face-list", Fface_list, 0, 1, 0, /*
733 Return a list of the names of all defined faces. 742 Return a list of the names of all defined faces.
734 If TEMPORARY is nil, only the permanent faces are included. 743 If TEMPORARY is nil, only the permanent faces are included.
1576 1585
1577 /***************************************************************************** 1586 /*****************************************************************************
1578 interface functions 1587 interface functions
1579 ****************************************************************************/ 1588 ****************************************************************************/
1580 1589
1581 /* #### This function should be converted into appropriate device methods. */
1582 static void 1590 static void
1583 update_EmacsFrame (Lisp_Object frame, Lisp_Object name) 1591 update_EmacsFrame (Lisp_Object frame, Lisp_Object name)
1584 { 1592 {
1585 struct frame *frm = XFRAME (frame); 1593 struct frame *frm = XFRAME (frame);
1586 1594 MAYBE_FRAMEMETH (frm, update_frame_external_traits, (frm, name));
1587 #ifdef HAVE_X_WINDOWS
1588 if (FRAME_X_P (frm))
1589 {
1590 Arg av[10];
1591 int ac = 0;
1592
1593 if (EQ (name, Qforeground))
1594 {
1595 Lisp_Object color = FACE_FOREGROUND (Vdefault_face, frame);
1596 XColor fgc;
1597
1598 if (!EQ (color, Vthe_null_color_instance))
1599 {
1600 fgc = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color));
1601 XtSetArg (av[ac], XtNforeground, (void *) fgc.pixel); ac++;
1602 }
1603 }
1604 else if (EQ (name, Qbackground))
1605 {
1606 Lisp_Object color = FACE_BACKGROUND (Vdefault_face, frame);
1607 XColor bgc;
1608
1609 if (!EQ (color, Vthe_null_color_instance))
1610 {
1611 bgc = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color));
1612 XtSetArg (av[ac], XtNbackground, (void *) bgc.pixel); ac++;
1613 }
1614
1615 /* Really crappy way to force the modeline shadows to be
1616 redrawn. But effective. */
1617 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (frm);
1618 MARK_FRAME_CHANGED (frm);
1619 }
1620 else if (EQ (name, Qfont))
1621 {
1622 Lisp_Object font = FACE_FONT (Vdefault_face, frame, Vcharset_ascii);
1623
1624 if (!EQ (font, Vthe_null_font_instance))
1625 XtSetArg (av[ac], XtNfont,
1626 (void *) FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)));
1627 ac++;
1628 }
1629 else
1630 abort ();
1631
1632 XtSetValues (FRAME_X_TEXT_WIDGET (frm), av, ac);
1633
1634 #ifdef HAVE_TOOLBARS
1635 /* Setting the background clears the entire frame area
1636 including the toolbar so we force an immediate redraw of
1637 it. */
1638 if (EQ (name, Qbackground))
1639 MAYBE_DEVMETH (XDEVICE (frm->device), redraw_frame_toolbars, (frm));
1640 #endif /* HAVE_TOOLBARS */
1641
1642 /* The intent of this code is to cause the frame size in
1643 characters to remain the same when the font changes, at the
1644 expense of changing the frame size in pixels. It's not
1645 totally clear that this is the right thing to do, but it's
1646 not clearly wrong either. */
1647 if (EQ (name, Qfont))
1648 {
1649 EmacsFrameRecomputeCellSize (FRAME_X_TEXT_WIDGET (frm));
1650 Fset_frame_size (frame,
1651 make_int (frm->width),
1652 make_int (frm->height),
1653 Qnil);
1654 }
1655 }
1656 #endif /* HAVE_X_WINDOWS */
1657 #ifdef HAVE_MS_WINDOWS
1658 if (CONSOLE_TYPESYM_MSWINDOWS_P (FRAME_TYPE (frm)))
1659 {
1660 /* Cause the frame size in characters to remain the same when the font
1661 * changes, at the expense of changing the frame size in pixels. */
1662 if (EQ (name, Qfont))
1663 {
1664 Fset_frame_size (frame,
1665 make_int (frm->width),
1666 make_int (frm->height),
1667 Qnil);
1668 }
1669 }
1670 #endif /* HAVE_MS_WINDOWS */
1671 } 1595 }
1672 1596
1673 static void 1597 static void
1674 update_EmacsFrames (Lisp_Object locale, Lisp_Object name) 1598 update_EmacsFrames (Lisp_Object locale, Lisp_Object name)
1675 { 1599 {