mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
wmaker: update docked application balloon text
This patch is displaying the number of application instance run directly in the balloon text (and I also run checkpatch.pl).
This commit is contained in:
committed by
Carlos R. Mafra
parent
162cca286d
commit
6b5e589d09
@@ -117,8 +117,7 @@ static int getMaxStringWidth(WMFont * font, const char *text)
|
||||
return w;
|
||||
}
|
||||
|
||||
static void
|
||||
drawMultiLineString(WMScreen * scr, Pixmap pixmap, WMColor * color,
|
||||
static void drawMultiLineString(WMScreen *scr, Pixmap pixmap, WMColor *color,
|
||||
WMFont *font, int x, int y, const char *text, int len)
|
||||
{
|
||||
const char *p = text;
|
||||
@@ -137,10 +136,9 @@ drawMultiLineString(WMScreen * scr, Pixmap pixmap, WMColor * color,
|
||||
}
|
||||
p++;
|
||||
}
|
||||
if (pos > 0) {
|
||||
if (pos > 0)
|
||||
WMDrawString(scr, pixmap, color, font, x, y + l * height, pb, pos);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SHAPED_BALLOON
|
||||
|
||||
@@ -245,9 +243,9 @@ static Pixmap makePixmap(WScreen * scr, int width, int height, int side, Pixmap
|
||||
|
||||
bitmap = XCreatePixmap(dpy, scr->root_win, width + SPACE, height + SPACE, 1);
|
||||
|
||||
if (!bal->monoGC) {
|
||||
if (!bal->monoGC)
|
||||
bal->monoGC = XCreateGC(dpy, bitmap, 0, NULL);
|
||||
}
|
||||
|
||||
XSetForeground(dpy, bal->monoGC, 0);
|
||||
XFillRectangle(dpy, bitmap, bal->monoGC, 0, 0, width + SPACE, height + SPACE);
|
||||
|
||||
@@ -255,11 +253,10 @@ static Pixmap makePixmap(WScreen * scr, int width, int height, int side, Pixmap
|
||||
XSetForeground(dpy, scr->draw_gc, scr->black_pixel);
|
||||
XFillRectangle(dpy, pixmap, scr->draw_gc, 0, 0, width + SPACE, height + SPACE);
|
||||
|
||||
if (side & BOTTOM) {
|
||||
if (side & BOTTOM)
|
||||
y = 0;
|
||||
} else {
|
||||
else
|
||||
y = SPACE;
|
||||
}
|
||||
x = 0;
|
||||
|
||||
drawBalloon(scr, bitmap, pixmap, x, y, width, height, side);
|
||||
@@ -460,7 +457,8 @@ static void showBalloon(WScreen * scr)
|
||||
|
||||
if (wPreferences.miniwin_apercu_balloon && scr->balloon->apercu != None)
|
||||
/* used to display either the apercu alone or the apercu and the title */
|
||||
showApercu(scr, x, y, (wPreferences.icon_size - 1) * wPreferences.apercu_size, (wPreferences.icon_size - 1) * wPreferences.apercu_size,
|
||||
showApercu(scr, x, y, (wPreferences.icon_size - 1) * wPreferences.apercu_size,
|
||||
(wPreferences.icon_size - 1) * wPreferences.apercu_size,
|
||||
scr->balloon->text, scr->balloon->apercu);
|
||||
else
|
||||
showText(scr, x, y, scr->balloon->h, w, scr->balloon->text);
|
||||
@@ -522,15 +520,36 @@ static void appiconBalloon(WObjDescriptor *object)
|
||||
}
|
||||
} else if (aicon->command && aicon->wm_class) {
|
||||
int len;
|
||||
WApplication *app;
|
||||
unsigned int app_win_cnt = 0;
|
||||
|
||||
if (object->parent_type == WCLASS_DOCK_ICON) {
|
||||
if (aicon->main_window) {
|
||||
app = wApplicationOf(aicon->main_window);
|
||||
if (app && app->main_window_desc && app->main_window_desc->fake_group)
|
||||
app_win_cnt = app->main_window_desc->fake_group->retainCount - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check to see if it is a GNUstep app */
|
||||
if (strcmp(aicon->wm_class, "GNUstep") == 0)
|
||||
len = strlen(aicon->command) + strlen(aicon->wm_instance) + 8;
|
||||
else
|
||||
len = strlen(aicon->command) + strlen(aicon->wm_class) + 8;
|
||||
|
||||
if (app_win_cnt > 0)
|
||||
len += 1 + snprintf(NULL, 0, "%u", app_win_cnt);
|
||||
|
||||
tmp = wmalloc(len);
|
||||
/* Check to see if it is a GNUstep App */
|
||||
if (strcmp(aicon->wm_class, "GNUstep") == 0)
|
||||
if (app_win_cnt > 0)
|
||||
snprintf(tmp, len, "%u %s\n(%s)", app_win_cnt, aicon->wm_instance, aicon->command);
|
||||
else
|
||||
snprintf(tmp, len, "%s\n(%s)", aicon->wm_instance, aicon->command);
|
||||
else
|
||||
if (app_win_cnt > 0)
|
||||
snprintf(tmp, len, "%u %s\n(%s)", app_win_cnt, aicon->wm_class, aicon->command);
|
||||
else
|
||||
snprintf(tmp, len, "%s\n(%s)", aicon->wm_class, aicon->command);
|
||||
scr->balloon->text = tmp;
|
||||
|
||||
Reference in New Issue
Block a user