--- ./src/balloon.h.orig-clipcaptions Wed Oct 21 09:43:54 1998 +++ ./src/balloon.h Mon Aug 13 11:33:06 2001 @@ -26,6 +26,10 @@ void wBalloonEnteredObject(WScreen *scr, WObjDescriptor *object); +#ifdef PRETTY_CLIP_CAPTIONS +void wBalloonChangeText(WScreen *scr, char *text); +#endif + void wBalloonHide(WScreen *scr); #endif --- ./src/balloon.c.orig-clipcaptions Mon Jul 23 13:31:49 2001 +++ ./src/balloon.c Mon Aug 13 11:35:40 2001 @@ -388,6 +388,30 @@ +#ifdef PRETTY_CLIP_CAPTIONS +static void +clipIconBalloon(WObjDescriptor *object) +{ + WAppIcon *aicon = (WAppIcon*)object->parent; + WScreen *scr = aicon->icon->core->screen_ptr; + int workspace = scr->current_workspace; + + scr->balloon->text = wstrdup(scr->workspaces[workspace]->name); + scr->balloon->h = aicon->icon->core->height; + scr->balloon->objectWindow = aicon->icon->core->window; + if (scr->balloon->prevType != 0) { + XUnmapWindow(dpy, scr->balloon->window); + showBalloon(scr); + } else { + scr->balloon->timer = WMAddTimerHandler(BALLOON_DELAY, + (WMCallback*)showBalloon, scr); + } + scr->flags.clip_balloon_mapped = 1; +} +#endif /* PRETTY_CLIP_CAPTIONS */ + + + void wBalloonInitialize(WScreen *scr) { @@ -435,6 +459,10 @@ wfree(scr->balloon->text); scr->balloon->text = NULL; +#ifdef PRETTY_CLIP_CAPTIONS + scr->flags.clip_balloon_mapped = 0; +#endif + if (!object) { wBalloonHide(scr); balloon->ignoreTimer = 0; @@ -448,7 +476,14 @@ break; case WCLASS_DOCK_ICON: +#ifndef PRETTY_CLIP_CAPTIONS if (object->parent != scr->clip_icon && wPreferences.appicon_balloon) +#else + if (wPreferences.appicon_balloon) + if (object->parent == scr->clip_icon) + clipIconBalloon(object); + else +#endif appiconBalloon(object); else wBalloonHide(scr); @@ -472,6 +507,21 @@ +#ifdef PRETTY_CLIP_CAPTIONS +void wBalloonChangeText(WScreen *scr, char *text) +{ + if (scr->balloon->text) { + wfree(scr->balloon->text); + } + scr->balloon->text = wstrdup(text); + if (scr->balloon->mapped) { + showBalloon(scr); + } +} +#endif /* PRETTY_CLIP_CAPTIONS */ + + + void wBalloonHide(WScreen *scr) { @@ -483,6 +533,9 @@ WMDeleteTimerHandler(scr->balloon->timer); scr->balloon->timer = NULL; } +#ifdef PRETTY_CLIP_CAPTIONS + scr->flags.clip_balloon_mapped = 0; +#endif scr->balloon->prevType = 0; } } --- ./src/dock.c.orig-clipcaptions Mon Aug 13 11:21:28 2001 +++ ./src/dock.c Mon Aug 13 11:39:55 2001 @@ -141,7 +141,9 @@ static void clipAutoLower(void *cdata); static void clipAutoRaise(void *cdata); +#ifndef PRETTY_CLIP_CAPTIONS static void showClipBalloon(WDock *dock, int workspace); +#endif /* PRETTY_CLIP_CAPTIONS */ #ifdef OFFIX_DND @@ -1235,6 +1237,10 @@ } +#ifdef PRETTY_CLIP_CAPTIONS +#define CLIP_CAPTION_SPACE_X (4) +#define CLIP_CAPTION_SPACE_Y (3) +#endif /* PRETTY_CLIP_CAPTIONS */ void wClipIconPaint(WAppIcon *aicon) { @@ -1245,6 +1251,9 @@ int length, nlength; char *ws_name, ws_number[10]; int ty, tx; +#ifdef PRETTY_CLIP_CAPTIONS + char *shrunk_ws_name; +#endif /* PRETTY_CLIP_CAPTIONS */ wIconPaint(aicon->icon); @@ -1261,20 +1270,42 @@ else XSetForeground(dpy, gc, scr->clip_title_pixel[CLIP_COLLAPSED]); +#ifndef PRETTY_CLIP_CAPTIONS ty = ICON_SIZE - WMFontHeight(scr->clip_title_font) - 3; tx = CLIP_BUTTON_SIZE*ICON_SIZE/64; WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx, ty, ws_name, length); +#else /* PRETTY_CLIP_CAPTIONS */ + tx = CLIP_CAPTION_SPACE_X; + ty = CLIP_CAPTION_SPACE_Y; + shrunk_ws_name = ShrinkString(scr->clip_title_font, ws_name, ICON_SIZE - + (CLIP_BUTTON_SIZE * ICON_SIZE/64)); + length = strlen(shrunk_ws_name); + WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx, + ty, shrunk_ws_name, length); + wfree(shrunk_ws_name); +#endif /* PRETTY_CLIP_CAPTIONS */ + wfree(ws_name); +#ifndef PRETTY_CLIP_CAPTIONS tx = (ICON_SIZE/2 - WMWidthOfString(scr->clip_title_font, ws_number, nlength))/2; WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx, 2, ws_number, nlength); +#else /* PRETTY_CLIP_CAPTIONS */ + tx = (ICON_SIZE - + WMWidthOfString(scr->clip_title_font, ws_number, nlength) - + CLIP_CAPTION_SPACE_X); - wfree(ws_name); + ty = (ICON_SIZE - WMFontHeight(scr->clip_title_font) - + CLIP_CAPTION_SPACE_Y - 1); + + WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx, + ty, ws_number, nlength); +#endif /* PRETTY_CLIP_CAPTIONS */ if (aicon->launching) { XFillRectangle(dpy, aicon->icon->core->window, scr->stipple_gc, @@ -1283,6 +1314,10 @@ paintClipButtons(aicon, aicon->dock->lclip_button_pushed, aicon->dock->rclip_button_pushed); } +#ifdef PRETTY_CLIP_CAPTIONS +#undef CLIP_CAPTION_SPACE_X +#undef CLIP_CAPTION_SPACE_Y +#endif /* PRETTY_CLIP_CAPTIONS */ static void @@ -3207,7 +3242,11 @@ wDockShowIcons(scr->workspaces[workspace]->clip); } if (scr->flags.clip_balloon_mapped) +#ifdef PRETTY_CLIP_CAPTIONS + wBalloonChangeText(scr, scr->workspaces[workspace]->name); +#else /* !PRETTY_CLIP_CAPTIONS */ showClipBalloon(scr->clip_icon->dock, workspace); +#endif /* PRETTY_CLIP_CAPTIONS */ } } @@ -4021,10 +4060,12 @@ } } +#ifndef PRETTY_CLIP_CAPTIONS if (dock->type == WM_CLIP && scr->flags.clip_balloon_mapped) { XUnmapWindow(dpy, scr->clip_balloon); scr->flags.clip_balloon_mapped = 0; } +#endif /* PRETTY_CLIP_CAPTIONS */ #ifdef DEBUG puts("handling dock"); @@ -4079,6 +4120,7 @@ } +#ifndef PRETTY_CLIP_CAPTIONS static void showClipBalloon(WDock *dock, int workspace) { @@ -4120,6 +4162,7 @@ WMDrawString(scr->wmscreen, scr->clip_balloon, scr->clip_title_gc, scr->clip_title_font, 0, 0, text, strlen(text)); } +#endif /* PRETTY_CLIP_CAPTIONS */ static void @@ -4165,6 +4208,7 @@ (void *)dock); } +#ifndef PRETTY_CLIP_CAPTIONS if (btn->xindex == 0 && btn->yindex == 0) showClipBalloon(dock, dock->screen_ptr->current_workspace); else { @@ -4173,6 +4217,7 @@ dock->screen_ptr->flags.clip_balloon_mapped = 0; } } +#endif /* PRETTY_CLIP_CAPTIONS */ } @@ -4296,9 +4341,11 @@ if (dock->auto_raise_lower) wDockRaise(dock); +#ifndef PRETTY_CLIP_CAPTIONS if (dock->screen_ptr->flags.clip_balloon_mapped) { showClipBalloon(dock, dock->screen_ptr->current_workspace); } +#endif /* PRETTY_CLIP_CAPTIONS */ dock->auto_raise_magic = NULL; } --- ./src/wconfig.h.in.orig-clipcaptions Mon Aug 13 11:21:28 2001 +++ ./src/wconfig.h.in Mon Aug 13 11:40:19 2001 @@ -93,6 +93,11 @@ */ #define SHAPED_BALLOON +/* Define PRETTY_CLIP_CAPTIONS if you want a more aesthetically pleasing + * arrangement of the workspace name and number in the Clip tile. + */ +#define PRETTY_CLIP_CAPTIONS + /* * Define NO_EMERGENCY_AUTORESTART if you don't want another window manager