1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 05:18:06 +01:00

fixed crash bug with alt-tab + run-dialog (or internal windows in general)

This commit is contained in:
kojima
2004-10-26 08:00:19 +00:00
parent c95b464680
commit 92a84fe050
2 changed files with 31 additions and 20 deletions

View File

@@ -1,3 +1,7 @@
Changes since version 0.91.0:
.............................
- fixed crash with info panel and alt-tabbing
Changes since version 0.90.0:
.............................

View File

@@ -360,32 +360,39 @@ drawTitle(WSwitchPanel *panel, int index, char *title)
int width= WMWidgetWidth(panel->win);
int x;
ntitle= ShrinkString(panel->font, title, width-2*BORDER_SPACE);
if (title)
ntitle= ShrinkString(panel->font, title, width-2*BORDER_SPACE);
else
ntitle= NULL;
if (panel->bg) {
if (strcmp(ntitle, title)!=0)
x= BORDER_SPACE;
else
{
int w= WMWidthOfString(panel->font, ntitle, strlen(ntitle));
x= BORDER_SPACE+(index-panel->firstVisible)*ICON_TILE_SIZE + ICON_TILE_SIZE/2 - w/2;
if (x < BORDER_SPACE)
if (ntitle) {
if (strcmp(ntitle, title)!=0)
x= BORDER_SPACE;
else if (x + w > width-BORDER_SPACE)
x= width-BORDER_SPACE-w;
}
else
{
int w= WMWidthOfString(panel->font, ntitle, strlen(ntitle));
x= BORDER_SPACE+(index-panel->firstVisible)*ICON_TILE_SIZE + ICON_TILE_SIZE/2 - w/2;
if (x < BORDER_SPACE)
x= BORDER_SPACE;
else if (x + w > width-BORDER_SPACE)
x= width-BORDER_SPACE-w;
}
}
XClearWindow(dpy, WMWidgetXID(panel->win));
WMDrawString(panel->scr->wmscreen,
WMWidgetXID(panel->win),
panel->white, panel->font,
x, WMWidgetHeight(panel->win) - BORDER_SPACE - LABEL_HEIGHT + WMFontHeight(panel->font)/2,
ntitle, strlen(ntitle));
if (ntitle)
WMDrawString(panel->scr->wmscreen,
WMWidgetXID(panel->win),
panel->white, panel->font,
x, WMWidgetHeight(panel->win) - BORDER_SPACE - LABEL_HEIGHT + WMFontHeight(panel->font)/2,
ntitle, strlen(ntitle));
} else {
WMSetLabelText(panel->label, ntitle);
if (ntitle)
WMSetLabelText(panel->label, ntitle);
}
free(ntitle);
if (ntitle)
free(ntitle);
}