1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00
This commit is contained in:
kojima
2004-10-15 00:27:36 +00:00
parent 0c09179f01
commit cd36d73886

View File

@@ -22,6 +22,7 @@
#include "wconfig.h" #include "wconfig.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "WindowMaker.h" #include "WindowMaker.h"
#include "screen.h" #include "screen.h"
@@ -114,9 +115,6 @@ struct SwitchPanel {
WMArray *windows; WMArray *windows;
int current; int current;
WMColor *normalColor;
WMColor *selectColor;
RImage *defIcon; RImage *defIcon;
RImage *tile; RImage *tile;
@@ -218,10 +216,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
int iconWidth = ICON_IDEAL_SIZE; int iconWidth = ICON_IDEAL_SIZE;
WMBox *vbox; WMBox *vbox;
panel->defIcon= NULL; memset(panel, 0, sizeof(WSwitchPanel));
panel->normalColor = WMGrayColor(scr->wmscreen);
panel->selectColor = WMWhiteColor(scr->wmscreen);
panel->scr= scr; panel->scr= scr;
panel->windows= WMCreateArray(10); panel->windows= WMCreateArray(10);
@@ -255,9 +250,8 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
if (iconWidth < 16 || WMGetArrayItemCount(panel->windows) == 0) if (iconWidth < 16 || WMGetArrayItemCount(panel->windows) == 0)
{ {
/* if there are too many windows, don't bother trying to show the panel */ /* if there are too many windows, don't bother trying to show the panel */
WMFreeArray(panel->windows);
wfree(panel); return panel;
return NULL;
} }
height= iconWidth + 20 + 10 + ICON_EXTRASPACE; height= iconWidth + 20 + 10 + ICON_EXTRASPACE;
@@ -356,18 +350,22 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
{ {
int i; int i;
RImage *image; RImage *image;
if (panel->images) {
WM_ITERATE_ARRAY(panel->images, image, i) { WM_ITERATE_ARRAY(panel->images, image, i) {
if (image) if (image)
RReleaseImage(image); RReleaseImage(image);
} }
WMFreeArray(panel->images);
}
if (panel->win)
WMDestroyWidget(panel->win); WMDestroyWidget(panel->win);
if (panel->icons)
WMFreeArray(panel->icons); WMFreeArray(panel->icons);
WMFreeArray(panel->windows); WMFreeArray(panel->windows);
WMFreeArray(panel->images);
WMReleaseColor(panel->selectColor);
WMReleaseColor(panel->normalColor);
if (panel->defIcon) if (panel->defIcon)
RReleaseImage(panel->defIcon); RReleaseImage(panel->defIcon);
if (panel->tile)
RReleaseImage(panel->tile); RReleaseImage(panel->tile);
wfree(panel); wfree(panel);
} }
@@ -378,6 +376,7 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
WWindow *wwin; WWindow *wwin;
int count = WMGetArrayItemCount(panel->windows); int count = WMGetArrayItemCount(panel->windows);
if (panel->win)
changeImage(panel, panel->current, 0); changeImage(panel, panel->current, 0);
if (!back) if (!back)
@@ -387,10 +386,11 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
wwin = WMGetFromArray(panel->windows, panel->current); wwin = WMGetFromArray(panel->windows, panel->current);
if (panel->win) {
WMSetLabelText(panel->label, wwin->frame->title); WMSetLabelText(panel->label, wwin->frame->title);
changeImage(panel, panel->current, 1); changeImage(panel, panel->current, 1);
}
return wwin; return wwin;
} }