On 11/02/12 23:03, Carlos R. Mafra wrote:

> On Sat, 11 Feb 2012 at 21:16:34 +0000, Carlos R. Mafra wrote:
>>
>> Subject: [PATCH] clip: Do not display balloon with workspace name
> 
> Oh, I see now.
> 
> This balloon can be slightly useful if the clip is already displaying
> the workspace name. If the name does not fit into the clip icon it is
> drastically cut at the boundary, and then moving the mouse over the
> clip "completes" the name by writing the missing piece -- which is
> the odd thing I saw earlier, and it is odd because my clip was not
> displaying the workspace name.
> 
> So another less disrupting option would be to display the balloon
> only if show_clip_title is set via WPrefs, something like the patch
> below.
> 
> But I find this behavior of completing the name a workaround for
> a ugly situation. Having the name cut does not look beautiful, and
> I see little aesthetic improvement by completing it like that.
> 
> Does anybody who hasn't already shortened the workspace name 
> like this balloon completion? I think the code removal for this
> dubious situation is better than the patch below. And perhaps
> another patch to not display a name which does not fit would
> also be appropriate.
> 
> Comments?




Yes, first, very good job. Second, IMO you can apply the previous patch to 
remove the odd label. Then, you can apply the patch attached. This patch show 
the Clip's name if the length of the label is > 5 characters in a normal 
balloon. If you want, can remove the length > 5 and the name will be show 
always, but in my opinion the info is redundant.

The patch clean some brackets and empty lines. This is the patch:

 
>From fe9b47ed12bd1e107abd7708ed8c0adfff00ab7f Mon Sep 17 00:00:00 2001
From: Rodolfo García Peñas (kix) <[email protected]>
Date: Sun, 12 Feb 2012 16:08:51 +0100
Subject: [PATCH] WindowMaker: Add Balloon to the clip

Now the clip has balloon if dock icon is set in WMPrefs.
---
 src/balloon.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/balloon.c b/src/balloon.c
index a4e8aaf..23ca21f 100644
--- a/src/balloon.c
+++ b/src/balloon.c
@@ -439,7 +439,15 @@ static void appiconBalloon(WObjDescriptor * object)
        WScreen *scr = aicon->icon->core->screen_ptr;
        char *tmp;
 
-       if (aicon->command && aicon->wm_class) {
+       /* If is the Clip and the length of the workspace's name is > 6,  then 
show the ballon */
+       if (object->parent == scr->clip_icon) { 
+               if (strlen(scr->workspaces[scr->current_workspace]->name) > 5) {
+                       scr->balloon->text = 
wstrdup(scr->workspaces[scr->current_workspace]->name);
+               } else {
+                       wBalloonHide(scr);
+                       return;
+               }
+       } else if (aicon->command && aicon->wm_class) {
                int len = strlen(aicon->command) + strlen(aicon->wm_class) + 8;
                tmp = wmalloc(len);
                snprintf(tmp, len, "%s\n(%s)", aicon->wm_class, aicon->command);
@@ -510,24 +518,19 @@ void wBalloonEnteredObject(WScreen * scr, WObjDescriptor 
* object)
                balloon->ignoreTimer = 0;
                return;
        }
+
        switch (object->parent_type) {
        case WCLASS_FRAME:
-               if (wPreferences.window_balloon) {
+               if (wPreferences.window_balloon)
                        frameBalloon(object);
-               }
                break;
-
        case WCLASS_DOCK_ICON:
-               if (object->parent != scr->clip_icon && 
wPreferences.appicon_balloon)
+               if (wPreferences.appicon_balloon)
                        appiconBalloon(object);
-               else
-                       wBalloonHide(scr);
                break;
-
        case WCLASS_MINIWINDOW:
-               if (wPreferences.miniwin_balloon) {
+               if (wPreferences.miniwin_balloon)
                        miniwindowBalloon(object);
-               }
                break;
        case WCLASS_APPICON:
                if (wPreferences.appicon_balloon)
-- 
1.7.7.3



[snip]
-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From fe9b47ed12bd1e107abd7708ed8c0adfff00ab7f Mon Sep 17 00:00:00 2001
From: Rodolfo García Peñas (kix) <[email protected]>
Date: Sun, 12 Feb 2012 16:08:51 +0100
Subject: [PATCH] WindowMaker: Add Balloon to the clip

Now the clip has balloon if dock icon is set in WMPrefs.
---
 src/balloon.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/balloon.c b/src/balloon.c
index a4e8aaf..23ca21f 100644
--- a/src/balloon.c
+++ b/src/balloon.c
@@ -439,7 +439,15 @@ static void appiconBalloon(WObjDescriptor * object)
 	WScreen *scr = aicon->icon->core->screen_ptr;
 	char *tmp;
 
-	if (aicon->command && aicon->wm_class) {
+	/* If is the Clip and the length of the workspace's name is > 6,  then show the ballon */
+	if (object->parent == scr->clip_icon) { 
+		if (strlen(scr->workspaces[scr->current_workspace]->name) > 5) {
+			scr->balloon->text = wstrdup(scr->workspaces[scr->current_workspace]->name);
+		} else {
+			wBalloonHide(scr);
+			return;
+		}
+	} else if (aicon->command && aicon->wm_class) {
 		int len = strlen(aicon->command) + strlen(aicon->wm_class) + 8;
 		tmp = wmalloc(len);
 		snprintf(tmp, len, "%s\n(%s)", aicon->wm_class, aicon->command);
@@ -510,24 +518,19 @@ void wBalloonEnteredObject(WScreen * scr, WObjDescriptor * object)
 		balloon->ignoreTimer = 0;
 		return;
 	}
+
 	switch (object->parent_type) {
 	case WCLASS_FRAME:
-		if (wPreferences.window_balloon) {
+		if (wPreferences.window_balloon)
 			frameBalloon(object);
-		}
 		break;
-
 	case WCLASS_DOCK_ICON:
-		if (object->parent != scr->clip_icon && wPreferences.appicon_balloon)
+		if (wPreferences.appicon_balloon)
 			appiconBalloon(object);
-		else
-			wBalloonHide(scr);
 		break;
-
 	case WCLASS_MINIWINDOW:
-		if (wPreferences.miniwin_balloon) {
+		if (wPreferences.miniwin_balloon)
 			miniwindowBalloon(object);
-		}
 		break;
 	case WCLASS_APPICON:
 		if (wPreferences.appicon_balloon)
-- 
1.7.7.3

Reply via email to