diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-06-22 03:04:16 +0200 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-06-22 03:05:22 +0200 |
commit | 1c0199050bfa594287f3975aca56fc2a57ba0f66 (patch) | |
tree | 20073a58d1d5874f25875be88b097409de29487a /src | |
parent | c98bc9821f4a402d5fda67fe141ed34622c50e4f (diff) | |
download | emacs-1c0199050bfa594287f3975aca56fc2a57ba0f66.tar.gz |
Improve --without-x GCC pacification
* src/composite.c (autocmp_chars):
* src/conf_post.h (DebPrint) [HAVE_NTGUI && !DebPrint && !EMACSDEBUG]:
Use simpler ((void) 0) for no-op expression returning void.
* src/dispextern.h [HAVE_WINDOW_SYSTEM]:
Include fontset.h, for face_for_char.
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_FOR_CHAR):
Now inline functions instead of macros. This avoids the need for
all those casts to void.
(FACE_SUITABLE_FOR_ASCII_CHAR_P): Omit 2nd (unused) arg.
All uses changed.
* src/frame.c (Ficonify_frame, Fset_frame_position):
* src/xdisp.c (Fmove_point_visually, show_mouse_face):
* src/xdisp.c (note_mode_line_or_margin_highlight)
(note_mouse_highlight):
Assume HAVE_WINDOW_SYSTEM for simplicity, since the code should
now work either way without generating warnings.
* src/frame.c (display_available) [HAVE_WINDOW_SYSTEM]: New function.
(window_system_available) [HAVE_WINDOW_SYSTEM]: Move to frame.h.
(decode_window_system_frame): Use check_window_system instead of
rolling the code ourself. Return needed only if HAVE_WINDOW_SYSTEM.
(decode_window_system_frame, check_window_system):
Merge the HAVE_WINDOW_SYSTEM and !HAVE_WINDOW_SYSTEM versions into one.
* src/frame.c (Ficonify_frame, Fset_frame_position):
* src/xdisp.c (show_mouse_face, define_frame_cursor1)
(note_mouse_highlight):
Narrow the scope of the HAVE_WINDOW_SYSTEM #ifdef;
this is a better way to pacify GCC.
* src/xdisp.c (x_set_left_fringe, x_set_right_fringe)
(x_set_right_divider_width, x_set_bottom_divider_width):
* src/xfns.c (x_set_internal_border_width):
Don’t use what are now function calls as lvalues.
* src/frame.h (WINDOW_SYSTEM_RETURN): New macro.
(decode_window_system_frame, check_window_system):
Use it, to avoid the need for duplicate declarations.
(window_system_available): Now an inline function.
(display_available): New decl.
(frame_dimension): New inline function.
(FRAME_FRINGE_COLS, FRAME_LEFT_FRINGE_WIDTH)
(FRAME_RIGHT_FRINGE_WIDTH, FRAME_TOTAL_FRINGE_WIDTH)
(FRAME_INTERNAL_BORDER_WIDTH, FRAME_RIGHT_DIVIDER_WIDTH)
(FRAME_BOTTOM_DIVIDER_WIDTH):
Use it, to avoid the need for duplicate definitions.
Now inline functions instead of macros.
* src/gnutls.c (gnutls_log_function2i): Remove.
* src/gnutls.h (GNUTLS_LOG2i): Use ‘message’ directly.
This avoids complaints about gnutls_log_function2i being defined
and not used on older platforms that do not need to call GNUTLS_LOG2i.
* src/image.c (DefaultDepthOfScreen) [0]: Remove unused macro.
* src/lisp.h (AUTO_STRING_WITH_LEN): Revert change from ‘type id =
expr’ to ‘type id; id = expr’, as this would suppress valid
jump-misses-init diagnostics. Let’s find a better way to address
the problem.
* src/vm-limit.c (__MALLOC_HOOK_VOLATILE):
Define only if needed.
* src/xdisp.c (handle_single_display_spec):
Simplify fringe_bitmap computation.
(define_frame_cursor1): Do nothing unless in a window system.
All callers changed and simplified.
* src/xfaces.c (realize_default_face):
Use a simpler way to pacify GCC when a return value is not used
on some platforms.
Diffstat (limited to 'src')
-rw-r--r-- | src/composite.c | 6 | ||||
-rw-r--r-- | src/conf_post.h | 3 | ||||
-rw-r--r-- | src/dispextern.h | 40 | ||||
-rw-r--r-- | src/frame.c | 75 | ||||
-rw-r--r-- | src/frame.h | 96 | ||||
-rw-r--r-- | src/gnutls.c | 7 | ||||
-rw-r--r-- | src/gnutls.h | 2 | ||||
-rw-r--r-- | src/image.c | 3 | ||||
-rw-r--r-- | src/lisp.h | 4 | ||||
-rw-r--r-- | src/vm-limit.c | 6 | ||||
-rw-r--r-- | src/xdisp.c | 78 | ||||
-rw-r--r-- | src/xfaces.c | 12 | ||||
-rw-r--r-- | src/xfns.c | 2 |
13 files changed, 148 insertions, 186 deletions
diff --git a/src/composite.c b/src/composite.c index 5696e3ee3a9..8aa69746595 100644 --- a/src/composite.c +++ b/src/composite.c @@ -867,11 +867,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, Lisp_Object string) { ptrdiff_t count = SPECPDL_INDEX (); -#ifdef HAVE_WINDOW_SYSTEM struct frame *f = XFRAME (win->frame); -#else - (void) XFRAME (win->frame); -#endif Lisp_Object pos = make_number (charpos); ptrdiff_t to; ptrdiff_t pt = PT, pt_byte = PT_BYTE; @@ -895,7 +891,6 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, if (len <= 0) return unbind_to (count, Qnil); to = limit = charpos + len; -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) { font_object = font_range (charpos, bytepos, &to, win, face, string); @@ -906,7 +901,6 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, return unbind_to (count, Qnil); } else -#endif /* not HAVE_WINDOW_SYSTEM */ font_object = win->frame; lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object, string); diff --git a/src/conf_post.h b/src/conf_post.h index 431b7a9d826..7aa5baeb30e 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -211,8 +211,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ extern void _DebPrint (const char *fmt, ...); # define DebPrint(stuff) _DebPrint stuff # else -/* Avoid compiler warnings about empty body of 'if' statement. */ -# define DebPrint(stuff) do {} while (false) +# define DebPrint(stuff) ((void) 0) # endif #endif diff --git a/src/dispextern.h b/src/dispextern.h index 987d7f8b048..d0fc3b24df7 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -82,6 +82,7 @@ typedef XImagePtr XImagePtr_or_DC; #ifdef HAVE_WINDOW_SYSTEM # include <time.h> +# include "fontset.h" #endif #ifndef HAVE_WINDOW_SYSTEM @@ -1825,31 +1826,32 @@ struct face_cache ? FACE_FROM_ID (F, ID) \ : NULL) +/* True if FACE is suitable for displaying ASCII characters. */ +INLINE bool +FACE_SUITABLE_FOR_ASCII_CHAR_P (struct face *face) +{ #ifdef HAVE_WINDOW_SYSTEM - -/* Non-zero if FACE is suitable for displaying character CHAR. */ - -#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) \ - ((FACE) == (FACE)->ascii_face) + return face == face->ascii_face; +#else + return true; +#endif +} /* Return the id of the realized face on frame F that is like the face - FACE, but is suitable for displaying character CHAR at buffer or + FACE, but is suitable for displaying character CHARACTER at buffer or string position POS. OBJECT is the string object, or nil for buffer. This macro is only meaningful for multibyte character CHAR. */ - -#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ - face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT)) - -#else /* not HAVE_WINDOW_SYSTEM */ - -#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) \ - ((void) (FACE), (void) (CHAR), true) -#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ - ((void) (F), (void) (FACE), (void) (CHAR), (void) (POS), \ - (void) (OBJECT), (FACE)->id) - -#endif /* not HAVE_WINDOW_SYSTEM */ +INLINE int +FACE_FOR_CHAR (struct frame *f, struct face *face, int character, + ptrdiff_t pos, Lisp_Object object) +{ +#ifdef HAVE_WINDOW_SYSTEM + return face_for_char (f, face, character, pos, object); +#else + return face->id; +#endif +} /* Return true if G contains a valid character code. */ INLINE bool diff --git a/src/frame.c b/src/frame.c index 9048452381c..aa06a381108 100644 --- a/src/frame.c +++ b/src/frame.c @@ -106,39 +106,32 @@ decode_any_frame (register Lisp_Object frame) } #ifdef HAVE_WINDOW_SYSTEM - bool -window_system_available (struct frame *f) +display_available (void) { - return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : x_display_list != NULL; + return x_display_list != NULL; } +#endif struct frame * decode_window_system_frame (Lisp_Object frame) { struct frame *f = decode_live_frame (frame); - - if (!window_system_available (f)) - error ("Window system frame should be used"); + check_window_system (f); +#ifdef HAVE_WINDOW_SYSTEM return f; +#endif } -#else /* not HAVE_WINDOW_SYSTEM */ - -_Noreturn void -decode_window_system_frame (Lisp_Object frame) -{ - error ("Window system is not in use"); -} - -_Noreturn -#endif /* not HAVE_WINDOW_SYSTEM */ void check_window_system (struct frame *f) { - if (!window_system_available (f)) - error (f ? "Window system frame should be used" - : "Window system is not in use or not initialized"); +#ifdef HAVE_WINDOW_SYSTEM + if (window_system_available (f)) + return; +#endif + error (f ? "Window system frame should be used" + : "Window system is not in use or not initialized"); } /* Return the value of frame parameter PROP in frame FRAME. */ @@ -2137,20 +2130,18 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, If omitted, FRAME defaults to the currently selected frame. */) (Lisp_Object frame) { -#ifdef HAVE_WINDOW_SYSTEM struct frame *f = decode_live_frame (frame); -#else - (void) decode_live_frame (frame); -#endif /* 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. */ -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) + { +#ifdef HAVE_WINDOW_SYSTEM x_iconify_frame (f); #endif + } /* Make menu bar update for the Buffers and Frames menus. */ windows_or_buffers_changed = 17; @@ -3013,20 +3004,18 @@ or bottom edge of the outer frame of FRAME relative to the right or bottom edge of FRAME's display. */) (Lisp_Object frame, Lisp_Object x, Lisp_Object y) { -#ifdef HAVE_WINDOW_SYSTEM - register struct frame *f = decode_live_frame (frame); -#else - (void) decode_live_frame (frame); -#endif + struct frame *f = decode_live_frame (frame); CHECK_TYPE_RANGED_INTEGER (int, x); CHECK_TYPE_RANGED_INTEGER (int, y); /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) - x_set_offset (f, XINT (x), XINT (y), 1); + { +#ifdef HAVE_WINDOW_SYSTEM + x_set_offset (f, XINT (x), XINT (y), 1); #endif + } return Qt; } @@ -3755,8 +3744,8 @@ x_set_left_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_value if (new_width != old_width) { - FRAME_LEFT_FRINGE_WIDTH (f) = new_width; - FRAME_FRINGE_COLS (f) /* Round up. */ + f->left_fringe_width = new_width; + f->fringe_cols /* Round up. */ = (new_width + FRAME_RIGHT_FRINGE_WIDTH (f) + unit - 1) / unit; if (FRAME_X_WINDOW (f) != 0) @@ -3779,8 +3768,8 @@ x_set_right_fringe (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu if (new_width != old_width) { - FRAME_RIGHT_FRINGE_WIDTH (f) = new_width; - FRAME_FRINGE_COLS (f) /* Round up. */ + f->right_fringe_width = new_width; + f->fringe_cols /* Round up. */ = (new_width + FRAME_LEFT_FRINGE_WIDTH (f) + unit - 1) / unit; if (FRAME_X_WINDOW (f) != 0) @@ -3809,13 +3798,11 @@ void x_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); - FRAME_RIGHT_DIVIDER_WIDTH (f) = XINT (arg); - if (FRAME_RIGHT_DIVIDER_WIDTH (f) < 0) - FRAME_RIGHT_DIVIDER_WIDTH (f) = 0; - if (FRAME_RIGHT_DIVIDER_WIDTH (f) != old) + int new = max (0, XINT (arg)); + if (new != old) { + f->right_divider_width = new; adjust_frame_size (f, -1, -1, 4, 0, Qright_divider_width); adjust_frame_glyphs (f); SET_FRAME_GARBAGED (f); @@ -3827,13 +3814,11 @@ void x_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); - FRAME_BOTTOM_DIVIDER_WIDTH (f) = XINT (arg); - if (FRAME_BOTTOM_DIVIDER_WIDTH (f) < 0) - FRAME_BOTTOM_DIVIDER_WIDTH (f) = 0; - if (FRAME_BOTTOM_DIVIDER_WIDTH (f) != old) + int new = max (0, XINT (arg)); + if (new != old) { + f->bottom_divider_width = new; adjust_frame_size (f, -1, -1, 4, 0, Qbottom_divider_width); adjust_frame_glyphs (f); SET_FRAME_GARBAGED (f); diff --git a/src/frame.h b/src/frame.h index 4ee0a7411f9..5e3ee68942a 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1102,23 +1102,37 @@ extern Lisp_Object selected_frame; extern int frame_default_tool_bar_height; #endif +#ifdef HAVE_WINDOW_SYSTEM +# define WINDOW_SYSTEM_RETURN +#else +# define WINDOW_SYSTEM_RETURN _Noreturn +#endif + +extern WINDOW_SYSTEM_RETURN struct frame * + decode_window_system_frame (Lisp_Object); extern struct frame *decode_live_frame (Lisp_Object); extern struct frame *decode_any_frame (Lisp_Object); extern struct frame *make_initial_frame (void); extern struct frame *make_frame (bool); #ifdef HAVE_WINDOW_SYSTEM -extern void check_window_system (struct frame *); -extern struct frame *decode_window_system_frame (Lisp_Object); extern struct frame *make_minibuffer_frame (void); extern struct frame *make_frame_without_minibuffer (Lisp_Object, struct kboard *, Lisp_Object); -extern bool window_system_available (struct frame *); -#else /* not HAVE_WINDOW_SYSTEM */ -extern _Noreturn void check_window_system (struct frame *); -extern _Noreturn void decode_window_system_frame (Lisp_Object); -#define window_system_available(f) ((void) (f), false) -#endif /* HAVE_WINDOW_SYSTEM */ +extern bool display_available (void); +#endif + +INLINE bool +window_system_available (struct frame *f) +{ +#ifdef HAVE_WINDOW_SYSTEM + return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : display_available (); +#else + return false; +#endif +} + +extern WINDOW_SYSTEM_RETURN void check_window_system (struct frame *); extern void frame_make_pointer_invisible (struct frame *); extern void frame_make_pointer_visible (struct frame *); extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); @@ -1152,46 +1166,68 @@ extern Lisp_Object Vframe_list; This value currently equals the average width of the default font of F. */ #define FRAME_COLUMN_WIDTH(F) ((F)->column_width) -/* Pixel width of areas used to display truncation marks, continuation - marks, overlay arrows. This is 0 for terminal frames. */ +/* Get a frame's window system dimension. If no window system, this is 0. */ +INLINE int +frame_dimension (int x) +{ #ifdef HAVE_WINDOW_SYSTEM + return x; +#else + return 0; +#endif +} /* Total width of fringes reserved for drawing truncation bitmaps, continuation bitmaps and alike. The width is in canonical char units of the frame. This must currently be the case because window sizes aren't pixel values. If it weren't the case, we wouldn't be able to split windows horizontally nicely. */ -#define FRAME_FRINGE_COLS(F) ((F)->fringe_cols) +INLINE int +FRAME_FRINGE_COLS (struct frame *f) +{ + return frame_dimension (f->fringe_cols); +} /* Pixel-width of the left and right fringe. */ -#define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width) -#define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width) +INLINE int +FRAME_LEFT_FRINGE_WIDTH (struct frame *f) +{ + return frame_dimension (f->left_fringe_width); +} +INLINE int +FRAME_RIGHT_FRINGE_WIDTH (struct frame *f) +{ + return frame_dimension (f->right_fringe_width); +} /* Total width of fringes in pixels. */ -#define FRAME_TOTAL_FRINGE_WIDTH(F) \ - (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F)) +INLINE int +FRAME_TOTAL_FRINGE_WIDTH (struct frame *f) +{ + return FRAME_LEFT_FRINGE_WIDTH (f) + FRAME_RIGHT_FRINGE_WIDTH (f); +} /* Pixel-width of internal border lines */ -#define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width) +INLINE int +FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->internal_border_width); +} /* Pixel-size of window border lines */ -#define FRAME_RIGHT_DIVIDER_WIDTH(F) ((F)->right_divider_width) -#define FRAME_BOTTOM_DIVIDER_WIDTH(F) ((F)->bottom_divider_width) - -#else /* not HAVE_WINDOW_SYSTEM */ - -#define FRAME_FRINGE_COLS(F) ((void) (F), 0) -#define FRAME_TOTAL_FRINGE_WIDTH(F) ((void) (F), 0) -#define FRAME_LEFT_FRINGE_WIDTH(F) ((void) (F), 0) -#define FRAME_RIGHT_FRINGE_WIDTH(F) ((void) (F), 0) -#define FRAME_INTERNAL_BORDER_WIDTH(F) ((void) (F), 0) -#define FRAME_RIGHT_DIVIDER_WIDTH(F) ((void) (F), 0) -#define FRAME_BOTTOM_DIVIDER_WIDTH(F) ((void) (F), 0) - -#endif /* not HAVE_WINDOW_SYSTEM */ +INLINE int +FRAME_RIGHT_DIVIDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->right_divider_width); +} +INLINE int +FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->bottom_divider_width); +} /*********************************************************************** Conversion between canonical units and pixels diff --git a/src/gnutls.c b/src/gnutls.c index 8ee066f46b5..7f05ac4bc47 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -383,13 +383,6 @@ gnutls_log_function2 (int level, const char *string, const char *extra) message ("gnutls.c: [%d] %s %s", level, string, extra); } -/* Log a message and an integer. */ -static void -gnutls_log_function2i (int level, const char *string, int extra) -{ - message ("gnutls.c: [%d] %s %d", level, string, extra); -} - int gnutls_try_handshake (struct Lisp_Process *proc) { diff --git a/src/gnutls.h b/src/gnutls.h index 47e11f2905f..41769a47f54 100644 --- a/src/gnutls.h +++ b/src/gnutls.h @@ -71,7 +71,7 @@ typedef enum #define GNUTLS_LOG2i(level, max, string, extra) \ do { \ if ((level) <= (max)) \ - gnutls_log_function2i (level, "(Emacs) " string, extra); \ + message ("gnutls.c: [%d] %s %d", level, string, extra); \ } while (false) extern ptrdiff_t diff --git a/src/image.c b/src/image.c index 0df415c37c9..572557dd264 100644 --- a/src/image.c +++ b/src/image.c @@ -80,9 +80,6 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #define x_defined_color w32_defined_color -#if 0 /* unused */ -#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) -#endif #endif /* HAVE_NTGUI */ diff --git a/src/lisp.h b/src/lisp.h index 6a8f829546e..e0eb52a84ea 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4634,10 +4634,8 @@ enum STR's value is not necessarily copied. The resulting Lisp string should not be modified or made visible to user code. */ -/* Avoid initializing NAME to prevent "jump-misses-init" compiler - warnings. */ #define AUTO_STRING_WITH_LEN(name, str, len) \ - Lisp_Object name; name = \ + Lisp_Object name = \ (USE_STACK_STRING \ ? (make_lisp_ptr \ ((&(union Aligned_String) \ diff --git a/src/vm-limit.c b/src/vm-limit.c index 7eeca3c8250..58e7729186c 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -54,10 +54,10 @@ char data_start[1] = { 1 }; #ifdef HAVE_MALLOC_H # include <malloc.h> #endif -#ifndef __MALLOC_HOOK_VOLATILE -# define __MALLOC_HOOK_VOLATILE volatile -#endif #ifndef HAVE_MALLOC_H +# ifndef __MALLOC_HOOK_VOLATILE +# define __MALLOC_HOOK_VOLATILE volatile +# endif extern void *(*__morecore) (ptrdiff_t); extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); #endif diff --git a/src/xdisp.c b/src/xdisp.c index da0e84f0043..9df73f2d833 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5040,11 +5040,9 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, return 1; #ifdef HAVE_WINDOW_SYSTEM - int fringe_bitmap; - value = XCAR (XCDR (spec)); - if (!SYMBOLP (value) - || !(fringe_bitmap = lookup_fringe_bitmap (value))) + int fringe_bitmap = SYMBOLP (value) ? lookup_fringe_bitmap (value) : 0; + if (! fringe_bitmap) /* If we return here, POSITION has been advanced across the text with this property. */ { @@ -21691,9 +21689,7 @@ Value is the new character position of point. */) int pt_x, target_x, pixel_width, pt_vpos; bool at_eol_p; bool overshoot_expected = false; -#ifdef HAVE_WINDOW_SYSTEM bool target_is_eol_p = false; -#endif /* Setup the arena. */ SET_TEXT_POS (pt, PT, PT_BYTE); @@ -21808,9 +21804,7 @@ Value is the new character position of point. */) { move_it_by_lines (&it, -1); target_x = it.last_visible_x - !FRAME_WINDOW_P (it.f); -#ifdef HAVE_WINDOW_SYSTEM target_is_eol_p = true; -#endif /* Under word-wrap, we don't know the x coordinate of the last character displayed on the previous line, which immediately precedes the wrap point. To find @@ -21851,7 +21845,6 @@ Value is the new character position of point. */) } /* Move to the target X coordinate. */ -#ifdef HAVE_WINDOW_SYSTEM /* On GUI frames, as we don't know the X coordinate of the character to the left of point, moving point to the left requires walking, one grapheme cluster at a time, until we @@ -21908,9 +21901,7 @@ Value is the new character position of point. */) new_pos.bytepos = CHAR_TO_BYTE (new_pos.charpos); it.current.pos = new_pos; } - else -#endif - if (it.current_x != target_x) + else if (it.current_x != target_x) move_it_in_display_line_to (&it, ZV, target_x, MOVE_TO_POS | MOVE_TO_X); /* If we ended up in a display string that covers point, move to @@ -28602,11 +28593,7 @@ static void show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) { struct window *w = XWINDOW (hlinfo->mouse_face_window); -#ifdef HAVE_WINDOW_SYSTEM struct frame *f = XFRAME (WINDOW_FRAME (w)); -#else - (void) XFRAME (WINDOW_FRAME (w)); -#endif if (/* If window is in the process of being destroyed, don't bother to do anything. */ @@ -28617,9 +28604,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) anymore. This can happen when a window is split. */ && hlinfo->mouse_face_end_row < w->current_matrix->nrows) { -#ifdef HAVE_WINDOW_SYSTEM bool phys_cursor_on_p = w->phys_cursor_on_p; -#endif struct glyph_row *row, *first, *last; first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); @@ -28695,12 +28680,12 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) } } -#ifdef HAVE_WINDOW_SYSTEM /* When we've written over the cursor, arrange for it to be displayed again. */ if (FRAME_WINDOW_P (f) && phys_cursor_on_p && !w->phys_cursor_on_p) { +#ifdef HAVE_WINDOW_SYSTEM int hpos = w->phys_cursor.hpos; /* When the window is hscrolled, cursor hpos can legitimately be @@ -28715,8 +28700,8 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) display_and_set_cursor (w, true, hpos, w->phys_cursor.vpos, w->phys_cursor.x, w->phys_cursor.y); unblock_input (); - } #endif /* HAVE_WINDOW_SYSTEM */ + } } #ifdef HAVE_WINDOW_SYSTEM @@ -29656,12 +29641,17 @@ Returns the alist element for the first matching AREA in MAP. */) clip_to_bounds (INT_MIN, XINT (x), INT_MAX), clip_to_bounds (INT_MIN, XINT (y), INT_MAX)); } +#endif /* HAVE_WINDOW_SYSTEM */ /* Display frame CURSOR, optionally using shape defined by POINTER. */ static void define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) { +#ifdef HAVE_WINDOW_SYSTEM + if (!FRAME_WINDOW_P (f)) + return; + /* Do not change cursor shape while dragging mouse. */ if (EQ (do_mouse_tracking, Qdragging)) return; @@ -29678,10 +29668,10 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; else if (EQ (pointer, intern ("nhdrag"))) cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; -#ifdef HAVE_X_WINDOWS +# ifdef HAVE_X_WINDOWS else if (EQ (pointer, intern ("vdrag"))) cursor = FRAME_DISPLAY_INFO (f)->vertical_scroll_bar_cursor; -#endif +# endif else if (EQ (pointer, intern ("hourglass"))) cursor = FRAME_X_OUTPUT (f)->hourglass_cursor; else if (EQ (pointer, Qmodeline)) @@ -29692,10 +29682,9 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) if (cursor != No_Cursor) FRAME_RIF (f)->define_frame_cursor (f, cursor); +#endif } -#endif /* HAVE_WINDOW_SYSTEM */ - /* Take proper action when mouse has moved to the mode or header line or marginal area AREA of window W, x-position X and y-position Y. X is relative to the start of the text display area of W, so the @@ -29711,9 +29700,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM Display_Info *dpyinfo; +#endif Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; -#endif int dx, dy, width, height; ptrdiff_t charpos; Lisp_Object string, object = Qnil; @@ -29964,12 +29953,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, && hlinfo->mouse_face_beg_row == vpos ) return; -#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor = No_Cursor; -#else - (void) clear_mouse_face (hlinfo); -#endif if (!row->reversed_p) { @@ -30003,10 +29988,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, show_mouse_face (hlinfo, DRAW_MOUSE_FACE); mouse_face_shown = true; -#ifdef HAVE_WINDOW_SYSTEM if (NILP (pointer)) pointer = Qhand; -#endif } } @@ -30015,10 +29998,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if ((area == ON_MODE_LINE || area == ON_HEADER_LINE) && !mouse_face_shown) clear_mouse_face (hlinfo); -#ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f)) - define_frame_cursor1 (f, cursor, pointer); -#endif + define_frame_cursor1 (f, cursor, pointer); } @@ -30037,10 +30017,8 @@ note_mouse_highlight (struct frame *f, int x, int y) enum window_part part = ON_NOTHING; Lisp_Object window; struct window *w; -#ifdef HAVE_WINDOW_SYSTEM Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; /* Takes precedence over cursor! */ -#endif struct buffer *b; /* When a menu is active, don't highlight because this looks odd. */ @@ -30223,19 +30201,17 @@ note_mouse_highlight (struct frame *f, int x, int y) && glyph->type == STRETCH_GLYPH && glyph->avoid_cursor_p)) { -#ifndef HAVE_WINDOW_SYSTEM - (void) clear_mouse_face (hlinfo); -#else /* HAVE_WINDOW_SYSTEM */ if (clear_mouse_face (hlinfo)) cursor = No_Cursor; if (FRAME_WINDOW_P (f) && NILP (pointer)) { +#ifdef HAVE_WINDOW_SYSTEM if (area != TEXT_AREA) cursor = FRAME_X_OUTPUT (f)->nontext_cursor; else pointer = Vvoid_text_area_pointer; +#endif } -#endif /* HAVE_WINDOW_SYSTEM */ goto set_cursor; } @@ -30280,10 +30256,8 @@ note_mouse_highlight (struct frame *f, int x, int y) same_region = coords_in_mouse_face_p (w, hpos, vpos); -#ifdef HAVE_WINDOW_SYSTEM if (same_region) cursor = No_Cursor; -#endif /* Check mouse-face highlighting. */ if (! same_region @@ -30310,12 +30284,8 @@ note_mouse_highlight (struct frame *f, int x, int y) hlinfo->mouse_face_overlay = overlay; /* Clear the display of the old active region, if any. */ -#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor = No_Cursor; -#else - (void) clear_mouse_face (hlinfo); -#endif /* If no overlay applies, get a text property. */ if (NILP (overlay)) @@ -30346,9 +30316,7 @@ note_mouse_highlight (struct frame *f, int x, int y) = face_at_string_position (w, object, pos, 0, &ignore, glyph->face_id, true); show_mouse_face (hlinfo, DRAW_MOUSE_FACE); -#ifdef HAVE_WINDOW_SYSTEM cursor = No_Cursor; -#endif } else { @@ -30432,9 +30400,7 @@ note_mouse_highlight (struct frame *f, int x, int y) : XFASTINT (after), before_string, after_string, disp_string); -#ifdef HAVE_WINDOW_SYSTEM cursor = No_Cursor; -#endif } } } @@ -30557,15 +30523,7 @@ note_mouse_highlight (struct frame *f, int x, int y) } set_cursor: - -#ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f)) - define_frame_cursor1 (f, cursor, pointer); -#else - /* This is here to prevent a compiler error, about "label at end of - compound statement". */ - return; -#endif + define_frame_cursor1 (f, cursor, pointer); } diff --git a/src/xfaces.c b/src/xfaces.c index faf28fc513d..97a5ae01e36 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5287,11 +5287,11 @@ realize_default_face (struct frame *f) eassert (lface_fully_specified_p (XVECTOR (lface)->contents)); check_lface (lface); memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs); - -#ifndef HAVE_X_WINDOWS - (void) realize_face (c, attrs, DEFAULT_FACE_ID); -#else /* HAVE_X_WINDOWS */ struct face *face = realize_face (c, attrs, DEFAULT_FACE_ID); + +#ifndef HAVE_WINDOW_SYSTEM + (void) face; +#else if (FRAME_X_P (f) && face->font != FRAME_FONT (f)) { /* This can happen when making a frame on a display that does @@ -5305,7 +5305,7 @@ realize_default_face (struct frame *f) font. */ x_set_font (f, LFACE_FONT (lface), Qnil); } -#endif /* HAVE_X_WINDOWS */ +#endif return true; } @@ -6093,7 +6093,7 @@ face_at_string_position (struct window *w, Lisp_Object string, if we don't have fonts, so we can stop here if not working on a window-system frame. */ || !FRAME_WINDOW_P (f) - || FACE_SUITABLE_FOR_ASCII_CHAR_P (base_face, 0))) + || FACE_SUITABLE_FOR_ASCII_CHAR_P (base_face))) return base_face->id; /* Begin with attributes from the base face. */ diff --git a/src/xfns.c b/src/xfns.c index 35e2a236f89..1120c330e8b 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1434,7 +1434,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva if (border != FRAME_INTERNAL_BORDER_WIDTH (f)) { - FRAME_INTERNAL_BORDER_WIDTH (f) = border; + f->internal_border_width = border; #ifdef USE_X_TOOLKIT if (FRAME_X_OUTPUT (f)->edit_widget) |