From 3daa2162f4e32f7228fe72bec44a4f06be02931f Mon Sep 17 00:00:00 2001 From: K D Hedger Date: Sat, 18 Nov 2023 16:24:03 +0000 Subject: [PATCH] vairous fixes see changelog ... --- .../LFSApplications/src/lfsappearance.cpp | 18 +-- .../LFSApplications/src/lfsbackdropprefs.cpp | 8 +- .../LFSApplications/src/lfsdesktopprefs.cpp | 5 +- .../LFSApplications/src/lfspanelprefs.cpp | 8 +- .../LFSApplications/src/lfsruncommand.cpp | 4 +- .../LFSApplications/src/lfstkprefs.cpp | 4 +- .../LFSApplications/src/lfswm2prefs.cpp | 4 +- .../LFSApplications/src/lfswmprefs.cpp | 4 +- LFSDesktop/LFSDesktop/src/disks.cpp | 2 +- LFSDesktop/LFSDesktop/src/main.cpp | 6 +- LFSDock/ChangeLog | 9 ++ LFSDock/LFSDock/src/callbacks.cpp | 52 ++++++++ LFSDock/LFSDock/src/callbacks.h | 3 +- LFSDock/LFSDock/src/clock.cpp | 20 +-- LFSDock/LFSDock/src/clock.h | 2 +- LFSDock/LFSDock/src/globals.cpp | 69 ++++------ LFSDock/LFSDock/src/globals.h | 35 +++-- LFSDock/LFSDock/src/launchers.cpp | 62 ++------- LFSDock/LFSDock/src/main.cpp | 123 ++++++++++-------- LFSDock/LFSDock/src/slider.cpp | 21 +-- LFSDock/configure.ac | 2 +- LFSPanel/ChangeLog | 1 + LFSPanel/LFSPanel/src/callbacks.cpp | 42 ------ LFSPanel/LFSPanel/src/callbacks.h | 1 - LFSPanel/LFSPanel/src/globals.cpp | 2 +- LFSPanel/LFSPanel/src/launchers.cpp | 2 +- LFSPanel/LFSPanel/src/main.cpp | 16 ++- LFSToolKit/ChangeLog | 1 + .../LFSToolKit/lfstk/LFSTKApplication.cpp | 10 +- .../LFSToolKit/lfstk/LFSTKApplication.h | 6 +- .../LFSToolKit/lfstk/LFSTKFileDialog.cpp | 10 +- LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp | 3 +- LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h | 2 + LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp | 19 +-- LFSToolKit/examples/dialogs.cpp | 2 +- LFSToolKit/examples/geticonpath.cpp | 2 +- LFSToolKit/examples/lfsruncommand.cpp | 2 +- LFSToolKit/examples/subwindowtest.cpp | 6 +- 38 files changed, 273 insertions(+), 315 deletions(-) diff --git a/LFSApplications/LFSApplications/src/lfsappearance.cpp b/LFSApplications/LFSApplications/src/lfsappearance.cpp index dde7690..6e66e24 100644 --- a/LFSApplications/LFSApplications/src/lfsappearance.cpp +++ b/LFSApplications/LFSApplications/src/lfsappearance.cpp @@ -113,16 +113,16 @@ void makeGroup(const char *grpname) char *grp; char *command; - asprintf(&grp,"%s/lfsgroupsprefs/%s",apc->configDir,grpname); + asprintf(&grp,"%s/lfsgroupsprefs/%s",apc->configDir.c_str(),grpname); if(fileExists(grp)!=0) mkdir(grp,0755); - asprintf(&command,"cp \"%s\"/lfs*.rc \"%s\"",apc->configDir,grp); + asprintf(&command,"cp \"%s\"/lfs*.rc \"%s\"",apc->configDir.c_str(),grp); system(command); free(command); free(grp); - asprintf(&command,"echo -e \"%s\n%s\" > \"%s/lfsappearance.rc\"",currentSet->LFSTK_getCStr(),key->LFSTK_getCStr(),apc->configDir); + asprintf(&command,"echo -e \"%s\n%s\" > \"%s/lfsappearance.rc\"",currentSet->LFSTK_getCStr(),key->LFSTK_getCStr(),apc->configDir.c_str()); system(command); free(command); } @@ -132,16 +132,16 @@ void setGroup(void) char *command; char *grp; - asprintf(&grp,"%s/lfsgroupsprefs/%s",apc->configDir,currentSet->LFSTK_getCStr()); + asprintf(&grp,"%s/lfsgroupsprefs/%s",apc->configDir.c_str(),currentSet->LFSTK_getCStr()); if(fileExists(grp)==0) { - asprintf(&command,"cp \"%s/lfsgroupsprefs/%s/\"lfs*.rc \"%s\"",apc->configDir,currentSet->LFSTK_getCStr(),apc->configDir); + asprintf(&command,"cp \"%s/lfsgroupsprefs/%s/\"lfs*.rc \"%s\"",apc->configDir.c_str(),currentSet->LFSTK_getCStr(),apc->configDir.c_str()); system(command); free(command); } free(grp); - asprintf(&command,"echo -e \"%s\n%s\" > \"%s/lfsappearance.rc\"",currentSet->LFSTK_getCStr(),key->LFSTK_getCStr(),apc->configDir); + asprintf(&command,"echo -e \"%s\n%s\" > \"%s/lfsappearance.rc\"",currentSet->LFSTK_getCStr(),key->LFSTK_getCStr(),apc->configDir.c_str()); system(command); free(command); } @@ -217,7 +217,7 @@ void addGroup(void) char *command; int menucnt; - asprintf(&command,"%s/lfsgroupsprefs",apc->configDir); + asprintf(&command,"%s/lfsgroupsprefs",apc->configDir.c_str()); find->LFSTK_findFiles(command,false); find->LFSTK_sortByName(); @@ -363,14 +363,14 @@ int main(int argc, char **argv) setMenu->LFSTK_setMouseCallBack(NULL,menuCB,NULL); setMenu->LFSTK_addMainMenus(groupNameMenuItems,find->LFSTK_getDataCount()+2); - buffer=wc->globalLib->LFSTK_oneLiner("sed -n '1p' %s/lfsappearance.rc",apc->configDir); + buffer=wc->globalLib->LFSTK_oneLiner("sed -n '1p' %s/lfsappearance.rc",apc->configDir.c_str()); currentSet=new LFSTK_lineEditClass(wc,buffer,BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,BUTTONGRAV); hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,currentSet}); free(buffer); sy+=YSPACING; //msg key - buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); launchLabel=new LFSTK_labelClass(wc,"Msg Key",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT); hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchLabel}); key=new LFSTK_lineEditClass(wc,buffer,BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,BUTTONGRAV); diff --git a/LFSApplications/LFSApplications/src/lfsbackdropprefs.cpp b/LFSApplications/LFSApplications/src/lfsbackdropprefs.cpp index 80a643e..017698c 100644 --- a/LFSApplications/LFSApplications/src/lfsbackdropprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfsbackdropprefs.cpp @@ -221,7 +221,7 @@ void loadMonitorInfo(void) int numchars; size_t n; - asprintf(&monitorrc,"%s/lfsmonitors.rc",apc->configDir); + asprintf(&monitorrc,"%s/lfsmonitors.rc",apc->configDir.c_str()); fd=fopen(monitorrc,"r"); if(fd!=NULL) { @@ -296,8 +296,8 @@ int main(int argc, char **argv) wc=apc->mainWindow; asprintf(&wd,"%s",apc->userHome); - asprintf(&mainPrefs,"%s/lfssetwallpaper.rc",apc->configDir); - asprintf(&monitorPrefs,"%s/lfsmonitors.rc",apc->configDir); + asprintf(&mainPrefs,"%s/lfssetwallpaper.rc",apc->configDir.c_str()); + asprintf(&monitorPrefs,"%s/lfsmonitors.rc",apc->configDir.c_str()); fileDialog=new LFSTK_fileDialogClass(wc,"Select File",NULL,FILEDIALOG,"lfsbackdropprefs"); @@ -423,7 +423,7 @@ int main(int argc, char **argv) if(parentWindow!=-1) wc->LFSTK_setTransientFor(parentWindow); - buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); if((queueID=msgget(atoi(buffer),IPC_CREAT|0660))==-1) fprintf(stderr,"Can't create message queue :( ...\n"); free(buffer); diff --git a/LFSApplications/LFSApplications/src/lfsdesktopprefs.cpp b/LFSApplications/LFSApplications/src/lfsdesktopprefs.cpp index 4d29433..374dc7f 100644 --- a/LFSApplications/LFSApplications/src/lfsdesktopprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfsdesktopprefs.cpp @@ -221,8 +221,7 @@ int main(int argc, char **argv) {prefs.LFSTK_hashFromKey("doubleclickexe"),{TYPEBOOL,"doubleclickexe","",false,0}} }; - - asprintf(&envFile,"%s/lfsdesktop.rc",apc->configDir); + asprintf(&envFile,"%s/lfsdesktop.rc",apc->configDir.c_str()); prefs.LFSTK_loadVarsFromFile(envFile); copyrite=new LFSTK_labelClass(wc,COPYRITE,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE); @@ -326,7 +325,7 @@ int main(int argc, char **argv) if(parentWindow!=-1) wc->LFSTK_setTransientFor(parentWindow); - buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); if((queueID=msgget(atoi(buffer),IPC_CREAT|0660))==-1) fprintf(stderr,"Can't create message queue :( ...\n"); free(buffer); diff --git a/LFSApplications/LFSApplications/src/lfspanelprefs.cpp b/LFSApplications/LFSApplications/src/lfspanelprefs.cpp index 578e577..8b03f22 100644 --- a/LFSApplications/LFSApplications/src/lfspanelprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfspanelprefs.cpp @@ -179,7 +179,7 @@ bool applyCB(void *p,void* ud) } getEdits(); - asprintf(&env,"%s/%s",apc->configDir,panelNameEdit->LFSTK_getCStr()); + asprintf(&env,"%s/%s",apc->configDir.c_str(),panelNameEdit->LFSTK_getCStr()); //wc->globalLib->LFSTK_saveVarsToFile(env,panelPrefs); prefs.LFSTK_saveVarsToFile(env); //prefs.LFSTK_saveVarsToFile("-"); @@ -230,7 +230,7 @@ void getPrefs(void) {prefs.LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","black",false,0}}, }; - asprintf(&env,"%s/%s",apc->configDir,panelNameEdit->LFSTK_getCStr()); + asprintf(&env,"%s/%s",apc->configDir.c_str(),panelNameEdit->LFSTK_getCStr()); prefs.LFSTK_loadVarsFromFile(env); free(env); } @@ -314,7 +314,7 @@ int main(int argc, char **argv) //panel menus //temp fix char *touchpanel; - asprintf(&touchpanel,"touch %s/lfspanel.rc",apc->configDir); + asprintf(&touchpanel,"touch %s/lfspanel.rc",apc->configDir.c_str()); system(touchpanel); free(touchpanel); @@ -323,7 +323,7 @@ int main(int argc, char **argv) find->LFSTK_setIgnoreBroken(true); find->LFSTK_setSort(false); find->LFSTK_setFileTypes("lfspanel"); - find->LFSTK_findFiles(apc->configDir,false); + find->LFSTK_findFiles(apc->configDir.c_str(),false); find->LFSTK_sortByName(); panelCnt=find->LFSTK_getDataCount(); diff --git a/LFSApplications/LFSApplications/src/lfsruncommand.cpp b/LFSApplications/LFSApplications/src/lfsruncommand.cpp index ec0e512..6a9c202 100755 --- a/LFSApplications/LFSApplications/src/lfsruncommand.cpp +++ b/LFSApplications/LFSApplications/src/lfsruncommand.cpp @@ -94,7 +94,7 @@ int main(int argc, char **argv) list=list=new LFSTK_listGadgetClass(wc,"",BORDER,sy,DIALOGWIDTH-(BORDER*2)-LGAP,LISTHITE); - thist=wc->globalLib->LFSTK_oneLiner("head -n1 '%s/%s'",apc->configDir,"command.max"); + thist=wc->globalLib->LFSTK_oneLiner("head -n1 '%s/%s'",apc->configDir.c_str(),"command.max"); maxHistory=MAXHISTORY; if((thist!=NULL) && (thist[0]!=0)) @@ -106,7 +106,7 @@ int main(int argc, char **argv) if(argv[1]!=NULL) maxHistory=atoi(argv[1]); - asprintf(&commandfile,"%s/%s",apc->configDir,"command.hist"); + asprintf(&commandfile,"%s/%s",apc->configDir.c_str(),"command.hist"); list->LFSTK_setListFromFile(commandfile,false); list->LFSTK_setMouseCallBack(NULL,select,NULL); sy+=LISTHITE+8; diff --git a/LFSApplications/LFSApplications/src/lfstkprefs.cpp b/LFSApplications/LFSApplications/src/lfstkprefs.cpp index 29a025c..f416040 100644 --- a/LFSApplications/LFSApplications/src/lfstkprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfstkprefs.cpp @@ -527,14 +527,14 @@ int main(int argc, char **argv) apc->LFSTK_addWindow(NULL,BOXLABEL); wc=apc->mainWindow; - command=apc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + command=apc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); key=atoi(command); freeAndNull(&command); if((queueID=msgget(key,IPC_CREAT|0660))==-1) fprintf(stderr,"Can't create message queue\n"); - wd=strdup(apc->configDir); + wd=strdup(apc->configDir.c_str()); tileDialog=new LFSTK_fileDialogClass(wc,"Select File",wd,false); copyrite=new LFSTK_labelClass(wc,COPYRITE,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE); diff --git a/LFSApplications/LFSApplications/src/lfswm2prefs.cpp b/LFSApplications/LFSApplications/src/lfswm2prefs.cpp index ba563ba..216a2a6 100644 --- a/LFSApplications/LFSApplications/src/lfswm2prefs.cpp +++ b/LFSApplications/LFSApplications/src/lfswm2prefs.cpp @@ -379,7 +379,7 @@ int main(int argc, char **argv) apc->LFSTK_addWindow(NULL,BOXLABEL); wc=apc->mainWindow; - buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); if((queueID=msgget(atoi(buffer),IPC_CREAT|0660))==-1) fprintf(stderr,"Can't create message queue :( ...\n"); free(buffer); @@ -412,7 +412,7 @@ int main(int argc, char **argv) {prefs.LFSTK_hashFromKey("framealpha"),{TYPEINT,"framealpha","",false,255}} }; - asprintf(&envFile,"%s/lfswm2.rc",apc->configDir); + asprintf(&envFile,"%s/lfswm2.rc",apc->configDir.c_str()); prefs.LFSTK_loadVarsFromFile(envFile); prefsPlacementTemp=prefs.LFSTK_getInt("placement"); diff --git a/LFSApplications/LFSApplications/src/lfswmprefs.cpp b/LFSApplications/LFSApplications/src/lfswmprefs.cpp index 50a642e..b615dd5 100644 --- a/LFSApplications/LFSApplications/src/lfswmprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfswmprefs.cpp @@ -239,7 +239,7 @@ int main(int argc, char **argv) apc->LFSTK_addWindow(NULL,BOXLABEL); wc=apc->mainWindow; - buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); if((queueID=msgget(atoi(buffer),IPC_CREAT|0660))==-1) fprintf(stderr,"Can't create message queue :( ...\n"); free(buffer); @@ -266,7 +266,7 @@ int main(int argc, char **argv) {prefs.LFSTK_hashFromKey("rescanprefs"),{TYPEINT,"rescanprefs","",false,4}}, }; - asprintf(&envFile,"%s/lfswmanager.rc",apc->configDir); + asprintf(&envFile,"%s/lfswmanager.rc",apc->configDir.c_str()); prefs.LFSTK_loadVarsFromFile(envFile); prefsPlacementTemp=prefs.LFSTK_getInt("placement"); diff --git a/LFSDesktop/LFSDesktop/src/disks.cpp b/LFSDesktop/LFSDesktop/src/disks.cpp index 04afc4a..a93bfd1 100644 --- a/LFSDesktop/LFSDesktop/src/disks.cpp +++ b/LFSDesktop/LFSDesktop/src/disks.cpp @@ -239,7 +239,7 @@ continueWithLoop: for(unsigned j=0;jglobalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + command=apc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); key=atoi(command); freeAndNull(&command); @@ -180,7 +180,7 @@ Atom xa_prop[3]; #endif apc->globalLib->LFSTK_setUseTheme(false); wc->LFSTK_setWindowPixmap(apc->globalLib->LFSTK_getWindowPixmap(apc->display,apc->rootWindow),apc->displayWidth,apc->displayHeight); - asprintf(&cachePath,"%s/lfsdesktop/cache",apc->configDir); + asprintf(&cachePath,"%s/lfsdesktop/cache",apc->configDir.c_str()); asprintf(&command,"mkdir -p %s 2>&1 >/dev/null",cachePath); system(command); free(command); @@ -190,7 +190,7 @@ apc->globalLib->LFSTK_setUseTheme(false); asprintf(&documentsPath,"%s/Documents",getenv("HOME")); mkdir(documentsPath,0755); - asprintf(&prefsPath,"%s/lfsdesktop.rc",apc->configDir); + asprintf(&prefsPath,"%s/lfsdesktop.rc",apc->configDir.c_str()); loadPrefs(); diff --git a/LFSDock/ChangeLog b/LFSDock/ChangeLog index 1f88f46..5c3325b 100644 --- a/LFSDock/ChangeLog +++ b/LFSDock/ChangeLog @@ -1,3 +1,12 @@ 0.1.0 +Prefs file is ~/.config/LFS/lfsdock.rc +Tweaked prefs name. +Removed unused defines. +Fixed stting absolute position. +Fixed clock. +Set font details. +Dock can only be north or south gravity. +Dock size now set to 32, 48, 64 or 128. +Removed unused code. Script updates. First commit of lfsdock. \ No newline at end of file diff --git a/LFSDock/LFSDock/src/callbacks.cpp b/LFSDock/LFSDock/src/callbacks.cpp index dc1950e..111d2ca 100644 --- a/LFSDock/LFSDock/src/callbacks.cpp +++ b/LFSDock/LFSDock/src/callbacks.cpp @@ -113,3 +113,55 @@ void readMsg(void) } buffer.mText[0]=0; } + +bool exitCB(LFSTK_gadgetClass*p,void* ud) +{ + if(ud!=NULL) + { + launcherList *ll; + ll=(launcherList*)ud; + geometryStruct geom2; + int adj; +adj=extraSpace*posMultiplier; +// if(posMultiplier==-1) +// adj=-extraSpace; +// else +// adj=extraSpace; + //printf(">>>Mouse Out %s<<<\n",ll->entry.name); + p->LFSTK_getGeom(&geom2); + p->LFSTK_moveGadget(geom2.x,geom2.y+adj); + popWindow->LFSTK_hideWindow(); + } + return(true); +} + +bool moveCB(LFSTK_gadgetClass*p,void* ud) +{ + if(ud!=NULL) + { + geometryStruct geom; + launcherList *ll; + int width; + int adj; + + adj=extraSpace*posMultiplier; + ll=(launcherList*)ud; + +// printf(">>>Mouse In %s<<<\n",ll->entry.name); + p->LFSTK_getGeom(&geom); + p->LFSTK_moveGadget(geom.x,geom.y-adj); + popLabel->LFSTK_setLabel(ll->entry.name); + popLabel->LFSTK_setFontString(prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("font")),true); + width=popLabel->LFSTK_getTextRealWidth(ll->entry.name); + popWindow->LFSTK_resizeWindow(width,GADGETHITE); + p->LFSTK_getGeomWindowRelative(&geom,apc->rootWindow); + + if(posMultiplier==1) + popWindow->LFSTK_moveWindow(geom.x-(width/2)+(geom.w/2),geom.y-(GADGETHITE),true); + else + popWindow->LFSTK_moveWindow(geom.x-(width/2)+(geom.w/2),iconSize+extraSpace,true); + popWindow->LFSTK_showWindow(); + popWindow->LFSTK_clearWindow(true); + } + return(true); +} diff --git a/LFSDock/LFSDock/src/callbacks.h b/LFSDock/LFSDock/src/callbacks.h index fb04fc4..bb91fec 100644 --- a/LFSDock/LFSDock/src/callbacks.h +++ b/LFSDock/LFSDock/src/callbacks.h @@ -25,5 +25,6 @@ bool launcherCB(void *p,void* ud); bool gadgetDrop(void *lwc,propertyStruct *data,void* ud); bool timerCB(LFSTK_applicationClass *p,void* ud); void readMsg(void); - +bool exitCB(LFSTK_gadgetClass*p,void* ud); +bool moveCB(LFSTK_gadgetClass*p,void* ud); #endif diff --git a/LFSDock/LFSDock/src/clock.cpp b/LFSDock/LFSDock/src/clock.cpp index 16e617e..3b9f454 100644 --- a/LFSDock/LFSDock/src/clock.cpp +++ b/LFSDock/LFSDock/src/clock.cpp @@ -24,7 +24,8 @@ #include "globals.h" -LFSTK_labelClass *clockButton=NULL; +//LFSTK_labelClass *clockButton=NULL; +LFSTK_buttonClass *clockButton=NULL; void updateClock(void) { @@ -42,15 +43,9 @@ void updateClock(void) int addClock(int x,int y,int grav) { int xpos=0; - int width=BWIDTH; + int width=iconSize; int retval=width; - if((panelGravity==PANELEAST) || (panelGravity==PANELWEST)) - { - printError("Clock not allowed with this panel's orientation."); - return(0); - } - if(clockButton!=NULL) { printError("Duplicate clock"); @@ -61,9 +56,14 @@ int addClock(int x,int y,int grav) else xpos=x-width; - clockButton=new LFSTK_labelClass(mainwind,"--:--:--",xpos,0,width,panelHeight,CENTRE,grav); + clockButton=new LFSTK_buttonClass(mainwind,"--:--:--",xpos,0,iconSize,iconSize+extraSpace,NorthWestGravity); + clockButton->LFSTK_setFontString(prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("font")),true); - setGadgetDetails(clockButton); + clockButton->LFSTK_setIgnores(false,false); + clockButton->LFSTK_setTile(NULL,0); + clockButton->LFSTK_setColourName(NORMALCOLOUR,"#80ffffff"); + clockButton->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); + clockButton->gadgetDetails.bevel=BEVELIN; return(retval); } diff --git a/LFSDock/LFSDock/src/clock.h b/LFSDock/LFSDock/src/clock.h index 7b7025b..54a56fa 100644 --- a/LFSDock/LFSDock/src/clock.h +++ b/LFSDock/LFSDock/src/clock.h @@ -22,7 +22,7 @@ #ifndef _CLOCK_ #define _CLOCK_ -extern LFSTK_labelClass *clockButton; +extern LFSTK_buttonClass *clockButton; int addClock(int x,int y,int grav); void updateClock(void); diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp index 50d834e..71aedee 100644 --- a/LFSDock/LFSDock/src/globals.cpp +++ b/LFSDock/LFSDock/src/globals.cpp @@ -22,21 +22,23 @@ //prefs LFSTK_prefsClass prefs; -/* - {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",useTheme->LFSTK_getValue(),0}}, - {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour",panelColourEdit->LFSTK_getCStr(),false,0}}, +std::string configDir; +std::string launchersDir; +std::string configFile; +LFSTK_windowClass *popWindow=NULL; +LFSTK_labelClass *popLabel=NULL; +launcherList *ll=NULL; +int iconSize=16; +int posMultiplier=1; -*/ -int panelHeight=16; +int panelSize=2; int panelWidth=-1; const monitorStruct *mons=NULL; int onMonitor=0; int panelPos=PANELCENTRE; int panelGravity=PANELNORTH; -bool useTheme=true; -const char *panelColour=""; const char *panelTextColour=""; -bool noButtons=false; +int extraSpace=16; int queueID; msgBuffer buffer; @@ -46,7 +48,6 @@ bool realMainLoop=true; int refreshRate=1; -int iconSize=16; //panel window LFSTK_applicationClass *apc=NULL; @@ -69,8 +70,8 @@ const char *possibleError="Unknown"; void setSizes(int *x,int *y,int *w,int *h,int *size,int *grav,bool fromleft) { - *w=panelHeight; - *h=panelHeight; + *w=iconSize; + *h=iconSize; *size=(*w)-12; switch(*grav) @@ -89,32 +90,14 @@ void setSizes(int *x,int *y,int *w,int *h,int *size,int *grav,bool fromleft) } *y=0; break; - - case PANELEAST: - case PANELWEST: - if(fromleft==true) - { - *grav=NorthWestGravity; - *y=*x; - } - else - { - *grav=SouthWestGravity; - *y=*x-*h+1; - } - *x=0; - break; } } void sendNotify(const char *name,const char *message)//TODO//could be better { #ifdef _GOTNOTIFYSEND_ - char *command; - asprintf(&command,"notify-send -u low -t 2000 -i stock_dialog-info \"%s\" \"%s ...\" &",name,message); -fprintf(stderr,"%s\n",command); - system(command); - free(command); + std::string com=std::string("notify-send -u low -t 2000 -i stock_dialog-info \"" + std::string(name) + " " + std::string(message) + " ...\" &"); + system(com.c_str()); #endif } @@ -130,7 +113,7 @@ void dropDesktopFile(const char *data,launcherList *launcher) cleanstr=apc->globalLib->LFSTK_cleanString((const char*)line.c_str()); if((strrchr(cleanstr,'.')!=NULL) && (strcmp(strrchr(cleanstr,'.'),".desktop")==0)) { - asprintf(&command,"mkdir -p '%s/launchers-DOCK';cp -nP '%s' '%s/launchers-DOCK'",apc->configDir,cleanstr,apc->configDir); + asprintf(&command,"mkdir -p '%s/launchers-DOCK';cp -nP '%s' '%s/launchers-DOCK'",apc->configDir.c_str(),cleanstr,apc->configDir.c_str()); ptr=strrchr(cleanstr,'/'); sendNotify("Adding launcher ",++ptr); system(command); @@ -157,18 +140,12 @@ void dropDesktopFile(const char *data,launcherList *launcher) void setGadgetDetails(LFSTK_gadgetClass *gadget) { - if(useTheme==false) - { - gadget->LFSTK_setAlpha(1.0); - gadget->LFSTK_setTile(NULL,0); - gadget->LFSTK_setColourName(NORMALCOLOUR,panelColour); - gadget->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); - if(noButtons==true) - { - gadget->gadgetDetails.bevel=BEVELNONE; - gadget->LFSTK_setColourName(PRELIGHTCOLOUR,panelColour); - gadget->LFSTK_setColourName(ACTIVECOLOUR,panelColour); - gadget->LFSTK_setColourName(INACTIVECOLOUR,panelColour); - } - } + gadget->LFSTK_setAlpha(1.0); + gadget->LFSTK_setTile(NULL,0); + gadget->LFSTK_setColourName(NORMALCOLOUR,"#00000000"); + gadget->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); + gadget->gadgetDetails.bevel=BEVELNONE; + gadget->LFSTK_setColourName(PRELIGHTCOLOUR,"#00000000"); + gadget->LFSTK_setColourName(ACTIVECOLOUR,"#00000000"); + gadget->LFSTK_setColourName(INACTIVECOLOUR,"#00000000"); } diff --git a/LFSDock/LFSDock/src/globals.h b/LFSDock/LFSDock/src/globals.h index 1b7a971..e9a331f 100644 --- a/LFSDock/LFSDock/src/globals.h +++ b/LFSDock/LFSDock/src/globals.h @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include "config.h" #include @@ -33,17 +36,9 @@ #ifndef _GLOBALS_ #define _GLOBALS_ -#define WINHELPER DATADIR "/scripts/PanelHelperWinList" -#define BWIDTH 64 -#define SPACING 10 -#define WINDOWREFRESH 2 -#define RCNAME "lfsdock" -#define REFRESHMULTI 4 - enum PANELXPOS {PANELLEFT=-1,PANELCENTRE=-2,PANELRIGHT=-3}; -enum PANELYPOS {PANELTOP=-1,PANELBOTTOM=-3}; enum PANELSIZE {PANELFULL=-1,PANELSHRINK=-2}; -enum PANELGRAVITY {PANELABS=0,PANELNORTH,PANELEAST,PANELSOUTH,PANELWEST}; +enum PANELGRAVITY {PANELNORTH=1,PANELSOUTH=2}; struct menuEntryStruct { @@ -55,28 +50,33 @@ struct menuEntryStruct struct launcherList { - launcherList *next=NULL; + launcherList *next=NULL; LFSTK_buttonClass *bc=NULL; - LFSTK_labelClass *label=NULL; - char *icon=NULL; + char *icon=NULL; menuEntryStruct entry; }; -enum {NOLAUNCHERS,LAUNCHERINLEFT,LAUNCHERINRITE}; +enum {NOLAUNCHERS,LAUNCHERINLEFT}; //prefs extern LFSTK_prefsClass prefs; +extern std::string configDir; +extern std::string launchersDir; +extern std::string configFile; +extern LFSTK_windowClass *popWindow; +extern LFSTK_labelClass *popLabel; +extern launcherList *ll; +extern int iconSize; +extern int posMultiplier; -extern int panelHeight; +extern int panelSize; extern int panelWidth; extern const monitorStruct *mons; extern int onMonitor; extern int panelPos; extern int panelGravity; -extern bool useTheme; -extern const char *panelColour; extern const char *panelTextColour; -extern bool noButtons; +extern int extraSpace; extern int queueID; extern msgBuffer buffer; @@ -85,7 +85,6 @@ extern bool realMainLoop; extern const char *desktopTheme; extern int refreshRate; -extern int iconSize; //panel window extern LFSTK_applicationClass *apc; diff --git a/LFSDock/LFSDock/src/launchers.cpp b/LFSDock/LFSDock/src/launchers.cpp index f62abe9..f39faac 100644 --- a/LFSDock/LFSDock/src/launchers.cpp +++ b/LFSDock/LFSDock/src/launchers.cpp @@ -26,43 +26,6 @@ #include "launchers.h" -LFSTK_windowClass *popWindow=NULL; - -bool moveCB(LFSTK_gadgetClass*p,void* ud) -{ - if(ud!=NULL) - { - XEvent event; - geometryStruct geom; - printf(">>>Mouse In %p<<<\n",(launcherList*)ud); - LFSTK_labelClass *label=NULL; - label=((launcherList*)ud)->label; -popWindow->LFSTK_resizeWindow(((launcherList*)ud)->label->LFSTK_getTextRealWidth("This is a mouse enter callback"),GADGETHITE); -//popWindow->LFSTK_resizeWindow(100,GADGETHITE); -fprintf(stderr,"label=%s\n",((launcherList*)ud)->entry.name); -label->LFSTK_setLabel(((launcherList*)ud)->entry.name,true); -label->LFSTK_clearWindow(); - p->LFSTK_getGeomWindowRelative(&geom,apc->rootWindow); - popWindow->LFSTK_moveWindow(geom.x,geom.y-GADGETHITE,true); - popWindow->LFSTK_showWindow(); - popWindow->LFSTK_clearWindow(true); - } - return(true); -} - -bool exitCB(LFSTK_gadgetClass*p,void* ud) -{ - if(ud!=NULL) - { - printf(">>>Mouse Out %s<<<\n",(const char*)ud); - popWindow->LFSTK_hideWindow(); - } - return(true); -} - -launcherList *ll=NULL; -std::string popUpString; - void addALAuncher(const char *fpath,menuEntryStruct *entry) { size_t start_pos=0; @@ -148,10 +111,10 @@ 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; + char *launchers; + launcherList *loopll; ll=NULL; - char *icon=NULL; + char *icon=NULL; int xpos=x; int ypos=y; int width=0; @@ -160,8 +123,9 @@ int addLaunchers(int x,int y,int grav,bool fromleft) int iconsize=16; int maxwidth=0; int sx,sy; + int adj; - asprintf(&launchers,"%s/launchers-DOCK",apc->configDir); + asprintf(&launchers,"%s/launchers-DOCK",apc->configDir.c_str()); ftw(launchers,launcherBuildCB,16); setSizes(&xpos,&ypos,&width,&height,&iconsize,&thisgrav,fromleft); @@ -170,23 +134,23 @@ int addLaunchers(int x,int y,int grav,bool fromleft) sy=ypos; popWindow=new LFSTK_toolWindowClass(apc->display,mainwind,"_NET_WM_WINDOW_TYPE_MENU",0,0,200,100,"lfstkpopup",apc); - //poplabel->LFSTK_setCairoFontDataParts("sB",20); - //poplabel->LFSTK_setTile(NULL,0); - - //popWindow->LFSTK_resizeWindow(poplabel->LFSTK_getTextRealWidth("This is a mouse enter callback"),GADGETHITE); + popLabel=new LFSTK_labelClass(popWindow,"ANAME",0,0,GADGETWIDTH*8,GADGETHITE,WestGravity); + popLabel->LFSTK_setCairoFontDataParts("sB",20); + popLabel->LFSTK_setTile(NULL,0); popWindow->LFSTK_setWindowColourName(NORMALCOLOUR,"#c0808080"); - - + if(posMultiplier==-1) + adj=0; + else + adj=extraSpace; loopll=ll; while(loopll!=NULL) { icon=NULL; - loopll->bc=new LFSTK_buttonClass(mainwind,"",sx,sy,width,height,thisgrav); + loopll->bc=new LFSTK_buttonClass(mainwind,"",sx,sy+adj,width,height,thisgrav); loopll->bc->LFSTK_setMouseCallBack(NULL,launcherCB,(void*)loopll); loopll->bc->LFSTK_setGadgetDropCallBack(gadgetDrop,(void*)loopll); - loopll->label=new LFSTK_labelClass(popWindow,loopll->entry.name,0,0,GADGETWIDTH*8,GADGETHITE,WestGravity); loopll->bc->LFSTK_setMouseMoveCallBack(moveCB,exitCB,USERDATA(loopll)); fprintf(stderr,"name=>>%s<<\n",loopll->entry.name); loopll->bc->gadgetAcceptsDnD=true; diff --git a/LFSDock/LFSDock/src/main.cpp b/LFSDock/LFSDock/src/main.cpp index d8b372f..80e11fc 100644 --- a/LFSDock/LFSDock/src/main.cpp +++ b/LFSDock/LFSDock/src/main.cpp @@ -34,15 +34,12 @@ void loadPrefs(const char *env) { prefs.LFSTK_loadVarsFromFile(env); - panelHeight=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelheight")); + panelSize=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelsize")); panelWidth=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelwidth")); onMonitor=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("onmonitor")); panelPos=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelpos")); panelGravity=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelgrav")); - useTheme=prefs.LFSTK_getBool(prefs.LFSTK_hashFromKey("usetheme")); - panelColour=prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("panelcolour")); panelTextColour=prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("textcolour")); - noButtons=prefs.LFSTK_getBool(prefs.LFSTK_hashFromKey("nobuttons")); } void addGadgets(void) @@ -57,7 +54,7 @@ void addGadgets(void) offset+=addClock(offset,mons->y,NorthWestGravity); break; case 'S': - offset+=panelHeight; + offset+=iconSize; break; case 'l': if(launcherSide==NOLAUNCHERS) @@ -69,7 +66,7 @@ void addGadgets(void) printError("Duplicate launcher widget"); break; case 's': - offset+=addSlider(offset,mons->y,panelGravity,true); + offset+=addSlider(offset,mons->y,panelGravity,true);//TODO// break; } } @@ -104,6 +101,29 @@ bool windowDrop(LFSTK_windowClass *lwc,void* ud) return(true); } +void sanityCheck(void) +{ + namespace fs=std::filesystem; + + if(!fs::exists(fs::status(launchersDir))) + fs::create_directories(launchersDir); + if(!fs::exists(fs::status(configFile))) + { + std::ofstream rcfile; + rcfile.open (configFile); + rcfile<<"panelpos -2\n"; + rcfile<<"onmonitor 0\n"; + rcfile<<"panelgrav 2\n"; + rcfile<<"panelwidth -2\n"; + rcfile<<"textcolour black\n"; + rcfile<<"gadgetsleft lC\n"; + rcfile<<"panelsize 3\n"; + rcfile<<"termcommand kkterminal -m -l -e \n"; + rcfile<<"font Arial:size=16\n"; + rcfile.close(); + } +} + int main(int argc,char **argv) { char *env; @@ -114,22 +134,25 @@ int main(int argc,char **argv) timeval tv={0,0}; int key=666; int refreshmulti=0; - + + configDir=getenv("HOME") + std::string("/.config/LFS/"); + launchersDir=configDir + std::string("launchers-DOCK"); + configFile=configDir + std::string("lfsdock.rc"); + sanityCheck(); + prefs.prefsMap={ - {prefs.LFSTK_hashFromKey("panelheight"),{TYPEINT,"panelheight","",false,0}}, + {prefs.LFSTK_hashFromKey("panelsize"),{TYPEINT,"panelsize","",false,1}}, {prefs.LFSTK_hashFromKey("panelwidth"),{TYPEINT,"panelwidth","",false,0}}, {prefs.LFSTK_hashFromKey("onmonitor"),{TYPEINT,"onmonitor","",false,0}}, {prefs.LFSTK_hashFromKey("panelpos"),{TYPEINT,"panelpos","",false,0}}, {prefs.LFSTK_hashFromKey("panelgrav"),{TYPEINT,"panelgrav","",false,0}}, - {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",false,0}}, - {prefs.LFSTK_hashFromKey("nobuttons"),{TYPEBOOL,"nobuttons","",false,0}}, - {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour","",false,0}}, {prefs.LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","black",false,0}}, {prefs.LFSTK_hashFromKey("termcommand"),{TYPESTRING,"termcommand","xterm -e ",false,0}}, {prefs.LFSTK_hashFromKey("gadgetsleft"),{TYPESTRING,"gadgetsleft","l",false,0}}, + {prefs.LFSTK_hashFromKey("font"),{TYPESTRING,"font","l",false,0}}, }; realMainLoop=true; @@ -155,7 +178,7 @@ int main(int argc,char **argv) NET_WM_NAME=XInternAtom(mainwind->app->display,"_NET_WM_NAME",False); UTF8_STRING=XInternAtom(mainwind->app->display,"UTF8_STRING",False); - env=mainwind->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + env=mainwind->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); key=atoi(env); freeAndNull(&env); @@ -165,22 +188,36 @@ int main(int argc,char **argv) if((queueID=msgget(key,IPC_CREAT|0660))==-1) fprintf(stderr,"Can't create message queue\n"); - iconSize=32; - - asprintf(&env,"%s/%s.rc",apc->configDir,RCNAME); + asprintf(&env,"%s",configFile.c_str()); loadPrefs(env); + if(panelGravity==1) + posMultiplier=-1; + else + posMultiplier=1; + + switch(panelSize) + { + case 2: + iconSize=48; + break; + case 3: + iconSize=64; + break; + case 4: + iconSize=96; + break; + default: + iconSize=32; + } desktopTheme=mainwind->globalLib->desktopIconTheme.c_str(); mons=apc->LFSTK_getMonitorData(onMonitor); leftOffset=0; - if(useTheme==false) - { - mainwind->LFSTK_setTile(NULL,0); - mainwind->LFSTK_setWindowColourName(NORMALCOLOUR,panelColour); - } + mainwind->LFSTK_setTile(NULL,0); + mainwind->LFSTK_setWindowColourName(NORMALCOLOUR,"#00000000"); addGadgets(); @@ -196,7 +233,7 @@ int main(int argc,char **argv) switch(panelGravity) { case PANELSOUTH: - py=mons->y+mons->h-panelHeight; + py=mons->y+mons->h-iconSize; case PANELNORTH: switch(panelWidth) { @@ -219,46 +256,22 @@ int main(int argc,char **argv) case PANELRIGHT: px=mons->x+mons->w-psize; break; - } - break; - - case PANELEAST: - px=mons->x+mons->w-panelHeight; - case PANELWEST: - switch(panelWidth) - { - case PANELFULL: - panelWidth=panelHeight; - panelHeight=mons->h; - panelPos=PANELLEFT; - break; - case PANELSHRINK: - panelWidth=panelHeight; - panelHeight=psize; - break; default: - thold=panelWidth; - panelWidth=panelHeight; - panelHeight=thold; - break; - } - switch(panelPos) - { - case PANELLEFT: - py=mons->y; + px=panelPos; break; - case PANELCENTRE: - py=((mons->h/2)-(panelHeight/2))+mons->y; - break; - case PANELRIGHT: - py=mons->y+mons->h-panelHeight; - break; } break; } - mainwind->LFSTK_resizeWindow(panelWidth,panelHeight,true); - mainwind->LFSTK_moveWindow(px,py,true); + mainwind->LFSTK_resizeWindow(panelWidth,iconSize+extraSpace,true); + if(posMultiplier==1) + { + mainwind->LFSTK_moveWindow(px,py-extraSpace,true); + } + else + { + mainwind->LFSTK_moveWindow(px,py,true); + } mainwind->LFSTK_showWindow(true); mainwind->LFSTK_setKeepAbove(true); diff --git a/LFSDock/LFSDock/src/slider.cpp b/LFSDock/LFSDock/src/slider.cpp index 244dae9..77d9dc1 100644 --- a/LFSDock/LFSDock/src/slider.cpp +++ b/LFSDock/LFSDock/src/slider.cpp @@ -106,12 +106,6 @@ bool sliderCB(void *p,void* ud) case PANELSOUTH: scwindow->LFSTK_moveWindow(geom.x,geom.y-SCROLLBARWIDTH,true); break; - case PANELEAST: - scwindow->LFSTK_moveWindow(geom.x-SCROLLBARWIDTH,geom.y,true); - break; - case PANELWEST: - scwindow->LFSTK_moveWindow(geom.x+geom.w,geom.y,true); - break; } scwindow->LFSTK_showWindow(true); scwindow->LFSTK_redrawAllGadgets(); @@ -192,18 +186,9 @@ int addSlider(int x,int y,int grav,bool fromleft) win->y=100; bool direction=false; - if((panelGravity==PANELWEST) || (panelGravity==PANELEAST)) - { - w=16; - h=100; - direction=true; - } - else - { - w=100; - h=16; - direction=false; - } + w=100; + h=16; + direction=false; win->w=w; win->h=h; diff --git a/LFSDock/configure.ac b/LFSDock/configure.ac index 1b218ca..ed72d96 100644 --- a/LFSDock/configure.ac +++ b/LFSDock/configure.ac @@ -1,5 +1,5 @@ -AC_INIT([LFSDock],[0.1.0],[PROJ],[LFSPanel]) +AC_INIT([LFSDock],[0.1.0],[PROJ],[LFSDock]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CXX diff --git a/LFSPanel/ChangeLog b/LFSPanel/ChangeLog index 563d754..5eac2ec 100644 --- a/LFSPanel/ChangeLog +++ b/LFSPanel/ChangeLog @@ -1,4 +1,5 @@ 0.2.0 +Fixed setting absolute position of panels. Added extra prefs to handle transparent windows, etc. Fixed occasional segfault in window menu. Fixed menu items from bad window names. diff --git a/LFSPanel/LFSPanel/src/callbacks.cpp b/LFSPanel/LFSPanel/src/callbacks.cpp index 2873660..8d135ee 100644 --- a/LFSPanel/LFSPanel/src/callbacks.cpp +++ b/LFSPanel/LFSPanel/src/callbacks.cpp @@ -88,8 +88,6 @@ bool timerCB(LFSTK_applicationClass *p,void* ud) if(buttonmask!=0) return(true); - readMsg(); - if(clockButton!=NULL) updateClock(); @@ -104,43 +102,3 @@ bool timerCB(LFSTK_applicationClass *p,void* ud) return(true); } - -void readMsg(void) -{ - int retcode; - char *command=NULL; - FILE *fd=NULL; - char buff[2048]; - char *comstring=NULL; - char *forwhom; - - buffer.mText[0]=0; - retcode=msgrcv(queueID,&buffer,MAX_MSG_SIZE,PANEL_MSG,IPC_NOWAIT); - - comstring=strdup(buffer.mText); - command=strtok(comstring," "); - forwhom=strtok(NULL," "); - - if(forwhom==NULL) - { - free(comstring); - return; - } - - if(strcmp(forwhom,panelID)!=0) - { - if((msgsnd(queueID,&buffer,strlen(buffer.mText)+1,0))==-1) - fprintf(stderr,"Can't send message :(\n"); - free(comstring); - return; - } - - if((command!=NULL) && (strcmp(command,"quitpanel")==0)) - { - apc->mainLoop=false; - realMainLoop=false; - } - free(comstring); - - buffer.mText[0]=0; -} diff --git a/LFSPanel/LFSPanel/src/callbacks.h b/LFSPanel/LFSPanel/src/callbacks.h index fb04fc4..99eea64 100644 --- a/LFSPanel/LFSPanel/src/callbacks.h +++ b/LFSPanel/LFSPanel/src/callbacks.h @@ -24,6 +24,5 @@ bool launcherCB(void *p,void* ud); bool gadgetDrop(void *lwc,propertyStruct *data,void* ud); bool timerCB(LFSTK_applicationClass *p,void* ud); -void readMsg(void); #endif diff --git a/LFSPanel/LFSPanel/src/globals.cpp b/LFSPanel/LFSPanel/src/globals.cpp index cd1856d..e224b9e 100644 --- a/LFSPanel/LFSPanel/src/globals.cpp +++ b/LFSPanel/LFSPanel/src/globals.cpp @@ -129,7 +129,7 @@ void dropDesktopFile(const char *data,launcherList *launcher) cleanstr=apc->globalLib->LFSTK_cleanString((const char*)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,panelID,cleanstr,apc->configDir,panelID); + asprintf(&command,"mkdir -p '%s/launchers-%s';cp -nP '%s' '%s/launchers-%s'",apc->configDir.c_str(),panelID,cleanstr,apc->configDir.c_str(),panelID); ptr=strrchr(cleanstr,'/'); sendNotify("Adding launcher ",++ptr); system(command); diff --git a/LFSPanel/LFSPanel/src/launchers.cpp b/LFSPanel/LFSPanel/src/launchers.cpp index c02dfe0..fb49e63 100644 --- a/LFSPanel/LFSPanel/src/launchers.cpp +++ b/LFSPanel/LFSPanel/src/launchers.cpp @@ -126,7 +126,7 @@ int addLaunchers(int x,int y,int grav,bool fromleft) int maxwidth=0; int sx,sy; - asprintf(&launchers,"%s/launchers-%s",apc->configDir,panelID); + asprintf(&launchers,"%s/launchers-%s",apc->configDir.c_str(),panelID); ftw(launchers,launcherBuildCB,16); setSizes(&xpos,&ypos,&width,&height,&iconsize,&thisgrav,fromleft); diff --git a/LFSPanel/LFSPanel/src/main.cpp b/LFSPanel/LFSPanel/src/main.cpp index 536422f..85d5640 100644 --- a/LFSPanel/LFSPanel/src/main.cpp +++ b/LFSPanel/LFSPanel/src/main.cpp @@ -204,7 +204,7 @@ int main(int argc,char **argv) {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",false,0}}, {prefs.LFSTK_hashFromKey("nobuttons"),{TYPEBOOL,"nobuttons","",false,0}}, - {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour","",false,0}}, + {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour","white",false,0}}, {prefs.LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","black",false,0}} }; realMainLoop=true; @@ -232,7 +232,7 @@ int main(int argc,char **argv) NET_WM_NAME=XInternAtom(mainwind->app->display,"_NET_WM_NAME",False); UTF8_STRING=XInternAtom(mainwind->app->display,"UTF8_STRING",False); - env=mainwind->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); + env=mainwind->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir.c_str()); key=atoi(env); freeAndNull(&env); @@ -253,10 +253,10 @@ int main(int argc,char **argv) if(argc>1) { panelID=argv[1]; - asprintf(&env,"%s/%s-%s.rc",apc->configDir,RCNAME,panelID); + asprintf(&env,"%s/%s-%s.rc",apc->configDir.c_str(),RCNAME,panelID); } else - asprintf(&env,"%s/%s.rc",apc->configDir,RCNAME); + asprintf(&env,"%s/%s.rc",apc->configDir.c_str(),RCNAME); loadPrefs(env); @@ -311,6 +311,8 @@ int main(int argc,char **argv) case PANELRIGHT: px=mons->x+mons->w-psize; break; + default: + px=panelPos; } break; @@ -344,8 +346,10 @@ int main(int argc,char **argv) break; case PANELRIGHT: py=mons->y+mons->h-panelHeight; - break; - } + break; + default: + py=panelPos; + } break; } diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog index 5a8310c..dc32ea6 100644 --- a/LFSToolKit/ChangeLog +++ b/LFSToolKit/ChangeLog @@ -1,4 +1,5 @@ 0.6.0 +Removed some old 'c' code. Minor menu stack fix. Fixed labels on translucent windows. Fixed version number in .pc file. diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp index d20d1ca..de53470 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp @@ -30,9 +30,9 @@ LFSTK_applicationClass::~LFSTK_applicationClass() delete this->globalLib; delete this->windows; XCloseDisplay(this->display); - free(this->configDir); - if(this->iconThemeName!=NULL) - free(this->iconThemeName); + //free(this->configDir); + //if(this->iconThemeName!=NULL) + // free(this->iconThemeName); #ifdef _ENABLEDEBUG_ cairo_debug_reset_static_data(); #endif @@ -94,8 +94,8 @@ LFSTK_applicationClass::LFSTK_applicationClass() this->displayNum=ConnectionNumber(this->display); this->userHome=getenv("HOME"); - asprintf(&this->configDir,"%s/.config/LFS",this->userHome); - this->iconThemeName=this->globalLib->LFSTK_oneLiner("cat '%s'/lfsdesktop.rc|grep -i icontheme|awk '{print $2}'",this->configDir); + this->configDir=this->userHome + std::string("/.config/LFS"); + this->iconThemeName=this->globalLib->LFSTK_oneLiner("cat '%s'/lfsdesktop.rc|grep -i icontheme|awk '{print $2}'",this->configDir.c_str()); } /** diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.h index 5803cd8..ad72273 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.h @@ -86,9 +86,9 @@ class LFSTK_applicationClass LFSTK_lib *globalLib=NULL; std::vector *windows; LFSTK_windowClass *mainWindow=NULL; - char *configDir=NULL; - char *userHome=NULL; - char *iconThemeName=NULL; + std::string configDir=""; + std::string userHome=""; + std::string iconThemeName=""; private: int displayNum; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp index 4f150a5..397305b 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp @@ -162,10 +162,10 @@ bool LFSTK_fileDialogClass::LFSTK_getRequestType(void) */ void LFSTK_fileDialogClass::LFSTK_setWorkingDir(const char *dir) { - char *holddir; + char *holddir;//TODO// //in case dir doesnt exist if(access(dir,F_OK)!=0) - holddir=strdup(this->wc->app->userHome); + holddir=strdup(this->wc->app->userHome.c_str());//TODO// //in case dir=this->currentDir else holddir=strdup(dir); @@ -443,11 +443,11 @@ void LFSTK_fileDialogClass::LFSTK_getLastFolder(void) { if(this->currentDir!=NULL) free(this->currentDir); - this->currentDir=this->wc->app->globalLib->LFSTK_oneLiner("grep -i '%s' '%s/dialoglast.rc'|awk -F= '{print $NF}'",this->recentsName,this->wc->app->configDir); + this->currentDir=this->wc->app->globalLib->LFSTK_oneLiner("grep -i '%s' '%s/dialoglast.rc'|awk -F= '{print $NF}'",this->recentsName,this->wc->app->configDir.c_str()); if(strlen(this->currentDir)<2) { free(this->currentDir); - this->currentDir=strdup(this->wc->app->userHome); + this->currentDir=strdup(this->wc->app->userHome.c_str());//TODO// } } @@ -613,7 +613,7 @@ void LFSTK_fileDialogClass::setFileData(void) freeAndNull(&this->currentPath); this->currentPath=strdup(this->dirEdit->LFSTK_getCStr()); - asprintf(&lastdir,"sed -i '/%s=/d' '%s/dialoglast.rc';echo '%s=%s'|cat - '%s/dialoglast.rc'|sort -uo '%s/dialoglast.rc'",this->recentsName,this->wc->app->configDir,this->recentsName,this->currentDir,this->wc->app->configDir,this->wc->app->configDir); + asprintf(&lastdir,"sed -i '/%s=/d' '%s/dialoglast.rc';echo '%s=%s'|cat - '%s/dialoglast.rc'|sort -uo '%s/dialoglast.rc'",this->recentsName,this->wc->app->configDir.c_str(),this->recentsName,this->currentDir,this->wc->app->configDir.c_str(),this->wc->app->configDir.c_str()); system(lastdir); free(lastdir); } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp index ff4d319..1ff9673 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp @@ -1019,6 +1019,7 @@ void LFSTK_gadgetClass::drawImage() cairo_save(this->cr); cairo_reset_clip (this->cr); cairo_translate(this->cr,xoffset,yoffset); +// cairo_scale(this->cr,this->imageXextraScale,this->imageYextraScale); cairo_set_source_surface(this->cr,this->cImage,0,0); cairo_paint_with_alpha(this->cr,this->alpha); @@ -1733,7 +1734,7 @@ void LFSTK_gadgetClass::LFSTK_setGadgetSize(int width,int height) this->gadgetDetails.gadgetGeom.h=height; this->gadgetGeom.w=width; this->gadgetGeom.h=height; - this->wc->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->window,this->wc->app->visual,&this->sfc,&this->cr,width,height); + this->wc->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->window,this->visual,&this->sfc,&this->cr,width,height); } /** diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h index e198abc..05a5d00 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h @@ -174,6 +174,8 @@ class LFSTK_gadgetClass //context contextPostition contextWindowPos=CONTEXTRIGHT; +//double imageXextraScale=1.0; +//double imageYextraScale=1.0; private: void initGadget(void); void selectBevel(bool mousedown); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp index ac86d3e..7c08e02 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp @@ -364,12 +364,12 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) cairo_save(this->cr); cairo_reset_clip (this->cr); cairo_set_source(this->cr,this->pattern); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_paint(this->cr); cairo_restore(this->cr); } else { - cairo_save(this->cr); cairo_reset_clip (this->cr); cairo_set_source_rgba(this->cr,this->windowColourNames[state].RGBAColour.r,this->windowColourNames[state].RGBAColour.g,this->windowColourNames[state].RGBAColour.b,this->windowColourNames[state].RGBAColour.a); @@ -390,21 +390,11 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) void LFSTK_windowClass::LFSTK_resizeWindow(int w,int h,bool tellx) { this->setWindowGeom(0,0,w,h,WINDSETWH); + this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->visual,&this->sfc,&this->cr,w,h); if(tellx==true) XResizeWindow(this->app->display,this->window,w,h); - -//cairo_xlib_surface_set_drawable (this->sfc, -// this->window, -// w, -// h); -//XSync(this->app->display,false); this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->visual,&this->sfc,&this->cr,w,h); -// this->LFSTK_clearWindow(); - -//XUnmapWindow(this->app->display,this->window); -//XSync(this->app->display,false); -//XMapWindow(this->app->display,this->window); -//XSync(this->app->display,false); + this->LFSTK_clearWindow(true); } /** @@ -1555,7 +1545,8 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event) oldwindowGeom=this->windowGeom; flag=true; } - this->LFSTK_resizeWindow(event->xconfigurerequest.width,event->xconfigurerequest.height,false); + if(event->xconfigure.send_event==true) + this->LFSTK_resizeWindow(event->xconfigure.width,event->xconfigure.height,false); this->LFSTK_clearWindow(); if((this->windowGeom.w!=oldwindowGeom.w) ||(this->windowGeom.h!=oldwindowGeom.h)) diff --git a/LFSToolKit/examples/dialogs.cpp b/LFSToolKit/examples/dialogs.cpp index 6b1fdc6..bf45563 100755 --- a/LFSToolKit/examples/dialogs.cpp +++ b/LFSToolKit/examples/dialogs.cpp @@ -109,7 +109,7 @@ int main(int argc, char **argv) sy+=YSPACING; //files and folders - asprintf(&wd,"%s",apc->userHome); + asprintf(&wd,"%s",apc->userHome.c_str()); filedialogfile=new LFSTK_fileDialogClass(wc,"Select File",wd,FILEDIALOG); //filedialogfile->useThumbs=true; //filedialogfile=new LFSTK_fileDialogClass(wc,"Select File",NULL,FILEDIALOG); diff --git a/LFSToolKit/examples/geticonpath.cpp b/LFSToolKit/examples/geticonpath.cpp index c982b94..3579191 100755 --- a/LFSToolKit/examples/geticonpath.cpp +++ b/LFSToolKit/examples/geticonpath.cpp @@ -43,7 +43,7 @@ bool getPath(void *p,void* ud) fileInformation fileinfo; apc->globalLib->LFSTK_loadDesktopIconTheme(); - iconpath=(char*)apc->globalLib->LFSTK_findThemedIcon(apc->iconThemeName,mimeEdit->LFSTK_getCStr(),""); + iconpath=(char*)apc->globalLib->LFSTK_findThemedIcon(apc->iconThemeName.c_str(),mimeEdit->LFSTK_getCStr(),""); if(iconpath!=NULL) { diff --git a/LFSToolKit/examples/lfsruncommand.cpp b/LFSToolKit/examples/lfsruncommand.cpp index 69b3810..ebf5680 100755 --- a/LFSToolKit/examples/lfsruncommand.cpp +++ b/LFSToolKit/examples/lfsruncommand.cpp @@ -89,7 +89,7 @@ int main(int argc, char **argv) list=list=new LFSTK_listGadgetClass(wc,"",BORDER,sy,DIALOGWIDTH-(BORDER*2)-LGAP,LISTHITE); - asprintf(&commandfile,"%s/%s",apc->configDir,"command.hist"); + asprintf(&commandfile,"%s/%s",apc->configDir.c_str(),"command.hist"); list->LFSTK_setListFromFile(commandfile,false); list->LFSTK_setMouseCallBack(NULL,select,NULL); sy+=LISTHITE+8; diff --git a/LFSToolKit/examples/subwindowtest.cpp b/LFSToolKit/examples/subwindowtest.cpp index 01c5007..7acc7c7 100755 --- a/LFSToolKit/examples/subwindowtest.cpp +++ b/LFSToolKit/examples/subwindowtest.cpp @@ -72,14 +72,16 @@ bool doTransSubQuit(void *p,void* ud) int cnt=1; bool timerCB(LFSTK_applicationClass *p,void* ud) { -return(true); printf("From window %s\n",ud); printf("Timer callback number %i of 10\n",cnt); cnt++; if(cnt<11) return(true); else - return(false); + { + //transtest->LFSTK_setGadgetSize(100,100); + return(false); + } } int main(int argc, char **argv)