* dispextern.h (Mouse_HLInfo): ...to here and offload lisp.h.
(reset_mouse_highlight): New function.
* msdos.c (dos_set_window_size, IT_update_begin)
(internal_terminal_init):
* nsterm.m (ns_update_window_end, x_free_frame_resources)
(ns_initialize_display_info):
* w32console.c (initialize_w32_display):
* w32term.c (x_update_window_end, x_free_frame_resources)
(w32_initialize_display_info):
* xterm.c (x_update_window_end, x_free_frame_resources, x_term_init):
* window.c (Fdelete_other_windows_internal):
* xdisp.c (clear_mouse_face, cancel_mouse_face): Use it.
* termchar.h (toplevel):
* xterm.h (toplevel): Include dispextern.h.
+2013-08-27 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * lisp.h (Mouse_HLInfo): Move from here...
+ * dispextern.h (Mouse_HLInfo): ...to here and offload lisp.h.
+ (reset_mouse_highlight): New function.
+ * msdos.c (dos_set_window_size, IT_update_begin)
+ (internal_terminal_init):
+ * nsterm.m (ns_update_window_end, x_free_frame_resources)
+ (ns_initialize_display_info):
+ * w32console.c (initialize_w32_display):
+ * w32term.c (x_update_window_end, x_free_frame_resources)
+ (w32_initialize_display_info):
+ * xterm.c (x_update_window_end, x_free_frame_resources, x_term_init):
+ * window.c (Fdelete_other_windows_internal):
+ * xdisp.c (clear_mouse_face, cancel_mouse_face): Use it.
+ * termchar.h (toplevel):
+ * xterm.h (toplevel): Include dispextern.h.
+
2013-08-26 Paul Eggert <eggert@cs.ucla.edu>
Fix minor problems found by static checking.
MOVE_TO_POS = 0x08
};
+/***********************************************************************
+ Mouse Highlight
+ ***********************************************************************/
+
+/* Structure to hold mouse highlight data. */
+
+typedef struct {
+ /* These variables describe the range of text currently shown in its
+ mouse-face, together with the window they apply to. As long as
+ the mouse stays within this range, we need not redraw anything on
+ its account. Rows and columns are glyph matrix positions in
+ MOUSE_FACE_WINDOW. */
+ int mouse_face_beg_row, mouse_face_beg_col, mouse_face_beg_x;
+ int mouse_face_end_row, mouse_face_end_col, mouse_face_end_x;
+ Lisp_Object mouse_face_window;
+ int mouse_face_face_id;
+ Lisp_Object mouse_face_overlay;
+
+ /* FRAME and X, Y position of mouse when last checked for
+ highlighting. X and Y can be negative or out of range for the frame. */
+ struct frame *mouse_face_mouse_frame;
+ int mouse_face_mouse_x, mouse_face_mouse_y;
+
+ /* Nonzero if part of the text currently shown in
+ its mouse-face is beyond the window end. */
+ unsigned mouse_face_past_end : 1;
+
+ /* Nonzero means defer mouse-motion highlighting. */
+ unsigned mouse_face_defer : 1;
+
+ /* Nonzero means that the mouse highlight should not be shown. */
+ unsigned mouse_face_hidden : 1;
+} Mouse_HLInfo;
+
+DISPEXTERN_INLINE void
+reset_mouse_highlight (Mouse_HLInfo *hlinfo)
+{
+
+ hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+ hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+ hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
+ hlinfo->mouse_face_beg_x = hlinfo->mouse_face_end_x = 0;
+ hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
+ hlinfo->mouse_face_mouse_frame = NULL;
+ hlinfo->mouse_face_window = Qnil;
+ hlinfo->mouse_face_overlay = Qnil;
+ hlinfo->mouse_face_past_end = 0;
+ hlinfo->mouse_face_hidden = 0;
+ hlinfo->mouse_face_defer = 0;
+}
-\f
/***********************************************************************
Window-based redisplay interface
***********************************************************************/
CHARACTERBITS = 22
};
\f
-/* Structure to hold mouse highlight data. This is here because other
- header files need it for defining struct x_output etc. */
-typedef struct {
- /* These variables describe the range of text currently shown in its
- mouse-face, together with the window they apply to. As long as
- the mouse stays within this range, we need not redraw anything on
- its account. Rows and columns are glyph matrix positions in
- MOUSE_FACE_WINDOW. */
- int mouse_face_beg_row, mouse_face_beg_col, mouse_face_beg_x;
- int mouse_face_end_row, mouse_face_end_col, mouse_face_end_x;
- Lisp_Object mouse_face_window;
- int mouse_face_face_id;
- Lisp_Object mouse_face_overlay;
-
- /* FRAME and X, Y position of mouse when last checked for
- highlighting. X and Y can be negative or out of range for the frame. */
- struct frame *mouse_face_mouse_frame;
- int mouse_face_mouse_x, mouse_face_mouse_y;
-
- /* Nonzero if part of the text currently shown in
- its mouse-face is beyond the window end. */
- unsigned mouse_face_past_end : 1;
-
- /* Nonzero means defer mouse-motion highlighting. */
- unsigned mouse_face_defer : 1;
-
- /* Nonzero means that the mouse highlight should not be shown. */
- unsigned mouse_face_hidden : 1;
-} Mouse_HLInfo;
-\f
/* Data type checking. */
LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x))
Lisp_Object window = hlinfo->mouse_face_window;
if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- }
+ reset_mouse_highlight (hlinfo);
}
/* Enable bright background colors. */
}
}
else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame))
- {
- /* If the frame with mouse highlight was deleted, invalidate the
- highlight info. */
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_mouse_frame = NULL;
- }
+ /* If the frame with mouse highlight was deleted, invalidate the
+ highlight info. */
+ reset_mouse_highlight (hlinfo);
unblock_input ();
}
if (colors[1] >= 0 && colors[1] < 16)
FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
}
- the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL;
- the_only_display_info.mouse_highlight.mouse_face_beg_row =
- the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
- the_only_display_info.mouse_highlight.mouse_face_end_row =
- the_only_display_info.mouse_highlight.mouse_face_end_col = -1;
- the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID;
- the_only_display_info.mouse_highlight.mouse_face_window = Qnil;
- the_only_display_info.mouse_highlight.mouse_face_mouse_x =
- the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0;
- the_only_display_info.mouse_highlight.mouse_face_defer = 0;
- the_only_display_info.mouse_highlight.mouse_face_hidden = 0;
+
+ reset_mouse_highlight (&the_only_display_info.mouse_highlight);
if (have_mouse) /* detected in dos_ttraw, which see */
{
external (RIF) call; for one window called before update_end
-------------------------------------------------------------------------- */
{
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-
/* note: this fn is nearly identical in all terms */
if (!w->pseudo_window_p)
{
/* If a row with mouse-face was overwritten, arrange for
frame_up_to_date to redisplay the mouse highlight. */
if (mouse_face_overwritten_p)
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- }
+ reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
NSTRACE (update_window_end);
}
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
if (f == hlinfo->mouse_face_mouse_frame)
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_mouse_frame = 0;
- }
+ reset_mouse_highlight (hlinfo);
if (f->output_data.ns->miniimage != nil)
[f->output_data.ns->miniimage release];
{
NSScreen *screen = [NSScreen mainScreen];
NSWindowDepth depth = [screen depth];
- Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */
dpyinfo->resy = 72.27;
dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table);
dpyinfo->color_table->colors = NULL;
dpyinfo->root_window = 42; /* a placeholder.. */
-
- hlinfo->mouse_face_mouse_frame = NULL;
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
- hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil;
- hlinfo->mouse_face_hidden = 0;
-
- hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
- hlinfo->mouse_face_defer = 0;
-
dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL;
-
dpyinfo->n_fonts = 0;
dpyinfo->smallest_font_height = 1;
dpyinfo->smallest_char_width = 1;
+
+ reset_mouse_highlight (&dpyinfo->mouse_highlight);
}
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
+#include "dispextern.h"
+
/* Each termcap frame points to its own struct tty_output object in
the output_data.tty field. The tty_output structure contains the
information that is specific to termcap frames. */
term->frame_up_to_date_hook = 0;
/* Initialize the mouse-highlight data. */
- hlinfo = &term->display_info.tty->mouse_highlight;
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
- hlinfo->mouse_face_mouse_frame = NULL;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_hidden = 0;
+ reset_mouse_highlight (&term->display_info.tty->mouse_highlight);
/* Initialize interrupt_handle. */
init_crit ();
x_update_window_end (struct window *w, bool cursor_on_p,
bool mouse_face_overwritten_p)
{
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-
if (!w->pseudo_window_p)
{
block_input ();
/* If a row with mouse-face was overwritten, arrange for
XTframe_up_to_date to redisplay the mouse highlight. */
if (mouse_face_overwritten_p)
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- }
+ reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
/* Unhide the caret. This won't actually show the cursor, unless it
was visible before the corresponding call to HideCaret in
dpyinfo->w32_focus_event_frame = 0;
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
-
if (f == hlinfo->mouse_face_mouse_frame)
- {
- hlinfo->mouse_face_beg_row
- = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row
- = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_mouse_frame = 0;
- }
+ reset_mouse_highlight (hlinfo);
unblock_input ();
}
w32_initialize_display_info (Lisp_Object display_name)
{
struct w32_display_info *dpyinfo = &one_w32_display_info;
- Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
memset (dpyinfo, 0, sizeof (*dpyinfo));
dpyinfo->n_fonts = 0;
dpyinfo->smallest_font_height = 1;
dpyinfo->smallest_char_width = 1;
-
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_overlay = Qnil;
- hlinfo->mouse_face_hidden = 0;
-
dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
/* TODO: dpyinfo->gray */
+ reset_mouse_highlight (&dpyinfo->mouse_highlight);
}
/* Create an xrdb-style database of resources to supersede registry settings.
block_input ();
if (!FRAME_INITIAL_P (f))
{
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
/* We are going to free the glyph matrices of WINDOW, and with
that we might lose any information about glyph rows that have
frame's up-to-date hook that mouse highlight was overwritten,
so that it will arrange for redisplaying the highlight. */
if (EQ (hlinfo->mouse_face_window, window))
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- }
+ reset_mouse_highlight (hlinfo);
}
free_window_matrices (r);
cleared = 1;
}
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_overlay = Qnil;
+ reset_mouse_highlight (hlinfo);
return cleared;
}
window = hlinfo->mouse_face_window;
if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- }
+ reset_mouse_highlight (hlinfo);
}
x_update_window_end (struct window *w, bool cursor_on_p,
bool mouse_face_overwritten_p)
{
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-
if (!w->pseudo_window_p)
{
block_input ();
/* If a row with mouse-face was overwritten, arrange for
XTframe_up_to_date to redisplay the mouse highlight. */
if (mouse_face_overwritten_p)
- {
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- }
+ reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
}
dpyinfo->x_focus_event_frame = 0;
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
-
if (f == hlinfo->mouse_face_mouse_frame)
- {
- hlinfo->mouse_face_beg_row
- = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row
- = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_mouse_frame = 0;
- }
+ reset_mouse_highlight (hlinfo);
unblock_input ();
}
struct terminal *terminal;
struct x_display_info *dpyinfo;
XrmDatabase xrdb;
- Mouse_HLInfo *hlinfo;
ptrdiff_t lim;
block_input ();
/* We have definitely succeeded. Record the new connection. */
dpyinfo = xzalloc (sizeof *dpyinfo);
- hlinfo = &dpyinfo->mouse_highlight;
-
terminal = x_create_terminal (dpyinfo);
{
dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen);
dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen);
dpyinfo->icon_bitmap_id = -1;
- hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
- hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
- hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
- hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_overlay = Qnil;
dpyinfo->wm_type = X_WMTYPE_UNKNOWN;
+ reset_mouse_highlight (&dpyinfo->mouse_highlight);
+
/* See if we can construct pixel values from RGB values. */
if (dpyinfo->visual->class == TrueColor)
{
#ifndef XTERM_H
#define XTERM_H
+#include "dispextern.h"
+
#include <X11/Xlib.h>
#include <X11/cursorfont.h>