]> granicus.if.org Git - vim/commitdiff
patch 8.0.1008: slow updating of terminal window in Motif v8.0.1008
authorBram Moolenaar <Bram@vim.org>
Sun, 27 Aug 2017 15:38:27 +0000 (17:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 27 Aug 2017 15:38:27 +0000 (17:38 +0200)
Problem:    Slow updating of terminal window in Motif.
Solution:   Add a timeout to the wait-for-character loop.

src/gui_x11.c
src/version.c

index 855f4be0e9183f3a448f72e12f9b8d1e8b239eba..a638222251ae0ac3473449802e45d8f527a1a68d 100644 (file)
@@ -136,20 +136,11 @@ static guicolor_T prev_sp_color = INVALCOLOR;
 static XButtonPressedEvent last_mouse_event;
 #endif
 
-static void gui_x11_timer_cb(XtPointer timed_out, XtIntervalId *interval_id);
-static void gui_x11_visibility_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum);
-static void gui_x11_expose_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum);
-static void gui_x11_resize_window_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum);
-static void gui_x11_focus_change_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
-static void gui_x11_enter_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
-static void gui_x11_leave_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
-static void gui_x11_mouse_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
 static void gui_x11_check_copy_area(void);
 #ifdef FEAT_CLIENTSERVER
 static void gui_x11_send_event_handler(Widget, XtPointer, XEvent *, Boolean *);
 #endif
 static void gui_x11_wm_protocol_handler(Widget, XtPointer, XEvent *, Boolean *);
-static void gui_x11_blink_cb(XtPointer timed_out, XtIntervalId *interval_id);
 static Cursor gui_x11_create_blank_mouse(void);
 static void draw_curl(int row, int col, int cells);
 
@@ -574,6 +565,25 @@ gui_x11_timer_cb(
     *((int *)timed_out) = TRUE;
 }
 
+#ifdef FEAT_JOB_CHANNEL
+    static void
+channel_poll_cb(
+    XtPointer      client_data,
+    XtIntervalId    *interval_id UNUSED)
+{
+    XtIntervalId    *channel_timer = (XtIntervalId *)client_data;
+
+    /* Using an event handler for a channel that may be disconnected does
+     * not work, it hangs.  Instead poll for messages. */
+    channel_handle_events(TRUE);
+    parse_queued_messages();
+
+    /* repeat */
+    *channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
+                                                channel_poll_cb, client_data);
+}
+#endif
+
     static void
 gui_x11_visibility_cb(
     Widget     w UNUSED,
@@ -2698,12 +2708,22 @@ gui_mch_wait_for_chars(long wtime)
     static int     timed_out;
     XtIntervalId    timer = (XtIntervalId)0;
     XtInputMask            desired;
+#ifdef FEAT_JOB_CHANNEL
+    XtIntervalId    channel_timer = (XtIntervalId)0;
+#endif
 
     timed_out = FALSE;
 
     if (wtime > 0)
        timer = XtAppAddTimeOut(app_context, (long_u)wtime, gui_x11_timer_cb,
                                                                  &timed_out);
+#ifdef FEAT_JOB_CHANNEL
+    /* If there is a channel with the keep_open flag we need to poll for input
+     * on them. */
+    if (channel_any_keep_open())
+       channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
+                                  channel_poll_cb, (XtPointer)&channel_timer);
+#endif
 
     focus = gui.in_focus;
 #ifdef ALT_X_INPUT
@@ -2755,6 +2775,10 @@ gui_mch_wait_for_chars(long wtime)
 
     if (timer != (XtIntervalId)0 && !timed_out)
        XtRemoveTimeOut(timer);
+#ifdef FEAT_JOB_CHANNEL
+    if (channel_timer != (XtIntervalId)0)
+       XtRemoveTimeOut(channel_timer);
+#endif
 
     return retval;
 }
@@ -3087,25 +3111,6 @@ gui_mch_stop_blink(void)
     blink_state = BLINK_NONE;
 }
 
-/*
- * Start the cursor blinking.  If it was already blinking, this restarts the
- * waiting time and shows the cursor.
- */
-    void
-gui_mch_start_blink(void)
-{
-    if (blink_timer != (XtIntervalId)0)
-       XtRemoveTimeOut(blink_timer);
-    /* Only switch blinking on if none of the times is zero */
-    if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
-    {
-       blink_timer = XtAppAddTimeOut(app_context, blink_waittime,
-                                                     gui_x11_blink_cb, NULL);
-       blink_state = BLINK_ON;
-       gui_update_cursor(TRUE, FALSE);
-    }
-}
-
     static void
 gui_x11_blink_cb(
     XtPointer      timed_out UNUSED,
@@ -3127,6 +3132,25 @@ gui_x11_blink_cb(
     }
 }
 
+/*
+ * Start the cursor blinking.  If it was already blinking, this restarts the
+ * waiting time and shows the cursor.
+ */
+    void
+gui_mch_start_blink(void)
+{
+    if (blink_timer != (XtIntervalId)0)
+       XtRemoveTimeOut(blink_timer);
+    /* Only switch blinking on if none of the times is zero */
+    if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
+    {
+       blink_timer = XtAppAddTimeOut(app_context, blink_waittime,
+                                                     gui_x11_blink_cb, NULL);
+       blink_state = BLINK_ON;
+       gui_update_cursor(TRUE, FALSE);
+    }
+}
+
 /*
  * Return the RGB value of a pixel as a long.
  */
index 7b23a9a9fdbf035e07600a5c9aa54b4e43b6f2b3..ae7e6ed5addc60329cf3312aea8188ebffccd590 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1008,
 /**/
     1007,
 /**/