diff --git a/LFSDock/ChangeLog b/LFSDock/ChangeLog
index f09c8aa..11d1e6d 100644
--- a/LFSDock/ChangeLog
+++ b/LFSDock/ChangeLog
@@ -1,10 +1,12 @@
0.1.0
+Removed legacy code.
+Code clean.
Fixed volume slider icons.
Fixed clock.
Prefs file is ~/.config/LFS/lfsdock.rc
Tweaked prefs name.
Removed unused defines.
-Fixed stting absolute position.
+Fixed setting absolute position.
Fixed clock.
Set font details.
Dock can only be north or south gravity.
diff --git a/LFSDock/LFSDock/app/Makefile.am b/LFSDock/LFSDock/app/Makefile.am
index 491e956..90aa70c 100644
--- a/LFSDock/LFSDock/app/Makefile.am
+++ b/LFSDock/LFSDock/app/Makefile.am
@@ -7,8 +7,8 @@ lfsdock_SOURCES = $(COMMONSRC)
man1_MANS = ../resources/man/lfsdock.1
-#pixfilesdir = $(pkgdatadir)/pixmaps
-#pixfiles_DATA = ../resources/pixmaps/*
+pixfilesdir = $(pkgdatadir)/pixmaps
+pixfiles_DATA = ../resources/pixmaps/*
bin_PROGRAMS = lfsdock
diff --git a/LFSDock/LFSDock/resources/pixmaps/command.png b/LFSDock/LFSDock/resources/pixmaps/command.png
new file mode 100644
index 0000000..362f763
Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/command.png differ
diff --git a/LFSDock/LFSDock/sources b/LFSDock/LFSDock/sources
index 5b6909a..dfa4cd6 100644
--- a/LFSDock/LFSDock/sources
+++ b/LFSDock/LFSDock/sources
@@ -1 +1 @@
-COMMONSRC = ../src/callbacks.cpp ../src/clock.cpp ../src/globals.cpp ../src/launchers.cpp ../src/main.cpp ../src/slider.cpp
+COMMONSRC = ../src/callbacks.cpp ../src/clock.cpp ../src/desktopSwitcher.cpp ../src/globals.cpp ../src/launchers.cpp ../src/main.cpp ../src/slider.cpp
diff --git a/LFSDock/LFSDock/src/callbacks.cpp b/LFSDock/LFSDock/src/callbacks.cpp
index 80ab82a..1e42ec6 100644
--- a/LFSDock/LFSDock/src/callbacks.cpp
+++ b/LFSDock/LFSDock/src/callbacks.cpp
@@ -1,21 +1,21 @@
/*
*
- * ©K. D. Hedger. Sat 6 Feb 13:59:35 GMT 2021 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:09:02 GMT 2023 keithdhedger@gmail.com
- * This file (callbacks.cpp) is part of LFSPanel.
+ * This file (callbacks.cpp) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
#include "globals.h"
@@ -77,17 +77,6 @@ bool gadgetDrop(void *lwc,propertyStruct *data,void* ud)
bool timerCB(LFSTK_applicationClass *p,void* ud)
{
- Window sink;
- Window childwindow;
- int sinkx;
- int sinky;
- unsigned int buttonmask;
-
- XQueryPointer(apc->display,apc->rootWindow,&sink,&childwindow,&sinkx,&sinky,&sinkx,&sinky,&buttonmask);
-
- if(buttonmask!=0)
- return(true);
-
readMsg();
if(clockButton!=NULL)
@@ -131,7 +120,7 @@ bool exitCB(LFSTK_gadgetClass*p,void* ud)
return(true);
}
-bool moveCB(LFSTK_gadgetClass*p,void* ud)
+bool enterCB(LFSTK_gadgetClass*p,void* ud)
{
if(ud!=NULL)
{
diff --git a/LFSDock/LFSDock/src/callbacks.h b/LFSDock/LFSDock/src/callbacks.h
index bb91fec..febe3cf 100644
--- a/LFSDock/LFSDock/src/callbacks.h
+++ b/LFSDock/LFSDock/src/callbacks.h
@@ -1,21 +1,21 @@
/*
*
- * ©K. D. Hedger. Sat 6 Feb 13:59:29 GMT 2021 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:09:12 GMT 2023 keithdhedger@gmail.com
- * This file (callbacks.h) is part of LFSPanel.
+ * This file (callbacks.h) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
#ifndef _CALLBACKS_
@@ -26,5 +26,5 @@ 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);
+bool enterCB(LFSTK_gadgetClass*p,void* ud);
#endif
diff --git a/LFSDock/LFSDock/src/clock.cpp b/LFSDock/LFSDock/src/clock.cpp
index 5d94bda..dd8b240 100644
--- a/LFSDock/LFSDock/src/clock.cpp
+++ b/LFSDock/LFSDock/src/clock.cpp
@@ -1,30 +1,25 @@
/*
*
- * ©K. D. Hedger. Mon 21 Sep 13:41:36 BST 2015 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:09:27 GMT 2023 keithdhedger@gmail.com
- * This file (clock.cpp) is part of LFSPanel.
+ * This file (clock.cpp) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
-#include
-#include
-#include
-
#include "globals.h"
-//LFSTK_labelClass *clockButton=NULL;
LFSTK_buttonClass *clockButton=NULL;
void updateClock(void)
@@ -44,25 +39,15 @@ void updateClock(void)
int addClock(int x,int y,int grav)
{
- int xpos=0;
- int width=iconSize;
- int retval=width;
-
if(clockButton!=NULL)
{
printError("Duplicate clock");
return(0);
}
- if(grav==NorthWestGravity)
- xpos=x;
- else
- xpos=x-width;
-
- clockButton=new LFSTK_buttonClass(mainwind,"--:--:--",xpos,((iconSize+extraSpace)/2)-(GADGETHITE/2),iconSize,GADGETHITE,NorthWestGravity);
-
- clockButton->LFSTK_setFontString(prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("font")),true);
+ clockButton=new LFSTK_buttonClass(mainwind,"--:--:--",x,y+(iconSize/2)-(GADGETHITE/2),iconSize,GADGETHITE);
setGadgetDetails(clockButton);
+ clockButton->LFSTK_setFontString(prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("font")),true);
clockButton->LFSTK_setAlpha(1.0);
clockButton->LFSTK_setIgnores(false,false);
@@ -75,5 +60,5 @@ int addClock(int x,int y,int grav)
clockButton->drawLabelBG=true;
clockButton->autoLabelBGColour=true;
- return(retval);
+ return(iconSize);
}
diff --git a/LFSDock/LFSDock/src/clock.h b/LFSDock/LFSDock/src/clock.h
index 54a56fa..3e65f5d 100644
--- a/LFSDock/LFSDock/src/clock.h
+++ b/LFSDock/LFSDock/src/clock.h
@@ -1,24 +1,23 @@
/*
*
- * ©K. D. Hedger. Mon 21 Sep 13:41:31 BST 2015 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:09:41 GMT 2023 keithdhedger@gmail.com
- * This file (clock.h) is part of LFSPanel.
+ * This file (clock.h) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
-
#ifndef _CLOCK_
#define _CLOCK_
diff --git a/LFSDock/LFSDock/src/desktopSwitcher.cpp b/LFSDock/LFSDock/src/desktopSwitcher.cpp
new file mode 100644
index 0000000..16f5af5
--- /dev/null
+++ b/LFSDock/LFSDock/src/desktopSwitcher.cpp
@@ -0,0 +1,95 @@
+/*
+ *
+ * ©K. D. Hedger. Sun 19 Nov 19:10:19 GMT 2023 keithdhedger@gmail.com
+
+ * This file (desktopSwitcher.cpp) is part of LFSDock.
+
+ * LFSDock is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * LFSDock is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with LFSDock. If not, see .
+ */
+
+#include "globals.h"
+
+LFSTK_toggleButtonClass *switchButton;
+bool switchIsUp=false;
+
+bool deskSwitcherExitCB(LFSTK_gadgetClass*p,void* ud)
+{
+ geometryStruct geom2;
+ int adj;
+
+ if(switchButton->LFSTK_getValue()==1)
+ return(true);
+ adj=extraSpace*posMultiplier;
+ p->LFSTK_getGeom(&geom2);
+ p->LFSTK_moveGadget(geom2.x,geom2.y+adj);
+ switchIsUp=false;
+ return(true);
+}
+
+bool deskSwitcherEnterCB(LFSTK_gadgetClass*p,void* ud)
+{
+ geometryStruct geom;
+ int adj;
+
+ if(switchIsUp==true)
+ return(true);
+
+ adj=extraSpace*posMultiplier;
+ p->LFSTK_getGeom(&geom);
+ p->LFSTK_moveGadget(geom.x,geom.y-adj);
+ switchIsUp=true;
+ return(true);
+}
+
+bool deskListCB(void* p,void* ud)
+{
+ return(true);
+}
+
+int addDesktopSwitcer(int x,int y,int grav)
+{
+ char *icon=NULL;
+ if(switchButton!=NULL)
+ {
+ printError("Duplicate switcher");
+ return(0);
+ }
+ switchButton=new LFSTK_toggleButtonClass(mainwind,"",x,y,iconSize,iconSize);
+ switchButton->LFSTK_setToggleStyle(TOGGLENORMAL);
+ switchButton->LFSTK_setMouseCallBack(NULL,deskListCB,NULL);
+ switchButton->LFSTK_setMouseMoveCallBack(deskSwitcherEnterCB,deskSwitcherExitCB,NULL);
+
+ setGadgetDetails(switchButton);
+ switchButton->LFSTK_setAlpha(1.0);
+ switchButton->LFSTK_setStyle(BEVELNONE);
+
+ switchButton->LFSTK_setColourName(NORMALCOLOUR,panelBGColour);
+ switchButton->LFSTK_setColourName(PRELIGHTCOLOUR,panelBGColour);
+ switchButton->LFSTK_setColourName(ACTIVECOLOUR,panelBGColour);
+
+ switchButton->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true);
+ switchButton->LFSTK_setFontColourName(PRELIGHTCOLOUR,panelTextColour,true);
+ switchButton->LFSTK_setFontColourName(ACTIVECOLOUR,panelTextColour,true);
+
+ icon=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"remote-desktop","");
+ if(icon!=NULL)
+ {
+ switchButton->LFSTK_setImageFromPath(icon,LEFT,true);
+ free(icon);
+ }
+ else
+ switchButton->LFSTK_setImageFromPath(DATADIR "/pixmaps/windows.png",LEFT,true);
+
+ return(iconSize);
+}
diff --git a/LFSDock/LFSDock/src/desktopSwitcher.h b/LFSDock/LFSDock/src/desktopSwitcher.h
new file mode 100644
index 0000000..395a87d
--- /dev/null
+++ b/LFSDock/LFSDock/src/desktopSwitcher.h
@@ -0,0 +1,30 @@
+/*
+ *
+ * ©K. D. Hedger. Sun 19 Nov 19:12:44 GMT 2023 keithdhedger@gmail.com
+
+ * This file (desktopSwitcher.h) is part of LFSDock.
+
+ * LFSDock is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * LFSDock is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with LFSDock. If not, see .
+ */
+
+#ifndef _DESKTOPSWITCHER_
+#define _DESKTOPSWITCHER_
+
+#include "globals.h"
+
+extern LFSTK_toggleButtonClass *switchButton;
+
+int addDesktopSwitcer(int x,int y,int grav);
+
+#endif
diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp
index 6854e52..a61d1b5 100644
--- a/LFSDock/LFSDock/src/globals.cpp
+++ b/LFSDock/LFSDock/src/globals.cpp
@@ -1,59 +1,57 @@
/*
*
- * ©K. D. Hedger. Sun 20 Sep 14:41:10 BST 2015 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:08:31 GMT 2023 keithdhedger@gmail.com
- * This file (globals.cpp) is part of LFSPanel.
+ * This file (globals.cpp) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
#include "globals.h"
//prefs
LFSTK_prefsClass prefs;
-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;
+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 panelSize=2;
-int panelWidth=-1;
-const monitorStruct *mons=NULL;
-int onMonitor=0;
-int panelPos=PANELCENTRE;
-int panelGravity=PANELNORTH;
-const char *panelTextColour="";
-const char *panelBGColour="";
-int extraSpace=16;
+int panelSize=2;
+int panelWidth=-1;
+const monitorStruct *mons=NULL;
+int onMonitor=0;
+int panelPos=PANELCENTRE;
+int panelGravity=PANELNORTH;
+const char *panelTextColour="";
+const char *panelBGColour="";
+int extraSpace=16;
-int queueID;
-msgBuffer buffer;
+int queueID;
+msgBuffer buffer;
-const char *desktopTheme=NULL;
-bool realMainLoop=true;
-
-int refreshRate=1;
+const char *desktopTheme=NULL;
+bool realMainLoop=true;
+int refreshRate=1;
//panel window
LFSTK_applicationClass *apc=NULL;
LFSTK_windowClass *mainwind=NULL;
-int leftOffset=0;
int launcherSide=NOLAUNCHERS;
//atoms
@@ -69,31 +67,6 @@ Atom UTF8_STRING=None;
const char *possibleError="Unknown";
-void setSizes(int *x,int *y,int *w,int *h,int *size,int *grav,bool fromleft)
-{
- *w=iconSize;
- *h=iconSize;
- *size=(*w)-12;
-
- switch(*grav)
- {
- case PANELNORTH:
- case PANELSOUTH:
- if(fromleft==true)
- {
- *grav=NorthWestGravity;
- *x=*x;
- }
- else
- {
- *grav=NorthEastGravity;
- *x=*x-*w+1;
- }
- *y=0;
- break;
- }
-}
-
void sendNotify(const char *name,const char *message)//TODO//could be better
{
#ifdef _GOTNOTIFYSEND_
diff --git a/LFSDock/LFSDock/src/globals.h b/LFSDock/LFSDock/src/globals.h
index a4e595c..f00f58d 100644
--- a/LFSDock/LFSDock/src/globals.h
+++ b/LFSDock/LFSDock/src/globals.h
@@ -1,21 +1,21 @@
/*
*
- * ©K. D. Hedger. Sun 20 Sep 14:41:04 BST 2015 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:08:47 GMT 2023 keithdhedger@gmail.com
- * This file (globals.h) is part of LFSPanel.
+ * This file (globals.h) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
#include
@@ -32,6 +32,7 @@
#include "callbacks.h"
#include "clock.h"
#include "slider.h"
+#include "desktopSwitcher.h"
#ifndef _GLOBALS_
#define _GLOBALS_
@@ -59,56 +60,54 @@ struct launcherList
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 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 panelSize;
-extern int panelWidth;
-extern const monitorStruct *mons;
-extern int onMonitor;
-extern int panelPos;
-extern int panelGravity;
-extern const char *panelTextColour;
-extern const char *panelBGColour;
+extern int panelSize;
+extern int panelWidth;
+extern const monitorStruct *mons;
+extern int onMonitor;
+extern int panelPos;
+extern int panelGravity;
+extern const char *panelTextColour;
+extern const char *panelBGColour;
-extern int extraSpace;
+extern int extraSpace;
-extern int queueID;
-extern msgBuffer buffer;
-extern bool realMainLoop;
+extern int queueID;
+extern msgBuffer buffer;
+extern bool realMainLoop;
-extern const char *desktopTheme;
-extern int refreshRate;
+extern const char *desktopTheme;
+extern int refreshRate;
//panel window
extern LFSTK_applicationClass *apc;
-extern LFSTK_windowClass *mainwind;
-extern int leftOffset;
-extern int launcherSide;
+extern LFSTK_windowClass *mainwind;
+extern int launcherSide;
//atoms
-extern Atom WM_STATE;
-extern Atom NET_WM_WINDOW_TYPE_NORMAL;
-extern Atom NET_WM_STATE_HIDDEN;
-extern Atom NET_WM_WINDOW_TYPE_DIALOG;
-extern Atom NET_WM_DESKTOP;
-extern Atom NET_WM_WINDOW_TYPE;
-extern Atom NET_WM_STATE;
-extern Atom NET_WM_NAME;
-extern Atom UTF8_STRING;
+extern Atom WM_STATE;
+extern Atom NET_WM_WINDOW_TYPE_NORMAL;
+extern Atom NET_WM_STATE_HIDDEN;
+extern Atom NET_WM_WINDOW_TYPE_DIALOG;
+extern Atom NET_WM_DESKTOP;
+extern Atom NET_WM_WINDOW_TYPE;
+extern Atom NET_WM_STATE;
+extern Atom NET_WM_NAME;
+extern Atom UTF8_STRING;
-extern const char *possibleError;
+extern const char *possibleError;
void printError(const char *err);
-void setSizes(int *x,int *y,int *w,int *h,int *size,int *grav,bool fromleft);
void dropDesktopFile(const char *data,launcherList *launcher);
void sendNotify(const char *message1,const char *message2);
void setGadgetDetails(LFSTK_gadgetClass *gadget);
diff --git a/LFSDock/LFSDock/src/launchers.cpp b/LFSDock/LFSDock/src/launchers.cpp
index f39faac..0cff1f1 100644
--- a/LFSDock/LFSDock/src/launchers.cpp
+++ b/LFSDock/LFSDock/src/launchers.cpp
@@ -18,10 +18,7 @@
* along with LFSPanel. If not, see .
*/
-
#include
-#include
-#include
#include
#include "launchers.h"
@@ -109,51 +106,34 @@ int launcherBuildCB(const char *fpath,const struct stat *sb,int typeflag)
return(0);
}
-int addLaunchers(int x,int y,int grav,bool fromleft)
+int addLaunchers(int x,int y,int grav)
{
char *launchers;
- launcherList *loopll;
- ll=NULL;
+ launcherList *loopll=NULL;
char *icon=NULL;
int xpos=x;
int ypos=y;
- int width=0;
- int height=0;
- int thisgrav=grav;
- int iconsize=16;
- int maxwidth=0;
- int sx,sy;
- int adj;
asprintf(&launchers,"%s/launchers-DOCK",apc->configDir.c_str());
ftw(launchers,launcherBuildCB,16);
- setSizes(&xpos,&ypos,&width,&height,&iconsize,&thisgrav,fromleft);
- maxwidth=width;
- sx=xpos;
- sy=ypos;
-
- popWindow=new LFSTK_toolWindowClass(apc->display,mainwind,"_NET_WM_WINDOW_TYPE_MENU",0,0,200,100,"lfstkpopup",apc);
+ popWindow=new LFSTK_toolWindowClass(apc->display,mainwind,"_NET_WM_WINDOW_TYPE_MENU",0,0,100,100,"lfstkpopup",apc);
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+adj,width,height,thisgrav);
+ loopll->bc=new LFSTK_buttonClass(mainwind,"",xpos,ypos,iconSize,iconSize);
loopll->bc->LFSTK_setMouseCallBack(NULL,launcherCB,(void*)loopll);
loopll->bc->LFSTK_setGadgetDropCallBack(gadgetDrop,(void*)loopll);
- loopll->bc->LFSTK_setMouseMoveCallBack(moveCB,exitCB,USERDATA(loopll));
-fprintf(stderr,"name=>>%s<<\n",loopll->entry.name);
+ loopll->bc->LFSTK_setMouseMoveCallBack(enterCB,exitCB,USERDATA(loopll));
loopll->bc->gadgetAcceptsDnD=true;
+fprintf(stderr,"name=>>%s x=%i<<\n",loopll->entry.name,xpos);
if((loopll->icon!=NULL) && (desktopTheme!=NULL))
icon=apc->globalLib->LFSTK_findThemedIcon(desktopTheme,loopll->icon,"");
@@ -167,18 +147,9 @@ fprintf(stderr,"name=>>%s<<\n",loopll->entry.name);
if(icon!=NULL)
free(icon);
loopll=loopll->next;
- if((grav==PANELNORTH) || (grav==PANELSOUTH))
- {
- if(fromleft==false)
- sx-=width;
- else
- sx+=width;
- }
- else
- sy+=height;
- maxwidth+=width;
+ xpos+=iconSize;
}
free(launchers);
- return(maxwidth-width);
+ return(xpos);
}
diff --git a/LFSDock/LFSDock/src/launchers.h b/LFSDock/LFSDock/src/launchers.h
index 510b899..f2bb147 100644
--- a/LFSDock/LFSDock/src/launchers.h
+++ b/LFSDock/LFSDock/src/launchers.h
@@ -26,6 +26,6 @@
extern launcherList *ll;
-int addLaunchers(int x,int y,int grav,bool fromleft);
+int addLaunchers(int x,int y,int grav);
#endif
diff --git a/LFSDock/LFSDock/src/main.cpp b/LFSDock/LFSDock/src/main.cpp
index 1e3f9ca..bfe05e6 100644
--- a/LFSDock/LFSDock/src/main.cpp
+++ b/LFSDock/LFSDock/src/main.cpp
@@ -1,21 +1,21 @@
/*
*
- * ©K. D. Hedger. Mon 7 Sep 13:20:24 BST 2015 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:08:13 GMT 2023 keithdhedger@gmail.com
- * This file (lfswmprefs.cpp) is part of LFSApplications.
+ * This file (main.cpp) is part of LFSDock.
- * LFSApplications is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation,either version 3 of the License,or
- * at your option) any later version.
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
- * LFSApplications is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSApplications. If not,see .
+ * along with LFSDock. If not, see .
*/
#include
@@ -31,6 +31,8 @@
#define RCNAME "lfsdock"
+int windowWidth=0;
+
void loadPrefs(const char *env)
{
prefs.LFSTK_loadVarsFromFile(env);
@@ -45,34 +47,42 @@ void loadPrefs(const char *env)
void addGadgets(void)
{
- int offset=leftOffset;
+ int offset=0;
+ int adj;
+
+ if(posMultiplier==-1)
+ adj=0;
+ else
+ adj=extraSpace;
for(int j=0; jlength();j++)
{
switch(prefs.LFSTK_getStringObject("gadgetsleft")->at(j))
{
case 'C':
- offset+=addClock(offset,mons->y,NorthWestGravity);
+ offset+=addClock(offset,adj,NorthWestGravity);
break;
- case 'S':
- offset+=iconSize;
+ case 's':
+ offset+=8;
break;
case 'l':
if(launcherSide==NOLAUNCHERS)
{
launcherSide=LAUNCHERINLEFT;
- offset+=addLaunchers(offset,mons->y,panelGravity,true);
+ offset+=addLaunchers(offset,adj,panelGravity);
}
else
printError("Duplicate launcher widget");
break;
- case 's':
- offset+=addSlider(offset,mons->y,panelGravity,true);//TODO//
+ case 'S':
+ offset+=addSlider(offset,adj,panelGravity);
+ break;
+ case 'D':
+ offset+=addDesktopSwitcer(offset,adj,panelGravity);
break;
}
}
- offset++;
- leftOffset=offset;
+ windowWidth=offset;
}
int errHandler(Display *dpy,XErrorEvent *e)
@@ -128,14 +138,14 @@ void sanityCheck(void)
int main(int argc,char **argv)
{
- char *env;
- XEvent event;
- int psize;
- int thold;
- int px,py;
- timeval tv={0,0};
- int key=666;
- int refreshmulti=0;
+ char *env;
+ XEvent event;
+ int psize;
+ int thold;
+ int px,py;
+ timeval tv={0,0};
+ int key=666;
+ int refreshmulti=0;
configDir=getenv("HOME") + std::string("/.config/LFS/");
launchersDir=configDir + std::string("launchers-DOCK");
@@ -217,20 +227,17 @@ int main(int argc,char **argv)
desktopTheme=mainwind->globalLib->desktopIconTheme.c_str();
mons=apc->LFSTK_getMonitorData(onMonitor);
- leftOffset=0;
-
mainwind->LFSTK_setTile(NULL,0);
mainwind->LFSTK_setWindowColourName(NORMALCOLOUR,"#00000000");
-
+ windowWidth=0;
addGadgets();
-
- if(leftOffset==0)
+ if(windowWidth==0)
{
- fprintf(stderr,"Not using empty panel ...\n");
+ fprintf(stderr,"Not using empty dock ...\n");
exit(0);
}
- psize=leftOffset;
+ psize=windowWidth;
px=mons->x;
py=mons->y;
switch(panelGravity)
@@ -268,13 +275,10 @@ int main(int argc,char **argv)
mainwind->LFSTK_resizeWindow(panelWidth,iconSize+extraSpace,true);
if(posMultiplier==1)
- {
- mainwind->LFSTK_moveWindow(px,py-extraSpace,true);
- }
+ mainwind->LFSTK_moveWindow(px,py-extraSpace,true);
else
- {
- mainwind->LFSTK_moveWindow(px,py,true);
- }
+ 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 68c51c4..ab62df5 100644
--- a/LFSDock/LFSDock/src/slider.cpp
+++ b/LFSDock/LFSDock/src/slider.cpp
@@ -1,41 +1,38 @@
/*
*
- * ©K. D. Hedger. Thu 3 Jan 12:11:08 GMT 2019 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:09:57 GMT 2023 keithdhedger@gmail.com
- * This file (slider.cpp) is part of LFSPanel.
+ * This file (slider.cpp) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
-#include
-#include
-#include
#include
#include "globals.h"
-LFSTK_scrollBarClass *vsb=NULL;
+LFSTK_scrollBarClass *vsb=NULL;
LFSTK_windowClass *scwindow=NULL;
-bool windowVisible=false;
+bool windowVisible=false;
LFSTK_toggleButtonClass *volumeButton;
-char *iconH=NULL;
-char *iconM=NULL;
-char *iconL=NULL;
-char *iconZ=NULL;
+char *iconH=NULL;
+char *iconM=NULL;
+char *iconL=NULL;
+char *iconZ=NULL;
int oldVolVal=-1;
-char label[32];
-bool isUp=false;
+char label[32];
+bool sliderIsUp=false;
void setLabel(void)
{
@@ -48,11 +45,11 @@ void setLabel(void)
int getAlsaVolume(bool setvol,int volume)
{
long value=-1;
- snd_mixer_t *handle;
+ snd_mixer_t *handle;
snd_mixer_selem_id_t *sid;
snd_mixer_elem_t *elem;
- const char *card="default";
- const char *selem_name="Master";
+ const char *card="default";
+ const char *selem_name="Master";
snd_mixer_open(&handle,0);
snd_mixer_attach(handle,card);
@@ -123,7 +120,6 @@ bool sliderCB(void *p,void* ud)
scwindow->LFSTK_hideWindow();
apc->windows->at(apc->LFSTK_findWindow(scwindow)).showing=false;
}
- //bc->LFSTK_clearWindow();
}
return(true);
}
@@ -133,7 +129,7 @@ bool valChanged(void *p,void* ud)
LFSTK_scrollBarClass *sb=NULL;
char *command;
char *vol;
- int volume=-1;
+ int volume=-1;
if(p!=NULL)
{
@@ -147,7 +143,7 @@ bool valChanged(void *p,void* ud)
return(true);
}
-void updateSlider(void)//TODO//when large icon
+void updateSlider(void)
{
int volume;
@@ -172,7 +168,7 @@ bool volExitCB(LFSTK_gadgetClass*p,void* ud)
adj=extraSpace*posMultiplier;
p->LFSTK_getGeom(&geom2);
p->LFSTK_moveGadget(geom2.x,geom2.y+adj);
- isUp=false;
+ sliderIsUp=false;
return(true);
}
@@ -181,36 +177,27 @@ bool volMoveCB(LFSTK_gadgetClass*p,void* ud)
geometryStruct geom;
int adj;
- if(isUp==true)
+ if(sliderIsUp==true)
return(true);
adj=extraSpace*posMultiplier;
p->LFSTK_getGeom(&geom);
p->LFSTK_moveGadget(geom.x,geom.y-adj);
- isUp=true;
+ sliderIsUp=true;
return(true);
}
-int addSlider(int x,int y,int grav,bool fromleft)
+int addSlider(int x,int y,int grav)
{
- int xpos=x;
- int ypos=y;
- int width=0;
- int height=0;
- int thisgrav=grav;
- int iconsize=16;
- int adj;
- char *label=mainwind->globalLib->LFSTK_oneLiner("amixer get Master|tail -n1|awk '{print \"%s \" $4}'|tr -d '[]'",SLIDERLABEL);
-
- if(posMultiplier==-1)
- adj=0;
- else
- adj=extraSpace;
+ char *vol=mainwind->globalLib->LFSTK_oneLiner("amixer get Master|tail -n1|awk '{print $3}'");
+ char *label=mainwind->globalLib->LFSTK_oneLiner("amixer get Master|tail -n1|awk '{print \"%s \" $4}'|tr -d '[]'",SLIDERLABEL);//TODO//
+ windowInitStruct *win=new windowInitStruct;;
+ int w,h;
+ bool direction=false;
getAlsaVolume(false,-1);
- setSizes(&xpos,&ypos,&width,&height,&iconsize,&thisgrav,fromleft);
- volumeButton=new LFSTK_toggleButtonClass(mainwind,label,xpos,ypos+adj,iconSize,iconSize,thisgrav);
+ volumeButton=new LFSTK_toggleButtonClass(mainwind,label,x,y,iconSize,iconSize);
volumeButton->LFSTK_setToggleStyle(TOGGLENORMAL);
volumeButton->LFSTK_setMouseCallBack(NULL,sliderCB,(void*)volumeButton->LFSTK_getLabel());
volumeButton->LFSTK_setMouseMoveCallBack(volMoveCB,volExitCB,USERDATA(0));
@@ -235,20 +222,10 @@ int addSlider(int x,int y,int grav,bool fromleft)
iconL=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"volume-low","");
iconZ=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"volume-zero","");
- char *vol=mainwind->globalLib->LFSTK_oneLiner("amixer get Master|tail -n1|awk '{print $3}'");
-
- windowInitStruct *win;
- int w,h;
-
- win=new windowInitStruct;
win->x=100;
win->y=100;
- bool direction=false;
-
w=100;
h=16;
- direction=false;
-
win->w=w;
win->h=h;
apc->LFSTK_addToolWindow(win);
@@ -265,6 +242,6 @@ int addSlider(int x,int y,int grav,bool fromleft)
free(vol);
free(label);
- return(width);
+ return(iconSize);
}
diff --git a/LFSDock/LFSDock/src/slider.h b/LFSDock/LFSDock/src/slider.h
index 100ef42..de0b64c 100644
--- a/LFSDock/LFSDock/src/slider.h
+++ b/LFSDock/LFSDock/src/slider.h
@@ -1,21 +1,21 @@
/*
*
- * ©K. D. Hedger. Thu 3 Jan 12:10:58 GMT 2019 keithdhedger@gmail.com
+ * ©K. D. Hedger. Sun 19 Nov 19:10:07 GMT 2023 keithdhedger@gmail.com
- * This file (slider.h) is part of LFSPanel.
+ * This file (slider.h) is part of LFSDock.
- * LFSPanel is free software: you can redistribute it and/or modify
+ * LFSDock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
+ * (at your option) any later version.
- * LFSPanel is distributed in the hope that it will be useful,
+ * LFSDock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
- * along with LFSPanel. If not, see .
+ * along with LFSDock. If not, see .
*/
#ifndef _SLIDER_
@@ -24,7 +24,7 @@
#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;
@@ -34,7 +34,7 @@ extern char *iconL;
extern int oldVolVal;
void setIcon(void);
-int addSlider(int x,int y,int grav,bool fromleft);
+int addSlider(int x,int y,int grav);
void updateSlider(void);
int getAlsaVolume(bool setvol,int volume);