Commit 1c019905 authored by Paul Eggert's avatar Paul Eggert

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.
parent c98bc982
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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
......
......@@ -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 */
......
......@@ -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) \
......
......@@ -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
......
......@@ -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