diff options
author | Alexander Gramiak <agrambot@gmail.com> | 2019-04-13 09:40:03 -0600 |
---|---|---|
committer | Alexander Gramiak <agrambot@gmail.com> | 2019-04-26 16:54:17 -0600 |
commit | a411517faf624657aa58979f5463115115093309 (patch) | |
tree | bd75804dd99876f424c9e6805212e356683c54d4 /src/nsfns.m | |
parent | da9541dd1086b7bab52940c82915efe114bb7419 (diff) | |
download | emacs-a411517faf624657aa58979f5463115115093309.tar.gz |
Rename generic x_* identifiers
* src/image.c: Rename x_* procedures to image_*.
* src/frame.c: Rename x_* procedures to gui_*. Rename
xrdb_get_resource to gui_display_get_resource. Rename x_get_arg to
gui_display_get arg.
* src/frame.h: Rename can_x_set_window_size to can_set_window_size.
* src/xfaces.c: Rename realize_x_face to realize_gui_face. Rename
x_supports_face_attributes_p to gui_supports_face_attributes_p.
* src/keyboard.c:
* src/lisp.h:
* src/nsterm.m:
* src/w32term.c:
* src/xterm.c: Rename x_get_keysym_name to get_keysym_name.
* src/nsfns.c:
* src/nsterm.m: Rename x_* procedures to ns_*.
* src/w32fns.c:
* src/w32term.c: Rename x_* procedures to w32_*.
* src/termhooks.h (query_colors, get_focus_frame, focus_frame_hook)
(frame_visible_invisible_hook, iconify_frame_hook)
(set_window_size_hook, set_frame_offset_hook, set_frame_alpha_hook)
(set_new_font_hook, set_bitmap_icon_hook, implicit_set_name_hook)
(activate_menubar_hook, change_tool_bar_height_hook)
(set_scroll_bar_default_width_hook)
(set_scroll_bar_default_height_hook, get_string_resource_hook): New
terminal hooks to replace backend-specific x_* procedures.
* src/dispextern.h (clear_under_internal_border): New RIF procedure.
* src/alloc.c:
* src/frame.c:
* src/xdisp.c: Use FRAME_OUTPUT_DATA instead of FRAME_X_OUTPUT.
* src/frame.c:
* src/w32term.c:
* src/w32fns.c: Use FRAME_NATIVE_WINDOW instead of FRAME_X_WINDOW.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r-- | src/nsfns.m | 402 |
1 files changed, 194 insertions, 208 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 009e9d55e2b..2470c05c4b5 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -233,7 +233,7 @@ interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) static void -x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { NSColor *col; EmacsCGFloat r, g, b, alpha; @@ -269,7 +269,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) static void -x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { struct face *face; NSColor *col; @@ -325,7 +325,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) static void -x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { NSColor *col; @@ -351,10 +351,10 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) static void -x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { NSView *view = FRAME_NS_VIEW (f); - NSTRACE ("x_set_icon_name"); + NSTRACE ("ns_set_icon_name"); /* See if it's changed. */ if (STRINGP (arg)) @@ -508,9 +508,9 @@ ns_set_represented_filename (struct frame *f) specified a name for the frame; the name will override any set by the redisplay code. */ static void -x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - NSTRACE ("x_explicitly_set_name"); + NSTRACE ("ns_explicitly_set_name"); ns_set_name (f, arg, 1); } @@ -519,9 +519,9 @@ x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) name; names set this way will never override names set by the user's lisp code. */ void -x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - NSTRACE ("x_implicitly_set_name"); + NSTRACE ("ns_implicitly_set_name"); if (ns_use_proxy_icon) ns_set_represented_filename (f); @@ -534,9 +534,9 @@ x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) If NAME is nil, use the frame name as the title. */ static void -x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) +ns_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { - NSTRACE ("x_set_title"); + NSTRACE ("ns_set_title"); /* Don't change the title if it's already NAME. */ if (EQ (name, f->title)) return; @@ -582,7 +582,7 @@ ns_set_doc_edited (void) static void -x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) +ns_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; if (FRAME_MINIBUF_ONLY_P (f)) @@ -612,7 +612,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) /* toolbar support */ static void -x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) +ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { /* Currently, when the tool bar changes state, the frame is resized. @@ -621,7 +621,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) `frame-inhibit-implied-resize'. */ int nlines; - NSTRACE ("x_set_tool_bar_lines"); + NSTRACE ("ns_set_tool_bar_lines"); if (FRAME_MINIBUF_ONLY_P (f)) return; @@ -680,7 +680,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) static void -x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int old_width = FRAME_INTERNAL_BORDER_WIDTH (f); @@ -692,7 +692,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva if (FRAME_INTERNAL_BORDER_WIDTH (f) == old_width) return; - if (FRAME_X_WINDOW (f) != 0) + if (FRAME_NATIVE_WINDOW (f) != 0) adjust_frame_size (f, -1, -1, 3, 0, Qinternal_border_width); SET_FRAME_GARBAGED (f); @@ -771,13 +771,13 @@ ns_implicitly_set_icon_type (struct frame *f) static void -x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { EmacsView *view = FRAME_NS_VIEW (f); id image = nil; BOOL setMini = YES; - NSTRACE ("x_set_icon_type"); + NSTRACE ("ns_set_icon_type"); if (!NILP (arg) && SYMBOLP (arg)) { @@ -811,7 +811,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) /* This is the same as the xfns.c definition. */ static void -x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { set_frame_cursor_types (f, arg); } @@ -819,7 +819,7 @@ x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) /* called to set mouse pointer color, but all other terms use it to initialize pointer types (and don't set the color ;) */ static void -x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +ns_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { /* Don't think we can do this on Nextstep. */ } @@ -864,7 +864,7 @@ ns_appkit_version_int (void) static void -x_icon (struct frame *f, Lisp_Object parms) +ns_icon (struct frame *f, Lisp_Object parms) /* -------------------------------------------------------------------------- Strangely-named function to set icon position parameters in frame. This is irrelevant under macOS, but might be needed under GNUstep, @@ -879,8 +879,10 @@ x_icon (struct frame *f, Lisp_Object parms) f->output_data.ns->icon_left = -1; /* Set the position of the icon. */ - icon_x = x_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); - icon_y = x_get_arg (dpyinfo, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); + icon_x = gui_display_get_arg (dpyinfo, parms, Qicon_left, 0, 0, + RES_TYPE_NUMBER); + icon_y = gui_display_get_arg (dpyinfo, parms, Qicon_top, 0, 0, + RES_TYPE_NUMBER); if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) { CHECK_FIXNUM (icon_x); @@ -897,56 +899,56 @@ x_icon (struct frame *f, Lisp_Object parms) implemented. */ frame_parm_handler ns_frame_parm_handlers[] = { - x_set_autoraise, /* generic OK */ - x_set_autolower, /* generic OK */ - x_set_background_color, + gui_set_autoraise, /* generic OK */ + gui_set_autolower, /* generic OK */ + ns_set_background_color, 0, /* x_set_border_color, may be impossible under Nextstep */ 0, /* x_set_border_width, may be impossible under Nextstep */ - x_set_cursor_color, - x_set_cursor_type, - x_set_font, /* generic OK */ - x_set_foreground_color, - x_set_icon_name, - x_set_icon_type, - x_set_internal_border_width, /* generic OK */ - x_set_right_divider_width, - x_set_bottom_divider_width, - x_set_menu_bar_lines, - x_set_mouse_color, - x_explicitly_set_name, - x_set_scroll_bar_width, /* generic OK */ - x_set_scroll_bar_height, /* generic OK */ - x_set_title, - x_set_unsplittable, /* generic OK */ - x_set_vertical_scroll_bars, /* generic OK */ - x_set_horizontal_scroll_bars, /* generic OK */ - x_set_visibility, /* generic OK */ - x_set_tool_bar_lines, + ns_set_cursor_color, + ns_set_cursor_type, + gui_set_font, /* generic OK */ + ns_set_foreground_color, + ns_set_icon_name, + ns_set_icon_type, + ns_set_internal_border_width, + gui_set_right_divider_width, /* generic OK */ + gui_set_bottom_divider_width, /* generic OK */ + ns_set_menu_bar_lines, + ns_set_mouse_color, + ns_explicitly_set_name, + gui_set_scroll_bar_width, /* generic OK */ + gui_set_scroll_bar_height, /* generic OK */ + ns_set_title, + gui_set_unsplittable, /* generic OK */ + gui_set_vertical_scroll_bars, /* generic OK */ + gui_set_horizontal_scroll_bars, /* generic OK */ + gui_set_visibility, /* generic OK */ + ns_set_tool_bar_lines, 0, /* x_set_scroll_bar_foreground, will ignore (not possible on NS) */ 0, /* x_set_scroll_bar_background, will ignore (not possible on NS) */ - x_set_screen_gamma, /* generic OK */ - x_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */ - x_set_left_fringe, /* generic OK */ - x_set_right_fringe, /* generic OK */ + gui_set_screen_gamma, /* generic OK */ + gui_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */ + gui_set_left_fringe, /* generic OK */ + gui_set_right_fringe, /* generic OK */ 0, /* x_set_wait_for_wm, will ignore */ - x_set_fullscreen, /* generic OK */ - x_set_font_backend, /* generic OK */ - x_set_alpha, + gui_set_fullscreen, /* generic OK */ + gui_set_font_backend, /* generic OK */ + gui_set_alpha, 0, /* x_set_sticky */ 0, /* x_set_tool_bar_position */ 0, /* x_set_inhibit_double_buffering */ #ifdef NS_IMPL_COCOA - x_set_undecorated, + ns_set_undecorated, #else - 0, /* x_set_undecorated */ + 0, /* ns_set_undecorated */ #endif - x_set_parent_frame, + ns_set_parent_frame, 0, /* x_set_skip_taskbar */ - x_set_no_focus_on_map, - x_set_no_accept_focus, - x_set_z_group, /* x_set_z_group */ + ns_set_no_focus_on_map, + ns_set_no_accept_focus, + ns_set_z_group, 0, /* x_set_override_redirect */ - x_set_no_special_glyphs, + gui_set_no_special_glyphs, #ifdef NS_IMPL_COCOA ns_set_appearance, ns_set_transparent_titlebar, @@ -979,14 +981,14 @@ unwind_create_frame (Lisp_Object frame) private shadow variable, it means we are unwinding a frame for which we didn't yet call init_frame_faces, where the refcount is incremented. Therefore, we increment it here, so - that free_frame_faces, called in x_free_frame_resources + that free_frame_faces, called in ns_free_frame_resources below, will not mistakenly decrement the counter that was not incremented yet to account for this new frame. */ if (FRAME_IMAGE_CACHE (f) != NULL && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount) FRAME_IMAGE_CACHE (f)->refcount++; - x_free_frame_resources (f); + ns_free_frame_resources (f); free_glyphs (f); #if defined GLYPH_DEBUG && defined ENABLE_CHECKING @@ -1022,8 +1024,8 @@ get_geometry_from_preferences (struct ns_display_info *dpyinfo, if (NILP (Fassq (r[i].tem, parms))) { Lisp_Object value - = x_get_arg (dpyinfo, parms, r[i].tem, r[i].val, r[i].cls, - RES_TYPE_NUMBER); + = gui_display_get_arg (dpyinfo, parms, r[i].tem, r[i].val, r[i].cls, + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (r[i].tem, value), parms); } @@ -1056,14 +1058,15 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, static int desc_ctr = 1; int x_width = 0, x_height = 0; - /* x_get_arg modifies parms. */ + /* gui_display_get_arg modifies parms. */ parms = Fcopy_alist (parms); /* Use this general default value to start with until we know if this frame has a specified name. */ Vx_resource_name = Vinvocation_name; - display = x_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_STRING); + display = gui_display_get_arg (dpyinfo, parms, Qterminal, 0, 0, + RES_TYPE_STRING); if (EQ (display, Qunbound)) display = Qnil; dpyinfo = check_ns_display_info (display); @@ -1072,7 +1075,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, if (!dpyinfo->terminal->name) error ("Terminal is not live, can't create new frames on it"); - name = x_get_arg (dpyinfo, parms, Qname, 0, 0, RES_TYPE_STRING); + name = gui_display_get_arg (dpyinfo, parms, Qname, 0, 0, + RES_TYPE_STRING); if (!STRINGP (name) && ! EQ (name, Qunbound) && ! NILP (name)) @@ -1081,7 +1085,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, if (STRINGP (name)) Vx_resource_name = name; - parent = x_get_arg (dpyinfo, parms, Qparent_id, 0, 0, RES_TYPE_NUMBER); + parent = gui_display_get_arg (dpyinfo, parms, Qparent_id, 0, 0, + RES_TYPE_NUMBER); if (EQ (parent, Qunbound)) parent = Qnil; if (! NILP (parent)) @@ -1091,8 +1096,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, /* No need to protect DISPLAY because that's not used after passing it to make_frame_without_minibuffer. */ frame = Qnil; - tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer", - RES_TYPE_SYMBOL); + tem = gui_display_get_arg (dpyinfo, parms, Qminibuffer, + "minibuffer", "Minibuffer", + RES_TYPE_SYMBOL); if (EQ (tem, Qnone) || NILP (tem)) f = make_frame_without_minibuffer (Qnil, kb, display); else if (EQ (tem, Qonly)) @@ -1114,9 +1120,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, FRAME_FONTSET (f) = -1; - fset_icon_name (f, x_get_arg (dpyinfo, parms, Qicon_name, - "iconName", "Title", - RES_TYPE_STRING)); + fset_icon_name (f, gui_display_get_arg (dpyinfo, parms, Qicon_name, + "iconName", "Title", + RES_TYPE_STRING)); if (! STRINGP (f->icon_name)) fset_icon_name (f, Qnil); @@ -1162,35 +1168,35 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, image_cache_refcount = FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; - x_default_parameter (f, parms, Qfont_backend, Qnil, - "fontBackend", "FontBackend", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qfont_backend, Qnil, + "fontBackend", "FontBackend", RES_TYPE_STRING); { /* use for default font name */ id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ - x_default_parameter (f, parms, Qfontsize, - make_fixnum (0 /* (int)[font pointSize] */), - "fontSize", "FontSize", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qfontsize, + make_fixnum (0 /* (int)[font pointSize] */), + "fontSize", "FontSize", RES_TYPE_NUMBER); // Remove ' Regular', not handled by backends. char *fontname = xstrdup ([[font displayName] UTF8String]); int len = strlen (fontname); if (len > 8 && strcmp (fontname + len - 8, " Regular") == 0) fontname[len-8] = '\0'; - x_default_parameter (f, parms, Qfont, - build_string (fontname), - "font", "Font", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qfont, + build_string (fontname), + "font", "Font", RES_TYPE_STRING); xfree (fontname); } unblock_input (); - x_default_parameter (f, parms, Qborder_width, make_fixnum (0), - "borderwidth", "BorderWidth", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2), - "internalBorderWidth", "InternalBorderWidth", - RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), + gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), + "borderwidth", "BorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2), + "internalBorderWidth", "InternalBorderWidth", + RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), NULL, NULL, RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), + gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), NULL, NULL, RES_TYPE_NUMBER); /* default vertical scrollbars on right on Mac */ @@ -1201,57 +1207,61 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, #else = Qright; #endif - x_default_parameter (f, parms, Qvertical_scroll_bars, spos, - "verticalScrollBars", "VerticalScrollBars", - RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qvertical_scroll_bars, spos, + "verticalScrollBars", "VerticalScrollBars", + RES_TYPE_SYMBOL); } - x_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil, - "horizontalScrollBars", "HorizontalScrollBars", - RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qforeground_color, build_string ("Black"), - "foreground", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qbackground_color, build_string ("White"), - "background", "Background", RES_TYPE_STRING); - x_default_parameter (f, parms, Qline_spacing, Qnil, - "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qleft_fringe, Qnil, - "leftFringe", "LeftFringe", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qright_fringe, Qnil, - "rightFringe", "RightFringe", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qno_special_glyphs, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil, + "horizontalScrollBars", "HorizontalScrollBars", + RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qforeground_color, build_string ("Black"), + "foreground", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qbackground_color, build_string ("White"), + "background", "Background", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qline_spacing, Qnil, + "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qleft_fringe, Qnil, + "leftFringe", "LeftFringe", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qright_fringe, Qnil, + "rightFringe", "RightFringe", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qno_special_glyphs, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); init_frame_faces (f); /* Read comment about this code in corresponding place in xfns.c. */ - tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER); + tem = gui_display_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, + RES_TYPE_NUMBER); if (FIXNUMP (tem)) store_frame_param (f, Qmin_width, tem); - tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER); + tem = gui_display_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, + RES_TYPE_NUMBER); if (FIXNUMP (tem)) store_frame_param (f, Qmin_height, tem); adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, Qx_create_frame_1); - tem = x_get_arg (dpyinfo, parms, Qundecorated, NULL, NULL, RES_TYPE_BOOLEAN); + tem = gui_display_get_arg (dpyinfo, parms, Qundecorated, NULL, NULL, + RES_TYPE_BOOLEAN); FRAME_UNDECORATED (f) = !NILP (tem) && !EQ (tem, Qunbound); store_frame_param (f, Qundecorated, FRAME_UNDECORATED (f) ? Qt : Qnil); #ifdef NS_IMPL_COCOA - tem = x_get_arg (dpyinfo, parms, Qns_appearance, NULL, NULL, RES_TYPE_SYMBOL); + tem = gui_display_get_arg (dpyinfo, parms, Qns_appearance, NULL, NULL, + RES_TYPE_SYMBOL); FRAME_NS_APPEARANCE (f) = EQ (tem, Qdark) ? ns_appearance_vibrant_dark : ns_appearance_aqua; store_frame_param (f, Qns_appearance, tem); - tem = x_get_arg (dpyinfo, parms, Qns_transparent_titlebar, - NULL, NULL, RES_TYPE_BOOLEAN); + tem = gui_display_get_arg (dpyinfo, parms, Qns_transparent_titlebar, + NULL, NULL, RES_TYPE_BOOLEAN); FRAME_NS_TRANSPARENT_TITLEBAR (f) = !NILP (tem) && !EQ (tem, Qunbound); store_frame_param (f, Qns_transparent_titlebar, tem); #endif - parent_frame = x_get_arg (dpyinfo, parms, Qparent_frame, NULL, NULL, - RES_TYPE_SYMBOL); + parent_frame = gui_display_get_arg (dpyinfo, parms, Qparent_frame, NULL, NULL, + RES_TYPE_SYMBOL); /* Accept parent-frame iff parent-id was not specified. */ if (!NILP (parent) || EQ (parent_frame, Qunbound) @@ -1263,33 +1273,35 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, fset_parent_frame (f, parent_frame); store_frame_param (f, Qparent_frame, parent_frame); - x_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qno_focus_on_map, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qno_accept_focus, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qno_focus_on_map, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qno_accept_focus, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); /* The resources controlling the menu-bar and tool-bar are processed specially at startup, and reflected in the mode variables; ignore them here. */ - x_default_parameter (f, parms, Qmenu_bar_lines, - NILP (Vmenu_bar_mode) - ? make_fixnum (0) : make_fixnum (1), - NULL, NULL, RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qtool_bar_lines, - NILP (Vtool_bar_mode) - ? make_fixnum (0) : make_fixnum (1), - NULL, NULL, RES_TYPE_NUMBER); - - x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", - "BufferPredicate", RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", - RES_TYPE_STRING); + gui_default_parameter (f, parms, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_fixnum (0) : make_fixnum (1), + NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_fixnum (0) : make_fixnum (1), + NULL, NULL, RES_TYPE_NUMBER); + + gui_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", + "BufferPredicate", RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", + RES_TYPE_STRING); parms = get_geometry_from_preferences (dpyinfo, parms); - window_prompting = x_figure_window_size (f, parms, true, &x_width, &x_height); + window_prompting = gui_figure_window_size (f, parms, true, + &x_width, &x_height); - tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); + tem = gui_display_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, + RES_TYPE_BOOLEAN); f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !NILP (tem)); /* NOTE: on other terms, this is done in set_mouse_color, however this @@ -1320,7 +1332,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, [[EmacsView alloc] initFrameFromEmacs: f]; - x_icon (f, parms); + ns_icon (f, parms); /* ns_display_info does not have a reference_count. */ f->terminal->reference_count++; @@ -1330,28 +1342,28 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, won't work. */ Vframe_list = Fcons (frame, Vframe_list); - x_default_parameter (f, parms, Qicon_type, Qnil, - "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); - - x_default_parameter (f, parms, Qauto_raise, Qnil, - "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qauto_lower, Qnil, - "autoLower", "AutoLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qcursor_type, Qbox, - "cursorType", "CursorType", RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qscroll_bar_width, Qnil, - "scrollBarWidth", "ScrollBarWidth", - RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qscroll_bar_height, Qnil, - "scrollBarHeight", "ScrollBarHeight", - RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qalpha, Qnil, - "alpha", "Alpha", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qfullscreen, Qnil, - "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); - - /* Allow x_set_window_size, now. */ - f->can_x_set_window_size = true; + gui_default_parameter (f, parms, Qicon_type, Qnil, + "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); + + gui_default_parameter (f, parms, Qauto_raise, Qnil, + "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qauto_lower, Qnil, + "autoLower", "AutoLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qcursor_type, Qbox, + "cursorType", "CursorType", RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qscroll_bar_width, Qnil, + "scrollBarWidth", "ScrollBarWidth", + RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qscroll_bar_height, Qnil, + "scrollBarHeight", "ScrollBarHeight", + RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qalpha, Qnil, + "alpha", "Alpha", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qfullscreen, Qnil, + "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); + + /* Allow set_window_size_hook, now. */ + f->can_set_window_size = true; if (x_width > 0) SET_FRAME_WIDTH (f, x_width); @@ -1365,16 +1377,16 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, { Lisp_Object visibility; - visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, - RES_TYPE_SYMBOL); + visibility = gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0, + RES_TYPE_SYMBOL); if (EQ (visibility, Qunbound)) visibility = Qt; if (EQ (visibility, Qicon)) - x_iconify_frame (f); + ns_iconify_frame (f); else if (! NILP (visibility)) { - x_make_frame_visible (f); + ns_make_frame_visible (f); [[FRAME_NS_VIEW (f) window] makeKeyWindow]; } else @@ -1388,14 +1400,15 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) kset_default_minibuffer_frame (kb, frame); - /* All remaining specified parameters, which have not been "used" - by x_get_arg and friends, now go in the misc. alist of the frame. */ + /* All remaining specified parameters, which have not been "used" by + gui_display_get_arg and friends, now go in the misc. alist of the + frame. */ for (tem = parms; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) fset_param_alist (f, Fcons (XCAR (tem), f->param_alist)); if (window_prompting & USPosition) - x_set_offset (f, f->left_pos, f->top_pos, 1); + ns_set_offset (f, f->left_pos, f->top_pos, 1); /* Make sure windows on this frame appear in calls to next-window and similar functions. */ @@ -1404,21 +1417,6 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, return unbind_to (count, frame); } -void -x_focus_frame (struct frame *f, bool noactivate) -{ - struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - - if (dpyinfo->x_focus_frame != f) - { - EmacsView *view = FRAME_NS_VIEW (f); - block_input (); - [NSApp activateIgnoringOtherApps: YES]; - [[view window] makeKeyAndOrderFront: view]; - unblock_input (); - } -} - static BOOL ns_window_is_ancestor (NSWindow *win, NSWindow *candidate) /* Test whether CANDIDATE is an ancestor window of WIN. */ @@ -1790,7 +1788,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, { struct ns_display_info *dpyinfo = check_ns_display_info (terminal); - return make_fixnum (x_display_pixel_height (dpyinfo) / (92.0/25.4)); + return make_fixnum (ns_display_pixel_height (dpyinfo) / (92.0/25.4)); } @@ -1800,7 +1798,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, { struct ns_display_info *dpyinfo = check_ns_display_info (terminal); - return make_fixnum (x_display_pixel_width (dpyinfo) / (92.0/25.4)); + return make_fixnum (ns_display_pixel_width (dpyinfo) / (92.0/25.4)); } @@ -2230,7 +2228,7 @@ check_x_display_info (Lisp_Object frame) void -x_set_scroll_bar_default_width (struct frame *f) +ns_set_scroll_bar_default_width (struct frame *f) { int wid = FRAME_COLUMN_WIDTH (f); FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = NS_SCROLL_BAR_WIDTH_DEFAULT; @@ -2239,7 +2237,7 @@ x_set_scroll_bar_default_width (struct frame *f) } void -x_set_scroll_bar_default_height (struct frame *f) +ns_set_scroll_bar_default_height (struct frame *f) { int height = FRAME_LINE_HEIGHT (f); FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = NS_SCROLL_BAR_WIDTH_DEFAULT; @@ -2248,8 +2246,8 @@ x_set_scroll_bar_default_height (struct frame *f) } /* Terms implement this instead of x-get-resource directly. */ -char * -x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) +const char * +ns_get_string_resource (void *_rdb, const char *name, const char *class) { /* remove appname prefix; TODO: allow for !="Emacs" */ const char *res, *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0); @@ -2261,24 +2259,10 @@ x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) return NULL; res = ns_get_defaults_value (toCheck); - return (char *) (!res ? NULL - : !c_strncasecmp (res, "YES", 3) ? "true" - : !c_strncasecmp (res, "NO", 2) ? "false" - : res); -} - - -Lisp_Object -x_get_focus_frame (struct frame *frame) -{ - struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); - Lisp_Object nsfocus; - - if (!dpyinfo->x_focus_frame) - return Qnil; - - XSETFRAME (nsfocus, dpyinfo->x_focus_frame); - return nsfocus; + return (const char *) (!res ? NULL + : !c_strncasecmp (res, "YES", 3) ? "true" + : !c_strncasecmp (res, "NO", 2) ? "false" + : res); } /* ========================================================================== @@ -2361,7 +2345,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, { struct ns_display_info *dpyinfo = check_ns_display_info (terminal); - return make_fixnum (x_display_pixel_width (dpyinfo)); + return make_fixnum (ns_display_pixel_width (dpyinfo)); } @@ -2372,7 +2356,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height, { struct ns_display_info *dpyinfo = check_ns_display_info (terminal); - return make_fixnum (x_display_pixel_height (dpyinfo)); + return make_fixnum (ns_display_pixel_height (dpyinfo)); } #ifdef NS_IMPL_COCOA @@ -2659,7 +2643,7 @@ compute_tip_xy (struct frame *f, { /* Absolute coordinates. */ pt.x = FIXNUMP (left) ? XFIXNUM (left) : XFIXNUM (right); - pt.y = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) + pt.y = (ns_display_pixel_height (FRAME_DISPLAY_INFO (f)) - (FIXNUMP (top) ? XFIXNUM (top) : XFIXNUM (bottom)) - height); } @@ -2748,11 +2732,13 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, else Fx_hide_tip (); - t = x_get_arg (NULL, parms, Qbackground_color, NULL, NULL, RES_TYPE_STRING); + t = gui_display_get_arg (NULL, parms, Qbackground_color, NULL, NULL, + RES_TYPE_STRING); if (ns_lisp_to_color (t, &color) == 0) [ns_tooltip setBackgroundColor: color]; - t = x_get_arg (NULL, parms, Qforeground_color, NULL, NULL, RES_TYPE_STRING); + t = gui_display_get_arg (NULL, parms, Qforeground_color, NULL, NULL, + RES_TYPE_STRING); if (ns_lisp_to_color (t, &color) == 0) [ns_tooltip setForegroundColor: color]; |