>From 55a39c6cb4eb9a1442dd3388766f0219bf8cd825 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Sat, 13 Apr 2019 09:40:03 -0600 Subject: [PATCH 3/5] Rename non-X x_* identifiers * src/image.c: Rename x_* procedures to image_* and gui_*. * src/frame.c: Rename x_* procedures to gui_*. * 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 (focus_frame_hook) (iconify_frame_hook, set_frame_alpha_hook) (set_new_font_hook, implicit_set_name_hook) (change_tool_bar_height_hook, set_scroll_bar_default_width_hook) (set_scroll_bar_default_height_hook): New terminal hooks. * src/dispextern.h (clear_under_internal_border): New RIF function pointer. --- src/dispextern.h | 32 +-- src/fontset.c | 15 +- src/frame.c | 194 ++++++++-------- src/frame.h | 70 +++--- src/gtkutil.c | 14 +- src/image.c | 306 +++++++++++++------------ src/keyboard.c | 2 +- src/lisp.h | 2 +- src/nsfns.m | 310 ++++++++++++------------- src/nsterm.h | 40 ++-- src/nsterm.m | 162 ++++++++----- src/termhooks.h | 26 +++ src/w32fns.c | 578 +++++++++++++++++++++++------------------------ src/w32font.c | 2 +- src/w32menu.c | 2 +- src/w32term.c | 555 +++++++++++++++++++++++---------------------- src/w32term.h | 31 +-- src/window.c | 2 +- src/xdisp.c | 23 +- src/xfaces.c | 8 +- src/xfns.c | 361 +++++++++++++---------------- src/xterm.c | 122 +++++++--- src/xterm.h | 17 +- 23 files changed, 1470 insertions(+), 1404 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 79ec4ce52e..d42b0359ed 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -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 @@ -3348,19 +3353,19 @@ 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 *, +extern void gui_reference_bitmap (struct frame *, ptrdiff_t); +extern ptrdiff_t gui_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 gui_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); #endif -extern void x_destroy_all_bitmaps (Display_Info *); +extern void gui_destroy_all_bitmaps (Display_Info *); extern void x_create_bitmap_mask (struct frame *, ptrdiff_t); -extern Lisp_Object x_find_image_file (Lisp_Object); +extern Lisp_Object gui_find_image_file (Lisp_Object); void x_kill_gs_process (Pixmap, struct frame *); struct image_cache *make_image_cache (void); @@ -3446,11 +3451,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); @@ -3593,16 +3593,16 @@ 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 *, - enum resource_types); +extern Lisp_Object gui_default_parameter (struct frame *, Lisp_Object, + Lisp_Object, Lisp_Object, + const char *, const char *, + enum resource_types); extern char *x_get_string_resource (XrmDatabase, const char *, const char *); #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/fontset.c b/src/fontset.c index eec1e0da4c..0a6edc7eb1 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -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 192ef4244f..48a6aa7668 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. */ @@ -537,8 +537,8 @@ keep_ratio (struct frame *f, struct frame *p, int old_width, int old_height, * 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. + * 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 @@ -1296,6 +1296,32 @@ affects all frames on the same terminal device. */) return frame; } +#ifdef HAVE_WINDOW_SYSTEM +Lisp_Object +gui_get_focus_frame (struct frame *frame) +{ + Lisp_Object gfocus; + struct frame *gui_focus_frame; + +#ifdef HAVE_X_WINDOWS + struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); + gui_focus_frame = dpyinfo->x_focus_frame; +#elif defined (HAVE_NTGUI) + struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); + gui_focus_frame = dpyinfo->w32_focus_frame; +#elif defined (HAVE_NS) + struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); + gui_focus_frame = dpyinfo->ns_focus_frame; +#endif + + if (!gui_focus_frame) + return Qnil; + + XSETFRAME (gfocus, gui_focus_frame); + return gfocus; +} +#endif + /* Perform the switch to frame FRAME. @@ -1366,18 +1392,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 = gui_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 */ @@ -2583,11 +2609,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); @@ -2639,11 +2662,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; @@ -2687,13 +2707,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; } @@ -2755,7 +2770,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; } @@ -2771,7 +2786,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; } @@ -2840,7 +2855,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; } @@ -2911,7 +2928,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) @@ -3163,7 +3180,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 { @@ -3269,7 +3286,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 @@ -3651,12 +3668,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; @@ -3903,12 +3920,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; @@ -4035,7 +4052,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) store_frame_param (f, prop, val); - param_index = Fget (prop, Qx_frame_parameter); + param_index = Fget (prop, Qframe_parameter_pos); if (FIXNATP (param_index) && XFIXNAT (param_index) < ARRAYELTS (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XFIXNUM (param_index)]) @@ -4097,7 +4114,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) 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))) **/ - adjust_frame_size (f, width, height, 1, 0, Qx_set_frame_parameters); + adjust_frame_size (f, width, height, 1, 0, Qgui_set_frame_parameters); if ((!NILP (left) || !NILP (top)) && ! (left_no_change && top_no_change) @@ -4174,7 +4191,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); } @@ -4188,14 +4205,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; @@ -4277,7 +4294,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; @@ -4299,7 +4316,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; @@ -4325,7 +4342,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; @@ -4341,7 +4358,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu bgcolor = Fassq (Qbackground_color, f->param_alist); if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor))) { - Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter); + Lisp_Object parm_index = Fget (Qbackground_color, Qframe_parameter_pos); if (FIXNATP (parm_index) && XFIXNAT (parm_index) < ARRAYELTS (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XFIXNAT (parm_index)]) @@ -4355,7 +4372,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; @@ -4425,8 +4442,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; } @@ -4437,7 +4454,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); @@ -4469,7 +4486,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)) @@ -4517,14 +4534,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); @@ -4548,7 +4565,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); @@ -4572,7 +4589,7 @@ 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); @@ -4586,7 +4603,7 @@ x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } 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); @@ -4601,7 +4618,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); @@ -4616,7 +4633,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); @@ -4630,25 +4647,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)) @@ -4680,7 +4697,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)) @@ -4701,7 +4718,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); @@ -4717,7 +4734,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } else { - x_set_scroll_bar_default_width (f); + FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); if (FRAME_X_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); @@ -4730,7 +4747,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); @@ -4747,7 +4764,7 @@ x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } else { - x_set_scroll_bar_default_height (f); + FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); if (FRAME_X_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); @@ -4761,7 +4778,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]; @@ -4802,25 +4819,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); @@ -4832,7 +4848,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 @@ -4843,7 +4860,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)) @@ -5196,9 +5213,9 @@ 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; @@ -5206,7 +5223,7 @@ x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, 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; } @@ -5381,7 +5398,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; @@ -5808,7 +5826,7 @@ syms_of_frame (void) DEFSYM (Qfullboth, "fullboth"); DEFSYM (Qmaximized, "maximized"); DEFSYM (Qx_resource_name, "x-resource-name"); - DEFSYM (Qx_frame_parameter, "x-frame-parameter"); + DEFSYM (Qframe_parameter_pos, "frame-parameter-pos"); DEFSYM (Qworkarea, "workarea"); DEFSYM (Qmm_size, "mm-size"); @@ -5831,7 +5849,7 @@ syms_of_frame (void) DEFSYM (Qadjust_frame_size_1, "adjust-frame-size-1"); DEFSYM (Qadjust_frame_size_2, "adjust-frame-size-2"); DEFSYM (Qadjust_frame_size_3, "adjust-frame-size-3"); - DEFSYM (Qx_set_frame_parameters, "x-set-frame-parameters"); + DEFSYM (Qgui_set_frame_parameters, "gui-set-frame-parameters"); DEFSYM (QEmacsFrameResize, "EmacsFrameResize"); DEFSYM (Qset_frame_size, "set-frame-size"); DEFSYM (Qframe_inhibit_resize, "frame-inhibit-resize"); @@ -5927,7 +5945,7 @@ syms_of_frame (void) Lisp_Object v = (frame_parms[i].sym < 0 ? intern_c_string (frame_parms[i].name) : builtin_lisp_symbol (frame_parms[i].sym)); - Fput (v, Qx_frame_parameter, make_fixnum (i)); + Fput (v, Qframe_parameter_pos, make_fixnum (i)); } } diff --git a/src/frame.h b/src/frame.h index ec8f61465f..7b5aeaa136 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1544,37 +1544,32 @@ 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); @@ -1587,16 +1582,10 @@ extern Lisp_Object display_x_get_resource (Display_Info *, 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 Lisp_Object gui_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,9 +1597,6 @@ 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); @@ -1618,7 +1604,7 @@ 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); diff --git a/src/gtkutil.c b/src/gtkutil.c index b130692c87..0ddf1886d8 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -385,7 +385,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 = gui_find_image_file (specified_file))) { char *encoded_file = SSDATA (ENCODE_FILE (file)); if (! old_widget) @@ -935,7 +935,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); @@ -963,7 +963,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); @@ -1029,7 +1029,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 @@ -1147,8 +1147,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)); } } @@ -4405,7 +4405,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 6e415ef1f7..2b47aebe99 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,7 +129,7 @@ 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 + If you use gui_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. */ @@ -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) +gui_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) +gui_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) +gui_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 = gui_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) +gui_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 = gui_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 = gui_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].have_mask = false; dpyinfo->bitmaps[id - 1].refcount = 1; @@ -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) +gui_destroy_all_bitmaps (Display_Info *dpyinfo) { ptrdiff_t i; Bitmap_Record *bm = dpyinfo->bitmaps; @@ -414,9 +415,9 @@ x_destroy_all_bitmaps (Display_Info *dpyinfo) 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 gui_create_x_image_and_pixmap (struct frame *, int, int, int, + XImagePtr *, Pixmap *, Picture *); +static void gui_destroy_x_image (XImagePtr ximg); #ifdef HAVE_NTGUI static XImagePtr_or_DC image_get_x_image_or_dc (struct frame *, struct image *, @@ -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 = gui_create_x_image_and_pixmap (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); + gui_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,13 +1314,17 @@ 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) +gui_query_frame_background_color (struct frame *f, XColor *bgcolor) { -#ifndef HAVE_NS - bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); - x_query_color (f, bgcolor); +#ifdef HAVE_NS + ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, true); #else - ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, 1); + bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); +# ifdef HAVE_NTGUI + w32_query_colors (f, bgcolor, 1); +# else + x_query_colors (f, bgcolor, 1); +# endif /* HAVE_NTGUI */ #endif } @@ -1341,7 +1346,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) +gui_clear_image_1 (struct frame *f, struct image *img, int flags) { if (flags & CLEAR_IMAGE_PIXMAP) { @@ -1355,7 +1360,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); + gui_destroy_x_image (img->ximg); img->ximg = NULL; img->background_valid = 0; } @@ -1373,7 +1378,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); + gui_destroy_x_image (img->mask_img); img->mask_img = NULL; img->background_transparent_valid = 0; } @@ -1396,14 +1401,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) +gui_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, + gui_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_MASK | CLEAR_IMAGE_COLORS); unblock_input (); } @@ -1415,7 +1420,7 @@ 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, +gui_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name, unsigned long dflt) { XColor color; @@ -1715,7 +1720,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 +1728,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); + gui_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 +1865,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) +gui_set_image_size (struct frame *f, struct image *img) { #ifdef HAVE_NATIVE_SCALING # ifdef HAVE_IMAGEMAGICK @@ -1964,7 +1969,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); + gui_set_image_size (f, img); ascent = image_spec_value (spec, QCascent, NULL); if (FIXNUMP (ascent)) @@ -1996,8 +2001,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)); + = gui_alloc_image_color (f, img, bg, + FRAME_BACKGROUND_PIXEL (f)); img->background_valid = 1; } } @@ -2094,7 +2099,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) +gui_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 +2143,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) +gui_create_x_image_and_pixmap (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 +2164,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 (! gui_check_image_size (*ximg, width, height)) { - x_destroy_x_image (*ximg); + gui_destroy_x_image (*ximg); *ximg = NULL; image_error ("Image too large (%dx%d)", make_fixnum (width), make_fixnum (height)); @@ -2175,7 +2180,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); + gui_destroy_x_image (*ximg); *ximg = NULL; image_error ("Unable to create X pixmap"); return 0; @@ -2297,7 +2302,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); + gui_destroy_x_image (*ximg); *ximg = NULL; return 0; } @@ -2323,7 +2328,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) +gui_destroy_x_image (XImagePtr ximg) { eassert (input_blocked_p ()); if (ximg) @@ -2349,7 +2354,7 @@ 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 +2380,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 gui_create_x_image_and_pixmap, so that it matches with image_put_x_image. */ static bool @@ -2389,9 +2394,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 gui_create_x_image_and_pixmap (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 +2421,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, + gui_put_x_image (f, ximg, !mask_p ? img->pixmap : img->mask, img->width, img->height); - x_destroy_x_image (ximg); + gui_destroy_x_image (ximg); #endif } @@ -2431,14 +2436,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); + gui_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); + gui_destroy_x_image (img->mask_img); img->mask_img = NULL; } } @@ -2520,7 +2525,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) +gui_find_image_fd (Lisp_Object file, int *pfd) { Lisp_Object file_found, search_path; int fd; @@ -2558,9 +2563,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) +gui_find_image_file (Lisp_Object file) { - return x_find_image_fd (file, 0); + return gui_find_image_fd (file, 0); } /* Read FILE into memory. Value is a pointer to a buffer allocated @@ -2661,7 +2666,7 @@ static struct image_type xbm_type = SYMBOL_INDEX (Qxbm), xbm_image_p, xbm_load, - x_clear_image, + gui_clear_image, NULL, NULL }; @@ -2981,7 +2986,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) + (gui_check_image_size (0, img->width, img->height) ? XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), data, @@ -3098,7 +3103,7 @@ xbm_read_bitmap_data (struct frame *f, char *contents, char *end, expect ('='); expect ('{'); - if (! x_check_image_size (0, *width, *height)) + if (! gui_check_image_size (0, *width, *height)) { if (!inhibit_image_error) image_error ("Image too large (%dx%d)", @@ -3186,13 +3191,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 = gui_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 = gui_alloc_image_color (f, img, value, background); img->background = background; img->background_valid = 1; non_default_colors = 1; @@ -3205,7 +3210,7 @@ xbm_load_image (struct frame *f, struct image *img, char *contents, char *end) if (img->pixmap == NO_PIXMAP) { - x_clear_image (f, img); + gui_clear_image (f, img); image_error ("Unable to create X pixmap for `%s'", img->spec); } else @@ -3247,7 +3252,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 = gui_find_image_fd (file_name, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -3302,16 +3307,16 @@ 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 = gui_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 = gui_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value, + background); non_default_colors = 1; } @@ -3358,7 +3363,7 @@ xbm_load (struct frame *f, struct image *img) #endif /* Create the pixmap. */ - if (x_check_image_size (0, img->width, img->height)) + if (gui_check_image_size (0, img->width, img->height)) Create_Pixmap_From_Bitmap_Data (f, img, bits, foreground, background, non_default_colors); @@ -3371,7 +3376,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); + gui_clear_image (f, img); } SAFE_FREE (); @@ -3468,7 +3473,7 @@ static struct image_type xpm_type = SYMBOL_INDEX (Qxpm), xpm_image_p, xpm_load, - x_clear_image, + gui_clear_image, init_xpm_functions, NULL }; @@ -3769,7 +3774,7 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits) return -1; } - id = x_allocate_bitmap_record (f); + id = gui_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 +3908,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 = gui_find_image_file (specified_file); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -3993,7 +3998,7 @@ xpm_load (struct frame *f, struct image *img) else { rc = XpmFileInvalid; - x_clear_image (f, img); + gui_clear_image (f, img); } #else #ifdef HAVE_X_WINDOWS @@ -4004,7 +4009,7 @@ xpm_load (struct frame *f, struct image *img) img->ximg->depth); if (img->pixmap == NO_PIXMAP) { - x_clear_image (f, img); + gui_clear_image (f, img); rc = XpmNoMemory; } else if (img->mask_img) @@ -4015,7 +4020,7 @@ xpm_load (struct frame *f, struct image *img) img->mask_img->depth); if (img->mask == NO_PIXMAP) { - x_clear_image (f, img); + gui_clear_image (f, img); rc = XpmNoMemory; } } @@ -4528,17 +4533,17 @@ xpm_load_image (struct frame *f, } else { - x_destroy_x_image (mask_img); - x_clear_image_1 (f, img, CLEAR_IMAGE_MASK); + gui_destroy_x_image (mask_img); + gui_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); + gui_destroy_x_image (ximg); + gui_destroy_x_image (mask_img); + gui_clear_image (f, img); return 0; #undef match @@ -4558,7 +4563,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 = gui_find_image_fd (file_name, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -4789,7 +4794,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 (); @@ -4934,8 +4939,13 @@ 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); - + { +# ifdef HAVE_NTGUI + w32_query_colors (f, row, img->width); +# else + x_query_colors (f, row, img->width); +# endif + } #else for (x = 0; x < img->width; ++x, ++p) @@ -5016,7 +5026,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); + gui_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,7 +5057,8 @@ 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 *new, *p; @@ -5117,9 +5128,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 +5139,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 +5157,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 +5180,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 @@ -5279,7 +5290,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 +5306,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); + gui_clear_image_1 (f, img, CLEAR_IMAGE_MASK); #ifndef HAVE_NTGUI #ifndef HAVE_NS @@ -5335,7 +5347,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)); + gui_alloc_image_color (f, img, build_string (color_name), 0)); use_img_background = 0; } } @@ -5378,7 +5390,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: gui_destroy_x_image ((XImagePtr )mask_img); which seems bogus ++kfs */ xfree (mask_img); #endif /* HAVE_NTGUI */ @@ -5436,7 +5448,7 @@ static struct image_type pbm_type = SYMBOL_INDEX (Qpbm), pbm_image_p, pbm_load, - x_clear_image, + gui_clear_image, NULL, NULL }; @@ -5547,7 +5559,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 = gui_find_image_fd (specified_file, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -5675,7 +5687,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 +5696,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 = gui_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 = gui_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); img->background = bg; img->background_valid = 1; } @@ -5712,9 +5724,9 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO cairo_surface_destroy (surface); #else - x_destroy_x_image (ximg); + gui_destroy_x_image (ximg); #endif - x_clear_image (f, img); + gui_clear_image (f, img); image_error ("Invalid image size in image `%s'", img->spec); goto error; @@ -5758,9 +5770,9 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO cairo_surface_destroy (surface); #else - x_destroy_x_image (ximg); + gui_destroy_x_image (ximg); #endif - x_clear_image (f, img); + gui_clear_image (f, img); image_error ("Invalid image size in image `%s'", img->spec); goto error; } @@ -5792,7 +5804,7 @@ pbm_load (struct frame *f, struct image *img) #ifdef USE_CAIRO cairo_surface_destroy (surface); #else - x_destroy_x_image (ximg); + gui_destroy_x_image (ximg); #endif image_error ("Invalid pixel value in image `%s'", img->spec); goto error; @@ -5904,7 +5916,7 @@ static struct image_type png_type = SYMBOL_INDEX (Qpng), png_image_p, png_load, - x_clear_image, + gui_clear_image, init_png_functions, NULL }; @@ -6186,7 +6198,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 = gui_find_image_fd (specified_file, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -6341,7 +6353,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)) + : (gui_query_frame_background_color (f, &color), true)) /* The user specified `:background', use that. */ { int shift = bit_depth == 16 ? 0 : 8; @@ -6398,8 +6410,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); + gui_destroy_x_image (ximg); + gui_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP); goto error; } #endif @@ -6581,7 +6593,7 @@ static struct image_type jpeg_type = SYMBOL_INDEX (Qjpeg), jpeg_image_p, jpeg_load, - x_clear_image, + gui_clear_image, init_jpeg_functions, NULL }; @@ -6945,7 +6957,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 = gui_find_image_fd (specified_file, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -6997,10 +7009,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); + gui_destroy_x_image (ximg); #endif /* Free pixmap and colors. */ - x_clear_image (f, img); + gui_clear_image (f, img); return 0; } @@ -7213,7 +7225,7 @@ static struct image_type tiff_type = SYMBOL_INDEX (Qtiff), tiff_image_p, tiff_load, - x_clear_image, + gui_clear_image, init_tiff_functions, NULL }; @@ -7457,7 +7469,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 = gui_find_image_file (specified_file); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -7709,7 +7721,7 @@ static void gif_clear_image (struct frame *f, struct image *img) { img->lisp_data = Qnil; - x_clear_image (f, img); + gui_clear_image (f, img); } /* Return true if OBJECT is a valid GIF image specification. */ @@ -7893,7 +7905,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 = gui_find_image_file (specified_file); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", specified_file); @@ -8079,8 +8091,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 = gui_alloc_image_color (f, img, specified_bg, + FRAME_BACKGROUND_PIXEL (f)); #endif for (j = 0; j <= idx; ++j) @@ -8376,7 +8388,7 @@ static void imagemagick_clear_image (struct frame *f, struct image *img) { - x_clear_image (f, img); + gui_clear_image (f, img); } /* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do @@ -8787,7 +8799,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); + gui_query_frame_background_color (f, &bgcolor); bg_wand = NewPixelWand (); PixelSetRed (bg_wand, (double) bgcolor.red / 65535); @@ -8981,7 +8993,7 @@ imagemagick_load_image (struct frame *f, struct image *img, free_color_table (); #endif #ifndef USE_CAIRO - x_destroy_x_image (ximg); + gui_destroy_x_image (ximg); #endif image_error ("Imagemagick pixel iterator creation failed"); goto imagemagick_error; @@ -9067,7 +9079,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 = gui_find_image_file (file_name); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -9198,7 +9210,7 @@ static struct image_type svg_type = SYMBOL_INDEX (Qsvg), svg_image_p, svg_load, - x_clear_image, + gui_clear_image, init_svg_functions, NULL }; @@ -9368,7 +9380,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 = gui_find_image_fd (file_name, &fd); if (!STRINGP (file)) { image_error ("Cannot find image file `%s'", file_name); @@ -9522,7 +9534,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); + gui_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 @@ -9665,7 +9677,7 @@ static struct image_type gs_type = static void gs_clear_image (struct frame *f, struct image *img) { - x_clear_image (f, img); + gui_clear_image (f, img); } @@ -9745,7 +9757,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 (gui_check_image_size (0, img->width, img->height)) { /* Only W32 version did BLOCK_INPUT here. ++kfs */ block_input (); @@ -9855,7 +9867,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 gui_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 8fb6db987b..b6521e53bd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6510,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 681efc3b52..addac3b6db 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4679,7 +4679,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/nsfns.m b/src/nsfns.m index 009e9d55e2..bc47c40ced 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); @@ -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, @@ -897,56 +897,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 +979,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 @@ -1162,35 +1162,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,25 +1201,25 @@ 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); @@ -1263,31 +1263,32 @@ 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); f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !NILP (tem)); @@ -1320,7 +1321,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,25 +1331,25 @@ 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); + 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 x_set_window_size, now. */ f->can_x_set_window_size = true; @@ -1371,7 +1372,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. visibility = Qt; if (EQ (visibility, Qicon)) - x_iconify_frame (f); + ns_iconify_frame (f); else if (! NILP (visibility)) { x_make_frame_visible (f); @@ -1395,7 +1396,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. 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 +1405,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 +1776,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 +1786,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 +2216,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 +2225,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; @@ -2267,20 +2253,6 @@ Frames are listed from topmost (first) to bottommost (last). */) : 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; -} - /* ========================================================================== Lisp definitions that, for whatever reason, we can't alias as 'ns-XXX'. @@ -2361,7 +2333,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 +2344,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 +2631,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); } diff --git a/src/nsterm.h b/src/nsterm.h index 78ce608554..4d72ae2402 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -881,8 +881,8 @@ struct ns_display_info mouse-face. */ Mouse_HLInfo mouse_highlight; - struct frame *x_highlight_frame; - struct frame *x_focus_frame; + struct frame *ns_highlight_frame; + struct frame *ns_focus_frame; /* The frame where the mouse was last time we reported a mouse event. */ struct frame *last_mouse_frame; @@ -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); @@ -1151,6 +1154,12 @@ 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); + /* C access to ObjC functionality */ extern void ns_release_object (void *obj); extern void ns_retain_object (void *obj); @@ -1172,6 +1181,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 +1212,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..8d0b14b38f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1444,6 +1444,23 @@ -(void)remove ========================================================================== */ +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 +1514,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 +1526,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 +1547,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 +1603,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 +1624,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 +1673,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 +1695,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 +1713,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 +1732,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 +1746,7 @@ -(void)remove NSView *view = FRAME_NS_VIEW (f); NSScreen *screen = [[view window] screen]; - NSTRACE ("x_set_offset"); + NSTRACE ("ns_set_offset"); block_input (); @@ -1853,7 +1882,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 +1897,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 +1932,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 +1958,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 +2006,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 +2015,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 +2024,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 +2034,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 +2054,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 +2380,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 +2400,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 +2431,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 +2441,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 +2569,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 +2667,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 +5018,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 +5033,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 +5117,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 +5154,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 +5186,13 @@ static Lisp_Object ns_string_to_lispmod (const char *s) block_input (); - x_destroy_all_bitmaps (dpyinfo); + gui_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 +5216,25 @@ 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->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_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->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->delete_frame_hook = ns_destroy_window; terminal->delete_terminal_hook = ns_delete_terminal; /* Other hooks are NULL by default. */ @@ -5658,7 +5697,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 +7254,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 +7275,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 +7289,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) @@ -9222,9 +9261,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..40749dda37 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -512,6 +512,9 @@ struct terminal Lisp_Object *y, Time *); + /* 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. */ @@ -534,6 +537,19 @@ struct terminal 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 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); + + 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); @@ -542,6 +558,11 @@ struct terminal Lisp_Object (*popup_dialog_hook) (struct frame *f, Lisp_Object header, Lisp_Object contents); +#ifndef HAVE_EXT_TOOL_BAR + /* This hook is called to change the frame's (internal) tool-bar. */ + void (*change_tool_bar_height_hook) (struct frame *f, int height); +#endif + /* Scroll bar hooks. */ /* The representation of scroll bars is determined by the code which @@ -583,6 +604,11 @@ struct terminal int portion, int whole, int position); + /* Set the default scroll bar width on FRAME. */ + void (*x_set_scroll_bar_default_width) (struct frame *frame); + + /* Set the default scroll bar height on FRAME. */ + void (*x_set_scroll_bar_default_height) (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 diff --git a/src/w32fns.c b/src/w32fns.c index e6cb1ee311..f01ced604b 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -314,7 +314,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 +331,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 +355,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 +372,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 +1244,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 +1269,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 +1277,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 +1301,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 +1319,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 +1330,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 +1479,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 +1527,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 +1545,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; @@ -1590,8 +1590,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 +1638,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 +1685,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; @@ -1707,22 +1707,22 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva 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 +1761,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 +1777,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 +1792,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 +1849,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 +1909,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 +1955,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 +1991,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 +2002,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 +2012,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 +2024,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 +2055,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 +2083,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 +2117,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 +2128,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 +2151,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 +2162,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 +2181,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 +2206,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 +4018,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 +4037,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 +4057,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 +4070,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 +4522,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 +4698,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 +4740,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 +4878,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 +4920,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 +4945,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 +4976,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 +5022,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 +5083,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 +5132,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 +5197,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 +5216,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 +5355,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; @@ -5496,7 +5496,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 +5507,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,7 +5525,7 @@ 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; @@ -5544,24 +5544,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 +5579,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 +5598,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 +5606,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,11 +5630,11 @@ 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); + RES_TYPE_STRING); Lisp_Object font; if (EQ (font_param, Qunbound)) font_param = Qnil; @@ -5674,10 +5664,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, @@ -5844,16 +5834,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). */ @@ -5868,46 +5858,46 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 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 +5905,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. @@ -5943,24 +5933,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 +5971,16 @@ 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); 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,19 +5989,19 @@ 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); + 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 x_set_window_size, now. */ f->can_x_set_window_size = true; @@ -6024,7 +6015,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 +6024,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 @@ -6047,7 +6038,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, = x_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)) @@ -6062,8 +6053,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. */ @@ -6085,21 +6076,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 +6140,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 +6150,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 +6224,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 +6240,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 +6414,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) @@ -6536,7 +6512,7 @@ x_screen_planes (register struct frame *f) Open a new connection if necessary. */ struct w32_display_info * -x_display_info_for_name (Lisp_Object name) +w32_display_info_for_name (Lisp_Object name) { struct w32_display_info *dpyinfo; @@ -6655,7 +6631,7 @@ DEFUN ("x-close-connection", Fx_close_connection, block_input (); x_destroy_all_bitmaps (dpyinfo); - x_delete_display (dpyinfo); + w32_delete_display (dpyinfo); unblock_input (); return Qnil; @@ -6831,13 +6807,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; @@ -6876,7 +6852,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 +6888,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). */ @@ -6935,24 +6911,24 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms) 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 +6937,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 +6951,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 @@ -7079,8 +7055,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 +7121,7 @@ compute_tip_xy (struct frame *f, } /** - * x_hide_tip: + * w32_hide_tip: * * Hide currently visible tooltip and cancel its timer. * @@ -7156,7 +7132,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)) { @@ -7329,13 +7305,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 +7340,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 +7461,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 +7597,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 +8900,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 +10138,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/w32menu.c b/src/w32menu.c index 38e1b506e0..42912db443 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -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/w32term.c b/src/w32term.c index edcdc56a9e..a3589c06c9 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); +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 (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]; @@ -1599,7 +1594,7 @@ w32_alloc_lighter_color (struct frame *f, COLORREF *color, 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) +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_reframe_highlight_1 (FRAME_DISPLAY_INFO (frame)); } static void -x_frame_rehighlight (struct w32_display_info *dpyinfo) +w32_reframe_highlight_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]; @@ -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: @@ -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; @@ -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; @@ -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; @@ -6589,8 +6579,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 +6590,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 +6599,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 +6661,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 +6679,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 +6695,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 +6726,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 +6797,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 +6818,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 +6841,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 +6854,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 +6892,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 +6909,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 +6934,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) @@ -7099,10 +7098,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 +7110,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 +7122,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 +7136,37 @@ 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->mouse_position_hook = w32_mouse_position; + 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_frame_alpha_hook = w32_set_frame_alpha; + terminal->set_new_font_hook = w32_new_font; + terminal->implicit_set_name_hook = w32_implicitly_set_name; terminal->menu_show_hook = w32_menu_show; 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->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 +7184,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 +7195,7 @@ x_delete_terminal (struct terminal *terminal) block_input (); - x_delete_display (dpyinfo); + w32_delete_display (dpyinfo); unblock_input (); } @@ -7262,7 +7271,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..6374704b54 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -227,7 +227,14 @@ 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); + +extern void w32_real_positions (struct frame *f, int *xptr, int *yptr); + +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 *); struct w32_display_info *x_display_info_for_name (Lisp_Object); @@ -237,18 +244,17 @@ 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); @@ -715,9 +721,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..d805d2f8b9 100644 --- a/src/window.c +++ b/src/window.c @@ -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) { diff --git a/src/xdisp.c b/src/xdisp.c index ae4c405b8d..11667d2735 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11592,9 +11592,8 @@ 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 */ + if (FRAME_RIF (f)->clear_under_internal_border) + FRAME_RIF (f)->clear_under_internal_border (f); fset_redisplay (f); f->garbaged = false; @@ -11664,9 +11663,8 @@ 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 */ + if (FRAME_RIF (f)->clear_under_internal_border) + FRAME_RIF (f)->clear_under_internal_border (f); } @@ -12074,7 +12072,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); } } @@ -12848,7 +12848,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); @@ -12943,7 +12943,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; @@ -14485,9 +14485,8 @@ 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 */ + if (FRAME_RIF (f)->clear_under_internal_border) + FRAME_RIF (f)->clear_under_internal_border (f); /* Prevent various kinds of signals during display update. stdio is not robust about handling diff --git a/src/xfaces.c b/src/xfaces.c index c6723ebe2c..24574ae141 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -777,13 +777,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 = gui_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 = gui_create_bitmap_from_file (f, name); } unblock_input (); @@ -5458,7 +5458,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; diff --git a/src/xfns.c b/src/xfns.c index da11e74345..392185157a 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 = gui_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, @@ -2056,7 +2056,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) x_set_name_internal (f, name); } -void +static void x_set_scroll_bar_default_width (struct frame *f) { int unit = FRAME_COLUMN_WIDTH (f); @@ -2077,7 +2077,7 @@ x_set_scroll_bar_default_width (struct frame *f) #endif } -void +static void x_set_scroll_bar_default_height (struct frame *f) { int height = FRAME_LINE_HEIGHT (f); @@ -2148,7 +2148,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; } @@ -3407,7 +3407,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 +3417,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; @@ -3518,11 +3518,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); } @@ -3768,8 +3768,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 +3782,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 @@ -3798,48 +3798,48 @@ This function is an internal primitive--use `make-frame' instead. */) 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 +3848,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); @@ -3880,30 +3880,31 @@ 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); f->no_split = minibuffer_only || EQ (tem, Qt); @@ -3927,23 +3928,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 +3956,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. */ @@ -3999,8 +4000,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 @@ -4043,11 +4044,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. */ @@ -4069,60 +4070,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'. @@ -6122,7 +6069,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. */ @@ -6245,15 +6192,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 @@ -6269,36 +6216,36 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) 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; @@ -6341,14 +6288,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 @@ -7605,41 +7552,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, @@ -7650,7 +7597,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/xterm.c b/src/xterm.c index bf6e3837a8..785a50bd3a 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); @@ -2355,16 +2355,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. @@ -2528,7 +2518,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 @@ -2569,7 +2559,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); @@ -4950,7 +4940,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; @@ -5156,7 +5146,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. */ @@ -8184,7 +8174,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); @@ -8671,7 +8661,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) @@ -8918,7 +8908,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 { @@ -9572,7 +9562,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 = gui_create_bitmap_from_file (f, file); x_create_bitmap_mask (f, bitmap_id); } else @@ -9602,8 +9592,8 @@ 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 = gui_create_bitmap_from_data (f, (char *) gnu_xbm_bits, + gnu_xbm_width, gnu_xbm_height); if (rc == -1) return true; @@ -9616,7 +9606,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); + gui_reference_bitmap (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id); bitmap_id = FRAME_DISPLAY_INFO (f)->icon_bitmap_id; } @@ -10018,7 +10008,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); @@ -10390,7 +10380,7 @@ 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 @@ -11274,7 +11264,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 @@ -11392,9 +11382,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 @@ -11406,7 +11405,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 @@ -11425,14 +11424,42 @@ x_ewmh_activate_frame (struct frame *f) } } +/* 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. */ @@ -11513,7 +11540,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)) { @@ -11690,6 +11717,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 @@ -11708,7 +11744,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)) @@ -13099,6 +13135,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, @@ -13126,6 +13164,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, @@ -13157,7 +13196,7 @@ x_delete_terminal (struct terminal *terminal) /* Normally, the display is available... */ if (dpyinfo->display) { - x_destroy_all_bitmaps (dpyinfo); + gui_destroy_all_bitmaps (dpyinfo); XSetCloseDownMode (dpyinfo->display, DestroyAll); /* Whether or not XCloseDisplay destroys the associated resource @@ -13242,15 +13281,26 @@ 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->mouse_position_hook = XTmouse_position; + 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_frame_alpha_hook = x_set_frame_alpha; + terminal->set_new_font_hook = x_new_font; + terminal->implicit_set_name_hook = x_implicitly_set_name; terminal->menu_show_hook = x_menu_show; #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; diff --git a/src/xterm.h b/src/xterm.h index c5ad38650c..a5313cf8f9 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1103,8 +1103,12 @@ 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_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 @@ -1117,7 +1121,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 *); @@ -1194,6 +1198,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 *); -- 2.21.0