parent
19156db2a8
commit
e3cb25ae23
@ -0,0 +1,32 @@
|
|||||||
|
From 2fa554b01ef6079a9b35df9332bdc4f139ed67e0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Date: Sat, 29 Apr 2023 17:50:39 -0700
|
||||||
|
Subject: [PATCH] Fix CVE-2023-43788: Out of bounds read in
|
||||||
|
XpmCreateXpmImageFromBuffer
|
||||||
|
|
||||||
|
When the test case for CVE-2022-46285 was run with the Address Sanitizer
|
||||||
|
enabled, it found an out-of-bounds read in ParseComment() when reading
|
||||||
|
from a memory buffer instead of a file, as it continued to look for the
|
||||||
|
closing comment marker past the end of the buffer.
|
||||||
|
|
||||||
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
---
|
||||||
|
lib/Xm/Xpmdata.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/Xpmdata.c b/lib/Xm/Xpmdata.c
|
||||||
|
index 7524e65..0b0f1f3 100644
|
||||||
|
--- a/lib/Xm/Xpmdata.c
|
||||||
|
+++ b/lib/Xm/Xpmdata.c
|
||||||
|
@@ -108,7 +108,7 @@ ParseComment(xpmData *data)
|
||||||
|
n++;
|
||||||
|
s2++;
|
||||||
|
} while (c == *s2 && *s2 != '\0' && c);
|
||||||
|
- if (*s2 == '\0') {
|
||||||
|
+ if (*s2 == '\0' || c == '\0') {
|
||||||
|
/* this is the end of the comment */
|
||||||
|
notend = 0;
|
||||||
|
mdata->cptr--;
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From 7e21cb63b9a1ca760a06cc4cd9b19bbc3fcd8f51 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Date: Sat, 29 Apr 2023 18:30:34 -0700
|
||||||
|
Subject: [PATCH] Fix CVE-2023-43789: Out of bounds read on XPM with corrupted
|
||||||
|
colormap
|
||||||
|
|
||||||
|
Found with clang's libfuzzer
|
||||||
|
|
||||||
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
---
|
||||||
|
lib/Xm/Xpmdata.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/Xpmdata.c b/lib/Xm/Xpmdata.c
|
||||||
|
index 0b0f1f3..6e87455 100644
|
||||||
|
--- a/lib/Xm/Xpmdata.c
|
||||||
|
+++ b/lib/Xm/Xpmdata.c
|
||||||
|
@@ -259,13 +259,13 @@ xpmNextWord(
|
||||||
|
int c;
|
||||||
|
|
||||||
|
if (!mdata->type || mdata->type == XPMBUFFER) {
|
||||||
|
- while (isspace(c = *mdata->cptr) && c != mdata->Eos)
|
||||||
|
+ while ((c = *mdata->cptr) && isspace(c) && (c != mdata->Eos))
|
||||||
|
mdata->cptr++;
|
||||||
|
do {
|
||||||
|
c = *mdata->cptr++;
|
||||||
|
*buf++ = c;
|
||||||
|
n++;
|
||||||
|
- } while (!isspace(c) && c != mdata->Eos && n < buflen);
|
||||||
|
+ } while (c && !isspace(c) && (c != mdata->Eos) && (n < buflen));
|
||||||
|
n--;
|
||||||
|
mdata->cptr--;
|
||||||
|
} else {
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
@ -0,0 +1,61 @@
|
|||||||
|
From 49791ea9aa84c64af114f564d4c46228263d1439 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Tue, 19 Nov 2024 18:40:33 +0100
|
||||||
|
Subject: [PATCH 1/7] build: Check for Xinerama availability
|
||||||
|
|
||||||
|
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
---
|
||||||
|
configure.ac | 22 ++++++++++++++++++++++
|
||||||
|
lib/Xm/Makefile.am | 2 +-
|
||||||
|
2 files changed, 23 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index d57f71e6..f0b2617d 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -280,7 +280,29 @@ AC_SUBST(LIB_XP)
|
||||||
|
AC_FIND_XFT
|
||||||
|
AC_IMAGE_SUPPORT
|
||||||
|
|
||||||
|
+AC_ARG_ENABLE(xinerama,[ --enable-xinerama Enable Xinerama (default=yes)])
|
||||||
|
+if test "x$enable_xinerama" = "x"
|
||||||
|
+then
|
||||||
|
+ enable_xinerama="yes"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+if test "x$enable_xinerama" = "xyes"
|
||||||
|
+then
|
||||||
|
+ AC_MSG_CHECKING([for libXinerama])
|
||||||
|
+ AC_CHECK_HEADERS(X11/extensions/Xinerama.h,
|
||||||
|
+ AC_CHECK_LIB(Xinerama, XineramaQueryExtension, ,enable_xinerama="no"),
|
||||||
|
+ enable_xinerama="no")
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+if test "x$enable_xinerama" = "xyes"
|
||||||
|
+then
|
||||||
|
+ LIB_XINERAMA=-lXinerama
|
||||||
|
+else
|
||||||
|
+ LIB_XINERAMA=
|
||||||
|
+fi
|
||||||
|
|
||||||
|
+AM_CONDITIONAL(XINERAMA, test "$enable_xinerama" = "yes")
|
||||||
|
+AC_SUBST(LIB_XINERAMA)
|
||||||
|
|
||||||
|
# AM_CONDITIONAL(Motif22Compatibility, test x$enable_motif22_compatibility = xyes)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/Makefile.am b/lib/Xm/Makefile.am
|
||||||
|
index a95fa2db..07b733f5 100644
|
||||||
|
--- a/lib/Xm/Makefile.am
|
||||||
|
+++ b/lib/Xm/Makefile.am
|
||||||
|
@@ -71,7 +71,7 @@ else
|
||||||
|
PRINTS_SRC =
|
||||||
|
endif
|
||||||
|
|
||||||
|
-libXm_la_LIBADD = ${X_LIBS} ${X_XMU} -lXt -lXext ${LIB_XP} -lX11 ${X_EXTRA_LIBS}
|
||||||
|
+libXm_la_LIBADD = ${X_LIBS} ${X_XMU} -lXt -lXext ${LIB_XP} ${LIB_XINERAMA} -lX11 ${X_EXTRA_LIBS}
|
||||||
|
|
||||||
|
noinst_HEADERS = BaseClassI.h \
|
||||||
|
BitmapsI.h \
|
||||||
|
--
|
||||||
|
2.47.1
|
||||||
|
|
@ -0,0 +1,119 @@
|
|||||||
|
From 10168aa7f16afb32e71d9e0a22fa8f90fb301bf4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Thu, 21 Nov 2024 11:52:22 +0100
|
||||||
|
Subject: [PATCH 3/7] Xm/MenuShell: Use Xinerama to place menus
|
||||||
|
|
||||||
|
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
---
|
||||||
|
lib/Xm/MenuShell.c | 34 +++++++++++++++++-----------------
|
||||||
|
1 file changed, 17 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/MenuShell.c b/lib/Xm/MenuShell.c
|
||||||
|
index 483cc95a..1dea4a54 100644
|
||||||
|
--- a/lib/Xm/MenuShell.c
|
||||||
|
+++ b/lib/Xm/MenuShell.c
|
||||||
|
@@ -41,6 +41,7 @@ static char rcsid[] = "$TOG: MenuShell.c /main/24 1999/07/08 16:49:59 vipin $"
|
||||||
|
#include <Xm/LabelP.h>
|
||||||
|
#include <Xm/LayoutT.h>
|
||||||
|
#include <Xm/MenuT.h>
|
||||||
|
+#include <Xm/ScreenP.h>
|
||||||
|
#include <Xm/SpecRenderT.h>
|
||||||
|
#include <Xm/TraitP.h>
|
||||||
|
#include <Xm/TransltnsP.h>
|
||||||
|
@@ -913,7 +914,7 @@ ForceMenuPaneOnScreen(
|
||||||
|
register Position *y )
|
||||||
|
{
|
||||||
|
Position rightEdgeOfMenu, bottomEdgeOfMenu;
|
||||||
|
- Dimension dispWidth, dispHeight;
|
||||||
|
+ Position dispX, dispY, dispMaxX, dispMaxY;
|
||||||
|
Widget pulldown_button = RC_CascadeBtn(rowcol);
|
||||||
|
Dimension RowColBorderWidth = rowcol->core.border_width << 1;
|
||||||
|
Dimension CascadeBorderWidth = 0;
|
||||||
|
@@ -925,8 +926,7 @@ ForceMenuPaneOnScreen(
|
||||||
|
|
||||||
|
rightEdgeOfMenu = *x + RowColBorderWidth + rowcol->core.width;
|
||||||
|
bottomEdgeOfMenu = *y + RowColBorderWidth + rowcol->core.height;
|
||||||
|
- dispWidth = WidthOfScreen (XtScreen(rowcol));
|
||||||
|
- dispHeight = HeightOfScreen (XtScreen(rowcol));
|
||||||
|
+ _XmScreenGetBoundariesAtpoint(XtScreen(rowcol), *x, *y, &dispX, &dispY, &dispMaxX, &dispMaxY);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For OPTION menus, if the submenu is [partially] offscreen, offset it
|
||||||
|
@@ -937,9 +937,9 @@ ForceMenuPaneOnScreen(
|
||||||
|
(RC_Type(XtParent(pulldown_button)) == XmMENU_OPTION))
|
||||||
|
{
|
||||||
|
Position old_x = *x;
|
||||||
|
- if (bottomEdgeOfMenu >= (Position)dispHeight)
|
||||||
|
+ if (bottomEdgeOfMenu >= dispMaxY)
|
||||||
|
{
|
||||||
|
- *y = dispHeight - rowcol->core.height - RowColBorderWidth - 1;
|
||||||
|
+ *y = dispMaxY - rowcol->core.height - RowColBorderWidth - 1;
|
||||||
|
if (LayoutIsRtoLM(rowcol))
|
||||||
|
*x = old_x - rowcol->core.width - (rowcol->core.border_width <<1);
|
||||||
|
else
|
||||||
|
@@ -948,9 +948,9 @@ ForceMenuPaneOnScreen(
|
||||||
|
bottomEdgeOfMenu = *y + RowColBorderWidth + rowcol->core.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (*y < 0)
|
||||||
|
+ if (*y < dispY)
|
||||||
|
{
|
||||||
|
- *y = 0;
|
||||||
|
+ *y = dispY;
|
||||||
|
|
||||||
|
/* Consider CascadeBtn as well as RowCol width to allow multi
|
||||||
|
* column RowColumn
|
||||||
|
@@ -963,13 +963,13 @@ ForceMenuPaneOnScreen(
|
||||||
|
bottomEdgeOfMenu = *y + RowColBorderWidth + rowcol->core.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (rightEdgeOfMenu >= (Position)dispWidth)
|
||||||
|
+ if (rightEdgeOfMenu >= dispMaxX)
|
||||||
|
{
|
||||||
|
*x = old_x - rowcol->core.width + RowColBorderWidth;
|
||||||
|
rightEdgeOfMenu = *x + RowColBorderWidth + rowcol->core.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (*x < 0)
|
||||||
|
+ if (*x < dispX)
|
||||||
|
{
|
||||||
|
if (LayoutIsRtoLM(rowcol))
|
||||||
|
*x = old_x + pulldown_button->core.width + CascadeBorderWidth;
|
||||||
|
@@ -982,10 +982,10 @@ ForceMenuPaneOnScreen(
|
||||||
|
/*
|
||||||
|
* If the submenu is offscreen force it completely on.
|
||||||
|
*/
|
||||||
|
- if (rightEdgeOfMenu >= (Position)dispWidth)
|
||||||
|
- *x -= (rightEdgeOfMenu - dispWidth + 1);
|
||||||
|
+ if (rightEdgeOfMenu >= dispMaxX)
|
||||||
|
+ *x -= (rightEdgeOfMenu - dispMaxX + 1);
|
||||||
|
|
||||||
|
- if (bottomEdgeOfMenu >= (Position)dispHeight)
|
||||||
|
+ if (bottomEdgeOfMenu >= dispMaxY)
|
||||||
|
{
|
||||||
|
if (pulldown_button && XtParent(pulldown_button) &&
|
||||||
|
(RC_Type(XtParent(pulldown_button)) == XmMENU_BAR))
|
||||||
|
@@ -1005,15 +1005,15 @@ ForceMenuPaneOnScreen(
|
||||||
|
*y = y_temp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
- *y -= (bottomEdgeOfMenu - dispHeight + 1);
|
||||||
|
+ *y -= (bottomEdgeOfMenu - dispMaxY + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure that the top left corner os on screen! */
|
||||||
|
- if (*x < 0)
|
||||||
|
- *x = 0;
|
||||||
|
+ if (*x < dispX)
|
||||||
|
+ *x = dispX;
|
||||||
|
|
||||||
|
- if (*y < 0)
|
||||||
|
- *y = 0;
|
||||||
|
+ if (*y < dispY)
|
||||||
|
+ *y = dispY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
2.47.1
|
||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
From e21e7ffaa62df64be305326d24eca09c80129403 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Thu, 21 Nov 2024 14:11:11 +0100
|
||||||
|
Subject: [PATCH 4/7] Xm/DropDown: Use Xinerama for placement
|
||||||
|
|
||||||
|
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
---
|
||||||
|
lib/Xm/DropDown.c | 18 +++++++++---------
|
||||||
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/DropDown.c b/lib/Xm/DropDown.c
|
||||||
|
index a25d1092..665e0e26 100644
|
||||||
|
--- a/lib/Xm/DropDown.c
|
||||||
|
+++ b/lib/Xm/DropDown.c
|
||||||
|
@@ -13,7 +13,7 @@
|
||||||
|
#include "XmI.h"
|
||||||
|
#include <Xm/VaSimpleP.h>
|
||||||
|
#include <Xm/DrawP.h>
|
||||||
|
-
|
||||||
|
+#include <Xm/ScreenP.h>
|
||||||
|
#include <Xm/DropDownP.h>
|
||||||
|
|
||||||
|
#include <X11/Shell.h>
|
||||||
|
@@ -2169,8 +2169,9 @@ PopupList(Widget w)
|
||||||
|
XmDropDownWidget cbw = (XmDropDownWidget) w;
|
||||||
|
Widget shell = XmDropDown_popup_shell(cbw);
|
||||||
|
Position x, y, temp;
|
||||||
|
+ Position dispX, dispY, dispMaxX, dispMaxY;
|
||||||
|
Dimension width;
|
||||||
|
- int ret, scr_width, scr_height;
|
||||||
|
+ int ret;
|
||||||
|
Arg args[10];
|
||||||
|
Cardinal num_args;
|
||||||
|
|
||||||
|
@@ -2209,21 +2210,20 @@ PopupList(Widget w)
|
||||||
|
*
|
||||||
|
* Lets start by getting the width and height of the screen.
|
||||||
|
*/
|
||||||
|
- scr_width = WidthOfScreen(XtScreen(shell));
|
||||||
|
- scr_height = HeightOfScreen(XtScreen(shell));
|
||||||
|
+ _XmScreenGetBoundariesAtpoint(XtScreen(shell), x, y, &dispX, &dispY, &dispMaxX, &dispMaxY);
|
||||||
|
|
||||||
|
- if( (int)(y + XtHeight(shell)) > scr_height )
|
||||||
|
+ if( (int)(y + XtHeight(shell)) > dispMaxY )
|
||||||
|
{
|
||||||
|
Position tmp;
|
||||||
|
XtTranslateCoords(w, 0, 0, &tmp, &y);
|
||||||
|
y -= ((int)XtHeight(shell));
|
||||||
|
}
|
||||||
|
- if( y < 0 ) y = 0;
|
||||||
|
- if( (int)(x + width) > scr_width )
|
||||||
|
+ if( y < dispY ) y = dispY;
|
||||||
|
+ if( (int)(x + width) > dispMaxX )
|
||||||
|
{
|
||||||
|
- x = scr_width - ((int)width);
|
||||||
|
+ x = dispMaxX - ((int)width);
|
||||||
|
}
|
||||||
|
- if( x < 0 ) x = 0;
|
||||||
|
+ if( x < dispX ) x = dispX;
|
||||||
|
|
||||||
|
XtSetArg(args[num_args], XmNx, x); num_args++;
|
||||||
|
XtSetArg(args[num_args], XmNy, y); num_args++;
|
||||||
|
--
|
||||||
|
2.47.1
|
||||||
|
|
@ -0,0 +1,70 @@
|
|||||||
|
From d97abbe6cf64a8bb0e331725c36caf5e0ac37b0f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Thu, 21 Nov 2024 14:17:21 +0100
|
||||||
|
Subject: [PATCH 5/7] Xm/RCMenu: Use Xinerama for placement
|
||||||
|
|
||||||
|
Please note that when building with Xinerama enabled, the placement
|
||||||
|
logic changes, as the original location of the CascadeButton is not
|
||||||
|
taken into account when relocating the RCMenu widget.
|
||||||
|
|
||||||
|
Reason for that is because I reckon the current code is not correct, as
|
||||||
|
it moves the RCMenu way off the screen, yet it doesn't show without
|
||||||
|
Xinerama because there is another check later to make sure the widget
|
||||||
|
remains on the overall screen, hence hiding the problem.
|
||||||
|
|
||||||
|
With Xinerama, that breaks in-between monitors and the RCMenu ends up
|
||||||
|
completely misplaced, which is why I think the code was wrong, yet the
|
||||||
|
logic is preserved when building without XINERAMA support to preserve
|
||||||
|
the current behavior if needed.
|
||||||
|
|
||||||
|
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
---
|
||||||
|
lib/Xm/RCMenu.c | 18 ++++++++++++++----
|
||||||
|
1 file changed, 14 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/RCMenu.c b/lib/Xm/RCMenu.c
|
||||||
|
index 2c698d4f..abd7a70e 100644
|
||||||
|
--- a/lib/Xm/RCMenu.c
|
||||||
|
+++ b/lib/Xm/RCMenu.c
|
||||||
|
@@ -537,6 +537,7 @@ LocatePulldown(
|
||||||
|
XEvent *event )
|
||||||
|
{
|
||||||
|
Position x, y, x1, y1;
|
||||||
|
+ Position dispX, dispMaxX;
|
||||||
|
|
||||||
|
if (root == NULL)
|
||||||
|
return;
|
||||||
|
@@ -617,17 +618,26 @@ LocatePulldown(
|
||||||
|
* window co-ords.
|
||||||
|
*/
|
||||||
|
XtTranslateCoords( (Widget) p, x, y, &x1, &y1);
|
||||||
|
+ _XmScreenGetBoundariesAtpoint(XtScreen(m), x1, y1, &dispX, NULL, &dispMaxX, NULL);
|
||||||
|
|
||||||
|
/* Oh no! we're going off screen. Let's try and do
|
||||||
|
something reasonable. We're only doing the cascade
|
||||||
|
off a menu case for now. (CR 6421) */
|
||||||
|
- if ((x1 + XtWidth(m)) > WidthOfScreen(XtScreen(m))) {
|
||||||
|
+ if ((x1 + XtWidth(m)) > dispMaxX) {
|
||||||
|
if (!IsOption(root) && (XmIsCascadeButton(p) || XmIsCascadeButtonGadget(p))) {
|
||||||
|
- x1 -= XtWidth(m) + x - XtX(p);
|
||||||
|
+ x1 -= XtWidth(m) + x;
|
||||||
|
+#ifndef HAVE_LIBXINERAMA
|
||||||
|
+ /* XXX: I don't think it's correct, but that's what the original code was doing… */
|
||||||
|
+ x1 -= XtX(p);
|
||||||
|
+#endif /* not HAVE_LIBXINERAMA */
|
||||||
|
}
|
||||||
|
- } else if (x1 < 0) { /* R to L case */
|
||||||
|
+ } else if (x1 < dispX) { /* R to L case */
|
||||||
|
if (!IsOption(root) && (XmIsCascadeButton(p) || XmIsCascadeButtonGadget(p))) {
|
||||||
|
- x1 += XtWidth(m) + x - XtX(p);
|
||||||
|
+ x1 += XtWidth(m) + x;
|
||||||
|
+#ifndef HAVE_LIBXINERAMA
|
||||||
|
+ /* XXX: I don't think it's correct, but that's what the original code was doing… */
|
||||||
|
+ x1 -= XtX(p);
|
||||||
|
+#endif /* not HAVE_LIBXINERAMA */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.47.1
|
||||||
|
|
@ -0,0 +1,53 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,51 @@
|
|||||||
|
From 8a026c2d1e94ab2a33a1bec55d703b229ce9daf7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Thu, 21 Nov 2024 14:30:23 +0100
|
||||||
|
Subject: [PATCH 7/7] Xm/ComboBox: Use Xinerama for placement
|
||||||
|
|
||||||
|
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
---
|
||||||
|
lib/Xm/ComboBox.c | 11 +++++++----
|
||||||
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Xm/ComboBox.c b/lib/Xm/ComboBox.c
|
||||||
|
index 1472e458..0f49de50 100644
|
||||||
|
--- a/lib/Xm/ComboBox.c
|
||||||
|
+++ b/lib/Xm/ComboBox.c
|
||||||
|
@@ -43,6 +43,7 @@
|
||||||
|
#include <Xm/DisplayP.h>
|
||||||
|
#include <Xm/DrawP.h>
|
||||||
|
#include <Xm/GrabShellP.h>
|
||||||
|
+#include <Xm/ScreenP.h>
|
||||||
|
#include <Xm/List.h>
|
||||||
|
#include <Xm/TextF.h>
|
||||||
|
#include <Xm/TraitP.h>
|
||||||
|
@@ -1791,6 +1792,7 @@ CBDropDownList(Widget widget,
|
||||||
|
Cardinal n;
|
||||||
|
int tmp;
|
||||||
|
Position root_x, root_y, shell_x, shell_y;
|
||||||
|
+ Position dispX, dispY, dispMaxX, dispMaxY;
|
||||||
|
Dimension shell_width;
|
||||||
|
|
||||||
|
XtTranslateCoords((Widget)cb, XtX(cb), XtY(cb), &root_x, &root_y);
|
||||||
|
@@ -1801,12 +1803,13 @@ CBDropDownList(Widget widget,
|
||||||
|
XtY(cb);
|
||||||
|
|
||||||
|
/* Try to position the shell on the screen. */
|
||||||
|
- tmp = WidthOfScreen(XtScreen(cb)) - XtWidth(CB_ListShell(cb));
|
||||||
|
+ _XmScreenGetBoundariesAtpoint(XtScreen(cb), shell_x, shell_y, &dispX, &dispY, &dispMaxX, &dispMaxY);
|
||||||
|
+ tmp = dispMaxX - XtWidth(CB_ListShell(cb));
|
||||||
|
tmp = MIN(tmp, shell_x);
|
||||||
|
- shell_x = MAX(0, tmp);
|
||||||
|
- tmp = HeightOfScreen(XtScreen(cb)) - XtHeight(CB_ListShell(cb));
|
||||||
|
+ shell_x = MAX(dispX, tmp);
|
||||||
|
+ tmp = dispMaxY - XtHeight(CB_ListShell(cb));
|
||||||
|
tmp = MIN(tmp, shell_y);
|
||||||
|
- shell_y = MAX(0, tmp);
|
||||||
|
+ shell_y = MAX(dispY, tmp);
|
||||||
|
|
||||||
|
/* CR 8446: The shell width may have changed unexpectedly. */
|
||||||
|
shell_width = XtWidth(cb) - 2 * CB_HighlightThickness(cb);
|
||||||
|
--
|
||||||
|
2.47.1
|
||||||
|
|
Loading…
Reference in new issue