From 2804a851d15554f1c086a703b2bc7b4db2e3cccf Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 2 Jun 2025 16:30:57 +0200 Subject: [PATCH] Keep drop-down menus on the same monitor Resolves: RHEL-91951 --- ...uild-Check-for-Xinerama-availability.patch | 4 +- ...isplay-Add-optional-Xinerama-support.patch | 4 +- ...enuShell-Use-Xinerama-to-place-menus.patch | 43 +++++++++++++------ ...-DropDown-Use-Xinerama-for-placement.patch | 4 +- ...Xm-RCMenu-Use-Xinerama-for-placement.patch | 4 +- ...m-Tooltip-Use-Xinerama-for-placement.patch | 4 +- ...-ComboBox-Use-Xinerama-for-placement.patch | 4 +- motif.spec | 8 +++- 8 files changed, 48 insertions(+), 27 deletions(-) diff --git a/0001-build-Check-for-Xinerama-availability.patch b/0001-build-Check-for-Xinerama-availability.patch index 3931927..724c6c3 100644 --- a/0001-build-Check-for-Xinerama-availability.patch +++ b/0001-build-Check-for-Xinerama-availability.patch @@ -1,4 +1,4 @@ -From 49791ea9aa84c64af114f564d4c46228263d1439 Mon Sep 17 00:00:00 2001 +From 3a164564cf8241ee4544ff012659e8eb510b195b Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 19 Nov 2024 18:40:33 +0100 Subject: [PATCH 1/7] build: Check for Xinerama availability @@ -57,5 +57,5 @@ index a95fa2db..07b733f5 100644 noinst_HEADERS = BaseClassI.h \ BitmapsI.h \ -- -2.47.1 +2.49.0 diff --git a/0002-Xm-Display-Add-optional-Xinerama-support.patch b/0002-Xm-Display-Add-optional-Xinerama-support.patch index bde8695..3bce3bf 100644 --- a/0002-Xm-Display-Add-optional-Xinerama-support.patch +++ b/0002-Xm-Display-Add-optional-Xinerama-support.patch @@ -1,4 +1,4 @@ -From 011e62e69fb87e78a128487a043cc13b042bb8b5 Mon Sep 17 00:00:00 2001 +From f8aa9901f3cfa5fb49b809fdb223798623bede63 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 20 Nov 2024 10:26:28 +0100 Subject: [PATCH 2/7] Xm/Display: Add optional Xinerama support @@ -415,5 +415,5 @@ index 8c0c4f9a..5887e7ad 100644 #file XmStrDefsI.h #table _XmStringsI -- -2.47.1 +2.49.0 diff --git a/0003-Xm-MenuShell-Use-Xinerama-to-place-menus.patch b/0003-Xm-MenuShell-Use-Xinerama-to-place-menus.patch index df57514..7f86717 100644 --- a/0003-Xm-MenuShell-Use-Xinerama-to-place-menus.patch +++ b/0003-Xm-MenuShell-Use-Xinerama-to-place-menus.patch @@ -1,15 +1,19 @@ -From 10168aa7f16afb32e71d9e0a22fa8f90fb301bf4 Mon Sep 17 00:00:00 2001 +From 5fbc1dff0e2e248d61e43c362606c3f5e5255f7d Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 21 Nov 2024 11:52:22 +0100 Subject: [PATCH 3/7] Xm/MenuShell: Use Xinerama to place menus +v2: If we have a pulldown button, use the location of that button to + keep the menu on the same monitor as that button so that the menu + doesn't eventually end up on another monitor entirely. + Signed-off-by: Olivier Fourdan --- - lib/Xm/MenuShell.c | 34 +++++++++++++++++----------------- - 1 file changed, 17 insertions(+), 17 deletions(-) + lib/Xm/MenuShell.c | 47 +++++++++++++++++++++++++++++----------------- + 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/lib/Xm/MenuShell.c b/lib/Xm/MenuShell.c -index 483cc95a..1dea4a54 100644 +index 483cc95a..c78bfb08 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 $" @@ -20,26 +24,39 @@ index 483cc95a..1dea4a54 100644 #include #include #include -@@ -913,7 +914,7 @@ ForceMenuPaneOnScreen( +@@ -913,7 +914,9 @@ ForceMenuPaneOnScreen( register Position *y ) { Position rightEdgeOfMenu, bottomEdgeOfMenu; - Dimension dispWidth, dispHeight; + Position dispX, dispY, dispMaxX, dispMaxY; ++ Position x1 = *x; ++ Position y1 = *y; Widget pulldown_button = RC_CascadeBtn(rowcol); Dimension RowColBorderWidth = rowcol->core.border_width << 1; Dimension CascadeBorderWidth = 0; -@@ -925,8 +926,7 @@ ForceMenuPaneOnScreen( +@@ -925,8 +928,18 @@ 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); ++#ifdef HAVE_LIBXINERAMA ++ if (pulldown_button) ++ { ++ /* If we have a pulldown button, use the location of that button to ++ * keep the menu on the same monitor as that button so that the menu ++ * doesn't eventually end up on another monitor entirely. ++ */ ++ XtTranslateCoords((Widget) pulldown_button, ++ XtX(pulldown_button), XtY(pulldown_button), &x1, &y1); ++ } ++#endif ++ _XmScreenGetBoundariesAtpoint(XtScreen(rowcol), x1, y1, &dispX, &dispY, &dispMaxX, &dispMaxY); /* * For OPTION menus, if the submenu is [partially] offscreen, offset it -@@ -937,9 +937,9 @@ ForceMenuPaneOnScreen( +@@ -937,9 +950,9 @@ ForceMenuPaneOnScreen( (RC_Type(XtParent(pulldown_button)) == XmMENU_OPTION)) { Position old_x = *x; @@ -51,7 +68,7 @@ index 483cc95a..1dea4a54 100644 if (LayoutIsRtoLM(rowcol)) *x = old_x - rowcol->core.width - (rowcol->core.border_width <<1); else -@@ -948,9 +948,9 @@ ForceMenuPaneOnScreen( +@@ -948,9 +961,9 @@ ForceMenuPaneOnScreen( bottomEdgeOfMenu = *y + RowColBorderWidth + rowcol->core.height; } @@ -63,7 +80,7 @@ index 483cc95a..1dea4a54 100644 /* Consider CascadeBtn as well as RowCol width to allow multi * column RowColumn -@@ -963,13 +963,13 @@ ForceMenuPaneOnScreen( +@@ -963,13 +976,13 @@ ForceMenuPaneOnScreen( bottomEdgeOfMenu = *y + RowColBorderWidth + rowcol->core.height; } @@ -79,7 +96,7 @@ index 483cc95a..1dea4a54 100644 { if (LayoutIsRtoLM(rowcol)) *x = old_x + pulldown_button->core.width + CascadeBorderWidth; -@@ -982,10 +982,10 @@ ForceMenuPaneOnScreen( +@@ -982,10 +995,10 @@ ForceMenuPaneOnScreen( /* * If the submenu is offscreen force it completely on. */ @@ -93,7 +110,7 @@ index 483cc95a..1dea4a54 100644 { if (pulldown_button && XtParent(pulldown_button) && (RC_Type(XtParent(pulldown_button)) == XmMENU_BAR)) -@@ -1005,15 +1005,15 @@ ForceMenuPaneOnScreen( +@@ -1005,15 +1018,15 @@ ForceMenuPaneOnScreen( *y = y_temp; } else @@ -115,5 +132,5 @@ index 483cc95a..1dea4a54 100644 /* -- -2.47.1 +2.49.0 diff --git a/0004-Xm-DropDown-Use-Xinerama-for-placement.patch b/0004-Xm-DropDown-Use-Xinerama-for-placement.patch index 6d4fc22..b65e7fc 100644 --- a/0004-Xm-DropDown-Use-Xinerama-for-placement.patch +++ b/0004-Xm-DropDown-Use-Xinerama-for-placement.patch @@ -1,4 +1,4 @@ -From e21e7ffaa62df64be305326d24eca09c80129403 Mon Sep 17 00:00:00 2001 +From 0e834a8d37dfabd8fa4463f83c132478e50f8337 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 21 Nov 2024 14:11:11 +0100 Subject: [PATCH 4/7] Xm/DropDown: Use Xinerama for placement @@ -61,5 +61,5 @@ index a25d1092..665e0e26 100644 XtSetArg(args[num_args], XmNx, x); num_args++; XtSetArg(args[num_args], XmNy, y); num_args++; -- -2.47.1 +2.49.0 diff --git a/0005-Xm-RCMenu-Use-Xinerama-for-placement.patch b/0005-Xm-RCMenu-Use-Xinerama-for-placement.patch index 04b4788..a3f26fa 100644 --- a/0005-Xm-RCMenu-Use-Xinerama-for-placement.patch +++ b/0005-Xm-RCMenu-Use-Xinerama-for-placement.patch @@ -1,4 +1,4 @@ -From d97abbe6cf64a8bb0e331725c36caf5e0ac37b0f Mon Sep 17 00:00:00 2001 +From 3ef8c038b06f136a6abe7cfa23afec4d514af4f0 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 21 Nov 2024 14:17:21 +0100 Subject: [PATCH 5/7] Xm/RCMenu: Use Xinerama for placement @@ -66,5 +66,5 @@ index 2c698d4f..abd7a70e 100644 } -- -2.47.1 +2.49.0 diff --git a/0006-Xm-Tooltip-Use-Xinerama-for-placement.patch b/0006-Xm-Tooltip-Use-Xinerama-for-placement.patch index 286ee5d..1387787 100644 --- a/0006-Xm-Tooltip-Use-Xinerama-for-placement.patch +++ b/0006-Xm-Tooltip-Use-Xinerama-for-placement.patch @@ -1,4 +1,4 @@ -From af453aebd8e53a32369c792cf8d0e641b2b3a834 Mon Sep 17 00:00:00 2001 +From f2bc91c789ed33fc1e0a31d167a6a7bc0383429e Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 21 Nov 2024 14:24:30 +0100 Subject: [PATCH 6/7] Xm/Tooltip: Use Xinerama for placement @@ -49,5 +49,5 @@ index dc65071d..fdd32221 100644 destY = ry + (XmIsGadget (w) ? XtY (w) : 0) - y - geo.height; } -- -2.47.1 +2.49.0 diff --git a/0007-Xm-ComboBox-Use-Xinerama-for-placement.patch b/0007-Xm-ComboBox-Use-Xinerama-for-placement.patch index d6c02da..772f930 100644 --- a/0007-Xm-ComboBox-Use-Xinerama-for-placement.patch +++ b/0007-Xm-ComboBox-Use-Xinerama-for-placement.patch @@ -1,4 +1,4 @@ -From 8a026c2d1e94ab2a33a1bec55d703b229ce9daf7 Mon Sep 17 00:00:00 2001 +From eb193dce2b7f8ce80004d14ccf64c53552ae103c Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 21 Nov 2024 14:30:23 +0100 Subject: [PATCH 7/7] Xm/ComboBox: Use Xinerama for placement @@ -47,5 +47,5 @@ index 1472e458..0f49de50 100644 /* CR 8446: The shell width may have changed unexpectedly. */ shell_width = XtWidth(cb) - 2 * CB_HighlightThickness(cb); -- -2.47.1 +2.49.0 diff --git a/motif.spec b/motif.spec index 453f375..d34860e 100644 --- a/motif.spec +++ b/motif.spec @@ -1,7 +1,7 @@ Summary: Run-time libraries and programs Name: motif Version: 2.3.4 -Release: 21%{?dist} +Release: 22%{?dist} License: LGPLv2+ Group: System Environment/Libraries Source: http://downloads.sf.net/motif/motif-%{version}-src.tgz @@ -55,7 +55,6 @@ Patch62: 0005-Xm-RCMenu-Use-Xinerama-for-placement.patch Patch63: 0006-Xm-Tooltip-Use-Xinerama-for-placement.patch Patch64: 0007-Xm-ComboBox-Use-Xinerama-for-placement.patch - Conflicts: lesstif <= 0.92.32-6 %description @@ -170,6 +169,11 @@ rm -rf %{buildroot} %{_libdir}/lib*.a %changelog +* Mon Jun 2 2025 Olivier Fourdan - 2.3.4-22 +- Keep drop-down menus on the same monitor as the pull-down button with + Xinerama + Resolves: RHEL-91951 + * Mon Nov 25 2024 Olivier Fourdan - 2.3.4-21 - Add Xinerama support (RHEL-67987)