aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/nsfns.m82
2 files changed, 87 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5e4dbb7ae1c..6ef5746daa2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12015-02-22 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsfns.m (Fx_frame_geometry): New function.
4 (syms_of_nsfns): Defsubr Sx_frame_geometry.
5
12015-02-22 Paul Eggert <eggert@cs.ucla.edu> 62015-02-22 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Spelling fixes 8 Spelling fixes
diff --git a/src/nsfns.m b/src/nsfns.m
index 9e379e28429..f8863e6d400 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2806,6 +2806,87 @@ Value is t if tooltip was open, nil otherwise. */)
2806 return Qt; 2806 return Qt;
2807} 2807}
2808 2808
2809DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0,
2810 doc: /* Return geometric attributes of frame FRAME.
2811
2812FRAME must be a live frame and defaults to the selected one.
2813
2814The return value is an association list containing the following
2815elements (all size values are in pixels).
2816
2817- `frame-outer-size' is a cons of the outer width and height of FRAME.
2818 The outer size include the title bar and the external borders as well
2819 as any menu and/or tool bar of frame.
2820
2821- `border' is a cons of the horizontal and vertical width of FRAME's
2822 external borders.
2823
2824- `title-bar-height' is the height of the title bar of FRAME.
2825
2826- `menu-bar-external' if `t' means the menu bar is external (not
2827 included in the inner edges of FRAME).
2828
2829- `menu-bar-size' is a cons of the width and height of the menu bar of
2830 FRAME.
2831
2832- `tool-bar-external' if `t' means the tool bar is external (not
2833 included in the inner edges of FRAME).
2834
2835- `tool-bar-side' tells tells on which side the tool bar on FRAME is and
2836 can be one of `left', `top', `right' or `bottom'.
2837
2838- `tool-bar-size' is a cons of the width and height of the tool bar of
2839 FRAME.
2840
2841- `frame-inner-size' is a cons of the inner width and height of FRAME.
2842 This excludes FRAME's title bar and external border as well as any
2843 external menu and/or tool bar. */)
2844 (Lisp_Object frame)
2845{
2846 struct frame *f = decode_live_frame (frame);
2847 int inner_width = FRAME_PIXEL_WIDTH (f);
2848 int inner_height = FRAME_PIXEL_HEIGHT (f);
2849 Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen);
2850 int border = f->border_width;
2851 int title = FRAME_NS_TITLEBAR_HEIGHT (f);
2852 int outer_width = FRAME_PIXEL_WIDTH (f) + 2 * border;
2853 int outer_height = FRAME_PIXEL_HEIGHT (f) + 2 * border;
2854 int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
2855 int tool_bar_width = tool_bar_height > 0
2856 ? outer_width - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)
2857 : 0;
2858 // Always 0 on NS.
2859 int menu_bar_height = 0;
2860 int menu_bar_width = 0;
2861
2862 return
2863 listn (CONSTYPE_HEAP, 10,
2864 Fcons (Qframe_position,
2865 Fcons (make_number (f->left_pos), make_number (f->top_pos))),
2866 Fcons (Qframe_outer_size,
2867 Fcons (make_number (outer_width), make_number (outer_height))),
2868 Fcons (Qexternal_border_size,
2869 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
2870 ? Fcons (make_number (0), make_number (0))
2871 : Fcons (make_number (border), make_number (border)))),
2872 Fcons (Qtitle_height,
2873 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
2874 ? make_number (0)
2875 : make_number (title))),
2876 Fcons (Qmenu_bar_external, FRAME_EXTERNAL_MENU_BAR (f) ? Qt : Qnil),
2877 Fcons (Qmenu_bar_size,
2878 Fcons (make_number (menu_bar_width),
2879 make_number (menu_bar_height))),
2880 Fcons (Qtool_bar_external, FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
2881 Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
2882 Fcons (Qtool_bar_size,
2883 Fcons (make_number (tool_bar_width),
2884 make_number (tool_bar_height))),
2885 Fcons (Qframe_inner_size,
2886 Fcons (make_number (inner_width),
2887 make_number (inner_height))));
2888}
2889
2809 2890
2810/* ========================================================================== 2891/* ==========================================================================
2811 2892
@@ -2989,6 +3070,7 @@ be used as the image of the icon representing the frame. */);
2989 defsubr (&Sx_display_pixel_width); 3070 defsubr (&Sx_display_pixel_width);
2990 defsubr (&Sx_display_pixel_height); 3071 defsubr (&Sx_display_pixel_height);
2991 defsubr (&Sns_display_monitor_attributes_list); 3072 defsubr (&Sns_display_monitor_attributes_list);
3073 defsubr (&Sx_frame_geometry);
2992 defsubr (&Sx_display_mm_width); 3074 defsubr (&Sx_display_mm_width);
2993 defsubr (&Sx_display_mm_height); 3075 defsubr (&Sx_display_mm_height);
2994 defsubr (&Sx_display_screens); 3076 defsubr (&Sx_display_screens);