diff options
| author | Po Lu | 2022-06-05 10:02:55 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-05 10:06:00 +0800 |
| commit | ddfb91c0a7e46f0332caf82237cabc736ddfd276 (patch) | |
| tree | 68d039b2f88abf4cef087fdb9ec568fe7899fa99 | |
| parent | f15f9ddea1ee512d017b1abf132d648f999a07f6 (diff) | |
| download | emacs-ddfb91c0a7e46f0332caf82237cabc736ddfd276.tar.gz emacs-ddfb91c0a7e46f0332caf82237cabc736ddfd276.zip | |
Fix positioning of non-system tooltips on GTK builds
* src/xfns.c (compute_tip_xy): Fix coding style.
* src/xterm.c (handle_one_xevent): Set tooltip size immediately
on GTK builds.
| -rw-r--r-- | src/xfns.c | 12 | ||||
| -rw-r--r-- | src/xterm.c | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/xfns.c b/src/xfns.c index d696078440a..e3763a55893 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -8156,9 +8156,9 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) | |||
| 8156 | the display in *ROOT_X, and *ROOT_Y. */ | 8156 | the display in *ROOT_X, and *ROOT_Y. */ |
| 8157 | 8157 | ||
| 8158 | static void | 8158 | static void |
| 8159 | compute_tip_xy (struct frame *f, | 8159 | compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, |
| 8160 | Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, | 8160 | Lisp_Object dy, int width, int height, int *root_x, |
| 8161 | int width, int height, int *root_x, int *root_y) | 8161 | int *root_y) |
| 8162 | { | 8162 | { |
| 8163 | Lisp_Object left, top, right, bottom; | 8163 | Lisp_Object left, top, right, bottom; |
| 8164 | int win_x, win_y; | 8164 | int win_x, win_y; |
| @@ -8184,7 +8184,7 @@ compute_tip_xy (struct frame *f, | |||
| 8184 | &root, &child, root_x, root_y, &win_x, &win_y, &pmask); | 8184 | &root, &child, root_x, root_y, &win_x, &win_y, &pmask); |
| 8185 | unblock_input (); | 8185 | unblock_input (); |
| 8186 | 8186 | ||
| 8187 | XSETFRAME(frame, f); | 8187 | XSETFRAME (frame, f); |
| 8188 | attributes = Fx_display_monitor_attributes_list (frame); | 8188 | attributes = Fx_display_monitor_attributes_list (frame); |
| 8189 | 8189 | ||
| 8190 | /* Try to determine the monitor where the mouse pointer is and | 8190 | /* Try to determine the monitor where the mouse pointer is and |
| @@ -8199,11 +8199,13 @@ compute_tip_xy (struct frame *f, | |||
| 8199 | min_y = XFIXNUM (Fnth (make_fixnum (2), geometry)); | 8199 | min_y = XFIXNUM (Fnth (make_fixnum (2), geometry)); |
| 8200 | max_x = min_x + XFIXNUM (Fnth (make_fixnum (3), geometry)); | 8200 | max_x = min_x + XFIXNUM (Fnth (make_fixnum (3), geometry)); |
| 8201 | max_y = min_y + XFIXNUM (Fnth (make_fixnum (4), geometry)); | 8201 | max_y = min_y + XFIXNUM (Fnth (make_fixnum (4), geometry)); |
| 8202 | |||
| 8202 | if (min_x <= *root_x && *root_x < max_x | 8203 | if (min_x <= *root_x && *root_x < max_x |
| 8203 | && min_y <= *root_y && *root_y < max_y) | 8204 | && min_y <= *root_y && *root_y < max_y) |
| 8204 | { | 8205 | { |
| 8205 | break; | 8206 | break; |
| 8206 | } | 8207 | } |
| 8208 | |||
| 8207 | max_y = -1; | 8209 | max_y = -1; |
| 8208 | } | 8210 | } |
| 8209 | 8211 | ||
| @@ -8213,7 +8215,7 @@ compute_tip_xy (struct frame *f, | |||
| 8213 | 8215 | ||
| 8214 | /* It was not possible to determine the monitor's geometry, so we | 8216 | /* It was not possible to determine the monitor's geometry, so we |
| 8215 | assign some sane defaults here: */ | 8217 | assign some sane defaults here: */ |
| 8216 | if ( max_y < 0 ) | 8218 | if (max_y < 0) |
| 8217 | { | 8219 | { |
| 8218 | min_x = 0; | 8220 | min_x = 0; |
| 8219 | min_y = 0; | 8221 | min_y = 0; |
diff --git a/src/xterm.c b/src/xterm.c index 57a3f73cac6..2bf37e94d6b 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -17554,15 +17554,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17554 | #endif | 17554 | #endif |
| 17555 | x_net_wm_state (f, configureEvent.xconfigure.window); | 17555 | x_net_wm_state (f, configureEvent.xconfigure.window); |
| 17556 | 17556 | ||
| 17557 | #ifdef USE_X_TOOLKIT | 17557 | #if defined USE_X_TOOLKIT || defined USE_GTK |
| 17558 | /* Tip frames are pure X window, set size for them. */ | 17558 | /* Tip frames are pure X window, set size for them. */ |
| 17559 | if (FRAME_TOOLTIP_P (f)) | 17559 | if (FRAME_TOOLTIP_P (f)) |
| 17560 | { | 17560 | { |
| 17561 | if (FRAME_PIXEL_HEIGHT (f) != configureEvent.xconfigure.height | 17561 | if (FRAME_PIXEL_HEIGHT (f) != configureEvent.xconfigure.height |
| 17562 | || FRAME_PIXEL_WIDTH (f) != configureEvent.xconfigure.width) | 17562 | || FRAME_PIXEL_WIDTH (f) != configureEvent.xconfigure.width) |
| 17563 | { | 17563 | SET_FRAME_GARBAGED (f); |
| 17564 | SET_FRAME_GARBAGED (f); | 17564 | |
| 17565 | } | ||
| 17566 | FRAME_PIXEL_HEIGHT (f) = configureEvent.xconfigure.height; | 17565 | FRAME_PIXEL_HEIGHT (f) = configureEvent.xconfigure.height; |
| 17567 | FRAME_PIXEL_WIDTH (f) = configureEvent.xconfigure.width; | 17566 | FRAME_PIXEL_WIDTH (f) = configureEvent.xconfigure.width; |
| 17568 | } | 17567 | } |