diff options
| author | Po Lu | 2022-10-28 19:55:18 +0800 |
|---|---|---|
| committer | Po Lu | 2022-10-28 19:55:18 +0800 |
| commit | 90caddc98605e6dbf46be721f4a9ac8a72e8d7ac (patch) | |
| tree | c6e88528368f7346c62f335be32fdb9a1757607c /src | |
| parent | 93aff6e5334ee9f398727395b02c2e7913d84bc2 (diff) | |
| download | emacs-90caddc98605e6dbf46be721f4a9ac8a72e8d7ac.tar.gz emacs-90caddc98605e6dbf46be721f4a9ac8a72e8d7ac.zip | |
Clean up some xwidgets code
* src/xterm.c (handle_one_xevent): [HAVE_XWIDGETS]: Fix coding
style and remove extra ifdefs. Also avoid redundant frame
lookups in some cases.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 74 |
1 files changed, 43 insertions, 31 deletions
diff --git a/src/xterm.c b/src/xterm.c index c8ac30c72c7..f2d6be5d46b 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -18962,11 +18962,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 18962 | goto OTHER; | 18962 | goto OTHER; |
| 18963 | 18963 | ||
| 18964 | case Expose: | 18964 | case Expose: |
| 18965 | f = x_window_to_frame (dpyinfo, event->xexpose.window); | 18965 | |
| 18966 | #ifdef HAVE_XWIDGETS | 18966 | #ifdef HAVE_XWIDGETS |
| 18967 | { | 18967 | { |
| 18968 | struct xwidget_view *xv = | 18968 | struct xwidget_view *xv; |
| 18969 | xwidget_view_from_window (event->xexpose.window); | 18969 | |
| 18970 | xv = xwidget_view_from_window (event->xexpose.window); | ||
| 18970 | 18971 | ||
| 18971 | if (xv) | 18972 | if (xv) |
| 18972 | { | 18973 | { |
| @@ -18975,6 +18976,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 18975 | } | 18976 | } |
| 18976 | } | 18977 | } |
| 18977 | #endif | 18978 | #endif |
| 18979 | |||
| 18980 | f = x_window_to_frame (dpyinfo, event->xexpose.window); | ||
| 18978 | if (f) | 18981 | if (f) |
| 18979 | { | 18982 | { |
| 18980 | if (!FRAME_VISIBLE_P (f)) | 18983 | if (!FRAME_VISIBLE_P (f)) |
| @@ -19778,28 +19781,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19778 | 19781 | ||
| 19779 | case EnterNotify: | 19782 | case EnterNotify: |
| 19780 | x_display_set_last_user_time (dpyinfo, event->xcrossing.time, | 19783 | x_display_set_last_user_time (dpyinfo, event->xcrossing.time, |
| 19781 | event->xcrossing.send_event, false); | 19784 | event->xcrossing.send_event, |
| 19782 | 19785 | false); | |
| 19783 | #ifdef HAVE_XINPUT2 | ||
| 19784 | /* For whatever reason, the X server continues to deliver | ||
| 19785 | EnterNotify and LeaveNotify events despite us selecting for | ||
| 19786 | related XI_Enter and XI_Leave events. It's not just our | ||
| 19787 | problem, since windows created by "xinput test-xi2" suffer | ||
| 19788 | from the same defect. Simply ignore all such events while | ||
| 19789 | the input extension is enabled. (bug#57468) */ | ||
| 19790 | |||
| 19791 | if (dpyinfo->supports_xi2) | ||
| 19792 | goto OTHER; | ||
| 19793 | #endif | ||
| 19794 | |||
| 19795 | if (x_top_window_to_frame (dpyinfo, event->xcrossing.window)) | ||
| 19796 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); | ||
| 19797 | 19786 | ||
| 19798 | #ifdef HAVE_XWIDGETS | 19787 | #ifdef HAVE_XWIDGETS |
| 19799 | { | 19788 | { |
| 19800 | struct xwidget_view *xvw = xwidget_view_from_window (event->xcrossing.window); | 19789 | struct xwidget_view *xvw; |
| 19801 | Mouse_HLInfo *hlinfo; | 19790 | Mouse_HLInfo *hlinfo; |
| 19802 | 19791 | ||
| 19792 | xvw = xwidget_view_from_window (event->xcrossing.window); | ||
| 19793 | |||
| 19803 | if (xvw) | 19794 | if (xvw) |
| 19804 | { | 19795 | { |
| 19805 | xwidget_motion_or_crossing (xvw, event); | 19796 | xwidget_motion_or_crossing (xvw, event); |
| @@ -19813,14 +19804,28 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19813 | } | 19804 | } |
| 19814 | 19805 | ||
| 19815 | if (any_help_event_p) | 19806 | if (any_help_event_p) |
| 19816 | { | 19807 | do_help = -1; |
| 19817 | do_help = -1; | 19808 | |
| 19818 | } | ||
| 19819 | goto OTHER; | 19809 | goto OTHER; |
| 19820 | } | 19810 | } |
| 19821 | } | 19811 | } |
| 19822 | #endif | 19812 | #endif |
| 19823 | 19813 | ||
| 19814 | #ifdef HAVE_XINPUT2 | ||
| 19815 | /* For whatever reason, the X server continues to deliver | ||
| 19816 | EnterNotify and LeaveNotify events despite us selecting for | ||
| 19817 | related XI_Enter and XI_Leave events. It's not just our | ||
| 19818 | problem, since windows created by "xinput test-xi2" suffer | ||
| 19819 | from the same defect. Simply ignore all such events while | ||
| 19820 | the input extension is enabled. (bug#57468) */ | ||
| 19821 | |||
| 19822 | if (dpyinfo->supports_xi2) | ||
| 19823 | goto OTHER; | ||
| 19824 | #endif | ||
| 19825 | |||
| 19826 | if (x_top_window_to_frame (dpyinfo, event->xcrossing.window)) | ||
| 19827 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); | ||
| 19828 | |||
| 19824 | f = any; | 19829 | f = any; |
| 19825 | 19830 | ||
| 19826 | if (f && event->xcrossing.window == FRAME_X_WINDOW (f)) | 19831 | if (f && event->xcrossing.window == FRAME_X_WINDOW (f)) |
| @@ -19931,7 +19936,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19931 | 19936 | ||
| 19932 | #ifdef HAVE_XWIDGETS | 19937 | #ifdef HAVE_XWIDGETS |
| 19933 | { | 19938 | { |
| 19934 | struct xwidget_view *xvw = xwidget_view_from_window (event->xcrossing.window); | 19939 | struct xwidget_view *xvw; |
| 19940 | |||
| 19941 | xvw = xwidget_view_from_window (event->xcrossing.window); | ||
| 19935 | 19942 | ||
| 19936 | if (xvw) | 19943 | if (xvw) |
| 19937 | { | 19944 | { |
| @@ -20291,7 +20298,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 20291 | f = 0; | 20298 | f = 0; |
| 20292 | #endif | 20299 | #endif |
| 20293 | #ifdef HAVE_XWIDGETS | 20300 | #ifdef HAVE_XWIDGETS |
| 20294 | struct xwidget_view *xvw = xwidget_view_from_window (event->xmotion.window); | 20301 | struct xwidget_view *xvw; |
| 20302 | |||
| 20303 | xvw = xwidget_view_from_window (event->xmotion.window); | ||
| 20295 | 20304 | ||
| 20296 | if (xvw) | 20305 | if (xvw) |
| 20297 | xwidget_motion_or_crossing (xvw, event); | 20306 | xwidget_motion_or_crossing (xvw, event); |
| @@ -20742,7 +20751,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 20742 | event->xbutton.send_event, true); | 20751 | event->xbutton.send_event, true); |
| 20743 | 20752 | ||
| 20744 | #ifdef HAVE_XWIDGETS | 20753 | #ifdef HAVE_XWIDGETS |
| 20745 | struct xwidget_view *xvw = xwidget_view_from_window (event->xbutton.window); | 20754 | struct xwidget_view *xvw; |
| 20755 | |||
| 20756 | xvw = xwidget_view_from_window (event->xbutton.window); | ||
| 20746 | 20757 | ||
| 20747 | if (xvw) | 20758 | if (xvw) |
| 20748 | { | 20759 | { |
| @@ -21407,10 +21418,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 21407 | 21418 | ||
| 21408 | { | 21419 | { |
| 21409 | #ifdef HAVE_XWIDGETS | 21420 | #ifdef HAVE_XWIDGETS |
| 21410 | struct xwidget_view *xwidget_view = xwidget_view_from_window (enter->event); | 21421 | struct xwidget_view *xwidget_view; |
| 21411 | #endif | 21422 | |
| 21423 | xwidget_view = xwidget_view_from_window (enter->event); | ||
| 21412 | 21424 | ||
| 21413 | #ifdef HAVE_XWIDGETS | ||
| 21414 | if (xwidget_view) | 21425 | if (xwidget_view) |
| 21415 | { | 21426 | { |
| 21416 | xwidget_motion_or_crossing (xwidget_view, event); | 21427 | xwidget_motion_or_crossing (xwidget_view, event); |
| @@ -21544,8 +21555,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 21544 | 21555 | ||
| 21545 | #ifdef HAVE_XWIDGETS | 21556 | #ifdef HAVE_XWIDGETS |
| 21546 | { | 21557 | { |
| 21547 | struct xwidget_view *xvw | 21558 | struct xwidget_view *xvw; |
| 21548 | = xwidget_view_from_window (leave->event); | 21559 | |
| 21560 | xvw = xwidget_view_from_window (leave->event); | ||
| 21549 | 21561 | ||
| 21550 | if (xvw) | 21562 | if (xvw) |
| 21551 | { | 21563 | { |