Commit 9fed9729 authored by Dmitry Antipov's avatar Dmitry Antipov

* 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.
parent 9e89d835
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.
......
......@@ -2667,8 +2667,57 @@ enum move_operation_enum
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;
}
/***********************************************************************
Window-based redisplay interface
***********************************************************************/
......
......@@ -2164,36 +2164,6 @@ enum char_bits
CHARACTERBITS = 22
};
/* 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;
/* Data type checking. */
LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x))
......
......@@ -602,11 +602,7 @@ dos_set_window_size (int *rows, int *cols)
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. */
......@@ -1276,14 +1272,9 @@ IT_update_begin (struct frame *f)
}
}
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 ();
}
......@@ -1843,17 +1834,8 @@ internal_terminal_init (void)
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 */
{
......
......@@ -749,8 +749,6 @@ Free a pool and temporary objects it refers to (callable from C)
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)
{
......@@ -770,11 +768,7 @@ Free a pool and temporary objects it refers to (callable from C)
/* 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);
}
......@@ -1183,12 +1177,7 @@ Free a pool and temporary objects it refers to (callable from C)
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];
......@@ -3951,7 +3940,6 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
{
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;
......@@ -3964,22 +3952,12 @@ 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.. */
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);
}
......
......@@ -16,6 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <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. */
......
......@@ -636,13 +636,7 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
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 ();
......
......@@ -678,8 +678,6 @@ static void
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 ();
......@@ -698,11 +696,7 @@ x_update_window_end (struct window *w, bool cursor_on_p,
/* 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
......@@ -6156,16 +6150,8 @@ x_free_frame_resources (struct frame *f)
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 ();
}
......@@ -6235,7 +6221,6 @@ void
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));
......@@ -6258,17 +6243,10 @@ w32_initialize_display_info (Lisp_Object display_name)
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.
......
......@@ -2842,7 +2842,7 @@ window-start value is reasonable when this function is called. */)
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
......@@ -2852,11 +2852,7 @@ window-start value is reasonable when this function is called. */)
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);
......
......@@ -26795,10 +26795,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo)
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;
}
......@@ -28586,11 +28583,7 @@ cancel_mouse_face (struct frame *f)
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);
}
......
......@@ -613,8 +613,6 @@ static void
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 ();
......@@ -633,11 +631,7 @@ x_update_window_end (struct window *w, bool cursor_on_p,
/* 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)));
}
......@@ -9445,16 +9439,8 @@ x_free_frame_resources (struct frame *f)
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 ();
}
......@@ -9826,7 +9812,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
struct terminal *terminal;
struct x_display_info *dpyinfo;
XrmDatabase xrdb;
Mouse_HLInfo *hlinfo;
ptrdiff_t lim;
block_input ();
......@@ -9967,8 +9952,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
/* We have definitely succeeded. Record the new connection. */
dpyinfo = xzalloc (sizeof *dpyinfo);
hlinfo = &dpyinfo->mouse_highlight;
terminal = x_create_terminal (dpyinfo);
{
......@@ -10082,13 +10065,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
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)
{
......
......@@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef XTERM_H
#define XTERM_H
#include "dispextern.h"
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment