Bug 63904

Summary: Maintainer update: x11-wm/treewm - fixes "menu item commands are lower-cased"
Product: Ports & Packages Reporter: Rudolf Polzer <freebsd-dr>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
treewm.diff none

Description Rudolf Polzer 2004-03-07 23:40:10 UTC
Menu item values (eg commands) are converted to lower case for no apparent
reason, making it impossible to call programs like Eterm from the menu.
Behavior of treewm is changed/corrected using a simple patch.

Fix: Appliying this diff to x11-wm/treewm should fix it.
How-To-Repeat: Insert in your .treewm in the menu section:
Test = !xmessage "Hello World!"

The message will contain "hello world!" in lower case letters.
This is obviously a bug.
Comment 1 Rudolf Polzer 2004-03-07 23:49:11 UTC
Fixing this problem made another small problem appear: menu names of submenus
aren't correctly handled case insensitively any more when this is fixed.

To reproduce, do the following:

  [menu]
  test2 = $XYZ
  test3 = $xyz

  [menu XYZ]
  6x9 = !xmessage "42"

If handled correctly, both menu items would show the submenu. But only the
latter does (while in correct case sensitive handling, only the former would
do). To get correct case insensitive handling of menu items (that's what the
author wanted anyway), the handling of the $ must lower case the names.

The following patch fixes the menu handling; sorry for the inconvenience of a
second patch:

diff -Ndru /usr/ports/x11-wm/treewm/files/patch-resmanager.cc /tmp/treewm/files/patch-resmanager.cc
--- /usr/ports/x11-wm/treewm/files/patch-resmanager.cc	Thu Jan  1 01:00:00 1970
+++ /tmp/treewm/files/patch-resmanager.cc	Mon Mar  8 00:40:51 2004
@@ -0,0 +1,10 @@
+--- ../treewm-0.4.5.orig/src/resmanager.cc	Mon Mar  8 00:20:42 2004
++++ src/resmanager.cc	Mon Mar  8 00:40:02 2004
+@@ -127,6 +127,7 @@
+     for (int j=0; j!=mi->n; ++j) {
+       MenuItem &mitem = mi->menu[j];
+       if (mitem.key[0] == '$') {
++        lower(mitem.key);
+         MenuInfo *mi2 = (MenuInfo *)rman->GetInfo(SE_MENUINFO,mitem.key+1);
+         if (mi2) {
+           mitem.submenu = new SubMenuInfo;
diff -Ndru /usr/ports/x11-wm/treewm/files/patch-uehandler.cc /tmp/treewm/files/patch-uehandler.cc
--- /usr/ports/x11-wm/treewm/files/patch-uehandler.cc	Thu Jan  1 01:00:00 1970
+++ /tmp/treewm/files/patch-uehandler.cc	Mon Mar  8 00:43:01 2004
@@ -0,0 +1,10 @@
+--- ../treewm-0.4.5.orig/src/uehandler.cc	Mon Mar  8 00:20:42 2004
++++ src/uehandler.cc	Mon Mar  8 00:42:26 2004
+@@ -955,6 +955,7 @@
+       if (!ExecAll)
+         return false;
+       {
++        lower(str);
+         MenuInfo *mi = ((MenuInfo *)rman->GetInfo(SE_MENUINFO,str+1));
+         if (mi) {
+           int x,y;
Comment 2 Kirill Ponomarev freebsd_committer freebsd_triage 2004-03-08 10:30:54 UTC
State Changed
From-To: open->closed

Committed, thanks!