NetBSD Problem Report #58467
From www@netbsd.org Thu Jul 25 12:24:57 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 3BF471A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 25 Jul 2024 12:24:57 +0000 (UTC)
Message-Id: <20240725122456.1B7341A923B@mollari.NetBSD.org>
Date: Thu, 25 Jul 2024 12:24:56 +0000 (UTC)
From: s9281723@gmail.com
Reply-To: s9281723@gmail.com
To: gnats-bugs@NetBSD.org
Subject: ctwm does not move the application window to the specified workspace
X-Send-Pr-Version: www-1.0
>Number: 58467
>Category: bin
>Synopsis: ctwm does not move the application window to the specified workspace
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 25 12:25:00 +0000 2024
>Last-Modified: Mon Jan 13 00:20:01 +0000 2025
>Originator: Szymon
>Release: ctwm 4.0.3
>Organization:
-
>Environment:
NetBSD 10.0_STABLE NetBSD 10.0_STABLE (GENERIC) #0: Sat Jul 20 16:11:27 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
f.occupy does not work
>How-To-Repeat:
1.Run option with f.occupy
2.Popup window does not display correctly, but you can select workspaces
3.When you click ok to confirm your selection, the application window is not transferred
>Fix:
Install NetBSD 9.4
>Audit-Trail:
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Fri, 26 Jul 2024 08:07:30 +0000 (UTC)
Actually, it does move the window if only 1 workspace is selected--ie. all
other workspaces should be de-selected. This is a bit difficult to see
because of the bug you reported.
> 2.Popup window does not display correctly, but you can select workspaces
>
Can you try this patch below (and please upstream it because it's a
quick hack and may not be the correct way to do it.):
--- START ---
diff -urN a/xsrc/external/mit/ctwm/dist/occupation.c b/xsrc/external/mit/ctwm/dist/occupation.c
--- a/xsrc/external/mit/ctwm/dist/occupation.c 2023-07-05 07:36:07.000000000 +0000
+++ b/xsrc/external/mit/ctwm/dist/occupation.c 2024-07-26 07:28:17.638397232 +0000
@@ -1131,6 +1131,8 @@
/* Mark it shown, and stash what window we're showing it for */
occupyWindow->twm_win->mapped = true;
occupyWin = twm_win;
+
+ PaintOccupyWindow();
}
--- END ---
If you want to switch the workspace after moving the window, something
like this in ~/.ctwmrc works:
--- START ---
--- system.ctwmrc 2024-05-31 13:11:41.000000000 +0000
+++ .ctwmrc 2024-07-26 06:59:35.771645403 +0000
@@ -322,6 +322,15 @@
" Quit" f.quit
}
+menu "workspaces"
+{
+ "1" f.function "move-to-wsp-1"
+ "2" f.function "move-to-wsp-2"
+ "3" f.function "move-to-wsp-3"
+ "4" f.function "move-to-wsp-4"
+ "5" f.function "move-to-wsp-5"
+}
+
menu "titleops"
{
"Window" f.title
@@ -330,7 +339,7 @@
" Resize" f.resize
" Move" f.move
"" f.separator
- " Occupy ..." f.occupy
+ " Move-To..." f.menu "workspaces"
" Occupy All" f.occupyall
"" f.separator
" Raise" f.raise
@@ -389,6 +398,12 @@
Function "raise-move" { f.raise f.deltastop f.forcemove }
Function "raise-and-resize" { f.raise f.deltastop f.resize }
+Function "move-to-wsp-1" { f.addtoworkspace "1" f.vanish f.gotoworkspace "1" }
+Function "move-to-wsp-2" { f.addtoworkspace "2" f.vanish f.gotoworkspace "2" }
+Function "move-to-wsp-3" { f.addtoworkspace "3" f.vanish f.gotoworkspace "3" }
+Function "move-to-wsp-4" { f.addtoworkspace "4" f.vanish f.gotoworkspace "4" }
+Function "move-to-wsp-5" { f.addtoworkspace "5" f.vanish f.gotoworkspace "5" }
+
# These are basically essential for basic functionality.
Button1 = : title : f.function "raise-move"
--- END ---
-RVP
PS. Only tested all this on ctwm-4.1.0 in -HEAD.
From: szymon <s9281723@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Fri, 26 Jul 2024 22:48:03 +0200
Ctwm 4.0.3 is installed with NetBSD 10.0 operating system.
Unfortunately I have no possibility to test your patch.
Is this a system or package patch?
Regarding the second part of the answer, I don't quite understand. I
didn't ask about switching workspaces after moving the window.
Szymon
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Sat, 27 Jul 2024 07:41:07 +0000 (UTC)
On Fri, 26 Jul 2024, szymon wrote:
> Ctwm 4.0.3 is installed with NetBSD 10.0 operating system.
> Unfortunately I have no possibility to test your patch.
>
No prob. I think I've got the proximate cause of this issue. Try
this modified ~/.ctwmrc:
```
--- /etc/X11/ctwm/system.ctwmrc 2024-05-31 13:11:41.000000000 +0000
+++ .ctwmrc 2024-07-27 07:10:46.685887738 +0000
@@ -183,8 +183,8 @@
NoShowOccupyAll
ReverseCurrentWorkspace
StartInMapState
-WMgrHorizButtonIndent 0
-WMgrVertButtonIndent 0
+WMgrHorizButtonIndent 1
+WMgrVertButtonIndent 1
WorkSpaces
{
```
Ie. set those variables to 1 instead of 0. A value of 0 doesn't
seem to be handled correctly by the code.
You can also upstream this patch for review--it does the same thing:
```
diff -urN a/xsrc/external/mit/ctwm/dist/parse_be.c b/xsrc/external/mit/ctwm/dist/parse_be.c
--- a/xsrc/external/mit/ctwm/dist/parse_be.c 2023-07-05 07:36:06.000000000 +0000
+++ b/xsrc/external/mit/ctwm/dist/parse_be.c 2024-07-27 07:19:21.895964575 +0000
@@ -1280,8 +1280,8 @@
if(Scr->FirstTime) {
Scr->WMgrVertButtonIndent = num;
}
- if(Scr->WMgrVertButtonIndent < 0) {
- Scr->WMgrVertButtonIndent = 0;
+ if(Scr->WMgrVertButtonIndent < 1) {
+ Scr->WMgrVertButtonIndent = 1;
}
Scr->workSpaceMgr.vspace = Scr->WMgrVertButtonIndent;
Scr->workSpaceMgr.occupyWindow->vspace = Scr->WMgrVertButtonIndent;
@@ -1291,8 +1291,8 @@
if(Scr->FirstTime) {
Scr->WMgrHorizButtonIndent = num;
}
- if(Scr->WMgrHorizButtonIndent < 0) {
- Scr->WMgrHorizButtonIndent = 0;
+ if(Scr->WMgrHorizButtonIndent < 1) {
+ Scr->WMgrHorizButtonIndent = 1;
}
Scr->workSpaceMgr.hspace = Scr->WMgrHorizButtonIndent;
Scr->workSpaceMgr.occupyWindow->hspace = Scr->WMgrHorizButtonIndent;
```
Should be easy to apply by hand to both pkgsrc and the system ctwm-4.1.0.
> Regarding the second part of the answer, I don't quite understand. I
> didn't ask about switching workspaces after moving the window.
>
I know--it was a bonus.
-RVP
From: szymon <s9281723@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Sat, 27 Jul 2024 21:54:14 +0200
I tested update below:
> -WMgrHorizButtonIndent 0
> -WMgrVertButtonIndent 0
> +WMgrHorizButtonIndent 1
> +WMgrVertButtonIndent 1
first in /etc/X11/ctwm/system.ctwmrc
and then in my ~/.ctwmrc
on my computer system NetBSD 10.0 with ctwm 4.0.3.
It works. Problem solved. Popup window now displays correctly when
clicking Occupy... and application window is now transferred to the
selected workspaces.
I can't apply the patch to *.c files because I'm not a system
developer and I don't maintain application packages.
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Sun, 28 Jul 2024 22:46:30 +0000 (UTC)
On Sat, 27 Jul 2024, szymon wrote:
> I can't apply the patch to *.c files because I'm not a system
> developer and I don't maintain application packages.
>
Since this is a ctwm bug, you should file a PR upstream.
-RVP
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Sun, 12 Jan 2025 00:20:55 +0000 (UTC)
On Sun, 28 Jul 2024, RVP wrote:
> On Sat, 27 Jul 2024, szymon wrote:
>
> > I can't apply the patch to *.c files because I'm not a system
> > developer and I don't maintain application packages.
> >
>
> Since this is a ctwm bug, you should file a PR upstream.
>
Until this is fixed by upstream, this patch suffices:
```
diff -urN a/src/external/mit/ctwm/etc/system.ctwmrc b/src/external/mit/ctwm/etc/system.ctwmrc
--- a/src/external/mit/ctwm/etc/system.ctwmrc 2024-04-24 19:35:30.784169448 +0000
+++ b/src/external/mit/ctwm/etc/system.ctwmrc 2025-01-12 00:14:06.559583119 +0000
@@ -183,8 +183,8 @@
NoShowOccupyAll
ReverseCurrentWorkspace
StartInMapState
-WMgrHorizButtonIndent 0
-WMgrVertButtonIndent 0
+WMgrHorizButtonIndent 1
+WMgrVertButtonIndent 1
WorkSpaces
{
```
Pull-up to 10.x and 9.x also, please.
-RVP
From: matthew green <mrg@eterna23.net>
To: gnats-bugs@netbsd.org, rvp@SDF.ORG
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, s9281723@gmail.com
Subject: re: bin/58467: ctwm does not move the application window to the specified workspace
Date: Sun, 12 Jan 2025 16:54:30 +1100
RVP,
can you explain what the change does? ie, why does having these
as 0 ever cause a problem? i'm just trying to understand what's
wrong and why this fixes it, thanks.
thanks.
.mrg.
From: RVP <rvp@SDF.ORG>
To: matthew green <mrg@eterna23.net>
Cc: gnats-bugs@netbsd.org
Subject: re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Sun, 12 Jan 2025 09:28:31 +0000 (UTC)
On Sun, 12 Jan 2025, matthew green wrote:
> can you explain what the change does? ie, why does having these
> as 0 ever cause a problem? i'm just trying to understand what's
> wrong and why this fixes it, thanks.
>
I had a quick look when this bug was originally filed. What's happening when
both values are 0 (not otherwise) is that in event_handlers.c:HandleExpose()
line 1667, the Event.xany.window is _never_ the main window itself, so and the
optimization fails to paint the Occupy window. The HandleExpose _is_ called
for all the other 5 WS buttons. and the 3 action buttons, however.
You can remove that check, and then it works with the 0 values, but, then the
Occupy window gets painted 9 times (with the std. config.: 1 + 5 + 3 times).
Didn't chase this any further.
HTH,
-RVP
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc: matthew green <mrg@eterna23.net>
Subject: re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Sun, 12 Jan 2025 09:41:47 +0000 (UTC)
On Sun, 12 Jan 2025, RVP via gnats wrote:
> You can remove that check, and then it works with the 0 values, but, then the
> Occupy window gets painted 9 times (with the std. config.: 1 + 5 + 3 times).
>
That should be 5 + 3 = 8 times, of course. (No Expose is generated for the
main window.)
-RVP
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc: matthew green <mrg@eterna23.net>
Subject: re: bin/58467: ctwm does not move the application window to the
specified workspace
Date: Mon, 13 Jan 2025 00:18:29 +0000 (UTC)
On Sun, 12 Jan 2025, RVP via gnats wrote:
> Didn't chase this any further.
>
I did this now. Last year, I had an intuition that this bug was caused by
the "button" windows _completely_ covering the `Occupy Win' window, thereby
causing X to not generate any Expose events for it. This is confirmed by
logging the various window dimensions:
the 3 Workspace "button" window dimensions:
ResizeOccupyWindow: x=0, y=0, bwidth=144, bheight=48
ResizeOccupyWindow: x=0, y=48, bwidth=144, bheight=48
ResizeOccupyWindow: x=0, y=96, bwidth=144, bheight=48
ResizeOccupyWindow: x=0, y=144, bwidth=144, bheight=48
ResizeOccupyWindow: x=0, y=192, bwidth=144, bheight=48
the OK/Cancel/All "button" windows:
(not that the "OK" button has x == -4)
ResizeOccupyWindow: x=-4, y=240, bwidth=54, bheight=48
ResizeOccupyWindow: x=46, y=240, bwidth=54, bheight=48
ResizeOccupyWindow: x=96, y=240, bwidth=54, bheight=48
and, the `Occupy Win' window itself:
ResizeOccupyWindow: neww=144, newh=288
After setting `WMgrVertButtonIndent 1' (which makes the `Occupy Win' window
come out right because it is now visible and so X generates Expose events for
it):
ResizeOccupyWindow: x=0, y=0, bwidth=144, bheight=47
ResizeOccupyWindow: x=0, y=48, bwidth=144, bheight=47
ResizeOccupyWindow: x=0, y=96, bwidth=144, bheight=47
ResizeOccupyWindow: x=0, y=144, bwidth=144, bheight=47
ResizeOccupyWindow: x=0, y=192, bwidth=144, bheight=47
ResizeOccupyWindow: x=-4, y=241, bwidth=54, bheight=47
ResizeOccupyWindow: x=46, y=241, bwidth=54, bheight=47
ResizeOccupyWindow: x=96, y=241, bwidth=54, bheight=47
ResizeOccupyWindow: neww=144, newh=289
So, I've come up with this updated patch for the source (just correcting for
the x == -negative co-ord.)
---START PATCH---
diff -urN a/xsrc/external/mit/ctwm/dist/occupation.c b/xsrc/external/mit/ctwm/dist/occupation.c
--- a/xsrc/external/mit/ctwm/dist/occupation.c 2023-07-05 07:36:07.000000000 +0000
+++ b/xsrc/external/mit/ctwm/dist/occupation.c 2025-01-13 00:02:15.899106141 +0000
@@ -927,6 +927,7 @@
* Now the action buttons
*/
hspace = (neww - 3 * owidth) / 4; // Padding between
+ hspace = (hspace < 0) ? 0 : hspace; // ensure never negative
x = hspace;
y = ((bheight + vspace) * lines) + ((3 * vspace) / 2);
XMoveResizeWindow(dpy, occwin->OK, x, y, owidth, oheight);
diff -urN a/xsrc/external/mit/ctwm/dist/parse_be.c b/xsrc/external/mit/ctwm/dist/parse_be.c
--- a/xsrc/external/mit/ctwm/dist/parse_be.c 2023-07-05 07:36:06.000000000 +0000
+++ b/xsrc/external/mit/ctwm/dist/parse_be.c 2025-01-13 00:00:09.952045885 +0000
@@ -1280,8 +1280,8 @@
if(Scr->FirstTime) {
Scr->WMgrVertButtonIndent = num;
}
- if(Scr->WMgrVertButtonIndent < 0) {
- Scr->WMgrVertButtonIndent = 0;
+ if(Scr->WMgrVertButtonIndent < 1) {
+ Scr->WMgrVertButtonIndent = 1;
}
Scr->workSpaceMgr.vspace = Scr->WMgrVertButtonIndent;
Scr->workSpaceMgr.occupyWindow->vspace = Scr->WMgrVertButtonIndent;
@@ -1291,8 +1291,8 @@
if(Scr->FirstTime) {
Scr->WMgrHorizButtonIndent = num;
}
- if(Scr->WMgrHorizButtonIndent < 0) {
- Scr->WMgrHorizButtonIndent = 0;
+ if(Scr->WMgrHorizButtonIndent < 1) {
+ Scr->WMgrHorizButtonIndent = 1;
}
Scr->workSpaceMgr.hspace = Scr->WMgrHorizButtonIndent;
Scr->workSpaceMgr.occupyWindow->hspace = Scr->WMgrHorizButtonIndent;
---END PATCH---
-RVP
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.