diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-08-27 17:38:27 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-08-27 17:38:27 +0200 |
commit | 1dccf6351dd37e648b2e15fb9f9f71ceba88d446 (patch) | |
tree | 367ef3f06f0dac62d61ebd23983dc2b425340283 /src/gui_x11.c | |
parent | cbe6944956d7c39176e8b15faa77f1c29eaf5c97 (diff) | |
download | vim-1dccf6351dd37e648b2e15fb9f9f71ceba88d446.zip |
patch 8.0.1008: slow updating of terminal window in Motif
Problem: Slow updating of terminal window in Motif.
Solution: Add a timeout to the wait-for-character loop.
Diffstat (limited to 'src/gui_x11.c')
-rw-r--r-- | src/gui_x11.c | 80 |
1 files changed, 52 insertions, 28 deletions
diff --git a/src/gui_x11.c b/src/gui_x11.c index 855f4be0e..a63822225 100644 --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -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, @@ -3128,6 +3133,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. */ guicolor_T |