diff options
| author | Po Lu | 2021-12-29 13:13:15 +0800 |
|---|---|---|
| committer | Po Lu | 2021-12-29 13:13:15 +0800 |
| commit | 42ede97016e82c86460b2a20cadeb4e8e6ebea7a (patch) | |
| tree | d9097e1d6f5737dea4091cc6c8b340a623b55c90 /src | |
| parent | 0b5d9e9d8e914b060e6fdc868169259080f9d7a0 (diff) | |
| download | emacs-42ede97016e82c86460b2a20cadeb4e8e6ebea7a.tar.gz emacs-42ede97016e82c86460b2a20cadeb4e8e6ebea7a.zip | |
Use XI2 to handle xwidget button events
* src/xterm.c (handle_one_xevent): Handle xwidget views when
handling XI_ButtonPress or XI_ButtonRelease events.
* src/xwidget.c (x_draw_xwidget_glyph_string): Add appropriate
values to the XI2 event mask.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 22 | ||||
| -rw-r--r-- | src/xwidget.c | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index 3fdf214c3da..3200e44a872 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10325,6 +10325,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 10325 | bool tab_bar_p = false; | 10325 | bool tab_bar_p = false; |
| 10326 | bool tool_bar_p = false; | 10326 | bool tool_bar_p = false; |
| 10327 | struct xi_device_t *device; | 10327 | struct xi_device_t *device; |
| 10328 | #ifdef HAVE_XWIDGETS | ||
| 10329 | struct xwidget_view *xvw; | ||
| 10330 | #endif | ||
| 10328 | 10331 | ||
| 10329 | #ifdef XIPointerEmulated | 10332 | #ifdef XIPointerEmulated |
| 10330 | /* Ignore emulated scroll events when XI2 native | 10333 | /* Ignore emulated scroll events when XI2 native |
| @@ -10340,6 +10343,25 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 10340 | } | 10343 | } |
| 10341 | #endif | 10344 | #endif |
| 10342 | 10345 | ||
| 10346 | #ifdef HAVE_XWIDGETS | ||
| 10347 | xvw = xwidget_view_from_window (xev->event); | ||
| 10348 | if (xvw) | ||
| 10349 | { | ||
| 10350 | xwidget_button (xvw, xev->evtype == XI_ButtonPress, | ||
| 10351 | lrint (xev->event_x), lrint (xev->event_y), | ||
| 10352 | xev->detail, xev->mods.effective, xev->time); | ||
| 10353 | |||
| 10354 | if (!EQ (selected_window, xvw->w) && (xev->detail < 4)) | ||
| 10355 | { | ||
| 10356 | inev.ie.kind = SELECT_WINDOW_EVENT; | ||
| 10357 | inev.ie.frame_or_window = xvw->w; | ||
| 10358 | } | ||
| 10359 | |||
| 10360 | *finish = X_EVENT_DROP; | ||
| 10361 | goto XI_OTHER; | ||
| 10362 | } | ||
| 10363 | #endif | ||
| 10364 | |||
| 10343 | device = xi_device_from_id (dpyinfo, xev->deviceid); | 10365 | device = xi_device_from_id (dpyinfo, xev->deviceid); |
| 10344 | 10366 | ||
| 10345 | if (!device || !device->master_p) | 10367 | if (!device || !device->master_p) |
diff --git a/src/xwidget.c b/src/xwidget.c index 57451535485..22c42382bbf 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -2106,6 +2106,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 2106 | mask.deviceid = XIAllMasterDevices; | 2106 | mask.deviceid = XIAllMasterDevices; |
| 2107 | 2107 | ||
| 2108 | XISetMask (m, XI_Motion); | 2108 | XISetMask (m, XI_Motion); |
| 2109 | XISetMask (m, XI_ButtonPress); | ||
| 2110 | XISetMask (m, XI_ButtonRelease); | ||
| 2109 | XISelectEvents (xv->dpy, xv->wdesc, &mask, 1); | 2111 | XISelectEvents (xv->dpy, xv->wdesc, &mask, 1); |
| 2110 | } | 2112 | } |
| 2111 | #endif | 2113 | #endif |