mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
fix
This commit is contained in:
@@ -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"
|
||||||
@@ -113,10 +114,7 @@ struct SwitchPanel {
|
|||||||
WMArray *images;
|
WMArray *images;
|
||||||
WMArray *windows;
|
WMArray *windows;
|
||||||
int current;
|
int current;
|
||||||
|
|
||||||
WMColor *normalColor;
|
|
||||||
WMColor *selectColor;
|
|
||||||
|
|
||||||
RImage *defIcon;
|
RImage *defIcon;
|
||||||
|
|
||||||
RImage *tile;
|
RImage *tile;
|
||||||
@@ -217,12 +215,9 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
|
|||||||
int height;
|
int height;
|
||||||
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,19 +350,23 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
RImage *image;
|
RImage *image;
|
||||||
WM_ITERATE_ARRAY(panel->images, image, i) {
|
|
||||||
if (image)
|
if (panel->images) {
|
||||||
RReleaseImage(image);
|
WM_ITERATE_ARRAY(panel->images, image, i) {
|
||||||
|
if (image)
|
||||||
|
RReleaseImage(image);
|
||||||
|
}
|
||||||
|
WMFreeArray(panel->images);
|
||||||
}
|
}
|
||||||
WMDestroyWidget(panel->win);
|
if (panel->win)
|
||||||
WMFreeArray(panel->icons);
|
WMDestroyWidget(panel->win);
|
||||||
|
if (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);
|
||||||
RReleaseImage(panel->tile);
|
if (panel->tile)
|
||||||
|
RReleaseImage(panel->tile);
|
||||||
wfree(panel);
|
wfree(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +376,8 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
int count = WMGetArrayItemCount(panel->windows);
|
int count = WMGetArrayItemCount(panel->windows);
|
||||||
|
|
||||||
changeImage(panel, panel->current, 0);
|
if (panel->win)
|
||||||
|
changeImage(panel, panel->current, 0);
|
||||||
|
|
||||||
if (!back)
|
if (!back)
|
||||||
panel->current = (count + panel->current - 1) % count;
|
panel->current = (count + panel->current - 1) % count;
|
||||||
@@ -386,11 +385,12 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
|
|||||||
panel->current = (panel->current + 1) % count;
|
panel->current = (panel->current + 1) % count;
|
||||||
|
|
||||||
wwin = WMGetFromArray(panel->windows, panel->current);
|
wwin = WMGetFromArray(panel->windows, panel->current);
|
||||||
|
|
||||||
WMSetLabelText(panel->label, wwin->frame->title);
|
|
||||||
|
|
||||||
changeImage(panel, panel->current, 1);
|
if (panel->win) {
|
||||||
|
WMSetLabelText(panel->label, wwin->frame->title);
|
||||||
|
|
||||||
|
changeImage(panel, panel->current, 1);
|
||||||
|
}
|
||||||
return wwin;
|
return wwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user