Re: Patching FvwmButtons to use Balloons (tooltips).

2006-08-01 Thread Thomas Adam
On Tue, 1 Aug 2006 15:30:15 +0400
"Serge (gentoosiast) Koksharov" <[EMAIL PROTECTED]> wrote:

> My suggestions:
> 
> - Use term 'tips' instead of 'balloons' in any new code & docs.

I was going to do this anyway.

> - Rename 'balloons' to 'tips' in FvwmPager, still supporting the old
>   variant, but marking it explicitly as deprecated. (I can do all
>   necessary changes and send a patch if core developers agree with this
>   opinion).

I don't see a problem with this providing the Balloon* syntax is maintained
by *warning* of future deprecation (the classic example of this is the Decor
code in FVWM.  :P)

You can patch that aspect if you want, but the logic of it would be after I
have finished adding the necessary code to work with FTips.h, and seeing as I
am doing that anyway, marking as I go a warning of deprecation isn't all that
hard to be honest.  Either way I don't mind.

-- Thomas Adam

-- 
ThisWindow (thomas_adam) Destroy



Re: Patching FvwmButtons to use Balloons (tooltips).

2006-08-01 Thread Serge (gentoosiast) Koksharov
  Hello, Thomas,

On Mon, Jul 31, 2006 at 03:10:08PM +0100, Thomas Adam wrote:
> Dear all,
> 
> Before I attempt to do this, I just wanted to make sure that this is
> something worthwhile doing.  Currently, FvwmPager is about the only module
> that implements balloons to easily tell which window is which.

Wrong. FvwmIconMan & FvwmTaskBar implement them. But in this two modules
they are called tips, not balloons. I think 'tips' is more conventional
term.

My suggestions:

- Use term 'tips' instead of 'balloons' in any new code & docs.
- Rename 'balloons' to 'tips' in FvwmPager, still supporting the old
  variant, but marking it explicitly as deprecated. (I can do all
  necessary changes and send a patch if core developers agree with this
  opinion).

> I would assume that for sundry options such as:
> 
>   BalloonColorset 
> 
> That would be a global option to FvwmButtons rather than a per-button
> option?  

I can hardly imagine why users need tips with different colors. Don't
bother, make it global.

Bye

-- 
Serge Koksharov, Free Software user & supporter
GPG public key ID: 0x3D330896 (pgp.mit.edu)
Key fingerprint: 5BC4 0475 CB03 6A31 0076  82C2 C240 72F0 3D33 0896


pgpv8ezVclmuG.pgp
Description: PGP signature


FvwmWinList: string truncation in DoButton function

2006-08-01 Thread Serge (gentoosiast) Koksharov
  Hello,

While studying code of the FvwmWinList module I found that truncation
code isn't very well written:

1) Truncated string saved only if 'TruncateLeft' option is set. If not,
string recalculated each time.

2) If 'TruncateLeft' isn't set, during truncation only length of the
string is updated, end of string '\0' marker position isn't moved.

3) If 'TruncateLeft' is set string can be truncated up to zero
characters (only '\0' is left); if it isn't set string can only be
truncated up to one character.

Attached patch:

- fixes first two issues.
- independently of 'TruncateLeft' setting, allows string truncation up
  to zero characters (only '\0' is left).
- considerably shortens the code (can be shortened even more, but I
  followed module author's coding style) and makes it more easy to
  understand.
- removes useless comments about converting module code to C++.

Hope you'll find my changes useful.

Bye

-- 
Serge Koksharov, Free Software user & supporter
GPG public key ID: 0x3D330896 (pgp.mit.edu)
Key fingerprint: 5BC4 0475 CB03 6A31 0076  82C2 C240 72F0 3D33 0896
diff -Naur fvwmCVS-orig/modules/ChangeLog fvwmCVS-fixed/modules/ChangeLog
--- fvwmCVS-orig/modules/ChangeLog  2006-08-01 12:38:42.0 +0400
+++ fvwmCVS-fixed/modules/ChangeLog 2006-08-01 14:25:42.0 +0400
@@ -1,3 +1,13 @@
+2006-08-01  Serge Koksharov  
+
+   * modules/FvwmWinList/ButtonArray.c (DoButton):
+   improved truncation code.
+   
+   * modules/FvwmWinList/ButtonArray.c:
+   * modules/FvwmWinList/List.c:
+   * modules/FvwmWinList/List.h:
+   removed useless comments about converting module code to C++.
+
 2006-07-16  Scott Smedley  <[EMAIL PROTECTED]>
 
* FvwmTabs/FvwmTabs.in:
diff -Naur fvwmCVS-orig/modules/FvwmWinList/ButtonArray.c 
fvwmCVS-fixed/modules/FvwmWinList/ButtonArray.c
--- fvwmCVS-orig/modules/FvwmWinList/ButtonArray.c  2006-08-01 
12:38:41.0 +0400
+++ fvwmCVS-fixed/modules/FvwmWinList/ButtonArray.c 2006-08-01 
14:20:57.0 +0400
@@ -10,7 +10,6 @@
  * whatsoever. Use this program at your own risk. Permission to use this
  * program for any purpose is given, as long as the copyright is kept intact.
  *
- *  Things to do:  Convert to C++  (In Progress)
  */
 
 /* This program is free software; you can redistribute it and/or modify
@@ -517,33 +516,24 @@
}
else
{
-   if (TruncateLeft)
+   while (*string &&
+   (newx + FlocaleTextWidth(
+   FButtonFont, string, len)
+   + 2 * button->reliefwidth +
+   INNER_MARGIN) > w)
{
-   /* move the ptr up until the rest fits */
-   while (*string &&
-  (newx + FlocaleTextWidth(
-  FButtonFont, string,
-  strlen(string))
-   + 2 * button->reliefwidth +
-   INNER_MARGIN) > w)
+   len--;
+   if (TruncateLeft)
{
string++;
-   len--;
}
-   button->truncatewidth = w;
-   button->truncate_title = string;
-   }
-   else
-   {
-   while ((len > 1) &&
-  (newx + FlocaleTextWidth(
-  FButtonFont, string, len)
-   + 2 * button->reliefwidth +
-   INNER_MARGIN) > w)
+   else
{
-   len--;
+   *(string + len) = '\0';
}
}
+   button->truncatewidth = w;
+   button->truncate_title = string;
}
}
FwinString->str = string;
diff -Naur fvwmCVS-orig/modules/FvwmWinList/List.c 
fvwmCVS-fixed/modules/FvwmWinList/List.c
--- fvwmCVS-orig/modules/FvwmWinList/List.c 2006-08-01 12:38:41.0 
+0400
+++ fvwmCVS-fixed/modules/FvwmWinList/List.c2006-08-01 12:55:53.0 
+0400
@@ -10,7 +10,6 @@
  * whatsoever. Use this program at your own risk. Permission to use this
  * program for any purpose is given, as long as the copyright is kept intact.
  *
- *  Things to do:  Convert to C++  (In Progress)
  */
 
 /* This program is free software; you can redistribute it and/or modify
diff -Naur fvwmCVS-orig/modules/Fv