* alloc.c (Fgarbage_collect): Unblock input after clearing
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 22 Nov 2012 09:32:32 +0000 (13:32 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Thu, 22 Nov 2012 09:32:32 +0000 (13:32 +0400)
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.

src/ChangeLog
src/alloc.c
src/frame.h
src/lisp.h
src/msdos.c
src/nsterm.m
src/w32term.c
src/xdisp.c
src/xterm.c

index 4a4572b..2e485f1 100644 (file)
@@ -1,3 +1,17 @@
+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.
index 46b2dde..28c9b51 100644 (file)
@@ -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;
index 35cbc44..87c4fcb 100644 (file)
@@ -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;
index 4817c6e..419176d 100644 (file)
@@ -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;
index dd05a8b..433bf10 100644 (file)
@@ -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 =
index 57d32ee..25eb7eb 100644 (file)
@@ -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;
index 032912c..ab6afd3 100644 (file)
@@ -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;
     }
 
index e9b20d1..5d260d8 100644 (file)
@@ -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);
 
index 463d82b..61e942e 100644 (file)
@@ -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;