aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-06 16:58:44 +0000
committerGerd Moellmann2001-04-06 16:58:44 +0000
commitab452f99021b64a0bd17944cf699a3ff7faea43c (patch)
tree42c5226a23ba716011f88b026d02afbc3517f570 /src
parent5f5c9e79243614837b422a197ad360ef1110b969 (diff)
downloademacs-ab452f99021b64a0bd17944cf699a3ff7faea43c.tar.gz
emacs-ab452f99021b64a0bd17944cf699a3ff7faea43c.zip
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Make sure the tooltip is completely visible. (x_make_gc): Use FRAME_X_SCREEN_NUMBER.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 1e14bc80fe6..4f718fa9020 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3977,8 +3977,7 @@ x_make_gc (f)
3977 gray_bits, gray_width, gray_height, 3977 gray_bits, gray_width, gray_height,
3978 f->output_data.x->foreground_pixel, 3978 f->output_data.x->foreground_pixel,
3979 f->output_data.x->background_pixel, 3979 f->output_data.x->background_pixel,
3980 DefaultDepth (FRAME_X_DISPLAY (f), 3980 DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))));
3981 XScreenNumberOfScreen (FRAME_X_SCREEN (f)))));
3982 3981
3983 UNBLOCK_INPUT; 3982 UNBLOCK_INPUT;
3984} 3983}
@@ -10415,7 +10414,7 @@ hide_hourglass ()
10415static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *, 10414static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *,
10416 Lisp_Object, Lisp_Object)); 10415 Lisp_Object, Lisp_Object));
10417static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, 10416static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
10418 Lisp_Object, int *, int *)); 10417 Lisp_Object, int, int, int *, int *));
10419 10418
10420/* The frame of a currently visible tooltip. */ 10419/* The frame of a currently visible tooltip. */
10421 10420
@@ -10768,13 +10767,15 @@ x_create_tip_frame (dpyinfo, parms, text)
10768 10767
10769/* Compute where to display tip frame F. PARMS is the list of frame 10768/* Compute where to display tip frame F. PARMS is the list of frame
10770 parameters for F. DX and DY are specified offsets from the current 10769 parameters for F. DX and DY are specified offsets from the current
10771 location of the mouse. Return coordinates relative to the root 10770 location of the mouse. WIDTH and HEIGHT are the width and height
10772 window of the display in *ROOT_X, and *ROOT_Y. */ 10771 of the tooltip. Return coordinates relative to the root window of
10772 the display in *ROOT_X, and *ROOT_Y. */
10773 10773
10774static void 10774static void
10775compute_tip_xy (f, parms, dx, dy, root_x, root_y) 10775compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
10776 struct frame *f; 10776 struct frame *f;
10777 Lisp_Object parms, dx, dy; 10777 Lisp_Object parms, dx, dy;
10778 int width, height;
10778 int *root_x, *root_y; 10779 int *root_x, *root_y;
10779{ 10780{
10780 Lisp_Object left, top; 10781 Lisp_Object left, top;
@@ -10788,18 +10789,30 @@ compute_tip_xy (f, parms, dx, dy, root_x, root_y)
10788 10789
10789 /* Move the tooltip window where the mouse pointer is. Resize and 10790 /* Move the tooltip window where the mouse pointer is. Resize and
10790 show it. */ 10791 show it. */
10791 BLOCK_INPUT; 10792 if (!INTEGERP (left) && !INTEGERP (top))
10792 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, 10793 {
10793 &root, &child, root_x, root_y, &win_x, &win_y, &pmask); 10794 BLOCK_INPUT;
10794 UNBLOCK_INPUT; 10795 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
10796 &root, &child, root_x, root_y, &win_x, &win_y, &pmask);
10797 UNBLOCK_INPUT;
10798 }
10795 10799
10796 *root_x += XINT (dx);
10797 *root_y += XINT (dy);
10798
10799 if (INTEGERP (left))
10800 *root_x = XINT (left);
10801 if (INTEGERP (top)) 10800 if (INTEGERP (top))
10802 *root_y = XINT (top); 10801 *root_y = XINT (top);
10802 else if (*root_y + XINT (dy) - height < 0)
10803 *root_y -= XINT (dy);
10804 else
10805 {
10806 *root_y -= height;
10807 *root_y += XINT (dy);
10808 }
10809
10810 if (INTEGERP (left))
10811 *root_x = XINT (left);
10812 else if (*root_x + XINT (dx) + width > FRAME_X_DISPLAY_INFO (f)->width)
10813 *root_x -= width + XINT (dx);
10814 else
10815 *root_x += XINT (dx);
10803} 10816}
10804 10817
10805 10818
@@ -10881,9 +10894,10 @@ DY added (default is -10).")
10881 } 10894 }
10882 10895
10883 BLOCK_INPUT; 10896 BLOCK_INPUT;
10884 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y); 10897 compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f),
10898 PIXEL_HEIGHT (f), &root_x, &root_y);
10885 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 10899 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
10886 root_x, root_y - PIXEL_HEIGHT (f)); 10900 root_x, root_y);
10887 UNBLOCK_INPUT; 10901 UNBLOCK_INPUT;
10888 goto start_timer; 10902 goto start_timer;
10889 } 10903 }
@@ -10968,11 +10982,11 @@ DY added (default is -10).")
10968 10982
10969 /* Move the tooltip window where the mouse pointer is. Resize and 10983 /* Move the tooltip window where the mouse pointer is. Resize and
10970 show it. */ 10984 show it. */
10971 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y); 10985 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
10972 10986
10973 BLOCK_INPUT; 10987 BLOCK_INPUT;
10974 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 10988 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
10975 root_x, root_y - height, width, height); 10989 root_x, root_y, width, height);
10976 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 10990 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
10977 UNBLOCK_INPUT; 10991 UNBLOCK_INPUT;
10978 10992