You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
motif/SOURCES/0006-Xm-Tooltip-Use-Xineram...

54 lines
1.7 KiB

From af453aebd8e53a32369c792cf8d0e641b2b3a834 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Thu, 21 Nov 2024 14:24:30 +0100
Subject: [PATCH 6/7] Xm/Tooltip: Use Xinerama for placement
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
---
lib/Xm/ToolTip.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/lib/Xm/ToolTip.c b/lib/Xm/ToolTip.c
index dc65071d..fdd32221 100644
--- a/lib/Xm/ToolTip.c
+++ b/lib/Xm/ToolTip.c
@@ -29,6 +29,7 @@
#include <Xm/VendorSEP.h>
#include <Xm/GadgetP.h>
#include <Xm/SlideC.h>
+#include <Xm/ScreenP.h>
#include <Xm/TraitP.h>
#include <Xm/ToolTipCT.h>
#include <Xm/ToolTipT.h>
@@ -153,6 +154,8 @@ ToolTipPost (XtPointer client_data,
XtWidgetGeometry geo;
Position destX,
destY;
+ Position dispMaxX,
+ dispMaxY;
XmToolTipConfigTrait ttp; /* ToolTip pointer */
@@ -197,12 +200,14 @@ ToolTipPost (XtPointer client_data,
Don't let the tip be off the right/bottom of the screen
*/
destX = rx + (XmIsGadget (w) ? XtX (w) : 0) - x + XtWidth (w) / 2;
- if (destX + geo.width > WidthOfScreen (XtScreen (w)))
+ destY = ry + (XmIsGadget (w) ? XtY (w) : 0) - y + XtHeight (w);
+ _XmScreenGetBoundariesAtpoint(XtScreen(w), destX, destY, NULL, NULL, &dispMaxX, &dispMaxY);
+
+ if (destX + geo.width > dispMaxX)
{
- destX = WidthOfScreen (XtScreen (w)) - geo.width;
+ destX = dispMaxX - geo.width;
}
- destY = ry + (XmIsGadget (w) ? XtY (w) : 0) - y + XtHeight (w);
- if (destY + geo.height > HeightOfScreen (XtScreen (w)))
+ if (destY + geo.height > dispMaxY)
{
destY = ry + (XmIsGadget (w) ? XtY (w) : 0) - y - geo.height;
}
--
2.47.1