[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ddfb91c0a7 3/3: Fix positioning of non-system tooltips on GTK bui
From: |
Po Lu |
Subject: |
master ddfb91c0a7 3/3: Fix positioning of non-system tooltips on GTK builds |
Date: |
Sat, 4 Jun 2022 22:06:14 -0400 (EDT) |
branch: master
commit ddfb91c0a7e46f0332caf82237cabc736ddfd276
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
src/xfns.c | 12 +++++++-----
src/xterm.c | 7 +++----
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/xfns.c b/src/xfns.c
index d696078440..e3763a5589 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)
the display in *ROOT_X, and *ROOT_Y. */
static void
-compute_tip_xy (struct frame *f,
- Lisp_Object parms, Lisp_Object dx, Lisp_Object dy,
- int width, int height, int *root_x, int *root_y)
+compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx,
+ Lisp_Object dy, int width, int height, int *root_x,
+ int *root_y)
{
Lisp_Object left, top, right, bottom;
int win_x, win_y;
@@ -8184,7 +8184,7 @@ compute_tip_xy (struct frame *f,
&root, &child, root_x, root_y, &win_x, &win_y, &pmask);
unblock_input ();
- XSETFRAME(frame, f);
+ XSETFRAME (frame, f);
attributes = Fx_display_monitor_attributes_list (frame);
/* Try to determine the monitor where the mouse pointer is and
@@ -8199,11 +8199,13 @@ compute_tip_xy (struct frame *f,
min_y = XFIXNUM (Fnth (make_fixnum (2), geometry));
max_x = min_x + XFIXNUM (Fnth (make_fixnum (3), geometry));
max_y = min_y + XFIXNUM (Fnth (make_fixnum (4), geometry));
+
if (min_x <= *root_x && *root_x < max_x
&& min_y <= *root_y && *root_y < max_y)
{
break;
}
+
max_y = -1;
}
@@ -8213,7 +8215,7 @@ compute_tip_xy (struct frame *f,
/* It was not possible to determine the monitor's geometry, so we
assign some sane defaults here: */
- if ( max_y < 0 )
+ if (max_y < 0)
{
min_x = 0;
min_y = 0;
diff --git a/src/xterm.c b/src/xterm.c
index 57a3f73cac..2bf37e94d6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -17554,15 +17554,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
#endif
x_net_wm_state (f, configureEvent.xconfigure.window);
-#ifdef USE_X_TOOLKIT
+#if defined USE_X_TOOLKIT || defined USE_GTK
/* Tip frames are pure X window, set size for them. */
if (FRAME_TOOLTIP_P (f))
{
if (FRAME_PIXEL_HEIGHT (f) != configureEvent.xconfigure.height
|| FRAME_PIXEL_WIDTH (f) != configureEvent.xconfigure.width)
- {
- SET_FRAME_GARBAGED (f);
- }
+ SET_FRAME_GARBAGED (f);
+
FRAME_PIXEL_HEIGHT (f) = configureEvent.xconfigure.height;
FRAME_PIXEL_WIDTH (f) = configureEvent.xconfigure.width;
}