From 701d0a44ee33ca0b3650645b1be6dfc3ff6bc191 Mon Sep 17 00:00:00 2001 From: K D Hedger Date: Mon, 8 Jan 2024 12:29:20 +0000 Subject: [PATCH] Mose code cleaning... --- LFSDesktop/ChangeLog | 1 + LFSDesktop/LFSDesktop/src/disks.cpp | 7 +- LFSDesktop/LFSDesktop/src/globals.h | 2 +- LFSDesktop/LFSDesktop/src/main.cpp | 14 +- LFSDesktop/LFSDesktop/src/prefs.cpp | 2 - LFSDock/LFSDock/src/calendar.cpp | 9 +- LFSDock/LFSDock/src/desktopSwitcher.cpp | 23 ++-- LFSDock/LFSDock/src/globals.cpp | 3 +- LFSDock/LFSDock/src/launchers.cpp | 18 +-- LFSDock/LFSDock/src/main.cpp | 13 -- LFSDock/LFSDock/src/slider.cpp | 8 +- LFSDock/LFSDock/src/slider.h | 8 +- LFSDock/LFSDock/src/taskBar.cpp | 19 +-- LFSPanel/LFSPanel/src/appmenu.cpp | 12 +- LFSPanel/LFSPanel/src/globals.cpp | 5 +- LFSPanel/LFSPanel/src/globals.h | 4 +- LFSPanel/LFSPanel/src/launchers.cpp | 17 ++- LFSPanel/LFSPanel/src/logout.cpp | 34 ++--- LFSPanel/LFSPanel/src/main.cpp | 5 - LFSPanel/LFSPanel/src/slider.cpp | 16 +-- LFSPanel/LFSPanel/src/slider.h | 10 +- LFSPanel/LFSPanel/src/windowlist.cpp | 46 +++---- LFSToolKit/ChangeLog | 1 + LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp | 2 +- LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp | 122 ++++++------------ LFSToolKit/LFSToolKit/lfstk/LFSTKLib.h | 4 +- LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp | 9 +- .../LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp | 7 +- LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp | 4 +- LFSToolKit/examples/geticonpath.cpp | 9 +- LFSToolKit/examples/image.cpp | 5 +- LFSToolKit/examples/toggle.cpp | 18 +-- 32 files changed, 173 insertions(+), 284 deletions(-) diff --git a/LFSDesktop/ChangeLog b/LFSDesktop/ChangeLog index fec6cfc..3b14731 100644 --- a/LFSDesktop/ChangeLog +++ b/LFSDesktop/ChangeLog @@ -1,4 +1,5 @@ 0.2.0 +Fixed minor compiler complaint. Fixed segfault for unreachable icon in desktop file. Fixed not displaying items as links properly. Added custom icons to desktop files. diff --git a/LFSDesktop/LFSDesktop/src/disks.cpp b/LFSDesktop/LFSDesktop/src/disks.cpp index a93bfd1..4bb9358 100644 --- a/LFSDesktop/LFSDesktop/src/disks.cpp +++ b/LFSDesktop/LFSDesktop/src/disks.cpp @@ -23,8 +23,8 @@ const char *diskModel=NULL; const char *diskVendor=NULL; -char diskUUID[256]={0,}; -char diskLabel[256]={0,}; +char diskUUID[256]={0,}; +char diskLabel[256]={0,}; struct udev *udev; int diskTypeData(const char *devname) @@ -239,7 +239,7 @@ continueWithLoop: for(unsigned j=0;jLFSTK_getDefaultWInit(); - //new windowInitStruct; - //win->app=apc; win->windowName=""; win->loadVars=true; win->wc=wc; @@ -220,14 +218,11 @@ Atom xa_prop[3]; button->LFSTK_setMouseCallBack(NULL,doDeskItemMenuSelect,(void*)(long)(j)); iconpath=apc->globalLib->LFSTK_findThemedIcon(iconTheme,diskThemeIconData[j],""); button->LFSTK_setImageFromPath(iconpath,LEFT,true); - freeAndNull(&iconpath); sy+=GADGETHITE; } fileWindow->LFSTK_resizeWindow(GADGETWIDTH+16,sy,true); - //win=new windowInitStruct; win=apc->LFSTK_getDefaultWInit(); - //win->app=apc; win->windowName=""; win->loadVars=true; win->wc=wc; @@ -246,7 +241,6 @@ Atom xa_prop[3]; iconpath=apc->globalLib->LFSTK_findThemedIcon(iconTheme,diskThemeIconData[j],""); button->LFSTK_setImageFromPath(iconpath,LEFT,true); sy+=GADGETHITE; - freeAndNull(&iconpath); } diskWindow->LFSTK_resizeWindow(GADGETWIDTH+16,sy,true); @@ -278,8 +272,8 @@ Atom xa_prop[3]; free(desktopItems.at(j).itemPath); if(desktopItems.at(j).label!=NULL) free(desktopItems.at(j).label); - if(desktopItems.at(j).iconPath!=NULL) - free(desktopItems.at(j).iconPath); + //if(desktopItems.at(j).iconPath!=NULL) + // free(desktopItems.at(j).iconPath); } desktopItems.clear(); diff --git a/LFSDesktop/LFSDesktop/src/prefs.cpp b/LFSDesktop/LFSDesktop/src/prefs.cpp index c733904..dc4d358 100644 --- a/LFSDesktop/LFSDesktop/src/prefs.cpp +++ b/LFSDesktop/LFSDesktop/src/prefs.cpp @@ -136,11 +136,9 @@ void reloadPrefs(void) loadPrefs(); for(unsigned j=0;jLFSTK_setImageFromPath(desktopItems.at(j).iconPath,TOOLBAR,true); desktopItems.at(j).item->LFSTK_setLabelBGColour(backCol,strtod(backAlpha,NULL)); - //desktopItems.at(j).item->LFSTK_setFontColourName(NORMALCOLOUR,foreCol,false) ; desktopItems.at(j).item->newGadgetFGColours[NORMALCOLOUR]=desktopItems.at(j).item->LFSTK_setColour(foreCol); desktopItems.at(j).item->LFSTK_setFontString(fontFace,true); diff --git a/LFSDock/LFSDock/src/calendar.cpp b/LFSDock/LFSDock/src/calendar.cpp index 8480273..10aa25e 100644 --- a/LFSDock/LFSDock/src/calendar.cpp +++ b/LFSDock/LFSDock/src/calendar.cpp @@ -186,7 +186,7 @@ bool doNext(void *p,void* ud) int addCalendar(int x,int y,int grav) { windowInitStruct *win; - char *icon=NULL; + std::string icon; std::string thisday; int txtwid; int txthite; @@ -201,11 +201,8 @@ int addCalendar(int x,int y,int grav) setGadgetDetails(calendarButton); icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,"stock_calendar",""); - if(icon!=NULL) - { - calendarButton->LFSTK_setImageFromPath(icon,LEFT,true); - freeAndNull(&icon); - } + if(icon.length()>0) + calendarButton->LFSTK_setImageFromPath(icon,LEFT,true); else calendarButton->LFSTK_setImageFromPath(DATADIR "/pixmaps/windows.png",LEFT,true); diff --git a/LFSDock/LFSDock/src/desktopSwitcher.cpp b/LFSDock/LFSDock/src/desktopSwitcher.cpp index 30f6613..91aabc5 100644 --- a/LFSDock/LFSDock/src/desktopSwitcher.cpp +++ b/LFSDock/LFSDock/src/desktopSwitcher.cpp @@ -96,14 +96,14 @@ bool desktopSelect(void *object,void* userdata) int addDesktopSwitcer(int x,int y,int grav) { - char *icon=NULL; - infoDataStruct ls; - std::string label; - propertyStruct props; - propReturn pr; - std::string lc="#a0f0f0f0"; - std::string pc="#60a0a0a0"; - std::string ac="#60404040"; + std::string icon; + infoDataStruct ls; + std::string label; + propertyStruct props; + propReturn pr; + std::string lc="#a0f0f0f0"; + std::string pc="#60a0a0a0"; + std::string ac="#60404040"; if(switchButton!=NULL) { @@ -132,11 +132,8 @@ int addDesktopSwitcer(int x,int y,int grav) deskLabel->LFSTK_setStyle(BEVELNONE); icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,"remote-desktop",""); - if(icon!=NULL) - { - switchButton->LFSTK_setImageFromPath(icon,LEFT,true); - freeAndNull(&icon); - } + if(icon.length()>0) + switchButton->LFSTK_setImageFromPath(icon,LEFT,true); else switchButton->LFSTK_setImageFromPath(DATADIR "/pixmaps/windows.png",LEFT,true); diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp index d0b20ac..b2dcca0 100644 --- a/LFSDock/LFSDock/src/globals.cpp +++ b/LFSDock/LFSDock/src/globals.cpp @@ -99,7 +99,8 @@ void dropDesktopFile(const char *data,void *launcher)//TODO// std::string line; while(std::getline(stream,line)) { - cleanstr=apc->globalLib->LFSTK_cleanString((const char*)line.c_str()); + //cleanstr=apc->globalLib->LFSTK_cleanString((const char*)line.c_str());//TODO// + cleanstr=strdup(apc->globalLib->LFSTK_cleanString(line).c_str()); if((strrchr(cleanstr,'.')!=NULL) && (strcmp(strrchr(cleanstr,'.'),".desktop")==0))//TODO// { asprintf(&command,"mkdir -p '%s';cp -nP '%s' '%s'",launchersDir.c_str(),cleanstr,launchersDir.c_str()); diff --git a/LFSDock/LFSDock/src/launchers.cpp b/LFSDock/LFSDock/src/launchers.cpp index 2f79c1a..44e1dfa 100644 --- a/LFSDock/LFSDock/src/launchers.cpp +++ b/LFSDock/LFSDock/src/launchers.cpp @@ -138,9 +138,9 @@ void addALAuncher(const char *fpath,desktopFileStruct *entry) size_t start_pos=0; std::string from; std::string str; - bool goodkey; - GKeyFile *kf=g_key_file_new(); - char *execstring; + bool goodkey; + GKeyFile *kf=g_key_file_new(); + char *execstring; entry->icon=NULL; entry->name=NULL; @@ -171,14 +171,14 @@ void addALAuncher(const char *fpath,desktopFileStruct *entry) int addLaunchers(int x,int y,int grav) { char *launchers; - char *icon=NULL; + std::string icon; int xpos=x; int ypos=y; windowInitStruct *win; std::string lc="#a0f0f0f0"; std::string pc="#60a0a0a0"; std::string ac="#60404040"; - char *iconpath=NULL; + std::string iconpath; int ww; int sy=0; @@ -224,7 +224,6 @@ int addLaunchers(int x,int y,int grav) contextButtons[j]->LFSTK_setGadgetColours(GADGETBG,lc,pc,ac,lc); contextButtons[j]->LFSTK_setGadgetColours(GADGETFG,lc,pc,ac,lc); - freeAndNull(&iconpath); sy+=GADGETHITE; } ww=contextButtons[0]->LFSTK_getTextRealWidth(contextLabelData[1]); @@ -239,7 +238,6 @@ int addLaunchers(int x,int y,int grav) entry.name=NULL; entry.exec=NULL; entry.inTerm=false; -freeAndNull(&icon); addALAuncher(findlaunchers->data.at(l).path.c_str(),&entry); @@ -262,16 +260,12 @@ freeAndNull(&icon); bc->gadgetAcceptsDnD=true; if((entry.icon!=NULL) && (desktopTheme!=NULL)) icon=apc->globalLib->LFSTK_findThemedIcon(desktopTheme,entry.icon,""); - if(icon!=NULL) + if(icon.length()>0) bc->LFSTK_setImageFromPath(icon,LEFT,true); else bc->LFSTK_setImageFromPath(DATADIR "/pixmaps/command.png",LEFT,true); -freeAndNull(&icon); -//freeAndNull(&entry.icon); setGadgetDetails(bc); - //if(icon!=NULL) - // freeAndNull(&icon); launchersArray.push_back(lds); g_free(entry.name); g_free(entry.exec); diff --git a/LFSDock/LFSDock/src/main.cpp b/LFSDock/LFSDock/src/main.cpp index 906facb..768b41e 100644 --- a/LFSDock/LFSDock/src/main.cpp +++ b/LFSDock/LFSDock/src/main.cpp @@ -336,21 +336,8 @@ int main(int argc,char **argv) int retval=apc->LFSTK_runApp(); - -/* -extern LFSTK_windowClass *calWindow; -extern bool calWindowVisible; -extern LFSTK_toggleButtonClass *calendarButton; -extern bool calendarIsUp; -*/ - //delete editbox; - //delete calWindow; - //delete calendarButton; calendarIsUp=false; - freeAndNull(&iconL); - freeAndNull(&iconM); - freeAndNull(&iconH); holdtasks.clear(); filltasks.clear(); tasks.clear(); diff --git a/LFSDock/LFSDock/src/slider.cpp b/LFSDock/LFSDock/src/slider.cpp index 258140d..8fc662b 100644 --- a/LFSDock/LFSDock/src/slider.cpp +++ b/LFSDock/LFSDock/src/slider.cpp @@ -26,10 +26,10 @@ LFSTK_scrollBarClass *vsb=NULL; LFSTK_windowClass *scwindow=NULL; bool windowVisible=false; LFSTK_toggleButtonClass *volumeButton; -char *iconH=NULL; -char *iconM=NULL; -char *iconL=NULL; -char *iconZ=NULL; +std::string iconH; +std::string iconM; +std::string iconL; +std::string iconZ; int oldVolVal=-1; char label[32]; bool sliderIsUp=false; diff --git a/LFSDock/LFSDock/src/slider.h b/LFSDock/LFSDock/src/slider.h index de0b64c..ab7e842 100644 --- a/LFSDock/LFSDock/src/slider.h +++ b/LFSDock/LFSDock/src/slider.h @@ -28,9 +28,11 @@ extern LFSTK_windowClass *scwindow; extern bool windowVisible; extern LFSTK_toggleButtonClass *volumeButton; extern LFSTK_scrollBarClass *vsb; -extern char *iconH; -extern char *iconM; -extern char *iconL; +extern std::string iconH; +extern std::string iconM; +extern std::string iconL; +extern std::string iconZ; + extern int oldVolVal; void setIcon(void); diff --git a/LFSDock/LFSDock/src/taskBar.cpp b/LFSDock/LFSDock/src/taskBar.cpp index 79f8c95..687dade 100644 --- a/LFSDock/LFSDock/src/taskBar.cpp +++ b/LFSDock/LFSDock/src/taskBar.cpp @@ -208,7 +208,7 @@ void updateTaskBar(bool force) { int cnt=0; bool skipflag=false; - char *icon=NULL; + std::string icon; dataStruct *datam=NULL; bool goodkey; char *keyicon=NULL; @@ -263,17 +263,14 @@ skiplabel: for(int j=0;jglobalLib->LFSTK_findThemedIcon(desktopTheme,filltasks.at(j).taskClass[0].c_str(),""); - if(icon==NULL) - icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,filltasks.at(j).taskClass[1].c_str(),""); + icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,filltasks.at(j).taskClass[0],""); + if(icon.length()==0) + icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,filltasks.at(j).taskClass[1],""); - if(icon!=NULL) + if(icon.length()>0) { if(taskbuttons[j]->imagePath!=icon) taskbuttons[j]->LFSTK_setImageFromPath(icon,LEFT,true); - freeAndNull(&icon); } else { @@ -289,11 +286,10 @@ skiplabel: if(keyicon!=NULL) { icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,keyicon,""); - if(icon!=NULL) + if(icon.length()>0) { if(taskbuttons[j]->imagePath!=icon) taskbuttons[j]->LFSTK_setImageFromPath(icon,LEFT,true); - freeAndNull(&icon); } g_free(keyicon); } @@ -312,11 +308,10 @@ skiplabel: if(keyicon!=NULL) { icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,keyicon,""); - if(icon!=NULL) + if(icon.length()>0) { if(taskbuttons[j]->imagePath!=icon) taskbuttons[j]->LFSTK_setImageFromPath(icon,LEFT,true); - freeAndNull(&icon); } g_free(keyicon); } diff --git a/LFSPanel/LFSPanel/src/appmenu.cpp b/LFSPanel/LFSPanel/src/appmenu.cpp index 639e390..b35c2cb 100755 --- a/LFSPanel/LFSPanel/src/appmenu.cpp +++ b/LFSPanel/LFSPanel/src/appmenu.cpp @@ -121,7 +121,7 @@ void addEntries(void) const std::regex expnodisplay("NoDisplay=([^[:space:]]*).*"); const std::regex expcat("Categories=(.*)"); std::smatch m; - const char *iconpath=NULL; + std::string iconpath; asprintf(&homeapps,"%s/.local/share/applications",getenv("HOME")); find->LFSTK_setFindType(FILETYPE); @@ -176,7 +176,7 @@ void addEntries(void) catagoryMenus[catagoryCnt]->subMenuCnt=0; catagoryMenus[catagoryCnt]->label=strdup(myCats[k]); iconpath=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,catImageNames[k],""); - if(iconpath!=NULL) + if(iconpath.length()>0) { catagoryMenus[catagoryCnt]->imageType=FILETHUMB; catagoryMenus[catagoryCnt]->imagePath=iconpath; @@ -207,8 +207,8 @@ void addEntries(void) } else { - iconpath=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,df.icon.c_str(),""); - if(iconpath!=NULL) + iconpath=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,df.icon,""); + if(iconpath.length()>0) { catagoryMenus[catMenusPtr[myCats[k]]]->subMenus[submenunum]->imageType=FILETHUMB; catagoryMenus[catMenusPtr[myCats[k]]]->subMenus[submenunum]->imagePath=iconpath; @@ -233,7 +233,7 @@ void addEntries(void) void addExtras(void) { - char *iconpath=NULL; + std::string iconpath; catagoryMenus[catagoryCnt]=new infoDataStruct; catagoryMenus[catagoryCnt]->label=strdup("--"); @@ -244,7 +244,7 @@ void addExtras(void) catagoryMenus[catagoryCnt]->label=strdup("LFS About"); catagoryMenus[catagoryCnt]->userData=(void*)-1; iconpath=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"help-about",""); - if(iconpath!=NULL) + if(iconpath.length()>0) { catagoryMenus[catagoryCnt]->imagePath=iconpath; catagoryMenus[catagoryCnt]->imageType=FILETHUMB; diff --git a/LFSPanel/LFSPanel/src/globals.cpp b/LFSPanel/LFSPanel/src/globals.cpp index d910a87..af0ac1a 100644 --- a/LFSPanel/LFSPanel/src/globals.cpp +++ b/LFSPanel/LFSPanel/src/globals.cpp @@ -117,7 +117,7 @@ void sendNotify(const char *name,const char *message)//TODO//could be better #endif } -void dropDesktopFile(const char *data,launcherList *launcher) +void dropDesktopFile(const char *data,launcherList *launcher)//TODO// { char *cleanstr; char *command=NULL; @@ -126,7 +126,8 @@ void dropDesktopFile(const char *data,launcherList *launcher) std::string line; while(std::getline(stream,line)) { - cleanstr=apc->globalLib->LFSTK_cleanString((const char*)line.c_str()); + //cleanstr=apc->globalLib->LFSTK_cleanString((const char*)line.c_str()); + cleanstr=strdup(apc->globalLib->LFSTK_cleanString(line).c_str()); if((strrchr(cleanstr,'.')!=NULL) && (strcmp(strrchr(cleanstr,'.'),".desktop")==0)) { asprintf(&command,"mkdir -p '%s/launchers-%s';cp -nP '%s' '%s/launchers-%s'",apc->configDir.c_str(),panelID,cleanstr,apc->configDir.c_str(),panelID); diff --git a/LFSPanel/LFSPanel/src/globals.h b/LFSPanel/LFSPanel/src/globals.h index 64977a3..89bbc7c 100644 --- a/LFSPanel/LFSPanel/src/globals.h +++ b/LFSPanel/LFSPanel/src/globals.h @@ -58,9 +58,9 @@ struct menuEntryStruct struct launcherList { - launcherList *next=NULL; + launcherList *next=NULL; LFSTK_buttonClass *bc=NULL; - char *icon=NULL; + std::string icon; menuEntryStruct entry; }; diff --git a/LFSPanel/LFSPanel/src/launchers.cpp b/LFSPanel/LFSPanel/src/launchers.cpp index fb49e63..51f5f01 100644 --- a/LFSPanel/LFSPanel/src/launchers.cpp +++ b/LFSPanel/LFSPanel/src/launchers.cpp @@ -113,10 +113,9 @@ int launcherBuildCB(const char *fpath,const struct stat *sb,int typeflag) int addLaunchers(int x,int y,int grav,bool fromleft) { - char *launchers; - launcherList *loopll; - ll=NULL; - char *icon=NULL; + char *launchers; + launcherList *loopll; + std::string icon; int xpos=x; int ypos=y; int width=0; @@ -126,6 +125,8 @@ int addLaunchers(int x,int y,int grav,bool fromleft) int maxwidth=0; int sx,sy; + ll=NULL; + asprintf(&launchers,"%s/launchers-%s",apc->configDir.c_str(),panelID); ftw(launchers,launcherBuildCB,16); @@ -137,23 +138,21 @@ int addLaunchers(int x,int y,int grav,bool fromleft) loopll=ll; while(loopll!=NULL) { - icon=NULL; + icon=""; loopll->bc=new LFSTK_buttonClass(mainwind,"",sx,sy,width,height,thisgrav); loopll->bc->LFSTK_setMouseCallBack(NULL,launcherCB,(void*)loopll); loopll->bc->LFSTK_setGadgetDropCallBack(gadgetDrop,(void*)loopll); loopll->bc->gadgetAcceptsDnD=true; - if((loopll->icon!=NULL) && (desktopTheme!=NULL)) + if((loopll->icon.length()>0) && (desktopTheme!=NULL)) icon=apc->globalLib->LFSTK_findThemedIcon(desktopTheme,loopll->icon,""); - if(icon!=NULL) + if(icon.length()>0) loopll->bc->LFSTK_setImageFromPath(icon,LEFT,true); else loopll->bc->LFSTK_setImageFromPath(DATADIR "/pixmaps/command.png",LEFT,true); setGadgetDetails(loopll->bc); - if(icon!=NULL) - free(icon); loopll=loopll->next; if((grav==PANELNORTH) || (grav==PANELSOUTH)) { diff --git a/LFSPanel/LFSPanel/src/logout.cpp b/LFSPanel/LFSPanel/src/logout.cpp index dd43349..34e1e27 100644 --- a/LFSPanel/LFSPanel/src/logout.cpp +++ b/LFSPanel/LFSPanel/src/logout.cpp @@ -74,14 +74,14 @@ bool logoutCB(void *p,void* ud) int addLogout(int x,int y,int grav,bool fromleft) { - char *themedicon=NULL; - char *icon=NULL; - int xpos=x; - int ypos=y; - int width=0; - int height=0; - int thisgrav=grav; - int iconsize=16; + std::string themedicon; + std::string icon; + int xpos=x; + int ypos=y; + int width=0; + int height=0; + int thisgrav=grav; + int iconsize=16; if(logoutButton!=NULL) { @@ -94,11 +94,8 @@ int addLogout(int x,int y,int grav,bool fromleft) logoutButton=new LFSTK_buttonClass(mainwind,"",xpos,ypos,width,height,thisgrav); icon=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,logoutIconNames[NUMLOGOUTENTRYS],""); - if(icon!=NULL) - { - logoutButton->LFSTK_setImageFromPath(icon,LEFT,true); - free(icon); - } + if(icon.length()>0) + logoutButton->LFSTK_setImageFromPath(icon,LEFT,true); else logoutButton->LFSTK_setImageFromPath(DATADIR "/pixmaps/exit.png",LEFT,true); @@ -116,15 +113,10 @@ int addLogout(int x,int y,int grav,bool fromleft) logoutMenus[j]->userData=(void*)(long)j; themedicon=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,logoutIconNames[j],""); - if(themedicon!=NULL) - { - logoutMenus[j]->imagePath=themedicon; - free(themedicon); - } + if(themedicon.length()>0) + logoutMenus[j]->imagePath=themedicon; else - { - logoutMenus[j]->imagePath=logoutImages[j]; - } + logoutMenus[j]->imagePath=logoutImages[j]; logoutMenus[j]->imageType=FILETHUMB; } diff --git a/LFSPanel/LFSPanel/src/main.cpp b/LFSPanel/LFSPanel/src/main.cpp index b9b3678..4f0bc7e 100644 --- a/LFSPanel/LFSPanel/src/main.cpp +++ b/LFSPanel/LFSPanel/src/main.cpp @@ -366,8 +366,6 @@ int main(int argc,char **argv) while(ll!=NULL) { freell=ll; - if(ll->icon!=NULL) - free(ll->icon); if(ll->entry.name!=NULL) free(ll->entry.name); if(ll->entry.exec!=NULL) @@ -399,9 +397,6 @@ int main(int argc,char **argv) delete logoutMenu; delete windowMenu; - free(iconL); - free(iconM); - free(iconH); logoutButton=NULL; diskButton=NULL; clockButton=NULL; diff --git a/LFSPanel/LFSPanel/src/slider.cpp b/LFSPanel/LFSPanel/src/slider.cpp index cc9511c..35bb996 100644 --- a/LFSPanel/LFSPanel/src/slider.cpp +++ b/LFSPanel/LFSPanel/src/slider.cpp @@ -29,10 +29,10 @@ LFSTK_scrollBarClass *vsb=NULL; LFSTK_windowClass *scwindow=NULL; bool windowVisible=false; LFSTK_toggleButtonClass *volumeButton; -char *iconH=NULL; -char *iconM=NULL; -char *iconL=NULL; -char *iconZ=NULL; +std::string iconH; +std::string iconM; +std::string iconL; +std::string iconZ; int oldVolVal=-1; char label[32]; @@ -80,16 +80,16 @@ void setIcon(void) { int vol=vsb->LFSTK_getValue(); - if((iconZ!=NULL) && (vol<16)) + if((iconZ.length()>0) && (vol<16)) volumeButton->LFSTK_setImageFromPath(iconZ,TOOLBAR,true); - if((iconL!=NULL) && (vol>=16) && (vol<32)) + if((iconL.length()>0) && (vol>=16) && (vol<32)) volumeButton->LFSTK_setImageFromPath(iconL,TOOLBAR,true); - if((iconM!=NULL) && (vol>=32) && (vol<48)) + if((iconM.length()>0) && (vol>=32) && (vol<48)) volumeButton->LFSTK_setImageFromPath(iconM,TOOLBAR,true); - if((iconH!=NULL) && (vol>=48)) + if((iconH.length()>0) && (vol>=48)) volumeButton->LFSTK_setImageFromPath(iconH,TOOLBAR,true); } diff --git a/LFSPanel/LFSPanel/src/slider.h b/LFSPanel/LFSPanel/src/slider.h index f50c8ef..44e9a27 100644 --- a/LFSPanel/LFSPanel/src/slider.h +++ b/LFSPanel/LFSPanel/src/slider.h @@ -24,14 +24,14 @@ #define SLIDERWIDTH 100 #define SLIDERLABEL "Vol" -extern LFSTK_windowClass *scwindow; +extern LFSTK_windowClass *scwindow; extern bool windowVisible; extern LFSTK_toggleButtonClass *volumeButton; extern LFSTK_scrollBarClass *vsb; -extern char *iconH; -extern char *iconM; -extern char *iconL; -extern char *iconZ; +extern std::string iconH; +extern std::string iconM; +extern std::string iconL; +extern std::string iconZ; extern int oldVolVal; void setIcon(void); diff --git a/LFSPanel/LFSPanel/src/windowlist.cpp b/LFSPanel/LFSPanel/src/windowlist.cpp index 6aed856..d01f72a 100644 --- a/LFSPanel/LFSPanel/src/windowlist.cpp +++ b/LFSPanel/LFSPanel/src/windowlist.cpp @@ -88,7 +88,7 @@ bool windowAllCB(void *p,void* ud) bool windowAllMenuCB(void *p,void* ud) { - Window winid=0; + Window winid=0; static_cast(p)->wc->LFSTK_hideWindow(); winid=(Window)(ud); @@ -258,7 +258,7 @@ Window doTreeWalk(Window wind,bool thisdesktop) void getCurrentDesktop(void) { - std::string desknum=NULL; + std::string desknum; desknum=mainwind->globalLib->LFSTK_oneLiner("%s","/usr/bin/xprop -root |/bin/grep '_NET_CURRENT_DESKTOP(CARDINAL)'|/bin/head -n1|/usr/bin/awk -F'=' '{print $2}'"); if(desknum.length()>0) @@ -285,13 +285,13 @@ void updateWindowMenu(bool global) int addWindowDeskMenu(int x,int y,int grav,bool fromleft) { - char *icon=NULL; - int xpos=x; - int ypos=y; - int width=0; - int height=0; - int thisgrav=grav; - int iconsize=16; + std::string icon; + int xpos=x; + int ypos=y; + int width=0; + int height=0; + int thisgrav=grav; + int iconsize=16; if(windowDesk!=NULL) { @@ -302,11 +302,8 @@ int addWindowDeskMenu(int x,int y,int grav,bool fromleft) windowDesk=new LFSTK_buttonClass(mainwind,"",xpos,ypos,width,height,thisgrav); icon=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"remote-desktop",""); - if(icon!=NULL) - { - windowDesk->LFSTK_setImageFromPath(icon,LEFT,true); - free(icon); - } + if(icon.length()>0) + windowDesk->LFSTK_setImageFromPath(icon,LEFT,true); else windowDesk->LFSTK_setImageFromPath(DATADIR "/pixmaps/windows.png",LEFT,true); @@ -327,13 +324,13 @@ int addWindowDeskMenu(int x,int y,int grav,bool fromleft) int addWindowMenu(int x,int y,int grav,bool fromleft) { - char *icon=NULL; - int xpos=x; - int ypos=y; - int width=0; - int height=0; - int thisgrav=grav; - int iconsize=16; + std::string icon; + int xpos=x; + int ypos=y; + int width=0; + int height=0; + int thisgrav=grav; + int iconsize=16; if(windowAll!=NULL) { @@ -347,11 +344,8 @@ int addWindowMenu(int x,int y,int grav,bool fromleft) setGadgetDetails(windowAll); - if(icon!=NULL) - { - windowAll->LFSTK_setImageFromPath(icon,LEFT,true); - free(icon); - } + if(icon.length()>0) + windowAll->LFSTK_setImageFromPath(icon,LEFT,true); else windowAll->LFSTK_setImageFromPath(DATADIR "/pixmaps/windows.png",LEFT,true); diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog index 27f688e..3f7599a 100644 --- a/LFSToolKit/ChangeLog +++ b/LFSToolKit/ChangeLog @@ -1,4 +1,5 @@ 0.6.1 +Mose code cleaning... Set default whitespace for LFSTK_strStrip. Renoved some leaky glib code. Updated LFSTK_strStrip whitespace to include \n & \r. diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp index 51be315..a339666 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp @@ -1416,7 +1416,7 @@ cairo_status_t LFSTK_gadgetClass::LFSTK_setImageFromPath(std::string file,int or tempimage=this->wc->globalLib->LFSTK_cairo_image_surface_create_from_jpeg(file.c_str()); if(tempimage==NULL) { - fprintf(stderr,"Unkown Format : %s\n",file); + fprintf(stderr,"Unkown Format : %s\n",file.c_str()); return(CAIRO_STATUS_INVALID_FORMAT); } } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp index ac16607..106f66d 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp @@ -547,34 +547,35 @@ void LFSTK_lib::LFSTK_setUseTheme(bool use) * \param theme Theme name ( case sensitive ). * \param icon Icon name ( case insensitive ). * \param catagory Catagory or "" NOT NULL ( case insensitive ). -* \return char* string caller should free. -* \note returned string is set to NULL on error. +* \return std::string. +* \note returned string is set to "" if icon not found. */ #define GLOBALICONS 0 #define GLOBALPIXMAPS 2 #define GLOBALPIXMAPSEND 5 -char* LFSTK_lib::LFSTK_findThemedIcon(const char *theme,const char *icon,const char *catagory) +/** +* Find a themed icon. +* \param std::string theme. +* \param std::string icon. +* \param std::string catagory ( or "" for any cat ). +* \return std::string path to themed icon or "". +*/std::string LFSTK_lib::LFSTK_findThemedIcon(std::string theme,std::string icon,std::string catagory) { - char *iconpath=NULL; - const char *iconthemes[3]; - const char *iconfolders[GLOBALPIXMAPSEND]; - bool maskdot=false; - char *holdicon=NULL; - - if(icon[0]=='/') - return(strdup(icon)); + std::string thetheme; + const char *iconthemes[3]; + const char *iconfolders[GLOBALPIXMAPSEND]; + std::string iconpath=""; - holdicon=strdup(icon); - if(strcasecmp(&holdicon[strlen(holdicon)-4],".png")==0) - { - maskdot=true; - holdicon[strlen(holdicon)-4]=0; - } - if(theme==NULL) - theme="gnome"; - - iconthemes[0]=theme; + if(icon.at(0)=='/') + return(icon); + + if(theme.length()==0) + thetheme="gnome"; + else + thetheme=theme; + + iconthemes[0]=thetheme.c_str(); iconthemes[1]="hicolor"; iconthemes[2]="gnome"; @@ -585,37 +586,29 @@ char* LFSTK_lib::LFSTK_findThemedIcon(const char *theme,const char *icon,const c iconfolders[3]="/usr/share/icons/hicolor"; iconfolders[4]="~/.local/share/icons"; - iconpath=NULL; for(int j=GLOBALICONS;jLFSTK_oneLiner("find %s/\"%s\"/*/%s -iname '*%s.png' 2>/dev/null|sort --version-sort|tail -n1 2>/dev/null",iconfolders[j],iconthemes[k],catagory,holdicon).c_str()); + { + iconpath=this->LFSTK_oneLiner("find %s/\"%s\"/*/%s -iname '*%s.png' 2>/dev/null|sort --version-sort|tail -n1 2>/dev/null",iconfolders[j],iconthemes[k],catagory.c_str(),icon.c_str()); - if((iconpath!=NULL) && (strlen(iconpath)>1)) + if(iconpath.length()>1) goto breakReturn; - //if(iconpath!=NULL) - freeAndNull(&iconpath); - //iconpath=NULL; } } - if(iconpath==NULL) + if(iconpath.length()==0) { for(int j=GLOBALPIXMAPS;jLFSTK_oneLiner("find %s -iname '*%s.*'",iconfolders[j],holdicon).c_str()); - if((iconpath!=NULL) && (strlen(iconpath)>1)) + iconpath=this->LFSTK_oneLiner("find %s -iname '*%s*'",iconfolders[j],icon.c_str()); + if(iconpath.length()>1) goto breakReturn; - if(iconpath!=NULL) - freeAndNull(&iconpath); - iconpath=NULL; } } + iconpath=""; breakReturn: - freeAndNull(&holdicon); - //freeAndNull(&iconpath); return(iconpath); } @@ -1029,34 +1022,6 @@ void LFSTK_lib::LFSTK_setThemePath(char *path) this->prefs.LFSTK_setString("themepath",path); } -/** -* Clean up string. -* \param const char *str. -* \return char* Cleaned string. -* \note uri translated to local files. -* \note strings are cleaned of white space at front and back. -* \note returned string should be freed by caller. -*/ -char* LFSTK_lib::LFSTK_cleanString(const char *str) -{ - gchar *t; - std::string cleanedstr; - char *uristr=g_uri_parse_scheme(str); - - if(uristr!=NULL) - { - t=g_filename_from_uri(str,NULL,NULL); - cleanedstr=LFSTK_UtilityClass::LFSTK_strStrip(t); - g_free(t); - } - else - { - cleanedstr=LFSTK_UtilityClass::LFSTK_strStrip(str); - } - freeAndNull(&uristr); - return(strdup(cleanedstr.c_str())); -} - /** * Clean up string. * \param const char *str. @@ -1162,10 +1127,10 @@ void LFSTK_lib::LFSTK_getFileInfo(const char* path,fileInformation* info) { struct stat sb; GError *error; - char *icon=NULL; std::string data; size_t pos; std::string th; + std::string ic; if(lstat(path,&sb)==-1) { @@ -1189,9 +1154,7 @@ void LFSTK_lib::LFSTK_getFileInfo(const char* path,fileInformation* info) info->isDir=true; info->fileMode=sb.st_mode & 07777; info->themeName=this->desktopIconTheme; - icon=this->LFSTK_findThemedIcon(info->themeName.c_str(),"application-octet-stream",""); - info->iconPath=icon; - freeAndNull(&icon); + info->iconPath=this->LFSTK_findThemedIcon(info->themeName,"application-octet-stream",""); return; } @@ -1219,22 +1182,16 @@ void LFSTK_lib::LFSTK_getFileInfo(const char* path,fileInformation* info) } info->themeName=this->desktopIconTheme; - icon=this->LFSTK_findThemedIcon(info->themeName.c_str(),data.c_str(),""); - if(icon!=NULL) + ic=this->LFSTK_findThemedIcon(info->themeName,data,""); + if(ic.length()>0) { - info->iconPath=icon; - freeAndNull(&icon); + info->iconPath=ic; } else { data=info->mimeType; pos=data.find("/"); - icon=this->LFSTK_findThemedIcon(info->themeName.c_str(),data.erase(pos,std::string::npos).c_str(),""); - if(icon!=NULL) - { - info->iconPath=icon; - freeAndNull(&icon); - } + info->iconPath=this->LFSTK_findThemedIcon(info->themeName,data.erase(pos,std::string::npos),""); } if(strcasecmp(&path[strlen(path)-8],".desktop")==0) @@ -1246,13 +1203,8 @@ void LFSTK_lib::LFSTK_getFileInfo(const char* path,fileInformation* info) char *iiconpath=g_key_file_get_value(kf,"Desktop Entry",G_KEY_FILE_DESKTOP_KEY_ICON,NULL); if(iiconpath!=NULL) { - iconpath=this->LFSTK_findThemedIcon(this->desktopIconTheme.c_str(),iiconpath,""); - if(iconpath!=NULL) - { - info->iconPath=iconpath; - freeAndNull(&iconpath); - } - freeAndNull(&iiconpath); + info->iconPath=this->LFSTK_findThemedIcon(this->desktopIconTheme,iiconpath,""); + g_free(iiconpath); } g_key_file_free(kf); } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.h index 71baacd..4d85028 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.h @@ -53,7 +53,7 @@ class LFSTK_lib const char *bestFontColour(long pixel); static bool LFSTK_gadgetEvent(void *self,XEvent *e,int type); - char *LFSTK_findThemedIcon(const char *theme,const char *icon,const char *catagory); + std::string LFSTK_findThemedIcon(std::string theme,std::string icon,std::string catagory); bool LFSTK_pointInRect(pointStruct *point,geometryStruct *geom); unsigned long LFSTK_getColourFromName(Display *display,Colormap cm,const char *name); @@ -79,7 +79,7 @@ class LFSTK_lib void LFSTK_loadDesktopIconTheme(void); //utils - char *LFSTK_cleanString(const char *str); + //char *LFSTK_cleanString(const char *str); std::string LFSTK_cleanString(std::string str); propReturn LFSTK_getSingleProp(Display *display,Window win,Atom prop,Atom wanttype); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp index aa6f09d..c0068cd 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp @@ -560,10 +560,9 @@ void LFSTK_lineEditClass::LFSTK_dropData(propertyStruct* data) if(strcasecmp(data->mimeType,"text/uri-list")==0) { - char *ret; - ret=this->wc->app->globalLib->LFSTK_cleanString((const char*)data->data); - this->LFSTK_setFormatedText((const char*)ret,true); - freeAndNull(&ret); + std::string ret; + ret=this->wc->app->globalLib->LFSTK_cleanString(std::string((const char*)data->data)); + this->LFSTK_setFormatedText(ret,true); } if(this->callBacks.validCallbacks & GADGETDROPCB) @@ -575,7 +574,7 @@ void LFSTK_lineEditClass::LFSTK_dropData(propertyStruct* data) * \param const char* Text to be formated. * \param bool true=Replace contents, false=insert. */ -void LFSTK_lineEditClass::LFSTK_setFormatedText(std::string txt,bool replace) +void LFSTK_lineEditClass::LFSTK_setFormatedText(std::string txt,bool replace)//TODO// { std::string formtxt=""; int len=0; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp index a609a48..f3df11f 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp @@ -553,10 +553,9 @@ void LFSTK_multiLineEditClass::LFSTK_dropData(propertyStruct* data) if(strcasecmp(data->mimeType,"text/uri-list")==0) { - char *ret; - ret=this->wc->app->globalLib->LFSTK_cleanString((const char*)data->data); - this->LFSTK_setFormatedText((const char*)ret,true); - freeAndNull(&ret); + std::string r1; + r1=this->wc->app->globalLib->LFSTK_cleanString((const char*)data->data); + this->LFSTK_setFormatedText((const char*)r1.c_str(),true); } if(this->callBacks.validCallbacks & GADGETDROPCB) diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp index f4b302e..517288f 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp @@ -1221,8 +1221,8 @@ void LFSTK_windowClass::LFSTK_dropData(propertyStruct* data) if(strcasecmp(data->mimeType,"text/uri-list")==0) { - char *ret; - ret=this->app->globalLib->LFSTK_cleanString((const char*)data->data); + char *ret; + ret=strdup(this->app->globalLib->LFSTK_cleanString(std::string((const char*)data->data)).c_str());//TODO//LEAVE this->droppedData.type=DROPURI; this->droppedData.data=ret; } diff --git a/LFSToolKit/examples/geticonpath.cpp b/LFSToolKit/examples/geticonpath.cpp index ad77aac..28c93ba 100755 --- a/LFSToolKit/examples/geticonpath.cpp +++ b/LFSToolKit/examples/geticonpath.cpp @@ -39,16 +39,15 @@ bool doQuit(void *p,void* ud) bool getPath(void *p,void* ud) { - char *iconpath=NULL; fileInformation fileinfo; + std::string iconpath; apc->globalLib->LFSTK_loadDesktopIconTheme(); - iconpath=(char*)apc->globalLib->LFSTK_findThemedIcon(apc->iconThemeName.c_str(),mimeEdit->LFSTK_getCStr(),""); - if(iconpath!=NULL) + iconpath=apc->globalLib->LFSTK_findThemedIcon(apc->iconThemeName,mimeEdit->LFSTK_getBuffer(),""); + if(iconpath.length()>1) { - printf("iconpath=%s\n",iconpath); - free(iconpath); + printf("iconpath=%s\n",iconpath.c_str()); } else printf("No icon found for '%s' in '%s'\n",mimeEdit->LFSTK_getCStr(),fileInfoEdit->LFSTK_getCStr()); diff --git a/LFSToolKit/examples/image.cpp b/LFSToolKit/examples/image.cpp index 88b87e9..41ac0fb 100755 --- a/LFSToolKit/examples/image.cpp +++ b/LFSToolKit/examples/image.cpp @@ -34,7 +34,8 @@ LFSTK_imageClass *tux; const char *diskLabelData[]={"Mount","Unmount","Eject","Open","Custom Icon","Remove Icon",NULL}; const char *diskThemeIconData[]={"drive-harddisk","media-eject","media-eject","document-open","list-add","list-remove"}; -char *iconpath=NULL; +//char *iconpath=NULL; +std::string iconpath; LFSTK_windowClass *diskWindow=NULL; LFSTK_buttonClass *diskButtons[NOMOREBUTONS]; bool sticky=false; @@ -165,7 +166,6 @@ int main(int argc, char **argv) win->w=200; win->h=200; win->wc=wc; - //win->windowType="_NET_WM_WINDOW_TYPE_MENU"; win->windowType=apc->appAtomsHashed.at(apc->globalLib->prefs.LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_TOOL")); win->decorated=false; @@ -182,7 +182,6 @@ int main(int argc, char **argv) diskButtons[j]->LFSTK_setMouseCallBack(NULL,contextCB,(void*)(long)(j+1)); iconpath=diskWindow->globalLib->LFSTK_findThemedIcon("gnome",diskThemeIconData[j],""); diskButtons[j]->LFSTK_setImageFromPath(iconpath,LEFT,true); - free(iconpath); sy+=GADGETHITE; } diskWindow->LFSTK_resizeWindow(GADGETWIDTH+GADGETHITE,sy,true); diff --git a/LFSToolKit/examples/toggle.cpp b/LFSToolKit/examples/toggle.cpp index 1c068da..86b7fbd 100755 --- a/LFSToolKit/examples/toggle.cpp +++ b/LFSToolKit/examples/toggle.cpp @@ -28,9 +28,12 @@ LFSTK_toggleButtonClass *check=NULL; LFSTK_toggleButtonClass *toggle=NULL; LFSTK_buttonClass *seperator=NULL; LFSTK_buttonClass *quit=NULL; -char *iconH=NULL; -char *iconM=NULL; -char *iconL=NULL; +//char *iconH=NULL; +//char *iconM=NULL; +//char *iconL=NULL; +std::string iconH; +std::string iconM; +std::string iconL; LFSTK_windowClass *scwindow; @@ -129,9 +132,6 @@ int main(int argc, char **argv) iconH=apc->globalLib->LFSTK_findThemedIcon("gnome","volume-high",""); toggle->LFSTK_setImageFromPath(iconH,TOOLBAR,true); - //toggle->gadgetDetails.showBroken=true; - //toggle->gadgetDetails.showLink=true; - free(iconH); sy+=YSPACING*3; windowInitStruct *win; @@ -141,19 +141,13 @@ int main(int argc, char **argv) win->y=100; win->w=16; win->h=100; - //win->wc=wc; -// win->windowType="_NET_WM_WINDOW_TYPE_DOCK"; win->decorated=false; win->overRide=true; -// win->level=ABOVEALL; win->app=apc; win->windowType=apc->appAtomsHashed.at(apc->globalLib->prefs.LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_TOOL")); apc->LFSTK_addToolWindow(win); scwindow=apc->windows->back().window;//TODO// - //XReparentWindow(apc->display,scwindow->window,wc->window,20,20); - vsb=new LFSTK_scrollBarClass(scwindow,true,0,0,16,100); - vsb->LFSTK_setValue(1); //toggle->LFSTK_setContextWindow(scwindow);