aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2021-12-02 17:53:58 +0800
committerPo Lu2021-12-02 17:53:58 +0800
commit2f6b519eaeb3be4ee6a912b40a21686be12d4d88 (patch)
treed835634ef08ebdf0e7900a8322060d511eb56481 /src
parent78a3933b62c1c83a6a4d54c9bc65faf069aa83dc (diff)
parent3f98188b864fb4f16a7c2878a96c880ec55452dd (diff)
downloademacs-2f6b519eaeb3be4ee6a912b40a21686be12d4d88.tar.gz
emacs-2f6b519eaeb3be4ee6a912b40a21686be12d4d88.zip
Merge remote-tracking branch 'origin/master' into feature/pgtk
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c17
-rw-r--r--src/termhooks.h7
-rw-r--r--src/xterm.c49
3 files changed, 55 insertions, 18 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 35b98846a90..df07cf290b8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5997,6 +5997,21 @@ make_lispy_event (struct input_event *event)
5997 return list2 (head, position); 5997 return list2 (head, position);
5998 } 5998 }
5999 5999
6000 case TOUCH_END_EVENT:
6001 {
6002 Lisp_Object position;
6003
6004 /* Build the position as appropriate for this mouse click. */
6005 struct frame *f = XFRAME (event->frame_or_window);
6006
6007 if (! FRAME_LIVE_P (f))
6008 return Qnil;
6009
6010 position = make_lispy_position (f, event->x, event->y,
6011 event->timestamp);
6012
6013 return list2 (Qtouch_end, position);
6014 }
6000 6015
6001#ifdef USE_TOOLKIT_SCROLL_BARS 6016#ifdef USE_TOOLKIT_SCROLL_BARS
6002 6017
@@ -11754,6 +11769,8 @@ syms_of_keyboard (void)
11754 DEFSYM (Qfile_notify, "file-notify"); 11769 DEFSYM (Qfile_notify, "file-notify");
11755#endif /* USE_FILE_NOTIFY */ 11770#endif /* USE_FILE_NOTIFY */
11756 11771
11772 DEFSYM (Qtouch_end, "touch-end");
11773
11757 /* Menu and tool bar item parts. */ 11774 /* Menu and tool bar item parts. */
11758 DEFSYM (QCenable, ":enable"); 11775 DEFSYM (QCenable, ":enable");
11759 DEFSYM (QCvisible, ":visible"); 11776 DEFSYM (QCvisible, ":visible");
diff --git a/src/termhooks.h b/src/termhooks.h
index 649a4236d20..b124e995292 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -273,6 +273,13 @@ enum event_kind
273 /* Pre-edit text was changed. */ 273 /* Pre-edit text was changed. */
274 , PGTK_PREEDIT_TEXT_EVENT 274 , PGTK_PREEDIT_TEXT_EVENT
275#endif 275#endif
276
277 /* Either the mouse wheel has been released without it being
278 clicked, or the user has lifted his finger from a touchpad.
279
280 In the future, this may take into account other multi-touch
281 events generated from touchscreens and such. */
282 , TOUCH_END_EVENT
276}; 283};
277 284
278/* Bit width of an enum event_kind tag at the start of structs and unions. */ 285/* Bit width of an enum event_kind tag at the start of structs and unions. */
diff --git a/src/xterm.c b/src/xterm.c
index d633953018c..3f7b9560345 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10025,42 +10025,55 @@ handle_one_xevent (struct x_display_info *dpyinfo,
10025 val->emacs_value += delta; 10025 val->emacs_value += delta;
10026 10026
10027 if (mwheel_coalesce_scroll_events 10027 if (mwheel_coalesce_scroll_events
10028 && (fabs (val->emacs_value) < 1)) 10028 && (fabs (val->emacs_value) < 1)
10029 && (fabs (delta) > 0))
10029 continue; 10030 continue;
10030 10031
10031 bool s = signbit (val->emacs_value); 10032 bool s = signbit (val->emacs_value);
10032 inev.ie.kind = (val->horizontal 10033 inev.ie.kind = (fabs (delta) > 0
10033 ? HORIZ_WHEEL_EVENT 10034 ? (val->horizontal
10034 : WHEEL_EVENT); 10035 ? HORIZ_WHEEL_EVENT
10036 : WHEEL_EVENT)
10037 : TOUCH_END_EVENT);
10035 inev.ie.timestamp = xev->time; 10038 inev.ie.timestamp = xev->time;
10036 10039
10037 XSETINT (inev.ie.x, lrint (xev->event_x)); 10040 XSETINT (inev.ie.x, lrint (xev->event_x));
10038 XSETINT (inev.ie.y, lrint (xev->event_y)); 10041 XSETINT (inev.ie.y, lrint (xev->event_y));
10039 XSETFRAME (inev.ie.frame_or_window, f); 10042 XSETFRAME (inev.ie.frame_or_window, f);
10040 10043
10041 inev.ie.modifiers = !s ? up_modifier : down_modifier; 10044 if (fabs (delta) > 0)
10042 inev.ie.modifiers 10045 {
10043 |= x_x_to_emacs_modifiers (dpyinfo, 10046 inev.ie.modifiers = !s ? up_modifier : down_modifier;
10044 xev->mods.effective); 10047 inev.ie.modifiers
10048 |= x_x_to_emacs_modifiers (dpyinfo,
10049 xev->mods.effective);
10050 }
10045 10051
10046 scroll_unit = pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0); 10052 scroll_unit = pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0);
10047 10053
10048 if (NUMBERP (Vx_scroll_event_delta_factor)) 10054 if (NUMBERP (Vx_scroll_event_delta_factor))
10049 scroll_unit *= XFLOATINT (Vx_scroll_event_delta_factor); 10055 scroll_unit *= XFLOATINT (Vx_scroll_event_delta_factor);
10050 10056
10051 if (val->horizontal) 10057 if (fabs (delta) > 0)
10052 { 10058 {
10053 inev.ie.arg 10059 if (val->horizontal)
10054 = list3 (Qnil, 10060 {
10055 make_float (val->emacs_value 10061 inev.ie.arg
10056 * scroll_unit), 10062 = list3 (Qnil,
10057 make_float (0)); 10063 make_float (val->emacs_value
10064 * scroll_unit),
10065 make_float (0));
10066 }
10067 else
10068 {
10069 inev.ie.arg = list3 (Qnil, make_float (0),
10070 make_float (val->emacs_value
10071 * scroll_unit));
10072 }
10058 } 10073 }
10059 else 10074 else
10060 { 10075 {
10061 inev.ie.arg = list3 (Qnil, make_float (0), 10076 inev.ie.arg = Qnil;
10062 make_float (val->emacs_value
10063 * scroll_unit));
10064 } 10077 }
10065 10078
10066 kbd_buffer_store_event_hold (&inev.ie, hold_quit); 10079 kbd_buffer_store_event_hold (&inev.ie, hold_quit);