diff options
author | Dmitry Antipov <[email protected]> | 2013-03-20 13:56:19 +0400 |
---|---|---|
committer | Dmitry Antipov <[email protected]> | 2013-03-20 13:56:19 +0400 |
commit | 42143acda9a3993f383cf1c9688831cba8200d10 (patch) | |
tree | 0bb5855507dcf8b8d1741bee75117f0fa14ec450 /src/frame.h | |
parent | 47077837aff40030430e3d1d0522fee5db62ee1e (diff) |
* frame.h (struct frame): Drop resx and resy because the same data is
available from window system-specific output context. Adjust users.
(default_pixesls_per_inch_x, default_pixesls_per_inch_y): New
functions to provide defaults when no window system available.
(FRAME_RES_X, FRAME_RES_Y): New macros.
(NUMVAL): Moved from xdisp.c.
* font.c (font_pixel_size, font_find_for_lface, font_open_for_lface)
(Ffont_face_attributes, Fopen_font):
* image.c (gs_load):
* w32font.c (fill_in_logfont):
* xdisp.c (calc_pixel_width_or_height):
* xfaces.c (Fx_family_fonts, set_lface_from_font): Use them.
* xsettings.c (apply_xft_settings): Drop frame loop and adjust comment.
Diffstat (limited to 'src/frame.h')
-rw-r--r-- | src/frame.h | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/src/frame.h b/src/frame.h index c18b766207..7a4943327e 100644 --- a/src/frame.h +++ b/src/frame.h @@ -276,9 +276,6 @@ struct frame /* Size of the frame window in pixels. */ int pixel_height, pixel_width; - /* Dots per inch of the screen the frame is on. */ - double resx, resy; - /* These many pixels are the difference between the outer window (i.e. the left and top of the window manager decoration) and FRAME_X_WINDOW. */ int x_pixels_diff, y_pixels_diff; @@ -569,6 +566,26 @@ fset_tool_bar_window (struct frame *f, Lisp_Object val) f->tool_bar_window = val; } +#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1) + +FRAME_INLINE double +default_pixels_per_inch_x (void) +{ + Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch) + ? XCAR (Vdisplay_pixels_per_inch) + : Vdisplay_pixels_per_inch); + return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0; +} + +FRAME_INLINE double +default_pixels_per_inch_y (void) +{ + Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch) + ? XCDR (Vdisplay_pixels_per_inch) + : Vdisplay_pixels_per_inch); + return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0; +} + #define FRAME_KBOARD(f) ((f)->terminal->kboard) /* Return a pointer to the image cache of frame F. */ @@ -602,6 +619,37 @@ typedef struct frame *FRAME_PTR; #else #define FRAME_NS_P(f) ((f)->output_method == output_ns) #endif + +/* Dots per inch of the screen the frame F is on. */ + +#ifdef HAVE_X_WINDOWS +#define FRAME_RES_X(f) \ + (eassert (FRAME_X_P (f)), FRAME_X_DISPLAY_INFO (f)->resx) +#define FRAME_RES_Y(f) \ + (eassert (FRAME_X_P (f)), FRAME_X_DISPLAY_INFO (f)->resy) +#endif + +#ifdef HAVE_NTGUI +#define FRAME_RES_X(f) \ + (eassert (FRAME_W32_P (f)), FRAME_W32_DISPLAY_INFO (f)->resx) +#define FRAME_RES_Y(f) \ + (eassert (FRAME_W32_P (f)), FRAME_W32_DISPLAY_INFO (f)->resy) +#endif + +#ifdef HAVE_NS +#define FRAME_RES_X(f) \ + (eassert (FRAME_NS_P (f)), FRAME_NS_DISPLAY_INFO (f)->resx) +#define FRAME_RES_Y(f) \ + (eassert (FRAME_NS_P (f)), FRAME_NS_DISPLAY_INFO (f)->resy) +#endif + +/* Defaults when no window system available. */ + +#ifndef FRAME_RES_X +#define FRAME_RES_X(f) default_pixels_per_inch_x () +#define FRAME_RES_Y(f) default_pixels_per_inch_y () +#endif + /* FRAME_WINDOW_P tests whether the frame is a window, and is defined to be the predicate for the window system being used. */ |