commit 8dc00b2f1e6523c634df3e24379afbe712a32b27 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat Apr 27 11:34:05 2019 +0300 Fix -nw sessions on MS-Windows broken by a recent commit * src/w32console.c: Include dispextern.h. (initialize_w32_display): Populate defined_color_hook. diff --git a/src/w32console.c b/src/w32console.c index df232ecd1a..8575c930a8 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "coding.h" #include "termchar.h" /* for FRAME_TTY */ +#include "dispextern.h" /* for tty_defined_color */ #include "menu.h" /* for tty_menu_show */ #include "w32term.h" #include "w32common.h" /* for os_subtype */ @@ -673,6 +674,7 @@ initialize_w32_display (struct terminal *term, int *width, int *height) term->update_begin_hook = w32con_update_begin; term->update_end_hook = w32con_update_end; + term->defined_color_hook = &tty_defined_color; /* xfaces.c */ term->read_socket_hook = w32_console_read_socket; term->mouse_position_hook = w32_console_mouse_position; term->menu_show_hook = tty_menu_show; commit fb834ea3f0226cf0de740445dc11dccd6e867779 Author: Eli Zaretskii Date: Sat Apr 27 10:43:05 2019 +0300 Fix MS-Windows build broken by a recent commit * src/w32term.c (w32_new_focus_frame): Fix a typo in a recent commit. diff --git a/src/w32term.c b/src/w32term.c index 3811585d0f..451dd54dd8 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2940,7 +2940,7 @@ w32_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) dpyinfo->w32_pending_autoraise_frame = NULL; } - w32_reframe_highlight_1 (dpyinfo); + w32_frame_rehighlight_1 (dpyinfo); } commit 9921b78a4d0135347917d9cd9cc9f2df8dcc2a3d Author: YAMAMOTO Mitsuharu Date: Sat Apr 27 15:27:36 2019 +0900 Fix --with-x-toolkit=no build breakage * oldXMenu/Create.c (XMenuCreate): Add const modifier to variable def_val. * oldXMenu/Create.c: * src/frame.h: Add const modifier to return type of x_get_resource_string. * src/frame.c (x_get_resource_string): Exempt x_get_string_resource from renaming generic x_* identifiers. diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c index 2ea84e921a..58d1782662 100644 --- a/oldXMenu/Create.c +++ b/oldXMenu/Create.c @@ -87,7 +87,7 @@ along with this program. If not, see . */ #define XASSOC_TABLE_SIZE 64 -char *x_get_resource_string (char const *, char const *); +const char *x_get_resource_string (char const *, char const *); @@ -107,7 +107,7 @@ XMenuCreate(Display *display, Window parent, register char const *def_env) /* Window ID of the menu's parent window. */ /* X Defaults program environment name. */ { - register char *def_val; /* X Default value temp variable. */ + register const char *def_val; /* X Default value temp variable. */ register XMenu *menu; /* Pointer to the new menu. */ XMStyle menu_style; /* Menu display style. */ diff --git a/src/frame.c b/src/frame.c index 7f951b4f73..03bbbfb4da 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5045,8 +5045,8 @@ x_get_resource_string (const char *attribute, const char *class) esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); - result = gui_display_get_resource (FRAME_DISPLAY_INFO (sf), - name_key, class_key); + result = x_get_string_resource (&FRAME_DISPLAY_INFO (sf)->rdb, + name_key, class_key); SAFE_FREE (); return result; } diff --git a/src/frame.h b/src/frame.h index 70597737d4..b8aed823af 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1588,7 +1588,7 @@ extern enum internal_border_part frame_internal_border_part (struct frame *f, in #if defined HAVE_X_WINDOWS extern void x_wm_set_icon_position (struct frame *, int, int); #if !defined USE_X_TOOLKIT -extern char *x_get_resource_string (const char *, const char *); +extern const char *x_get_resource_string (const char *, const char *); #endif extern void x_sync (struct frame *); #endif /* HAVE_X_WINDOWS */ commit 28220664714c50996d8318788289e1c69d69b8ab Author: YAMAMOTO Mitsuharu Date: Sat Apr 27 14:43:19 2019 +0900 Update multicolor font support status * etc/NEWS: Mention multicolor font support on Cairo and NS. * src/macfont.m (macfont_list): Re-enable color bitmap fonts. diff --git a/etc/NEWS b/etc/NEWS index 721ebb2ded..cf6f4fea3e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -337,6 +337,9 @@ longer. directories searched for byte-compiler error messages (this used to be controlled by compilation-search-path). +** Multicolor fonts such as "Noto Color Emoji" can be displayed on +Emacs configured with Cairo drawing and linked with cairo >= 1.16.0. + * Editing Changes in Emacs 27.1 @@ -1977,6 +1980,9 @@ modifier keys in line with Apples guidelines. This makes the drag and drop behaviour more consistent, as previously the sending application was able to 'set' modifiers without the knowledge of the user. +** On NS multicolor font display is enabled again since it is also +implemented in Emacs on free operating systems via Cairo drawing. + ---------------------------------------------------------------------- This file is part of GNU Emacs. diff --git a/src/macfont.m b/src/macfont.m index 59627823fa..d8e86201f5 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -2344,9 +2344,9 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no != (spacing >= FONT_SPACING_MONO))) continue; - /* Don't use a color bitmap font until it is supported on - free platforms. */ - if (sym_traits & kCTFontTraitColorGlyphs) + /* Don't use a color bitmap font unless its family is + explicitly specified. */ + if ((sym_traits & kCTFontTraitColorGlyphs) && NILP (family)) continue; if (j > 0 commit dfa7f367a0b8987f21f36f6fdf81a45fea8b3d08 Author: Alexander Gramiak Date: Fri Apr 26 21:49:52 2019 -0600 * src/frame.c (x_get_resource_string): Fix typo diff --git a/src/frame.c b/src/frame.c index 328facd2d5..7f951b4f73 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5045,7 +5045,7 @@ x_get_resource_string (const char *attribute, const char *class) esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); - result = gui_display_get_resource (&FRAME_DISPLAY_INFO (sf)->rdb, + result = gui_display_get_resource (FRAME_DISPLAY_INFO (sf), name_key, class_key); SAFE_FREE (); return result; commit f257a0a5b44b58e4d0dcd9cf2d66b31ab80500a5 Author: Alexander Gramiak Date: Fri Apr 26 21:32:06 2019 -0600 * src/xdisp.c: Only check FRAME_RIF for graphical frames diff --git a/src/xdisp.c b/src/xdisp.c index 9f0739e0c6..d52d1333a0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11599,7 +11599,8 @@ clear_garbaged_frames (void) clear_current_matrices (f); #ifdef HAVE_WINDOW_SYSTEM - if (FRAME_RIF (f)->clear_under_internal_border) + if (FRAME_WINDOW_P (f) + && FRAME_RIF (f)->clear_under_internal_border) FRAME_RIF (f)->clear_under_internal_border (f); #endif fset_redisplay (f); @@ -11671,7 +11672,8 @@ echo_area_display (bool update_frame_p) n = redisplay_mode_lines (FRAME_ROOT_WINDOW (f), false); #ifdef HAVE_WINDOW_SYSTEM - if (FRAME_RIF (f)->clear_under_internal_border) + if (FRAME_WINDOW_P (f) + && FRAME_RIF (f)->clear_under_internal_border) FRAME_RIF (f)->clear_under_internal_border (f); #endif } @@ -14497,7 +14499,8 @@ redisplay_internal (void) goto retry; #ifdef HAVE_WINDOW_SYSTEM - if (FRAME_RIF (f)->clear_under_internal_border) + if (FRAME_WINDOW_P (f) + && FRAME_RIF (f)->clear_under_internal_border) FRAME_RIF (f)->clear_under_internal_border (f); #endif /* Prevent various kinds of signals during display commit 02397678b1169849a098c42f625b31da1f79c48e Author: Alexander Gramiak Date: Wed Apr 17 07:39:25 2019 -0600 Rename x_highlight_frame property to highlight_frame * src/nsterm.h: * src/nsterm.m: * src/w32term.c: * src/w32term.h: * src/xdisp.c: * src/xterm.c: * src/xterm.h: Rename. diff --git a/src/nsterm.h b/src/nsterm.h index 41cdaccbc7..683f2dd934 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -881,7 +881,7 @@ struct ns_display_info mouse-face. */ Mouse_HLInfo mouse_highlight; - struct frame *x_highlight_frame; + struct frame *highlight_frame; struct frame *ns_focus_frame; /* The frame where the mouse was last time we reported a mouse event. */ diff --git a/src/nsterm.m b/src/nsterm.m index cf1ff05530..cdf1916e71 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1540,36 +1540,36 @@ -(void)remove -------------------------------------------------------------------------- */ { struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); - struct frame *old_highlight = dpyinfo->x_highlight_frame; + struct frame *old_highlight = dpyinfo->highlight_frame; NSTRACE ("ns_frame_rehighlight"); if (dpyinfo->ns_focus_frame) { - dpyinfo->x_highlight_frame + dpyinfo->highlight_frame = (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) : dpyinfo->ns_focus_frame); - if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame)) + if (!FRAME_LIVE_P (dpyinfo->highlight_frame)) { fset_focus_frame (dpyinfo->ns_focus_frame, Qnil); - dpyinfo->x_highlight_frame = dpyinfo->ns_focus_frame; + dpyinfo->highlight_frame = dpyinfo->ns_focus_frame; } } else - dpyinfo->x_highlight_frame = 0; + dpyinfo->highlight_frame = 0; - if (dpyinfo->x_highlight_frame && - dpyinfo->x_highlight_frame != old_highlight) + if (dpyinfo->highlight_frame && + dpyinfo->highlight_frame != old_highlight) { if (old_highlight) { gui_update_cursor (old_highlight, 1); ns_set_frame_alpha (old_highlight); } - if (dpyinfo->x_highlight_frame) + if (dpyinfo->highlight_frame) { - gui_update_cursor (dpyinfo->x_highlight_frame, 1); - ns_set_frame_alpha (dpyinfo->x_highlight_frame); + gui_update_cursor (dpyinfo->highlight_frame, 1); + ns_set_frame_alpha (dpyinfo->highlight_frame); } } } @@ -1667,8 +1667,8 @@ Hide the window (X11 semantics) view = FRAME_NS_VIEW (f); dpyinfo = FRAME_DISPLAY_INFO (f); - if (dpyinfo->x_highlight_frame == f) - dpyinfo->x_highlight_frame = 0; + if (dpyinfo->highlight_frame == f) + dpyinfo->highlight_frame = 0; if ([[view window] windowNumber] <= 0) { @@ -1714,8 +1714,8 @@ Hide the window (X11 semantics) if (f == dpyinfo->ns_focus_frame) dpyinfo->ns_focus_frame = 0; - if (f == dpyinfo->x_highlight_frame) - dpyinfo->x_highlight_frame = 0; + if (f == dpyinfo->highlight_frame) + dpyinfo->highlight_frame = 0; if (f == hlinfo->mouse_face_mouse_frame) reset_mouse_highlight (hlinfo); @@ -2468,7 +2468,7 @@ so some key presses (TAB) are swallowed by the system. */ NSTRACE ("ns_set_frame_alpha"); - if (dpyinfo->x_highlight_frame == f) + if (dpyinfo->highlight_frame == f) alpha = f->alpha[0]; else alpha = f->alpha[1]; @@ -5142,7 +5142,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); dpyinfo->color_table->colors = NULL; dpyinfo->root_window = 42; /* A placeholder. */ - dpyinfo->x_highlight_frame = dpyinfo->ns_focus_frame = NULL; + dpyinfo->highlight_frame = dpyinfo->ns_focus_frame = NULL; dpyinfo->n_fonts = 0; dpyinfo->smallest_font_height = 1; dpyinfo->smallest_char_width = 1; diff --git a/src/w32term.c b/src/w32term.c index 65c1baf20f..3811585d0f 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3036,29 +3036,29 @@ w32_frame_rehighlight (struct frame *frame) static void w32_frame_rehighlight_1 (struct w32_display_info *dpyinfo) { - struct frame *old_highlight = dpyinfo->x_highlight_frame; + struct frame *old_highlight = dpyinfo->highlight_frame; if (dpyinfo->w32_focus_frame) { - dpyinfo->x_highlight_frame + dpyinfo->highlight_frame = ((FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame))) ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame)) : dpyinfo->w32_focus_frame); - if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) + if (! FRAME_LIVE_P (dpyinfo->highlight_frame)) { fset_focus_frame (dpyinfo->w32_focus_frame, Qnil); - dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame; + dpyinfo->highlight_frame = dpyinfo->w32_focus_frame; } } else - dpyinfo->x_highlight_frame = 0; + dpyinfo->highlight_frame = 0; - if (dpyinfo->x_highlight_frame != old_highlight) + if (dpyinfo->highlight_frame != old_highlight) { if (old_highlight) w32_frame_unhighlight (old_highlight); - if (dpyinfo->x_highlight_frame) - w32_frame_highlight (dpyinfo->x_highlight_frame); + if (dpyinfo->highlight_frame) + w32_frame_highlight (dpyinfo->highlight_frame); } } @@ -6822,8 +6822,8 @@ void w32_make_frame_invisible (struct frame *f) { /* Don't keep the highlight on an invisible frame. */ - if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) - FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0; + if (FRAME_DISPLAY_INFO (f)->highlight_frame == f) + FRAME_DISPLAY_INFO (f)->highlight_frame = 0; block_input (); @@ -6855,8 +6855,8 @@ void w32_iconify_frame (struct frame *f) { /* Don't keep the highlight on an invisible frame. */ - if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) - FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0; + if (FRAME_DISPLAY_INFO (f)->highlight_frame == f) + FRAME_DISPLAY_INFO (f)->highlight_frame = 0; if (FRAME_ICONIFIED_P (f)) return; @@ -6903,8 +6903,8 @@ w32_free_frame_resources (struct frame *f) dpyinfo->w32_focus_frame = 0; if (f == dpyinfo->w32_focus_event_frame) dpyinfo->w32_focus_event_frame = 0; - if (f == dpyinfo->x_highlight_frame) - dpyinfo->x_highlight_frame = 0; + if (f == dpyinfo->highlight_frame) + dpyinfo->highlight_frame = 0; if (f == hlinfo->mouse_face_mouse_frame) reset_mouse_highlight (hlinfo); diff --git a/src/w32term.h b/src/w32term.h index d5bb08dc67..de372d7e5d 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -182,7 +182,7 @@ struct w32_display_info event). It points to the focus frame's selected window's frame. It differs from w32_focus_frame when we're using a global minibuffer. */ - struct frame *x_highlight_frame; + struct frame *highlight_frame; /* The frame waiting to be auto-raised in w32_read_socket. */ struct frame *w32_pending_autoraise_frame; diff --git a/src/xdisp.c b/src/xdisp.c index 34e89c7904..9f0739e0c6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -29306,7 +29306,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, /* Detect a nonselected window or nonselected frame. */ else if (w != XWINDOW (f->selected_window) - || f != FRAME_DISPLAY_INFO (f)->x_highlight_frame) + || f != FRAME_DISPLAY_INFO (f)->highlight_frame) { *active_cursor = false; diff --git a/src/xterm.c b/src/xterm.c index c710d1c918..dd19b8bde1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -917,7 +917,7 @@ x_set_frame_alpha (struct frame *f) unsigned long opac; Window parent; - if (dpyinfo->x_highlight_frame == f) + if (dpyinfo->highlight_frame == f) alpha = f->alpha[0]; else alpha = f->alpha[1]; @@ -4718,29 +4718,29 @@ XTframe_rehighlight (struct frame *frame) static void x_frame_rehighlight (struct x_display_info *dpyinfo) { - struct frame *old_highlight = dpyinfo->x_highlight_frame; + struct frame *old_highlight = dpyinfo->highlight_frame; if (dpyinfo->x_focus_frame) { - dpyinfo->x_highlight_frame + dpyinfo->highlight_frame = ((FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame))) ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame)) : dpyinfo->x_focus_frame); - if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) + if (! FRAME_LIVE_P (dpyinfo->highlight_frame)) { fset_focus_frame (dpyinfo->x_focus_frame, Qnil); - dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; + dpyinfo->highlight_frame = dpyinfo->x_focus_frame; } } else - dpyinfo->x_highlight_frame = 0; + dpyinfo->highlight_frame = 0; - if (dpyinfo->x_highlight_frame != old_highlight) + if (dpyinfo->highlight_frame != old_highlight) { if (old_highlight) x_frame_unhighlight (old_highlight); - if (dpyinfo->x_highlight_frame) - x_frame_highlight (dpyinfo->x_highlight_frame); + if (dpyinfo->highlight_frame) + x_frame_highlight (dpyinfo->highlight_frame); } } @@ -8907,7 +8907,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, into a parent frame with the child frame selected and `no-accept-focus' is not set, select the clicked frame. */ - struct frame *hf = dpyinfo->x_highlight_frame; + struct frame *hf = dpyinfo->highlight_frame; if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf))) { @@ -11674,8 +11674,8 @@ x_make_frame_invisible (struct frame *f) window = FRAME_OUTER_WINDOW (f); /* Don't keep the highlight on an invisible frame. */ - if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) - FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0; + if (FRAME_DISPLAY_INFO (f)->highlight_frame == f) + FRAME_DISPLAY_INFO (f)->highlight_frame = 0; block_input (); @@ -11735,8 +11735,8 @@ x_iconify_frame (struct frame *f) #endif /* Don't keep the highlight on an invisible frame. */ - if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) - FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0; + if (FRAME_DISPLAY_INFO (f)->highlight_frame == f) + FRAME_DISPLAY_INFO (f)->highlight_frame = 0; if (FRAME_ICONIFIED_P (f)) return; @@ -11999,8 +11999,8 @@ x_free_frame_resources (struct frame *f) dpyinfo->x_focus_frame = 0; if (f == dpyinfo->x_focus_event_frame) dpyinfo->x_focus_event_frame = 0; - if (f == dpyinfo->x_highlight_frame) - dpyinfo->x_highlight_frame = 0; + if (f == dpyinfo->highlight_frame) + dpyinfo->highlight_frame = 0; if (f == hlinfo->mouse_face_mouse_frame) reset_mouse_highlight (hlinfo); diff --git a/src/xterm.h b/src/xterm.h index f4007d6e7f..266a42afa0 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -350,7 +350,7 @@ struct x_display_info event). It points to the X focus frame's selected window's frame. It differs from x_focus_frame when we're using a global minibuffer. */ - struct frame *x_highlight_frame; + struct frame *highlight_frame; /* The frame waiting to be auto-raised in XTread_socket. */ struct frame *x_pending_autoraise_frame; commit 46cfe5cb1fe9cca5e2fa9f993320c46b1b564609 Author: Alexander Gramiak Date: Mon Apr 15 11:33:19 2019 -0600 Check for existence of terminal hooks before use This should not be necessary, and is merely a precaution. For background, see: https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00639.html * src/frame.c: * src/xdisp.c: Check for existence of terminal hooks before use. diff --git a/src/frame.c b/src/frame.c index 22a7985945..328facd2d5 100644 --- a/src/frame.c +++ b/src/frame.c @@ -482,7 +482,8 @@ keep_ratio (struct frame *f, struct frame *p, int old_width, int old_height, f->top_pos = pos_y; } - FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); + if (FRAME_TERMINAL (f)->set_frame_offset_hook) + FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); } if (!CONSP (keep_ratio) || !NILP (Fcar (keep_ratio))) @@ -669,11 +670,12 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, list2 (inhibit_horizontal ? Qt : Qnil, inhibit_vertical ? Qt : Qnil)); - FRAME_TERMINAL (f)->set_window_size_hook (f, - 0, - new_text_width, - new_text_height, - 1); + if (FRAME_TERMINAL (f)->set_window_size_hook) + FRAME_TERMINAL (f)->set_window_size_hook (f, + 0, + new_text_width, + new_text_height, + 1); f->resized_p = true; return; @@ -1370,7 +1372,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor #else /* ! 0 */ /* Instead, apply it only to the frame we're pointing to. */ #ifdef HAVE_WINDOW_SYSTEM - if (track && FRAME_WINDOW_P (f)) + if (track && FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->get_focus_frame) { Lisp_Object focus, gfocus; @@ -2836,7 +2838,7 @@ If there is no window system support, this function does nothing. */) { #ifdef HAVE_WINDOW_SYSTEM struct frame *f = decode_window_system_frame (frame); - if (f) + if (f && FRAME_TERMINAL (f)->focus_frame_hook) FRAME_TERMINAL (f)->focus_frame_hook (f, !NILP (noactivate)); #endif return Qnil; @@ -3602,10 +3604,11 @@ bottom edge of FRAME's display. */) if (FRAME_WINDOW_P (f)) { #ifdef HAVE_WINDOW_SYSTEM - FRAME_TERMINAL (f)->set_frame_offset_hook (f, - XFIXNUM (x), - XFIXNUM (y), - 1); + if (FRAME_TERMINAL (f)->set_frame_offset_hook) + FRAME_TERMINAL (f)->set_frame_offset_hook (f, + XFIXNUM (x), + XFIXNUM (y), + 1); #endif } @@ -4161,7 +4164,8 @@ gui_set_frame_parameters (struct frame *f, Lisp_Object alist) f->win_gravity = NorthWestGravity; /* Actually set that position, and convert to absolute. */ - FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); + if (FRAME_TERMINAL (f)->set_frame_offset_hook) + FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); } if (fullscreen_change) @@ -4436,7 +4440,8 @@ gui_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (! NILP (Fequal (font_object, oldval))) return; - FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); + if (FRAME_TERMINAL (f)->set_new_font_hook) + FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); store_frame_param (f, Qfont, arg); #ifdef HAVE_X_WINDOWS store_frame_param (f, Qfont_parameter, font_param); @@ -4716,7 +4721,8 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } else { - FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); + if (FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook) + FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); @@ -4746,7 +4752,8 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } else { - FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); + if (FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook) + FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); diff --git a/src/frame.h b/src/frame.h index e66590ef74..70597737d4 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1602,7 +1602,8 @@ gui_set_bitmap_icon (struct frame *f) { Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist); - if (CONSP (obj) && !NILP (XCDR (obj))) + if (CONSP (obj) && !NILP (XCDR (obj)) + && FRAME_TERMINAL (f)->set_bitmap_icon_hook) FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj)); } diff --git a/src/xdisp.c b/src/xdisp.c index 19fbf93dd0..34e89c7904 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12077,9 +12077,10 @@ gui_consider_frame_title (Lisp_Object frame) already wasted too much time by walking through the list with display_mode_element, then we might need to optimize at a higher level than this.) */ - if (! STRINGP (f->name) - || SBYTES (f->name) != len - || memcmp (title, SDATA (f->name), len) != 0) + if ((! STRINGP (f->name) + || SBYTES (f->name) != len + || memcmp (title, SDATA (f->name), len) != 0) + && FRAME_TERMINAL (f)->implicit_set_name_hook) FRAME_TERMINAL (f)->implicit_set_name_hook (f, make_string (title, len), Qnil); @@ -12856,7 +12857,8 @@ redisplay_tool_bar (struct frame *f) if (new_height != WINDOW_PIXEL_HEIGHT (w)) { - FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); + if (FRAME_TERMINAL (f)->change_tool_bar_height_hook) + FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); frame_default_tool_bar_height = new_height; /* Always do that now. */ clear_glyph_matrix (w->desired_matrix); @@ -12951,7 +12953,8 @@ redisplay_tool_bar (struct frame *f) if (change_height_p) { - FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); + if (FRAME_TERMINAL (f)->change_tool_bar_height_hook) + FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); frame_default_tool_bar_height = new_height; clear_glyph_matrix (w->desired_matrix); f->n_tool_bar_rows = nrows; commit 5d8b0fadeec373cd2861328aeb1cb4293cbc9ded Author: Alexander Gramiak Date: Sat Apr 13 20:41:31 2019 -0600 Add terminal hook query_frame_background_color * src/termhooks.c (query_frame_background_color): New terminal hook. * src/image.c (image_query_frame_background_color): Remove. Use the terminal hook instead. * src/nsterm.m: * src/w32term.c: * src/xterm.c: Implement and set the new terminal hook. diff --git a/src/image.c b/src/image.c index 0023b9369c..bf594987eb 100644 --- a/src/image.c +++ b/src/image.c @@ -1306,22 +1306,6 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D return img->background_transparent; } -#if defined (HAVE_PNG) || defined (HAVE_IMAGEMAGICK) || defined (HAVE_RSVG) - -/* Store F's background color into *BGCOLOR. */ -static void -image_query_frame_background_color (struct frame *f, XColor *bgcolor) -{ -#ifndef HAVE_NS - bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); - x_query_color (f, bgcolor); -#else - ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, 1); -#endif -} - -#endif /* HAVE_PNG || HAVE_IMAGEMAGICK || HAVE_RSVG */ - /*********************************************************************** Helper functions for X image types ***********************************************************************/ @@ -6363,7 +6347,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) &color, false, false) - : (image_query_frame_background_color (f, &color), true)) + : (FRAME_TERMINAL (f)->query_frame_background_color (f, &color), + true)) /* The user specified `:background', use that. */ { int shift = bit_depth == 16 ? 0 : 8; @@ -8816,7 +8801,7 @@ imagemagick_load_image (struct frame *f, struct image *img, &bgcolor, false, false)) - image_query_frame_background_color (f, &bgcolor); + FRAME_TERMINAL (f)->query_frame_background_color (f, &bgcolor); bg_wand = NewPixelWand (); PixelSetRed (bg_wand, (double) bgcolor.red / 65535); @@ -9555,7 +9540,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, &background, false, false)) - image_query_frame_background_color (f, &background); + FRAME_TERMINAL (f)->query_frame_background_color (f, &background); /* SVG pixmaps specify transparency in the last byte, so right shift 8 bits to get rid of it, since emacs doesn't support diff --git a/src/nsterm.m b/src/nsterm.m index 1217eb8e18..cf1ff05530 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2447,6 +2447,14 @@ so some key presses (TAB) are swallowed by the system. */ return 1; } +static void +ns_query_frame_background_color (struct frame *f, XColor *bgcolor) +/* -------------------------------------------------------------------------- + External (hook): Store F's background color into *BGCOLOR + -------------------------------------------------------------------------- */ +{ + ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, true); +} static void ns_set_frame_alpha (struct frame *f) @@ -5233,6 +5241,7 @@ static Lisp_Object ns_new_font (struct frame *f, Lisp_Object font_object, terminal->read_socket_hook = ns_read_socket; terminal->frame_up_to_date_hook = ns_frame_up_to_date; terminal->defined_color_hook = ns_defined_color; + terminal->query_frame_background_color = ns_query_frame_background_color; terminal->mouse_position_hook = ns_mouse_position; terminal->get_focus_frame = ns_get_focus_frame; terminal->focus_frame_hook = ns_focus_frame; diff --git a/src/termhooks.h b/src/termhooks.h index fbc3726133..54f09e0303 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -513,6 +513,10 @@ struct terminal */ + /* This hook is called to store the frame's background color into + BGCOLOR. */ + void (*query_frame_background_color) (struct frame *f, XColor *bgcolor); + #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) /* On frame F, translate pixel colors to RGB values for the NCOLORS colors in COLORS. Use cached information, if available. */ diff --git a/src/w32term.c b/src/w32term.c index 9d050984f7..65c1baf20f 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1608,6 +1608,14 @@ w32_query_colors (struct frame *f, XColor *colors, int ncolors) } } +/* Store F's background color into *BGCOLOR. */ + +static void +w32_query_frame_background_color (struct frame *f, XColor *bgcolor) +{ + bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); + w32_query_colors (f, bgcolor, 1); +} /* Set up the foreground color for drawing relief lines of glyph string S. RELIEF is a pointer to a struct relief containing the GC @@ -7160,6 +7168,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal->read_socket_hook = w32_read_socket; terminal->frame_up_to_date_hook = w32_frame_up_to_date; terminal->defined_color_hook = w32_defined_color; + terminal->query_frame_background_color = w32_query_frame_background_color; terminal->query_colors = w32_query_colors; terminal->mouse_position_hook = w32_mouse_position; terminal->get_focus_frame = w32_get_focus_frame; diff --git a/src/xterm.c b/src/xterm.c index d65ad98c4c..c710d1c918 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2325,6 +2325,14 @@ x_query_colors (struct frame *f, XColor *colors, int ncolors) XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors, ncolors); } +/* Store F's background color into *BGCOLOR. */ + +static void +x_query_frame_background_color (struct frame *f, XColor *bgcolor) +{ + bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); + x_query_colors (f, bgcolor, 1); +} /* On frame F, translate the color name to RGB values. Use cached information, if possible. @@ -13272,6 +13280,7 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->frame_up_to_date_hook = XTframe_up_to_date; terminal->buffer_flipping_unblocked_hook = XTbuffer_flipping_unblocked_hook; terminal->defined_color_hook = x_defined_color; + terminal->query_frame_background_color = x_query_frame_background_color; terminal->query_colors = x_query_colors; terminal->mouse_position_hook = XTmouse_position; terminal->get_focus_frame = x_get_focus_frame; commit 41e20ee4bc01576d23fb8fd4f875385ce57eb36a Author: Alexander Gramiak Date: Sat Apr 13 08:59:07 2019 -0600 Add terminal hook defined_color_hook * src/termhooks.h (defined_color_hook): New terminal hook. * src/xterm.c: * src/nsterm.m: * src/term.c: * src/w32term.c: Set defined_color_hook. * src/xfaces.c: Use defined_color_hook. (defined_color): Remove. * src/image.c: Remove redefinitions of x_defined_color, and use defined_color_hook. diff --git a/src/dispextern.h b/src/dispextern.h index 6c1cdf3e2d..4d6d0371d3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3413,6 +3413,9 @@ void x_free_colors (struct frame *, unsigned long *, int); void update_face_from_frame_parameter (struct frame *, Lisp_Object, Lisp_Object); +extern bool tty_defined_color (struct frame *f, const char *, XColor *, bool, + bool); + Lisp_Object tty_color_name (struct frame *, int); void clear_face_cache (bool); unsigned long load_color (struct frame *, struct face *, Lisp_Object, diff --git a/src/image.c b/src/image.c index 1cf90c88c5..0023b9369c 100644 --- a/src/image.c +++ b/src/image.c @@ -89,8 +89,6 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_RETAIN 0 #define PIX_MASK_DRAW 1 -#define x_defined_color w32_defined_color - #endif /* HAVE_NTGUI */ #ifdef HAVE_NS @@ -101,8 +99,6 @@ typedef struct ns_bitmap_record Bitmap_Record; #define PIX_MASK_RETAIN 0 -#define x_defined_color(f, name, color_def, alloc) \ - ns_defined_color (f, name, color_def, alloc, 0) #endif /* HAVE_NS */ #if (defined HAVE_X_WINDOWS \ @@ -1424,7 +1420,11 @@ image_alloc_image_color (struct frame *f, struct image *img, eassert (STRINGP (color_name)); - if (x_defined_color (f, SSDATA (color_name), &color, 1) + if (FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (color_name), + &color, + true, + false) && img->ncolors < min (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *img->colors, INT_MAX)) { @@ -4470,8 +4470,8 @@ xpm_load_image (struct frame *f, { if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0) color_val = Qt; - else if (x_defined_color (f, SSDATA (XCDR (specified_color)), - &cdef, 0)) + else if (FRAME_TERMINAL (f)->defined_color_hook + (f, SSDATA (XCDR (specified_color)), &cdef, false, false)) color_val = make_fixnum (cdef.pixel); } } @@ -4479,7 +4479,8 @@ xpm_load_image (struct frame *f, { if (xstrcasecmp (max_color, "None") == 0) color_val = Qt; - else if (x_defined_color (f, max_color, &cdef, 0)) + else if (FRAME_TERMINAL (f)->defined_color_hook + (f, max_color, &cdef, false, false)) color_val = make_fixnum (cdef.pixel); } if (!NILP (color_val)) @@ -5681,7 +5682,11 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO if (! fmt[PBM_FOREGROUND].count || ! STRINGP (fmt[PBM_FOREGROUND].value) - || ! x_defined_color (f, SSDATA (fmt[PBM_FOREGROUND].value), &xfg, 0)) + || ! FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (fmt[PBM_FOREGROUND].value), + &xfg, + false, + false)) { xfg.pixel = fg; x_query_colors (f, &xfg, 1); @@ -5690,7 +5695,11 @@ pbm_load (struct frame *f, struct image *img) if (! fmt[PBM_BACKGROUND].count || ! STRINGP (fmt[PBM_BACKGROUND].value) - || ! x_defined_color (f, SSDATA (fmt[PBM_BACKGROUND].value), &xbg, 0)) + || ! FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (fmt[PBM_BACKGROUND].value), + &xbg, + false, + false)) { xbg.pixel = bg; x_query_colors (f, &xbg, 1); @@ -6349,7 +6358,11 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) current frame background, ignoring any default background color set by the image. */ if (STRINGP (specified_bg) - ? x_defined_color (f, SSDATA (specified_bg), &color, false) + ? FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (specified_bg), + &color, + false, + false) : (image_query_frame_background_color (f, &color), true)) /* The user specified `:background', use that. */ { @@ -8036,7 +8049,8 @@ gif_load (struct frame *f, struct image *img) if (STRINGP (specified_bg)) { XColor color; - if (x_defined_color (f, SSDATA (specified_bg), &color, 0)) + if (FRAME_TERMINAL (f)->defined_color_hook + (f, SSDATA (specified_bg), &color, false, false)) { uint32_t *dataptr = data32; int r = color.red/256; @@ -8797,7 +8811,11 @@ imagemagick_load_image (struct frame *f, struct image *img, specified_bg = image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP (specified_bg) - || !x_defined_color (f, SSDATA (specified_bg), &bgcolor, 0)) + || !FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (specified_bg), + &bgcolor, + false, + false)) image_query_frame_background_color (f, &bgcolor); bg_wand = NewPixelWand (); @@ -9532,7 +9550,11 @@ svg_load_image (struct frame *f, struct image *img, char *contents, XColor background; Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP (specified_bg) - || !x_defined_color (f, SSDATA (specified_bg), &background, 0)) + || !FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (specified_bg), + &background, + false, + false)) image_query_frame_background_color (f, &background); /* SVG pixmaps specify transparency in the last byte, so right diff --git a/src/nsterm.m b/src/nsterm.m index ae49b659b7..1217eb8e18 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5232,6 +5232,7 @@ static Lisp_Object ns_new_font (struct frame *f, Lisp_Object font_object, terminal->update_end_hook = ns_update_end; terminal->read_socket_hook = ns_read_socket; terminal->frame_up_to_date_hook = ns_frame_up_to_date; + terminal->defined_color_hook = ns_defined_color; terminal->mouse_position_hook = ns_mouse_position; terminal->get_focus_frame = ns_get_focus_frame; terminal->focus_frame_hook = ns_focus_frame; diff --git a/src/term.c b/src/term.c index 2de0a0e664..6a8fc2ee93 100644 --- a/src/term.c +++ b/src/term.c @@ -3838,6 +3838,7 @@ clear_tty_hooks (struct terminal *terminal) terminal->update_begin_hook = 0; terminal->update_end_hook = 0; terminal->set_terminal_window_hook = 0; + terminal->defined_color_hook = 0; terminal->mouse_position_hook = 0; terminal->frame_rehighlight_hook = 0; terminal->frame_raise_lower_hook = 0; @@ -3881,6 +3882,7 @@ set_tty_hooks (struct terminal *terminal) terminal->menu_show_hook = &tty_menu_show; #endif terminal->set_terminal_window_hook = &tty_set_terminal_window; + terminal->defined_color_hook = &tty_defined_color; /* xfaces.c */ terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ terminal->delete_frame_hook = &tty_free_frame_resources; terminal->delete_terminal_hook = &delete_tty; diff --git a/src/termhooks.h b/src/termhooks.h index b66233cf1c..fbc3726133 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see . */ /* Miscellanea. */ #include "lisp.h" +#include "dispextern.h" #include "systime.h" /* for Time */ struct glyph; @@ -488,6 +489,17 @@ struct terminal void (*update_end_hook) (struct frame *); void (*set_terminal_window_hook) (struct frame *, int); + /* Decide if color named COLOR_NAME is valid for the display + associated with the frame F; if so, return the RGB values in + COLOR_DEF. If ALLOC (and MAKEINDEX for NS), allocate a new + colormap cell. + + If MAKEINDEX (on NS), set COLOR_DEF pixel to ARGB. */ + bool (*defined_color_hook) (struct frame *f, const char *color_name, + XColor *color_def, + bool alloc, + bool makeIndex); + /* Multi-frame and mouse support hooks. */ /* Graphical window systems are expected to define all of the diff --git a/src/w32fns.c b/src/w32fns.c index 30e5479cdc..525642bfaa 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1173,9 +1173,9 @@ gamma_correct (struct frame *f, COLORREF *color) the selected frame; if so, return the rgb values in COLOR_DEF. If ALLOC is nonzero, allocate a new colormap cell. */ -int +bool w32_defined_color (struct frame *f, const char *color, XColor *color_def, - bool alloc_p) + bool alloc_p, bool _makeIndex) { register Lisp_Object tem; COLORREF w32_color_ref; @@ -1262,7 +1262,7 @@ w32_decode_color (struct frame *f, Lisp_Object arg, int def) /* w32_defined_color is responsible for coping with failures by looking for a near-miss. */ - if (w32_defined_color (f, SSDATA (arg), &cdef, true)) + if (w32_defined_color (f, SSDATA (arg), &cdef, true, false)) return cdef.pixel; /* defined_color failed; return an ultimate default. */ @@ -6105,7 +6105,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, CHECK_STRING (color); - if (w32_defined_color (f, SSDATA (color), &foo, false)) + if (w32_defined_color (f, SSDATA (color), &foo, false, false)) return Qt; else return Qnil; @@ -6120,7 +6120,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); - if (w32_defined_color (f, SSDATA (color), &foo, false)) + if (w32_defined_color (f, SSDATA (color), &foo, false, false)) return list3i ((GetRValue (foo.pixel) << 8) | GetRValue (foo.pixel), (GetGValue (foo.pixel) << 8) | GetGValue (foo.pixel), (GetBValue (foo.pixel) << 8) | GetBValue (foo.pixel)); diff --git a/src/w32term.c b/src/w32term.c index fca1ef96ad..9d050984f7 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -7159,6 +7159,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal->update_end_hook = w32_update_end; terminal->read_socket_hook = w32_read_socket; terminal->frame_up_to_date_hook = w32_frame_up_to_date; + terminal->defined_color_hook = w32_defined_color; terminal->query_colors = w32_query_colors; terminal->mouse_position_hook = w32_mouse_position; terminal->get_focus_frame = w32_get_focus_frame; @@ -7262,8 +7263,8 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) /* initialize palette with white and black */ { XColor color; - w32_defined_color (0, "white", &color, 1); - w32_defined_color (0, "black", &color, 1); + w32_defined_color (0, "white", &color, true, false); + w32_defined_color (0, "black", &color, true, false); } #ifdef WINDOWSNT diff --git a/src/w32term.h b/src/w32term.h index 6d2765961c..d5bb08dc67 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -241,8 +241,8 @@ extern void w32_set_scroll_bar_default_height (struct frame *); extern struct w32_display_info *w32_term_init (Lisp_Object, char *, char *); -extern int w32_defined_color (struct frame *f, const char *color, - XColor *color_def, bool alloc_p); +extern bool w32_defined_color (struct frame *, const char *, XColor *, + bool, bool); extern int w32_display_pixel_height (struct w32_display_info *); extern int w32_display_pixel_width (struct w32_display_info *); extern void initialize_frame_menubar (struct frame *); diff --git a/src/xfaces.c b/src/xfaces.c index 925c3d54ff..7e04c0e995 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -893,11 +893,11 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, return false; } -/* A version of defined_color for non-X frames. */ +/* An implementation of defined_color_hook for tty frames. */ -static bool +bool tty_defined_color (struct frame *f, const char *color_name, - XColor *color_def, bool alloc) + XColor *color_def, bool alloc, bool _makeIndex) { bool status = true; @@ -924,36 +924,6 @@ tty_defined_color (struct frame *f, const char *color_name, return status; } - -/* Decide if color named COLOR_NAME is valid for the display - associated with the frame F; if so, return the rgb values in - COLOR_DEF. If ALLOC, allocate a new colormap cell. - - This does the right thing for any type of frame. */ - -static bool -defined_color (struct frame *f, const char *color_name, XColor *color_def, - bool alloc) -{ - if (!FRAME_WINDOW_P (f)) - return tty_defined_color (f, color_name, color_def, alloc); -#ifdef HAVE_X_WINDOWS - else if (FRAME_X_P (f)) - return x_defined_color (f, color_name, color_def, alloc); -#endif -#ifdef HAVE_NTGUI - else if (FRAME_W32_P (f)) - return w32_defined_color (f, color_name, color_def, alloc); -#endif -#ifdef HAVE_NS - else if (FRAME_NS_P (f)) - return ns_defined_color (f, color_name, color_def, alloc, true); -#endif - else - emacs_abort (); -} - - /* Given the index IDX of a tty color on frame F, return its name, a Lisp string. */ @@ -998,7 +968,8 @@ face_color_gray_p (struct frame *f, const char *color_name) XColor color; bool gray_p; - if (defined_color (f, color_name, &color, false)) + if (FRAME_TERMINAL (f)->defined_color_hook + (f, color_name, &color, false, true)) gray_p = (/* Any color sufficiently close to black counts as gray. */ (color.red < 5000 && color.green < 5000 && color.blue < 5000) || @@ -1038,7 +1009,7 @@ face_color_supported_p (struct frame *f, const char *color_name, && face_color_gray_p (f, color_name))) : #endif - tty_defined_color (f, color_name, ¬_used, false); + tty_defined_color (f, color_name, ¬_used, false, false); } @@ -1082,9 +1053,10 @@ load_color2 (struct frame *f, struct face *face, Lisp_Object name, || target_index == LFACE_STRIKE_THROUGH_INDEX || target_index == LFACE_BOX_INDEX); - /* if the color map is full, defined_color will return a best match + /* if the color map is full, defined_color_hook will return a best match to the values in an existing cell. */ - if (!defined_color (f, SSDATA (name), color, true)) + if (!FRAME_TERMINAL (f)->defined_color_hook + (f, SSDATA (name), color, true, true)) { add_to_log ("Unable to load color \"%s\"", name); @@ -4235,11 +4207,19 @@ two lists of the form (RED GREEN BLUE) aforementioned. */) if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1)) && !(STRINGP (color1) - && defined_color (f, SSDATA (color1), &cdef1, false))) + && FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (color1), + &cdef1, + false, + true))) signal_error ("Invalid color", color1); if (!(CONSP (color2) && parse_rgb_list (color2, &cdef2)) && !(STRINGP (color2) - && defined_color (f, SSDATA (color2), &cdef2, false))) + && FRAME_TERMINAL (f)->defined_color_hook (f, + SSDATA (color2), + &cdef2, + false, + true))) signal_error ("Invalid color", color2); if (NILP (metric)) diff --git a/src/xfns.c b/src/xfns.c index c4bdb3f5cf..2ceb55a30a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -653,7 +653,7 @@ gamma_correct (struct frame *f, XColor *color) bool x_defined_color (struct frame *f, const char *color_name, - XColor *color, bool alloc_p) + XColor *color, bool alloc_p, bool _makeIndex) { bool success_p = false; Colormap cmap = FRAME_X_COLORMAP (f); @@ -698,7 +698,7 @@ x_decode_color (struct frame *f, Lisp_Object color_name, int mono_color) /* x_defined_color is responsible for coping with failures by looking for a near-miss. */ - if (x_defined_color (f, SSDATA (color_name), &cdef, true)) + if (x_defined_color (f, SSDATA (color_name), &cdef, true, false)) return cdef.pixel; signal_error ("Undefined color", color_name); @@ -4110,7 +4110,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, CHECK_STRING (color); - if (x_defined_color (f, SSDATA (color), &foo, false)) + if (x_defined_color (f, SSDATA (color), &foo, false, false)) return Qt; else return Qnil; @@ -4126,7 +4126,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); - if (x_defined_color (f, SSDATA (color), &foo, false)) + if (x_defined_color (f, SSDATA (color), &foo, false, false)) return list3i (foo.red, foo.green, foo.blue); else return Qnil; diff --git a/src/xterm.c b/src/xterm.c index a89f13955d..d65ad98c4c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13271,6 +13271,7 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->read_socket_hook = XTread_socket; terminal->frame_up_to_date_hook = XTframe_up_to_date; terminal->buffer_flipping_unblocked_hook = XTbuffer_flipping_unblocked_hook; + terminal->defined_color_hook = x_defined_color; terminal->query_colors = x_query_colors; terminal->mouse_position_hook = XTmouse_position; terminal->get_focus_frame = x_get_focus_frame; diff --git a/src/xterm.h b/src/xterm.h index 20d043e717..f4007d6e7f 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1222,7 +1222,7 @@ extern void destroy_frame_xic (struct frame *); extern void xic_set_preeditarea (struct window *, int, int); extern void xic_set_statusarea (struct frame *); extern void xic_set_xfontset (struct frame *, const char *); -extern bool x_defined_color (struct frame *, const char *, XColor *, bool); +extern bool x_defined_color (struct frame *, const char *, XColor *, bool, bool); #ifdef HAVE_X_I18N extern void free_frame_xic (struct frame *); # if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT commit a411517faf624657aa58979f5463115115093309 Author: Alexander Gramiak Date: Sat Apr 13 09:40:03 2019 -0600 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. diff --git a/src/alloc.c b/src/alloc.c index c4ef4e9686..948a0e8a2d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6289,7 +6289,7 @@ mark_frame (struct Lisp_Vector *ptr) mark_vectorlike (&ptr->header); mark_face_cache (f->face_cache); #ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f) && FRAME_X_OUTPUT (f)) + if (FRAME_WINDOW_P (f) && FRAME_OUTPUT_DATA (f)) { struct font *font = FRAME_FONT (f); diff --git a/src/dispextern.h b/src/dispextern.h index 79ec4ce52e..6c1cdf3e2d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1680,7 +1680,7 @@ struct face /* True means that colors of this face may not be freed because they have been copied bitwise from a base face (see - realize_x_face). */ + realize_gui_face). */ bool_bf colors_copied_bitwise_p : 1; /* If non-zero, use overstrike (to simulate bold-face). */ @@ -2897,6 +2897,11 @@ struct redisplay_interface void (*clear_frame_area) (struct frame *f, int x, int y, int width, int height); + /* Clear area of frame F's internal border. If the internal border + face of F has been specified (is not null), fill the area with + that face. */ + void (*clear_under_internal_border) (struct frame *f); + /* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH at row GLYPH_ROW on window W if ON_P is true. If ON_P is false, don't draw cursor. If ACTIVE_P is true, system caret @@ -3347,20 +3352,22 @@ extern bool buffer_flipping_blocked_p (void); #ifdef HAVE_WINDOW_SYSTEM -extern ptrdiff_t x_bitmap_pixmap (struct frame *, ptrdiff_t); -extern void x_reference_bitmap (struct frame *, ptrdiff_t); -extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *, - unsigned int, unsigned int); -extern ptrdiff_t x_create_bitmap_from_file (struct frame *, Lisp_Object); +extern ptrdiff_t image_bitmap_pixmap (struct frame *, ptrdiff_t); +extern void image_reference_bitmap (struct frame *, ptrdiff_t); +extern ptrdiff_t image_create_bitmap_from_data (struct frame *, char *, + unsigned int, unsigned int); +extern ptrdiff_t image_create_bitmap_from_file (struct frame *, Lisp_Object); #if defined HAVE_XPM && defined HAVE_X_WINDOWS && !defined USE_GTK extern ptrdiff_t x_create_bitmap_from_xpm_data (struct frame *, const char **); #endif -#ifndef x_destroy_bitmap -extern void x_destroy_bitmap (struct frame *, ptrdiff_t); +#ifndef image_destroy_bitmap +extern void image_destroy_bitmap (struct frame *, ptrdiff_t); #endif -extern void x_destroy_all_bitmaps (Display_Info *); +extern void image_destroy_all_bitmaps (Display_Info *); +#ifdef HAVE_X_WINDOWS extern void x_create_bitmap_mask (struct frame *, ptrdiff_t); -extern Lisp_Object x_find_image_file (Lisp_Object); +#endif +extern Lisp_Object image_find_image_file (Lisp_Object); void x_kill_gs_process (Pixmap, struct frame *); struct image_cache *make_image_cache (void); @@ -3446,11 +3453,6 @@ void gamma_correct (struct frame *, COLORREF *); #ifdef HAVE_WINDOW_SYSTEM -void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); -void x_change_tool_bar_height (struct frame *f, int); - -extern frame_parm_handler x_frame_parm_handlers[]; - extern void start_hourglass (void); extern void cancel_hourglass (void); @@ -3586,23 +3588,21 @@ enum resource_types }; extern Display_Info *check_x_display_info (Lisp_Object); -extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object, - Lisp_Object, const char *, const char *class, - enum resource_types); -extern Lisp_Object x_frame_get_and_record_arg (struct frame *, Lisp_Object, - Lisp_Object, - const char *, const char *, - enum resource_types); -extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object, - Lisp_Object, Lisp_Object, - const char *, const char *, +extern Lisp_Object gui_display_get_arg (Display_Info *, Lisp_Object, + Lisp_Object, const char *, const char *, enum resource_types); -extern char *x_get_string_resource (XrmDatabase, const char *, - const char *); +extern Lisp_Object gui_frame_get_and_record_arg (struct frame *, Lisp_Object, + Lisp_Object, + const char *, const char *, + enum resource_types); +extern Lisp_Object gui_default_parameter (struct frame *, Lisp_Object, + Lisp_Object, Lisp_Object, + const char *, const char *, + enum resource_types); #ifndef HAVE_NS /* These both used on W32 and X only. */ -extern bool x_mouse_grabbed (Display_Info *); -extern void x_redo_mouse_highlight (Display_Info *); +extern bool gui_mouse_grabbed (Display_Info *); +extern void gui_redo_mouse_highlight (Display_Info *); #endif /* HAVE_NS */ #endif /* HAVE_WINDOW_SYSTEM */ diff --git a/src/dispnew.c b/src/dispnew.c index cf3bfaaca4..25a2d1cd38 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5551,7 +5551,7 @@ change_frame_size_1 (struct frame *f, int new_width, int new_height, * FRAME_LINE_HEIGHT (f)); } - /* Adjust frame size but make sure x_set_window_size does not + /* Adjust frame size but make sure set_window_size_hook does not get called. */ adjust_frame_size (f, new_width, new_height, 5, pretend, Qchange_frame_size); diff --git a/src/fontset.c b/src/fontset.c index eec1e0da4c..2c45c95c3a 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1061,7 +1061,7 @@ font_for_char (struct face *face, int c, ptrdiff_t pos, Lisp_Object object) /* Make a realized fontset for ASCII face FACE on frame F from the base fontset BASE_FONTSET_ID. If BASE_FONTSET_ID is -1, use the default fontset as the base. Value is the id of the new fontset. - Called from realize_x_face. */ + Called from realize_gui_face. */ int make_fontset_for_ascii_face (struct frame *f, int base_fontset_id, struct face *face) @@ -1743,13 +1743,14 @@ static Lisp_Object auto_fontset_alist; static ptrdiff_t num_auto_fontsets; /* Return a fontset synthesized from FONT-OBJECT. This is called from - x_new_font when FONT-OBJECT is used for the default ASCII font of a - frame, and the returned fontset is used for the default fontset of - that frame. The fontset specifies a font of the same registry as - FONT-OBJECT for all characters in the repertory of the registry - (see Vfont_encoding_alist). If the repertory is not known, the - fontset specifies the font for all Latin characters assuming that a - user intends to use FONT-OBJECT for Latin characters. */ + the terminal hook set_new_font_hook when FONT-OBJECT is used for + the default ASCII font of a frame, and the returned fontset is used + for the default fontset of that frame. The fontset specifies a + font of the same registry as FONT-OBJECT for all characters in the + repertory of the registry (see Vfont_encoding_alist). If the + repertory is not known, the fontset specifies the font for all + Latin characters assuming that a user intends to use FONT-OBJECT + for Latin characters. */ int fontset_from_font (Lisp_Object font_object) diff --git a/src/frame.c b/src/frame.c index 7e29e69928..22a7985945 100644 --- a/src/frame.c +++ b/src/frame.c @@ -77,7 +77,7 @@ int frame_default_tool_bar_height; #endif #ifdef HAVE_WINDOW_SYSTEM -static void x_report_frame_params (struct frame *, Lisp_Object *); +static void gui_report_frame_params (struct frame *, Lisp_Object *); #endif /* These setters are used only in this file, so they can be private. */ @@ -482,7 +482,7 @@ keep_ratio (struct frame *f, struct frame *p, int old_width, int old_height, f->top_pos = pos_y; } - x_set_offset (f, pos_x, pos_y, -1); + FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); } if (!CONSP (keep_ratio) || !NILP (Fcar (keep_ratio))) @@ -518,36 +518,37 @@ keep_ratio (struct frame *f, struct frame *p, int old_width, int old_height, * text size of F in pixels. A value of -1 means no change is requested * for that direction (but the frame may still have to be resized to * accommodate windows with their minimum sizes). This can either issue - * a request to resize the frame externally (via x_set_window_size), to + * a request to resize the frame externally (via set_window_size_hook), to * resize the frame internally (via resize_frame_windows) or do nothing * at all. * * The argument INHIBIT can assume the following values: * - * 0 means to unconditionally call x_set_window_size even if sizes + * 0 means to unconditionally call set_window_size_hook even if sizes * apparently do not change. Fx_create_frame uses this to pass the * initial size to the window manager. * - * 1 means to call x_set_window_size if the native frame size really + * 1 means to call set_window_size_hook if the native frame size really * changes. Fset_frame_size, Fset_frame_height, ... use this. * - * 2 means to call x_set_window_size provided frame_inhibit_resize + * 2 means to call set_window_size_hook provided frame_inhibit_resize * allows it. The menu and tool bar code use this ("3" won't work * here in general because menu and tool bar are often not counted in * the frame's text height). * - * 3 means call x_set_window_size if window minimum sizes must be - * preserved or frame_inhibit_resize allows it. x_set_left_fringe, - * x_set_scroll_bar_width, x_new_font ... use (or should use) this. + * 3 means call set_window_size_hook if window minimum sizes must be + * preserved or frame_inhibit_resize allows it. + * gui_set_left_fringe, gui_set_scroll_bar_width, gui_new_font + * ... use (or should use) this. * - * 4 means call x_set_window_size only if window minimum sizes must be - * preserved. x_set_right_divider_width, x_set_border_width and the - * code responsible for wrapping the tool bar use this. + * 4 means call set_window_size_hook only if window minimum sizes must + * be preserved. x_set_right_divider_width, x_set_border_width and + * the code responsible for wrapping the tool bar use this. * - * 5 means to never call x_set_window_size. change_frame_size uses + * 5 means to never call set_window_size_hook. change_frame_size uses * this. * - * Note that even when x_set_window_size is not called, individual + * Note that even when set_window_size_hook is not called, individual * windows may have to be resized (via `window--sanitize-window-sizes') * in order to support minimum size constraints. * @@ -570,7 +571,7 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, /* The following two values are calculated from the old frame pixel sizes and any "new" settings for tool bar, menu bar and internal borders. We do it this way to detect whether we have to call - x_set_window_size as consequence of the new settings. */ + set_window_size_hook as consequence of the new settings. */ int windows_width = FRAME_WINDOWS_WIDTH (f); int windows_height = FRAME_WINDOWS_HEIGHT (f); int min_windows_width, min_windows_height; @@ -645,7 +646,7 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f) - && f->can_x_set_window_size + && f->can_set_window_size && ((!inhibit_horizontal && (new_pixel_width != old_pixel_width || inhibit == 0 || inhibit == 2)) @@ -668,7 +669,11 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, list2 (inhibit_horizontal ? Qt : Qnil, inhibit_vertical ? Qt : Qnil)); - x_set_window_size (f, 0, new_text_width, new_text_height, 1); + FRAME_TERMINAL (f)->set_window_size_hook (f, + 0, + new_text_width, + new_text_height, + 1); f->resized_p = true; return; @@ -827,7 +832,7 @@ make_frame (bool mini_p) f->wants_modeline = true; f->redisplay = true; f->garbaged = true; - f->can_x_set_window_size = false; + f->can_set_window_size = false; f->after_make_frame = false; f->inhibit_horizontal_resize = false; f->inhibit_vertical_resize = false; @@ -1089,7 +1094,7 @@ make_initial_frame (void) last_nonminibuf_frame = f; - f->can_x_set_window_size = true; + f->can_set_window_size = true; f->after_make_frame = true; return f; @@ -1291,7 +1296,7 @@ affects all frames on the same terminal device. */) for (tem = f->face_alist; CONSP (tem); tem = XCDR (tem)) XSETCDR (XCAR (tem), Fcopy_sequence (XCDR (XCAR (tem)))); - f->can_x_set_window_size = true; + f->can_set_window_size = true; f->after_make_frame = true; return frame; @@ -1367,18 +1372,18 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor #ifdef HAVE_WINDOW_SYSTEM if (track && FRAME_WINDOW_P (f)) { - Lisp_Object focus, xfocus; + Lisp_Object focus, gfocus; - xfocus = x_get_focus_frame (f); - if (FRAMEP (xfocus)) + gfocus = FRAME_TERMINAL (f)->get_focus_frame (f); + if (FRAMEP (gfocus)) { - focus = FRAME_FOCUS_FRAME (XFRAME (xfocus)); + focus = FRAME_FOCUS_FRAME (XFRAME (gfocus)); if ((FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ()) /* Redirect frame focus also when FRAME has its minibuffer window on the selected frame (see Bug#24500). */ || (NILP (focus) && EQ (FRAME_MINIBUF_WINDOW (f), sf->selected_window))) - Fredirect_frame_focus (xfocus, frame); + Fredirect_frame_focus (gfocus, frame); } } #endif /* HAVE_X_WINDOWS */ @@ -2584,11 +2589,8 @@ If omitted, FRAME defaults to the currently selected frame. */) { struct frame *f = decode_live_frame (frame); - /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f)) - x_make_frame_visible (f); -#endif + if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook) + FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, true); make_frame_visible_1 (f->root_window); @@ -2640,11 +2642,8 @@ displayed in the terminal. */) /* Don't allow minibuf_window to remain on an invisible frame. */ check_minibuf_window (frame, EQ (minibuf_window, selected_window)); - /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f)) - x_make_frame_invisible (f); -#endif + if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook) + FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false); /* Make menu bar update for the Buffers and Frames menus. */ windows_or_buffers_changed = 16; @@ -2688,13 +2687,8 @@ for how to proceed. */) /* Don't allow minibuf_window to remain on an iconified frame. */ check_minibuf_window (frame, EQ (minibuf_window, selected_window)); - /* I think this should be done with a hook. */ - if (FRAME_WINDOW_P (f)) - { -#ifdef HAVE_WINDOW_SYSTEM - x_iconify_frame (f); -#endif - } + if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->iconify_frame_hook) + FRAME_TERMINAL (f)->iconify_frame_hook (f); return Qnil; } @@ -2756,7 +2750,7 @@ doesn't support multiple overlapping frames, this function selects FRAME. */) Fmake_frame_visible (frame); if (FRAME_TERMINAL (f)->frame_raise_lower_hook) - (*FRAME_TERMINAL (f)->frame_raise_lower_hook) (f, 1); + (*FRAME_TERMINAL (f)->frame_raise_lower_hook) (f, true); return Qnil; } @@ -2772,7 +2766,7 @@ doesn't support multiple overlapping frames, this function does nothing. */) struct frame *f = decode_live_frame (frame); if (FRAME_TERMINAL (f)->frame_raise_lower_hook) - (*FRAME_TERMINAL (f)->frame_raise_lower_hook) (f, 0); + (*FRAME_TERMINAL (f)->frame_raise_lower_hook) (f, false); return Qnil; } @@ -2841,7 +2835,9 @@ If there is no window system support, this function does nothing. */) (Lisp_Object frame, Lisp_Object noactivate) { #ifdef HAVE_WINDOW_SYSTEM - x_focus_frame (decode_window_system_frame (frame), !NILP (noactivate)); + struct frame *f = decode_window_system_frame (frame); + if (f) + FRAME_TERMINAL (f)->focus_frame_hook (f, !NILP (noactivate)); #endif return Qnil; } @@ -2912,7 +2908,7 @@ frame_name_fnn_p (char *str, ptrdiff_t len) } /* Set the name of the terminal frame. Also used by MSDOS frames. - Modeled after x_set_name which is used for WINDOW frames. */ + Modeled after *_set_name which is used for WINDOW frames. */ static void set_term_frame_name (struct frame *f, Lisp_Object name) @@ -3164,7 +3160,7 @@ If FRAME is omitted or nil, return information on the currently selected frame. /* I think this should be done with a hook. */ #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) - x_report_frame_params (f, &alist); + gui_report_frame_params (f, &alist); else #endif { @@ -3270,7 +3266,7 @@ list, but are otherwise ignored. */) /* I think this should be done with a hook. */ #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) - x_set_frame_parameters (f, alist); + gui_set_frame_parameters (f, alist); else #endif #ifdef MSDOS @@ -3603,11 +3599,13 @@ bottom edge of FRAME's display. */) CHECK_TYPE_RANGED_INTEGER (int, x); CHECK_TYPE_RANGED_INTEGER (int, y); - /* I think this should be done with a hook. */ if (FRAME_WINDOW_P (f)) { #ifdef HAVE_WINDOW_SYSTEM - x_set_offset (f, XFIXNUM (x), XFIXNUM (y), 1); + FRAME_TERMINAL (f)->set_frame_offset_hook (f, + XFIXNUM (x), + XFIXNUM (y), + 1); #endif } @@ -3652,12 +3650,12 @@ window state change flag is reset. */) Frame Parameters ***********************************************************************/ -/* Connect the frame-parameter names for X frames - to the ways of passing the parameter values to the window system. +/* Connect the frame-parameter names for frames to the ways of passing + the parameter values to the window system. - The name of a parameter, as a Lisp symbol, - has an `x-frame-parameter' property which is an integer in Lisp - that is an index in this table. */ + The name of a parameter, as a Lisp symbol, has a + `frame-parameter-pos' property which is an integer in Lisp that is + an index in this table. */ struct frame_parm_table { const char *name; @@ -3904,12 +3902,12 @@ frame_float (struct frame *f, Lisp_Object val, enum frame_float_type what, /* Change the parameters of frame F as specified by ALIST. If a parameter is not specially recognized, do nothing special; - otherwise call the `x_set_...' function for that parameter. + otherwise call the `gui_set_...' function for that parameter. Except for certain geometry properties, always call store_frame_param to store the new value in the parameter alist. */ void -x_set_frame_parameters (struct frame *f, Lisp_Object alist) +gui_set_frame_parameters (struct frame *f, Lisp_Object alist) { Lisp_Object tail, frame; @@ -4097,7 +4095,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) all. With the old setting it can get a Heisenbug when EmacsFrameResize intermittently provokes a delayed change_frame_size in the middle of adjust_frame_size. */ - /** || (f->can_x_set_window_size && (f->new_height || f->new_width))) **/ + /** || (f->can_set_window_size && (f->new_height || f->new_width))) **/ adjust_frame_size (f, width, height, 1, 0, Qx_set_frame_parameters); if ((!NILP (left) || !NILP (top)) @@ -4163,7 +4161,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) f->win_gravity = NorthWestGravity; /* Actually set that position, and convert to absolute. */ - x_set_offset (f, leftpos, toppos, -1); + FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); } if (fullscreen_change) @@ -4175,7 +4173,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) store_frame_param (f, Qfullscreen, fullscreen); if (!EQ (fullscreen, old_value)) - x_set_fullscreen (f, fullscreen, old_value); + gui_set_fullscreen (f, fullscreen, old_value); } @@ -4189,14 +4187,14 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) } -/* Insert a description of internally-recorded parameters of frame X +/* Insert a description of internally-recorded parameters of frame F into the parameter alist *ALISTPTR that is to be given to the user. Only parameters that are specific to the X window system and whose values are not correctly recorded in the frame's param_alist need to be considered here. */ void -x_report_frame_params (struct frame *f, Lisp_Object *alistptr) +gui_report_frame_params (struct frame *f, Lisp_Object *alistptr) { Lisp_Object tem; uprintmax_t w; @@ -4241,11 +4239,11 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) /* nil means "use default height" for non-toolkit scroll bar. */ : Qnil)); - /* FRAME_X_WINDOW is not guaranteed to return an integer. E.g., on - MS-Windows it returns a value whose type is HANDLE, which is - actually a pointer. Explicit casting avoids compiler + /* FRAME_NATIVE_WINDOW is not guaranteed to return an integer. + E.g., on MS-Windows it returns a value whose type is HANDLE, + which is actually a pointer. Explicit casting avoids compiler warnings. */ - w = (uintptr_t) FRAME_X_WINDOW (f); + w = (uintptr_t) FRAME_NATIVE_WINDOW (f); store_in_alist (alistptr, Qwindow_id, make_formatted_string (buf, "%"pMu, w)); #ifdef HAVE_X_WINDOWS @@ -4264,10 +4262,10 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) store_in_alist (alistptr, Qdisplay, XCAR (FRAME_DISPLAY_INFO (f)->name_list_element)); - if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_DISPLAY_INFO (f)->root_window) + if (FRAME_OUTPUT_DATA (f)->parent_desc == FRAME_DISPLAY_INFO (f)->root_window) tem = Qnil; else - tem = make_fixed_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc); + tem = make_fixed_natnum ((uintptr_t) FRAME_OUTPUT_DATA (f)->parent_desc); store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); store_in_alist (alistptr, Qparent_id, tem); store_in_alist (alistptr, Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)); @@ -4278,7 +4276,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) the previous value of that parameter, NEW_VALUE is the new value. */ void -x_set_fullscreen (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_fullscreen (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (NILP (new_value)) f->want_fullscreen = FULLSCREEN_NONE; @@ -4300,7 +4298,7 @@ x_set_fullscreen (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) the previous value of that parameter, NEW_VALUE is the new value. */ void -x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (NILP (new_value)) f->extra_line_spacing = 0; @@ -4326,7 +4324,7 @@ x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu the previous value of that parameter, NEW_VALUE is the new value. */ void -x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { Lisp_Object bgcolor; @@ -4356,7 +4354,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu void -x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { Lisp_Object font_object; int fontset = -1; @@ -4426,8 +4424,8 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) /* SPEC might be nil because ASCII_FONT's name doesn't parse according to stupid XLFD rules, which, for example, disallow font names that include a dash followed by a - number. So in those cases we simply request x_new_font - below to generate a new fontset. */ + number. So in those cases we simply call + set_new_font_hook below to generate a new fontset. */ if (NILP (spec) || ! font_match_p (spec, font_object)) fontset = -1; } @@ -4438,7 +4436,7 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (! NILP (Fequal (font_object, oldval))) return; - x_new_font (f, font_object, fontset); + FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); store_frame_param (f, Qfont, arg); #ifdef HAVE_X_WINDOWS store_frame_param (f, Qfont_parameter, font_param); @@ -4470,7 +4468,7 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) void -x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (! NILP (new_value) && !CONSP (new_value)) @@ -4518,14 +4516,14 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu Lisp_Object frame; XSETFRAME (frame, f); - x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); + gui_set_font (f, Fframe_parameter (frame, Qfont), Qnil); face_change = true; windows_or_buffers_changed = 18; } } void -x_set_left_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_left_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { int unit = FRAME_COLUMN_WIDTH (f); int old_width = FRAME_LEFT_FRINGE_WIDTH (f); @@ -4540,7 +4538,7 @@ x_set_left_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value f->fringe_cols /* Round up. */ = (new_width + FRAME_RIGHT_FRINGE_WIDTH (f) + unit - 1) / unit; - if (FRAME_X_WINDOW (f) != 0) + if (FRAME_NATIVE_WINDOW (f) != 0) adjust_frame_size (f, -1, -1, 3, 0, Qleft_fringe); SET_FRAME_GARBAGED (f); @@ -4549,7 +4547,7 @@ x_set_left_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value void -x_set_right_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_right_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { int unit = FRAME_COLUMN_WIDTH (f); int old_width = FRAME_RIGHT_FRINGE_WIDTH (f); @@ -4564,7 +4562,7 @@ x_set_right_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu f->fringe_cols /* Round up. */ = (new_width + FRAME_LEFT_FRINGE_WIDTH (f) + unit - 1) / unit; - if (FRAME_X_WINDOW (f) != 0) + if (FRAME_NATIVE_WINDOW (f) != 0) adjust_frame_size (f, -1, -1, 3, 0, Qright_fringe); SET_FRAME_GARBAGED (f); @@ -4573,21 +4571,21 @@ x_set_right_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu void -x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { CHECK_TYPE_RANGED_INTEGER (int, arg); if (XFIXNUM (arg) == f->border_width) return; - if (FRAME_X_WINDOW (f) != 0) + if (FRAME_NATIVE_WINDOW (f) != 0) error ("Cannot change the border width of a frame"); f->border_width = XFIXNUM (arg); } void -x_set_right_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_right_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int old = FRAME_RIGHT_DIVIDER_WIDTH (f); CHECK_TYPE_RANGED_INTEGER (int, arg); @@ -4602,7 +4600,7 @@ x_set_right_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } void -x_set_bottom_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_bottom_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int old = FRAME_BOTTOM_DIVIDER_WIDTH (f); CHECK_TYPE_RANGED_INTEGER (int, arg); @@ -4617,7 +4615,7 @@ x_set_bottom_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval } void -x_set_visibility (struct frame *f, Lisp_Object value, Lisp_Object oldval) +gui_set_visibility (struct frame *f, Lisp_Object value, Lisp_Object oldval) { Lisp_Object frame; XSETFRAME (frame, f); @@ -4631,25 +4629,25 @@ x_set_visibility (struct frame *f, Lisp_Object value, Lisp_Object oldval) } void -x_set_autoraise (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_autoraise (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { f->auto_raise = !NILP (arg); } void -x_set_autolower (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_autolower (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { f->auto_lower = !NILP (arg); } void -x_set_unsplittable (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_unsplittable (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { f->no_split = !NILP (arg); } void -x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) @@ -4669,11 +4667,11 @@ x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval ? vertical_scroll_bar_right : vertical_scroll_bar_none); - /* We set this parameter before creating the X window for the - frame, so we can get the geometry right from the start. + /* We set this parameter before creating the native window for + the frame, so we can get the geometry right from the start. However, if the window hasn't been created yet, we shouldn't - call x_set_window_size. */ - if (FRAME_X_WINDOW (f)) + call set_window_size_hook. */ + if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qvertical_scroll_bars); SET_FRAME_GARBAGED (f); @@ -4681,7 +4679,7 @@ x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval } void -x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { #if USE_HORIZONTAL_SCROLL_BARS if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)) @@ -4689,11 +4687,11 @@ x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldv { f->horizontal_scroll_bars = NILP (arg) ? false : true; - /* We set this parameter before creating the X window for the - frame, so we can get the geometry right from the start. + /* We set this parameter before creating the native window for + the frame, so we can get the geometry right from the start. However, if the window hasn't been created yet, we shouldn't - call x_set_window_size. */ - if (FRAME_X_WINDOW (f)) + call set_window_size_hook. */ + if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qhorizontal_scroll_bars); SET_FRAME_GARBAGED (f); @@ -4702,7 +4700,7 @@ x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldv } void -x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int unit = FRAME_COLUMN_WIDTH (f); @@ -4711,16 +4709,16 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg); FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit; - if (FRAME_X_WINDOW (f)) + if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); SET_FRAME_GARBAGED (f); } else { - x_set_scroll_bar_default_width (f); + FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); - if (FRAME_X_WINDOW (f)) + if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); SET_FRAME_GARBAGED (f); @@ -4731,7 +4729,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } void -x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { #if USE_HORIZONTAL_SCROLL_BARS int unit = FRAME_LINE_HEIGHT (f); @@ -4741,16 +4739,16 @@ x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg); FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit; - if (FRAME_X_WINDOW (f)) + if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); SET_FRAME_GARBAGED (f); } else { - x_set_scroll_bar_default_height (f); + FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); - if (FRAME_X_WINDOW (f)) + if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); SET_FRAME_GARBAGED (f); @@ -4762,7 +4760,7 @@ x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } void -x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +gui_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { double alpha = 1.0; double newval[2]; @@ -4803,25 +4801,24 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) for (i = 0; i < 2; i++) f->alpha[i] = newval[i]; -#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) - block_input (); - x_set_frame_alpha (f); - unblock_input (); -#endif - - return; + if (FRAME_TERMINAL (f)->set_frame_alpha_hook) + { + block_input (); + FRAME_TERMINAL (f)->set_frame_alpha_hook (f); + unblock_input (); + } } /** - * x_set_no_special_glyphs: + * gui_set_no_special_glyphs: * * Set frame F's `no-special-glyphs' parameter which, if non-nil, * suppresses the display of truncation and continuation glyphs * outside fringes. */ void -x_set_no_special_glyphs (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +gui_set_no_special_glyphs (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (!EQ (new_value, old_value)) FRAME_NO_SPECIAL_GLYPHS (f) = !NILP (new_value); @@ -4833,7 +4830,8 @@ x_set_no_special_glyphs (struct frame *f, Lisp_Object new_value, Lisp_Object old /* Non-zero if mouse is grabbed on DPYINFO and we know the frame where it is. */ -bool x_mouse_grabbed (Display_Info *dpyinfo) +bool +gui_mouse_grabbed (Display_Info *dpyinfo) { return (dpyinfo->grabbed && dpyinfo->last_mouse_frame @@ -4844,7 +4842,7 @@ bool x_mouse_grabbed (Display_Info *dpyinfo) on DPYINFO using saved frame and mouse position. */ void -x_redo_mouse_highlight (Display_Info *dpyinfo) +gui_redo_mouse_highlight (Display_Info *dpyinfo) { if (dpyinfo->last_mouse_motion_frame && FRAME_LIVE_P (dpyinfo->last_mouse_motion_frame)) @@ -4926,11 +4924,13 @@ validate_x_resource_name (void) } } -/* Get specified attribute from resource database RDB. +/* Get a GUI resource, like Fx_get_resource, but for display DPYINFO. See Fx_get_resource below for other parameters. */ -static Lisp_Object -xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) +Lisp_Object +gui_display_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, + Lisp_Object class, Lisp_Object component, + Lisp_Object subclass) { CHECK_STRING (attribute); CHECK_STRING (class); @@ -4983,7 +4983,10 @@ xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Li *nz++ = '.'; lispstpcpy (nz, attribute); - char *value = x_get_string_resource (rdb, name_key, class_key); + const char *value = + dpyinfo->terminal->get_string_resource_hook (&dpyinfo->rdb, + name_key, + class_key); SAFE_FREE(); if (value && *value) @@ -5008,28 +5011,17 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) { check_window_system (NULL); - return xrdb_get_resource (check_x_display_info (Qnil)->xrdb, - attribute, class, component, subclass); -} - -/* Get an X resource, like Fx_get_resource, but for display DPYINFO. */ - -Lisp_Object -display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, - Lisp_Object class, Lisp_Object component, - Lisp_Object subclass) -{ - return xrdb_get_resource (dpyinfo->xrdb, - attribute, class, component, subclass); + return gui_display_get_resource (check_x_display_info (Qnil), + attribute, class, component, subclass); } #if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT && !defined USE_GTK /* Used when C code wants a resource value. */ /* Called from oldXMenu/Create.c. */ -char * +const char * x_get_resource_string (const char *attribute, const char *class) { - char *result; + const char *result; struct frame *sf = SELECTED_FRAME (); ptrdiff_t invocation_namelen = SBYTES (Vinvocation_name); USE_SAFE_ALLOCA; @@ -5046,8 +5038,8 @@ x_get_resource_string (const char *attribute, const char *class) esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); - result = x_get_string_resource (FRAME_DISPLAY_INFO (sf)->xrdb, - name_key, class_key); + result = gui_display_get_resource (&FRAME_DISPLAY_INFO (sf)->rdb, + name_key, class_key); SAFE_FREE (); return result; } @@ -5055,18 +5047,21 @@ x_get_resource_string (const char *attribute, const char *class) /* Return the value of parameter PARAM. - First search ALIST, then Vdefault_frame_alist, then the X defaults - database, using ATTRIBUTE as the attribute name and CLASS as its class. + First search ALIST, then Vdefault_frame_alist, then the GUI + resource database, using ATTRIBUTE as the attribute name and CLASS + as its class. Convert the resource to the type specified by desired_type. If no default is specified, return Qunbound. If you call - x_get_arg, make sure you deal with Qunbound in a reasonable way, - and don't let it get stored in any Lisp-visible variables! */ + gui_display_get_arg, make sure you deal with Qunbound in a + reasonable way, and don't let it get stored in any Lisp-visible + variables! */ Lisp_Object -x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, - const char *attribute, const char *class, enum resource_types type) +gui_display_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, + const char *attribute, const char *class, + enum resource_types type) { Lisp_Object tem; @@ -5096,7 +5091,7 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, { AUTO_STRING (at, attribute); AUTO_STRING (cl, class); - tem = display_x_get_resource (dpyinfo, at, cl, Qnil, Qnil); + tem = gui_display_get_resource (dpyinfo, at, cl, Qnil, Qnil); if (NILP (tem)) return Qunbound; @@ -5163,26 +5158,26 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, } static Lisp_Object -x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, - const char *attribute, const char *class, - enum resource_types type) +gui_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, + const char *attribute, const char *class, + enum resource_types type) { - return x_get_arg (FRAME_DISPLAY_INFO (f), - alist, param, attribute, class, type); + return gui_display_get_arg (FRAME_DISPLAY_INFO (f), + alist, param, attribute, class, type); } -/* Like x_frame_get_arg, but also record the value in f->param_alist. */ +/* Like gui_frame_get_arg, but also record the value in f->param_alist. */ Lisp_Object -x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, - Lisp_Object param, - const char *attribute, const char *class, - enum resource_types type) +gui_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, + Lisp_Object param, + const char *attribute, const char *class, + enum resource_types type) { Lisp_Object value; - value = x_get_arg (FRAME_DISPLAY_INFO (f), alist, param, - attribute, class, type); + value = gui_display_get_arg (FRAME_DISPLAY_INFO (f), alist, param, + attribute, class, type); if (! NILP (value) && ! EQ (value, Qunbound)) store_frame_param (f, param, value); @@ -5197,17 +5192,17 @@ x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, If that is not found either, use the value DEFLT. */ Lisp_Object -x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, - Lisp_Object deflt, const char *xprop, const char *xclass, - enum resource_types type) +gui_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, + Lisp_Object deflt, const char *xprop, const char *xclass, + enum resource_types type) { Lisp_Object tem; - tem = x_frame_get_arg (f, alist, prop, xprop, xclass, type); + tem = gui_frame_get_arg (f, alist, prop, xprop, xclass, type); if (EQ (tem, Qunbound)) tem = deflt; AUTO_FRAME_ARG (arg, prop, tem); - x_set_frame_parameters (f, arg); + gui_set_frame_parameters (f, arg); return tem; } @@ -5382,7 +5377,8 @@ On Nextstep, this just calls `ns-parse-geometry'. */) #define DEFAULT_COLS 80 long -x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p, int *x_width, int *x_height) +gui_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p, + int *x_width, int *x_height) { Lisp_Object height, width, user_size, top, left, user_position; long window_prompting = 0; @@ -5436,8 +5432,8 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p, int *x override what we specify below. */ f->new_width = f->new_height = 0; - height = x_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER); - width = x_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER); + height = gui_display_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER); + width = gui_display_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER); if (!EQ (width, Qunbound) || !EQ (height, Qunbound)) { if (!EQ (width, Qunbound)) @@ -5514,16 +5510,18 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p, int *x } } - user_size = x_get_arg (dpyinfo, parms, Quser_size, 0, 0, RES_TYPE_NUMBER); + user_size = gui_display_get_arg (dpyinfo, parms, Quser_size, 0, 0, + RES_TYPE_NUMBER); if (!NILP (user_size) && !EQ (user_size, Qunbound)) window_prompting |= USSize; else window_prompting |= PSize; } - top = x_get_arg (dpyinfo, parms, Qtop, 0, 0, RES_TYPE_NUMBER); - left = x_get_arg (dpyinfo, parms, Qleft, 0, 0, RES_TYPE_NUMBER); - user_position = x_get_arg (dpyinfo, parms, Quser_position, 0, 0, RES_TYPE_NUMBER); + top = gui_display_get_arg (dpyinfo, parms, Qtop, 0, 0, RES_TYPE_NUMBER); + left = gui_display_get_arg (dpyinfo, parms, Qleft, 0, 0, RES_TYPE_NUMBER); + user_position = gui_display_get_arg (dpyinfo, parms, Quser_position, 0, 0, + RES_TYPE_NUMBER); if (! EQ (top, Qunbound) || ! EQ (left, Qunbound)) { if (EQ (top, Qminus)) diff --git a/src/frame.h b/src/frame.h index e2e8eaab9b..e66590ef74 100644 --- a/src/frame.h +++ b/src/frame.h @@ -397,9 +397,9 @@ struct frame in pixels. */ bool_bf new_pixelwise : 1; - /* True means x_set_window_size requests can be processed for this - frame. */ - bool_bf can_x_set_window_size : 1; + /* True means set_window_size_hook requests can be processed for + this frame. */ + bool_bf can_set_window_size : 1; /* Set to true after this frame was made by `make-frame'. */ bool_bf after_make_frame : 1; @@ -786,8 +786,8 @@ default_pixels_per_inch_y (void) #define FRAME_NS_P(f) ((f)->output_method == output_ns) #endif -/* FRAME_WINDOW_P tests whether the frame is a window, and is - defined to be the predicate for the window system being used. */ +/* FRAME_WINDOW_P tests whether the frame is a graphical window system + frame. */ #ifdef HAVE_X_WINDOWS #define FRAME_WINDOW_P(f) FRAME_X_P (f) @@ -1544,59 +1544,44 @@ FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f) /* The class of this X application. */ #define EMACS_CLASS "Emacs" -extern void x_set_scroll_bar_default_width (struct frame *); -extern void x_set_scroll_bar_default_height (struct frame *); -extern void x_set_offset (struct frame *, int, int, int); -extern void x_wm_set_size_hint (struct frame *f, long flags, bool user_position); -extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); -extern void x_set_frame_parameters (struct frame *, Lisp_Object); -extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_font (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_font_backend (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_left_fringe (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_right_fringe (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_border_width (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_right_divider_width (struct frame *, Lisp_Object, - Lisp_Object); -extern void x_set_bottom_divider_width (struct frame *, Lisp_Object, - Lisp_Object); -extern void x_set_visibility (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_autoraise (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_autolower (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_vertical_scroll_bars (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_horizontal_scroll_bars (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_scroll_bar_width (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_scroll_bar_height (struct frame *, Lisp_Object, Lisp_Object); - -extern long x_figure_window_size (struct frame *, Lisp_Object, bool, int *, int *); - -extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_no_special_glyphs (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_frame_parameters (struct frame *, Lisp_Object); +extern void gui_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_font (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_font_backend (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_left_fringe (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_right_fringe (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_border_width (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_right_divider_width (struct frame *, Lisp_Object, + Lisp_Object); +extern void gui_set_bottom_divider_width (struct frame *, Lisp_Object, + Lisp_Object); +extern void gui_set_visibility (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_autoraise (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_autolower (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_vertical_scroll_bars (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_horizontal_scroll_bars (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_scroll_bar_width (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_scroll_bar_height (struct frame *, Lisp_Object, Lisp_Object); + +extern long gui_figure_window_size (struct frame *, Lisp_Object, bool, int *, int *); + +extern void gui_set_alpha (struct frame *, Lisp_Object, Lisp_Object); +extern void gui_set_no_special_glyphs (struct frame *, Lisp_Object, Lisp_Object); extern void validate_x_resource_name (void); -extern Lisp_Object display_x_get_resource (Display_Info *, - Lisp_Object attribute, - Lisp_Object class, - Lisp_Object component, - Lisp_Object subclass); +extern Lisp_Object gui_display_get_resource (Display_Info *, + Lisp_Object attribute, + Lisp_Object class, + Lisp_Object component, + Lisp_Object subclass); extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p); -extern void x_set_window_size (struct frame *f, bool change_gravity, - int width, int height, bool pixelwise); -extern Lisp_Object x_get_focus_frame (struct frame *); extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); -extern void x_make_frame_visible (struct frame *f); -extern void x_make_frame_invisible (struct frame *f); -extern void x_iconify_frame (struct frame *f); -extern void x_set_frame_alpha (struct frame *f); -extern void x_activate_menubar (struct frame *); -extern void x_real_positions (struct frame *, int *, int *); extern void free_frame_menubar (struct frame *); -extern void x_free_frame_resources (struct frame *); extern bool frame_ancestor_p (struct frame *af, struct frame *df); extern enum internal_border_part frame_internal_border_part (struct frame *f, int x, int y); @@ -1608,22 +1593,17 @@ extern char *x_get_resource_string (const char *, const char *); extern void x_sync (struct frame *); #endif /* HAVE_X_WINDOWS */ -extern void x_query_colors (struct frame *f, XColor *, int); -extern void x_focus_frame (struct frame *, bool); - #ifndef HAVE_NS -extern bool x_bitmap_icon (struct frame *, Lisp_Object); - /* Set F's bitmap icon, if specified among F's parameters. */ INLINE void -x_set_bitmap_icon (struct frame *f) +gui_set_bitmap_icon (struct frame *f) { Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist); if (CONSP (obj) && !NILP (XCDR (obj))) - x_bitmap_icon (f, XCDR (obj)); + FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj)); } #endif /* !HAVE_NS */ diff --git a/src/gtkutil.c b/src/gtkutil.c index 2612683bcb..4823357653 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -328,7 +328,7 @@ xg_get_image_for_pixmap (struct frame *f, In that case, use the pixmap already loaded. */ if (STRINGP (specified_file) - && STRINGP (file = x_find_image_file (specified_file))) + && STRINGP (file = image_find_image_file (specified_file))) { char *encoded_file = SSDATA (ENCODE_FILE (file)); if (! old_widget) @@ -866,7 +866,7 @@ xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight) || pixelwidth != FRAME_PIXEL_WIDTH (f) || pixelheight != FRAME_PIXEL_HEIGHT (f)) { - x_clear_under_internal_border (f); + FRAME_RIF (f)->clear_under_internal_border (f); change_frame_size (f, width, height, 0, 1, 0, 1); SET_FRAME_GARBAGED (f); cancel_mouse_face (f); @@ -894,7 +894,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) &gwidth, &gheight); /* Do this before resize, as we don't know yet if we will be resized. */ - x_clear_under_internal_border (f); + FRAME_RIF (f)->clear_under_internal_border (f); totalheight /= xg_get_scale (f); totalwidth /= xg_get_scale (f); @@ -960,7 +960,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) /* Try to restore fullscreen state. */ { store_frame_param (f, Qfullscreen, fullscreen); - x_set_fullscreen (f, fullscreen, fullscreen); + gui_set_fullscreen (f, fullscreen, fullscreen); } } else @@ -1078,8 +1078,8 @@ style_changed_cb (GObject *go, && FRAME_X_P (f) && FRAME_X_DISPLAY (f) == dpy) { - x_set_scroll_bar_default_width (f); - x_set_scroll_bar_default_height (f); + FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); + FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); xg_frame_set_char_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f)); } } @@ -4324,7 +4324,7 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) /* Return focus to the frame after we have clicked on a detached tool bar button. */ - x_focus_frame (f, false); + FRAME_TERMINAL (f)->focus_frame_hook (f, false); } static GtkWidget * diff --git a/src/image.c b/src/image.c index 8e3a9a4930..1cf90c88c5 100644 --- a/src/image.c +++ b/src/image.c @@ -111,9 +111,9 @@ typedef struct ns_bitmap_record Bitmap_Record; # define COLOR_TABLE_SUPPORT 1 #endif -static void x_disable_image (struct frame *, struct image *); -static void x_edge_detection (struct frame *, struct image *, Lisp_Object, - Lisp_Object); +static void image_disable_image (struct frame *, struct image *); +static void image_edge_detection (struct frame *, struct image *, Lisp_Object, + Lisp_Object); static void init_color_table (void); static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b); @@ -129,8 +129,8 @@ static unsigned long *colors_in_color_table (int *n); Bitmap indices are guaranteed to be > 0, so a negative number can be used to indicate no bitmap. - If you use x_create_bitmap_from_data, then you must keep track of - the bitmaps yourself. That is, creating a bitmap from the same + If you use image_create_bitmap_from_data, then you must keep track + of the bitmaps yourself. That is, creating a bitmap from the same data more than once will not be caught. */ #ifdef HAVE_NS @@ -169,7 +169,7 @@ x_bitmap_width (struct frame *f, ptrdiff_t id) #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) ptrdiff_t -x_bitmap_pixmap (struct frame *f, ptrdiff_t id) +image_bitmap_pixmap (struct frame *f, ptrdiff_t id) { /* HAVE_NTGUI needs the explicit cast here. */ return (ptrdiff_t) FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; @@ -187,7 +187,7 @@ x_bitmap_mask (struct frame *f, ptrdiff_t id) /* Allocate a new bitmap record. Returns index of new record. */ static ptrdiff_t -x_allocate_bitmap_record (struct frame *f) +image_allocate_bitmap_record (struct frame *f) { Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); ptrdiff_t i; @@ -208,7 +208,7 @@ x_allocate_bitmap_record (struct frame *f) /* Add one reference to the reference count of the bitmap with id ID. */ void -x_reference_bitmap (struct frame *f, ptrdiff_t id) +image_reference_bitmap (struct frame *f, ptrdiff_t id) { ++FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; } @@ -216,7 +216,8 @@ x_reference_bitmap (struct frame *f, ptrdiff_t id) /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ ptrdiff_t -x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsigned int height) +image_create_bitmap_from_data (struct frame *f, char *bits, + unsigned int width, unsigned int height) { Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); ptrdiff_t id; @@ -246,7 +247,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi return -1; #endif - id = x_allocate_bitmap_record (f); + id = image_allocate_bitmap_record (f); #ifdef HAVE_NS dpyinfo->bitmaps[id - 1].img = bitmap; @@ -276,7 +277,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi /* Create bitmap from file FILE for frame F. */ ptrdiff_t -x_create_bitmap_from_file (struct frame *f, Lisp_Object file) +image_create_bitmap_from_file (struct frame *f, Lisp_Object file) { #ifdef HAVE_NTGUI return -1; /* W32_TODO : bitmap support */ @@ -292,7 +293,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file) return -1; - id = x_allocate_bitmap_record (f); + id = image_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].img = bitmap; dpyinfo->bitmaps[id - 1].refcount = 1; dpyinfo->bitmaps[id - 1].file = xlispstrdup (file); @@ -335,7 +336,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file) if (result != BitmapSuccess) return -1; - id = x_allocate_bitmap_record (f); + id = image_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].have_mask = false; dpyinfo->bitmaps[id - 1].refcount = 1; @@ -377,7 +378,7 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm) /* Remove reference to bitmap with id number ID. */ void -x_destroy_bitmap (struct frame *f, ptrdiff_t id) +image_destroy_bitmap (struct frame *f, ptrdiff_t id) { Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); @@ -397,7 +398,7 @@ x_destroy_bitmap (struct frame *f, ptrdiff_t id) /* Free all the bitmaps for the display specified by DPYINFO. */ void -x_destroy_all_bitmaps (Display_Info *dpyinfo) +image_destroy_all_bitmaps (Display_Info *dpyinfo) { ptrdiff_t i; Bitmap_Record *bm = dpyinfo->bitmaps; @@ -410,13 +411,13 @@ x_destroy_all_bitmaps (Display_Info *dpyinfo) } #ifndef HAVE_XRENDER -/* Required for the definition of x_create_x_image_and_pixmap below. */ +/* Required for the definition of image_create_x_image_and_pixmap_1 below. */ typedef void Picture; #endif -static bool x_create_x_image_and_pixmap (struct frame *, int, int, int, - XImagePtr *, Pixmap *, Picture *); -static void x_destroy_x_image (XImagePtr ximg); +static bool image_create_x_image_and_pixmap_1 (struct frame *, int, int, int, + XImagePtr *, Pixmap *, Picture *); +static void image_destroy_x_image (XImagePtr ximg); #ifdef HAVE_NTGUI static XImagePtr_or_DC image_get_x_image_or_dc (struct frame *, struct image *, @@ -464,7 +465,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id) if (!(id > 0)) return; - pixmap = x_bitmap_pixmap (f, id); + pixmap = image_bitmap_pixmap (f, id); width = x_bitmap_width (f, id); height = x_bitmap_height (f, id); @@ -478,8 +479,8 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id) return; } - result = x_create_x_image_and_pixmap (f, width, height, 1, - &mask_img, &mask, NULL); + result = image_create_x_image_and_pixmap_1 (f, width, height, 1, + &mask_img, &mask, NULL); unblock_input (); if (!result) @@ -523,7 +524,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id) dpyinfo->bitmaps[id - 1].mask = mask; XDestroyImage (ximg); - x_destroy_x_image (mask_img); + image_destroy_x_image (mask_img); } #endif /* HAVE_X_WINDOWS */ @@ -567,9 +568,9 @@ static struct image_type *image_types; /* Forward function prototypes. */ static struct image_type *lookup_image_type (Lisp_Object); -static void x_laplace (struct frame *, struct image *); -static void x_emboss (struct frame *, struct image *); -static void x_build_heuristic_mask (struct frame *, struct image *, +static void image_laplace (struct frame *, struct image *); +static void image_emboss (struct frame *, struct image *); +static void image_build_heuristic_mask (struct frame *, struct image *, Lisp_Object); #ifdef WINDOWSNT #define CACHE_IMAGE_TYPE(type, status) \ @@ -1313,7 +1314,7 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D /* Store F's background color into *BGCOLOR. */ static void -x_query_frame_background_color (struct frame *f, XColor *bgcolor) +image_query_frame_background_color (struct frame *f, XColor *bgcolor) { #ifndef HAVE_NS bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); @@ -1341,7 +1342,7 @@ x_query_frame_background_color (struct frame *f, XColor *bgcolor) #define CLEAR_IMAGE_COLORS (1 << 2) static void -x_clear_image_1 (struct frame *f, struct image *img, int flags) +image_clear_image_1 (struct frame *f, struct image *img, int flags) { if (flags & CLEAR_IMAGE_PIXMAP) { @@ -1355,7 +1356,7 @@ x_clear_image_1 (struct frame *f, struct image *img, int flags) #ifdef HAVE_X_WINDOWS if (img->ximg) { - x_destroy_x_image (img->ximg); + image_destroy_x_image (img->ximg); img->ximg = NULL; img->background_valid = 0; } @@ -1373,7 +1374,7 @@ x_clear_image_1 (struct frame *f, struct image *img, int flags) #ifdef HAVE_X_WINDOWS if (img->mask_img) { - x_destroy_x_image (img->mask_img); + image_destroy_x_image (img->mask_img); img->mask_img = NULL; img->background_transparent_valid = 0; } @@ -1396,14 +1397,14 @@ x_clear_image_1 (struct frame *f, struct image *img, int flags) /* Free X resources of image IMG which is used on frame F. */ static void -x_clear_image (struct frame *f, struct image *img) +image_clear_image (struct frame *f, struct image *img) { block_input (); #ifdef USE_CAIRO if (img->cr_data) cairo_surface_destroy ((cairo_surface_t *)img->cr_data); #endif - x_clear_image_1 (f, img, + image_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_MASK | CLEAR_IMAGE_COLORS); unblock_input (); } @@ -1415,8 +1416,8 @@ x_clear_image (struct frame *f, struct image *img) color. */ static unsigned long -x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name, - unsigned long dflt) +image_alloc_image_color (struct frame *f, struct image *img, + Lisp_Object color_name, unsigned long dflt) { XColor color; unsigned long result; @@ -1715,7 +1716,7 @@ postprocess_image (struct frame *f, struct image *img) mask = image_spec_value (spec, QCheuristic_mask, NULL); if (!NILP (mask)) - x_build_heuristic_mask (f, img, mask); + image_build_heuristic_mask (f, img, mask); else { bool found_p; @@ -1723,37 +1724,37 @@ postprocess_image (struct frame *f, struct image *img) mask = image_spec_value (spec, QCmask, &found_p); if (EQ (mask, Qheuristic)) - x_build_heuristic_mask (f, img, Qt); + image_build_heuristic_mask (f, img, Qt); else if (CONSP (mask) && EQ (XCAR (mask), Qheuristic)) { if (CONSP (XCDR (mask))) - x_build_heuristic_mask (f, img, XCAR (XCDR (mask))); + image_build_heuristic_mask (f, img, XCAR (XCDR (mask))); else - x_build_heuristic_mask (f, img, XCDR (mask)); + image_build_heuristic_mask (f, img, XCDR (mask)); } else if (NILP (mask) && found_p && img->mask) - x_clear_image_1 (f, img, CLEAR_IMAGE_MASK); + image_clear_image_1 (f, img, CLEAR_IMAGE_MASK); } /* Should we apply an image transformation algorithm? */ conversion = image_spec_value (spec, QCconversion, NULL); if (EQ (conversion, Qdisabled)) - x_disable_image (f, img); + image_disable_image (f, img); else if (EQ (conversion, Qlaplace)) - x_laplace (f, img); + image_laplace (f, img); else if (EQ (conversion, Qemboss)) - x_emboss (f, img); + image_emboss (f, img); else if (CONSP (conversion) && EQ (XCAR (conversion), Qedge_detection)) { Lisp_Object tem; tem = XCDR (conversion); if (CONSP (tem)) - x_edge_detection (f, img, - Fplist_get (tem, QCmatrix), - Fplist_get (tem, QCcolor_adjustment)); + image_edge_detection (f, img, + Fplist_get (tem, QCmatrix), + Fplist_get (tem, QCcolor_adjustment)); } } } @@ -1860,7 +1861,7 @@ compute_image_size (size_t width, size_t height, #endif /* HAVE_IMAGEMAGICK || HAVE_NATIVE_SCALING */ static void -x_set_image_size (struct frame *f, struct image *img) +image_set_image_size (struct frame *f, struct image *img) { #ifdef HAVE_NATIVE_SCALING # ifdef HAVE_IMAGEMAGICK @@ -1964,7 +1965,7 @@ lookup_image (struct frame *f, Lisp_Object spec) `:background COLOR'. */ Lisp_Object ascent, margin, relief, bg; int relief_bound; - x_set_image_size (f, img); + image_set_image_size (f, img); ascent = image_spec_value (spec, QCascent, NULL); if (FIXNUMP (ascent)) @@ -1996,8 +1997,8 @@ lookup_image (struct frame *f, Lisp_Object spec) if (!NILP (bg)) { img->background - = x_alloc_image_color (f, img, bg, - FRAME_BACKGROUND_PIXEL (f)); + = image_alloc_image_color (f, img, bg, + FRAME_BACKGROUND_PIXEL (f)); img->background_valid = 1; } } @@ -2094,7 +2095,7 @@ mark_image_cache (struct image_cache *c) WIDTH and HEIGHT must both be positive. If XIMG is null, assume it is a bitmap. */ static bool -x_check_image_size (XImagePtr ximg, int width, int height) +image_check_image_size (XImagePtr ximg, int width, int height) { #ifdef HAVE_X_WINDOWS /* Respect Xlib's limits: it cannot deal with images that have more @@ -2138,8 +2139,8 @@ x_check_image_size (XImagePtr ximg, int width, int height) should indicate the bit depth of the image. */ static bool -x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, - XImagePtr *ximg, Pixmap *pixmap, Picture *picture) +image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int depth, + XImagePtr *ximg, Pixmap *pixmap, Picture *picture) { #ifdef HAVE_X_WINDOWS Display *display = FRAME_X_DISPLAY (f); @@ -2159,9 +2160,9 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, return 0; } - if (! x_check_image_size (*ximg, width, height)) + if (! image_check_image_size (*ximg, width, height)) { - x_destroy_x_image (*ximg); + image_destroy_x_image (*ximg); *ximg = NULL; image_error ("Image too large (%dx%d)", make_fixnum (width), make_fixnum (height)); @@ -2175,7 +2176,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, *pixmap = XCreatePixmap (display, drawable, width, height, depth); if (*pixmap == NO_PIXMAP) { - x_destroy_x_image (*ximg); + image_destroy_x_image (*ximg); *ximg = NULL; image_error ("Unable to create X pixmap"); return 0; @@ -2297,7 +2298,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, /* All system errors are < 10000, so the following is safe. */ XSETINT (errcode, err); image_error ("Unable to create bitmap, error code %d", errcode); - x_destroy_x_image (*ximg); + image_destroy_x_image (*ximg); *ximg = NULL; return 0; } @@ -2323,7 +2324,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, /* Destroy XImage XIMG. Free XIMG->data. */ static void -x_destroy_x_image (XImagePtr ximg) +image_destroy_x_image (XImagePtr ximg) { eassert (input_blocked_p ()); if (ximg) @@ -2349,7 +2350,8 @@ x_destroy_x_image (XImagePtr ximg) are width and height of both the image and pixmap. */ static void -x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int height) +gui_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, + int width, int height) { #ifdef HAVE_X_WINDOWS GC gc; @@ -2375,7 +2377,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he #endif } -/* Thin wrapper for x_create_x_image_and_pixmap, so that it matches +/* Thin wrapper for image_create_x_image_and_pixmap_1, so that it matches with image_put_x_image. */ static bool @@ -2389,9 +2391,9 @@ image_create_x_image_and_pixmap (struct frame *f, struct image *img, #ifdef HAVE_XRENDER picture = !mask_p ? &img->picture : &img->mask_picture; #endif - return x_create_x_image_and_pixmap (f, width, height, depth, ximg, - !mask_p ? &img->pixmap : &img->mask, - picture); + return image_create_x_image_and_pixmap_1 (f, width, height, depth, ximg, + !mask_p ? &img->pixmap : &img->mask, + picture); } /* Put X image XIMG into image IMG on frame F, as a mask if and only @@ -2416,9 +2418,9 @@ image_put_x_image (struct frame *f, struct image *img, XImagePtr ximg, img->mask_img = ximg; } #else - x_put_x_image (f, ximg, !mask_p ? img->pixmap : img->mask, - img->width, img->height); - x_destroy_x_image (ximg); + gui_put_x_image (f, ximg, !mask_p ? img->pixmap : img->mask, + img->width, img->height); + image_destroy_x_image (ximg); #endif } @@ -2431,14 +2433,14 @@ image_sync_to_pixmaps (struct frame *f, struct image *img) { if (img->ximg) { - x_put_x_image (f, img->ximg, img->pixmap, img->width, img->height); - x_destroy_x_image (img->ximg); + gui_put_x_image (f, img->ximg, img->pixmap, img->width, img->height); + image_destroy_x_image (img->ximg); img->ximg = NULL; } if (img->mask_img) { - x_put_x_image (f, img->mask_img, img->mask, img->width, img->height); - x_destroy_x_image (img->mask_img); + gui_put_x_image (f, img->mask_img, img->mask, img->width, img->height); + image_destroy_x_image (img->mask_img); img->mask_img = NULL; } } @@ -2520,7 +2522,7 @@ image_unget_x_image (struct image *img, bool mask_p, XImagePtr ximg) PFD is null, do not open the file. */ static Lisp_Object -x_find_image_fd (Lisp_Object file, int *pfd) +image_find_image_fd (Lisp_Object file, int *pfd) { Lisp_Object file_found, search_path; int fd; @@ -2558,9 +2560,9 @@ x_find_image_fd (Lisp_Object file, int *pfd) found, or nil if not found. */ Lisp_Object -x_find_image_file (Lisp_Object file) +image_find_image_file (Lisp_Object file) { - return x_find_image_fd (file, 0); + return image_find_image_fd (file, 0); } /* Read FILE into memory. Value is a pointer to a buffer allocated @@ -2661,7 +2663,7 @@ static struct image_type xbm_type = SYMBOL_INDEX (Qxbm), xbm_image_p, xbm_load, - x_clear_image, + image_clear_image, NULL, NULL }; @@ -2981,7 +2983,7 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data, #else img->pixmap = - (x_check_image_size (0, img->width, img->height) + (image_check_image_size (0, img->width, img->height) ? XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), data, @@ -3098,7 +3100,7 @@ xbm_read_bitmap_data (struct frame *f, char *contents, char *end, expect ('='); expect ('{'); - if (! x_check_image_size (0, *width, *height)) + if (! image_check_image_size (0, *width, *height)) { if (!inhibit_image_error) image_error ("Image too large (%dx%d)", @@ -3186,13 +3188,13 @@ xbm_load_image (struct frame *f, struct image *img, char *contents, char *end) value = image_spec_value (img->spec, QCforeground, NULL); if (!NILP (value)) { - foreground = x_alloc_image_color (f, img, value, foreground); + foreground = image_alloc_image_color (f, img, value, foreground); non_default_colors = 1; } value = image_spec_value (img->spec, QCbackground, NULL); if (!NILP (value)) { - background = x_alloc_image_color (f, img, value, background); + background = image_alloc_image_color (f, img, value, background); img->background = background; img->background_valid = 1; non_default_colors = 1; @@ -3205,7 +3207,7 @@ xbm_load_image (struct frame *f, struct image *img, char *contents, char *end) if (img->pixmap == NO_PIXMAP) { - x_clear_image (f, img); + image_clear_image (f, img); image_error ("Unable to create X pixmap for `%s'", img->spec); } else @@ -3247,7 +3249,7 @@ xbm_load (struct frame *f, struct image *img) if (STRINGP (file_name)) { int fd; - Lisp_Object file = x_find_image_fd (file_name, &fd); + Lisp_Object file = image_find_image_fd (file_name, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -3302,16 +3304,20 @@ xbm_load (struct frame *f, struct image *img) if (fmt[XBM_FOREGROUND].count && STRINGP (fmt[XBM_FOREGROUND].value)) { - foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value, - foreground); + foreground = image_alloc_image_color (f, + img, + fmt[XBM_FOREGROUND].value, + foreground); non_default_colors = 1; } if (fmt[XBM_BACKGROUND].count && STRINGP (fmt[XBM_BACKGROUND].value)) { - background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value, - background); + background = image_alloc_image_color (f, + img, + fmt[XBM_BACKGROUND].value, + background); non_default_colors = 1; } @@ -3358,7 +3364,7 @@ xbm_load (struct frame *f, struct image *img) #endif /* Create the pixmap. */ - if (x_check_image_size (0, img->width, img->height)) + if (image_check_image_size (0, img->width, img->height)) Create_Pixmap_From_Bitmap_Data (f, img, bits, foreground, background, non_default_colors); @@ -3371,7 +3377,7 @@ xbm_load (struct frame *f, struct image *img) { image_error ("Unable to create pixmap for XBM image `%s'", img->spec); - x_clear_image (f, img); + image_clear_image (f, img); } SAFE_FREE (); @@ -3468,7 +3474,7 @@ static struct image_type xpm_type = SYMBOL_INDEX (Qxpm), xpm_image_p, xpm_load, - x_clear_image, + image_clear_image, init_xpm_functions, NULL }; @@ -3769,7 +3775,7 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits) return -1; } - id = x_allocate_bitmap_record (f); + id = image_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].have_mask = true; dpyinfo->bitmaps[id - 1].mask = mask; @@ -3903,7 +3909,7 @@ xpm_load (struct frame *f, struct image *img) if (STRINGP (specified_file)) { - Lisp_Object file = x_find_image_file (specified_file); + Lisp_Object file = image_find_image_file (specified_file); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -3993,7 +3999,7 @@ xpm_load (struct frame *f, struct image *img) else { rc = XpmFileInvalid; - x_clear_image (f, img); + image_clear_image (f, img); } #else #ifdef HAVE_X_WINDOWS @@ -4004,7 +4010,7 @@ xpm_load (struct frame *f, struct image *img) img->ximg->depth); if (img->pixmap == NO_PIXMAP) { - x_clear_image (f, img); + image_clear_image (f, img); rc = XpmNoMemory; } else if (img->mask_img) @@ -4015,7 +4021,7 @@ xpm_load (struct frame *f, struct image *img) img->mask_img->depth); if (img->mask == NO_PIXMAP) { - x_clear_image (f, img); + image_clear_image (f, img); rc = XpmNoMemory; } } @@ -4528,17 +4534,17 @@ xpm_load_image (struct frame *f, } else { - x_destroy_x_image (mask_img); - x_clear_image_1 (f, img, CLEAR_IMAGE_MASK); + image_destroy_x_image (mask_img); + image_clear_image_1 (f, img, CLEAR_IMAGE_MASK); } #endif return 1; failure: image_error ("Invalid XPM3 file (%s)", img->spec); - x_destroy_x_image (ximg); - x_destroy_x_image (mask_img); - x_clear_image (f, img); + image_destroy_x_image (ximg); + image_destroy_x_image (mask_img); + image_clear_image (f, img); return 0; #undef match @@ -4558,7 +4564,7 @@ xpm_load (struct frame *f, if (STRINGP (file_name)) { int fd; - Lisp_Object file = x_find_image_fd (file_name, &fd); + Lisp_Object file = image_find_image_fd (file_name, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -4789,7 +4795,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel) #ifdef HAVE_X_WINDOWS cmap = FRAME_X_COLORMAP (f); color.pixel = pixel; - x_query_color (f, &color); + x_query_colors (f, &color, 1); rc = x_alloc_nearest_color (f, cmap, &color); #else block_input (); @@ -4905,7 +4911,7 @@ static int laplace_matrix[9] = { allocated with xmalloc; it must be freed by the caller. */ static XColor * -x_to_xcolors (struct frame *f, struct image *img, bool rgb_p) +image_to_xcolors (struct frame *f, struct image *img, bool rgb_p) { int x, y; XColor *colors, *p; @@ -4934,8 +4940,9 @@ x_to_xcolors (struct frame *f, struct image *img, bool rgb_p) for (x = 0; x < img->width; ++x, ++p) p->pixel = GET_PIXEL (ximg, x, y); if (rgb_p) - x_query_colors (f, row, img->width); - + { + FRAME_TERMINAL (f)->query_colors (f, row, img->width); + } #else for (x = 0; x < img->width; ++x, ++p) @@ -5008,7 +5015,7 @@ XPutPixel (XImagePtr ximg, int x, int y, COLORREF color) COLORS will be freed; an existing IMG->pixmap will be freed, too. */ static void -x_from_xcolors (struct frame *f, struct image *img, XColor *colors) +image_from_xcolors (struct frame *f, struct image *img, XColor *colors) { int x, y; XImagePtr oimg = NULL; @@ -5016,7 +5023,7 @@ x_from_xcolors (struct frame *f, struct image *img, XColor *colors) init_color_table (); - x_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_COLORS); + image_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_COLORS); image_create_x_image_and_pixmap (f, img, img->width, img->height, 0, &oimg, 0); p = colors; @@ -5047,9 +5054,10 @@ x_from_xcolors (struct frame *f, struct image *img, XColor *colors) outgoing image. */ static void -x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjust) +image_detect_edges (struct frame *f, struct image *img, + int *matrix, int color_adjust) { - XColor *colors = x_to_xcolors (f, img, 1); + XColor *colors = image_to_xcolors (f, img, 1); XColor *new, *p; int x, y, i, sum; ptrdiff_t nbytes; @@ -5107,7 +5115,7 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus } xfree (colors); - x_from_xcolors (f, img, new); + image_from_xcolors (f, img, new); #undef COLOR } @@ -5117,9 +5125,9 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus on frame F. */ static void -x_emboss (struct frame *f, struct image *img) +image_emboss (struct frame *f, struct image *img) { - x_detect_edges (f, img, emboss_matrix, 0xffff / 2); + image_detect_edges (f, img, emboss_matrix, 0xffff / 2); } @@ -5128,9 +5136,9 @@ x_emboss (struct frame *f, struct image *img) to draw disabled buttons, for example. */ static void -x_laplace (struct frame *f, struct image *img) +image_laplace (struct frame *f, struct image *img) { - x_detect_edges (f, img, laplace_matrix, 45000); + image_detect_edges (f, img, laplace_matrix, 45000); } @@ -5146,8 +5154,8 @@ x_laplace (struct frame *f, struct image *img) number. */ static void -x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix, - Lisp_Object color_adjust) +image_edge_detection (struct frame *f, struct image *img, + Lisp_Object matrix, Lisp_Object color_adjust) { int i = 0; int trans[9]; @@ -5169,14 +5177,14 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix, color_adjust = make_fixnum (0xffff / 2); if (i == 9 && NUMBERP (color_adjust)) - x_detect_edges (f, img, trans, XFLOATINT (color_adjust)); + image_detect_edges (f, img, trans, XFLOATINT (color_adjust)); } /* Transform image IMG on frame F so that it looks disabled. */ static void -x_disable_image (struct frame *f, struct image *img) +image_disable_image (struct frame *f, struct image *img) { Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); #ifdef HAVE_NTGUI @@ -5190,7 +5198,7 @@ x_disable_image (struct frame *f, struct image *img) /* Color (or grayscale). Convert to gray, and equalize. Just drawing such images with a stipple can look very odd, so we're using this method instead. */ - XColor *colors = x_to_xcolors (f, img, 1); + XColor *colors = image_to_xcolors (f, img, 1); XColor *p, *end; const int h = 15000; const int l = 30000; @@ -5204,7 +5212,7 @@ x_disable_image (struct frame *f, struct image *img) p->red = p->green = p->blue = i2; } - x_from_xcolors (f, img, colors); + image_from_xcolors (f, img, colors); } /* Draw a cross over the disabled image, if we must or if we @@ -5279,7 +5287,8 @@ x_disable_image (struct frame *f, struct image *img) heuristically. */ static void -x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) +image_build_heuristic_mask (struct frame *f, struct image *img, + Lisp_Object how) { XImagePtr_or_DC ximg; #ifdef HAVE_NTGUI @@ -5294,7 +5303,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) unsigned long bg = 0; if (img->mask) - x_clear_image_1 (f, img, CLEAR_IMAGE_MASK); + image_clear_image_1 (f, img, CLEAR_IMAGE_MASK); #ifndef HAVE_NTGUI #ifndef HAVE_NS @@ -5335,7 +5344,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) #ifdef HAVE_NTGUI 0x00ffffff & /* Filter out palette info. */ #endif /* HAVE_NTGUI */ - x_alloc_image_color (f, img, build_string (color_name), 0)); + image_alloc_image_color (f, img, build_string (color_name), 0)); use_img_background = 0; } } @@ -5378,7 +5387,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) SelectObject (ximg, img->mask); image_background_transparent (img, f, ximg); - /* Was: x_destroy_x_image ((XImagePtr )mask_img); which seems bogus ++kfs */ + /* Was: image_destroy_x_image ((XImagePtr )mask_img); which seems bogus ++kfs */ xfree (mask_img); #endif /* HAVE_NTGUI */ @@ -5436,7 +5445,7 @@ static struct image_type pbm_type = SYMBOL_INDEX (Qpbm), pbm_image_p, pbm_load, - x_clear_image, + image_clear_image, NULL, NULL }; @@ -5547,7 +5556,7 @@ pbm_load (struct frame *f, struct image *img) if (STRINGP (specified_file)) { int fd; - Lisp_Object file = x_find_image_fd (specified_file, &fd); + Lisp_Object file = image_find_image_fd (specified_file, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -5675,7 +5684,7 @@ pbm_load (struct frame *f, struct image *img) || ! x_defined_color (f, SSDATA (fmt[PBM_FOREGROUND].value), &xfg, 0)) { xfg.pixel = fg; - x_query_color (f, &xfg); + x_query_colors (f, &xfg, 1); } fga32 = xcolor_to_argb32 (xfg); @@ -5684,17 +5693,17 @@ pbm_load (struct frame *f, struct image *img) || ! x_defined_color (f, SSDATA (fmt[PBM_BACKGROUND].value), &xbg, 0)) { xbg.pixel = bg; - x_query_color (f, &xbg); + x_query_colors (f, &xbg, 1); } bga32 = xcolor_to_argb32 (xbg); #else if (fmt[PBM_FOREGROUND].count && STRINGP (fmt[PBM_FOREGROUND].value)) - fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg); + fg = image_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg); if (fmt[PBM_BACKGROUND].count && STRINGP (fmt[PBM_BACKGROUND].value)) { - bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); + bg = image_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); img->background = bg; img->background_valid = 1; } @@ -5712,9 +5721,9 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO cairo_surface_destroy (surface); #else - x_destroy_x_image (ximg); + image_destroy_x_image (ximg); #endif - x_clear_image (f, img); + image_clear_image (f, img); image_error ("Invalid image size in image `%s'", img->spec); goto error; @@ -5758,9 +5767,9 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO cairo_surface_destroy (surface); #else - x_destroy_x_image (ximg); + image_destroy_x_image (ximg); #endif - x_clear_image (f, img); + image_clear_image (f, img); image_error ("Invalid image size in image `%s'", img->spec); goto error; } @@ -5792,7 +5801,7 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO cairo_surface_destroy (surface); #else - x_destroy_x_image (ximg); + image_destroy_x_image (ximg); #endif image_error ("Invalid pixel value in image `%s'", img->spec); goto error; @@ -5904,7 +5913,7 @@ static struct image_type png_type = SYMBOL_INDEX (Qpng), png_image_p, png_load, - x_clear_image, + image_clear_image, init_png_functions, NULL }; @@ -6186,7 +6195,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) if (NILP (specified_data)) { int fd; - Lisp_Object file = x_find_image_fd (specified_file, &fd); + Lisp_Object file = image_find_image_fd (specified_file, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -6341,7 +6350,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) color set by the image. */ if (STRINGP (specified_bg) ? x_defined_color (f, SSDATA (specified_bg), &color, false) - : (x_query_frame_background_color (f, &color), true)) + : (image_query_frame_background_color (f, &color), true)) /* The user specified `:background', use that. */ { int shift = bit_depth == 16 ? 0 : 8; @@ -6398,8 +6407,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) && !image_create_x_image_and_pixmap (f, img, width, height, 1, &mask_img, 1)) { - x_destroy_x_image (ximg); - x_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP); + image_destroy_x_image (ximg); + image_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP); goto error; } #endif @@ -6581,7 +6590,7 @@ static struct image_type jpeg_type = SYMBOL_INDEX (Qjpeg), jpeg_image_p, jpeg_load, - x_clear_image, + image_clear_image, init_jpeg_functions, NULL }; @@ -6945,7 +6954,7 @@ jpeg_load_body (struct frame *f, struct image *img, if (NILP (specified_data)) { int fd; - Lisp_Object file = x_find_image_fd (specified_file, &fd); + Lisp_Object file = image_find_image_fd (specified_file, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -6997,10 +7006,10 @@ jpeg_load_body (struct frame *f, struct image *img, /* If we already have an XImage, free that. */ #ifndef USE_CAIRO - x_destroy_x_image (ximg); + image_destroy_x_image (ximg); #endif /* Free pixmap and colors. */ - x_clear_image (f, img); + image_clear_image (f, img); return 0; } @@ -7215,7 +7224,7 @@ static struct image_type tiff_type = SYMBOL_INDEX (Qtiff), tiff_image_p, tiff_load, - x_clear_image, + image_clear_image, init_tiff_functions, NULL }; @@ -7459,7 +7468,7 @@ tiff_load (struct frame *f, struct image *img) if (NILP (specified_data)) { /* Read from a file */ - Lisp_Object file = x_find_image_file (specified_file); + Lisp_Object file = image_find_image_file (specified_file); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -7711,7 +7720,7 @@ static void gif_clear_image (struct frame *f, struct image *img) { img->lisp_data = Qnil; - x_clear_image (f, img); + image_clear_image (f, img); } /* Return true if OBJECT is a valid GIF image specification. */ @@ -7895,7 +7904,7 @@ gif_load (struct frame *f, struct image *img) if (NILP (specified_data)) { - Lisp_Object file = x_find_image_file (specified_file); + Lisp_Object file = image_find_image_file (specified_file); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -8081,8 +8090,8 @@ gif_load (struct frame *f, struct image *img) #ifndef USE_CAIRO unsigned long bgcolor UNINIT; if (STRINGP (specified_bg)) - bgcolor = x_alloc_image_color (f, img, specified_bg, - FRAME_BACKGROUND_PIXEL (f)); + bgcolor = image_alloc_image_color (f, img, specified_bg, + FRAME_BACKGROUND_PIXEL (f)); #endif for (j = 0; j <= idx; ++j) @@ -8378,7 +8387,7 @@ static void imagemagick_clear_image (struct frame *f, struct image *img) { - x_clear_image (f, img); + image_clear_image (f, img); } /* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do @@ -8789,7 +8798,7 @@ imagemagick_load_image (struct frame *f, struct image *img, specified_bg = image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP (specified_bg) || !x_defined_color (f, SSDATA (specified_bg), &bgcolor, 0)) - x_query_frame_background_color (f, &bgcolor); + image_query_frame_background_color (f, &bgcolor); bg_wand = NewPixelWand (); PixelSetRed (bg_wand, (double) bgcolor.red / 65535); @@ -8983,7 +8992,7 @@ imagemagick_load_image (struct frame *f, struct image *img, free_color_table (); #endif #ifndef USE_CAIRO - x_destroy_x_image (ximg); + image_destroy_x_image (ximg); #endif image_error ("Imagemagick pixel iterator creation failed"); goto imagemagick_error; @@ -9069,7 +9078,7 @@ imagemagick_load (struct frame *f, struct image *img) file_name = image_spec_value (img->spec, QCfile, NULL); if (STRINGP (file_name)) { - Lisp_Object file = x_find_image_file (file_name); + Lisp_Object file = image_find_image_file (file_name); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -9200,7 +9209,7 @@ static struct image_type svg_type = SYMBOL_INDEX (Qsvg), svg_image_p, svg_load, - x_clear_image, + image_clear_image, init_svg_functions, NULL }; @@ -9370,7 +9379,7 @@ svg_load (struct frame *f, struct image *img) if (STRINGP (file_name)) { int fd; - Lisp_Object file = x_find_image_fd (file_name, &fd); + Lisp_Object file = image_find_image_fd (file_name, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -9524,7 +9533,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP (specified_bg) || !x_defined_color (f, SSDATA (specified_bg), &background, 0)) - x_query_frame_background_color (f, &background); + image_query_frame_background_color (f, &background); /* SVG pixmaps specify transparency in the last byte, so right shift 8 bits to get rid of it, since emacs doesn't support @@ -9667,7 +9676,7 @@ static struct image_type gs_type = static void gs_clear_image (struct frame *f, struct image *img) { - x_clear_image (f, img); + image_clear_image (f, img); } @@ -9747,7 +9756,7 @@ gs_load (struct frame *f, struct image *img) /* Create the pixmap. */ eassert (img->pixmap == NO_PIXMAP); - if (x_check_image_size (0, img->width, img->height)) + if (image_check_image_size (0, img->width, img->height)) { /* Only W32 version did BLOCK_INPUT here. ++kfs */ block_input (); @@ -9857,7 +9866,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) XDestroyImage (ximg); #if 0 /* This doesn't seem to be the case. If we free the colors - here, we get a BadAccess later in x_clear_image when + here, we get a BadAccess later in image_clear_image when freeing the colors. */ /* We have allocated colors once, but Ghostscript has also allocated colors on behalf of us. So, to get the diff --git a/src/keyboard.c b/src/keyboard.c index dff8f6b2fc..ea13c7f5bc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3890,10 +3890,12 @@ kbd_buffer_get_event (KBOARD **kbp, #ifdef HAVE_EXT_MENU_BAR case MENU_BAR_ACTIVATE_EVENT: { + struct frame *f; kbd_fetch_ptr = next_kbd_event (event); input_pending = readable_events (0); - if (FRAME_LIVE_P (XFRAME (event->ie.frame_or_window))) - x_activate_menubar (XFRAME (event->ie.frame_or_window)); + f = (XFRAME (event->ie.frame_or_window)); + if (FRAME_LIVE_P (f) && FRAME_TERMINAL (f)->activate_menubar_hook) + FRAME_TERMINAL (f)->activate_menubar_hook (f); } break; #endif @@ -6508,7 +6510,7 @@ modify_event_symbol (ptrdiff_t symbol_num, int modifiers, Lisp_Object symbol_kin #ifdef HAVE_WINDOW_SYSTEM if (NILP (value)) { - char *name = x_get_keysym_name (symbol_num); + char *name = get_keysym_name (symbol_num); if (name) value = intern (name); } diff --git a/src/lisp.h b/src/lisp.h index f613ce20b0..ca833476c0 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4647,7 +4647,7 @@ extern void syms_of_xterm (void); #ifdef HAVE_WINDOW_SYSTEM /* Defined in xterm.c, nsterm.m, w32term.c. */ -extern char *x_get_keysym_name (int); +extern char *get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ /* Defined in xml.c. */ diff --git a/src/menu.h b/src/menu.h index 0321c27454..4412948224 100644 --- a/src/menu.h +++ b/src/menu.h @@ -47,14 +47,17 @@ extern widget_value *digest_single_submenu (int, int, bool); #if defined (HAVE_X_WINDOWS) || defined (MSDOS) extern Lisp_Object x_menu_show (struct frame *, int, int, int, Lisp_Object, const char **); +extern void x_activate_menubar (struct frame *); #endif #ifdef HAVE_NTGUI extern Lisp_Object w32_menu_show (struct frame *, int, int, int, Lisp_Object, const char **); +extern void w32_activate_menubar (struct frame *); #endif #ifdef HAVE_NS extern Lisp_Object ns_menu_show (struct frame *, int, int, int, Lisp_Object, const char **); +extern void ns_activate_menubar (struct frame *); #endif extern Lisp_Object tty_menu_show (struct frame *, int, int, int, Lisp_Object, const char **); diff --git a/src/nsfns.m b/src/nsfns.m index 009e9d55e2..2470c05c4b 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -233,7 +233,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. /* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. `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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. /* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. /* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. /* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. #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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. [[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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. { 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. || !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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 @@ Frames are listed from topmost (first) to bottommost (last). */) { 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 @@ Frames are listed from topmost (first) to bottommost (last). */) { 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 @@ Frames are listed from topmost (first) to bottommost (last). */) 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 @@ Frames are listed from topmost (first) to bottommost (last). */) } 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 @@ Frames are listed from topmost (first) to bottommost (last). */) } /* 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 @@ Frames are listed from topmost (first) to bottommost (last). */) 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 @@ Frames are listed from topmost (first) to bottommost (last). */) { 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 @@ Frames are listed from topmost (first) to bottommost (last). */) { 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 @@ Frames are listed from topmost (first) to bottommost (last). */) { /* 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 @@ Frames are listed from topmost (first) to bottommost (last). */) 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]; diff --git a/src/nsgui.h b/src/nsgui.h index c857d77d9c..c147f4dec4 100644 --- a/src/nsgui.h +++ b/src/nsgui.h @@ -117,9 +117,6 @@ typedef void * Color; typedef int Window; typedef int Display; -/* Xism */ -typedef Lisp_Object XrmDatabase; - /* Some sort of attempt to normalize rectangle handling. Seems a bit much for what is accomplished. */ diff --git a/src/nsimage.m b/src/nsimage.m index f16910de08..33236c48d4 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -193,7 +193,7 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file EmacsImage *image; /* Search bitmap-file-path for the file, if appropriate. */ - found = x_find_image_file (file); + found = image_find_image_file (file); if (!STRINGP (found)) return nil; found = ENCODE_FILE (found); diff --git a/src/nsmenu.m b/src/nsmenu.m index 34ec980856..fd1323344b 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -470,7 +470,7 @@ } void -x_activate_menubar (struct frame *f) +ns_activate_menubar (struct frame *f) { #ifdef NS_IMPL_COCOA ns_update_menubar (f, true, nil); diff --git a/src/nsterm.h b/src/nsterm.h index 78ce608554..41cdaccbc7 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -869,7 +869,7 @@ struct ns_display_info Window root_window; /* Xism */ - XrmDatabase xrdb; + Lisp_Object rdb; /* The cursor to use for vertical scroll bars. */ Cursor vertical_scroll_bar_cursor; @@ -882,7 +882,7 @@ struct ns_display_info Mouse_HLInfo mouse_highlight; struct frame *x_highlight_frame; - struct frame *x_focus_frame; + struct frame *ns_focus_frame; /* The frame where the mouse was last time we reported a mouse event. */ struct frame *last_mouse_frame; @@ -993,9 +993,9 @@ struct x_output /* This gives the ns_display_info structure for the display F is on. */ #define FRAME_DISPLAY_INFO(f) ((f)->output_data.ns->display_info) -#define FRAME_X_OUTPUT(f) ((f)->output_data.ns) +#define FRAME_OUTPUT_DATA(f) ((f)->output_data.ns) #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc) -#define FRAME_X_WINDOW(f) ((f)->output_data.ns->window_desc) +#define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f) /* This is the `Display *' which frame F is on. */ #define FRAME_NS_DISPLAY(f) (0) @@ -1122,6 +1122,9 @@ extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern, int size, int maxnames); extern void ns_clear_frame (struct frame *f); +extern void ns_set_offset (struct frame *f, int xoff, int yoff, + int change_grav); + extern const char *ns_xlfd_to_fontname (const char *xlfd); extern Lisp_Object ns_map_event_to_object (void); @@ -1140,7 +1143,7 @@ ns_defined_color (struct frame *f, XColor *color_def, bool alloc, bool makeIndex); extern void -ns_query_color (void *col, XColor *color_def, int setPixel); +ns_query_color (void *col, XColor *color_def, bool setPixel); #ifdef __OBJC__ extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); @@ -1151,6 +1154,15 @@ extern void ns_check_menu_open (NSMenu *menu); extern void ns_check_pending_open_menu (void); #endif +/* Implemented in nsfns, published in nsterm. */ +extern void ns_implicitly_set_name (struct frame *f, Lisp_Object arg, + Lisp_Object oldval); +extern void ns_set_scroll_bar_default_width (struct frame *f); +extern void ns_set_scroll_bar_default_height (struct frame *f); +extern const char *ns_get_string_resource (void *_rdb, + const char *name, + const char *class); + /* C access to ObjC functionality */ extern void ns_release_object (void *obj); extern void ns_retain_object (void *obj); @@ -1172,6 +1184,8 @@ extern Lisp_Object find_and_return_menu_selection (struct frame *f, extern Lisp_Object ns_popup_dialog (struct frame *, Lisp_Object header, Lisp_Object contents); +extern void ns_free_frame_resources (struct frame *); + #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); @@ -1201,22 +1215,23 @@ extern unsigned long ns_get_pixel (void *img, int x, int y); extern void ns_put_pixel (void *img, int x, int y, unsigned long argb); extern void ns_set_alpha (void *img, int x, int y, unsigned char a); -extern int x_display_pixel_height (struct ns_display_info *); -extern int x_display_pixel_width (struct ns_display_info *); +extern int ns_display_pixel_height (struct ns_display_info *); +extern int ns_display_pixel_width (struct ns_display_info *); /* This in nsterm.m */ extern float ns_antialias_threshold; -extern void x_destroy_window (struct frame *f); -extern void x_set_undecorated (struct frame *f, Lisp_Object new_value, - Lisp_Object old_value); -extern void x_set_parent_frame (struct frame *f, Lisp_Object new_value, +extern void ns_make_frame_visible (struct frame *f); +extern void ns_iconify_frame (struct frame *f); +extern void ns_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value); -extern void x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, - Lisp_Object old_value); -extern void x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, - Lisp_Object old_value); -extern void x_set_z_group (struct frame *f, Lisp_Object new_value, - Lisp_Object old_value); +extern void ns_set_parent_frame (struct frame *f, Lisp_Object new_value, + Lisp_Object old_value); +extern void ns_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, + Lisp_Object old_value); +extern void ns_set_no_accept_focus (struct frame *f, Lisp_Object new_value, + Lisp_Object old_value); +extern void ns_set_z_group (struct frame *f, Lisp_Object new_value, + Lisp_Object old_value); #ifdef NS_IMPL_COCOA extern void ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value); diff --git a/src/nsterm.m b/src/nsterm.m index 62fb4b2e21..ae49b659b7 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -698,7 +698,7 @@ Free a pool and temporary objects it refers to (callable from C) NSDisableScreenUpdates. We use these functions to prevent the user seeing a blank frame - after it has been resized. x_set_window_size disables updates and + after it has been resized. ns_set_window_size disables updates and when redisplay completes unwind_redisplay enables them again (bug#30699). */ @@ -1444,6 +1444,40 @@ -(void)remove ========================================================================== */ +static Lisp_Object +ns_get_focus_frame (struct frame *f) +/* -------------------------------------------------------------------------- + External (hook) + -------------------------------------------------------------------------- */ +{ + Lisp_Object lisp_focus; + + struct frame *focus = FRAME_DISPLAY_INFO (f)->ns_focus_frame; + + if (!focus) + return Qnil; + + XSETFRAME (lisp_focus, focus); + return lisp_focus; +} + +static void +ns_focus_frame (struct frame *f, bool noactivate) +/* -------------------------------------------------------------------------- + External (hook) + -------------------------------------------------------------------------- */ +{ + struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); + + if (dpyinfo->ns_focus_frame != f) + { + EmacsView *view = FRAME_NS_VIEW (f); + block_input (); + [NSApp activateIgnoringOtherApps: YES]; + [[view window] makeKeyAndOrderFront: view]; + unblock_input (); + } +} static void ns_raise_frame (struct frame *f, BOOL make_key) @@ -1497,6 +1531,7 @@ -(void)remove ns_lower_frame (f); } +static void ns_set_frame_alpha (struct frame *f); static void ns_frame_rehighlight (struct frame *frame) @@ -1508,16 +1543,16 @@ -(void)remove struct frame *old_highlight = dpyinfo->x_highlight_frame; NSTRACE ("ns_frame_rehighlight"); - if (dpyinfo->x_focus_frame) + if (dpyinfo->ns_focus_frame) { dpyinfo->x_highlight_frame - = (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame)) - ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame)) - : dpyinfo->x_focus_frame); + = (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) + ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) + : dpyinfo->ns_focus_frame); if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame)) { - fset_focus_frame (dpyinfo->x_focus_frame, Qnil); - dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; + fset_focus_frame (dpyinfo->ns_focus_frame, Qnil); + dpyinfo->x_highlight_frame = dpyinfo->ns_focus_frame; } } else @@ -1529,24 +1564,24 @@ -(void)remove if (old_highlight) { gui_update_cursor (old_highlight, 1); - x_set_frame_alpha (old_highlight); + ns_set_frame_alpha (old_highlight); } if (dpyinfo->x_highlight_frame) { gui_update_cursor (dpyinfo->x_highlight_frame, 1); - x_set_frame_alpha (dpyinfo->x_highlight_frame); + ns_set_frame_alpha (dpyinfo->x_highlight_frame); } } } void -x_make_frame_visible (struct frame *f) +ns_make_frame_visible (struct frame *f) /* -------------------------------------------------------------------------- External: Show the window (X11 semantics) -------------------------------------------------------------------------- */ { - NSTRACE ("x_make_frame_visible"); + NSTRACE ("ns_make_frame_visible"); /* XXX: at some points in past this was not needed, as the only place that called this (frame.c:Fraise_frame ()) also called raise_lower; if this ends up the case again, comment this out again. */ @@ -1585,20 +1620,20 @@ -(void)remove /* If the parent frame moved while the child frame was invisible, the child frame's position won't have been updated. Make sure it's in the right place now. */ - x_set_offset(f, f->left_pos, f->top_pos, 0); + ns_set_offset(f, f->left_pos, f->top_pos, 0); } } } -void -x_make_frame_invisible (struct frame *f) +static void +ns_make_frame_invisible (struct frame *f) /* -------------------------------------------------------------------------- - External: Hide the window (X11 semantics) + Hide the window (X11 semantics) -------------------------------------------------------------------------- */ { NSView *view; - NSTRACE ("x_make_frame_invisible"); + NSTRACE ("ns_make_frame_invisible"); check_window_system (f); view = FRAME_NS_VIEW (f); [[view window] orderOut: NSApp]; @@ -1606,17 +1641,28 @@ -(void)remove SET_FRAME_ICONIFIED (f, 0); } +static void +ns_make_frame_visible_invisible (struct frame *f, bool visible) +/* -------------------------------------------------------------------------- + External (hook) + -------------------------------------------------------------------------- */ +{ + if (visible) + ns_make_frame_visible (f); + else + ns_make_frame_invisible (f); +} void -x_iconify_frame (struct frame *f) +ns_iconify_frame (struct frame *f) /* -------------------------------------------------------------------------- - External: Iconify window + External (hook): Iconify window -------------------------------------------------------------------------- */ { NSView *view; struct ns_display_info *dpyinfo; - NSTRACE ("x_iconify_frame"); + NSTRACE ("ns_iconify_frame"); check_window_system (f); view = FRAME_NS_VIEW (f); dpyinfo = FRAME_DISPLAY_INFO (f); @@ -1644,16 +1690,16 @@ -(void)remove unblock_input(); } -/* Free X resources of frame F. */ +/* Free resources of frame F. */ void -x_free_frame_resources (struct frame *f) +ns_free_frame_resources (struct frame *f) { NSView *view; struct ns_display_info *dpyinfo; Mouse_HLInfo *hlinfo; - NSTRACE ("x_free_frame_resources"); + NSTRACE ("ns_free_frame_resources"); check_window_system (f); view = FRAME_NS_VIEW (f); dpyinfo = FRAME_DISPLAY_INFO (f); @@ -1666,8 +1712,8 @@ -(void)remove free_frame_menubar (f); free_frame_faces (f); - if (f == dpyinfo->x_focus_frame) - dpyinfo->x_focus_frame = 0; + if (f == dpyinfo->ns_focus_frame) + dpyinfo->ns_focus_frame = 0; if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; if (f == hlinfo->mouse_face_mouse_frame) @@ -1684,13 +1730,13 @@ -(void)remove unblock_input (); } -void -x_destroy_window (struct frame *f) +static void +ns_destroy_window (struct frame *f) /* -------------------------------------------------------------------------- External: Delete the window -------------------------------------------------------------------------- */ { - NSTRACE ("x_destroy_window"); + NSTRACE ("ns_destroy_window"); /* If this frame has a parent window, detach it as not doing so can cause a crash in GNUStep. */ @@ -1703,13 +1749,13 @@ -(void)remove } check_window_system (f); - x_free_frame_resources (f); + ns_free_frame_resources (f); ns_window_num--; } void -x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) +ns_set_offset (struct frame *f, int xoff, int yoff, int change_grav) /* -------------------------------------------------------------------------- External: Position the window -------------------------------------------------------------------------- */ @@ -1717,7 +1763,7 @@ -(void)remove NSView *view = FRAME_NS_VIEW (f); NSScreen *screen = [[view window] screen]; - NSTRACE ("x_set_offset"); + NSTRACE ("ns_set_offset"); block_input (); @@ -1774,12 +1820,12 @@ -(void)remove } -void -x_set_window_size (struct frame *f, - bool change_gravity, - int width, - int height, - bool pixelwise) +static void +ns_set_window_size (struct frame *f, + bool change_gravity, + int width, + int height, + bool pixelwise) /* -------------------------------------------------------------------------- Adjust window pixel size based on given character grid size Impl is a bit more complex than other terms, need to do some @@ -1792,7 +1838,7 @@ -(void)remove int pixelwidth, pixelheight; int orig_height = wr.size.height; - NSTRACE ("x_set_window_size"); + NSTRACE ("ns_set_window_size"); if (view == nil) return; @@ -1853,7 +1899,7 @@ breaks live resize (resizing with a mouse), so don't do it if #ifdef NS_IMPL_COCOA void -x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +ns_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) /* -------------------------------------------------------------------------- Set frame F's `undecorated' parameter. If non-nil, F's window-system window is drawn without decorations, title, minimize/maximize boxes @@ -1868,7 +1914,7 @@ breaks live resize (resizing with a mouse), so don't do it if EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); NSWindow *window = [view window]; - NSTRACE ("x_set_undecorated"); + NSTRACE ("ns_set_undecorated"); if (!EQ (new_value, old_value)) { @@ -1903,7 +1949,7 @@ so some key presses (TAB) are swallowed by the system. */ #endif /* NS_IMPL_COCOA */ void -x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +ns_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) /* -------------------------------------------------------------------------- Set frame F's `parent-frame' parameter. If non-nil, make F a child frame of the frame specified by that parameter. Technically, this @@ -1929,7 +1975,7 @@ so some key presses (TAB) are swallowed by the system. */ struct frame *p = NULL; NSWindow *parent, *child; - NSTRACE ("x_set_parent_frame"); + NSTRACE ("ns_set_parent_frame"); if (!NILP (new_value) && (!FRAMEP (new_value) @@ -1977,7 +2023,7 @@ so some key presses (TAB) are swallowed by the system. */ } void -x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +ns_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) /* Set frame F's `no-focus-on-map' parameter which, if non-nil, means * that F's window-system window does not want to receive input focus * when it is mapped. (A frame's window is mapped when the frame is @@ -1986,7 +2032,7 @@ so some key presses (TAB) are swallowed by the system. */ * * Some window managers may not honor this parameter. */ { - NSTRACE ("x_set_no_focus_on_map"); + NSTRACE ("ns_set_no_focus_on_map"); if (!EQ (new_value, old_value)) { @@ -1995,7 +2041,7 @@ so some key presses (TAB) are swallowed by the system. */ } void -x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +ns_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) /* Set frame F's `no-accept-focus' parameter which, if non-nil, hints * that F's window-system window does not want to receive input focus * via mouse clicks or by moving the mouse into it. @@ -2005,14 +2051,14 @@ so some key presses (TAB) are swallowed by the system. */ * * Some window managers may not honor this parameter. */ { - NSTRACE ("x_set_no_accept_focus"); + NSTRACE ("ns_set_no_accept_focus"); if (!EQ (new_value, old_value)) FRAME_NO_ACCEPT_FOCUS (f) = !NILP (new_value); } void -x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +ns_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) /* Set frame F's `z-group' parameter. If `above', F's window-system window is displayed above all windows that do not have the `above' property set. If nil, F's window is shown below all windows that @@ -2025,7 +2071,7 @@ so some key presses (TAB) are swallowed by the system. */ EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); NSWindow *window = [view window]; - NSTRACE ("x_set_z_group"); + NSTRACE ("ns_set_z_group"); if (NILP (new_value)) { @@ -2351,7 +2397,7 @@ so some key presses (TAB) are swallowed by the system. */ } void -ns_query_color(void *col, XColor *color_def, int setPixel) +ns_query_color(void *col, XColor *color_def, bool setPixel) /* -------------------------------------------------------------------------- Get ARGB values out of NSColor col and put them into color_def. If setPixel, set the pixel to a concatenated version. @@ -2371,7 +2417,6 @@ so some key presses (TAB) are swallowed by the system. */ (int)(r*255), (int)(g*255), (int)(b*255)); } - bool ns_defined_color (struct frame *f, const char *name, @@ -2403,8 +2448,8 @@ so some key presses (TAB) are swallowed by the system. */ } -void -x_set_frame_alpha (struct frame *f) +static void +ns_set_frame_alpha (struct frame *f) /* -------------------------------------------------------------------------- change the entire-frame transparency -------------------------------------------------------------------------- */ @@ -2413,7 +2458,7 @@ so some key presses (TAB) are swallowed by the system. */ double alpha = 1.0; double alpha_min = 1.0; - NSTRACE ("x_set_frame_alpha"); + NSTRACE ("ns_set_frame_alpha"); if (dpyinfo->x_highlight_frame == f) alpha = f->alpha[0]; @@ -2541,7 +2586,7 @@ so some key presses (TAB) are swallowed by the system. */ && FRAME_LIVE_P (dpyinfo->last_mouse_frame)) f = dpyinfo->last_mouse_frame; else - f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame : SELECTED_FRAME (); + f = dpyinfo->ns_focus_frame ? dpyinfo->ns_focus_frame : SELECTED_FRAME (); if (f && FRAME_NS_P (f)) { @@ -2639,14 +2684,14 @@ so some key presses (TAB) are swallowed by the system. */ char * -x_get_keysym_name (int keysym) +get_keysym_name (int keysym) /* -------------------------------------------------------------------------- Called by keyboard.c. Not sure if the return val is important, except that it be unique. -------------------------------------------------------------------------- */ { static char value[16]; - NSTRACE ("x_get_keysym_name"); + NSTRACE ("get_keysym_name"); sprintf (value, "%d", keysym); return value; } @@ -4990,7 +5035,7 @@ in certain situations (rapid incoming events). ========================================================================== */ int -x_display_pixel_height (struct ns_display_info *dpyinfo) +ns_display_pixel_height (struct ns_display_info *dpyinfo) { NSArray *screens = [NSScreen screens]; NSEnumerator *enumerator = [screens objectEnumerator]; @@ -5005,7 +5050,7 @@ in certain situations (rapid incoming events). } int -x_display_pixel_width (struct ns_display_info *dpyinfo) +ns_display_pixel_width (struct ns_display_info *dpyinfo) { NSArray *screens = [NSScreen screens]; NSEnumerator *enumerator = [screens objectEnumerator]; @@ -5089,7 +5134,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); dpyinfo->color_table->colors = NULL; dpyinfo->root_window = 42; /* A placeholder. */ - dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; + dpyinfo->x_highlight_frame = dpyinfo->ns_focus_frame = NULL; dpyinfo->n_fonts = 0; dpyinfo->smallest_font_height = 1; dpyinfo->smallest_char_width = 1; @@ -5126,6 +5171,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) ns_draw_glyph_string, ns_define_frame_cursor, ns_clear_frame_area, + 0, /* clear_under_internal_border */ ns_draw_window_cursor, ns_draw_vertical_window_border, ns_draw_window_divider, @@ -5157,11 +5203,13 @@ static Lisp_Object ns_string_to_lispmod (const char *s) block_input (); - x_destroy_all_bitmaps (dpyinfo); + image_destroy_all_bitmaps (dpyinfo); ns_delete_display (dpyinfo); unblock_input (); } +static Lisp_Object ns_new_font (struct frame *f, Lisp_Object font_object, + int fontset); static struct terminal * ns_create_terminal (struct ns_display_info *dpyinfo) @@ -5185,17 +5233,30 @@ static Lisp_Object ns_string_to_lispmod (const char *s) terminal->read_socket_hook = ns_read_socket; terminal->frame_up_to_date_hook = ns_frame_up_to_date; terminal->mouse_position_hook = ns_mouse_position; + terminal->get_focus_frame = ns_get_focus_frame; + terminal->focus_frame_hook = ns_focus_frame; terminal->frame_rehighlight_hook = ns_frame_rehighlight; terminal->frame_raise_lower_hook = ns_frame_raise_lower; + terminal->frame_visible_invisible_hook = ns_make_frame_visible_invisible; terminal->fullscreen_hook = ns_fullscreen_hook; + terminal->iconify_frame_hook = ns_iconify_frame; + terminal->set_window_size_hook = ns_set_window_size; + terminal->set_frame_offset_hook = ns_set_offset; + terminal->set_frame_alpha_hook = ns_set_frame_alpha; + terminal->set_new_font_hook = ns_new_font; + terminal->implicit_set_name_hook = ns_implicitly_set_name; terminal->menu_show_hook = ns_menu_show; + terminal->activate_menubar_hook = ns_activate_menubar; terminal->popup_dialog_hook = ns_popup_dialog; terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar; + terminal->set_scroll_bar_default_width_hook = ns_set_scroll_bar_default_width; + terminal->set_scroll_bar_default_height_hook = ns_set_scroll_bar_default_height; terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; - terminal->delete_frame_hook = x_destroy_window; + terminal->get_string_resource_hook = ns_get_string_resource; + terminal->delete_frame_hook = ns_destroy_window; terminal->delete_terminal_hook = ns_delete_terminal; /* Other hooks are NULL by default. */ @@ -5658,7 +5719,7 @@ - (void)sendEvent: (NSEvent *)theEvent struct ns_display_info *di; BOOL has_focus = NO; for (di = x_display_list; ! has_focus && di; di = di->next) - has_focus = di->x_focus_frame != 0; + has_focus = di->ns_focus_frame != 0; if (! has_focus) return; } @@ -7215,12 +7276,12 @@ - (void)windowDidBecomeKey: (NSNotification *)notification - (void)windowDidBecomeKey /* for direct calls */ { struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); - struct frame *old_focus = dpyinfo->x_focus_frame; + struct frame *old_focus = dpyinfo->ns_focus_frame; NSTRACE ("[EmacsView windowDidBecomeKey]"); if (emacsframe != old_focus) - dpyinfo->x_focus_frame = emacsframe; + dpyinfo->ns_focus_frame = emacsframe; ns_frame_rehighlight (emacsframe); @@ -7236,11 +7297,11 @@ - (void)windowDidResignKey: (NSNotification *)notification /* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */ { struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); - BOOL is_focus_frame = dpyinfo->x_focus_frame == emacsframe; + BOOL is_focus_frame = dpyinfo->ns_focus_frame == emacsframe; NSTRACE ("[EmacsView windowDidResignKey:]"); if (is_focus_frame) - dpyinfo->x_focus_frame = 0; + dpyinfo->ns_focus_frame = 0; emacsframe->mouse_moved = 0; ns_frame_rehighlight (emacsframe); @@ -7250,7 +7311,7 @@ - (void)windowDidResignKey: (NSNotification *)notification if (!windowClosing && [[self window] isVisible] == YES) { gui_update_cursor (emacsframe, 1); - x_set_frame_alpha (emacsframe); + ns_set_frame_alpha (emacsframe); } if (any_help_event_p) @@ -7519,7 +7580,7 @@ - (void)windowDidMove: sender /* Called AFTER method below, but before our windowWillResize call there leads - to windowDidResize -> x_set_window_size. Update emacs' notion of frame + to windowDidResize -> ns_set_window_size. Update emacs' notion of frame location so set_window_size moves the frame. */ - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame { @@ -9222,9 +9283,12 @@ @implementation EmacsDocument ========================================================================== */ -Lisp_Object -x_new_font (struct frame *f, Lisp_Object font_object, int fontset) +static Lisp_Object +ns_new_font (struct frame *f, Lisp_Object font_object, int fontset) { + /* -------------------------------------------------------------------------- + External (hook) + -------------------------------------------------------------------------- */ struct font *font = XFONT_OBJECT (font_object); EmacsView *view = FRAME_NS_VIEW (f); int font_ascent, font_descent; diff --git a/src/termhooks.h b/src/termhooks.h index a92b981110..b66233cf1c 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -490,6 +490,23 @@ struct terminal /* Multi-frame and mouse support hooks. */ + /* Graphical window systems are expected to define all of the + following hooks with the possible exception of: + + * query_colors + * activate_menubar_hook + * change_tool_bar_height_hook + * set_bitmap_icon_hook + * buffer_flipping_unblocked_hook + + */ + +#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) + /* On frame F, translate pixel colors to RGB values for the NCOLORS + colors in COLORS. Use cached information, if available. */ + + void (*query_colors) (struct frame *f, XColor *colors, int ncolors); +#endif /* Return the current position of the mouse. Set *f to the frame the mouse is in, or zero if the mouse is in no @@ -512,6 +529,12 @@ struct terminal Lisp_Object *y, Time *); + /* This hook is called to get the focus frame. */ + Lisp_Object (*get_focus_frame) (struct frame *f); + + /* This hook is called to shift frame focus. */ + void (*focus_frame_hook) (struct frame *f, bool noactivate); + /* When a frame's focus redirection is changed, this hook tells the window system code to re-decide where to put the highlight. Under X, this means that Emacs lies about where the focus is. */ @@ -529,19 +552,65 @@ struct terminal windows. */ void (*frame_raise_lower_hook) (struct frame *f, bool raise_flag); + /* This hook is called to make the frame F visible if VISIBLE is + true, or invisible otherwise. */ + void (*frame_visible_invisible_hook) (struct frame *f, bool visible); + /* If the value of the frame parameter changed, this hook is called. For example, if going from fullscreen to not fullscreen this hook may do something OS dependent, like extended window manager hints on X11. */ void (*fullscreen_hook) (struct frame *f); + /* This hook is called to iconify the frame. */ + void (*iconify_frame_hook) (struct frame *f); + + /* This hook is called to change the size of frame F's native + (underlying) window. If CHANGE_GRAVITY, change to top-left-corner + window gravity for this size change and subsequent size changes. + Otherwise we leave the window gravity unchanged. */ + void (*set_window_size_hook) (struct frame *f, bool change_gravity, + int width, int height, bool pixelwise); + + /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, + to really change the position, and 0 when calling from + *_make_frame_visible (in that case, XOFF and YOFF are the current + position values). It is -1 when calling from gui_set_frame_parameters, + which means, do adjust for borders but don't change the gravity. */ + + void (*set_frame_offset_hook) (struct frame *f, register int xoff, + register int yoff, int change_gravity); + + /* This hook is called to set the frame's transparency. */ + void (*set_frame_alpha_hook) (struct frame *f); + + /* This hook is called to set a new font for the frame. */ + Lisp_Object (*set_new_font_hook) (struct frame *f, Lisp_Object font_object, + int fontset); + + /* This hook is called to set the GUI window icon of F using FILE. */ + bool (*set_bitmap_icon_hook) (struct frame *f, Lisp_Object file); + + /* This hook is called to set the name of the GUI window of F by + redisplay unless another name was explicitly requested. */ + void (*implicit_set_name_hook) (struct frame *f, Lisp_Object arg, + Lisp_Object oldval); + /* This hook is called to display menus. */ Lisp_Object (*menu_show_hook) (struct frame *f, int x, int y, int menuflags, Lisp_Object title, const char **error_name); +#ifdef HAVE_EXT_MENU_BAR + /* This hook is called to activate the menu bar. */ + void (*activate_menubar_hook) (struct frame *f); +#endif + /* This hook is called to display popup dialog. */ Lisp_Object (*popup_dialog_hook) (struct frame *f, Lisp_Object header, Lisp_Object contents); + /* This hook is called to change the frame's (internal) tool-bar. */ + void (*change_tool_bar_height_hook) (struct frame *f, int height); + /* Scroll bar hooks. */ /* The representation of scroll bars is determined by the code which @@ -583,6 +652,11 @@ struct terminal int portion, int whole, int position); + /* Set the default scroll bar width on FRAME. */ + void (*set_scroll_bar_default_width_hook) (struct frame *frame); + + /* Set the default scroll bar height on FRAME. */ + void (*set_scroll_bar_default_height_hook) (struct frame *frame); /* The following three hooks are used when we're doing a thorough redisplay of the frame. We don't explicitly know which scroll bars @@ -645,6 +719,11 @@ struct terminal while it runs. */ void (*buffer_flipping_unblocked_hook) (struct frame *); + /* Retrieve the string resource specified by NAME with CLASS from + database RDB. */ + const char * (*get_string_resource_hook) (void *rdb, + const char *name, + const char *class); /* Called to delete the device-specific portions of a frame that is on this terminal device. */ diff --git a/src/w32fns.c b/src/w32fns.c index e6cb1ee311..30e5479cdc 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -288,6 +288,8 @@ typedef BOOL (WINAPI *IsDebuggerPresent_Proc) (void); /* stdin, from w32console.c */ extern HANDLE keyboard_handle; +static struct w32_display_info *w32_display_info_for_name (Lisp_Object); + /* Let the user specify a display with a frame. nil stands for the selected frame--or, if that is not a w32 frame, the first display on the list. */ @@ -314,7 +316,7 @@ check_x_display_info (Lisp_Object object) return t->display_info.w32; } else if (STRINGP (object)) - return x_display_info_for_name (object); + return w32_display_info_for_name (object); else { struct frame *f; @@ -331,7 +333,7 @@ check_x_display_info (Lisp_Object object) It could be the frame's main window or an icon window. */ struct frame * -x_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc) +w32_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc) { Lisp_Object tail, frame; struct frame *f; @@ -355,16 +357,16 @@ static void my_create_window (struct frame *); static void my_create_tip_window (struct frame *); /* TODO: Native Input Method support; see x_create_im. */ -void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object); -void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object); -void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object); -void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object); -void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object); -void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); -void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object); -void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object); -void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); -void x_set_title (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_background_color (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_border_color (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_icon_type (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_icon_name (struct frame *, Lisp_Object, Lisp_Object); +static void w32_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +static void w32_set_title (struct frame *, Lisp_Object, Lisp_Object); /* Store the screen positions of frame F into XPTR and YPTR. @@ -372,7 +374,7 @@ void x_set_title (struct frame *, Lisp_Object, Lisp_Object); not Emacs's own window. */ void -x_real_positions (struct frame *f, int *xptr, int *yptr) +w32_real_positions (struct frame *f, int *xptr, int *yptr) { RECT rect; @@ -1244,7 +1246,7 @@ w32_defined_color (struct frame *f, const char *color, XColor *color_def, ARG says. */ static int -x_decode_color (struct frame *f, Lisp_Object arg, int def) +w32_decode_color (struct frame *f, Lisp_Object arg, int def) { XColor cdef; @@ -1269,7 +1271,7 @@ x_decode_color (struct frame *f, Lisp_Object arg, int def) -/* Functions called only from `x_set_frame_param' +/* Functions called only from `gui_set_frame_parameters' to set individual parameters. If FRAME_W32_WINDOW (f) is 0, @@ -1277,13 +1279,13 @@ x_decode_color (struct frame *f, Lisp_Object arg, int def) In that case, just record the parameter's new value in the standard place; do not attempt to change the window. */ -void -x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { struct w32_output *x = f->output_data.w32; PIX_TYPE fg, old_fg; - fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); + fg = w32_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); old_fg = FRAME_FOREGROUND_PIXEL (f); FRAME_FOREGROUND_PIXEL (f) = fg; @@ -1301,11 +1303,11 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } } -void -x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { FRAME_BACKGROUND_PIXEL (f) - = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); + = w32_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); if (FRAME_W32_WINDOW (f) != 0) { @@ -1319,8 +1321,8 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } } -void -x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { #if 0 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; @@ -1330,7 +1332,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (!EQ (Qnil, arg)) f->output_data.w32->mouse_pixel - = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); + = w32_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); mask_color = FRAME_BACKGROUND_PIXEL (f); /* Don't let pointers be invisible. */ @@ -1479,18 +1481,18 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) #endif /* TODO */ } -void -x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { unsigned long fore_pixel, pixel; if (!NILP (Vx_cursor_fore_pixel)) - fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, + fore_pixel = w32_decode_color (f, Vx_cursor_fore_pixel, WHITE_PIX_DEFAULT (f)); else fore_pixel = FRAME_BACKGROUND_PIXEL (f); - pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); + pixel = w32_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); /* Make sure that the cursor color differs from the background color. */ if (pixel == FRAME_BACKGROUND_PIXEL (f)) @@ -1527,7 +1529,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) F has a window. */ static void -x_set_border_pixel (struct frame *f, int pix) +w32_set_border_pixel (struct frame *f, int pix) { f->output_data.w32->border_pixel = pix; @@ -1545,26 +1547,26 @@ x_set_border_pixel (struct frame *f, int pix) Note that this does not fully take effect if done before F has a window; it must be redone when the window is created. */ -void -x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int pix; CHECK_STRING (arg); - pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); - x_set_border_pixel (f, pix); + pix = w32_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); + w32_set_border_pixel (f, pix); update_face_from_frame_parameter (f, Qborder_color, arg); } -void -x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { set_frame_cursor_types (f, arg); } -void -x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { bool result; @@ -1580,7 +1582,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) block_input (); - result = x_bitmap_icon (f, arg); + result = FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, arg); if (result) { unblock_input (); @@ -1590,8 +1592,8 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) unblock_input (); } -void -x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { if (STRINGP (arg)) { @@ -1638,13 +1640,13 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } /** - * x_clear_under_internal_border: + * w32_clear_under_internal_border: * * Clear area of frame F's internal border. If the internal border face * of F has been specified (is not null), fill the area with that face. */ void -x_clear_under_internal_border (struct frame *f) +w32_clear_under_internal_border (struct frame *f) { int border = FRAME_INTERNAL_BORDER_WIDTH (f); @@ -1685,13 +1687,13 @@ x_clear_under_internal_border (struct frame *f) /** - * x_set_internal_border_width: + * w32_set_internal_border_width: * * Set width of frame F's internal border to ARG pixels. ARG < 0 is * treated like ARG = 0. */ -void -x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int border; @@ -1702,27 +1704,27 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva { f->internal_border_width = border; - if (FRAME_X_WINDOW (f) != 0) + if (FRAME_NATIVE_WINDOW (f) != 0) { adjust_frame_size (f, -1, -1, 3, false, Qinternal_border_width); if (FRAME_VISIBLE_P (f)) - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); } } } /** - * x_set_menu_bar_lines: + * w32_set_menu_bar_lines: * * Set number of lines of frame F's menu bar to VALUE. An integer * greater zero specifies 1 line and turns the menu bar on if it was off * before. Any other value specifies 0 lines and turns the menu bar off * if it was on before. */ -void -x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) +static void +w32_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { /* Right now, menu bars don't work properly in minibuf-only frames; most of the commands try to apply themselves to the minibuffer @@ -1761,7 +1763,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) } if (FRAME_W32_WINDOW (f)) - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); /* Don't store anything but 1 or 0 in the parameter. */ store_frame_param (f, Qmenu_bar_lines, make_fixnum (new ? 1 : 0)); @@ -1777,8 +1779,8 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) height. By design, the frame's height doesn't change (but maybe it should if we don't get enough space otherwise). */ -void -x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) +static void +w32_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; @@ -1792,13 +1794,13 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) else nlines = 0; - x_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); + w32_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); } /* Set the pixel height of the tool bar of frame F to HEIGHT. */ void -x_change_tool_bar_height (struct frame *f, int height) +w32_change_tool_bar_height (struct frame *f, int height) { int unit = FRAME_LINE_HEIGHT (f); int old_height = FRAME_TOOL_BAR_HEIGHT (f); @@ -1849,7 +1851,7 @@ x_change_tool_bar_height (struct frame *f, int height) adjust_frame_glyphs (f); SET_FRAME_GARBAGED (f); if (FRAME_W32_WINDOW (f)) - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); } static void @@ -1909,7 +1911,7 @@ w32_set_title_bar_text (struct frame *f, Lisp_Object name) F->explicit_name is set, ignore the new name; otherwise, set it. */ static void -x_set_name (struct frame *f, Lisp_Object name, bool explicit) +w32_set_name (struct frame *f, Lisp_Object name, bool explicit) { /* Make sure that requests from lisp code override requests from Emacs redisplay code. */ @@ -1955,26 +1957,26 @@ x_set_name (struct frame *f, Lisp_Object name, bool explicit) /* This function should be called when the user's lisp code has specified a name for the frame; the name will override any set by the redisplay code. */ -void -x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +static void +w32_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - x_set_name (f, arg, true); + w32_set_name (f, arg, true); } /* This function should be called by Emacs redisplay code to set the 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) +w32_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - x_set_name (f, arg, false); + w32_set_name (f, arg, false); } /* Change the title of frame F to NAME. If NAME is nil, use the frame name as the title. */ -void -x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) +static void +w32_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { /* Don't change the title if it's already NAME. */ if (EQ (name, f->title)) @@ -1991,7 +1993,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) } void -x_set_scroll_bar_default_width (struct frame *f) +w32_set_scroll_bar_default_width (struct frame *f) { int unit = FRAME_COLUMN_WIDTH (f); @@ -2002,7 +2004,7 @@ x_set_scroll_bar_default_width (struct frame *f) void -x_set_scroll_bar_default_height (struct frame *f) +w32_set_scroll_bar_default_height (struct frame *f) { int unit = FRAME_LINE_HEIGHT (f); @@ -2012,7 +2014,7 @@ x_set_scroll_bar_default_height (struct frame *f) } /** - * x_set_undecorated: + * w32_set_undecorated: * * Set frame F's `undecorated' parameter. If non-nil, F's window-system * window is drawn without decorations, title, minimize/maximize boxes @@ -2024,7 +2026,7 @@ x_set_scroll_bar_default_height (struct frame *f) * Some window managers may not honor this parameter. */ static void -x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +w32_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { HWND hwnd = FRAME_W32_WINDOW (f); DWORD dwStyle = GetWindowLong (hwnd, GWL_STYLE); @@ -2055,7 +2057,7 @@ x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value } /** - * x_set_parent_frame: + * w32_set_parent_frame: * * Set frame F's `parent-frame' parameter. If non-nil, make F a child * frame of the frame specified by that parameter. Technically, this @@ -2083,7 +2085,7 @@ x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value * Some window managers may not honor this parameter. */ static void -x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +w32_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { struct frame *p = NULL; @@ -2117,7 +2119,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu } /** - * x_set_skip_taskbar: + * w32_set_skip_taskbar: * * Set frame F's `skip-taskbar' parameter. If non-nil, this should * remove F's icon from the taskbar associated with the display of F's @@ -2128,7 +2130,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu * Some window managers may not honor this parameter. */ static void -x_set_skip_taskbar (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +w32_set_skip_taskbar (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (!EQ (new_value, old_value)) { @@ -2151,7 +2153,7 @@ x_set_skip_taskbar (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu } /** - * x_set_no_focus_on_map: + * w32_set_no_focus_on_map: * * Set frame F's `no-focus-on-map' parameter which, if non-nil, means * that F's window-system window does not want to receive input focus @@ -2162,14 +2164,14 @@ x_set_skip_taskbar (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu * Some window managers may not honor this parameter. */ static void -x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +w32_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (!EQ (new_value, old_value)) FRAME_NO_FOCUS_ON_MAP (f) = !NILP (new_value); } /** - * x_set_no_accept_focus: + * w32_set_no_accept_focus: * * Set frame F's `no-accept-focus' parameter which, if non-nil, hints * that F's window-system window does not want to receive input focus @@ -2181,14 +2183,14 @@ x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_v * Some window managers may not honor this parameter. */ static void -x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +w32_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (!EQ (new_value, old_value)) FRAME_NO_ACCEPT_FOCUS (f) = !NILP (new_value); } /** - * x_set_z_group: + * w32_set_z_group: * * Set frame F's `z-group' parameter. If `above', F's window-system * window is displayed above all windows that do not have the `above' @@ -2206,7 +2208,7 @@ x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_v * progress. */ static void -x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) +w32_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { HWND hwnd = FRAME_W32_WINDOW (f); @@ -4018,7 +4020,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int windows_translate; int key; - /* Note that it is okay to call x_window_to_frame, even though we are + /* Note that it is okay to call w32_window_to_frame, even though we are not running in the main lisp thread, because frame deletion requires the lisp thread to synchronize with this thread. Thus, if a frame struct is returned, it can be used without concern that the @@ -4037,7 +4039,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_ERASEBKGND: - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) { HDC hdc = get_frame_dc (f); @@ -4057,7 +4059,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* ignore our own changes */ if ((HWND)wParam != hwnd) { - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) /* get_frame_dc will realize our palette and force all frames to be redrawn if needed. */ @@ -4070,7 +4072,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT update_rect; memset (&update_rect, 0, sizeof (update_rect)); - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f == 0) { DebPrint (("WM_PAINT received for unknown window %p\n", hwnd)); @@ -4522,7 +4524,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) careful not to move the IME window if the window described by W was deleted, as indicated by its buffer field being reset to nil. */ - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (!(f && FRAME_LIVE_P (f))) goto dflt; w = XWINDOW (FRAME_SELECTED_WINDOW (f)); @@ -4698,7 +4700,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int button; /* Ignore middle and extra buttons as long as the menu is active. */ - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f && f->output_data.w32->menubar_active) return 0; @@ -4740,7 +4742,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP); case WM_MOUSEMOVE: - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) { /* Ignore mouse movements as long as the menu is active. @@ -4878,7 +4880,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { KillTimer (hwnd, menu_free_timer); menu_free_timer = 0; - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); /* If a popup menu is active, don't wipe its strings. */ if (menubar_in_use && current_popup_menu == NULL) @@ -4920,7 +4922,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) this (there is no possibility of confusion with real menubar being active). */ - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f && (f->output_data.w32->menubar_active /* We can receive this message even in the absence of a @@ -4945,7 +4947,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } case WM_EXITMENULOOP: - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); /* If a menu is still active, check again after a short delay, since Windows often (always?) sends the WM_EXITMENULOOP @@ -4976,7 +4978,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 0; case WM_MEASUREITEM: - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) { MEASUREITEMSTRUCT * pMis = (MEASUREITEMSTRUCT *) lParam; @@ -5022,7 +5024,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 0; case WM_DRAWITEM: - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) { DRAWITEMSTRUCT * pDis = (DRAWITEMSTRUCT *) lParam; @@ -5083,7 +5085,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) user to click anywhere without changing point (or worse!). Don't eat mouse clicks on scrollbars though!! */ - if ((f = x_window_to_frame (dpyinfo, hwnd)) + if ((f = w32_window_to_frame (dpyinfo, hwnd)) && FRAME_NO_ACCEPT_FOCUS (f) /* Ignore child frames, they don't accept focus anyway. */ && !FRAME_PARENT_FRAME (f)) @@ -5132,7 +5134,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) goto command; case WM_COMMAND: menubar_in_use = 0; - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f && HIWORD (wParam) == 0) { if (menu_free_timer) @@ -5197,7 +5199,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SETCURSOR: if (LOWORD (lParam) == HTCLIENT) { - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) { if (f->output_data.w32->hourglass_p @@ -5216,7 +5218,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_EMACS_SETCURSOR: { Cursor cursor = (Cursor) wParam; - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f && cursor) { f->output_data.w32->current_cursor = cursor; @@ -5355,7 +5357,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Use menubar_active to indicate that WM_INITMENU is from TrackPopupMenu below, and should be ignored. */ - f = x_window_to_frame (dpyinfo, hwnd); + f = w32_window_to_frame (dpyinfo, hwnd); if (f) f->output_data.w32->menubar_active = 1; @@ -5413,10 +5415,12 @@ my_create_window (struct frame * f) Lisp_Object left, top; struct w32_display_info *dpyinfo = &one_w32_display_info; - /* When called with RES_TYPE_NUMBER, x_get_arg will return zero for - anything that is not a number and is not Qunbound. */ - left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER); - top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER); + /* When called with RES_TYPE_NUMBER, gui_display_get_arg will return + zero for anything that is not a number and is not Qunbound. */ + left = gui_display_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", + RES_TYPE_NUMBER); + top = gui_display_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", + RES_TYPE_NUMBER); if (EQ (left, Qunbound)) coords[0] = CW_USEDEFAULT; else @@ -5496,7 +5500,7 @@ w32_window (struct frame *f, long window_prompting, bool minibuffer_only) validate_x_resource_name (); - /* x_set_name normally ignores requests to set the name if the + /* w32_set_name normally ignores requests to set the name if the requested name is the same as the current name. This is the one place where that assumption isn't correct; f->name is set, but the server hasn't been told. */ @@ -5507,7 +5511,7 @@ w32_window (struct frame *f, long window_prompting, bool minibuffer_only) f->explicit_name = 0; name = f->name; fset_name (f, Qnil); - x_set_name (f, name, explicit); + w32_set_name (f, name, explicit); } unblock_input (); @@ -5525,15 +5529,17 @@ w32_window (struct frame *f, long window_prompting, bool minibuffer_only) well. */ static void -x_icon (struct frame *f, Lisp_Object parms) +w32_icon (struct frame *f, Lisp_Object parms) { Lisp_Object icon_x, icon_y; struct w32_display_info *dpyinfo = &one_w32_display_info; /* Set the position of the icon. Note that Windows 95 groups all icons in the tray. */ - 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); @@ -5544,24 +5550,14 @@ x_icon (struct frame *f, Lisp_Object parms) block_input (); -#if 0 /* TODO */ - /* Start up iconic or window? */ - x_wm_set_window_state - (f, (EQ (x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL), Qicon) - ? IconicState - : NormalState)); - - x_text_icon (f, SSDATA ((!NILP (f->icon_name) - ? f->icon_name - : f->name))); -#endif + /* TODO: Start up iconic or window? */ unblock_input (); } static void -x_make_gc (struct frame *f) +w32_make_gc (struct frame *f) { XGCValues gc_values; @@ -5589,8 +5585,8 @@ x_make_gc (struct frame *f) } -/* Handler for signals raised during x_create_frame and - x_create_tip_frame. FRAME is the frame which is partially +/* Handler for signals raised during Fx_create_frame and + w32_create_tip_frame. FRAME is the frame which is partially constructed. */ static Lisp_Object @@ -5608,7 +5604,7 @@ 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 w32_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 @@ -5616,7 +5612,7 @@ unwind_create_frame (Lisp_Object frame) FRAME_IMAGE_CACHE (f)->refcount++; #endif - x_free_frame_resources (f); + w32_free_frame_resources (f); free_glyphs (f); #ifdef GLYPH_DEBUG @@ -5640,16 +5636,18 @@ do_unwind_create_frame (Lisp_Object frame) } static void -x_default_font_parameter (struct frame *f, Lisp_Object parms) +w32_default_font_parameter (struct frame *f, Lisp_Object parms) { struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL, - RES_TYPE_STRING); + Lisp_Object font_param = gui_display_get_arg (dpyinfo, + parms, Qfont, NULL, NULL, + RES_TYPE_STRING); Lisp_Object font; if (EQ (font_param, Qunbound)) font_param = Qnil; font = !NILP (font_param) ? font_param - : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); + : gui_display_get_arg (dpyinfo, parms, Qfont, "font", "Font", + RES_TYPE_STRING); if (!STRINGP (font)) { @@ -5674,10 +5672,10 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) { /* Remember the explicit font parameter, so we can re-apply it after we've applied the `default' face settings. */ - x_set_frame_parameters (f, Fcons (Fcons (Qfont_parameter, font_param), - Qnil)); + gui_set_frame_parameters (f, Fcons (Fcons (Qfont_parameter, font_param), + Qnil)); } - x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); } DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, @@ -5709,9 +5707,11 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, until we know if this frame has a specified name. */ Vx_resource_name = Vinvocation_name; - display = x_get_arg (dpyinfo, parameters, Qterminal, 0, 0, RES_TYPE_NUMBER); + display = gui_display_get_arg (dpyinfo, parameters, Qterminal, 0, 0, + RES_TYPE_NUMBER); if (EQ (display, Qunbound)) - display = x_get_arg (dpyinfo, parameters, Qdisplay, 0, 0, RES_TYPE_STRING); + display = gui_display_get_arg (dpyinfo, parameters, Qdisplay, 0, 0, + RES_TYPE_STRING); if (EQ (display, Qunbound)) display = Qnil; dpyinfo = check_x_display_info (display); @@ -5720,7 +5720,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, parameters, Qname, "name", "Name", RES_TYPE_STRING); + name = gui_display_get_arg (dpyinfo, parameters, Qname, "name", "Name", + RES_TYPE_STRING); if (!STRINGP (name) && ! EQ (name, Qunbound) && ! NILP (name)) @@ -5730,8 +5731,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, Vx_resource_name = name; /* See if parent window is specified. */ - parent = x_get_arg (dpyinfo, parameters, Qparent_id, NULL, NULL, - RES_TYPE_NUMBER); + parent = gui_display_get_arg (dpyinfo, parameters, Qparent_id, NULL, NULL, + RES_TYPE_NUMBER); if (EQ (parent, Qunbound)) parent = Qnil; else if (!NILP (parent)) @@ -5741,8 +5742,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, parameters, Qminibuffer, "minibuffer", "Minibuffer", - RES_TYPE_SYMBOL); + tem = gui_display_get_arg (dpyinfo, parameters, 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)) @@ -5757,8 +5759,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, XSETFRAME (frame, f); - parent_frame = x_get_arg (dpyinfo, parameters, Qparent_frame, NULL, NULL, - RES_TYPE_SYMBOL); + parent_frame = gui_display_get_arg (dpyinfo, parameters, Qparent_frame, + NULL, NULL, + RES_TYPE_SYMBOL); /* Apply `parent-frame' parameter only when no `parent-id' was specified. */ if (!NILP (parent_frame) @@ -5771,13 +5774,13 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, fset_parent_frame (f, parent_frame); store_frame_param (f, Qparent_frame, parent_frame); - tem = x_get_arg (dpyinfo, parameters, Qundecorated, NULL, NULL, - RES_TYPE_BOOLEAN); + tem = gui_display_get_arg (dpyinfo, parameters, Qundecorated, NULL, NULL, + RES_TYPE_BOOLEAN); FRAME_UNDECORATED (f) = !NILP (tem) && !EQ (tem, Qunbound); store_frame_param (f, Qundecorated, FRAME_UNDECORATED (f) ? Qt : Qnil); - tem = x_get_arg (dpyinfo, parameters, Qskip_taskbar, NULL, NULL, - RES_TYPE_BOOLEAN); + tem = gui_display_get_arg (dpyinfo, parameters, Qskip_taskbar, NULL, NULL, + RES_TYPE_BOOLEAN); FRAME_SKIP_TASKBAR (f) = !NILP (tem) && !EQ (tem, Qunbound); store_frame_param (f, Qskip_taskbar, (NILP (tem) || EQ (tem, Qunbound)) ? Qnil : Qt); @@ -5792,9 +5795,12 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; - fset_icon_name - (f, x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", - RES_TYPE_STRING)); + fset_icon_name (f, gui_display_get_arg (dpyinfo, + parameters, + Qicon_name, + "iconName", + "Title", + RES_TYPE_STRING)); if (! STRINGP (f->icon_name)) fset_icon_name (f, Qnil); @@ -5844,16 +5850,16 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, register_font_driver (&uniscribe_font_driver, f); register_font_driver (&w32font_driver, f); - x_default_parameter (f, parameters, Qfont_backend, Qnil, - "fontBackend", "FontBackend", RES_TYPE_STRING); + gui_default_parameter (f, parameters, Qfont_backend, Qnil, + "fontBackend", "FontBackend", RES_TYPE_STRING); /* Extract the window parameters from the supplied values that are needed to determine window geometry. */ - x_default_font_parameter (f, parameters); + w32_default_font_parameter (f, parameters); /* Default BorderWidth to 0 to match other platforms. */ - x_default_parameter (f, parameters, Qborder_width, make_fixnum (0), - "borderWidth", "BorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qborder_width, make_fixnum (0), + "borderWidth", "BorderWidth", RES_TYPE_NUMBER); /* We recognize either internalBorderWidth or internalBorder (which is what xterm calls it). */ @@ -5861,53 +5867,54 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, { Lisp_Object value; - value = x_get_arg (dpyinfo, parameters, Qinternal_border_width, - "internalBorder", "InternalBorder", RES_TYPE_NUMBER); + value = gui_display_get_arg (dpyinfo, parameters, Qinternal_border_width, + "internalBorder", "InternalBorder", + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parameters = Fcons (Fcons (Qinternal_border_width, value), parameters); } - x_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0), - "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0), - NULL, NULL, RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0), - NULL, NULL, RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qvertical_scroll_bars, Qright, - "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); - x_default_parameter (f, parameters, Qhorizontal_scroll_bars, Qnil, - "horizontalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); + gui_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0), + "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0), + NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0), + NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qvertical_scroll_bars, Qright, + "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); + gui_default_parameter (f, parameters, Qhorizontal_scroll_bars, Qnil, + "horizontalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); /* Also do the stuff which must be set before the window exists. */ - x_default_parameter (f, parameters, Qforeground_color, build_string ("black"), - "foreground", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parameters, Qbackground_color, build_string ("white"), - "background", "Background", RES_TYPE_STRING); - x_default_parameter (f, parameters, Qmouse_color, build_string ("black"), - "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parameters, Qborder_color, build_string ("black"), - "borderColor", "BorderColor", RES_TYPE_STRING); - x_default_parameter (f, parameters, Qscreen_gamma, Qnil, - "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); - x_default_parameter (f, parameters, Qline_spacing, Qnil, - "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qleft_fringe, Qnil, - "leftFringe", "LeftFringe", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qright_fringe, Qnil, - "rightFringe", "RightFringe", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qno_focus_on_map, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); - x_default_parameter (f, parameters, Qno_accept_focus, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); - x_default_parameter (f, parameters, Qno_special_glyphs, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parameters, Qforeground_color, build_string ("black"), + "foreground", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parameters, Qbackground_color, build_string ("white"), + "background", "Background", RES_TYPE_STRING); + gui_default_parameter (f, parameters, Qmouse_color, build_string ("black"), + "pointerColor", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parameters, Qborder_color, build_string ("black"), + "borderColor", "BorderColor", RES_TYPE_STRING); + gui_default_parameter (f, parameters, Qscreen_gamma, Qnil, + "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); + gui_default_parameter (f, parameters, Qline_spacing, Qnil, + "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qleft_fringe, Qnil, + "leftFringe", "LeftFringe", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qright_fringe, Qnil, + "rightFringe", "RightFringe", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qno_focus_on_map, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parameters, Qno_accept_focus, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parameters, Qno_special_glyphs, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); /* Process alpha here (Bug#16619). On XP this fails with child frames. For `no-focus-on-map' frames delay processing of alpha until the frame becomes visible. */ if (!FRAME_NO_FOCUS_ON_MAP (f)) - x_default_parameter (f, parameters, Qalpha, Qnil, + gui_default_parameter (f, parameters, Qalpha, Qnil, "alpha", "Alpha", RES_TYPE_NUMBER); /* Init faces first since we need the frame's column width/line @@ -5915,7 +5922,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, init_frame_faces (f); /* We have to call adjust_frame_size here since otherwise - x_set_tool_bar_lines will already work with the character sizes + w32_set_tool_bar_lines will already work with the character sizes installed by init_frame_faces while the frame's pixel size is still calculated from a character size of 1 and we subsequently hit the (height >= 0) assertion in window_box_height. @@ -5926,12 +5933,12 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, Also process `min-width' and `min-height' parameters right here because `frame-windows-min-size' needs them. */ - tem = x_get_arg (dpyinfo, parameters, Qmin_width, NULL, NULL, - RES_TYPE_NUMBER); + tem = gui_display_get_arg (dpyinfo, parameters, Qmin_width, NULL, NULL, + RES_TYPE_NUMBER); if (FIXNUMP (tem)) store_frame_param (f, Qmin_width, tem); - tem = x_get_arg (dpyinfo, parameters, Qmin_height, NULL, NULL, - RES_TYPE_NUMBER); + tem = gui_display_get_arg (dpyinfo, parameters, 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), @@ -5943,24 +5950,24 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, variables; ignore them here. */ if (NILP (parent_frame)) { - x_default_parameter (f, parameters, Qmenu_bar_lines, - NILP (Vmenu_bar_mode) - ? make_fixnum (0) : make_fixnum (1), - NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_fixnum (0) : make_fixnum (1), + NULL, NULL, RES_TYPE_NUMBER); } else /* No menu bar for child frames. */ store_frame_param (f, Qmenu_bar_lines, make_fixnum (0)); - x_default_parameter (f, parameters, Qtool_bar_lines, - NILP (Vtool_bar_mode) - ? make_fixnum (0) : make_fixnum (1), - NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_fixnum (0) : make_fixnum (1), + NULL, NULL, RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qbuffer_predicate, Qnil, - "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); - x_default_parameter (f, parameters, Qtitle, Qnil, - "title", "Title", RES_TYPE_STRING); + gui_default_parameter (f, parameters, Qbuffer_predicate, Qnil, + "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); + gui_default_parameter (f, parameters, Qtitle, Qnil, + "title", "Title", RES_TYPE_STRING); f->output_data.w32->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; f->output_data.w32->text_cursor = w32_load_cursor (IDC_IBEAM); @@ -5981,15 +5988,17 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, f->output_data.w32->current_cursor = f->output_data.w32->nontext_cursor; - window_prompting = x_figure_window_size (f, parameters, true, &x_width, &x_height); + window_prompting = gui_figure_window_size (f, parameters, true, + &x_width, &x_height); - tem = x_get_arg (dpyinfo, parameters, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); + tem = gui_display_get_arg (dpyinfo, parameters, Qunsplittable, 0, 0, + RES_TYPE_BOOLEAN); f->no_split = minibuffer_only || EQ (tem, Qt); w32_window (f, window_prompting, minibuffer_only); - x_icon (f, parameters); + w32_icon (f, parameters); - x_make_gc (f); + w32_make_gc (f); /* Now consider the frame official. */ f->terminal->reference_count++; @@ -5998,22 +6007,22 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, /* We need to do this after creating the window, so that the icon-creation functions can say whose icon they're describing. */ - x_default_parameter (f, parameters, Qicon_type, Qnil, - "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); - - x_default_parameter (f, parameters, Qauto_raise, Qnil, - "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parameters, Qauto_lower, Qnil, - "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parameters, Qcursor_type, Qbox, - "cursorType", "CursorType", RES_TYPE_SYMBOL); - x_default_parameter (f, parameters, Qscroll_bar_width, Qnil, - "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qscroll_bar_height, Qnil, - "scrollBarHeight", "ScrollBarHeight", RES_TYPE_NUMBER); - - /* Allow x_set_window_size, now. */ - f->can_x_set_window_size = true; + gui_default_parameter (f, parameters, Qicon_type, Qnil, + "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); + + gui_default_parameter (f, parameters, Qauto_raise, Qnil, + "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parameters, Qauto_lower, Qnil, + "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parameters, Qcursor_type, Qbox, + "cursorType", "CursorType", RES_TYPE_SYMBOL); + gui_default_parameter (f, parameters, Qscroll_bar_width, Qnil, + "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qscroll_bar_height, Qnil, + "scrollBarHeight", "ScrollBarHeight", RES_TYPE_NUMBER); + + /* Allow set_window_size_hook, now. */ + f->can_set_window_size = true; if (x_width > 0) SET_FRAME_WIDTH (f, x_width); @@ -6024,7 +6033,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, badly we want them. This should be done after we have the menu bar so that its size can be taken into account. */ block_input (); - x_wm_set_size_hint (f, window_prompting, false); + w32_wm_set_size_hint (f, window_prompting, false); unblock_input (); adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, true, @@ -6033,10 +6042,10 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, /* Process fullscreen parameter here in the hope that normalizing a fullheight/fullwidth frame will produce the size set by the last adjust_frame_size call. */ - x_default_parameter (f, parameters, Qfullscreen, Qnil, - "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); - x_default_parameter (f, parameters, Qz_group, Qnil, - NULL, NULL, RES_TYPE_SYMBOL); + gui_default_parameter (f, parameters, Qfullscreen, Qnil, + "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); + gui_default_parameter (f, parameters, Qz_group, Qnil, + NULL, NULL, RES_TYPE_SYMBOL); /* Make the window appear on the frame and enable display, unless the caller says not to. However, with explicit parent, Emacs @@ -6044,17 +6053,18 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, if (!f->output_data.w32->explicit_parent) { Lisp_Object visibility - = x_get_arg (dpyinfo, parameters, Qvisibility, 0, 0, RES_TYPE_SYMBOL); + = gui_display_get_arg (dpyinfo, parameters, Qvisibility, 0, 0, + RES_TYPE_SYMBOL); if (EQ (visibility, Qicon)) - x_iconify_frame (f); + w32_iconify_frame (f); else { if (EQ (visibility, Qunbound)) visibility = Qt; if (!NILP (visibility)) - x_make_frame_visible (f); + w32_make_frame_visible (f); } store_frame_param (f, Qvisibility, visibility); @@ -6062,8 +6072,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, /* For `no-focus-on-map' frames set alpha here. */ if (FRAME_NO_FOCUS_ON_MAP (f)) - x_default_parameter (f, parameters, Qalpha, Qnil, - "alpha", "Alpha", RES_TYPE_NUMBER); + gui_default_parameter (f, parameters, Qalpha, Qnil, + "alpha", "Alpha", RES_TYPE_NUMBER); /* Initialize `default-minibuffer-frame' in case this is the first frame on this terminal. */ @@ -6072,8 +6082,9 @@ 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 = parameters; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) fset_param_alist (f, Fcons (XCAR (tem), f->param_alist)); @@ -6085,21 +6096,6 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, return unbind_to (count, frame); } -/* FRAME is used only to get a handle on the X display. We don't pass the - display info directly because we're called from frame.c, which doesn't - know about that structure. */ -Lisp_Object -x_get_focus_frame (struct frame *frame) -{ - struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); - Lisp_Object xfocus; - if (! dpyinfo->w32_focus_frame) - return Qnil; - - XSETFRAME (xfocus, dpyinfo->w32_focus_frame); - return xfocus; -} - DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object color, Lisp_Object frame) @@ -6164,7 +6160,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, { struct w32_display_info *dpyinfo = check_x_display_info (display); - return make_fixnum (x_display_pixel_width (dpyinfo)); + return make_fixnum (w32_display_pixel_width (dpyinfo)); } DEFUN ("x-display-pixel-height", Fx_display_pixel_height, @@ -6174,7 +6170,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height, { struct w32_display_info *dpyinfo = check_x_display_info (display); - return make_fixnum (x_display_pixel_height (dpyinfo)); + return make_fixnum (w32_display_pixel_height (dpyinfo)); } DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, @@ -6248,7 +6244,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, / GetDeviceCaps (hdc, VERTRES)); ReleaseDC (NULL, hdc); - return make_fixnum (x_display_pixel_height (dpyinfo) * mm_per_pixel + 0.5); + return make_fixnum (w32_display_pixel_height (dpyinfo) * mm_per_pixel + 0.5); } DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, @@ -6264,7 +6260,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, / GetDeviceCaps (hdc, HORZRES)); ReleaseDC (NULL, hdc); - return make_fixnum (x_display_pixel_width (dpyinfo) * mm_per_pixel + 0.5); + return make_fixnum (w32_display_pixel_width (dpyinfo) * mm_per_pixel + 0.5); } DEFUN ("x-display-backing-store", Fx_display_backing_store, @@ -6438,8 +6434,8 @@ w32_display_monitor_attributes_list_fallback (struct w32_display_info *dpyinfo) } attributes = Fcons (Fcons (Qframes, frames), attributes); - pixel_width = x_display_pixel_width (dpyinfo); - pixel_height = x_display_pixel_height (dpyinfo); + pixel_width = w32_display_pixel_width (dpyinfo); + pixel_height = w32_display_pixel_height (dpyinfo); hdc = GetDC (NULL); mm_per_pixel = ((double) GetDeviceCaps (hdc, HORZSIZE) @@ -6524,19 +6520,12 @@ SOUND is nil to use the normal beep. */) return sound; } -#if 0 /* unused */ -int -x_screen_planes (register struct frame *f) -{ - return FRAME_DISPLAY_INFO (f)->n_planes; -} -#endif /* Return the display structure for the display named NAME. Open a new connection if necessary. */ -struct w32_display_info * -x_display_info_for_name (Lisp_Object name) +static struct w32_display_info * +w32_display_info_for_name (Lisp_Object name) { struct w32_display_info *dpyinfo; @@ -6653,9 +6642,9 @@ DEFUN ("x-close-connection", Fx_close_connection, error ("Display still has frames on it"); block_input (); - x_destroy_all_bitmaps (dpyinfo); + image_destroy_all_bitmaps (dpyinfo); - x_delete_display (dpyinfo); + w32_delete_display (dpyinfo); unblock_input (); return Qnil; @@ -6831,13 +6820,13 @@ unwind_create_tip_frame (Lisp_Object frame) /* Create a frame for a tooltip on the display described by DPYINFO. PARMS is a list of frame parameters. Value is the frame. - Note that functions called here, esp. x_default_parameter can + Note that functions called here, esp. gui_default_parameter can signal errors, for instance when a specified color name is undefined. We have to make sure that we're in a consistent state when this happens. */ static Lisp_Object -x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) +w32_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) { struct frame *f; Lisp_Object frame; @@ -6854,12 +6843,14 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) kb = dpyinfo->terminal->kboard; - /* The calls to x_get_arg remove elements from PARMS, so copy it to - avoid destructive changes behind our caller's back. */ + /* The calls to gui_display_get_arg remove elements from PARMS, so + copy it to avoid destructive changes behind our caller's + back. */ parms = Fcopy_alist (parms); /* Get the name of the frame to use for resource lookup. */ - name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING); + name = gui_display_get_arg (dpyinfo, parms, Qname, "name", "Name", + RES_TYPE_STRING); if (!STRINGP (name) && !EQ (name, Qunbound) && !NILP (name)) @@ -6876,7 +6867,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) /* By setting the output method, we're essentially saying that the frame is live, as per FRAME_LIVE_P. If we get a signal - from this point on, x_destroy_window might screw up reference + from this point on, w32_destroy_window might screw up reference counts etc. */ f->terminal = dpyinfo->terminal; f->output_method = output_w32; @@ -6912,15 +6903,15 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) register_font_driver (&uniscribe_font_driver, f); register_font_driver (&w32font_driver, f); - 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); /* Extract the window parameters from the supplied values that are needed to determine window geometry. */ - x_default_font_parameter (f, parms); + w32_default_font_parameter (f, parms); - x_default_parameter (f, parms, Qborder_width, make_fixnum (2), - "borderWidth", "BorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qborder_width, make_fixnum (2), + "borderWidth", "BorderWidth", RES_TYPE_NUMBER); /* This defaults to 2 in order to match xterm. We recognize either internalBorderWidth or internalBorder (which is what xterm calls it). */ @@ -6928,31 +6919,32 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) { Lisp_Object value; - value = x_get_arg (dpyinfo, parms, Qinternal_border_width, - "internalBorder", "internalBorder", RES_TYPE_NUMBER); + value = gui_display_get_arg (dpyinfo, parms, Qinternal_border_width, + "internalBorder", "internalBorder", + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qinternal_border_width, value), parms); } - x_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1), - "internalBorderWidth", "internalBorderWidth", - RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1), + "internalBorderWidth", "internalBorderWidth", + RES_TYPE_NUMBER); /* Also do the stuff which must be set before the window exists. */ - 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, Qmouse_color, build_string ("black"), - "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qcursor_color, build_string ("black"), - "cursorColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qborder_color, build_string ("black"), - "borderColor", "BorderColor", RES_TYPE_STRING); - x_default_parameter (f, parms, Qno_special_glyphs, Qt, - NULL, NULL, RES_TYPE_BOOLEAN); - - /* Init faces before x_default_parameter is called for the + 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, Qmouse_color, build_string ("black"), + "pointerColor", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qcursor_color, build_string ("black"), + "cursorColor", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qborder_color, build_string ("black"), + "borderColor", "BorderColor", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qno_special_glyphs, Qt, + NULL, NULL, RES_TYPE_BOOLEAN); + + /* Init faces before gui_default_parameter is called for the scroll-bar-width parameter because otherwise we end up in init_iterator with a null face cache, which should not happen. */ init_frame_faces (f); @@ -6961,7 +6953,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) f->output_data.w32->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; f->output_data.w32->explicit_parent = false; - x_figure_window_size (f, parms, true, &x_width, &x_height); + gui_figure_window_size (f, parms, true, &x_width, &x_height); /* No fringes on tip frame. */ f->fringe_cols = 0; @@ -6975,17 +6967,17 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) my_create_tip_window (f); unblock_input (); - x_make_gc (f); + w32_make_gc (f); - x_default_parameter (f, parms, Qauto_raise, Qnil, - "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qauto_lower, Qnil, - "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qcursor_type, Qbox, - "cursorType", "CursorType", 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", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qcursor_type, Qbox, + "cursorType", "CursorType", RES_TYPE_SYMBOL); /* Process alpha here (Bug#17344). */ - x_default_parameter (f, parms, Qalpha, Qnil, - "alpha", "Alpha", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qalpha, Qnil, + "alpha", "Alpha", RES_TYPE_NUMBER); /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size. Change will not be effected unless different @@ -7035,7 +7027,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) below. And the frame needs to be on Vframe_list or making it visible won't work. */ Vframe_list = Fcons (frame, Vframe_list); - f->can_x_set_window_size = true; + f->can_set_window_size = true; /* Setting attributes of faces of the tooltip frame from resources and similar will set face_change, which leads to the @@ -7079,8 +7071,8 @@ compute_tip_xy (struct frame *f, /* Default min and max values. */ min_x = 0; min_y = 0; - max_x = x_display_pixel_width (FRAME_DISPLAY_INFO (f)); - max_y = x_display_pixel_height (FRAME_DISPLAY_INFO (f)); + max_x = w32_display_pixel_width (FRAME_DISPLAY_INFO (f)); + max_y = w32_display_pixel_height (FRAME_DISPLAY_INFO (f)); block_input (); GetCursorPos (&pt); @@ -7145,7 +7137,7 @@ compute_tip_xy (struct frame *f, } /** - * x_hide_tip: + * w32_hide_tip: * * Hide currently visible tooltip and cancel its timer. * @@ -7156,7 +7148,7 @@ compute_tip_xy (struct frame *f, * otherwise. */ static Lisp_Object -x_hide_tip (bool delete) +w32_hide_tip (bool delete) { if (!NILP (tip_timer)) { @@ -7187,7 +7179,7 @@ x_hide_tip (bool delete) tip_frame = Qnil; } else - x_make_frame_invisible (XFRAME (tip_frame)); + w32_make_frame_invisible (XFRAME (tip_frame)); was_open = Qt; } @@ -7329,13 +7321,13 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, } } - x_hide_tip (delete); + w32_hide_tip (delete); } else - x_hide_tip (true); + w32_hide_tip (true); } else - x_hide_tip (true); + w32_hide_tip (true); tip_last_frame = frame; tip_last_string = string; @@ -7364,7 +7356,7 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, /* Create a frame for the tooltip and record it in the global variable tip_frame. */ struct frame *f; /* The value is unused. */ - if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms))) + if (NILP (tip_frame = w32_create_tip_frame (FRAME_DISPLAY_INFO (f), parms))) { /* Creating the tip frame failed. */ unblock_input (); @@ -7485,7 +7477,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, doc: /* SKIP: real doc in xfns.c. */) (void) { - return x_hide_tip (!tooltip_reuse_hidden_frame); + return w32_hide_tip (!tooltip_reuse_hidden_frame); } /*********************************************************************** @@ -7621,9 +7613,9 @@ w32_dialog_in_progress (Lisp_Object in_progress) struct frame *f = XFRAME (frame); if (!NILP (in_progress) && FRAME_Z_GROUP_ABOVE (f)) - x_set_z_group (f, Qabove_suspended, Qabove); + w32_set_z_group (f, Qabove_suspended, Qabove); else if (NILP (in_progress) && FRAME_Z_GROUP_ABOVE_SUSPENDED (f)) - x_set_z_group (f, Qabove, Qabove_suspended); + w32_set_z_group (f, Qabove, Qabove_suspended); } } @@ -8924,7 +8916,7 @@ w32_frame_list_z_order (struct w32_display_info *dpyinfo, HWND window) while (window) { - struct frame *f = x_window_to_frame (dpyinfo, window); + struct frame *f = w32_window_to_frame (dpyinfo, window); if (f) { @@ -10162,52 +10154,52 @@ to be converted to forward slashes by the caller. */) frame_parm_handler w32_frame_parm_handlers[] = { - x_set_autoraise, - x_set_autolower, - x_set_background_color, - x_set_border_color, - x_set_border_width, - x_set_cursor_color, - x_set_cursor_type, - x_set_font, - x_set_foreground_color, - x_set_icon_name, - x_set_icon_type, - x_set_internal_border_width, - 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, - x_set_scroll_bar_height, - x_set_title, - x_set_unsplittable, - x_set_vertical_scroll_bars, - x_set_horizontal_scroll_bars, - x_set_visibility, - x_set_tool_bar_lines, + gui_set_autoraise, + gui_set_autolower, + w32_set_background_color, + w32_set_border_color, + gui_set_border_width, + w32_set_cursor_color, + w32_set_cursor_type, + gui_set_font, + w32_set_foreground_color, + w32_set_icon_name, + w32_set_icon_type, + w32_set_internal_border_width, + gui_set_right_divider_width, + gui_set_bottom_divider_width, + w32_set_menu_bar_lines, + w32_set_mouse_color, + w32_explicitly_set_name, + gui_set_scroll_bar_width, + gui_set_scroll_bar_height, + w32_set_title, + gui_set_unsplittable, + gui_set_vertical_scroll_bars, + gui_set_horizontal_scroll_bars, + gui_set_visibility, + w32_set_tool_bar_lines, 0, /* x_set_scroll_bar_foreground, */ 0, /* x_set_scroll_bar_background, */ - x_set_screen_gamma, - x_set_line_spacing, - x_set_left_fringe, - x_set_right_fringe, + gui_set_screen_gamma, + gui_set_line_spacing, + gui_set_left_fringe, + gui_set_right_fringe, 0, /* x_set_wait_for_wm, */ - x_set_fullscreen, - x_set_font_backend, - x_set_alpha, + gui_set_fullscreen, + gui_set_font_backend, + gui_set_alpha, 0, /* x_set_sticky */ 0, /* x_set_tool_bar_position */ 0, /* x_set_inhibit_double_buffering */ - x_set_undecorated, - x_set_parent_frame, - x_set_skip_taskbar, - x_set_no_focus_on_map, - x_set_no_accept_focus, - x_set_z_group, + w32_set_undecorated, + w32_set_parent_frame, + w32_set_skip_taskbar, + w32_set_no_focus_on_map, + w32_set_no_accept_focus, + w32_set_z_group, 0, /* x_set_override_redirect */ - x_set_no_special_glyphs, + gui_set_no_special_glyphs, }; void diff --git a/src/w32font.c b/src/w32font.c index 33c89825e9..848016da1c 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -678,7 +678,7 @@ w32font_draw (struct glyph_string *s, int from, int to, characters, because drawing background with font dimensions in those cases makes the display illegible. There's only one more call to the draw method with with_background set to - true, and that's in x_draw_glyph_string_foreground, when + true, and that's in w32_draw_glyph_string_foreground, when drawing the cursor, where we have no such heuristics available. FIXME. */ if (s->first_glyph->type == GLYPHLESS_GLYPH diff --git a/src/w32gui.h b/src/w32gui.h index dbc67993ce..5dcbbd9516 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -42,8 +42,6 @@ typedef struct _XGCValues typedef HBITMAP Pixmap; typedef HBITMAP Bitmap; -typedef char * XrmDatabase; - typedef XGCValues * GC; typedef COLORREF Color; typedef HWND Window; diff --git a/src/w32menu.c b/src/w32menu.c index 38e1b506e0..669161c408 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -153,7 +153,7 @@ w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) This way we can safely execute Lisp code. */ void -x_activate_menubar (struct frame *f) +w32_activate_menubar (struct frame *f) { set_frame_menubar (f, false, true); @@ -1469,7 +1469,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) { if (get_menu_item_info) { - struct frame *f = x_window_to_frame (&one_w32_display_info, owner); + struct frame *f = w32_window_to_frame (&one_w32_display_info, owner); Lisp_Object frame, help; /* No help echo on owner-draw menu items, or when the keyboard diff --git a/src/w32reg.c b/src/w32reg.c index aff131dd37..844e561377 100644 --- a/src/w32reg.c +++ b/src/w32reg.c @@ -21,8 +21,8 @@ along with GNU Emacs. If not, see . */ #include #include "lisp.h" -#include "w32term.h" /* for XrmDatabase, xrdb */ #include "blockinput.h" +#include "w32term.h" #include @@ -73,8 +73,8 @@ w32_get_rdb_resource (const char *rdb, const char *resource) return NULL; } -static char * -w32_get_string_resource (const char *name, const char *class, DWORD dwexptype) +static const char * +w32_get_string_resource_1 (const char *name, const char *class, DWORD dwexptype) { LPBYTE lpvalue = NULL; HKEY hrootkey = NULL; @@ -134,15 +134,17 @@ w32_get_string_resource (const char *name, const char *class, DWORD dwexptype) /* Check if there are Windows specific defaults defined. */ return w32_get_rdb_resource (SYSTEM_DEFAULT_RESOURCES, name); } - return (char *)lpvalue; + return (const char *)lpvalue; } /* Retrieve the string resource specified by NAME with CLASS from database RDB. */ -char * -x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) +const char * +w32_get_string_resource (void *v_rdb, const char *name, const char *class) { + const char *rdb = v_rdb; + if (rdb) { char *resource; @@ -157,5 +159,5 @@ x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) /* --quick was passed, so this is a no-op. */ return NULL; - return w32_get_string_resource (name, class, REG_SZ); + return w32_get_string_resource_1 (name, class, REG_SZ); } diff --git a/src/w32term.c b/src/w32term.c index edcdc56a9e..fca1ef96ad 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -87,9 +87,6 @@ extern unsigned int msh_mousewheel; extern int w32_codepage_for_font (char *fontname); extern Cursor w32_load_cursor (LPCTSTR name); -#define x_any_window_to_frame x_window_to_frame -#define x_top_window_to_frame x_window_to_frame - /* This is display since w32 does not support multiple ones. */ struct w32_display_info one_w32_display_info; @@ -171,27 +168,25 @@ static void w32_handle_tool_bar_click (struct frame *, struct input_event *); static void w32_define_cursor (Window, Cursor); -void x_lower_frame (struct frame *); -void x_scroll_bar_clear (struct frame *); -void x_raise_frame (struct frame *); -void x_wm_set_window_state (struct frame *, int); -void x_wm_set_icon_pixmap (struct frame *, int); +static void w32_scroll_bar_clear (struct frame *); +static void w32_raise_frame (struct frame *); +static void w32_lower_frame (struct frame *); static void w32_initialize (void); -static void x_update_end (struct frame *); +static void w32_update_end (struct frame *); static void w32_frame_up_to_date (struct frame *); -static void x_clear_frame (struct frame *); +static void w32_clear_frame (struct frame *); static void w32_frame_highlight (struct frame *); static void w32_frame_unhighlight (struct frame *); -static void x_new_focus_frame (struct w32_display_info *, - struct frame *); -static void x_focus_changed (int, int, struct w32_display_info *, +static void w32_new_focus_frame (struct w32_display_info *, + struct frame *); +static void w32_focus_changed (int, int, struct w32_display_info *, struct frame *, struct input_event *); static void w32_detect_focus_change (struct w32_display_info *, W32Msg *, struct input_event *); static void w32_frame_rehighlight (struct frame *); -static void x_frame_rehighlight (struct w32_display_info *); -static void x_draw_hollow_cursor (struct window *, struct glyph_row *); -static void x_draw_bar_cursor (struct window *, struct glyph_row *, int, +static void w32_frame_rehighlight_1 (struct w32_display_info *); +static void w32_draw_hollow_cursor (struct window *, struct glyph_row *); +static void w32_draw_bar_cursor (struct window *, struct glyph_row *, int, enum text_cursor_kinds); static void w32_clip_to_row (struct window *, struct glyph_row *, enum glyph_row_area, HDC); @@ -205,7 +200,7 @@ static void my_destroy_window (struct frame *, HWND); static void w32fullscreen_hook (struct frame *); #ifdef GLYPH_DEBUG -static void x_check_font (struct frame *, struct font *); +static void w32_check_font (struct frame *, struct font *); #endif @@ -263,7 +258,7 @@ XCreateGC (void *ignore, HWND wignore, unsigned long mask, XGCValues *xgcv) return gc; } -#if 0 /* unused for now, see x_draw_image_glyph_string below */ +#if 0 /* unused for now, see w32_draw_image_glyph_string below */ static void XGetGCValues (void *ignore, XGCValues *gc, unsigned long mask, XGCValues *xgcv) @@ -306,7 +301,7 @@ w32_restore_glyph_string_clip (struct glyph_string *s) } static void -x_get_scale_factor(struct w32_display_info *dpyinfo, int *scale_x, int *scale_y) +w32_get_scale_factor(struct w32_display_info *dpyinfo, int *scale_x, int *scale_y) { const int base_res = 96; @@ -338,7 +333,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f); int scale_x, scale_y; - x_get_scale_factor (dpyinfo, &scale_x, &scale_y); + w32_get_scale_factor (dpyinfo, &scale_x, &scale_y); int wave_height = 3 * scale_y, wave_length = 2 * scale_x, thickness = scale_y; int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax; @@ -457,8 +452,8 @@ w32_clear_window (struct frame *f) #define OPAQUE_FRAME 255 -void -x_set_frame_alpha (struct frame *f) +static void +w32_set_frame_alpha (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); double alpha = 1.0; @@ -504,7 +499,7 @@ x_set_frame_alpha (struct frame *f) } int -x_display_pixel_height (struct w32_display_info *dpyinfo) +w32_display_pixel_height (struct w32_display_info *dpyinfo) { int pixels = GetSystemMetrics (SM_CYVIRTUALSCREEN); @@ -516,7 +511,7 @@ x_display_pixel_height (struct w32_display_info *dpyinfo) } int -x_display_pixel_width (struct w32_display_info *dpyinfo) +w32_display_pixel_width (struct w32_display_info *dpyinfo) { int pixels = GetSystemMetrics (SM_CXVIRTUALSCREEN); @@ -534,11 +529,11 @@ x_display_pixel_width (struct w32_display_info *dpyinfo) /* Start an update of frame F. This function is installed as a hook for update_begin, i.e. it is called when update_begin is called. - This function is called prior to calls to x_update_window_begin for - each window being updated. */ + This function is called prior to calls to w32_update_window_begin + for each window being updated. */ static void -x_update_begin (struct frame *f) +w32_update_begin (struct frame *f) { struct w32_display_info *display_info = FRAME_DISPLAY_INFO (f); @@ -558,7 +553,7 @@ x_update_begin (struct frame *f) /* Start update of window W. */ static void -x_update_window_begin (struct window *w) +w32_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); @@ -698,7 +693,7 @@ w32_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) here. */ static void -x_update_window_end (struct window *w, bool cursor_on_p, +w32_update_window_end (struct window *w, bool cursor_on_p, bool mouse_face_overwritten_p) { if (!w->pseudo_window_p) @@ -734,7 +729,7 @@ x_update_window_end (struct window *w, bool cursor_on_p, /* Unhide the caret. This won't actually show the cursor, unless it was visible before the corresponding call to HideCaret in - x_update_window_begin. */ + w32_update_window_begin. */ if (w32_use_visible_system_caret && w32_system_caret_hwnd) { SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0, @@ -747,7 +742,7 @@ x_update_window_end (struct window *w, bool cursor_on_p, update_end. */ static void -x_update_end (struct frame *f) +w32_update_end (struct frame *f) { if (! FRAME_W32_P (f)) return; @@ -775,7 +770,7 @@ w32_frame_up_to_date (struct frame *f) between bitmaps to be drawn between current row and DESIRED_ROW. */ static void -x_after_update_window_line (struct window *w, struct glyph_row *desired_row) +w32_after_update_window_line (struct window *w, struct glyph_row *desired_row) { struct frame *f; int width, height; @@ -942,27 +937,27 @@ w32_destroy_fringe_bitmap (int which) /* Function prototypes of this page. */ -static void x_set_glyph_string_clipping (struct glyph_string *); -static void x_set_glyph_string_gc (struct glyph_string *); -static void x_draw_glyph_string_background (struct glyph_string *, - bool); -static void x_draw_glyph_string_foreground (struct glyph_string *); -static void x_draw_composite_glyph_string_foreground (struct glyph_string *); -static void x_draw_glyph_string_box (struct glyph_string *); -static void x_draw_glyph_string (struct glyph_string *); -static void x_set_cursor_gc (struct glyph_string *); -static void x_set_mode_line_face_gc (struct glyph_string *); -static void x_set_mouse_face_gc (struct glyph_string *); +static void w32_set_glyph_string_clipping (struct glyph_string *); +static void w32_set_glyph_string_gc (struct glyph_string *); +static void w32_draw_glyph_string_background (struct glyph_string *, + bool); +static void w32_draw_glyph_string_foreground (struct glyph_string *); +static void w32_draw_composite_glyph_string_foreground (struct glyph_string *); +static void w32_draw_glyph_string_box (struct glyph_string *); +static void w32_draw_glyph_string (struct glyph_string *); +static void w32_set_cursor_gc (struct glyph_string *); +static void w32_set_mode_line_face_gc (struct glyph_string *); +static void w32_set_mouse_face_gc (struct glyph_string *); static int w32_alloc_lighter_color (struct frame *, COLORREF *, double, int); static void w32_setup_relief_color (struct frame *, struct relief *, double, int, COLORREF); -static void x_setup_relief_colors (struct glyph_string *); -static void x_draw_image_glyph_string (struct glyph_string *); -static void x_draw_image_relief (struct glyph_string *); -static void x_draw_image_foreground (struct glyph_string *); +static void w32_setup_relief_colors (struct glyph_string *); +static void w32_draw_image_glyph_string (struct glyph_string *); +static void w32_draw_image_relief (struct glyph_string *); +static void w32_draw_image_foreground (struct glyph_string *); static void w32_draw_image_foreground_1 (struct glyph_string *, HBITMAP); -static void x_clear_glyph_string_rect (struct glyph_string *, int, - int, int, int); +static void w32_clear_glyph_string_rect (struct glyph_string *, int, + int, int, int); static void w32_draw_relief_rect (struct frame *, int, int, int, int, int, int, int, int, int, int, RECT *); @@ -974,7 +969,7 @@ static void w32_draw_box_rect (struct glyph_string *, int, int, int, int, face. */ static void -x_set_cursor_gc (struct glyph_string *s) +w32_set_cursor_gc (struct glyph_string *s) { if (s->font == FRAME_FONT (s->f) && s->face->background == FRAME_BACKGROUND_PIXEL (s->f) @@ -1010,7 +1005,7 @@ x_set_cursor_gc (struct glyph_string *s) xgcv.foreground = s->face->background; } - IF_DEBUG (x_check_font (s->f, s->font)); + IF_DEBUG (w32_check_font (s->f, s->font)); xgcv.font = s->font; mask = GCForeground | GCBackground | GCFont; @@ -1029,7 +1024,7 @@ x_set_cursor_gc (struct glyph_string *s) /* Set up S->gc of glyph string S for drawing text in mouse face. */ static void -x_set_mouse_face_gc (struct glyph_string *s) +w32_set_mouse_face_gc (struct glyph_string *s) { int face_id; struct face *face; @@ -1059,7 +1054,7 @@ x_set_mouse_face_gc (struct glyph_string *s) xgcv.background = s->face->background; xgcv.foreground = s->face->foreground; - IF_DEBUG (x_check_font (s->f, s->font)); + IF_DEBUG (w32_check_font (s->f, s->font)); xgcv.font = s->font; mask = GCForeground | GCBackground | GCFont; @@ -1082,7 +1077,7 @@ x_set_mouse_face_gc (struct glyph_string *s) matrix was built, so there isn't much to do, here. */ static inline void -x_set_mode_line_face_gc (struct glyph_string *s) +w32_set_mode_line_face_gc (struct glyph_string *s) { s->gc = s->face->gc; } @@ -1093,7 +1088,7 @@ x_set_mode_line_face_gc (struct glyph_string *s) pattern. */ static inline void -x_set_glyph_string_gc (struct glyph_string *s) +w32_set_glyph_string_gc (struct glyph_string *s) { prepare_face_for_display (s->f, s->face); @@ -1104,17 +1099,17 @@ x_set_glyph_string_gc (struct glyph_string *s) } else if (s->hl == DRAW_INVERSE_VIDEO) { - x_set_mode_line_face_gc (s); + w32_set_mode_line_face_gc (s); s->stippled_p = s->face->stipple != 0; } else if (s->hl == DRAW_CURSOR) { - x_set_cursor_gc (s); + w32_set_cursor_gc (s); s->stippled_p = false; } else if (s->hl == DRAW_MOUSE_FACE) { - x_set_mouse_face_gc (s); + w32_set_mouse_face_gc (s); s->stippled_p = s->face->stipple != 0; } else if (s->hl == DRAW_IMAGE_RAISED @@ -1135,7 +1130,7 @@ x_set_glyph_string_gc (struct glyph_string *s) line or menu if we don't have X toolkit support. */ static inline void -x_set_glyph_string_clipping (struct glyph_string *s) +w32_set_glyph_string_clipping (struct glyph_string *s) { RECT *r = s->clip; int n = get_glyph_string_clip_rects (s, r, 2); @@ -1159,8 +1154,8 @@ x_set_glyph_string_clipping (struct glyph_string *s) the area of SRC. */ static void -x_set_glyph_string_clipping_exactly (struct glyph_string *src, - struct glyph_string *dst) +w32_set_glyph_string_clipping_exactly (struct glyph_string *src, + struct glyph_string *dst) { RECT r; @@ -1205,7 +1200,7 @@ w32_compute_glyph_string_overhangs (struct glyph_string *s) /* Fill rectangle X, Y, W, H with background color of glyph string S. */ static inline void -x_clear_glyph_string_rect (struct glyph_string *s, +w32_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h) { int real_x = x; @@ -1236,7 +1231,7 @@ x_clear_glyph_string_rect (struct glyph_string *s, contains the first component of a composition. */ static void -x_draw_glyph_string_background (struct glyph_string *s, bool force_p) +w32_draw_glyph_string_background (struct glyph_string *s, bool force_p) { /* Nothing to do if background has already been drawn or if it shouldn't be drawn in the first place. */ @@ -1268,7 +1263,7 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p) || s->extends_to_end_of_line_p || force_p) { - x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, + w32_clear_glyph_string_rect (s, s->x, s->y + box_line_width, s->background_width, s->height - 2 * box_line_width); s->background_filled_p = true; @@ -1280,7 +1275,7 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p) /* Draw the foreground of glyph string S. */ static void -x_draw_glyph_string_foreground (struct glyph_string *s) +w32_draw_glyph_string_foreground (struct glyph_string *s) { int i, x; @@ -1337,7 +1332,7 @@ x_draw_glyph_string_foreground (struct glyph_string *s) /* Draw the foreground of composite glyph string S. */ static void -x_draw_composite_glyph_string_foreground (struct glyph_string *s) +w32_draw_composite_glyph_string_foreground (struct glyph_string *s) { int i, j, x; struct font *font = s->font; @@ -1432,7 +1427,7 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) /* Draw the foreground of glyph string S for glyphless characters. */ static void -x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) +w32_draw_glyphless_glyph_string_foreground (struct glyph_string *s) { struct glyph *glyph = s->first_glyph; XChar2b char2b[8]; @@ -1598,8 +1593,8 @@ w32_alloc_lighter_color (struct frame *f, COLORREF *color, /* On frame F, translate pixel colors to RGB values for the NCOLORS colors in COLORS. On W32, we no longer try to map colors to a palette. */ -void -x_query_colors (struct frame *f, XColor *colors, int ncolors) +static void +w32_query_colors (struct frame *f, XColor *colors, int ncolors) { int i; @@ -1613,12 +1608,6 @@ x_query_colors (struct frame *f, XColor *colors, int ncolors) } } -void -x_query_color (struct frame *f, XColor *color) -{ - x_query_colors (f, color, 1); -} - /* Set up the foreground color for drawing relief lines of glyph string S. RELIEF is a pointer to a struct relief containing the GC @@ -1665,7 +1654,7 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, /* Set up colors for the relief lines around glyph string S. */ static void -x_setup_relief_colors (struct glyph_string *s) +w32_setup_relief_colors (struct glyph_string *s) { struct w32_output *di = s->f->output_data.w32; COLORREF color; @@ -1799,7 +1788,7 @@ w32_draw_box_rect (struct glyph_string *s, /* Draw a box around glyph string S. */ static void -x_draw_glyph_string_box (struct glyph_string *s) +w32_draw_glyph_string_box (struct glyph_string *s) { int width, left_x, right_x, top_y, bottom_y, last_x; bool left_p, right_p, raised_p; @@ -1840,7 +1829,7 @@ x_draw_glyph_string_box (struct glyph_string *s) left_p, right_p, &clip_rect); else { - x_setup_relief_colors (s); + w32_setup_relief_colors (s); w32_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y, width, raised_p, 1, 1, left_p, right_p, &clip_rect); } @@ -1850,7 +1839,7 @@ x_draw_glyph_string_box (struct glyph_string *s) /* Draw foreground of image glyph string S. */ static void -x_draw_image_foreground (struct glyph_string *s) +w32_draw_image_foreground (struct glyph_string *s) { int x = s->x; int y = s->ybase - image_ascent (s->img, s->face, &s->slice); @@ -1881,7 +1870,7 @@ x_draw_image_foreground (struct glyph_string *s) DIBSECTION dib; SetBkColor (compat_hdc, RGB (255, 255, 255)); SetTextColor (s->hdc, RGB (0, 0, 0)); - x_set_glyph_string_clipping (s); + w32_set_glyph_string_clipping (s); /* Extract the original dimensions of the bitmap. */ if (GetObject (s->img->pixmap, sizeof (dib), &dib) > 0) { @@ -1891,7 +1880,7 @@ x_draw_image_foreground (struct glyph_string *s) } else { - DebPrint (("x_draw_image_foreground: GetObject failed!\n")); + DebPrint (("w32_draw_image_foreground: GetObject failed!\n")); orig_width = s->slice.width; orig_height = s->slice.height; } @@ -2008,7 +1997,7 @@ x_draw_image_foreground (struct glyph_string *s) /* Draw a relief around the image glyph string S. */ static void -x_draw_image_relief (struct glyph_string *s) +w32_draw_image_relief (struct glyph_string *s) { int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p; int extra_x, extra_y; @@ -2071,7 +2060,7 @@ x_draw_image_relief (struct glyph_string *s) if (s->slice.y + s->slice.height == s->img->height) y1 += thick + extra_y, bot_p = 1; - x_setup_relief_colors (s); + w32_setup_relief_colors (s); get_glyph_string_clip_rect (s, &r); w32_draw_relief_rect (s->f, x, y, x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p, &r); @@ -2104,7 +2093,7 @@ w32_draw_image_foreground_1 (struct glyph_string *s, HBITMAP pixmap) /* FIXME (maybe): The below doesn't support image scaling. But it seems to never be called, because the conditions for its call in - x_draw_image_glyph_string are never fulfilled (they will be if + w32_draw_image_glyph_string are never fulfilled (they will be if the #ifdef'ed away part of that function is ever activated). */ if (s->img->pixmap) { @@ -2172,7 +2161,7 @@ w32_draw_image_foreground_1 (struct glyph_string *s, HBITMAP pixmap) give the rectangle to draw. */ static void -x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h) +w32_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h) { #if 0 /* TODO: stipple */ if (s->stippled_p) @@ -2184,7 +2173,7 @@ x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h) } else #endif - x_clear_glyph_string_rect (s, x, y, w, h); + w32_clear_glyph_string_rect (s, x, y, w, h); } @@ -2203,7 +2192,7 @@ x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h) */ static void -x_draw_image_glyph_string (struct glyph_string *s) +w32_draw_image_glyph_string (struct glyph_string *s) { int x, y; int box_line_hwidth = eabs (s->face->box_line_width); @@ -2281,7 +2270,7 @@ x_draw_image_glyph_string (struct glyph_string *s) } else #endif - x_draw_glyph_string_bg_rect (s, x, y, width, height); + w32_draw_glyph_string_bg_rect (s, x, y, width, height); s->background_filled_p = true; } @@ -2290,7 +2279,7 @@ x_draw_image_glyph_string (struct glyph_string *s) if (pixmap != 0) { w32_draw_image_foreground_1 (s, pixmap); - x_set_glyph_string_clipping (s); + w32_set_glyph_string_clipping (s); { HDC compat_hdc = CreateCompatibleDC (s->hdc); HBRUSH fg_brush = CreateSolidBrush (s->gc->foreground); @@ -2311,20 +2300,20 @@ x_draw_image_glyph_string (struct glyph_string *s) pixmap = 0; } else - x_draw_image_foreground (s); + w32_draw_image_foreground (s); /* If we must draw a relief around the image, do it. */ if (s->img->relief || s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) - x_draw_image_relief (s); + w32_draw_image_relief (s); } /* Draw stretch glyph string S. */ static void -x_draw_stretch_glyph_string (struct glyph_string *s) +w32_draw_stretch_glyph_string (struct glyph_string *s) { eassert (s->first_glyph->type == STRETCH_GLYPH); @@ -2361,7 +2350,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) x -= width; /* Draw cursor. */ - x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); + w32_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); /* Clear rest using the GC of the original non-cursor face. */ if (width < background_width) @@ -2379,7 +2368,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) if (s->row->mouse_face_p && cursor_in_mouse_face_p (s->w)) { - x_set_mouse_face_gc (s); + w32_set_mouse_face_gc (s); gc = s->gc; } else @@ -2416,7 +2405,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) x = left_x; } if (background_width > 0) - x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); + w32_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); } s->background_filled_p = true; @@ -2426,7 +2415,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) /* Draw glyph string S. */ static void -x_draw_glyph_string (struct glyph_string *s) +w32_draw_glyph_string (struct glyph_string *s) { bool relief_drawn_p = 0; @@ -2442,18 +2431,18 @@ x_draw_glyph_string (struct glyph_string *s) width += next->width, next = next->next) if (next->first_glyph->type != IMAGE_GLYPH) { - x_set_glyph_string_gc (next); - x_set_glyph_string_clipping (next); + w32_set_glyph_string_gc (next); + w32_set_glyph_string_clipping (next); if (next->first_glyph->type == STRETCH_GLYPH) - x_draw_stretch_glyph_string (next); + w32_draw_stretch_glyph_string (next); else - x_draw_glyph_string_background (next, true); + w32_draw_glyph_string_background (next, true); next->num_clips = 0; } } /* Set up S->gc, set clipping and draw S. */ - x_set_glyph_string_gc (s); + w32_set_glyph_string_gc (s); /* Draw relief (if any) in advance for char/composition so that the glyph string can be drawn over it. */ @@ -2463,10 +2452,10 @@ x_draw_glyph_string (struct glyph_string *s) || s->first_glyph->type == COMPOSITE_GLYPH)) { - x_set_glyph_string_clipping (s); - x_draw_glyph_string_background (s, true); - x_draw_glyph_string_box (s); - x_set_glyph_string_clipping (s); + w32_set_glyph_string_clipping (s); + w32_draw_glyph_string_background (s, true); + w32_draw_glyph_string_box (s); + w32_set_glyph_string_clipping (s); relief_drawn_p = 1; } else if (!s->clip_head /* draw_glyphs didn't specify a clip mask. */ @@ -2476,26 +2465,26 @@ x_draw_glyph_string (struct glyph_string *s) /* We must clip just this glyph. left_overhang part has already drawn when s->prev was drawn, and right_overhang part will be drawn later when s->next is drawn. */ - x_set_glyph_string_clipping_exactly (s, s); + w32_set_glyph_string_clipping_exactly (s, s); else - x_set_glyph_string_clipping (s); + w32_set_glyph_string_clipping (s); switch (s->first_glyph->type) { case IMAGE_GLYPH: - x_draw_image_glyph_string (s); + w32_draw_image_glyph_string (s); break; case STRETCH_GLYPH: - x_draw_stretch_glyph_string (s); + w32_draw_stretch_glyph_string (s); break; case CHAR_GLYPH: if (s->for_overlaps) s->background_filled_p = true; else - x_draw_glyph_string_background (s, false); - x_draw_glyph_string_foreground (s); + w32_draw_glyph_string_background (s, false); + w32_draw_glyph_string_foreground (s); break; case COMPOSITE_GLYPH: @@ -2503,16 +2492,16 @@ x_draw_glyph_string (struct glyph_string *s) && ! s->first_glyph->u.cmp.automatic)) s->background_filled_p = true; else - x_draw_glyph_string_background (s, true); - x_draw_composite_glyph_string_foreground (s); + w32_draw_glyph_string_background (s, true); + w32_draw_composite_glyph_string_foreground (s); break; case GLYPHLESS_GLYPH: if (s->for_overlaps) s->background_filled_p = true; else - x_draw_glyph_string_background (s, false); - x_draw_glyphless_glyph_string_foreground (s); + w32_draw_glyph_string_background (s, false); + w32_draw_glyphless_glyph_string_foreground (s); break; default: @@ -2665,7 +2654,7 @@ x_draw_glyph_string (struct glyph_string *s) /* Draw relief if not yet drawn. */ if (!relief_drawn_p && s->face->box != FACE_NO_BOX) - x_draw_glyph_string_box (s); + w32_draw_glyph_string_box (s); if (s->prev) { @@ -2680,12 +2669,12 @@ x_draw_glyph_string (struct glyph_string *s) enum draw_glyphs_face save = prev->hl; prev->hl = s->hl; - x_set_glyph_string_gc (prev); - x_set_glyph_string_clipping_exactly (s, prev); + w32_set_glyph_string_gc (prev); + w32_set_glyph_string_clipping_exactly (s, prev); if (prev->first_glyph->type == CHAR_GLYPH) - x_draw_glyph_string_foreground (prev); + w32_draw_glyph_string_foreground (prev); else - x_draw_composite_glyph_string_foreground (prev); + w32_draw_composite_glyph_string_foreground (prev); w32_set_clip_rectangle (prev->hdc, NULL); prev->hl = save; prev->num_clips = 0; @@ -2705,12 +2694,12 @@ x_draw_glyph_string (struct glyph_string *s) enum draw_glyphs_face save = next->hl; next->hl = s->hl; - x_set_glyph_string_gc (next); - x_set_glyph_string_clipping_exactly (s, next); + w32_set_glyph_string_gc (next); + w32_set_glyph_string_clipping_exactly (s, next); if (next->first_glyph->type == CHAR_GLYPH) - x_draw_glyph_string_foreground (next); + w32_draw_glyph_string_foreground (next); else - x_draw_composite_glyph_string_foreground (next); + w32_draw_composite_glyph_string_foreground (next); w32_set_clip_rectangle (next->hdc, NULL); next->hl = save; next->num_clips = 0; @@ -2745,7 +2734,7 @@ w32_shift_glyphs_for_insert (struct frame *f, int x, int y, for X frames. */ static void -x_delete_glyphs (struct frame *f, register int n) +w32_delete_glyphs (struct frame *f, register int n) { if (! FRAME_W32_P (f)) return; @@ -2757,7 +2746,7 @@ x_delete_glyphs (struct frame *f, register int n) /* Clear entire frame. */ static void -x_clear_frame (struct frame *f) +w32_clear_frame (struct frame *f) { if (! FRAME_W32_P (f)) return; @@ -2772,7 +2761,7 @@ x_clear_frame (struct frame *f) /* We have to clear the scroll bars, too. If we have changed colors or something like that, then they should be notified. */ - x_scroll_bar_clear (f); + w32_scroll_bar_clear (f); unblock_input (); } @@ -2811,7 +2800,7 @@ w32_ring_bell (struct frame *f) lines or deleting -N lines at vertical position VPOS. */ static void -x_ins_del_lines (struct frame *f, int vpos, int n) +w32_ins_del_lines (struct frame *f, int vpos, int n) { if (! FRAME_W32_P (f)) return; @@ -2823,7 +2812,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n) /* Scroll part of the display as described by RUN. */ static void -x_scroll_run (struct window *w, struct run *run) +w32_scroll_run (struct window *w, struct run *run) { struct frame *f = XFRAME (w->frame); int x, y, width, height, from_y, to_y, bottom_y; @@ -2862,7 +2851,7 @@ x_scroll_run (struct window *w, struct run *run) block_input (); - /* Cursor off. Will be switched on again in x_update_window_end. */ + /* Cursor off. Will be switched on again in w32_update_window_end. */ gui_clear_cursor (w); { @@ -2907,14 +2896,14 @@ static void w32_frame_highlight (struct frame *f) { gui_update_cursor (f, 1); - x_set_frame_alpha (f); + w32_set_frame_alpha (f); } static void w32_frame_unhighlight (struct frame *f) { gui_update_cursor (f, 1); - x_set_frame_alpha (f); + w32_set_frame_alpha (f); } /* The focus has changed. Update the frames as necessary to reflect @@ -2924,7 +2913,7 @@ w32_frame_unhighlight (struct frame *f) Lisp code can tell when the switch took place by examining the events. */ static void -x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) +w32_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) { struct frame *old_focus = dpyinfo->w32_focus_frame; @@ -2935,7 +2924,7 @@ x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) dpyinfo->w32_focus_frame = frame; if (old_focus && old_focus->auto_lower) - x_lower_frame (old_focus); + w32_lower_frame (old_focus); if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise) dpyinfo->w32_pending_autoraise_frame = dpyinfo->w32_focus_frame; @@ -2943,7 +2932,7 @@ x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) dpyinfo->w32_pending_autoraise_frame = NULL; } - x_frame_rehighlight (dpyinfo); + w32_reframe_highlight_1 (dpyinfo); } @@ -2952,14 +2941,14 @@ x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) a FOCUS_IN_EVENT into *BUFP. */ static void -x_focus_changed (int type, int state, struct w32_display_info *dpyinfo, +w32_focus_changed (int type, int state, struct w32_display_info *dpyinfo, struct frame *frame, struct input_event *bufp) { if (type == WM_SETFOCUS) { if (dpyinfo->w32_focus_event_frame != frame) { - x_new_focus_frame (dpyinfo, frame); + w32_new_focus_frame (dpyinfo, frame); dpyinfo->w32_focus_event_frame = frame; bufp->kind = FOCUS_IN_EVENT; XSETFRAME (bufp->frame_or_window, frame); @@ -2976,7 +2965,7 @@ x_focus_changed (int type, int state, struct w32_display_info *dpyinfo, if (dpyinfo->w32_focus_event_frame == frame) { dpyinfo->w32_focus_event_frame = 0; - x_new_focus_frame (dpyinfo, 0); + w32_new_focus_frame (dpyinfo, 0); bufp->kind = FOCUS_OUT_EVENT; XSETFRAME (bufp->frame_or_window, frame); @@ -2998,15 +2987,15 @@ w32_detect_focus_change (struct w32_display_info *dpyinfo, W32Msg *event, { struct frame *frame; - frame = x_any_window_to_frame (dpyinfo, event->msg.hwnd); + frame = w32_window_to_frame (dpyinfo, event->msg.hwnd); if (! frame) return; /* On w32, this is only called from focus events, so no switch needed. */ - x_focus_changed (event->msg.message, - (event->msg.message == WM_KILLFOCUS ? - FOCUS_IMPLICIT : FOCUS_EXPLICIT), - dpyinfo, frame, bufp); + w32_focus_changed (event->msg.message, + (event->msg.message == WM_KILLFOCUS ? + FOCUS_IMPLICIT : FOCUS_EXPLICIT), + dpyinfo, frame, bufp); } @@ -3014,9 +3003,9 @@ w32_detect_focus_change (struct w32_display_info *dpyinfo, W32Msg *event, /* Handle an event saying the mouse has moved out of an Emacs frame. */ static void -x_mouse_leave (struct w32_display_info *dpyinfo) +w32_mouse_leave (struct w32_display_info *dpyinfo) { - x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); + w32_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); } #endif @@ -3033,11 +3022,11 @@ w32_frame_rehighlight (struct frame *frame) { if (! FRAME_W32_P (frame)) return; - x_frame_rehighlight (FRAME_DISPLAY_INFO (frame)); + w32_frame_rehighlight_1 (FRAME_DISPLAY_INFO (frame)); } static void -x_frame_rehighlight (struct w32_display_info *dpyinfo) +w32_frame_rehighlight_1 (struct w32_display_info *dpyinfo) { struct frame *old_highlight = dpyinfo->x_highlight_frame; @@ -3070,7 +3059,7 @@ x_frame_rehighlight (struct w32_display_info *dpyinfo) /* Convert a keysym to its name. */ char * -x_get_keysym_name (int keysym) +get_keysym_name (int keysym) { /* Make static so we can always return it */ static char value[100]; @@ -3455,7 +3444,7 @@ w32_note_mouse_movement (struct frame *frame, MSG *msg) int mouse_y = HIWORD (msg->lParam); RECT *r; - if (!FRAME_X_OUTPUT (frame)) + if (!FRAME_OUTPUT_DATA (frame)) return 0; dpyinfo = FRAME_DISPLAY_INFO (frame); @@ -3499,15 +3488,15 @@ w32_note_mouse_movement (struct frame *frame, MSG *msg) Mouse Face ************************************************************************/ -static struct scroll_bar *x_window_to_scroll_bar (Window, int); -static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, - enum scroll_bar_part *, - Lisp_Object *, Lisp_Object *, - Time *); -static void x_horizontal_scroll_bar_report_motion (struct frame **, Lisp_Object *, - enum scroll_bar_part *, - Lisp_Object *, Lisp_Object *, - Time *); +static struct scroll_bar *w32_window_to_scroll_bar (Window, int); +static void w32_scroll_bar_report_motion (struct frame **, Lisp_Object *, + enum scroll_bar_part *, + Lisp_Object *, Lisp_Object *, + Time *); +static void w32_horizontal_scroll_bar_report_motion (struct frame **, Lisp_Object *, + enum scroll_bar_part *, + Lisp_Object *, Lisp_Object *, + Time *); static void w32_define_cursor (Window window, Cursor cursor) { @@ -3548,9 +3537,9 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, struct scroll_bar *bar = dpyinfo->last_mouse_scroll_bar; if (bar->horizontal) - x_horizontal_scroll_bar_report_motion (fp, bar_window, part, x, y, time); + w32_horizontal_scroll_bar_report_motion (fp, bar_window, part, x, y, time); else - x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); + w32_scroll_bar_report_motion (fp, bar_window, part, x, y, time); } else { @@ -3572,7 +3561,7 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, /* If mouse was grabbed on a frame, give coords for that frame even if the mouse is now outside it. Otherwise check for window under mouse on one of our frames. */ - if (x_mouse_grabbed (dpyinfo)) + if (gui_mouse_grabbed (dpyinfo)) f1 = dpyinfo->last_mouse_frame; else { @@ -3580,14 +3569,14 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, if (wfp) { - f1 = x_any_window_to_frame (dpyinfo, wfp); + f1 = w32_window_to_frame (dpyinfo, wfp); if (f1) { HWND cwfp = ChildWindowFromPoint (wfp, pt); if (cwfp) { - struct frame *f2 = x_any_window_to_frame (dpyinfo, cwfp); + struct frame *f2 = w32_window_to_frame (dpyinfo, cwfp); /* If a child window was found, make sure that its frame is a child frame (Bug#26615, maybe). */ @@ -3602,7 +3591,7 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, if (! f1) { struct scroll_bar *bar - = x_window_to_scroll_bar (WindowFromPoint (pt), 2); + = w32_window_to_scroll_bar (WindowFromPoint (pt), 2); if (bar) f1 = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); @@ -3674,7 +3663,7 @@ w32_handle_tool_bar_click (struct frame *f, struct input_event *button_event) strip off mark bits. */ static struct scroll_bar * -x_window_to_scroll_bar (Window window_id, int type) +w32_window_to_scroll_bar (Window window_id, int type) { Lisp_Object tail, frame; @@ -3893,7 +3882,8 @@ my_bring_window_to_top (HWND hwnd) scroll bar. */ static struct scroll_bar * -x_scroll_bar_create (struct window *w, int left, int top, int width, int height, bool horizontal) +w32_scroll_bar_create (struct window *w, int left, int top, + int width, int height, bool horizontal) { struct frame *f = XFRAME (WINDOW_FRAME (w)); HWND hwnd; @@ -3955,7 +3945,7 @@ x_scroll_bar_create (struct window *w, int left, int top, int width, int height, nil. */ static void -x_scroll_bar_remove (struct scroll_bar *bar) +w32_scroll_bar_remove (struct scroll_bar *bar) { struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); @@ -4009,7 +3999,7 @@ w32_set_vertical_scroll_bar (struct window *w, } unblock_input (); - bar = x_scroll_bar_create (w, left, top, width, height, false); + bar = w32_scroll_bar_create (w, left, top, width, height, false); } else { @@ -4042,7 +4032,7 @@ w32_set_vertical_scroll_bar (struct window *w, for them on the frame, we have to clear "under" them. */ w32_clear_area (f, hdc, left, top, width, height); release_frame_dc (f, hdc); - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); } /* Make sure scroll bar is "visible" before moving, to ensure the area of the parent window now exposed will be refreshed. */ @@ -4113,7 +4103,7 @@ w32_set_horizontal_scroll_bar (struct window *w, } unblock_input (); - bar = x_scroll_bar_create (w, left, top, width, height, true); + bar = w32_scroll_bar_create (w, left, top, width, height, true); } else { @@ -4144,7 +4134,7 @@ w32_set_horizontal_scroll_bar (struct window *w, for them on the frame, we have to clear "under" them. */ w32_clear_area (f, hdc, clear_left, top, clear_width, height); release_frame_dc (f, hdc); - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); } /* Make sure scroll bar is "visible" before moving, to ensure the area of the parent window now exposed will be refreshed. */ @@ -4319,7 +4309,7 @@ w32_judge_scroll_bars (struct frame *f) { struct scroll_bar *b = XSCROLL_BAR (bar); - x_scroll_bar_remove (b); + w32_scroll_bar_remove (b); next = b->next; b->next = b->prev = Qnil; @@ -4563,7 +4553,7 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, /* Return information to the user about the current position of the mouse on the vertical scroll bar. */ static void -x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, +w32_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, Time *time) @@ -4613,10 +4603,10 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, /* Return information to the user about the current position of the mouse on the horizontal scroll bar. */ static void -x_horizontal_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, - enum scroll_bar_part *part, - Lisp_Object *x, Lisp_Object *y, - Time *time) +w32_horizontal_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, + enum scroll_bar_part *part, + Lisp_Object *x, Lisp_Object *y, + Time *time) { struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); struct scroll_bar *bar = dpyinfo->last_mouse_scroll_bar; @@ -4667,8 +4657,8 @@ x_horizontal_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_windo Clear out the scroll bars, and ask for expose events, so we can redraw them. */ -void -x_scroll_bar_clear (struct frame *f) +static void +w32_scroll_bar_clear (struct frame *f) { Lisp_Object bar; @@ -4691,7 +4681,7 @@ x_scroll_bar_clear (struct frame *f) GetClientRect (window, &rect); select_palette (f, hdc); w32_clear_rect (f, hdc, &rect); - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); deselect_palette (f, hdc); ReleaseDC (window, hdc); @@ -4763,7 +4753,7 @@ w32_read_socket (struct terminal *terminal, switch (msg.msg.message) { case WM_EMACS_PAINT: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -4818,14 +4808,14 @@ w32_read_socket (struct terminal *terminal, msg.rect.top, msg.rect.right - msg.rect.left, msg.rect.bottom - msg.rect.top); - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); } } break; case WM_INPUTLANGCHANGE: /* Generate a language change event. */ - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); /* lParam contains the input language ID in its low 16 bits. Use it to update our record of the keyboard codepage. */ @@ -4843,7 +4833,7 @@ w32_read_socket (struct terminal *terminal, case WM_KEYDOWN: case WM_SYSKEYDOWN: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f && !FRAME_ICONIFIED_P (f)) { @@ -4868,7 +4858,7 @@ w32_read_socket (struct terminal *terminal, case WM_UNICHAR: case WM_SYSCHAR: case WM_CHAR: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f && !FRAME_ICONIFIED_P (f)) { @@ -4946,7 +4936,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_APPCOMMAND: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f && !FRAME_ICONIFIED_P (f)) { @@ -4982,8 +4972,8 @@ w32_read_socket (struct terminal *terminal, previous_help_echo_string = help_echo_string; help_echo_string = Qnil; - f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame - : x_window_to_frame (dpyinfo, msg.msg.hwnd)); + f = (gui_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : w32_window_to_frame (dpyinfo, msg.msg.hwnd)); if (hlinfo->mouse_face_hidden) { @@ -5062,8 +5052,8 @@ w32_read_socket (struct terminal *terminal, int button = 0; int up = 0; - f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame - : x_window_to_frame (dpyinfo, msg.msg.hwnd)); + f = (gui_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : w32_window_to_frame (dpyinfo, msg.msg.hwnd)); if (f) { @@ -5123,8 +5113,8 @@ w32_read_socket (struct terminal *terminal, case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: { - f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame - : x_window_to_frame (dpyinfo, msg.msg.hwnd)); + f = (gui_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : w32_window_to_frame (dpyinfo, msg.msg.hwnd)); if (f) { @@ -5142,7 +5132,7 @@ w32_read_socket (struct terminal *terminal, dpyinfo->last_mouse_frame = f; } else if (FRAME_NO_ACCEPT_FOCUS (f) - && !x_mouse_grabbed (dpyinfo)) + && !gui_mouse_grabbed (dpyinfo)) { Lisp_Object frame1 = get_frame_param (f, Qmouse_wheel_frame); struct frame *f1 = FRAMEP (frame1) ? XFRAME (frame1) : NULL; @@ -5166,7 +5156,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_DROPFILES: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) w32_construct_drag_n_drop (&inev, &msg, f); @@ -5175,7 +5165,7 @@ w32_read_socket (struct terminal *terminal, case WM_HSCROLL: { struct scroll_bar *bar = - x_window_to_scroll_bar ((HWND)msg.msg.lParam, 1); + w32_window_to_scroll_bar ((HWND)msg.msg.lParam, 1); if (bar) w32_horizontal_scroll_bar_handle_click (bar, &msg, &inev); @@ -5185,7 +5175,7 @@ w32_read_socket (struct terminal *terminal, case WM_VSCROLL: { struct scroll_bar *bar = - x_window_to_scroll_bar ((HWND)msg.msg.lParam, 0); + w32_window_to_scroll_bar ((HWND)msg.msg.lParam, 0); if (bar) w32_scroll_bar_handle_click (bar, &msg, &inev); @@ -5193,7 +5183,7 @@ w32_read_socket (struct terminal *terminal, } case WM_WINDOWPOSCHANGED: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -5240,13 +5230,13 @@ w32_read_socket (struct terminal *terminal, case WM_ACTIVATE: case WM_ACTIVATEAPP: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { /* Run the full-screen hook function also when we are being activated, to actually install the required size in effect, if the WAIT flag is set. This is - because when the hook is run from x_set_fullscreen, + because when the hook is run from gui_set_fullscreen, the frame might not yet be visible, if that call is a result of make-frame, and in that case the hook just sets the WAIT flag. */ @@ -5264,11 +5254,11 @@ w32_read_socket (struct terminal *terminal, break; case WM_MOVE: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f && FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P(f)) { - x_real_positions (f, &f->left_pos, &f->top_pos); + w32_real_positions (f, &f->left_pos, &f->top_pos); inev.kind = MOVE_FRAME_EVENT; XSETFRAME (inev.frame_or_window, f); } @@ -5283,7 +5273,7 @@ w32_read_socket (struct terminal *terminal, if (!msg.msg.wParam && msg.msg.hwnd == tip_window) { tip_window = NULL; - x_redo_mouse_highlight (dpyinfo); + gui_redo_mouse_highlight (dpyinfo); } /* If window has been obscured or exposed by another window @@ -5295,20 +5285,20 @@ w32_read_socket (struct terminal *terminal, check_visibility = 1; else { - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); f->async_visible = msg.msg.wParam; } #endif - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) - x_clear_under_internal_border (f); + w32_clear_under_internal_border (f); check_visibility = 1; break; case WM_SIZE: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); /* Inform lisp of whether frame has been iconified etc. */ if (f) @@ -5344,7 +5334,7 @@ w32_read_socket (struct terminal *terminal, BEFORE telling us the Window is minimized when the Window is iconified, with 3000,3000 as the co-ords. */ - x_real_positions (f, &x, &y); + w32_real_positions (f, &x, &y); f->left_pos = x; f->top_pos = y; @@ -5368,7 +5358,7 @@ w32_read_socket (struct terminal *terminal, { int x, y; - x_real_positions (f, &x, &y); + w32_real_positions (f, &x, &y); if (x < 0 && y < 0) store_frame_param (f, Qfullscreen, Qmaximized); } @@ -5399,7 +5389,7 @@ w32_read_socket (struct terminal *terminal, BEFORE telling us the Window is minimized when the Window is iconified, with 3000,3000 as the co-ords. */ - x_real_positions (f, &f->left_pos, &f->top_pos); + w32_real_positions (f, &f->left_pos, &f->top_pos); inev.kind = DEICONIFY_EVENT; XSETFRAME (inev.frame_or_window, f); @@ -5463,7 +5453,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_MOUSELEAVE: - f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { if (f == hlinfo->mouse_face_mouse_frame) @@ -5492,7 +5482,7 @@ w32_read_socket (struct terminal *terminal, case WM_KILLFOCUS: w32_detect_focus_change (dpyinfo, &msg, &inev); - f = x_top_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -5517,7 +5507,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_CLOSE: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -5531,7 +5521,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_INITMENU: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -5541,7 +5531,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_COMMAND: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -5552,7 +5542,7 @@ w32_read_socket (struct terminal *terminal, break; case WM_DISPLAYCHANGE: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { @@ -5564,7 +5554,7 @@ w32_read_socket (struct terminal *terminal, The following code is untested yet. */ if (!NILP (fullscreen)) { - x_set_fullscreen (f, fullscreen, fullscreen); + gui_set_fullscreen (f, fullscreen, fullscreen); w32fullscreen_hook (f); } @@ -5578,7 +5568,7 @@ w32_read_socket (struct terminal *terminal, #if HAVE_W32NOTIFY case WM_EMACS_FILENOTIFY: - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = w32_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) w32_queue_notifications (&inev, &msg, f, &count); break; @@ -5636,7 +5626,7 @@ w32_read_socket (struct terminal *terminal, raise it now. FIXME: handle more than one such frame. */ if (dpyinfo->w32_pending_autoraise_frame) { - x_raise_frame (dpyinfo->w32_pending_autoraise_frame); + w32_raise_frame (dpyinfo->w32_pending_autoraise_frame); dpyinfo->w32_pending_autoraise_frame = NULL; } @@ -5748,7 +5738,7 @@ w32_clip_to_row (struct window *w, struct glyph_row *row, /* Draw a hollow box cursor on window W in glyph row ROW. */ static void -x_draw_hollow_cursor (struct window *w, struct glyph_row *row) +w32_draw_hollow_cursor (struct window *w, struct glyph_row *row) { struct frame *f = XFRAME (WINDOW_FRAME (w)); HDC hdc; @@ -5797,7 +5787,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) --gerd. */ static void -x_draw_bar_cursor (struct window *w, struct glyph_row *row, +w32_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind) { struct frame *f = XFRAME (w->frame); @@ -5976,7 +5966,7 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, switch (cursor_type) { case HOLLOW_BOX_CURSOR: - x_draw_hollow_cursor (w, glyph_row); + w32_draw_hollow_cursor (w, glyph_row); break; case FILLED_BOX_CURSOR: @@ -5984,11 +5974,11 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, break; case BAR_CURSOR: - x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); + w32_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); break; case HBAR_CURSOR: - x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); + w32_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); break; case NO_CURSOR: @@ -6005,8 +5995,8 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, /* Icons. */ -bool -x_bitmap_icon (struct frame *f, Lisp_Object icon) +static bool +w32_bitmap_icon (struct frame *f, Lisp_Object icon) { HANDLE main_icon; HANDLE small_icon = NULL; @@ -6093,8 +6083,8 @@ x_io_error_quitter (display) /* Changing the font of the frame. */ -Lisp_Object -x_new_font (struct frame *f, Lisp_Object font_object, int fontset) +static Lisp_Object +w32_new_font (struct frame *f, Lisp_Object font_object, int fontset) { struct font *font = XFONT_OBJECT (font_object); int unit, font_ascent, font_descent; @@ -6126,7 +6116,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) } /* Now make the frame display the given font. */ - if (FRAME_X_WINDOW (f) != 0) + if (FRAME_NATIVE_WINDOW (f) != 0) { /* Don't change the size of a tip frame; there's no point in doing it because it's done in Fx_show_tip, and it leads to @@ -6162,7 +6152,7 @@ xim_close_dpy (dpyinfo) from its current recorded position values and gravity. */ static void -x_calc_absolute_position (struct frame *f) +w32_calc_absolute_position (struct frame *f) { int flags = f->size_hint_flags; @@ -6245,7 +6235,7 @@ x_calc_absolute_position (struct frame *f) + f->left_pos - left_right_borders_width); else - f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) + f->left_pos = (w32_display_pixel_width (FRAME_DISPLAY_INFO (f)) + display_left - FRAME_PIXEL_WIDTH (f) + f->left_pos @@ -6260,7 +6250,7 @@ x_calc_absolute_position (struct frame *f) + f->top_pos - top_bottom_borders_height); else - f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) + f->top_pos = (w32_display_pixel_height (FRAME_DISPLAY_INFO (f)) + display_top - FRAME_PIXEL_HEIGHT (f) + f->top_pos @@ -6274,13 +6264,13 @@ x_calc_absolute_position (struct frame *f) /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, to really change the position, and 0 when calling from - x_make_frame_visible (in that case, XOFF and YOFF are the current - position values). It is -1 when calling from x_set_frame_parameters, + w32_make_frame_visible (in that case, XOFF and YOFF are the current + position values). It is -1 when calling from gui_set_frame_parameters, which means, do adjust for borders but don't change the gravity. */ -void -x_set_offset (struct frame *f, register int xoff, register int yoff, - int change_gravity) +static void +w32_set_offset (struct frame *f, register int xoff, register int yoff, + int change_gravity) { int modified_top, modified_left; @@ -6295,10 +6285,10 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, f->size_hint_flags |= YNegative; f->win_gravity = NorthWestGravity; } - x_calc_absolute_position (f); + w32_calc_absolute_position (f); block_input (); - x_wm_set_size_hint (f, (long) 0, false); + w32_wm_set_size_hint (f, (long) 0, false); modified_left = f->left_pos; modified_top = f->top_pos; @@ -6417,13 +6407,13 @@ w32fullscreen_hook (struct frame *f) f->want_fullscreen |= FULLSCREEN_WAIT; } -/* Call this to change the size of frame F's x-window. +/* Call this to change the size of frame F's native window. If CHANGE_GRAVITY, change to top-left-corner window gravity for this size change and subsequent size changes. Otherwise we leave the window gravity unchanged. */ -void -x_set_window_size (struct frame *f, bool change_gravity, +static void +w32_set_window_size (struct frame *f, bool change_gravity, int width, int height, bool pixelwise) { int pixelwidth, pixelheight; @@ -6472,7 +6462,7 @@ x_set_window_size (struct frame *f, bool change_gravity, } f->win_gravity = NorthWestGravity; - x_wm_set_size_hint (f, (long) 0, false); + w32_wm_set_size_hint (f, (long) 0, false); rect.left = rect.top = 0; rect.right = pixelwidth; @@ -6582,6 +6572,20 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) unblock_input (); } +static Lisp_Object +w32_get_focus_frame (struct frame *f) +{ + Lisp_Object lisp_focus; + + struct frame *focus = FRAME_DISPLAY_INFO (f)->w32_focus_frame; + + if (!focus) + return Qnil; + + XSETFRAME (lisp_focus, focus); + return lisp_focus; +} + /* Focus shifting, raising and lowering. */ @@ -6589,8 +6593,8 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) Windows API: An application cannot activate an inactive window without also bringing it to the top of the Z order. */ -void -x_focus_frame (struct frame *f, bool noactivate) +static void +w32_focus_frame (struct frame *f, bool noactivate) { #if 0 struct w32_display_info *dpyinfo = &one_w32_display_info; @@ -6600,7 +6604,7 @@ x_focus_frame (struct frame *f, bool noactivate) block_input (); #if 0 /* Try not to change its Z-order if possible. */ - if (x_window_to_frame (dpyinfo, GetForegroundWindow ())) + if (w32_window_to_frame (dpyinfo, GetForegroundWindow ())) my_set_focus (f, FRAME_W32_WINDOW (f)); else #endif @@ -6609,8 +6613,8 @@ x_focus_frame (struct frame *f, bool noactivate) } /* Raise frame F. */ -void -x_raise_frame (struct frame *f) +static void +w32_raise_frame (struct frame *f) { block_input (); @@ -6671,8 +6675,8 @@ x_raise_frame (struct frame *f) } /* Lower frame F. */ -void -x_lower_frame (struct frame *f) +static void +w32_lower_frame (struct frame *f) { block_input (); my_set_window_pos (FRAME_W32_WINDOW (f), @@ -6689,9 +6693,9 @@ w32_frame_raise_lower (struct frame *f, bool raise_flag) return; if (raise_flag) - x_raise_frame (f); + w32_raise_frame (f); else - x_lower_frame (f); + w32_lower_frame (f); } /* Change of visibility. */ @@ -6705,17 +6709,17 @@ w32_frame_raise_lower (struct frame *f, bool raise_flag) finishes with it. */ void -x_make_frame_visible (struct frame *f) +w32_make_frame_visible (struct frame *f) { block_input (); - x_set_bitmap_icon (f); + gui_set_bitmap_icon (f); if (! FRAME_VISIBLE_P (f)) { /* We test FRAME_GARBAGED_P here to make sure we don't - call x_set_offset a second time - if we get to x_make_frame_visible a second time + call w32_set_offset a second time + if we get to w32_make_frame_visible a second time before the window gets really visible. */ if (! FRAME_ICONIFIED_P (f) && ! f->output_data.w32->asked_for_visible) @@ -6736,7 +6740,7 @@ x_make_frame_visible (struct frame *f) workarea_rect.top); } - x_set_offset (f, f->left_pos, f->top_pos, 0); + w32_set_offset (f, f->left_pos, f->top_pos, 0); } f->output_data.w32->asked_for_visible = 1; @@ -6807,7 +6811,7 @@ x_make_frame_visible (struct frame *f) /* Make the frame visible (mapped and not iconified). */ void -x_make_frame_invisible (struct frame *f) +w32_make_frame_invisible (struct frame *f) { /* Don't keep the highlight on an invisible frame. */ if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) @@ -6828,10 +6832,19 @@ x_make_frame_invisible (struct frame *f) unblock_input (); } +static void +w32_make_frame_visible_invisible (struct frame *f, bool visible) +{ + if (visible) + w32_make_frame_visible (f); + else + w32_make_frame_invisible (f); +} + /* Change window state from mapped to iconified. */ void -x_iconify_frame (struct frame *f) +w32_iconify_frame (struct frame *f) { /* Don't keep the highlight on an invisible frame. */ if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) @@ -6842,7 +6855,7 @@ x_iconify_frame (struct frame *f) block_input (); - x_set_bitmap_icon (f); + gui_set_bitmap_icon (f); /* Simulate the user minimizing the frame. */ SendMessageTimeout (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0, @@ -6855,10 +6868,10 @@ x_iconify_frame (struct frame *f) } -/* Free X resources of frame F. */ +/* Free resources of frame F. */ void -x_free_frame_resources (struct frame *f) +w32_free_frame_resources (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); @@ -6893,11 +6906,11 @@ x_free_frame_resources (struct frame *f) /* Destroy the window of frame F. */ static void -x_destroy_window (struct frame *f) +w32_destroy_window (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - x_free_frame_resources (f); + w32_free_frame_resources (f); dpyinfo->reference_count--; } @@ -6910,7 +6923,7 @@ x_destroy_window (struct frame *f) If USER_POSITION, set the USPosition flag (this is useful when FLAGS is 0). */ void -x_wm_set_size_hint (struct frame *f, long flags, bool user_position) +w32_wm_set_size_hint (struct frame *f, long flags, bool user_position) { Window window = FRAME_W32_WINDOW (f); @@ -6935,7 +6948,7 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) font table. */ static void -x_check_font (struct frame *f, struct font *font) +w32_check_font (struct frame *f, struct font *font) { eassert (font != NULL && ! NILP (font->props[FONT_TYPE_INDEX])); if (font->driver->check) @@ -6951,7 +6964,7 @@ w32_show_hourglass (struct frame *f) { if (!menubar_in_use && !current_popup_menu) { - struct w32_output *w32 = FRAME_X_OUTPUT (f); + struct w32_output *w32 = FRAME_OUTPUT_DATA (f); w32->hourglass_p = 1; SetCursor (w32->hourglass_cursor); @@ -6963,7 +6976,7 @@ w32_show_hourglass (struct frame *f) static void w32_hide_hourglass (struct frame *f) { - struct w32_output *w32 = FRAME_X_OUTPUT (f); + struct w32_output *w32 = FRAME_OUTPUT_DATA (f); w32->hourglass_p = 0; if (f->pointer_invisible) @@ -7099,10 +7112,10 @@ static struct redisplay_interface w32_redisplay_interface = gui_write_glyphs, gui_insert_glyphs, gui_clear_end_of_line, - x_scroll_run, - x_after_update_window_line, - x_update_window_begin, - x_update_window_end, + w32_scroll_run, + w32_after_update_window_line, + w32_update_window_begin, + w32_update_window_end, 0, /* flush_display */ gui_clear_window_mouse_face, gui_get_glyph_overhangs, @@ -7111,9 +7124,10 @@ static struct redisplay_interface w32_redisplay_interface = w32_define_fringe_bitmap, w32_destroy_fringe_bitmap, w32_compute_glyph_string_overhangs, - x_draw_glyph_string, + w32_draw_glyph_string, w32_define_frame_cursor, w32_clear_frame_area, + w32_clear_under_internal_border, w32_draw_window_cursor, w32_draw_vertical_window_border, w32_draw_window_divider, @@ -7122,7 +7136,7 @@ static struct redisplay_interface w32_redisplay_interface = w32_hide_hourglass }; -static void x_delete_terminal (struct terminal *term); +static void w32_delete_terminal (struct terminal *term); static struct terminal * w32_create_terminal (struct w32_display_info *dpyinfo) @@ -7136,28 +7150,44 @@ w32_create_terminal (struct w32_display_info *dpyinfo) /* MSVC does not type K&R functions with no arguments correctly, and so we must explicitly cast them. */ - terminal->clear_frame_hook = x_clear_frame; - terminal->ins_del_lines_hook = x_ins_del_lines; - terminal->delete_glyphs_hook = x_delete_glyphs; + terminal->clear_frame_hook = w32_clear_frame; + terminal->ins_del_lines_hook = w32_ins_del_lines; + terminal->delete_glyphs_hook = w32_delete_glyphs; terminal->ring_bell_hook = w32_ring_bell; terminal->toggle_invisible_pointer_hook = w32_toggle_invisible_pointer; - terminal->update_begin_hook = x_update_begin; - terminal->update_end_hook = x_update_end; + terminal->update_begin_hook = w32_update_begin; + terminal->update_end_hook = w32_update_end; terminal->read_socket_hook = w32_read_socket; terminal->frame_up_to_date_hook = w32_frame_up_to_date; + terminal->query_colors = w32_query_colors; terminal->mouse_position_hook = w32_mouse_position; + terminal->get_focus_frame = w32_get_focus_frame; + terminal->focus_frame_hook = w32_focus_frame; terminal->frame_rehighlight_hook = w32_frame_rehighlight; terminal->frame_raise_lower_hook = w32_frame_raise_lower; + terminal->frame_visible_invisible_hook = w32_make_frame_visible_invisible; terminal->fullscreen_hook = w32fullscreen_hook; + terminal->iconify_frame_hook = w32_iconify_frame; + terminal->set_window_size_hook = w32_set_window_size; + terminal->set_frame_offset_hook = w32_set_offset; + terminal->set_frame_alpha_hook = w32_set_frame_alpha; + terminal->set_new_font_hook = w32_new_font; + terminal->set_bitmap_icon_hook = w32_bitmap_icon; + terminal->implicit_set_name_hook = w32_implicitly_set_name; terminal->menu_show_hook = w32_menu_show; + terminal->activate_menubar_hook = w32_activate_menubar; terminal->popup_dialog_hook = w32_popup_dialog; + terminal->change_tool_bar_height_hook = w32_change_tool_bar_height; terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; terminal->set_horizontal_scroll_bar_hook = w32_set_horizontal_scroll_bar; + terminal->set_scroll_bar_default_width_hook = w32_set_scroll_bar_default_width; + terminal->set_scroll_bar_default_height_hook = w32_set_scroll_bar_default_height; terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars; terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; terminal->judge_scroll_bars_hook = w32_judge_scroll_bars; - terminal->delete_frame_hook = x_destroy_window; - terminal->delete_terminal_hook = x_delete_terminal; + terminal->get_string_resource_hook = w32_get_string_resource; + terminal->delete_frame_hook = w32_destroy_window; + terminal->delete_terminal_hook = w32_delete_terminal; /* Other hooks are NULL by default. */ /* We don't yet support separate terminals on W32, so don't try to share @@ -7175,7 +7205,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) } static void -x_delete_terminal (struct terminal *terminal) +w32_delete_terminal (struct terminal *terminal) { struct w32_display_info *dpyinfo = terminal->display_info.w32; @@ -7186,7 +7216,7 @@ x_delete_terminal (struct terminal *terminal) block_input (); - x_delete_display (dpyinfo); + w32_delete_display (dpyinfo); unblock_input (); } @@ -7213,7 +7243,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) /* Set the name of the terminal. */ terminal->name = xlispstrdup (display_name); - dpyinfo->xrdb = xrm_option ? w32_make_rdb (xrm_option) : NULL; + dpyinfo->rdb = xrm_option ? w32_make_rdb (xrm_option) : NULL; /* Put this display on the chain. */ dpyinfo->next = x_display_list; @@ -7262,7 +7292,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) /* Get rid of display DPYINFO, assuming all frames are already gone. */ void -x_delete_display (struct w32_display_info *dpyinfo) +w32_delete_display (struct w32_display_info *dpyinfo) { /* FIXME: the only display info apparently can't be deleted. */ /* free palette table */ diff --git a/src/w32term.h b/src/w32term.h index a0942d630a..6d2765961c 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -120,7 +120,7 @@ struct w32_display_info Cursor horizontal_scroll_bar_cursor; /* Resource data base */ - XrmDatabase xrdb; + const char *rdb; /* color palette information. */ int has_palette; @@ -227,28 +227,33 @@ extern struct w32_display_info one_w32_display_info; extern HMENU current_popup_menu; extern int menubar_in_use; -extern struct frame *x_window_to_frame (struct w32_display_info *, HWND); +extern struct frame *w32_window_to_frame (struct w32_display_info *, HWND); -struct w32_display_info *x_display_info_for_name (Lisp_Object); +extern void w32_real_positions (struct frame *f, int *xptr, int *yptr); + +extern void w32_clear_under_internal_border (struct frame *); + +extern void w32_change_tool_bar_height (struct frame *, int); +extern void w32_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +extern void w32_set_scroll_bar_default_width (struct frame *); +extern void w32_set_scroll_bar_default_height (struct frame *); -/* also defined in xterm.h XXX: factor out to common header */ extern struct w32_display_info *w32_term_init (Lisp_Object, char *, char *); extern int w32_defined_color (struct frame *f, const char *color, XColor *color_def, bool alloc_p); -extern int x_display_pixel_height (struct w32_display_info *); -extern int x_display_pixel_width (struct w32_display_info *); -extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_tool_bar_lines (struct frame *f, - Lisp_Object value, - Lisp_Object oldval); -extern void x_set_internal_border_width (struct frame *f, - Lisp_Object value, - Lisp_Object oldval); +extern int w32_display_pixel_height (struct w32_display_info *); +extern int w32_display_pixel_width (struct w32_display_info *); extern void initialize_frame_menubar (struct frame *); extern void w32_dialog_in_progress (Lisp_Object in_progress); +extern void w32_make_frame_visible (struct frame *f); +extern void w32_make_frame_invisible (struct frame *f); +extern void w32_iconify_frame (struct frame *f); +extern void w32_free_frame_resources (struct frame *); +extern void w32_wm_set_size_hint (struct frame *, long, bool); + /* w32inevt.c */ extern int w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId); extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key); @@ -257,6 +262,10 @@ extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key); extern void w32con_hide_cursor (void); extern void w32con_show_cursor (void); +/* w32reg.c */ +extern const char *w32_get_string_resource (void *v_rdb, + const char *name, + const char *class); #define PIX_TYPE COLORREF @@ -397,12 +406,12 @@ struct w32_output extern struct w32_output w32term_display; -/* Return the X output data for frame F. */ -#define FRAME_X_OUTPUT(f) ((f)->output_data.w32) +/* Return the output data for frame F. */ +#define FRAME_OUTPUT_DATA(f) ((f)->output_data.w32) /* Return the window associated with the frame F. */ #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc) -#define FRAME_X_WINDOW(f) FRAME_W32_WINDOW (f) +#define FRAME_NATIVE_WINDOW(f) FRAME_W32_WINDOW (f) #define FRAME_FONT(f) ((f)->output_data.w32->font) #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset) @@ -715,9 +724,8 @@ extern void complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result); extern BOOL parse_button (int, int, int *, int *); extern void w32_sys_ring_bell (struct frame *f); -extern void x_delete_display (struct w32_display_info *dpyinfo); -extern void x_clear_under_internal_border (struct frame *f); -extern void x_query_color (struct frame *, XColor *); +extern void w32_query_color (struct frame *, XColor *); +extern void w32_delete_display (struct w32_display_info *dpyinfo); #define FILE_NOTIFICATIONS_SIZE 16384 /* Notifications come in sets. We use a doubly linked list with a diff --git a/src/window.c b/src/window.c index 05340ea439..30ffad0e51 100644 --- a/src/window.c +++ b/src/window.c @@ -3434,7 +3434,7 @@ run_window_configuration_change_hook (struct frame *f) XSETFRAME (frame, f); if (NILP (Vrun_hooks) - || !f->can_x_set_window_size + || !f->can_set_window_size || !f->after_make_frame) return; @@ -3763,7 +3763,7 @@ run_window_change_functions (void) ptrdiff_t number_of_windows; if (!FRAME_LIVE_P (f) - || !f->can_x_set_window_size + || !f->can_set_window_size || !f->after_make_frame || FRAME_TOOLTIP_P (f) || !(frame_window_change @@ -4683,7 +4683,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) int unit = horflag ? FRAME_COLUMN_WIDTH (f) : FRAME_LINE_HEIGHT (f); /* Don't let the size drop below one unit. This is more comforting - when we are called from x_set_tool_bar_lines since the latter may + when we are called from *_set_tool_bar_lines since the latter may have implicitly given us a zero or negative height. */ if (pixelwise) { @@ -6867,8 +6867,8 @@ the return value is nil. Otherwise the value is t. */) call1 (Qrecord_window_buffer, window); } - /* Disallow x_set_window_size, temporarily. */ - f->can_x_set_window_size = false; + /* Disallow set_window_size_hook, temporarily. */ + f->can_set_window_size = false; /* The mouse highlighting code could get screwed up if it runs during this. */ block_input (); @@ -7072,9 +7072,9 @@ the return value is nil. Otherwise the value is t. */) if (NILP (leaf_windows[i]->contents)) free_window_matrices (leaf_windows[i]); - /* Allow x_set_window_size again and apply frame size changes if - needed. */ - f->can_x_set_window_size = true; + /* Allow set_window_size_hook again and apply frame size changes + if needed. */ + f->can_set_window_size = true; adjust_frame_size (f, -1, -1, 1, false, Qset_window_configuration); adjust_frame_glyphs (f); diff --git a/src/xdisp.c b/src/xdisp.c index 7086e104a2..19fbf93dd0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -336,8 +336,8 @@ along with GNU Emacs. If not, see . */ #include TERM_HEADER #endif /* HAVE_WINDOW_SYSTEM */ -#ifndef FRAME_X_OUTPUT -#define FRAME_X_OUTPUT(f) ((f)->output_data.x) +#ifndef FRAME_OUTPUT_DATA +#define FRAME_OUTPUT_DATA(f) (NULL) #endif #define DISP_INFINITY 10000000 @@ -11281,7 +11281,7 @@ resize_mini_window (struct window *w, bool exact_p) /* Nil means don't try to resize. */ if ((NILP (Vresize_mini_windows) && (NILP (resize_mini_frames) || !FRAME_MINIBUF_ONLY_P (f))) - || (FRAME_X_P (f) && FRAME_X_OUTPUT (f) == NULL)) + || (FRAME_X_P (f) && FRAME_OUTPUT_DATA (f) == NULL)) return false; /* By default, start display at the beginning. */ @@ -11598,10 +11598,10 @@ clear_garbaged_frames (void) else clear_current_matrices (f); -#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_NS) - x_clear_under_internal_border (f); -#endif /* HAVE_WINDOW_SYSTEM && !HAVE_NS */ - +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_RIF (f)->clear_under_internal_border) + FRAME_RIF (f)->clear_under_internal_border (f); +#endif fset_redisplay (f); f->garbaged = false; f->resized_p = false; @@ -11670,10 +11670,10 @@ echo_area_display (bool update_frame_p) { n = redisplay_mode_lines (FRAME_ROOT_WINDOW (f), false); -#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_NS) - x_clear_under_internal_border (f); -#endif /* HAVE_WINDOW_SYSTEM && !HAVE_NS */ - +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_RIF (f)->clear_under_internal_border) + FRAME_RIF (f)->clear_under_internal_border (f); +#endif } if (window_height_changed_p @@ -12080,7 +12080,9 @@ gui_consider_frame_title (Lisp_Object frame) if (! STRINGP (f->name) || SBYTES (f->name) != len || memcmp (title, SDATA (f->name), len) != 0) - x_implicitly_set_name (f, make_string (title, len), Qnil); + FRAME_TERMINAL (f)->implicit_set_name_hook (f, + make_string (title, len), + Qnil); } } @@ -12854,7 +12856,7 @@ redisplay_tool_bar (struct frame *f) if (new_height != WINDOW_PIXEL_HEIGHT (w)) { - x_change_tool_bar_height (f, new_height); + FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); frame_default_tool_bar_height = new_height; /* Always do that now. */ clear_glyph_matrix (w->desired_matrix); @@ -12949,7 +12951,7 @@ redisplay_tool_bar (struct frame *f) if (change_height_p) { - x_change_tool_bar_height (f, new_height); + FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); frame_default_tool_bar_height = new_height; clear_glyph_matrix (w->desired_matrix); f->n_tool_bar_rows = nrows; @@ -13159,7 +13161,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) clear_mouse_face (hlinfo); /* Mouse is down, but on different tool-bar item? */ - mouse_down_p = (x_mouse_grabbed (dpyinfo) + mouse_down_p = (gui_mouse_grabbed (dpyinfo) && f == dpyinfo->last_mouse_frame); if (mouse_down_p && f->last_tool_bar_item != prop_idx) @@ -14491,10 +14493,10 @@ redisplay_internal (void) && garbaged_frame_retries++ < MAX_GARBAGED_FRAME_RETRIES) goto retry; -#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_NS) - x_clear_under_internal_border (f); -#endif /* HAVE_WINDOW_SYSTEM && !HAVE_NS */ - +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_RIF (f)->clear_under_internal_border) + FRAME_RIF (f)->clear_under_internal_border (f); +#endif /* Prevent various kinds of signals during display update. stdio is not robust about handling signals, which can cause an apparent I/O error. */ @@ -30025,13 +30027,13 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) #ifndef HAVE_EXT_TOOL_BAR if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); + FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->text_cursor); else #endif if (draw == DRAW_MOUSE_FACE) - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); + FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->hand_cursor); else - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); + FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->nontext_cursor); } #endif /* HAVE_WINDOW_SYSTEM */ } @@ -30973,25 +30975,25 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) if (!NILP (pointer)) { if (EQ (pointer, Qarrow)) - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; else if (EQ (pointer, Qhand)) - cursor = FRAME_X_OUTPUT (f)->hand_cursor; + cursor = FRAME_OUTPUT_DATA (f)->hand_cursor; else if (EQ (pointer, Qtext)) - cursor = FRAME_X_OUTPUT (f)->text_cursor; + cursor = FRAME_OUTPUT_DATA (f)->text_cursor; else if (EQ (pointer, intern ("hdrag"))) - cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; else if (EQ (pointer, intern ("nhdrag"))) - cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor; # ifdef HAVE_X_WINDOWS else if (EQ (pointer, intern ("vdrag"))) cursor = FRAME_DISPLAY_INFO (f)->vertical_scroll_bar_cursor; # endif else if (EQ (pointer, intern ("hourglass"))) - cursor = FRAME_X_OUTPUT (f)->hourglass_cursor; + cursor = FRAME_OUTPUT_DATA (f)->hourglass_cursor; else if (EQ (pointer, Qmodeline)) - cursor = FRAME_X_OUTPUT (f)->modeline_cursor; + cursor = FRAME_OUTPUT_DATA (f)->modeline_cursor; else - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; } if (cursor != No_Cursor) @@ -31143,7 +31145,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (STRINGP (string)) { - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; if (NILP (pointer)) pointer = Fget_text_property (pos, Qpointer, string); @@ -31158,13 +31160,13 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (!KEYMAPP (map)) map = Fget_text_property (pos, Qkeymap, string); if (!KEYMAPP (map) && draggable && area == ON_MODE_LINE) - cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor; } } else if (draggable && area == ON_MODE_LINE) - cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor; else - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; } #endif } @@ -31373,41 +31375,41 @@ note_mouse_highlight (struct frame *f, int x, int y) switch (part) { case INTERNAL_BORDER_NONE: - if (cursor != FRAME_X_OUTPUT (f)->nontext_cursor) + if (cursor != FRAME_OUTPUT_DATA (f)->nontext_cursor) /* Reset cursor. */ - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; break; case INTERNAL_BORDER_LEFT_EDGE: - cursor = FRAME_X_OUTPUT (f)->left_edge_cursor; + cursor = FRAME_OUTPUT_DATA (f)->left_edge_cursor; break; case INTERNAL_BORDER_TOP_LEFT_CORNER: - cursor = FRAME_X_OUTPUT (f)->top_left_corner_cursor; + cursor = FRAME_OUTPUT_DATA (f)->top_left_corner_cursor; break; case INTERNAL_BORDER_TOP_EDGE: - cursor = FRAME_X_OUTPUT (f)->top_edge_cursor; + cursor = FRAME_OUTPUT_DATA (f)->top_edge_cursor; break; case INTERNAL_BORDER_TOP_RIGHT_CORNER: - cursor = FRAME_X_OUTPUT (f)->top_right_corner_cursor; + cursor = FRAME_OUTPUT_DATA (f)->top_right_corner_cursor; break; case INTERNAL_BORDER_RIGHT_EDGE: - cursor = FRAME_X_OUTPUT (f)->right_edge_cursor; + cursor = FRAME_OUTPUT_DATA (f)->right_edge_cursor; break; case INTERNAL_BORDER_BOTTOM_RIGHT_CORNER: - cursor = FRAME_X_OUTPUT (f)->bottom_right_corner_cursor; + cursor = FRAME_OUTPUT_DATA (f)->bottom_right_corner_cursor; break; case INTERNAL_BORDER_BOTTOM_EDGE: - cursor = FRAME_X_OUTPUT (f)->bottom_edge_cursor; + cursor = FRAME_OUTPUT_DATA (f)->bottom_edge_cursor; break; case INTERNAL_BORDER_BOTTOM_LEFT_CORNER: - cursor = FRAME_X_OUTPUT (f)->bottom_left_corner_cursor; + cursor = FRAME_OUTPUT_DATA (f)->bottom_left_corner_cursor; break; default: /* This should not happen. */ - if (cursor != FRAME_X_OUTPUT (f)->nontext_cursor) - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + if (cursor != FRAME_OUTPUT_DATA (f)->nontext_cursor) + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; } - if (cursor != FRAME_X_OUTPUT (f)->nontext_cursor) + if (cursor != FRAME_OUTPUT_DATA (f)->nontext_cursor) { /* Do we really want a help echo here? */ help_echo_string = build_string ("drag-mouse-1: resize frame"); @@ -31443,7 +31445,7 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; /* Show non-text cursor (Bug#16647). */ goto set_cursor; } @@ -31455,13 +31457,13 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM if (part == ON_VERTICAL_BORDER) { - cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; help_echo_string = build_string ("drag-mouse-1: resize"); goto set_cursor; } else if (part == ON_RIGHT_DIVIDER) { - cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->horizontal_drag_cursor; help_echo_string = build_string ("drag-mouse-1: resize"); goto set_cursor; } @@ -31470,18 +31472,18 @@ note_mouse_highlight (struct frame *f, int x, int y) || minibuf_level || NILP (Vresize_mini_windows)) { - cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; + cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor; help_echo_string = build_string ("drag-mouse-1: resize"); goto set_cursor; } else - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE || part == ON_VERTICAL_SCROLL_BAR || part == ON_HORIZONTAL_SCROLL_BAR) - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; else - cursor = FRAME_X_OUTPUT (f)->text_cursor; + cursor = FRAME_OUTPUT_DATA (f)->text_cursor; #endif /* Are we in a window whose display is up to date? @@ -31572,7 +31574,7 @@ note_mouse_highlight (struct frame *f, int x, int y) { #ifdef HAVE_WINDOW_SYSTEM if (area != TEXT_AREA) - cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; else pointer = Vvoid_text_area_pointer; #endif diff --git a/src/xfaces.c b/src/xfaces.c index 13c979db63..925c3d54ff 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -338,7 +338,7 @@ struct named_merge_point; static struct face *realize_face (struct face_cache *, Lisp_Object *, int); -static struct face *realize_x_face (struct face_cache *, Lisp_Object *); +static struct face *realize_gui_face (struct face_cache *, Lisp_Object *); static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); static bool realize_basic_faces (struct frame *); static bool realize_default_face (struct frame *); @@ -772,13 +772,13 @@ load_pixmap (struct frame *f, Lisp_Object name) h = XFIXNUM (Fcar (Fcdr (name))); bits = Fcar (Fcdr (Fcdr (name))); - bitmap_id = x_create_bitmap_from_data (f, SSDATA (bits), - w, h); + bitmap_id = image_create_bitmap_from_data (f, SSDATA (bits), + w, h); } else { /* It must be a string -- a file name. */ - bitmap_id = x_create_bitmap_from_file (f, name); + bitmap_id = image_create_bitmap_from_file (f, name); } unblock_input (); @@ -1183,7 +1183,7 @@ load_face_colors (struct frame *f, struct face *face, if (!face_color_supported_p (f, SSDATA (bg), false) && !NILP (Fbitmap_spec_p (Vface_default_stipple))) { - x_destroy_bitmap (f, face->stipple); + image_destroy_bitmap (f, face->stipple); face->stipple = load_pixmap (f, Vface_default_stipple); } @@ -3476,8 +3476,8 @@ ordinary `x-get-resource' doesn't take a frame argument. */) CHECK_STRING (class); f = decode_live_frame (frame); block_input (); - value = display_x_get_resource (FRAME_DISPLAY_INFO (f), - resource, class, Qnil, Qnil); + value = gui_display_get_resource (FRAME_DISPLAY_INFO (f), + resource, class, Qnil, Qnil); unblock_input (); return value; } @@ -4145,7 +4145,7 @@ free_realized_face (struct frame *f, struct face *face) #ifdef HAVE_X_WINDOWS free_face_colors (f, face); #endif /* HAVE_X_WINDOWS */ - x_destroy_bitmap (f, face->stipple); + image_destroy_bitmap (f, face->stipple); } #endif /* HAVE_WINDOW_SYSTEM */ @@ -4180,7 +4180,7 @@ prepare_face_for_display (struct frame *f, struct face *face) if (face->stipple) { xgcv.fill_style = FillOpaqueStippled; - xgcv.stipple = x_bitmap_pixmap (f, face->stipple); + xgcv.stipple = image_bitmap_pixmap (f, face->stipple); mask |= GCFillStyle | GCStipple; } #endif @@ -4791,9 +4791,9 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, (2) `close in spirit' to what the attributes specify, if not exact. */ static bool -x_supports_face_attributes_p (struct frame *f, - Lisp_Object attrs[LFACE_VECTOR_SIZE], - struct face *def_face) +gui_supports_face_attributes_p (struct frame *f, + Lisp_Object attrs[LFACE_VECTOR_SIZE], + struct face *def_face) { Lisp_Object *def_attrs = def_face->lface; @@ -5130,7 +5130,7 @@ face for italic. */) supports = tty_supports_face_attributes_p (f, attrs, def_face); #ifdef HAVE_WINDOW_SYSTEM else - supports = x_supports_face_attributes_p (f, attrs, def_face); + supports = gui_supports_face_attributes_p (f, attrs, def_face); #endif return supports ? Qt : Qnil; @@ -5450,7 +5450,7 @@ realize_default_face (struct frame *f) acceptable as a font for the default face (perhaps because auto-scaled fonts are rejected), so we must adjust the frame font. */ - x_set_font (f, LFACE_FONT (lface), Qnil); + gui_set_font (f, LFACE_FONT (lface), Qnil); } #endif return true; @@ -5516,7 +5516,7 @@ realize_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE], } if (FRAME_WINDOW_P (cache->f)) - face = realize_x_face (cache, attrs); + face = realize_gui_face (cache, attrs); else if (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f)) face = realize_tty_face (cache, attrs); else if (FRAME_INITIAL_P (cache->f)) @@ -5567,14 +5567,14 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object, /* Realize the fully-specified face with attributes ATTRS in face - cache CACHE for ASCII characters. Do it for X frame CACHE->f. If - the new face doesn't share font with the default face, a fontname - is allocated from the heap and set in `font_name' of the new face, - but it is not yet loaded here. Value is a pointer to the newly - created realized face. */ + cache CACHE for ASCII characters. Do it for GUI frame CACHE->f. + If the new face doesn't share font with the default face, a + fontname is allocated from the heap and set in `font_name' of the + new face, but it is not yet loaded here. Value is a pointer to the + newly created realized face. */ static struct face * -realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]) +realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]) { struct face *face = NULL; #ifdef HAVE_WINDOW_SYSTEM diff --git a/src/xfns.c b/src/xfns.c index ee3266e223..c4bdb3f5cf 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -978,7 +978,7 @@ xg_set_icon (struct frame *f, Lisp_Object file) bool result = false; Lisp_Object found; - found = x_find_image_file (file); + found = image_find_image_file (file); if (! NILP (found)) { @@ -1021,7 +1021,7 @@ xg_set_icon_from_xpm_data (struct frame *f, const char **data) #endif /* USE_GTK */ -/* Functions called only from `x_set_frame_param' +/* Functions called only from `gui_set_frame_parameters' to set individual parameters. If FRAME_X_WINDOW (f) is 0, @@ -1466,7 +1466,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) ? f->icon_name : f->name))); else - result = x_bitmap_icon (f, arg); + result = FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, arg); if (result) { @@ -2115,7 +2115,8 @@ x_default_scroll_bar_color_parameter (struct frame *f, struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); Lisp_Object tem; - tem = x_get_arg (dpyinfo, alist, prop, xprop, xclass, RES_TYPE_STRING); + tem = gui_display_get_arg (dpyinfo, alist, prop, xprop, xclass, + RES_TYPE_STRING); if (EQ (tem, Qunbound)) { #ifdef USE_TOOLKIT_SCROLL_BARS @@ -2125,7 +2126,7 @@ x_default_scroll_bar_color_parameter (struct frame *f, AUTO_STRING (foreground, "foreground"); AUTO_STRING (background, "foreground"); AUTO_STRING (verticalScrollBar, "verticalScrollBar"); - tem = (display_x_get_resource + tem = (gui_display_get_resource (dpyinfo, foreground_p ? foreground : background, empty_unibyte_string, verticalScrollBar, @@ -2148,7 +2149,7 @@ x_default_scroll_bar_color_parameter (struct frame *f, } AUTO_FRAME_ARG (arg, prop, tem); - x_set_frame_parameters (f, arg); + gui_set_frame_parameters (f, arg); return tem; } @@ -3257,8 +3258,8 @@ x_icon_verify (struct frame *f, Lisp_Object parms) /* Set the position of the icon. Note that twm groups all icons in an icon window. */ - icon_x = x_frame_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); - icon_y = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); + icon_x = gui_frame_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); + icon_y = gui_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) { CHECK_FIXNUM (icon_x); @@ -3278,9 +3279,9 @@ x_icon (struct frame *f, Lisp_Object parms) /* Set the position of the icon. Note that twm groups all icons in an icon window. */ Lisp_Object icon_x - = x_frame_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); + = gui_frame_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); Lisp_Object icon_y - = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); + = gui_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) { CHECK_TYPE_RANGED_INTEGER (int, icon_x); @@ -3294,12 +3295,13 @@ x_icon (struct frame *f, Lisp_Object parms) if (! EQ (icon_x, Qunbound)) x_wm_set_icon_position (f, XFIXNUM (icon_x), XFIXNUM (icon_y)); -#if false /* x_get_arg removes the visibility parameter as a side effect, - but x_create_frame still needs it. */ +#if false /* gui_display_get_arg removes the visibility parameter as a + side effect, but x_create_frame still needs it. */ /* Start up iconic or window? */ struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); x_wm_set_window_state - (f, (EQ (x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL), + (f, (EQ (gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0, + RES_TYPE_SYMBOL), Qicon) ? IconicState : NormalState)); @@ -3407,7 +3409,7 @@ x_free_gcs (struct frame *f) /* Handler for signals raised during x_create_frame and - x_create_tip_frame. FRAME is the frame which is partially + Fx_create_tip_frame. FRAME is the frame which is partially constructed. */ static Lisp_Object @@ -3417,7 +3419,7 @@ unwind_create_frame (Lisp_Object frame) /* If frame is already dead, nothing to do. This can happen if the display is disconnected after the frame has become official, but - before x_create_frame removes the unwind protect. */ + before Fx_create_frame removes the unwind protect. */ if (!FRAME_LIVE_P (f)) return Qnil; @@ -3463,8 +3465,8 @@ static void x_default_font_parameter (struct frame *f, Lisp_Object parms) { struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL, - RES_TYPE_STRING); + Lisp_Object font_param = gui_display_get_arg (dpyinfo, parms, Qfont, NULL, NULL, + RES_TYPE_STRING); Lisp_Object font = Qnil; if (EQ (font_param, Qunbound)) font_param = Qnil; @@ -3481,7 +3483,8 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) if (NILP (font)) font = !NILP (font_param) ? font_param - : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); + : gui_display_get_arg (dpyinfo, parms, Qfont, "font", "Font", + RES_TYPE_STRING); if (! FONTP (font) && ! STRINGP (font)) { @@ -3518,11 +3521,11 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) /* Remember the explicit font parameter, so we can re-apply it after we've applied the `default' face settings. */ AUTO_FRAME_ARG (arg, Qfont_parameter, font_param); - x_set_frame_parameters (f, arg); + gui_set_frame_parameters (f, arg); } /* This call will make X resources override any system font setting. */ - x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); } @@ -3592,9 +3595,11 @@ This function is an internal primitive--use `make-frame' instead. */) 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_NUMBER); + display = gui_display_get_arg (dpyinfo, parms, Qterminal, 0, 0, + RES_TYPE_NUMBER); if (EQ (display, Qunbound)) - display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING); + display = gui_display_get_arg (dpyinfo, parms, Qdisplay, 0, 0, + RES_TYPE_STRING); if (EQ (display, Qunbound)) display = Qnil; dpyinfo = check_x_display_info (display); @@ -3603,7 +3608,8 @@ This function is an internal primitive--use `make-frame' instead. */) if (!dpyinfo->terminal->name) error ("Terminal is not live, can't create new frames on it"); - name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING); + name = gui_display_get_arg (dpyinfo, parms, Qname, "name", "Name", + RES_TYPE_STRING); if (!STRINGP (name) && ! EQ (name, Qunbound) && ! NILP (name)) @@ -3613,15 +3619,17 @@ This function is an internal primitive--use `make-frame' instead. */) Vx_resource_name = name; /* See if parent window is specified. */ - parent = x_get_arg (dpyinfo, parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER); + parent = gui_display_get_arg (dpyinfo, parms, Qparent_id, NULL, NULL, + RES_TYPE_NUMBER); if (EQ (parent, Qunbound)) parent = Qnil; if (! NILP (parent)) CHECK_FIXNUM (parent); 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)) @@ -3634,8 +3642,12 @@ This function is an internal primitive--use `make-frame' instead. */) else f = make_frame (true); - 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) @@ -3648,16 +3660,24 @@ This function is an internal primitive--use `make-frame' instead. */) fset_parent_frame (f, parent_frame); store_frame_param (f, Qparent_frame, parent_frame); - if (!NILP (tem = (x_get_arg (dpyinfo, parms, Qundecorated, NULL, NULL, - RES_TYPE_BOOLEAN))) + if (!NILP (tem = (gui_display_get_arg (dpyinfo, + parms, + Qundecorated, + NULL, + NULL, + RES_TYPE_BOOLEAN))) && !(EQ (tem, Qunbound))) undecorated = true; FRAME_UNDECORATED (f) = undecorated; store_frame_param (f, Qundecorated, undecorated ? Qt : Qnil); - if (!NILP (tem = (x_get_arg (dpyinfo, parms, Qoverride_redirect, NULL, NULL, - RES_TYPE_BOOLEAN))) + if (!NILP (tem = (gui_display_get_arg (dpyinfo, + parms, + Qoverride_redirect, + NULL, + NULL, + RES_TYPE_BOOLEAN))) && !(EQ (tem, Qunbound))) override_redirect = true; @@ -3681,9 +3701,12 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.x->white_relief.pixel = -1; f->output_data.x->black_relief.pixel = -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); @@ -3768,8 +3791,8 @@ This function is an internal primitive--use `make-frame' instead. */) dpyinfo_refcount = dpyinfo->reference_count; #endif /* GLYPH_DEBUG */ - 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); /* Extract the window parameters from the supplied values that are needed to determine window geometry. */ @@ -3782,8 +3805,8 @@ This function is an internal primitive--use `make-frame' instead. */) /* Frame contents get displaced if an embedded X window has a border. */ if (! FRAME_X_EMBEDDED_P (f)) - x_default_parameter (f, parms, Qborder_width, make_fixnum (0), - "borderWidth", "BorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), + "borderWidth", "BorderWidth", RES_TYPE_NUMBER); /* This defaults to 1 in order to match xterm. We recognize either internalBorderWidth or internalBorder (which is what xterm calls @@ -3792,54 +3815,55 @@ This function is an internal primitive--use `make-frame' instead. */) { Lisp_Object value; - value = x_get_arg (dpyinfo, parms, Qinternal_border_width, - "internalBorder", "internalBorder", RES_TYPE_NUMBER); + value = gui_display_get_arg (dpyinfo, parms, Qinternal_border_width, + "internalBorder", "internalBorder", + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qinternal_border_width, value), parms); } - x_default_parameter (f, parms, Qinternal_border_width, + gui_default_parameter (f, parms, Qinternal_border_width, #ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */ - make_fixnum (0), + make_fixnum (0), #else - make_fixnum (1), + make_fixnum (1), #endif - "internalBorderWidth", "internalBorderWidth", - RES_TYPE_NUMBER); - x_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), - NULL, NULL, RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qvertical_scroll_bars, + "internalBorderWidth", "internalBorderWidth", + RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), + NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), + NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qvertical_scroll_bars, #if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) - Qright, + Qright, #else - Qleft, + Qleft, #endif - "verticalScrollBars", "ScrollBars", - RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil, - "horizontalScrollBars", "ScrollBars", - RES_TYPE_SYMBOL); + "verticalScrollBars", "ScrollBars", + RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil, + "horizontalScrollBars", "ScrollBars", + RES_TYPE_SYMBOL); /* Also do the stuff which must be set before the window exists. */ - 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, Qmouse_color, build_string ("black"), - "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qborder_color, build_string ("black"), - "borderColor", "BorderColor", RES_TYPE_STRING); - x_default_parameter (f, parms, Qscreen_gamma, Qnil, - "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); - 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, 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, Qmouse_color, build_string ("black"), + "pointerColor", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qborder_color, build_string ("black"), + "borderColor", "BorderColor", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qscreen_gamma, Qnil, + "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); + 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); x_default_scroll_bar_color_parameter (f, parms, Qscroll_bar_foreground, "scrollBarForeground", @@ -3848,7 +3872,7 @@ This function is an internal primitive--use `make-frame' instead. */) "scrollBarBackground", "ScrollBarBackground", false); - /* Init faces before x_default_parameter is called for the + /* Init faces before gui_default_parameter is called for the scroll-bar-width parameter because otherwise we end up in init_iterator with a null face cache, which should not happen. */ init_frame_faces (f); @@ -3865,10 +3889,12 @@ This function is an internal primitive--use `make-frame' instead. */) Also process `min-width' and `min-height' parameters right here because `frame-windows-min-size' needs them. */ - 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), @@ -3880,32 +3906,34 @@ This function is an internal primitive--use `make-frame' instead. */) here; they are processed specially at startup, and reflected in the values of the mode variables. */ - 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); - x_default_parameter (f, parms, Qwait_for_wm, Qt, - "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qtool_bar_position, - FRAME_TOOL_BAR_POSITION (f), 0, 0, RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qinhibit_double_buffering, Qnil, - "inhibitDoubleBuffering", "InhibitDoubleBuffering", - RES_TYPE_BOOLEAN); + 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); + gui_default_parameter (f, parms, Qwait_for_wm, Qt, + "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qtool_bar_position, + FRAME_TOOL_BAR_POSITION (f), 0, 0, RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qinhibit_double_buffering, Qnil, + "inhibitDoubleBuffering", "InhibitDoubleBuffering", + RES_TYPE_BOOLEAN); /* Compute the size of the X window. */ - 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, Qt); x_icon_verify (f, parms); @@ -3927,23 +3955,23 @@ This function is an internal primitive--use `make-frame' instead. */) /* We need to do this after creating the X window, so that the icon-creation functions can say whose icon they're describing. */ - x_default_parameter (f, parms, Qicon_type, Qt, - "bitmapIcon", "BitmapIcon", RES_TYPE_BOOLEAN); - - x_default_parameter (f, parms, Qauto_raise, Qnil, - "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qauto_lower, Qnil, - "autoLower", "AutoRaiseLower", 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); + gui_default_parameter (f, parms, Qicon_type, Qt, + "bitmapIcon", "BitmapIcon", RES_TYPE_BOOLEAN); + + gui_default_parameter (f, parms, Qauto_raise, Qnil, + "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qauto_lower, Qnil, + "autoLower", "AutoRaiseLower", 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); if (!NILP (parent_frame)) { @@ -3955,10 +3983,10 @@ This function is an internal primitive--use `make-frame' instead. */) unblock_input (); } - 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, Qno_focus_on_map, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qno_accept_focus, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); #if defined (USE_X_TOOLKIT) || defined (USE_GTK) /* Create the menu bar. */ @@ -3979,7 +4007,7 @@ This function is an internal primitive--use `make-frame' instead. */) #endif /* USE_X_TOOLKIT || USE_GTK */ /* Consider frame official, now. */ - f->can_x_set_window_size = true; + f->can_set_window_size = true; if (x_width > 0) SET_FRAME_WIDTH (f, x_width); @@ -3999,8 +4027,8 @@ This function is an internal primitive--use `make-frame' instead. */) /* Process fullscreen parameter here in the hope that normalizing a fullheight/fullwidth frame will produce the size set by the last adjust_frame_size call. */ - x_default_parameter (f, parms, Qfullscreen, Qnil, - "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qfullscreen, Qnil, + "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); /* Make the window appear on the frame and enable display, unless the caller says not to. However, with explicit parent, Emacs @@ -4008,7 +4036,8 @@ This function is an internal primitive--use `make-frame' instead. */) if (!f->output_data.x->explicit_parent) { Lisp_Object visibility - = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL); + = gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0, + RES_TYPE_SYMBOL); if (EQ (visibility, Qicon)) x_iconify_frame (f); @@ -4043,11 +4072,11 @@ This function is an internal primitive--use `make-frame' instead. */) unblock_input (); /* Works iff frame has been already mapped. */ - x_default_parameter (f, parms, Qskip_taskbar, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qskip_taskbar, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); /* The `z-group' parameter works only for visible frames. */ - x_default_parameter (f, parms, Qz_group, Qnil, - NULL, NULL, RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qz_group, Qnil, + NULL, NULL, RES_TYPE_SYMBOL); /* Initialize `default-minibuffer-frame' in case this is the first frame on this terminal. */ @@ -4056,8 +4085,9 @@ This function is an internal primitive--use `make-frame' instead. */) || !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)); @@ -4069,60 +4099,6 @@ This function is an internal primitive--use `make-frame' instead. */) return unbind_to (count, frame); } - -/* FRAME is used only to get a handle on the X display. We don't pass the - display info directly because we're called from frame.c, which doesn't - know about that structure. */ - -Lisp_Object -x_get_focus_frame (struct frame *frame) -{ - struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); - Lisp_Object xfocus; - if (! dpyinfo->x_focus_frame) - return Qnil; - - XSETFRAME (xfocus, dpyinfo->x_focus_frame); - return xfocus; -} - - -/* In certain situations, when the window manager follows a - click-to-focus policy, there seems to be no way around calling - XSetInputFocus to give another frame the input focus . - - In an ideal world, XSetInputFocus should generally be avoided so - that applications don't interfere with the window manager's focus - policy. But I think it's okay to use when it's clearly done - following a user-command. */ - -void -x_focus_frame (struct frame *f, bool noactivate) -{ - Display *dpy = FRAME_X_DISPLAY (f); - - block_input (); - x_catch_errors (dpy); - - if (FRAME_X_EMBEDDED_P (f)) - { - /* For Xembedded frames, normally the embedder forwards key - events. See XEmbed Protocol Specification at - http://freedesktop.org/wiki/Specifications/xembed-spec */ - xembed_request_focus (f); - } - else - { - XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - RevertToParent, CurrentTime); - if (!noactivate) - x_ewmh_activate_frame (f); - } - - x_uncatch_errors (); - unblock_input (); -} - DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* Internal function called by `color-defined-p'. @@ -5529,8 +5505,8 @@ select_visual (struct x_display_info *dpyinfo) /* See if a visual is specified. */ AUTO_STRING (visualClass, "visualClass"); AUTO_STRING (VisualClass, "VisualClass"); - Lisp_Object value = display_x_get_resource (dpyinfo, visualClass, - VisualClass, Qnil, Qnil); + Lisp_Object value = gui_display_get_resource (dpyinfo, visualClass, + VisualClass, Qnil, Qnil); if (STRINGP (value)) { @@ -6116,7 +6092,7 @@ unwind_create_tip_frame (Lisp_Object frame) PARMS is a list of frame parameters. TEXT is the string to display in the tip frame. Value is the frame. - Note that functions called here, esp. x_default_parameter can + Note that functions called here, esp. gui_default_parameter can signal errors, for instance when a specified color name is undefined. We have to make sure that we're in a consistent state when this happens. */ @@ -6138,7 +6114,8 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) parms = Fcopy_alist (parms); /* Get the name of the frame to use for resource lookup. */ - name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING); + name = gui_display_get_arg (dpyinfo, parms, Qname, "name", "Name", + RES_TYPE_STRING); if (!STRINGP (name) && !EQ (name, Qunbound) && !NILP (name)) @@ -6239,15 +6216,15 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) dpyinfo_refcount = dpyinfo->reference_count; #endif /* GLYPH_DEBUG */ - 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); /* Extract the window parameters from the supplied values that are needed to determine window geometry. */ x_default_font_parameter (f, parms); - x_default_parameter (f, parms, Qborder_width, make_fixnum (0), - "borderWidth", "BorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), + "borderWidth", "BorderWidth", RES_TYPE_NUMBER); /* This defaults to 2 in order to match xterm. We recognize either internalBorderWidth or internalBorder (which is what xterm calls @@ -6256,43 +6233,44 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) { Lisp_Object value; - value = x_get_arg (dpyinfo, parms, Qinternal_border_width, - "internalBorder", "internalBorder", RES_TYPE_NUMBER); + value = gui_display_get_arg (dpyinfo, parms, Qinternal_border_width, + "internalBorder", "internalBorder", + RES_TYPE_NUMBER); if (! EQ (value, Qunbound)) parms = Fcons (Fcons (Qinternal_border_width, value), parms); } - x_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1), - "internalBorderWidth", "internalBorderWidth", - RES_TYPE_NUMBER); - x_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), - NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1), + "internalBorderWidth", "internalBorderWidth", + RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), + NULL, NULL, RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), + NULL, NULL, RES_TYPE_NUMBER); /* Also do the stuff which must be set before the window exists. */ - 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, Qmouse_color, build_string ("black"), - "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qcursor_color, build_string ("black"), - "cursorColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qborder_color, build_string ("black"), - "borderColor", "BorderColor", RES_TYPE_STRING); - x_default_parameter (f, parms, Qno_special_glyphs, Qnil, - NULL, NULL, RES_TYPE_BOOLEAN); - - /* Init faces before x_default_parameter is called for the + 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, Qmouse_color, build_string ("black"), + "pointerColor", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qcursor_color, build_string ("black"), + "cursorColor", "Foreground", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qborder_color, build_string ("black"), + "borderColor", "BorderColor", RES_TYPE_STRING); + gui_default_parameter (f, parms, Qno_special_glyphs, Qnil, + NULL, NULL, RES_TYPE_BOOLEAN); + + /* Init faces before gui_default_parameter is called for the scroll-bar-width parameter because otherwise we end up in init_iterator with a null face cache, which should not happen. */ init_frame_faces (f); f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; - x_figure_window_size (f, parms, false, &x_width, &x_height); + gui_figure_window_size (f, parms, false, &x_width, &x_height); { XSetWindowAttributes attrs; @@ -6335,14 +6313,14 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) x_make_gc (f); - x_default_parameter (f, parms, Qauto_raise, Qnil, - "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qauto_lower, Qnil, - "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); - x_default_parameter (f, parms, Qcursor_type, Qbox, - "cursorType", "CursorType", RES_TYPE_SYMBOL); - x_default_parameter (f, parms, Qalpha, Qnil, - "alpha", "Alpha", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qauto_raise, Qnil, + "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qauto_lower, Qnil, + "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); + gui_default_parameter (f, parms, Qcursor_type, Qbox, + "cursorType", "CursorType", RES_TYPE_SYMBOL); + gui_default_parameter (f, parms, Qalpha, Qnil, + "alpha", "Alpha", RES_TYPE_NUMBER); /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size. Change will not be effected unless different from the current @@ -6413,7 +6391,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) below. And the frame needs to be on Vframe_list or making it visible won't work. */ Vframe_list = Fcons (frame, Vframe_list); - f->can_x_set_window_size = true; + f->can_set_window_size = true; /* Setting attributes of faces of the tooltip frame from resources and similar will set face_change, which leads to the clearing of @@ -7599,41 +7577,41 @@ visible. */) frame_parm_handler x_frame_parm_handlers[] = { - x_set_autoraise, - x_set_autolower, + gui_set_autoraise, + gui_set_autolower, x_set_background_color, x_set_border_color, - x_set_border_width, + gui_set_border_width, x_set_cursor_color, x_set_cursor_type, - x_set_font, + gui_set_font, x_set_foreground_color, x_set_icon_name, x_set_icon_type, x_set_internal_border_width, - x_set_right_divider_width, - x_set_bottom_divider_width, + gui_set_right_divider_width, + gui_set_bottom_divider_width, x_set_menu_bar_lines, x_set_mouse_color, x_explicitly_set_name, - x_set_scroll_bar_width, - x_set_scroll_bar_height, + gui_set_scroll_bar_width, + gui_set_scroll_bar_height, x_set_title, - x_set_unsplittable, - x_set_vertical_scroll_bars, - x_set_horizontal_scroll_bars, - x_set_visibility, + gui_set_unsplittable, + gui_set_vertical_scroll_bars, + gui_set_horizontal_scroll_bars, + gui_set_visibility, x_set_tool_bar_lines, x_set_scroll_bar_foreground, x_set_scroll_bar_background, - x_set_screen_gamma, - x_set_line_spacing, - x_set_left_fringe, - x_set_right_fringe, + gui_set_screen_gamma, + gui_set_line_spacing, + gui_set_left_fringe, + gui_set_right_fringe, x_set_wait_for_wm, - x_set_fullscreen, - x_set_font_backend, - x_set_alpha, + gui_set_fullscreen, + gui_set_font_backend, + gui_set_alpha, x_set_sticky, x_set_tool_bar_position, x_set_inhibit_double_buffering, @@ -7644,7 +7622,7 @@ frame_parm_handler x_frame_parm_handlers[] = x_set_no_accept_focus, x_set_z_group, x_set_override_redirect, - x_set_no_special_glyphs, + gui_set_no_special_glyphs, }; void diff --git a/src/xrdb.c b/src/xrdb.c index 0950b70669..9c625e9821 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -60,12 +60,12 @@ x_get_customization_string (XrmDatabase db, const char *name, { char *full_name = alloca (strlen (name) + sizeof "customization" + 3); char *full_class = alloca (strlen (class) + sizeof "Customization" + 3); - char *result; + const char *result; sprintf (full_name, "%s.%s", name, "customization"); sprintf (full_class, "%s.%s", class, "Customization"); - result = x_get_string_resource (db, full_name, full_class); + result = x_get_string_resource (&db, full_name, full_class); return result ? xstrdup (result) : NULL; } @@ -547,19 +547,20 @@ x_get_resource (XrmDatabase rdb, const char *name, const char *class, /* Retrieve the string resource specified by NAME with CLASS from database RDB. */ -char * -x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) +const char * +x_get_string_resource (void *v_rdb, const char *name, const char *class) { + XrmDatabase *rdb = v_rdb; XrmValue value; if (inhibit_x_resources) /* --quick was passed, so this is a no-op. */ return NULL; - if (x_get_resource (rdb, name, class, x_rm_string, &value)) - return (char *) value.addr; + if (x_get_resource (*rdb, name, class, x_rm_string, &value)) + return (const char *) value.addr; - return 0; + return NULL; } /* Stand-alone test facilities. */ @@ -648,7 +649,7 @@ main (int argc, char **argv) printf ("Class: "); gets (query_class); - value = x_get_string_resource (xdb, query_name, query_class); + value = x_get_string_resource (&xdb, query_name, query_class); if (value != NULL) printf ("\t%s(%s): %s\n\n", query_name, query_class, value); diff --git a/src/xterm.c b/src/xterm.c index 69f9afddbc..a89f13955d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -405,7 +405,7 @@ x_set_cr_source_with_gc_foreground (struct frame *f, GC gc) XGetGCValues (FRAME_X_DISPLAY (f), gc, GCForeground, &xgcv); color.pixel = xgcv.foreground; - x_query_color (f, &color); + x_query_colors (f, &color, 1); cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0); } @@ -418,7 +418,7 @@ x_set_cr_source_with_gc_background (struct frame *f, GC gc) XGetGCValues (FRAME_X_DISPLAY (f), gc, GCBackground, &xgcv); color.pixel = xgcv.background; - x_query_color (f, &color); + x_query_colors (f, &color, 1); cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0); } @@ -906,7 +906,7 @@ x_find_topmost_parent (struct frame *f) #define OPAQUE 0xffffffff -void +static void x_set_frame_alpha (struct frame *f) { struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); @@ -2326,16 +2326,6 @@ x_query_colors (struct frame *f, XColor *colors, int ncolors) } -/* On frame F, translate pixel color to RGB values for the color in - COLOR. Use cached information, if available. */ - -void -x_query_color (struct frame *f, XColor *color) -{ - x_query_colors (f, color, 1); -} - - /* On frame F, translate the color name to RGB values. Use cached information, if possible. @@ -2499,7 +2489,7 @@ x_copy_color (struct frame *f, unsigned long pixel) color.pixel = pixel; block_input (); /* The color could still be found in the color_cells array. */ - x_query_color (f, &color); + x_query_colors (f, &color, 1); XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); unblock_input (); #ifdef DEBUG_X_COLORS @@ -2540,7 +2530,7 @@ x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, /* Get RGB color values. */ color.pixel = *pixel; - x_query_color (f, &color); + x_query_colors (f, &color, 1); /* Change RGB values by specified FACTOR. Avoid overflow! */ eassert (factor >= 0); @@ -4925,7 +4915,7 @@ x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, intmax_t state) /* Convert a keysym to its name. */ char * -x_get_keysym_name (int keysym) +get_keysym_name (int keysym) { char *value; @@ -5131,7 +5121,7 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, x_catch_errors (FRAME_X_DISPLAY (*fp)); - if (x_mouse_grabbed (dpyinfo)) + if (gui_mouse_grabbed (dpyinfo)) { /* If mouse was grabbed on a frame, give coords for that frame even if the mouse is now outside it. */ @@ -8159,7 +8149,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (event->xunmap.window == tip_window) { tip_window = None; - x_redo_mouse_highlight (dpyinfo); + gui_redo_mouse_highlight (dpyinfo); } f = x_top_window_to_frame (dpyinfo, event->xunmap.window); @@ -8646,7 +8636,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, previous_help_echo_string = help_echo_string; help_echo_string = Qnil; - f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + f = (gui_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame : x_window_to_frame (dpyinfo, event->xmotion.window)); if (hlinfo->mouse_face_hidden) @@ -8893,7 +8883,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, dpyinfo->last_mouse_glyph_frame = NULL; x_display_set_last_user_time (dpyinfo, event->xbutton.time); - if (x_mouse_grabbed (dpyinfo)) + if (gui_mouse_grabbed (dpyinfo)) f = dpyinfo->last_mouse_frame; else { @@ -9526,7 +9516,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, /* Make the x-window of frame F use the gnu icon bitmap. */ -bool +static bool x_bitmap_icon (struct frame *f, Lisp_Object file) { ptrdiff_t bitmap_id; @@ -9536,7 +9526,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file) /* Free up our existing icon bitmap and mask if any. */ if (f->output_data.x->icon_bitmap > 0) - x_destroy_bitmap (f, f->output_data.x->icon_bitmap); + image_destroy_bitmap (f, f->output_data.x->icon_bitmap); f->output_data.x->icon_bitmap = 0; if (STRINGP (file)) @@ -9547,7 +9537,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file) if (xg_set_icon (f, file)) return false; #endif /* USE_GTK */ - bitmap_id = x_create_bitmap_from_file (f, file); + bitmap_id = image_create_bitmap_from_file (f, file); x_create_bitmap_mask (f, bitmap_id); } else @@ -9577,8 +9567,10 @@ x_bitmap_icon (struct frame *f, Lisp_Object file) /* If all else fails, use the (black and white) xbm image. */ if (rc == -1) { - rc = x_create_bitmap_from_data (f, (char *) gnu_xbm_bits, - gnu_xbm_width, gnu_xbm_height); + rc = image_create_bitmap_from_data (f, + (char *) gnu_xbm_bits, + gnu_xbm_width, + gnu_xbm_height); if (rc == -1) return true; @@ -9591,7 +9583,7 @@ x_bitmap_icon (struct frame *f, Lisp_Object file) this increments the ref-count one extra time. As a result, the GNU bitmap and mask are never freed. That way, we don't have to worry about allocating it again. */ - x_reference_bitmap (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id); + image_reference_bitmap (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id); bitmap_id = FRAME_DISPLAY_INFO (f)->icon_bitmap_id; } @@ -9622,7 +9614,7 @@ x_text_icon (struct frame *f, const char *icon_name) } if (f->output_data.x->icon_bitmap > 0) - x_destroy_bitmap (f, f->output_data.x->icon_bitmap); + image_destroy_bitmap (f, f->output_data.x->icon_bitmap); f->output_data.x->icon_bitmap = 0; x_wm_set_icon_pixmap (f, 0); @@ -9993,7 +9985,7 @@ x_io_error_quitter (Display *display) frame. If it is negative, generate a new fontset from FONT-OBJECT. */ -Lisp_Object +static Lisp_Object x_new_font (struct frame *f, Lisp_Object font_object, int fontset) { struct font *font = XFONT_OBJECT (font_object); @@ -10125,7 +10117,7 @@ xim_open_dpy (struct x_display_info *dpyinfo, char *resource_name) { if (dpyinfo->xim) XCloseIM (dpyinfo->xim); - xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, + xim = XOpenIM (dpyinfo->display, dpyinfo->rdb, resource_name, emacs_class); dpyinfo->xim = xim; @@ -10224,7 +10216,7 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name) xim_inst->dpyinfo = dpyinfo; xim_inst->resource_name = xstrdup (resource_name); ret = XRegisterIMInstantiateCallback - (dpyinfo->display, dpyinfo->xrdb, xim_inst->resource_name, + (dpyinfo->display, dpyinfo->rdb, xim_inst->resource_name, emacs_class, xim_instantiate_callback, /* This is XPointer in XFree86 but (XPointer *) on Tru64, at least, hence the configure test. */ @@ -10252,7 +10244,7 @@ xim_close_dpy (struct x_display_info *dpyinfo) if (dpyinfo->display) { Bool ret = XUnregisterIMInstantiateCallback - (dpyinfo->display, dpyinfo->xrdb, xim_inst->resource_name, + (dpyinfo->display, dpyinfo->rdb, xim_inst->resource_name, emacs_class, xim_instantiate_callback, (XRegisterIMInstantiateCallback_arg6) xim_inst); eassert (ret == True); @@ -10365,10 +10357,10 @@ x_calc_absolute_position (struct frame *f) /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, to really change the position, and 0 when calling from x_make_frame_visible (in that case, XOFF and YOFF are the current - position values). It is -1 when calling from x_set_frame_parameters, + position values). It is -1 when calling from gui_set_frame_parameters, which means, do adjust for borders but don't change the gravity. */ -void +static void x_set_offset (struct frame *f, register int xoff, register int yoff, int change_gravity) { int modified_top, modified_left; @@ -10781,7 +10773,7 @@ do_ewmh_fullscreen (struct frame *f) int cur; bool dummy; - get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); + x_get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ @@ -11249,7 +11241,7 @@ x_set_window_size_1 (struct frame *f, bool change_gravity, /* Try to restore fullscreen state. */ { store_frame_param (f, Qfullscreen, fullscreen); - x_set_fullscreen (f, fullscreen, fullscreen); + gui_set_fullscreen (f, fullscreen, fullscreen); } } else @@ -11343,7 +11335,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) /* Raise frame F. */ -void +static void x_raise_frame (struct frame *f) { block_input (); @@ -11367,9 +11359,18 @@ x_lower_frame (struct frame *f) } } +static void +XTframe_raise_lower (struct frame *f, bool raise_flag) +{ + if (raise_flag) + x_raise_frame (f); + else + x_lower_frame (f); +} + /* Request focus with XEmbed */ -void +static void xembed_request_focus (struct frame *f) { /* See XEmbed Protocol Specification at @@ -11381,7 +11382,7 @@ xembed_request_focus (struct frame *f) /* Activate frame with Extended Window Manager Hints */ -void +static void x_ewmh_activate_frame (struct frame *f) { /* See Window Manager Specification/Extended Window Manager Hints at @@ -11400,14 +11401,56 @@ x_ewmh_activate_frame (struct frame *f) } } +static Lisp_Object +x_get_focus_frame (struct frame *f) +{ + Lisp_Object lisp_focus; + + struct frame *focus = FRAME_DISPLAY_INFO (f)->x_focus_frame; + + if (!focus) + return Qnil; + + XSETFRAME (lisp_focus, focus); + return lisp_focus; +} + +/* In certain situations, when the window manager follows a + click-to-focus policy, there seems to be no way around calling + XSetInputFocus to give another frame the input focus . + + In an ideal world, XSetInputFocus should generally be avoided so + that applications don't interfere with the window manager's focus + policy. But I think it's okay to use when it's clearly done + following a user-command. */ + static void -XTframe_raise_lower (struct frame *f, bool raise_flag) +x_focus_frame (struct frame *f, bool noactivate) { - if (raise_flag) - x_raise_frame (f); + Display *dpy = FRAME_X_DISPLAY (f); + + block_input (); + x_catch_errors (dpy); + + if (FRAME_X_EMBEDDED_P (f)) + { + /* For Xembedded frames, normally the embedder forwards key + events. See XEmbed Protocol Specification at + http://freedesktop.org/wiki/Specifications/xembed-spec */ + xembed_request_focus (f); + } else - x_lower_frame (f); + { + XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + RevertToParent, CurrentTime); + if (!noactivate) + x_ewmh_activate_frame (f); + } + + x_uncatch_errors (); + unblock_input (); } + /* XEmbed implementation. */ @@ -11488,7 +11531,7 @@ x_make_frame_visible (struct frame *f) block_input (); - x_set_bitmap_icon (f); + gui_set_bitmap_icon (f); if (! FRAME_VISIBLE_P (f)) { @@ -11665,6 +11708,15 @@ x_make_frame_invisible (struct frame *f) unblock_input (); } +static void +x_make_frame_visible_invisible (struct frame *f, bool visible) +{ + if (visible) + x_make_frame_visible (f); + else + x_make_frame_invisible (f); +} + /* Change window state from mapped to iconified. */ void @@ -11683,7 +11735,7 @@ x_iconify_frame (struct frame *f) block_input (); - x_set_bitmap_icon (f); + gui_set_bitmap_icon (f); #if defined (USE_GTK) if (FRAME_GTK_OUTER_WIDGET (f)) @@ -12108,7 +12160,7 @@ x_wm_set_icon_pixmap (struct frame *f, ptrdiff_t pixmap_id) if (pixmap_id > 0) { - icon_pixmap = x_bitmap_pixmap (f, pixmap_id); + icon_pixmap = image_bitmap_pixmap (f, pixmap_id); f->output_data.x->wm_hints.icon_pixmap = icon_pixmap; icon_mask = x_bitmap_mask (f, pixmap_id); f->output_data.x->wm_hints.icon_mask = icon_mask; @@ -12682,7 +12734,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) #endif /* Put the rdb where we can find it in a way that works on all versions. */ - dpyinfo->xrdb = xrdb; + dpyinfo->rdb = xrdb; dpyinfo->screen = ScreenOfDisplay (dpyinfo->display, DefaultScreen (dpyinfo->display)); @@ -12713,8 +12765,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) AUTO_STRING (privateColormap, "privateColormap"); AUTO_STRING (PrivateColormap, "PrivateColormap"); Lisp_Object value - = display_x_get_resource (dpyinfo, privateColormap, - PrivateColormap, Qnil, Qnil); + = gui_display_get_resource (dpyinfo, privateColormap, + PrivateColormap, Qnil, Qnil); if (STRINGP (value) && (!strcmp (SSDATA (value), "true") || !strcmp (SSDATA (value), "on"))) @@ -12931,8 +12983,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { AUTO_STRING (synchronous, "synchronous"); AUTO_STRING (Synchronous, "Synchronous"); - Lisp_Object value = display_x_get_resource (dpyinfo, synchronous, - Synchronous, Qnil, Qnil); + Lisp_Object value = gui_display_get_resource (dpyinfo, synchronous, + Synchronous, Qnil, Qnil); if (STRINGP (value) && (!strcmp (SSDATA (value), "true") || !strcmp (SSDATA (value), "on"))) @@ -12942,8 +12994,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { AUTO_STRING (useXIM, "useXIM"); AUTO_STRING (UseXIM, "UseXIM"); - Lisp_Object value = display_x_get_resource (dpyinfo, useXIM, UseXIM, - Qnil, Qnil); + Lisp_Object value = gui_display_get_resource (dpyinfo, useXIM, UseXIM, + Qnil, Qnil); #ifdef USE_XIM if (STRINGP (value) && (!strcmp (SSDATA (value), "false") @@ -13074,6 +13126,8 @@ x_activate_timeout_atimer (void) /* Set up use of X before we make the first connection. */ +extern frame_parm_handler x_frame_parm_handlers[]; + static struct redisplay_interface x_redisplay_interface = { x_frame_parm_handlers, @@ -13101,6 +13155,7 @@ static struct redisplay_interface x_redisplay_interface = x_draw_glyph_string, x_define_frame_cursor, x_clear_frame_area, + x_clear_under_internal_border, x_draw_window_cursor, x_draw_vertical_window_border, x_draw_window_divider, @@ -13132,13 +13187,13 @@ x_delete_terminal (struct terminal *terminal) /* Normally, the display is available... */ if (dpyinfo->display) { - x_destroy_all_bitmaps (dpyinfo); + image_destroy_all_bitmaps (dpyinfo); XSetCloseDownMode (dpyinfo->display, DestroyAll); /* Whether or not XCloseDisplay destroys the associated resource database depends on the version of libX11. To avoid both crash and memory leak, we dissociate the database from the - display and then destroy dpyinfo->xrdb ourselves. + display and then destroy dpyinfo->rdb ourselves. Unfortunately, the above strategy does not work in some situations due to a bug in newer versions of libX11: because @@ -13158,7 +13213,7 @@ x_delete_terminal (struct terminal *terminal) /* We used to call XrmDestroyDatabase from x_delete_display, but some older versions of libX11 crash if we call it after closing all the displays. */ - XrmDestroyDatabase (dpyinfo->xrdb); + XrmDestroyDatabase (dpyinfo->rdb); #endif #ifdef USE_GTK @@ -13216,19 +13271,39 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->read_socket_hook = XTread_socket; terminal->frame_up_to_date_hook = XTframe_up_to_date; terminal->buffer_flipping_unblocked_hook = XTbuffer_flipping_unblocked_hook; + terminal->query_colors = x_query_colors; terminal->mouse_position_hook = XTmouse_position; + terminal->get_focus_frame = x_get_focus_frame; + terminal->focus_frame_hook = x_focus_frame; terminal->frame_rehighlight_hook = XTframe_rehighlight; terminal->frame_raise_lower_hook = XTframe_raise_lower; + terminal->frame_visible_invisible_hook = x_make_frame_visible_invisible; terminal->fullscreen_hook = XTfullscreen_hook; + terminal->iconify_frame_hook = x_iconify_frame; + terminal->set_window_size_hook = x_set_window_size; + terminal->set_frame_offset_hook = x_set_offset; + terminal->set_frame_alpha_hook = x_set_frame_alpha; + terminal->set_new_font_hook = x_new_font; + terminal->set_bitmap_icon_hook = x_bitmap_icon; + terminal->implicit_set_name_hook = x_implicitly_set_name; terminal->menu_show_hook = x_menu_show; +#ifdef HAVE_EXT_MENU_BAR + terminal->activate_menubar_hook = x_activate_menubar; +#endif #if defined (USE_X_TOOLKIT) || defined (USE_GTK) terminal->popup_dialog_hook = xw_popup_dialog; +#endif +#ifndef HAVE_EXT_TOOL_BAR + terminal->change_tool_bar_height_hook = x_change_tool_bar_height; #endif terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; terminal->set_horizontal_scroll_bar_hook = XTset_horizontal_scroll_bar; + terminal->set_scroll_bar_default_width_hook = x_set_scroll_bar_default_width; + terminal->set_scroll_bar_default_height_hook = x_set_scroll_bar_default_height; terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; + terminal->get_string_resource_hook = x_get_string_resource; terminal->delete_frame_hook = x_destroy_window; terminal->delete_terminal_hook = x_delete_terminal; /* Other hooks are NULL by default. */ diff --git a/src/xterm.h b/src/xterm.h index bb7631a3f4..20d043e717 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -235,7 +235,7 @@ struct x_display_info #endif /* X Resource data base */ - XrmDatabase xrdb; + XrmDatabase rdb; /* Minimum width over all characters in all fonts in font_table. */ int smallest_char_width; @@ -747,9 +747,11 @@ enum /* Return the X output data for frame F. */ #define FRAME_X_OUTPUT(f) ((f)->output_data.x) +#define FRAME_OUTPUT_DATA(f) FRAME_X_OUTPUT (f) /* Return the X window used for displaying data in frame F. */ #define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc) +#define FRAME_NATIVE_WINDOW(f) FRAME_X_WINDOW (f) /* Return the drawable used for rendering to frame F. */ #define FRAME_X_RAW_DRAWABLE(f) ((f)->output_data.x->draw_desc) @@ -1058,6 +1060,7 @@ extern void x_real_pos_and_offsets (struct frame *f, XrmDatabase x_load_resources (Display *, const char *, const char *, const char *); +extern const char *x_get_string_resource (void *, const char *, const char *); /* Defined in xterm.c */ @@ -1074,8 +1077,13 @@ extern bool x_had_errors_p (Display *); extern void x_uncatch_errors (void); extern void x_uncatch_errors_after_check (void); extern void x_clear_errors (Display *); -extern void xembed_request_focus (struct frame *); -extern void x_ewmh_activate_frame (struct frame *); +extern void x_set_window_size (struct frame *f, bool, int, int, bool); +extern void x_make_frame_visible (struct frame *f); +extern void x_make_frame_invisible (struct frame *f); +extern void x_iconify_frame (struct frame *f); +extern void x_free_frame_resources (struct frame *); +extern void x_wm_set_size_hint (struct frame *, long, bool); + extern void x_delete_terminal (struct terminal *terminal); extern unsigned long x_copy_color (struct frame *, unsigned long); #ifdef USE_X_TOOLKIT @@ -1088,7 +1096,7 @@ extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap, double, int); #endif extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *); -extern void x_query_color (struct frame *f, XColor *); +extern void x_query_colors (struct frame *f, XColor *, int); extern void x_clear_area (struct frame *f, int, int, int, int); #if !defined USE_X_TOOLKIT && !defined USE_GTK extern void x_mouse_leave (struct x_display_info *); @@ -1165,6 +1173,13 @@ extern void x_clear_under_internal_border (struct frame *f); extern void tear_down_x_back_buffer (struct frame *f); extern void initial_set_up_x_back_buffer (struct frame *f); +/* Defined in xfns.c. */ +extern void x_real_positions (struct frame *, int *, int *); +extern void x_change_tool_bar_height (struct frame *, int); +extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_scroll_bar_default_width (struct frame *); +extern void x_set_scroll_bar_default_height (struct frame *); + /* Defined in xselect.c. */ extern void x_handle_property_notify (const XPropertyEvent *); commit da9541dd1086b7bab52940c82915efe114bb7419 Author: Alexander Gramiak Date: Thu Apr 11 09:00:58 2019 -0600 Add prefixes to some window system-dependent procedures * src/nsterm.m (note_mouse_movement): * src/w32fns.c (construct_console_modifiers): * src/w32inevt.c: * src/w32term.c (frame_highlight, frame_unhighlight) (construct_mouse_click, construct_mouse_wheel, construct_drag_n_drop) (lispy_file_action, queue_notifications, note_mouse_movement): * src/w32term.h: * src/xterm.c (frame_highlight, frame_unhighlight) (construct_mouse_click, note_mouse_movement, get_current_wm_state): Add and use window system prefixes. diff --git a/src/nsterm.m b/src/nsterm.m index 15316e23ed..62fb4b2e21 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2467,7 +2467,7 @@ so some key presses (TAB) are swallowed by the system. */ } static int -note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) +ns_note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) /* ------------------------------------------------------------------------ Called by EmacsView on mouseMovement events. Passes on to emacs mainstream code if we moved off of a rect of interest @@ -6890,7 +6890,7 @@ - (void)mouseMoved: (NSEvent *)e last_mouse_window = window; } - if (!note_mouse_movement (emacsframe, pt.x, pt.y)) + if (!ns_note_mouse_movement (emacsframe, pt.x, pt.y)) help_echo_string = previous_help_echo_string; XSETFRAME (frame, emacsframe); @@ -6898,7 +6898,7 @@ - (void)mouseMoved: (NSEvent *)e { /* NOTE: help_echo_{window,pos,object} are set in xdisp.c (note_mouse_highlight), which is called through the - note_mouse_movement () call above. */ + ns_note_mouse_movement () call above. */ any_help_event_p = YES; gen_help_event (help_echo_string, frame, help_echo_window, help_echo_object, help_echo_pos); diff --git a/src/w32fns.c b/src/w32fns.c index 814998f5f2..e6cb1ee311 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3061,7 +3061,7 @@ w32_get_modifiers (void) and window input. */ static int -construct_console_modifiers (void) +w32_construct_console_modifiers (void) { int mods; @@ -3087,7 +3087,7 @@ w32_get_key_modifiers (unsigned int wparam, unsigned int lparam) int mods; /* Convert to emacs modifiers. */ - mods = w32_kbd_mods_to_emacs (construct_console_modifiers (), wparam); + mods = w32_kbd_mods_to_emacs (w32_construct_console_modifiers (), wparam); return mods; } @@ -3719,7 +3719,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, if (count) { W32Msg wmsg; - DWORD console_modifiers = construct_console_modifiers (); + DWORD console_modifiers = w32_construct_console_modifiers (); int *b = buf, strip_ExtraMods = 1, hairy = 0; const char *type_CtrlAlt = NULL; @@ -4351,7 +4351,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* If not defined as a function key, change it to a WM_CHAR message. */ if (wParam > 255 || !lispy_function_keys[wParam]) { - DWORD modifiers = construct_console_modifiers (); + DWORD modifiers = w32_construct_console_modifiers (); if (!NILP (Vw32_recognize_altgr) && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU)) diff --git a/src/w32inevt.c b/src/w32inevt.c index ab71c560d6..fc1f90cd02 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -680,7 +680,7 @@ handle_file_notifications (struct input_event *hold_quit) already be defined at this point. */ Lisp_Object fname = code_convert_string_norecord (utf_16_fn, cs, 0); - Lisp_Object action = lispy_file_action (fni->Action); + Lisp_Object action = w32_lispy_file_action (fni->Action); inev.kind = FILE_NOTIFY_EVENT; inev.timestamp = GetTickCount (); diff --git a/src/w32term.c b/src/w32term.c index a43d43c558..edcdc56a9e 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -180,8 +180,8 @@ static void w32_initialize (void); static void x_update_end (struct frame *); static void w32_frame_up_to_date (struct frame *); static void x_clear_frame (struct frame *); -static void frame_highlight (struct frame *); -static void frame_unhighlight (struct frame *); +static void w32_frame_highlight (struct frame *); +static void w32_frame_unhighlight (struct frame *); static void x_new_focus_frame (struct w32_display_info *, struct frame *); static void x_focus_changed (int, int, struct w32_display_info *, @@ -2904,14 +2904,14 @@ x_scroll_run (struct window *w, struct run *run) ***********************************************************************/ static void -frame_highlight (struct frame *f) +w32_frame_highlight (struct frame *f) { gui_update_cursor (f, 1); x_set_frame_alpha (f); } static void -frame_unhighlight (struct frame *f) +w32_frame_unhighlight (struct frame *f) { gui_update_cursor (f, 1); x_set_frame_alpha (f); @@ -3059,9 +3059,9 @@ x_frame_rehighlight (struct w32_display_info *dpyinfo) if (dpyinfo->x_highlight_frame != old_highlight) { if (old_highlight) - frame_unhighlight (old_highlight); + w32_frame_unhighlight (old_highlight); if (dpyinfo->x_highlight_frame) - frame_highlight (dpyinfo->x_highlight_frame); + w32_frame_highlight (dpyinfo->x_highlight_frame); } } @@ -3168,7 +3168,8 @@ parse_button (int message, int xbutton, int * pbutton, int * pup) the mouse. */ static Lisp_Object -construct_mouse_click (struct input_event *result, W32Msg *msg, struct frame *f) +w32_construct_mouse_click (struct input_event *result, W32Msg *msg, + struct frame *f) { int button = 0; int up = 0; @@ -3194,7 +3195,8 @@ construct_mouse_click (struct input_event *result, W32Msg *msg, struct frame *f) } static Lisp_Object -construct_mouse_wheel (struct input_event *result, W32Msg *msg, struct frame *f) +w32_construct_mouse_wheel (struct input_event *result, W32Msg *msg, + struct frame *f) { POINT p; int delta; @@ -3228,7 +3230,8 @@ construct_mouse_wheel (struct input_event *result, W32Msg *msg, struct frame *f) } static Lisp_Object -construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) +w32_construct_drag_n_drop (struct input_event *result, W32Msg *msg, + struct frame *f) { Lisp_Object files; Lisp_Object frame; @@ -3307,7 +3310,7 @@ construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) /* File event notifications (see w32notify.c). */ Lisp_Object -lispy_file_action (DWORD action) +w32_lispy_file_action (DWORD action) { static char unknown_fmt[] = "unknown-action(%d)"; Lisp_Object retval; @@ -3347,8 +3350,8 @@ lispy_file_action (DWORD action) function runs when the WM_EMACS_FILENOTIFY message arrives from a watcher thread. */ static void -queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, - int *evcount) +w32_queue_notifications (struct input_event *event, W32Msg *msg, + struct frame *f, int *evcount) { struct notifications_set *ns = NULL; Lisp_Object frame; @@ -3407,7 +3410,7 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, already be defined at this point. */ Lisp_Object fname = code_convert_string_norecord (utf_16_fn, cs, 0); - Lisp_Object action = lispy_file_action (fni->Action); + Lisp_Object action = w32_lispy_file_action (fni->Action); event->kind = FILE_NOTIFY_EVENT; event->timestamp = msg->msg.time; @@ -3445,7 +3448,7 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, another motion event, so we can check again the next time it moves. */ static int -note_mouse_movement (struct frame *frame, MSG *msg) +w32_note_mouse_movement (struct frame *frame, MSG *msg) { struct w32_display_info *dpyinfo; int mouse_x = LOWORD (msg->lParam); @@ -5020,7 +5023,7 @@ w32_read_socket (struct terminal *terminal, last_mouse_window = window; } - if (!note_mouse_movement (f, &msg.msg)) + if (!w32_note_mouse_movement (f, &msg.msg)) help_echo_string = previous_help_echo_string; } else @@ -5064,7 +5067,7 @@ w32_read_socket (struct terminal *terminal, if (f) { - construct_mouse_click (&inev, &msg, f); + w32_construct_mouse_click (&inev, &msg, f); /* Is this in the tool-bar? */ if (WINDOWP (f->tool_bar_window) @@ -5129,7 +5132,7 @@ w32_read_socket (struct terminal *terminal, || f == dpyinfo->w32_focus_frame) /* Emit an Emacs wheel-up/down event. */ { - construct_mouse_wheel (&inev, &msg, f); + w32_construct_mouse_wheel (&inev, &msg, f); /* Ignore any mouse motion that happened before this event; any subsequent mouse-movement Emacs events @@ -5146,7 +5149,7 @@ w32_read_socket (struct terminal *terminal, if (f1 && FRAME_LIVE_P (f1) && FRAME_W32_P (f1)) { - construct_mouse_wheel (&inev, &msg, f1); + w32_construct_mouse_wheel (&inev, &msg, f1); f1->mouse_moved = false; f1->last_tool_bar_item = -1; dpyinfo->last_mouse_frame = f1; @@ -5166,7 +5169,7 @@ w32_read_socket (struct terminal *terminal, f = x_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) - construct_drag_n_drop (&inev, &msg, f); + w32_construct_drag_n_drop (&inev, &msg, f); break; case WM_HSCROLL: @@ -5577,7 +5580,7 @@ w32_read_socket (struct terminal *terminal, case WM_EMACS_FILENOTIFY: f = x_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) - queue_notifications (&inev, &msg, f, &count); + w32_queue_notifications (&inev, &msg, f, &count); break; #endif diff --git a/src/w32term.h b/src/w32term.h index 4c496e97e4..a0942d630a 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -732,7 +732,7 @@ struct notifications_set { }; extern struct notifications_set *notifications_set_head; extern Lisp_Object w32_get_watch_object (void *); -extern Lisp_Object lispy_file_action (DWORD); +extern Lisp_Object w32_lispy_file_action (DWORD); extern int handle_file_notifications (struct input_event *); extern void w32_initialize_display_info (Lisp_Object); diff --git a/src/xterm.c b/src/xterm.c index 5d4d2ca3b7..69f9afddbc 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -234,7 +234,7 @@ static void x_wm_set_window_state (struct frame *, int); static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t); static void x_initialize (void); -static bool get_current_wm_state (struct frame *, Window, int *, bool *); +static bool x_get_current_wm_state (struct frame *, Window, int *, bool *); /* Flush display of frame F. */ @@ -4354,7 +4354,7 @@ x_scroll_run (struct window *w, struct run *run) static void -frame_highlight (struct frame *f) +x_frame_highlight (struct frame *f) { /* We used to only do this if Vx_no_window_manager was non-nil, but the ICCCM (section 4.1.6) says that the window's border pixmap @@ -4375,7 +4375,7 @@ frame_highlight (struct frame *f) } static void -frame_unhighlight (struct frame *f) +x_frame_unhighlight (struct frame *f) { /* We used to only do this if Vx_no_window_manager was non-nil, but the ICCCM (section 4.1.6) says that the window's border pixmap @@ -4740,9 +4740,9 @@ x_frame_rehighlight (struct x_display_info *dpyinfo) if (dpyinfo->x_highlight_frame != old_highlight) { if (old_highlight) - frame_unhighlight (old_highlight); + x_frame_unhighlight (old_highlight); if (dpyinfo->x_highlight_frame) - frame_highlight (dpyinfo->x_highlight_frame); + x_frame_highlight (dpyinfo->x_highlight_frame); } } @@ -4962,9 +4962,9 @@ x_get_keysym_name (int keysym) the mouse. */ static Lisp_Object -construct_mouse_click (struct input_event *result, - const XButtonEvent *event, - struct frame *f) +x_construct_mouse_click (struct input_event *result, + const XButtonEvent *event, + struct frame *f) { /* Make the event type NO_EVENT; we'll change that when we decide otherwise. */ @@ -4993,7 +4993,7 @@ construct_mouse_click (struct input_event *result, another motion event, so we can check again the next time it moves. */ static bool -note_mouse_movement (struct frame *frame, const XMotionEvent *event) +x_note_mouse_movement (struct frame *frame, const XMotionEvent *event) { XRectangle *r; struct x_display_info *dpyinfo; @@ -7670,7 +7670,7 @@ x_net_wm_state (struct frame *f, Window window) Lisp_Object lval = Qnil; bool sticky = false; - get_current_wm_state (f, window, &value, &sticky); + x_get_current_wm_state (f, window, &value, &sticky); switch (value) { @@ -8594,12 +8594,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, /* EnterNotify counts as mouse movement, so update things that depend on mouse position. */ if (f && !f->output_data.x->hourglass_p) - note_mouse_movement (f, &event->xmotion); + x_note_mouse_movement (f, &event->xmotion); #ifdef USE_GTK /* We may get an EnterNotify on the buttons in the toolbar. In that case we moved out of any highlighted area and need to note this. */ if (!f && dpyinfo->last_mouse_glyph_frame) - note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); + x_note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); #endif goto OTHER; @@ -8632,7 +8632,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef USE_GTK /* See comment in EnterNotify above */ else if (dpyinfo->last_mouse_glyph_frame) - note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); + x_note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); #endif goto OTHER; @@ -8701,7 +8701,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, last_mouse_window = window; } - if (!note_mouse_movement (f, &event->xmotion)) + if (!x_note_mouse_movement (f, &event->xmotion)) help_echo_string = previous_help_echo_string; } else @@ -8959,13 +8959,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xbutton.time > ignore_next_mouse_click_timeout) { ignore_next_mouse_click_timeout = 0; - construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, f); } if (event->type == ButtonRelease) ignore_next_mouse_click_timeout = 0; } else - construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, f); } if (FRAME_X_EMBEDDED_P (f)) xembed_send_message (f, event->xbutton.time, @@ -10671,10 +10671,10 @@ x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) Return true iff we are not hidden. */ static bool -get_current_wm_state (struct frame *f, - Window window, - int *size_state, - bool *sticky) +x_get_current_wm_state (struct frame *f, + Window window, + int *size_state, + bool *sticky) { unsigned long actual_size; int i; @@ -10922,7 +10922,7 @@ x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) int value = FULLSCREEN_NONE; Lisp_Object lval; bool sticky = false; - bool not_hidden = get_current_wm_state (f, event->window, &value, &sticky); + bool not_hidden = x_get_current_wm_state (f, event->window, &value, &sticky); lval = Qnil; switch (value) commit ff4e31fa328a2cee5197beb20f068eb021712b5c Author: Alexander Gramiak Date: Sat Mar 23 11:19:40 2019 -0600 Rename generic x_* procedures in xdisp.c * src/xdisp.c (x_consider_frame_title, x_get_glyph_overhangs) (x_produce_glyphs, x_write_glyphs, x_insert_glyphs) (x_clear_end_of_line), x_fix_overlapping_area) (x_update_cursor, x_clear_cursor, x_clear_window_mouse_face) (x_draw_vertical_border, x_draw_right_divider, x_draw_bottom_divider) (x_intersect_rectangles): Rename with a gui prefix to indicate non-X-specific functionality. * src/composite.c: * src/dispextern.h: * src/nsfns.m: * src/nsterm.m: * src/w32fns.c: * src/w32term.c: * src/window.c: * src/xfns.c: * src/xterm.c: Use the renamed procedures. diff --git a/src/composite.c b/src/composite.c index 88f1235f11..7d7ed3f4a6 100644 --- a/src/composite.c +++ b/src/composite.c @@ -176,7 +176,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars, /* Maximum length of a string of glyphs. XftGlyphExtents limits this to INT_MAX, and Emacs limits it further. Divide INT_MAX - 1 - by 2 because x_produce_glyphs computes glyph_len * 2 + 1. Divide + by 2 because gui_produce_glyphs computes glyph_len * 2 + 1. Divide the size by MAX_MULTIBYTE_LENGTH because encode_terminal_code multiplies glyph_len by MAX_MULTIBYTE_LENGTH. */ enum { diff --git a/src/dispextern.h b/src/dispextern.h index 1a53656353..79ec4ce52e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3274,19 +3274,19 @@ extern void get_font_ascent_descent (struct font *, int *, int *); extern void dump_glyph_string (struct glyph_string *) EXTERNALLY_VISIBLE; #endif -extern void x_get_glyph_overhangs (struct glyph *, struct frame *, - int *, int *); +extern void gui_get_glyph_overhangs (struct glyph *, struct frame *, + int *, int *); extern struct font *font_for_underline_metrics (struct glyph_string *); -extern void x_produce_glyphs (struct it *); - -extern void x_write_glyphs (struct window *, struct glyph_row *, - struct glyph *, enum glyph_row_area, int); -extern void x_insert_glyphs (struct window *, struct glyph_row *, - struct glyph *, enum glyph_row_area, int); -extern void x_clear_end_of_line (struct window *, struct glyph_row *, - enum glyph_row_area, int); -extern void x_fix_overlapping_area (struct window *, struct glyph_row *, - enum glyph_row_area, int); +extern void gui_produce_glyphs (struct it *); + +extern void gui_write_glyphs (struct window *, struct glyph_row *, + struct glyph *, enum glyph_row_area, int); +extern void gui_insert_glyphs (struct window *, struct glyph_row *, + struct glyph *, enum glyph_row_area, int); +extern void gui_clear_end_of_line (struct window *, struct glyph_row *, + enum glyph_row_area, int); +extern void gui_fix_overlapping_area (struct window *, struct glyph_row *, + enum glyph_row_area, int); extern void draw_phys_cursor_glyph (struct window *, struct glyph_row *, enum draw_glyphs_face); @@ -3294,10 +3294,10 @@ extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, struct glyph *, int *, int *, int *); extern void erase_phys_cursor (struct window *); extern void display_and_set_cursor (struct window *, bool, int, int, int, int); -extern void x_update_cursor (struct frame *, bool); -extern void x_clear_cursor (struct window *); -extern void x_draw_vertical_border (struct window *w); -extern void x_draw_right_divider (struct window *w); +extern void gui_update_cursor (struct frame *, bool); +extern void gui_clear_cursor (struct window *); +extern void gui_draw_vertical_border (struct window *w); +extern void gui_draw_right_divider (struct window *w); extern int get_glyph_string_clip_rects (struct glyph_string *, NativeRectangle *, int); @@ -3309,11 +3309,11 @@ extern void handle_tool_bar_click (struct frame *, int, int, bool, int); extern void expose_frame (struct frame *, int, int, int, int); -extern bool x_intersect_rectangles (XRectangle *, XRectangle *, XRectangle *); +extern bool gui_intersect_rectangles (XRectangle *, XRectangle *, XRectangle *); #endif /* HAVE_WINDOW_SYSTEM */ extern void note_mouse_highlight (struct frame *, int, int); -extern void x_clear_window_mouse_face (struct window *); +extern void gui_clear_window_mouse_face (struct window *); extern void cancel_mouse_face (struct frame *); extern bool clear_mouse_face (Mouse_HLInfo *); extern bool cursor_in_mouse_face_p (struct window *w); diff --git a/src/nsfns.m b/src/nsfns.m index ee7598a1c7..009e9d55e2 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -342,8 +342,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. if (FRAME_VISIBLE_P (f)) { - x_update_cursor (f, 0); - x_update_cursor (f, 1); + gui_update_cursor (f, 0); + gui_update_cursor (f, 1); } update_face_from_frame_parameter (f, Qcursor_color, arg); unblock_input (); diff --git a/src/nsterm.m b/src/nsterm.m index 81d36be6cc..15316e23ed 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1183,9 +1183,9 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) if (draw_window_fringes (w, 1)) { if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - x_draw_right_divider (w); + gui_draw_right_divider (w); else - x_draw_vertical_border (w); + gui_draw_vertical_border (w); } unblock_input (); @@ -1528,12 +1528,12 @@ -(void)remove { if (old_highlight) { - x_update_cursor (old_highlight, 1); + gui_update_cursor (old_highlight, 1); x_set_frame_alpha (old_highlight); } if (dpyinfo->x_highlight_frame) { - x_update_cursor (dpyinfo->x_highlight_frame, 1); + gui_update_cursor (dpyinfo->x_highlight_frame, 1); x_set_frame_alpha (dpyinfo->x_highlight_frame); } } @@ -2607,7 +2607,7 @@ so some key presses (TAB) are swallowed by the system. */ [[view window] invalidateCursorRectsForView: view]; /* Redisplay assumes this function also draws the changed frame cursor, but this function doesn't, so do it explicitly. */ - x_update_cursor (f, 1); + gui_update_cursor (f, 1); } } @@ -2885,7 +2885,7 @@ so some key presses (TAB) are swallowed by the system. */ block_input (); - x_clear_cursor (w); + gui_clear_cursor (w); { NSRect srcRect = NSMakeRect (x, from_y, width, height); @@ -5099,7 +5099,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) /* This and next define (many of the) public functions in this file. */ -/* x_... are generic versions in xdisp.c that we, and other terms, get away +/* gui_* are generic versions in xdisp.c that we, and other terms, get away with using despite presence in the "system dependent" redisplay interface. In addition, many of the ns_ methods have code that is shared with all terms, indicating need for further refactoring. */ @@ -5107,18 +5107,18 @@ static Lisp_Object ns_string_to_lispmod (const char *s) static struct redisplay_interface ns_redisplay_interface = { ns_frame_parm_handlers, - x_produce_glyphs, - x_write_glyphs, - x_insert_glyphs, - x_clear_end_of_line, + gui_produce_glyphs, + gui_write_glyphs, + gui_insert_glyphs, + gui_clear_end_of_line, ns_scroll_run, ns_after_update_window_line, ns_update_window_begin, ns_update_window_end, 0, /* flush_display */ - x_clear_window_mouse_face, - x_get_glyph_overhangs, - x_fix_overlapping_area, + gui_clear_window_mouse_face, + gui_get_glyph_overhangs, + gui_fix_overlapping_area, ns_draw_fringe_bitmap, 0, /* define_fringe_bitmap */ /* FIXME: simplify ns_draw_fringe_bitmap */ 0, /* destroy_fringe_bitmap */ @@ -7249,7 +7249,7 @@ - (void)windowDidResignKey: (NSNotification *)notification from sole-frame Emacs to get hollow box to show. */ if (!windowClosing && [[self window] isVisible] == YES) { - x_update_cursor (emacsframe, 1); + gui_update_cursor (emacsframe, 1); x_set_frame_alpha (emacsframe); } diff --git a/src/w32fns.c b/src/w32fns.c index af82b46305..814998f5f2 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1514,8 +1514,8 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (FRAME_VISIBLE_P (f)) { - x_update_cursor (f, 0); - x_update_cursor (f, 1); + gui_update_cursor (f, 0); + gui_update_cursor (f, 1); } } diff --git a/src/w32term.c b/src/w32term.c index bb1f0bad01..a43d43c558 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -363,7 +363,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) get_glyph_string_clip_rect (s, &w32_string_clip); CONVERT_TO_XRECT (string_clip, w32_string_clip); - if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip)) + if (!gui_intersect_rectangles (&wave_clip, &string_clip, &final_clip)) return; hp = CreatePen (PS_SOLID, thickness, color); @@ -713,9 +713,9 @@ x_update_window_end (struct window *w, bool cursor_on_p, if (draw_window_fringes (w, true)) { if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - x_draw_right_divider (w); + gui_draw_right_divider (w); else - x_draw_vertical_border (w); + gui_draw_vertical_border (w); } unblock_input (); @@ -2863,7 +2863,7 @@ x_scroll_run (struct window *w, struct run *run) block_input (); /* Cursor off. Will be switched on again in x_update_window_end. */ - x_clear_cursor (w); + gui_clear_cursor (w); { RECT from; @@ -2906,14 +2906,14 @@ x_scroll_run (struct window *w, struct run *run) static void frame_highlight (struct frame *f) { - x_update_cursor (f, 1); + gui_update_cursor (f, 1); x_set_frame_alpha (f); } static void frame_unhighlight (struct frame *f) { - x_update_cursor (f, 1); + gui_update_cursor (f, 1); x_set_frame_alpha (f); } @@ -7092,18 +7092,18 @@ extern frame_parm_handler w32_frame_parm_handlers[]; static struct redisplay_interface w32_redisplay_interface = { w32_frame_parm_handlers, - x_produce_glyphs, - x_write_glyphs, - x_insert_glyphs, - x_clear_end_of_line, + gui_produce_glyphs, + gui_write_glyphs, + gui_insert_glyphs, + gui_clear_end_of_line, x_scroll_run, x_after_update_window_line, x_update_window_begin, x_update_window_end, 0, /* flush_display */ - x_clear_window_mouse_face, - x_get_glyph_overhangs, - x_fix_overlapping_area, + gui_clear_window_mouse_face, + gui_get_glyph_overhangs, + gui_fix_overlapping_area, w32_draw_fringe_bitmap, w32_define_fringe_bitmap, w32_destroy_fringe_bitmap, diff --git a/src/window.c b/src/window.c index ef2ed63850..05340ea439 100644 --- a/src/window.c +++ b/src/window.c @@ -220,7 +220,7 @@ static void wset_update_mode_line (struct window *w) { /* If this window is the selected window on its frame, set the - global variable update_mode_lines, so that x_consider_frame_title + global variable update_mode_lines, so that gui_consider_frame_title will consider this frame's title for redisplay. */ Lisp_Object fselected_window = XFRAME (WINDOW_FRAME (w))->selected_window; diff --git a/src/xdisp.c b/src/xdisp.c index c77a98023d..7086e104a2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -491,7 +491,7 @@ int windows_or_buffers_changed; Since the frame title uses the same %-constructs as the mode line (except %c, %C, and %l), if this variable is non-zero, we also consider - redisplaying the title of each frame, see x_consider_frame_title. + redisplaying the title of each frame, see gui_consider_frame_title. The `redisplay' bits are the same as those used for windows_or_buffers_changed, and setting windows_or_buffers_changed also @@ -900,7 +900,7 @@ static int underlying_face_id (struct it *); #ifdef HAVE_WINDOW_SYSTEM static void update_tool_bar (struct frame *, bool); -static void x_draw_bottom_divider (struct window *w); +static void gui_draw_bottom_divider (struct window *w); static void notice_overwritten_cursor (struct window *, enum glyph_row_area, int, int, int, int); @@ -2139,7 +2139,7 @@ get_glyph_string_clip_rects (struct glyph_string *s, NativeRectangle *rects, int rc.width = s->w->phys_cursor_width; rc.height = s->w->phys_cursor_height; - x_intersect_rectangles (&r_save, &rc, &r); + gui_intersect_rectangles (&r_save, &rc, &r); } } else @@ -2200,7 +2200,7 @@ get_glyph_string_clip_rects (struct glyph_string *s, NativeRectangle *rects, int { XRectangle r_save = r; - if (! x_intersect_rectangles (&r_save, s->row->clip, &r)) + if (! gui_intersect_rectangles (&r_save, s->row->clip, &r)) r.width = 0; } @@ -6932,7 +6932,7 @@ static next_element_function const get_next_element[NUM_IT_METHODS] = method symbol. By side-effect, update it->what and it->glyphless_method. This function is called from get_next_display_element for each character element, and from - x_produce_glyphs when no suitable font was found. */ + gui_produce_glyphs when no suitable font was found. */ Lisp_Object lookup_glyphless_char_display (int c, struct it *it) @@ -9630,7 +9630,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos /* When display_line produces a continued line that ends in a TAB, it skips a tab stop that is closer than the font's space character - width (see x_produce_glyphs where it produces + width (see gui_produce_glyphs where it produces the stretch glyph which represents a TAB). We need to reproduce the same logic here. */ eassert (face_font); @@ -12005,7 +12005,7 @@ store_mode_line_noprop (const char *string, int field_width, int precision) frame_title_format. */ static void -x_consider_frame_title (Lisp_Object frame) +gui_consider_frame_title (Lisp_Object frame) { struct frame *f = XFRAME (frame); @@ -12152,7 +12152,7 @@ prepare_menu_bars (void) || FRAME_VISIBLE_P (f) == 1 /* Exclude TTY frames that are obscured because they are not the top frame on their console. This is - because x_consider_frame_title actually switches + because gui_consider_frame_title actually switches to the frame, which for TTY frames means it is marked as garbaged, and will be completely redrawn on the next redisplay cycle. This causes @@ -12160,7 +12160,7 @@ prepare_menu_bars (void) are more than one of them, even though nothing should be changed on display. */ || (FRAME_VISIBLE_P (f) == 2 && FRAME_WINDOW_P (f)))) - x_consider_frame_title (frame); + gui_consider_frame_title (frame); } } #endif /* HAVE_WINDOW_SYSTEM */ @@ -17688,7 +17688,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) ignore_mouse_drag_p = true; #endif } - x_consider_frame_title (w->frame); + gui_consider_frame_title (w->frame); #endif } @@ -17703,16 +17703,16 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) if (draw_window_fringes (w, true)) { if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - x_draw_right_divider (w); + gui_draw_right_divider (w); else - x_draw_vertical_border (w); + gui_draw_vertical_border (w); } unblock_input (); update_end (f); } if (WINDOW_BOTTOM_DIVIDER_WIDTH (w)) - x_draw_bottom_divider (w); + gui_draw_bottom_divider (w); #endif /* HAVE_WINDOW_SYSTEM */ /* We go to this label, with fonts_changed set, if it is @@ -19156,7 +19156,7 @@ try_window_id (struct window *w) + window_internal_height (w)); #if defined (HAVE_GPM) || defined (MSDOS) - x_clear_window_mouse_face (w); + gui_clear_window_mouse_face (w); #endif /* Perform the operation on the screen. */ if (dvpos > 0) @@ -20180,7 +20180,7 @@ append_space_for_newline (struct it *it, bool default_face_p) it->object = saved_object; /* get_it_property needs this */ normal_char_ascent_descent (font, -1, &it->ascent, &it->descent); /* Must do a subset of line height processing from - x_produce_glyph for newline characters. */ + gui_produce_glyph for newline characters. */ height = get_it_property (it, Qline_height); if (CONSP (height) && CONSP (XCDR (height)) @@ -26266,7 +26266,7 @@ normal_char_height (struct font *font, int c) assumed to be zero. */ void -x_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *right) +gui_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *right) { *left = *right = 0; @@ -26356,7 +26356,7 @@ left_overwriting (struct glyph_string *s) for (i = first - 1; i >= 0; --i) { int left, right; - x_get_glyph_overhangs (glyphs + i, s->f, &left, &right); + gui_get_glyph_overhangs (glyphs + i, s->f, &left, &right); if (x + right > 0) k = i; x -= glyphs[i].pixel_width; @@ -26411,7 +26411,7 @@ right_overwriting (struct glyph_string *s) for (i = first; i < end; ++i) { int left, right; - x_get_glyph_overhangs (glyphs + i, s->f, &left, &right); + gui_get_glyph_overhangs (glyphs + i, s->f, &left, &right); if (x - left < 0) k = i; x += glyphs[i].pixel_width; @@ -27073,7 +27073,7 @@ font_for_underline_metrics (struct glyph_string *s) } /* Store one glyph for IT->char_to_display in IT->glyph_row. - Called from x_produce_glyphs when IT->glyph_row is non-null. */ + Called from gui_produce_glyphs when IT->glyph_row is non-null. */ static void append_glyph (struct it *it) @@ -27155,9 +27155,8 @@ append_glyph (struct it *it) IT_EXPAND_MATRIX_WIDTH (it, area); } -/* Store one glyph for the composition IT->cmp_it.id in - IT->glyph_row. Called from x_produce_glyphs when IT->glyph_row is - non-null. */ +/* Store one glyph for the composition IT->cmp_it.id in IT->glyph_row. + Called from gui_produce_glyphs when IT->glyph_row is non-null. */ static void append_composite_glyph (struct it *it) @@ -28233,7 +28232,7 @@ produce_glyphless_glyph (struct it *it, bool for_no_font, Lisp_Object acronym) for an overview of struct it. */ void -x_produce_glyphs (struct it *it) +gui_produce_glyphs (struct it *it) { int extra_line_spacing = it->extra_line_spacing; @@ -29001,7 +29000,7 @@ x_produce_glyphs (struct it *it) being updated, and UPDATED_AREA is the area of that row being updated. */ void -x_write_glyphs (struct window *w, struct glyph_row *updated_row, +gui_write_glyphs (struct window *w, struct glyph_row *updated_row, struct glyph *start, enum glyph_row_area updated_area, int len) { int x, hpos, chpos = w->phys_cursor.hpos; @@ -29045,7 +29044,7 @@ x_write_glyphs (struct window *w, struct glyph_row *updated_row, Insert LEN glyphs from START at the nominal cursor position. */ void -x_insert_glyphs (struct window *w, struct glyph_row *updated_row, +gui_insert_glyphs (struct window *w, struct glyph_row *updated_row, struct glyph *start, enum glyph_row_area updated_area, int len) { struct frame *f; @@ -29102,7 +29101,7 @@ x_insert_glyphs (struct window *w, struct glyph_row *updated_row, updated window W. TO_X == -1 means clear to the end of this area. */ void -x_clear_end_of_line (struct window *w, struct glyph_row *updated_row, +gui_clear_end_of_line (struct window *w, struct glyph_row *updated_row, enum glyph_row_area updated_area, int to_x) { struct frame *f; @@ -29489,7 +29488,7 @@ notice_overwritten_cursor (struct window *w, enum glyph_row_area area, with respect to the overlapping part OVERLAPS. */ void -x_fix_overlapping_area (struct window *w, struct glyph_row *row, +gui_fix_overlapping_area (struct window *w, struct glyph_row *row, enum glyph_row_area area, int overlaps) { int i, x; @@ -29568,12 +29567,12 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row, if (row > w->current_matrix->rows && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) - x_fix_overlapping_area (w, row - 1, TEXT_AREA, + gui_fix_overlapping_area (w, row - 1, TEXT_AREA, OVERLAPS_ERASED_CURSOR); if (MATRIX_ROW_BOTTOM_Y (row) < window_text_bottom_y (w) && MATRIX_ROW_OVERLAPS_PRED_P (row + 1)) - x_fix_overlapping_area (w, row + 1, TEXT_AREA, + gui_fix_overlapping_area (w, row + 1, TEXT_AREA, OVERLAPS_ERASED_CURSOR); } } @@ -29863,7 +29862,7 @@ update_cursor_in_window_tree (struct window *w, bool on_p) Don't change the cursor's position. */ void -x_update_cursor (struct frame *f, bool on_p) +gui_update_cursor (struct frame *f, bool on_p) { update_cursor_in_window_tree (XWINDOW (f->root_window), on_p); } @@ -29875,7 +29874,7 @@ x_update_cursor (struct frame *f, bool on_p) is about to be rewritten. */ void -x_clear_cursor (struct window *w) +gui_clear_cursor (struct window *w) { if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p) update_window_cursor (w, false); @@ -31903,7 +31902,7 @@ note_mouse_highlight (struct frame *f, int x, int y) functions to ensure the mouse-highlight is off. */ void -x_clear_window_mouse_face (struct window *w) +gui_clear_window_mouse_face (struct window *w) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); Lisp_Object window; @@ -32047,13 +32046,13 @@ expose_overlaps (struct window *w, row->clip = r; if (row->used[LEFT_MARGIN_AREA]) - x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA, OVERLAPS_BOTH); + gui_fix_overlapping_area (w, row, LEFT_MARGIN_AREA, OVERLAPS_BOTH); if (row->used[TEXT_AREA]) - x_fix_overlapping_area (w, row, TEXT_AREA, OVERLAPS_BOTH); + gui_fix_overlapping_area (w, row, TEXT_AREA, OVERLAPS_BOTH); if (row->used[RIGHT_MARGIN_AREA]) - x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA, OVERLAPS_BOTH); + gui_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA, OVERLAPS_BOTH); row->clip = NULL; } } @@ -32082,7 +32081,7 @@ phys_cursor_in_rect_p (struct window *w, XRectangle *r) cr.y = row->y; cr.width = WINDOW_RIGHT_FRINGE_WIDTH (w); cr.height = row->height; - return x_intersect_rectangles (&cr, r, &result); + return gui_intersect_rectangles (&cr, r, &result); } cursor_glyph = get_phys_cursor_glyph (w); @@ -32096,7 +32095,7 @@ phys_cursor_in_rect_p (struct window *w, XRectangle *r) cr.height = w->phys_cursor_height; /* ++KFS: W32 version used W32-specific IntersectRect here, but I assume the effect is the same -- and this is portable. */ - return x_intersect_rectangles (&cr, r, &result); + return gui_intersect_rectangles (&cr, r, &result); } /* If we don't understand the format, pretend we're not in the hot-spot. */ return false; @@ -32108,7 +32107,7 @@ phys_cursor_in_rect_p (struct window *w, XRectangle *r) have vertical scroll bars. */ void -x_draw_vertical_border (struct window *w) +gui_draw_vertical_border (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -32159,7 +32158,7 @@ x_draw_vertical_border (struct window *w) /* Draw window dividers for window W. */ void -x_draw_right_divider (struct window *w) +gui_draw_right_divider (struct window *w) { struct frame *f = WINDOW_XFRAME (w); @@ -32185,7 +32184,7 @@ x_draw_right_divider (struct window *w) } static void -x_draw_bottom_divider (struct window *w) +gui_draw_bottom_divider (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -32250,7 +32249,7 @@ expose_window (struct window *w, XRectangle *fr) wr.width = WINDOW_PIXEL_WIDTH (w); wr.height = WINDOW_PIXEL_HEIGHT (w); - if (x_intersect_rectangles (fr, &wr, &r)) + if (gui_intersect_rectangles (fr, &wr, &r)) { int yb = window_text_bottom_y (w); struct glyph_row *row; @@ -32267,7 +32266,7 @@ expose_window (struct window *w, XRectangle *fr) bool cursor_cleared_p = (!w->pseudo_window_p && phys_cursor_in_rect_p (w, &r)); if (cursor_cleared_p) - x_clear_cursor (w); + gui_clear_cursor (w); /* If the row containing the cursor extends face to end of line, then expose_area might overwrite the cursor outside the @@ -32360,12 +32359,12 @@ expose_window (struct window *w, XRectangle *fr) /* Draw border between windows. */ if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - x_draw_right_divider (w); + gui_draw_right_divider (w); else - x_draw_vertical_border (w); + gui_draw_vertical_border (w); if (WINDOW_BOTTOM_DIVIDER_WIDTH (w)) - x_draw_bottom_divider (w); + gui_draw_bottom_divider (w); /* Turn the cursor on again. */ if (cursor_cleared_p @@ -32499,7 +32498,7 @@ expose_frame (struct frame *f, int x, int y, int w, int h) empty. */ bool -x_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result) +gui_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result) { XRectangle *left, *right; XRectangle *upper, *lower; diff --git a/src/xfns.c b/src/xfns.c index 9075491e97..ee3266e223 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1388,8 +1388,8 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (FRAME_VISIBLE_P (f)) { - x_update_cursor (f, false); - x_update_cursor (f, true); + gui_update_cursor (f, false); + gui_update_cursor (f, true); } } @@ -4583,7 +4583,7 @@ x_get_monitor_for_frame (struct frame *f, if (mi->geom.width == 0) continue; - if (x_intersect_rectangles (&mi->geom, &frect, &res)) + if (gui_intersect_rectangles (&mi->geom, &frect, &res)) { a = res.width * res.height; if (a > area) @@ -4712,7 +4712,7 @@ x_get_monitor_attributes_xinerama (struct x_display_info *dpyinfo) if (i == 0 && x_get_net_workarea (dpyinfo, &workarea_r)) { mi->work = workarea_r; - if (! x_intersect_rectangles (&mi->geom, &mi->work, &mi->work)) + if (! gui_intersect_rectangles (&mi->geom, &mi->work, &mi->work)) mi->work = mi->geom; } else @@ -4816,7 +4816,7 @@ x_get_monitor_attributes_xrandr (struct x_display_info *dpyinfo) if (i == primary && x_get_net_workarea (dpyinfo, &workarea_r)) { mi->work= workarea_r; - if (! x_intersect_rectangles (&mi->geom, &mi->work, &mi->work)) + if (! gui_intersect_rectangles (&mi->geom, &mi->work, &mi->work)) mi->work = mi->geom; } else diff --git a/src/xterm.c b/src/xterm.c index e85e8e35d4..5d4d2ca3b7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1168,9 +1168,9 @@ x_update_window_end (struct window *w, bool cursor_on_p, if (draw_window_fringes (w, true)) { if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - x_draw_right_divider (w); + gui_draw_right_divider (w); else - x_draw_vertical_border (w); + gui_draw_vertical_border (w); } unblock_input (); @@ -3077,7 +3077,7 @@ x_draw_image_foreground (struct glyph_string *s) image_rect.y = y; image_rect.width = s->slice.width; image_rect.height = s->slice.height; - if (x_intersect_rectangles (&clip_rect, &image_rect, &r)) + if (gui_intersect_rectangles (&clip_rect, &image_rect, &r)) x_composite_image (s, FRAME_X_DRAWABLE (s->f), s->slice.x + r.x - x, s->slice.y + r.y - y, r.x, r.y, r.width, r.height); @@ -3091,7 +3091,7 @@ x_draw_image_foreground (struct glyph_string *s) image_rect.y = y; image_rect.width = s->slice.width; image_rect.height = s->slice.height; - if (x_intersect_rectangles (&clip_rect, &image_rect, &r)) + if (gui_intersect_rectangles (&clip_rect, &image_rect, &r)) x_composite_image (s, FRAME_X_DRAWABLE (s->f), s->slice.x + r.x - x, s->slice.y + r.y - y, r.x, r.y, r.width, r.height); @@ -3578,7 +3578,7 @@ x_draw_underwave (struct glyph_string *s) wave_clip.height = wave_height; get_glyph_string_clip_rect (s, &string_clip); - if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip)) + if (!gui_intersect_rectangles (&wave_clip, &string_clip, &final_clip)) return; XSetClipRectangles (s->display, s->gc, 0, 0, &final_clip, 1, Unsorted); @@ -4309,7 +4309,7 @@ x_scroll_run (struct window *w, struct run *run) block_input (); /* Cursor off. Will be switched on again in x_update_window_end. */ - x_clear_cursor (w); + gui_clear_cursor (w); #ifdef USE_CAIRO if (FRAME_CR_CONTEXT (f)) @@ -4370,7 +4370,7 @@ frame_highlight (struct frame *f) f->output_data.x->border_pixel); x_uncatch_errors (); unblock_input (); - x_update_cursor (f, true); + gui_update_cursor (f, true); x_set_frame_alpha (f); } @@ -4388,7 +4388,7 @@ frame_unhighlight (struct frame *f) f->output_data.x->border_tile); x_uncatch_errors (); unblock_input (); - x_update_cursor (f, true); + gui_update_cursor (f, true); x_set_frame_alpha (f); } @@ -13077,18 +13077,18 @@ x_activate_timeout_atimer (void) static struct redisplay_interface x_redisplay_interface = { x_frame_parm_handlers, - x_produce_glyphs, - x_write_glyphs, - x_insert_glyphs, - x_clear_end_of_line, + gui_produce_glyphs, + gui_write_glyphs, + gui_insert_glyphs, + gui_clear_end_of_line, x_scroll_run, x_after_update_window_line, x_update_window_begin, x_update_window_end, x_flip_and_flush, - x_clear_window_mouse_face, - x_get_glyph_overhangs, - x_fix_overlapping_area, + gui_clear_window_mouse_face, + gui_get_glyph_overhangs, + gui_fix_overlapping_area, x_draw_fringe_bitmap, #ifdef USE_CAIRO x_cr_define_fringe_bitmap, commit 86b6e91091ba14edb4811427fec8fe194f6520d4 Author: Eli Zaretskii Date: Fri Apr 26 22:40:54 2019 +0300 Avoid assertion violations in calculating line-number width * src/indent.c (line_number_display_width): Don't use the window's start marker if it belongs to a different buffer. (Bug#35429) diff --git a/src/indent.c b/src/indent.c index 1d5d346e63..c76e6b7b4b 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1968,8 +1968,11 @@ line_number_display_width (struct window *w, int *width, int *pixel_width) outside the accessible region, in which case we widen the buffer temporarily. It could even be beyond the buffer's end (Org mode's display of source code snippets is known to cause - that), in which case we just punt and start from point instead. */ - if (startpos.charpos > Z) + that) or belong to the wrong buffer, in which cases we just + punt and start from point instead. */ + if (startpos.charpos > Z + || !(BUFFERP (w->contents) + && XBUFFER (w->contents) == XMARKER (w->start)->buffer)) SET_TEXT_POS (startpos, PT, PT_BYTE); if (startpos.charpos < BEGV || startpos.charpos > ZV) { commit 82fc8ca6ba179596928db614ab903e44968ef44e Author: Stefan Monnier Date: Fri Apr 26 08:54:02 2019 -0400 * lib-src/profile.c: Delete long-obsolete file This auxiliary executable was used by the old `profile.el` which later inspired `elp.el`. It was made obsolete when Emacs acquired native timers. * lib-src/Makefile.in (UTILITIES): Remove profile. (profile${EXEEXT}): Delete rule. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index b5b55b848e..40222174bd 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -163,7 +163,7 @@ INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \ # Things that Emacs runs internally, or during the build process, # which should not be installed in bindir. -UTILITIES = profile${EXEEXT} hexl${EXEEXT} \ +UTILITIES = hexl${EXEEXT} \ $(if $(with_mailutils), , movemail${EXEEXT}) \ $(and $(use_gamedir), update-game-score${EXEEXT}) @@ -380,10 +380,6 @@ ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \ $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ $< $(NTLIB) $(LOADLIBES) -o $@ -profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h) - $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \ - $(NTLIB) $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o $@ - make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h) $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@ diff --git a/lib-src/profile.c b/lib-src/profile.c deleted file mode 100644 index 257008e92d..0000000000 --- a/lib-src/profile.c +++ /dev/null @@ -1,97 +0,0 @@ -/* profile.c --- generate periodic events for profiling of Emacs Lisp code. - Copyright (C) 1992, 1994, 1999, 2001-2019 Free Software Foundation, - Inc. - -Author: Boaz Ben-Zvi - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or (at -your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - - -/** - ** To be run as an emacs subprocess. Input string that starts with: - ** 'z' -- resets the watch (to zero). - ** 'p' -- return time (on stdout) as string with format . - ** 'q' -- exit. - ** - ** abstraction : a stopwatch - ** operations: reset_watch, get_time - */ - -#include - -#include -#include - -#include -#include -#include - -static struct timespec TV1; -static int watch_not_started = 1; /* flag */ -static char time_string[INT_STRLEN_BOUND (uintmax_t) + sizeof "." - + LOG10_TIMESPEC_HZ]; - -/* Reset the stopwatch to zero. */ - -static void -reset_watch (void) -{ - TV1 = current_timespec (); - watch_not_started = 0; -} - -/* This call returns the time since the last reset_watch call. The time - is returned as a string with the format . - If reset_watch was not called yet, exit. */ - -static char * -get_time (void) -{ - struct timespec TV2 = timespec_sub (current_timespec (), TV1); - uintmax_t s = TV2.tv_sec; - int ns = TV2.tv_nsec; - if (watch_not_started) - exit (EXIT_FAILURE); /* call reset_watch first ! */ - sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_TIMESPEC_HZ, ns); - return time_string; -} - -int -main (void) -{ - int c; - while ((c = getchar ()) != EOF) - { - switch (c) - { - case 'z': - reset_watch (); - break; - case 'p': - puts (get_time ()); - break; - case 'q': - return EXIT_SUCCESS; - } - /* Anything remaining on the line is ignored. */ - while (c != '\n' && c != EOF) - c = getchar (); - } - return EXIT_FAILURE; -} - - -/* profile.c ends here */ commit cc70501a3a77e2cb8649eee0f0c03689e8232a68 Author: Michael Albinus Date: Fri Apr 26 12:31:50 2019 +0200 Handle quoted file names in tramp-archive.el * lisp/net/tramp-archive.el (tramp-archive-file-name-p): Suppress quoted file names. (tramp-archive-file-name-handler): Handle quoted file names. * lisp/net/tramp-compat.el (tramp-compat-file-name-quoted-p): Add optional TOP argument. diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index ba4c26cdf2..b096edc4b3 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -318,10 +318,11 @@ pass to the OPERATION." operation args)) (archive (tramp-archive-file-name-archive filename))) - ;; The file archive could be a directory, see Bug#30293. - (if (and archive - (tramp-archive-run-real-handler - #'file-directory-p (list archive))) + ;; `filename' could be a quoted file name. Or the file + ;; archive could be a directory, see Bug#30293. + (if (or (null archive) + (tramp-archive-run-real-handler + #'file-directory-p (list archive))) (tramp-archive-run-real-handler operation args) ;; Now run the handler. (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) @@ -384,6 +385,8 @@ pass to the OPERATION." (defun tramp-archive-file-name-p (name) "Return t if NAME is a string with archive file name syntax." (and (stringp name) + ;; `tramp-archive-file-name-regexp' does not suppress quoted file names. + (not (tramp-compat-file-name-quoted-p name t)) ;; We cannot use `string-match-p', the matches are used. (string-match tramp-archive-file-name-regexp name) t)) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index e3d0343569..ae743b2507 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -198,10 +198,11 @@ It returns a file name which can be used directly as argument of (if (fboundp 'file-name-quoted-p) (defalias 'tramp-compat-file-name-quoted-p #'file-name-quoted-p) - (defsubst tramp-compat-file-name-quoted-p (name) + (defsubst tramp-compat-file-name-quoted-p (name &optional top) "Whether NAME is quoted with prefix \"/:\". -If NAME is a remote file name, check the local part of NAME." - (string-prefix-p "/:" (tramp-compat-file-local-name name)))) +If NAME is a remote file name and TOP is nil, check the local part of NAME." + (let ((file-name-handler-alist (unless top file-name-handler-alist))) + (string-prefix-p "/:" (tramp-compat-file-local-name name))))) (if (fboundp 'file-name-quote) (defalias 'tramp-compat-file-name-quote #'file-name-quote)