summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-11-22 13:32:32 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-11-22 13:32:32 +0400
commit5c74767510841c8afc35f66f5cb068fe99f29615 (patch)
treebc21f52790ac994e4d635b5d13f1947e0f61fed3
parent0e70ce9335996bd21c6b7f4ae0bf6b2924b89d4f (diff)
downloademacs-5c74767510841c8afc35f66f5cb068fe99f29615.tar.gz
* alloc.c (Fgarbage_collect): Unblock input after clearing
gc_in_progress to avoid note_mouse_highlight glitch with GC. * frame.h (FRAME_MOUSE_UPDATE): New macro. * msdos.c (IT_frame_up_to_date): Use it here... * w32term.c (w32_frame_up_to_date): ...here... * xterm.c (XTframe_up_to_date): ...and here... * nsterm.m (ns_frame_up_to_date): ...but not here. * lisp.h (Mouse_HLInfo): Remove mouse_face_deferred_gc member. Adjust users. * xdisp.c (message2_nolog, message3_nolog, note_mouse_highlight): Do not check whether GC is in progress.
-rw-r--r--src/ChangeLog14
-rw-r--r--src/alloc.c4
-rw-r--r--src/frame.h15
-rw-r--r--src/lisp.h4
-rw-r--r--src/msdos.c15
-rw-r--r--src/nsterm.m25
-rw-r--r--src/w32term.c17
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xterm.c18
9 files changed, 46 insertions, 76 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4a4572bdd63..2e485f1b87b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,19 @@
2012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
+ * alloc.c (Fgarbage_collect): Unblock input after clearing
+ gc_in_progress to avoid note_mouse_highlight glitch with GC.
+ * frame.h (FRAME_MOUSE_UPDATE): New macro.
+ * msdos.c (IT_frame_up_to_date): Use it here...
+ * w32term.c (w32_frame_up_to_date): ...here...
+ * xterm.c (XTframe_up_to_date): ...and here...
+ * nsterm.m (ns_frame_up_to_date): ...but not here.
+ * lisp.h (Mouse_HLInfo): Remove mouse_face_deferred_gc member.
+ Adjust users.
+ * xdisp.c (message2_nolog, message3_nolog, note_mouse_highlight):
+ Do not check whether GC is in progress.
+
+2012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
+
* xdisp.c (window_buffer_changed): New function.
(update_menu_bar, update_tool_bar): Use it to
simplify large 'if' statements.
diff --git a/src/alloc.c b/src/alloc.c
index 46b2dde93a3..28c9b51dab4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5331,12 +5331,12 @@ See Info node `(elisp)Garbage Collection'. */)
dump_zombies ();
#endif
- unblock_input ();
-
check_cons_list ();
gc_in_progress = 0;
+ unblock_input ();
+
consing_since_gc = 0;
if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10)
gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10;
diff --git a/src/frame.h b/src/frame.h
index 35cbc44becc..87c4fcb0555 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -933,6 +933,21 @@ typedef struct frame *FRAME_PTR;
&& (frame_var = XCAR (list_var), 1)); \
list_var = XCDR (list_var))
+/* Reflect mouse movement when a complete frame update is performed. */
+
+#define FRAME_MOUSE_UPDATE(frame) \
+ do { \
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
+ if (frame == hlinfo->mouse_face_mouse_frame) \
+ { \
+ block_input (); \
+ if (hlinfo->mouse_face_mouse_frame) \
+ note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
+ hlinfo->mouse_face_mouse_x, \
+ hlinfo->mouse_face_mouse_y); \
+ unblock_input (); \
+ } \
+ } while (0)
extern Lisp_Object Qframep, Qframe_live_p;
extern Lisp_Object Qtty, Qtty_type;
diff --git a/src/lisp.h b/src/lisp.h
index 4817c6eb990..419176d06c8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1649,10 +1649,6 @@ typedef struct {
int mouse_face_face_id;
Lisp_Object mouse_face_overlay;
- /* 1 if a mouse motion event came and we didn't handle it right away because
- gc was in progress. */
- int mouse_face_deferred_gc;
-
/* 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;
diff --git a/src/msdos.c b/src/msdos.c
index dd05a8b2c5d..433bf1074d8 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1275,7 +1275,6 @@ IT_update_begin (struct 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;
- hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_mouse_frame = NULL;
}
@@ -1295,21 +1294,10 @@ IT_update_end (struct frame *f)
static void
IT_frame_up_to_date (struct frame *f)
{
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
Lisp_Object new_cursor, frame_desired_cursor;
struct window *sw;
- if (hlinfo->mouse_face_deferred_gc
- || (f && f == hlinfo->mouse_face_mouse_frame))
- {
- block_input ();
- if (hlinfo->mouse_face_mouse_frame)
- note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
- hlinfo->mouse_face_mouse_x,
- hlinfo->mouse_face_mouse_y);
- hlinfo->mouse_face_deferred_gc = 0;
- unblock_input ();
- }
+ FRAME_MOUSE_UPDATE (f);
/* Set the cursor type to whatever they wanted. In a minibuffer
window, we want the cursor to appear only if we are reading input
@@ -1849,7 +1837,6 @@ internal_terminal_init (void)
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_deferred_gc = 0;
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 =
diff --git a/src/nsterm.m b/src/nsterm.m
index 57d32ee0528..25eb7ebc495 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1186,7 +1186,6 @@ x_free_frame_resources (struct 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;
- hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_mouse_frame = 0;
}
@@ -1887,8 +1886,7 @@ static void
ns_frame_up_to_date (struct frame *f)
/* --------------------------------------------------------------------------
External (hook): Fix up mouse highlighting right after a full update.
- Some highlighting was deferred if GC was happening during
- note_mouse_highlight (), while other highlighting was deferred for update.
+ Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls.
-------------------------------------------------------------------------- */
{
NSTRACE (ns_frame_up_to_date);
@@ -1896,19 +1894,17 @@ ns_frame_up_to_date (struct frame *f)
if (FRAME_NS_P (f))
{
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
- if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame)
- /*&& hlinfo->mouse_face_mouse_frame*/)
- {
- block_input ();
+ if (f == hlinfo->mouse_face_mouse_frame)
+ {
+ block_input ();
ns_update_begin(f);
- if (hlinfo->mouse_face_mouse_frame)
- note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
- hlinfo->mouse_face_mouse_x,
- hlinfo->mouse_face_mouse_y);
- hlinfo->mouse_face_deferred_gc = 0;
+ if (hlinfo->mouse_face_mouse_frame)
+ note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
+ hlinfo->mouse_face_mouse_x,
+ hlinfo->mouse_face_mouse_y);
ns_update_end(f);
- unblock_input ();
- }
+ unblock_input ();
+ }
}
}
@@ -3869,7 +3865,6 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
dpyinfo->root_window = 42; /* a placeholder.. */
hlinfo->mouse_face_mouse_frame = NULL;
- hlinfo->mouse_face_deferred_gc = 0;
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;
diff --git a/src/w32term.c b/src/w32term.c
index 032912c27f4..ab6afd32c75 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -723,21 +723,7 @@ static void
w32_frame_up_to_date (struct frame *f)
{
if (FRAME_W32_P (f))
- {
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-
- if (hlinfo->mouse_face_deferred_gc
- || f == hlinfo->mouse_face_mouse_frame)
- {
- block_input ();
- if (hlinfo->mouse_face_mouse_frame)
- note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
- hlinfo->mouse_face_mouse_x,
- hlinfo->mouse_face_mouse_y);
- hlinfo->mouse_face_deferred_gc = 0;
- unblock_input ();
- }
- }
+ FRAME_MOUSE_UPDATE (f);
}
@@ -5979,7 +5965,6 @@ x_free_frame_resources (struct frame *f)
hlinfo->mouse_face_end_row
= hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_mouse_frame = 0;
}
diff --git a/src/xdisp.c b/src/xdisp.c
index e9b20d148c7..5d260d851ef 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9642,7 +9642,7 @@ message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte)
do_pending_window_change (0);
echo_area_display (1);
do_pending_window_change (0);
- if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
+ if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
(*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
}
}
@@ -9739,7 +9739,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
do_pending_window_change (0);
echo_area_display (1);
do_pending_window_change (0);
- if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
+ if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
(*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
}
}
@@ -27685,12 +27685,6 @@ note_mouse_highlight (struct frame *f, int x, int y)
if (hlinfo->mouse_face_defer)
return;
- if (gc_in_progress)
- {
- hlinfo->mouse_face_deferred_gc = 1;
- return;
- }
-
/* Which window is that in? */
window = window_from_coordinates (f, x, y, &part, 1);
diff --git a/src/xterm.c b/src/xterm.c
index 463d82b4ee2..61e942e10d2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -669,21 +669,7 @@ static void
XTframe_up_to_date (struct frame *f)
{
if (FRAME_X_P (f))
- {
- Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-
- if (hlinfo->mouse_face_deferred_gc
- || f == hlinfo->mouse_face_mouse_frame)
- {
- block_input ();
- if (hlinfo->mouse_face_mouse_frame)
- note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
- hlinfo->mouse_face_mouse_x,
- hlinfo->mouse_face_mouse_y);
- hlinfo->mouse_face_deferred_gc = 0;
- unblock_input ();
- }
- }
+ FRAME_MOUSE_UPDATE (f);
}
@@ -9502,7 +9488,6 @@ x_free_frame_resources (struct frame *f)
hlinfo->mouse_face_end_row
= hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_window = Qnil;
- hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_mouse_frame = 0;
}
@@ -10153,7 +10138,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpyinfo->bitmaps_last = 0;
dpyinfo->scratch_cursor_gc = 0;
hlinfo->mouse_face_mouse_frame = 0;
- hlinfo->mouse_face_deferred_gc = 0;
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;