diff --git a/ChangeLog b/ChangeLog index 2b18923d..567b3fa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2022-01-29 Araki Ken + + * ui_layout.c: + - ui_screen_set_pointer_motion_event_mask() is used + instead of ui_window_{add|remove}_event_mask(). + - ui_window_t::pointer_motion is replaced by screen_pointer_motion() + only if autohide_scrollbar is enabled. + + * ui_screen.[ch]: ui_screen_set_pointer_motion_event_mask() is added. + + * vt_parser.c: The default value of XTSMPOINTER (CSI>p) is changed + from 2 to 1. + + * version.h: 3.9.2 -> 3.9.2post + 2022-01-16 Araki Ken * 3.9.2 released. diff --git a/main/version.h.in b/main/version.h.in index 675d86d5..ede01b36 100644 --- a/main/version.h.in +++ b/main/version.h.in @@ -12,7 +12,7 @@ #if 0 #define CHANGE_DATE "pre/@CHANGE_DATE@" -#elif 0 +#elif 1 #define CHANGE_DATE "post/@CHANGE_DATE@" #else #define CHANGE_DATE "" diff --git a/uitoolkit/ui_layout.c b/uitoolkit/ui_layout.c index 2660f962..692081c1 100644 --- a/uitoolkit/ui_layout.c +++ b/uitoolkit/ui_layout.c @@ -933,8 +933,10 @@ static int need_idling_event(struct terminal *term) { } #endif +static void screen_pointer_motion(ui_window_t *win, XMotionEvent *event); + static void change_sb_mode_intern(struct terminal *term, ui_sb_mode_t new_mode, - int dynamic_change) { + int dynamic_change /* true in changing by autohide */) { ui_layout_t *layout; ui_sb_mode_t old_mode; @@ -947,13 +949,15 @@ static void change_sb_mode_intern(struct terminal *term, ui_sb_mode_t new_mode, new_mode = SBM_NONE; term->autohide_scrollbar = 1; - ui_window_add_event_mask(&term->screen->window, PointerMotionMask); + term->screen->window.pointer_motion = screen_pointer_motion; + ui_screen_set_pointer_motion_event_mask(term->screen, 1); #ifndef USE_QUARTZ layout->window.idling = window_idling; #endif } else if (!dynamic_change) { term->autohide_scrollbar = 0; - ui_window_remove_event_mask(&term->screen->window, PointerMotionMask); + term->screen->window.pointer_motion = layout->pointer_motion; + ui_screen_set_pointer_motion_event_mask(term->screen, 0); (*term->screen->xterm_listener.set_mouse_report)(term->screen->xterm_listener.self); #ifndef USE_QUARTZ @@ -1195,14 +1199,14 @@ ui_layout_t *ui_layout_new(ui_screen_t *screen, char *view_name, char *fg_color, layout->line_scrolled_out = screen->screen_listener.line_scrolled_out; screen->screen_listener.line_scrolled_out = line_scrolled_out; + layout->pointer_motion = screen->window.pointer_motion; if (mode == SBM_AUTOHIDE) { layout->term.sb_mode = SBM_NONE; layout->term.autohide_scrollbar = 1; + screen->window.pointer_motion = screen_pointer_motion; } else { layout->term.sb_mode = mode; } - layout->pointer_motion = screen->window.pointer_motion; - screen->window.pointer_motion = screen_pointer_motion; if (layout->term.sb_mode == SBM_NONE) { actual_width = ACTUAL_WIDTH(&screen->window); @@ -1269,7 +1273,7 @@ ui_layout_t *ui_layout_new(ui_screen_t *screen, char *view_name, char *fg_color, #ifndef USE_QUARTZ layout->window.idling = window_idling; #endif - ui_window_add_event_mask(&screen->window, PointerMotionMask); + ui_screen_set_pointer_motion_event_mask(screen, 1); } return layout; @@ -1432,9 +1436,9 @@ int ui_layout_add_child(ui_layout_t *layout, ui_screen_t *screen, int horizontal next->sb_mode = term->sb_mode; if ((next->autohide_scrollbar = term->autohide_scrollbar)) { - ui_window_add_event_mask(&screen->window, PointerMotionMask); + screen->window.pointer_motion = screen_pointer_motion; + ui_screen_set_pointer_motion_event_mask(screen, 1); } - screen->window.pointer_motion = screen_pointer_motion; reset_layout(&layout->term, 0, 0, layout->window.width, layout->window.height); diff --git a/uitoolkit/ui_screen.c b/uitoolkit/ui_screen.c index e9f9d9e0..c6d29783 100644 --- a/uitoolkit/ui_screen.c +++ b/uitoolkit/ui_screen.c @@ -2489,6 +2489,10 @@ static void key_pressed(ui_window_t *win, XKeyEvent *event) { screen->hide_pointer = 1; } else { ui_window_add_event_mask(win, PointerMotionMask); + /* + * Need to remove PointerMotionMask after reviving the pointer in moving it. + * (see pointer_motion()) + */ screen->hide_pointer = 2; } } @@ -3532,18 +3536,20 @@ static void selecting_line(ui_screen_t *screen, int y, Time time) { static void change_sb_mode(ui_screen_t *screen, ui_sb_mode_t sb_mode); -static void pointer_motion(ui_window_t *win, XMotionEvent *event) { - ui_screen_t *screen; - - screen = (ui_screen_t *)win; - +static void show_pointer(ui_screen_t *screen) { if (screen->hide_pointer) { - ui_window_set_cursor(win, XC_xterm); + ui_window_set_cursor(&screen->window, XC_xterm); if (screen->hide_pointer == 2) { - ui_window_remove_event_mask(win, PointerMotionMask); + ui_window_remove_event_mask(&screen->window, PointerMotionMask); } screen->hide_pointer = 0; } +} + +static void pointer_motion(ui_window_t *win, XMotionEvent *event) { + ui_screen_t *screen = (ui_screen_t *)win; + + show_pointer(screen); if (!(event->state & (ShiftMask | ControlMask)) && vt_term_get_mouse_report_mode(screen->term) >= ANY_EVENT_MOUSE_REPORT) { @@ -6054,12 +6060,9 @@ static void xterm_set_mouse_report(void *p) { } if (vt_term_get_mouse_report_mode(screen->term) < ANY_EVENT_MOUSE_REPORT) { - /* pointer_motion may be overridden by ui_layout */ - if (screen->window.pointer_motion == pointer_motion) { - ui_window_remove_event_mask(&screen->window, PointerMotionMask); - } + ui_screen_set_pointer_motion_event_mask(screen, 0); } else { - ui_window_add_event_mask(&screen->window, PointerMotionMask); + ui_screen_set_pointer_motion_event_mask(screen, 1); } } @@ -7612,3 +7615,18 @@ ui_picture_modifier_t *ui_screen_get_picture_modifier(ui_screen_t *screen) { return &screen->pic_mod; } } + +void ui_screen_set_pointer_motion_event_mask(ui_screen_t *screen, int flag) { + if (flag) { + ui_window_add_event_mask(&screen->window, PointerMotionMask); + if (screen->hide_pointer == 2) { + /* No need to remove PointerMotionMask after reviving the pointer in moving it. */ + screen->hide_pointer = 1; + } + } else if (vt_term_get_mouse_report_mode(screen->term) != ANY_EVENT_MOUSE_REPORT && + /* pointer_motion may be overridden by ui_layout */ + screen->window.pointer_motion == pointer_motion) { + show_pointer(screen); + ui_window_remove_event_mask(&screen->window, PointerMotionMask); + } +} diff --git a/uitoolkit/ui_screen.h b/uitoolkit/ui_screen.h index f1797287..9c613bb4 100644 --- a/uitoolkit/ui_screen.h +++ b/uitoolkit/ui_screen.h @@ -221,4 +221,6 @@ void ui_screen_reload_color_cache(ui_screen_t *screen, int do_unload); ui_picture_modifier_t *ui_screen_get_picture_modifier(ui_screen_t *screen); +void ui_screen_set_pointer_motion_event_mask(ui_screen_t *screen, int flag); + #endif diff --git a/vtemu/vt_parser.c b/vtemu/vt_parser.c index 96097e2f..a39bad47 100644 --- a/vtemu/vt_parser.c +++ b/vtemu/vt_parser.c @@ -7096,7 +7096,7 @@ vt_parser_t *vt_parser_new(vt_screen_t *screen, vt_termcap_ptr_t termcap, vt_cha vt_parser->unicode_policy = policy; vt_parser->cursor_style = cursor_style; vt_parser->is_visible_cursor = 1; - vt_parser->hide_pointer_mode = 2; /* Compatible with xterm 344 */ + vt_parser->hide_pointer_mode = 1; /* Compatible with xterm 370 */ if ((vt_parser->cc_conv = vt_char_encoding_conv_new(encoding)) == NULL) { goto error;