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.
This commit is contained in:
Po Lu 2022-06-05 10:02:55 +08:00
parent f15f9ddea1
commit ddfb91c0a7
2 changed files with 10 additions and 9 deletions

View file

@ -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;

View file

@ -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;
}