mirror of
https://github.com/KeithDHedger/LFSDesktopProject.git
synced 2025-07-29 12:10:57 +00:00
added lfstrayprefs, lfswm2 fixes ...
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
0.2.0
|
||||
Added lfstrayprefs.
|
||||
Updated lfswm2prefs.
|
||||
Update to use new prefsclass functions.
|
||||
Added killall docks to lfsappearance 'Apply'.
|
||||
Added prelight colour to lfsdockprefs.
|
||||
|
@ -9,6 +9,7 @@ lfsdesktopprefs_SOURCES = ../src/lfsdesktopprefs.cpp
|
||||
lfspanelprefs_SOURCES = ../src/lfspanelprefs.cpp
|
||||
lfswm2prefs_SOURCES = ../src/lfswm2prefs.cpp
|
||||
lfsdockprefs_SOURCES = ../src/lfsdockprefs.cpp
|
||||
lfstrayprefs_SOURCES = ../src/lfstrayprefs.cpp
|
||||
|
||||
lfsfilechooser_SOURCES = ../src/lfsfilechooser.cpp
|
||||
lfscolourchooser_SOURCES = ../src/lfscolourchooser.cpp
|
||||
@ -21,4 +22,4 @@ lfswmprefs_SOURCES = ../src/lfswmprefs.cpp
|
||||
|
||||
man1_MANS = ../resources/man/lfsapplications.1
|
||||
|
||||
bin_PROGRAMS = lfstkprefs lfsappearance lfsbackdropprefs lfsdesktopprefs lfspanelprefs lfswm2prefs lfsdockprefs lfsfilechooser lfscolourchooser lfsabout lfsfontselect lfsruncommand lfsmimeeditor lfswmprefs
|
||||
bin_PROGRAMS = lfstkprefs lfsappearance lfsbackdropprefs lfsdesktopprefs lfspanelprefs lfswm2prefs lfsdockprefs lfsfilechooser lfscolourchooser lfsabout lfsfontselect lfsruncommand lfsmimeeditor lfswmprefs lfstrayprefs
|
||||
|
@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=LFS Tray Prefs
|
||||
Comment=Prefs for LFS Tray
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Gnome;GTK;;Settings;DesktopSettings;
|
||||
Icon=LFSTKPrefs
|
||||
Exec=lfstrayprefs
|
@ -58,7 +58,7 @@ LFSTK_ExpanderGadgetClass *multi=NULL;
|
||||
|
||||
int queueID=-1;
|
||||
|
||||
infoDataStruct **groupNameMenuItems=NULL;
|
||||
infoDataStruct **groupNameMenuItems=NULL;
|
||||
LFSTK_findClass *find;
|
||||
|
||||
bool doQuit(void *p,void* ud)
|
||||
@ -199,6 +199,12 @@ bool buttonCB(void *p,void* ud)
|
||||
system(command);
|
||||
free(command);
|
||||
}
|
||||
if(strcmp((char*)ud,"TRAYPREFS")==0)
|
||||
{
|
||||
asprintf(&command,"%slfstrayprefs -w %i &",libpath,wc->window);
|
||||
system(command);
|
||||
free(command);
|
||||
}
|
||||
if(strcmp((char*)ud,"UPDATE")==0)
|
||||
{
|
||||
makeGroup(currentSet->LFSTK_getCStr());
|
||||
@ -252,7 +258,6 @@ void doNewGroup(void)
|
||||
|
||||
bool menuCB(void *p,void* ud)
|
||||
{
|
||||
//if(strcmp(static_cast<LFSTK_gadgetClass*>(p)->LFSTK_getLabel(),"Add Group")==0)
|
||||
if(static_cast<LFSTK_gadgetClass*>(p)->LFSTK_getLabel().compare("Add Group")==0)
|
||||
{
|
||||
doNewGroup();
|
||||
@ -369,6 +374,14 @@ int main(int argc, char **argv)
|
||||
hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel});
|
||||
sy+=YSPACING;
|
||||
|
||||
//tray
|
||||
launchButton=new LFSTK_buttonClass(wc,"Tray Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"TRAYPREFS");
|
||||
hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton});
|
||||
launchLabel=new LFSTK_labelClass(wc,"Launch Tray Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT);
|
||||
hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel});
|
||||
sy+=YSPACING;
|
||||
|
||||
//load set
|
||||
loadSet=new LFSTK_buttonClass(wc,"Load Set",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
loadSet->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"SHOWGROUPS");
|
||||
|
269
LFSApplications/LFSApplications/src/lfstrayprefs.cpp
Executable file
269
LFSApplications/LFSApplications/src/lfstrayprefs.cpp
Executable file
@ -0,0 +1,269 @@
|
||||
/*
|
||||
*
|
||||
* ©K. D. Hedger. Sat 15 Feb 12:57:49 GMT 2025 keithdhedger@gmail.com
|
||||
|
||||
* This file (lfstrayprefs.cpp) is part of LFSApplications.
|
||||
|
||||
* LFSApplications 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.
|
||||
|
||||
* LFSApplications 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <lfstk/LFSTKGlobals.h>
|
||||
|
||||
#define BOXLABEL "LFSTray Prefs"
|
||||
#define EDITBOXWIDTH GADGETWIDTH*4
|
||||
#define TRAYPOSMENUSIZE 8
|
||||
|
||||
enum TrayPos{NW=1,NE,SE,SW,N,E,S,W};
|
||||
|
||||
LFSTK_applicationClass *apc=NULL;
|
||||
LFSTK_windowClass *wc=NULL;
|
||||
LFSTK_labelClass *label=NULL;
|
||||
LFSTK_labelClass *personal=NULL;
|
||||
LFSTK_labelClass *copyrite=NULL;
|
||||
LFSTK_buttonClass *seperator=NULL;
|
||||
LFSTK_buttonClass *quit=NULL;
|
||||
LFSTK_buttonClass *apply=NULL;
|
||||
|
||||
//prefs
|
||||
LFSTK_lineEditClass *onMonitor=NULL;
|
||||
LFSTK_lineEditClass *iconSize=NULL;
|
||||
LFSTK_lineEditClass *gravity=NULL;
|
||||
LFSTK_toggleButtonClass *vertical=NULL;
|
||||
LFSTK_toggleButtonClass *below=NULL;
|
||||
LFSTK_toggleButtonClass *noDups=NULL;
|
||||
LFSTK_buttonClass *tileFilepath=NULL;
|
||||
LFSTK_lineEditClass *tileFilepathEdit=NULL;
|
||||
|
||||
//tray postion
|
||||
LFSTK_buttonClass *trayPosWindowMenu=NULL;
|
||||
LFSTK_lineEditClass *trayPosWindowEdit=NULL;
|
||||
infoDataStruct **trayPosMenus;
|
||||
const char *trayPosMenuNames[]={"NW","NE","SE","SW","N","E","S","W"};
|
||||
LFSTK_menuClass *trayPosMenu=NULL;
|
||||
int grav=0;
|
||||
|
||||
LFSTK_prefsClass prefs("lfstrayprefs",VERSION);
|
||||
char *envFile=NULL;
|
||||
int parentWindow=-1;
|
||||
//msg
|
||||
int queueID=-1;
|
||||
|
||||
bool doQuit(void *p,void* ud)
|
||||
{
|
||||
apc->exitValue=0;
|
||||
apc->mainLoop=false;
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool buttonCB(void *p,void* ud)
|
||||
{
|
||||
LFSTK_buttonClass *button=NULL;
|
||||
|
||||
if(strcmp((char*)ud,"TRAYPOS")==0)
|
||||
trayPosMenu->LFSTK_showMenu();
|
||||
|
||||
if(strcmp((char*)ud,"SELECTIMAGE")==0)
|
||||
{
|
||||
LFSTK_fileDialogClass *image=NULL;
|
||||
image=new LFSTK_fileDialogClass(wc,"Select File",NULL,FILEDIALOG,"lfstrayfilepath");
|
||||
|
||||
image->LFSTK_showFileDialog(NULL,"Select Image Path");
|
||||
if(image->LFSTK_isValid()==true)
|
||||
tileFilepathEdit->LFSTK_setBuffer(image->LFSTK_getCurrentPath());
|
||||
delete image;
|
||||
return(true);
|
||||
}
|
||||
|
||||
if(strcmp((char*)ud,"APPLY")==0)
|
||||
{
|
||||
prefs.LFSTK_deleteFromPrefs("window");
|
||||
|
||||
prefs.LFSTK_setInt("monitor",atoi(onMonitor->LFSTK_getCStr()));
|
||||
prefs.LFSTK_setInt("iconsize",atoi(iconSize->LFSTK_getCStr()));
|
||||
prefs.LFSTK_setInt("gravity",grav);
|
||||
prefs.LFSTK_setBool("vertical",vertical->LFSTK_getValue());
|
||||
prefs.LFSTK_setBool("below",below->LFSTK_getValue());
|
||||
prefs.LFSTK_setBool("no-duplicates",noDups->LFSTK_getValue());
|
||||
prefs.LFSTK_setString("filepath",tileFilepathEdit->LFSTK_getCStr());
|
||||
prefs.LFSTK_saveVarsToFile(envFile);
|
||||
//prefs.LFSTK_saveVarsToFile("-");
|
||||
apc->globalLib->LFSTK_oneLiner("%s","pgrep \"^lfstray$\" |xargs kill -TERM");
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool trayPosMenuCB(void *p,void* ud)
|
||||
{
|
||||
static_cast<LFSTK_gadgetClass*>(p)->wc->LFSTK_hideWindow();
|
||||
trayPosWindowEdit->LFSTK_setBuffer(static_cast<LFSTK_gadgetClass*>(p)->LFSTK_getLabel());
|
||||
grav=(int)(long)ud+1;
|
||||
return(true);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int sy=0;
|
||||
int sx=BORDER;
|
||||
bool flag=false;
|
||||
int retcode;
|
||||
int receiveType=IPC_NOWAIT;
|
||||
msgBuffer mbuffer;
|
||||
std::string bffr;
|
||||
LFSTK_buttonClass *seperator=NULL;
|
||||
|
||||
option longOptions[]=
|
||||
{
|
||||
{"window",required_argument,0,'w'},
|
||||
{"monitor",required_argument,0,'m'},
|
||||
{"iconsize",required_argument,0,'i'},
|
||||
{"gravity",required_argument,0,'g'},
|
||||
{"vertical",no_argument,0,'V'},
|
||||
{"below",no_argument,0,'b'},
|
||||
{"no-duplicates",no_argument,0,'d'},
|
||||
{"filepath",required_argument,0,'f'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
apc=new LFSTK_applicationClass();
|
||||
prefs.prefsMap=
|
||||
{
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("monitor"),{TYPEINT,"monitor","Place on monitor ARG","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("iconsize"),{TYPEINT,"iconsize","Iconsize ARG","",false,32}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("gravity"),{TYPEINT,"gravity","Gravity NW ARG=1,NE ARG=2,SE ARG=3,SW ARG=4,N ARG=5,E ARG=6,S ARG=7,W ARG=8","",false,NW}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("vertical"),{TYPEBOOL,"vertical","Vertical systray ( default horizontal )","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("below"),{TYPEBOOL,"below","Below all windows ( default above )","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("filepath"),{TYPESTRING,"filepath","Use external file, if ARG begins with '#' use solid colour, eg '#ff0000'","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("no-duplicates"),{TYPEBOOL,"no-duplicates","Don't allow duplicate items ( by _NET_WM_NAME property )","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Set transient for window ARG","",false,-1}}
|
||||
};
|
||||
|
||||
parentWindow=prefs.LFSTK_getInt("window");
|
||||
//prefs.LFSTK_deleteFromPrefs("window");
|
||||
asprintf(&envFile,"%s/lfstray.rc",apc->configDir.c_str());
|
||||
prefs.LFSTK_loadVarsFromFile(envFile);
|
||||
|
||||
if(prefs.LFSTK_argsToPrefs(argc,argv,longOptions,true)==false)
|
||||
return(1);
|
||||
|
||||
apc->LFSTK_addWindow(NULL,BOXLABEL,"LFSTKPrefs");
|
||||
wc=apc->mainWindow;
|
||||
|
||||
bffr=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %S/lfsappearance.rc",apc->configDir);
|
||||
if((queueID=msgget(std::stoi(bffr,nullptr,10),IPC_CREAT|0660))==-1)
|
||||
fprintf(stderr,"Can't create message queue :( ...\n");
|
||||
|
||||
while(flag==false)
|
||||
{
|
||||
retcode=msgrcv(queueID,&mbuffer,MAX_MSG_SIZE,MSGANY,receiveType);
|
||||
if(retcode<=1)
|
||||
flag=true;
|
||||
}
|
||||
|
||||
copyrite=new LFSTK_labelClass(wc,COPYRITE,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE);
|
||||
sy+=HALFYSPACING;
|
||||
personal=new LFSTK_labelClass(wc,PERSONAL,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE);
|
||||
personal->LFSTK_setCairoFontDataParts("B");
|
||||
sy+=YSPACING;
|
||||
|
||||
//monitor
|
||||
label=new LFSTK_labelClass(wc,"On monitor",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT);
|
||||
sx+=GADGETWIDTH+BORDER;
|
||||
onMonitor=new LFSTK_lineEditClass(wc,std::to_string(prefs.LFSTK_getInt("monitor")).c_str(),sx,sy,EDITBOXWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
sy+=YSPACING;
|
||||
sx=BORDER;
|
||||
//iconsize
|
||||
label=new LFSTK_labelClass(wc,"Icon Size",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT);
|
||||
sx+=GADGETWIDTH+BORDER;
|
||||
iconSize=new LFSTK_lineEditClass(wc,std::to_string(prefs.LFSTK_getInt("iconsize")).c_str(),sx,sy,EDITBOXWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
sy+=YSPACING;
|
||||
sx=BORDER;
|
||||
|
||||
//tray position
|
||||
trayPosWindowMenu=new LFSTK_buttonClass(wc,"Tray Position",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
trayPosWindowMenu->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"TRAYPOS");
|
||||
trayPosMenu=new LFSTK_menuClass(wc,BORDER+GADGETWIDTH,sy,1,1);
|
||||
trayPosMenu->LFSTK_setMouseCallBack(NULL,trayPosMenuCB,NULL);
|
||||
|
||||
trayPosMenus=new infoDataStruct*[TRAYPOSMENUSIZE];
|
||||
for(long j=0;j<TRAYPOSMENUSIZE;j++)
|
||||
{
|
||||
trayPosMenus[j]=new infoDataStruct;
|
||||
trayPosMenus[j]->label=strdup(trayPosMenuNames[j]);
|
||||
trayPosMenus[j]->userData=(void*)j;
|
||||
}
|
||||
trayPosMenu->LFSTK_addMainMenus(trayPosMenus,TRAYPOSMENUSIZE);
|
||||
grav=prefs.LFSTK_getInt("gravity");
|
||||
|
||||
sx+=GADGETWIDTH+BORDER;
|
||||
trayPosWindowEdit=new LFSTK_lineEditClass(wc,trayPosMenuNames[prefs.LFSTK_getInt("gravity")-1],sx,sy,EDITBOXWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
sy+=YSPACING;
|
||||
sx=BORDER;
|
||||
|
||||
//vertical
|
||||
vertical=new LFSTK_toggleButtonClass(wc,"Vertical Tray",BORDER,sy,GADGETWIDTH,CHECKBOXSIZE,NorthWestGravity);
|
||||
vertical->LFSTK_setValue(prefs.LFSTK_getBool("vertical"));
|
||||
sy+=YSPACING-8;
|
||||
sx=BORDER;
|
||||
|
||||
//below
|
||||
below=new LFSTK_toggleButtonClass(wc,"Tray Below Windows",BORDER,sy,GADGETWIDTH,CHECKBOXSIZE,NorthWestGravity);
|
||||
below->LFSTK_setValue(prefs.LFSTK_getBool("below"));
|
||||
sy+=YSPACING-8;
|
||||
sx=BORDER;
|
||||
|
||||
//filepath
|
||||
tileFilepath=new LFSTK_buttonClass(wc,"Background",sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
tileFilepath->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"SELECTIMAGE");
|
||||
sx+=GADGETWIDTH+BORDER;
|
||||
tileFilepathEdit=new LFSTK_lineEditClass(wc,prefs.LFSTK_getCString("filepath"),sx,sy,EDITBOXWIDTH*2+BORDER,GADGETHITE,BUTTONGRAV);
|
||||
sy+=YSPACING;
|
||||
sx=BORDER;
|
||||
|
||||
//no-duplicates
|
||||
noDups=new LFSTK_toggleButtonClass(wc,"No Duplicate Icons",BORDER,sy,GADGETWIDTH,CHECKBOXSIZE,NorthWestGravity);
|
||||
noDups->LFSTK_setValue(prefs.LFSTK_getBool("no-duplicates"));
|
||||
sy+=YSPACING-8;
|
||||
sx=BORDER;
|
||||
|
||||
//line
|
||||
seperator=new LFSTK_buttonClass(wc,"--",0,sy,DIALOGWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
seperator->LFSTK_setStyle(BEVELNONE);
|
||||
seperator->gadgetDetails.buttonTile=false;
|
||||
seperator->gadgetDetails.colour=&wc->windowColourNames[NORMALCOLOUR];
|
||||
sy+=YSPACING;
|
||||
|
||||
//quit
|
||||
quit=new LFSTK_buttonClass(wc,"Quit",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
quit->LFSTK_setMouseCallBack(NULL,doQuit,NULL);
|
||||
|
||||
//apply
|
||||
apply=new LFSTK_buttonClass(wc,"Apply",DIALOGWIDTH-BORDER-GADGETWIDTH,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
apply->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"APPLY");
|
||||
sy+=YSPACING;
|
||||
|
||||
wc->LFSTK_resizeWindow(DIALOGWIDTH,sy,true);
|
||||
wc->LFSTK_showWindow();
|
||||
wc->LFSTK_setKeepAbove(true);
|
||||
if(parentWindow!=-1)
|
||||
wc->LFSTK_setTransientFor(parentWindow);
|
||||
|
||||
printf("Number of gadgets in window=%i\n",wc->LFSTK_gadgetCount());
|
||||
|
||||
int retval=apc->LFSTK_runApp();
|
||||
|
||||
delete apc;
|
||||
cairo_debug_reset_static_data();
|
||||
return retval;
|
||||
}
|
@ -62,28 +62,28 @@ LFSTK_lineEditClass *themeEdit=NULL;
|
||||
//placement
|
||||
LFSTK_buttonClass *placeWindowMenu=NULL;
|
||||
LFSTK_lineEditClass *placeWindowEdit=NULL;
|
||||
infoDataStruct **placementMenus;
|
||||
infoDataStruct **placementMenus;
|
||||
const char *placementMenuNames[]={"No placement","Under Mouse","Centre On Monitor With Mouse","Centre On Screen","TODO"};
|
||||
LFSTK_menuClass *placeMenu=NULL;
|
||||
|
||||
//resize
|
||||
LFSTK_buttonClass *resizeWindowMenu=NULL;
|
||||
LFSTK_lineEditClass *resizeWindowEdit=NULL;
|
||||
infoDataStruct **resizeMenus;
|
||||
infoDataStruct **resizeMenus;
|
||||
const char *resizeMenuNames[]={"Fast Resize","Live Resize"};
|
||||
LFSTK_menuClass *resizeMenu=NULL;
|
||||
|
||||
//title postion
|
||||
LFSTK_buttonClass *titlePosWindowMenu=NULL;
|
||||
LFSTK_lineEditClass *titlePosWindowEdit=NULL;
|
||||
infoDataStruct **titlePosMenus;
|
||||
infoDataStruct **titlePosMenus;
|
||||
const char *titlePosMenuNames[]={"Left","Centre","Right"};
|
||||
LFSTK_menuClass *titlePosMenu=NULL;
|
||||
|
||||
//force dock stack order
|
||||
LFSTK_buttonClass *forceDockStackWindowMenu=NULL;
|
||||
LFSTK_lineEditClass *forceDockStackWindowEdit=NULL;
|
||||
infoDataStruct **forceDockStackMenus;
|
||||
infoDataStruct **forceDockStackMenus;
|
||||
const char *forceDockStackMenuNames[]={"Force Above","Force Below"};
|
||||
LFSTK_menuClass *forceDockStackMenu=NULL;
|
||||
|
||||
@ -217,7 +217,6 @@ bool buttonCB(void *p,void* ud)
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("placement"),{TYPEINT,"placement","","",false,prefsPlacementTemp}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("desktops"),{TYPEINT,"desktops","","",false,atoi(deskCountEdit->LFSTK_getCStr())}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("resizemode"),{TYPEINT,"resizemode","","",false,prefsResizeTemp}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("rescanprefs"),{TYPEINT,"rescanprefs","","",false,atoi(rescanEdit->LFSTK_getCStr())}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("forcedocksstack"),{TYPEINT,"forcedocksstack","","",false,forceDockStackTemp}},
|
||||
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("modkeys"),{TYPEINT,"modkeys","","",false,prefsModkeys1Temp}}
|
||||
@ -232,6 +231,7 @@ bool buttonCB(void *p,void* ud)
|
||||
sprintf(mbuffer.mText,"reloadtheme");
|
||||
if((msgsnd(queueID,&mbuffer,strlen(mbuffer.mText)+1,0))==-1)
|
||||
fprintf(stderr,"Can't send message :(\n");
|
||||
std::vector<std::string> retsv=apc->globalLib->LFSTK_runAndGet("%s","pgrep \"^lfswm2$\" |xargs kill -SIGUSR1");
|
||||
reloadwm=false;
|
||||
return(true);
|
||||
}
|
||||
@ -355,11 +355,11 @@ int main(int argc, char **argv)
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("framefg"),{TYPESTRING,"framefg","","white",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","","black",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("forcedocksstack"),{TYPEINT,"forcedocksstack","","",false,1}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("rescanprefs"),{TYPEINT,"rescanprefs","","",false,10}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("resizemode"),{TYPEINT,"resizemode","","",false,2}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("modkeys"),{TYPEINT,"modkeys","","",false,64}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("framealpha"),{TYPEINT,"framealpha","","",false,255}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("framealpha"),{TYPEINT,"framealpha","","",false,255}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Set transient for window ARG","",false,0}}
|
||||
};
|
||||
|
||||
@ -565,13 +565,6 @@ int main(int argc, char **argv)
|
||||
sy+=YSPACING;
|
||||
sx=BORDER;
|
||||
|
||||
//rescan prefs
|
||||
label=new LFSTK_labelClass(wc,"Rescan Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT);
|
||||
sx+=GADGETWIDTH+BORDER;
|
||||
rescanEdit=new LFSTK_lineEditClass(wc,std::to_string(prefs.LFSTK_getInt("rescanprefs")).c_str(),sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
sy+=YSPACING;
|
||||
sx=BORDER;
|
||||
|
||||
//force dock stack order
|
||||
forceDockStackWindowMenu=new LFSTK_buttonClass(wc,"Dock Stacking",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV);
|
||||
forceDockStackWindowMenu->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"FORCEDOCKSTACK");
|
||||
|
@ -1,4 +1,5 @@
|
||||
0.2.0
|
||||
Fixed minor graphics glitch when setting 'no button borders'.
|
||||
Fixed slider.
|
||||
Removed "%u/%U/%f/%F" from command when launching from app menu.
|
||||
Fixed sending empty "%u" to launchers.
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include <experimental/filesystem>
|
||||
|
||||
|
||||
#define COPYRITE "Copyright © 2013-2024 K.D.Hedger"
|
||||
#define COPYRITE "Copyright © 2013-2025 K.D.Hedger"
|
||||
#define PERSONAL "kdhedger68713@gmail.com"
|
||||
#define MYWEBSITE "https://keithdhedger.github.io/"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
1.0.2
|
||||
Removed alarm timer, now use 'kill -SIGUSR1 $(pgrep "^lfswm2$")' to signal a change.
|
||||
Code clean.
|
||||
Fixed some configure window events.
|
||||
Moved some xlib fuctions out of lfswm2class.
|
||||
|
@ -35,7 +35,6 @@ LFSWM2_clientClass::~LFSWM2_clientClass(void)
|
||||
{
|
||||
XWindowAttributes x_window_attrs;
|
||||
|
||||
SHOWXERRORS
|
||||
this->mainClass->mainWindowClass->LFSWM2_freeHints(this->windowHints);
|
||||
this->mainClass->mainWindowClass->LFSWM2_setClientList(this->contentWindow,false);
|
||||
|
||||
@ -73,13 +72,10 @@ SHOWXERRORS
|
||||
XFreeGC(this->mainClass->display,this->menuControlStruct.controlGC);
|
||||
if(this->frameGC!=None)
|
||||
XFreeGC(this->mainClass->display,this->frameGC);
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
void LFSWM2_clientClass::LFSWM2_setWindowName(void)
|
||||
{
|
||||
HIDEXERRORS
|
||||
|
||||
char *namex=NULL;
|
||||
XTextProperty p;
|
||||
long unsigned int nitems_return;
|
||||
|
@ -31,6 +31,12 @@ LFSWM2_eventsClass::LFSWM2_eventsClass(LFSWM2_Class *mainclass)
|
||||
this->mainClass=mainclass;
|
||||
}
|
||||
|
||||
/*
|
||||
climsg -t 1005 -k 666 -s debugmsg;kill -SIGUSR1 $(pgrep lfswm2)
|
||||
climsg -t 1005 -k 666 -s reloadtheme;kill -SIGUSR1 $(pgrep lfswm2)
|
||||
climsg -t 1005 -k 666 -s restartwm;kill -SIGUSR1 $(pgrep lfswm2)
|
||||
climsg -t 1005 -k 666 -s quit;kill -SIGUSR1 $(pgrep lfswm2)
|
||||
*/
|
||||
void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void)
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
@ -53,54 +59,63 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void)
|
||||
{
|
||||
XEvent e;
|
||||
|
||||
if(this->mainClass->messages->whatMsg==QUITLFSWM)
|
||||
break;
|
||||
|
||||
if(this->mainClass->messages->whatMsg==RESTARTLFSWM)
|
||||
if(this->mainClass->messages->whatMsg!=NOMSG)
|
||||
{
|
||||
char self[PATH_MAX]={0};
|
||||
int nchar=readlink("/proc/self/exe",self,sizeof self);
|
||||
if(nchar>1)
|
||||
execv(self,this->mainClass->argv);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(this->mainClass->messages->whatMsg==REFRESHTHEME)
|
||||
{
|
||||
int mokeyshold=this->mainClass->modKeys;
|
||||
this->mainClass->mainWindowClass->LFSWM2_reloadTheme();
|
||||
this->mainClass->messages->whatMsg=NOMSG;
|
||||
LFSWM2_clientClass *ccs;
|
||||
for(long unsigned j=0;j<this->mainClass->mainWindowClass->windowIDList.size();j++)
|
||||
if(this->mainClass->messages->whatMsg==QUITLFSWM)
|
||||
{
|
||||
ccs=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(j));
|
||||
if(ccs!=NULL)
|
||||
{
|
||||
if(this->mainClass->mainWindowClass->theme.gotPart[LFSTK_UtilityClass::LFSTK_hashFromKey("menu-active")]==false)
|
||||
XMoveWindow(this->mainClass->display,ccs->menuButton,-1000,-1000);
|
||||
if(this->mainClass->mainWindowClass->theme.gotPart[LFSTK_UtilityClass::LFSTK_hashFromKey("shade-active")]==false)
|
||||
XMoveWindow(this->mainClass->display,ccs->shadeButton,-1000,-1000);
|
||||
|
||||
if(ccs->isFullscreen==false)
|
||||
{
|
||||
if(ccs->isBorderless==false)
|
||||
{
|
||||
XShapeCombineMask(this->mainClass->display,ccs->frameWindow,ShapeBounding,0,0,None,ShapeSet);
|
||||
ccs->setWindowRects(true);
|
||||
this->mainClass->mainWindowClass->LFSWM2_setControlRects(ccs);
|
||||
ccs->resetContentWindow();
|
||||
this->mainClass->mainWindowClass->LFSWM2_refreshFrame(ccs);
|
||||
ccs->resizeMode=this->mainClass->resizeMode;
|
||||
}
|
||||
}
|
||||
|
||||
XUngrabButton(this->mainClass->display,Button1,mokeyshold,ccs->contentWindow);
|
||||
XGrabButton(this->mainClass->display,Button1,(this->mainClass->modKeys),ccs->contentWindow,False,ButtonPressMask|ButtonReleaseMask|PointerMotionMask,GrabModeAsync,GrabModeAsync,None,None);
|
||||
XUngrabKey(this->mainClass->display,XKeysymToKeycode(this->mainClass->display,XK_Escape),mokeyshold,ccs->contentWindow);
|
||||
XGrabKey(this->mainClass->display,XKeysymToKeycode(this->mainClass->display,XK_Escape),(this->mainClass->modKeys),ccs->contentWindow,False,GrabModeSync,GrabModeAsync);
|
||||
}
|
||||
this->mainClass->messages->whatMsg=NOMSG;
|
||||
break;
|
||||
}
|
||||
this->noRestack=false;
|
||||
|
||||
if(this->mainClass->messages->whatMsg==RESTARTLFSWM)
|
||||
{
|
||||
this->mainClass->messages->whatMsg=NOMSG;
|
||||
char self[PATH_MAX]={0};
|
||||
int nchar=readlink("/proc/self/exe",self,sizeof self);
|
||||
if(nchar>1)
|
||||
execv(self,this->mainClass->argv);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(this->mainClass->messages->whatMsg==REFRESHTHEME)
|
||||
{
|
||||
this->mainClass->messages->whatMsg=NOMSG;
|
||||
int mokeyshold=this->mainClass->modKeys;
|
||||
this->mainClass->mainWindowClass->LFSWM2_reloadTheme();
|
||||
this->mainClass->messages->whatMsg=NOMSG;
|
||||
LFSWM2_clientClass *ccs;
|
||||
for(long unsigned j=0;j<this->mainClass->mainWindowClass->windowIDList.size();j++)
|
||||
{
|
||||
ccs=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(j));
|
||||
if(ccs!=NULL)
|
||||
{
|
||||
if(this->mainClass->mainWindowClass->theme.gotPart[LFSTK_UtilityClass::LFSTK_hashFromKey("menu-active")]==false)
|
||||
XMoveWindow(this->mainClass->display,ccs->menuButton,-1000,-1000);
|
||||
if(this->mainClass->mainWindowClass->theme.gotPart[LFSTK_UtilityClass::LFSTK_hashFromKey("shade-active")]==false)
|
||||
XMoveWindow(this->mainClass->display,ccs->shadeButton,-1000,-1000);
|
||||
|
||||
if(ccs->isFullscreen==false)
|
||||
{
|
||||
if(ccs->isBorderless==false)
|
||||
{
|
||||
XShapeCombineMask(this->mainClass->display,ccs->frameWindow,ShapeBounding,0,0,None,ShapeSet);
|
||||
ccs->setWindowRects(true);
|
||||
this->mainClass->mainWindowClass->LFSWM2_setControlRects(ccs);
|
||||
ccs->resetContentWindow();
|
||||
this->mainClass->mainWindowClass->LFSWM2_refreshFrame(ccs);
|
||||
ccs->resizeMode=this->mainClass->resizeMode;
|
||||
}
|
||||
}
|
||||
|
||||
XUngrabButton(this->mainClass->display,Button1,mokeyshold,ccs->contentWindow);
|
||||
XGrabButton(this->mainClass->display,Button1,(this->mainClass->modKeys),ccs->contentWindow,False,ButtonPressMask|ButtonReleaseMask|PointerMotionMask,GrabModeAsync,GrabModeAsync,None,None);
|
||||
XUngrabKey(this->mainClass->display,XKeysymToKeycode(this->mainClass->display,XK_Escape),mokeyshold,ccs->contentWindow);
|
||||
XGrabKey(this->mainClass->display,XKeysymToKeycode(this->mainClass->display,XK_Escape),(this->mainClass->modKeys),ccs->contentWindow,False,GrabModeSync,GrabModeAsync);
|
||||
}
|
||||
}
|
||||
this->noRestack=false;
|
||||
}
|
||||
this->mainClass->messages->whatMsg=NOMSG;
|
||||
}
|
||||
|
||||
XNextEvent(this->mainClass->display,&e);
|
||||
@ -232,7 +247,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void)
|
||||
|
||||
case MapNotify:
|
||||
{
|
||||
SHOWXERRORS
|
||||
//fprintf(stderr,"MapNotify main event loop window=%x when=%i\n",e.xmap.window,when++);
|
||||
Atom *v=NULL;
|
||||
long unsigned int nitems_return;
|
||||
@ -246,13 +260,11 @@ SHOWXERRORS
|
||||
XFree(v);
|
||||
}
|
||||
this->noRestack=false;
|
||||
HIDEXERRORS
|
||||
}
|
||||
break;
|
||||
|
||||
case MapRequest:
|
||||
{
|
||||
SHOWXERRORS
|
||||
// fprintf(stderr,"MapRequest main event loop window=%x when=%i\n",e.xmap.window,when++);
|
||||
this->noRestack=false;
|
||||
this->mainClass->mainWindowClass->LFSWM2_removeProp(this->mainClass->rootWindow,LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW"));
|
||||
@ -268,10 +280,8 @@ SHOWXERRORS
|
||||
{
|
||||
this->noRestack=false;
|
||||
}
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
SHOWXERRORS
|
||||
XMoveWindow(this->mainClass->display,e.xmaprequest.window,-1000000,-1000000);
|
||||
if(this->mainClass->mainWindowClass->LFSWM2_createClient(e.xmaprequest.window,hs)==false)
|
||||
{
|
||||
@ -280,7 +290,6 @@ SHOWXERRORS
|
||||
}
|
||||
XMoveResizeWindow(this->mainClass->display,e.xmaprequest.window,this->mainClass->leftSideBarSize,this->mainClass->titleBarSize,x_window_attrs.width,x_window_attrs.height);
|
||||
this->noRestack=true;
|
||||
HIDEXERRORS
|
||||
}
|
||||
break;
|
||||
|
||||
@ -303,20 +312,17 @@ HIDEXERRORS
|
||||
cc->configCnt++;
|
||||
if((cc->isBorderless==true) && (cc->configCnt<MAXCONFIGCNT))
|
||||
{
|
||||
SHOWXERRORS
|
||||
XWindowAttributes x_window_attrs;
|
||||
XGetWindowAttributes(this->mainClass->display,e.xconfigurerequest.window,&x_window_attrs);
|
||||
hintsDataStruct hs;
|
||||
hs=this->mainClass->mainWindowClass->LFSWM2_getWindowHints(e.xconfigurerequest.window);
|
||||
if((hs.mHints!=NULL) && (hs.mHints->decorations!=0))
|
||||
XMoveResizeWindow(this->mainClass->display,e.xconfigurerequest.window,hs.pt.x,hs.pt.y,hs.sh->min_width,hs.sh->min_height);
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
cc->configCnt=0;
|
||||
if((e.xconfigurerequest.value_mask & (CWWidth|CWHeight)) !=0)
|
||||
{
|
||||
SHOWXERRORS
|
||||
ch.width=e.xconfigurerequest.width+this->mainClass->riteSideBarSize+this->mainClass->leftSideBarSize;
|
||||
ch.height=e.xconfigurerequest.height+this->mainClass->titleBarSize+this->mainClass->bottomBarSize;
|
||||
if((cc->buttonDown==false) || (cc->isBorderless==false))
|
||||
@ -329,17 +335,14 @@ SHOWXERRORS
|
||||
ch.width=e.xconfigurerequest.width;
|
||||
ch.height=e.xconfigurerequest.height;
|
||||
XResizeWindow(this->mainClass->display,cc->contentWindow,ch.width,ch.height);
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
if((e.xconfigurerequest.value_mask & (CWX|CWY)) !=0)
|
||||
{
|
||||
SHOWXERRORS
|
||||
ch.x=e.xconfigurerequest.x;
|
||||
ch.y=e.xconfigurerequest.y;
|
||||
if(cc->isBorderless==false)
|
||||
XMoveWindow(this->mainClass->display,cc->frameWindow,ch.x,ch.y);
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
|
||||
@ -347,7 +350,6 @@ HIDEXERRORS
|
||||
|
||||
if((cc->buttonDown==false) && (cc->resizeMode==SCALERESIZE))
|
||||
XMoveWindow(this->mainClass->display,cc->resizeWindow,-100000,-100000);
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -361,9 +363,7 @@ HIDEXERRORS
|
||||
changes.sibling=e.xconfigurerequest.above;
|
||||
changes.stack_mode=e.xconfigurerequest.detail;
|
||||
|
||||
SHOWXERRORS
|
||||
XConfigureWindow(this->mainClass->display,e.xconfigurerequest.window,e.xconfigurerequest.value_mask,&changes);
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -375,6 +375,7 @@ HIDEXERRORS
|
||||
//fprintf(stderr,"PropertyNotify IN eventnumber %i atom name=%s\n",when++,XGetAtomName(this->mainClass->display,e.xproperty.atom));
|
||||
LFSWM2_clientClass *cc;
|
||||
//if(e.xproperty.window==0x3200006)
|
||||
#ifdef __DEBUG__
|
||||
if(false)
|
||||
{
|
||||
fprintf(stderr,"PropertyNotify eventnumber %i\n",when++);
|
||||
@ -385,14 +386,12 @@ HIDEXERRORS
|
||||
else
|
||||
fprintf(stderr,"state=%x =PropertyDelete \n",e.xproperty.state);
|
||||
fprintf(stderr,"send_event=%i\n",e.xproperty.send_event);
|
||||
#ifdef __DEBUG__
|
||||
this->mainClass->DEBUG_printAtom(e.xproperty.atom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if(e.xproperty.state==PropertyNewValue)
|
||||
{
|
||||
SHOWXERRORS
|
||||
bool unminim=false;
|
||||
cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(e.xproperty.window);
|
||||
if((cc!=NULL) && (cc->isMinimized==true))
|
||||
@ -407,7 +406,7 @@ SHOWXERRORS
|
||||
{
|
||||
if(((xh->flags & StateHint)==StateHint) && (xh->initial_state==NormalState))
|
||||
unminim=true;
|
||||
XFree((void*)xh);
|
||||
XFree((void*)xh);
|
||||
}
|
||||
}
|
||||
if(unminim==true)
|
||||
@ -418,35 +417,29 @@ SHOWXERRORS
|
||||
this->noRestack=false;
|
||||
break;
|
||||
}
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
if((e.xproperty.state==PropertyNewValue) || (e.xproperty.state==PropertyDelete))
|
||||
{
|
||||
if(e.xproperty.atom==this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CURRENT_DESKTOP")))
|
||||
{
|
||||
SHOWXERRORS
|
||||
if(e.xproperty.window==this->mainClass->rootWindow)
|
||||
{
|
||||
this->noRestack=false;
|
||||
this->mainClass->LFSWM2_setCurrentDesktopFromRoot();
|
||||
}
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
|
||||
if(e.xproperty.atom==this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE")))
|
||||
{
|
||||
SHOWXERRORS
|
||||
this->noRestack=false;
|
||||
cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(e.xproperty.window);
|
||||
if(cc!=NULL)
|
||||
{
|
||||
cc->LFSWM2_setNetWMState(&e);
|
||||
HIDEXERRORS
|
||||
break;
|
||||
}
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
if(e.xproperty.atom==this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_NAME")))
|
||||
@ -464,29 +457,24 @@ HIDEXERRORS
|
||||
if(cc!=NULL)
|
||||
this->mainClass->mainWindowClass->LFSWM2_reloadWindowState(cc->contentWindow);
|
||||
}
|
||||
HIDEXERRORS
|
||||
}
|
||||
//fprintf(stderr,"PropertyNotify OUT eventnumber %i\n",when++);
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
SHOWXERRORS
|
||||
//fprintf(stderr,"ClientMessage eventnumber %i\n",when++);
|
||||
this->LFSWM2_doClientMsg(e.xclient.window,&e.xclient);
|
||||
this->noRestack=false;
|
||||
HIDEXERRORS
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
{
|
||||
SHOWXERRORS
|
||||
//std::cout<<"DestroyNotify from main event loop"<<std::endl;
|
||||
//fprintf(stderr,"win=%p\n",e.xdestroywindow.window);
|
||||
std::vector<Window>::iterator it;
|
||||
it=std::find(this->mainClass->mainWindowClass->windowIDList.begin(),this->mainClass->mainWindowClass->windowIDList.end(),e.xdestroywindow.window);
|
||||
if(it != this->mainClass->mainWindowClass->windowIDList.end())
|
||||
this->mainClass->mainWindowClass->windowIDList.erase(it);
|
||||
HIDEXERRORS
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -542,7 +530,6 @@ void LFSWM2_eventsClass::LFSWM2_doClientMsg(Window id,XClientMessageEvent *e)
|
||||
ccmessage=this->mainClass->mainWindowClass->LFSWM2_getClientClass(e->window);
|
||||
if(ccmessage!=NULL)
|
||||
{
|
||||
SHOWXERRORS
|
||||
this->mainClass->LFSWM2_setCurrentDesktop(ccmessage->onDesk);
|
||||
this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,32,(void*)&ccmessage->contentWindow,1);
|
||||
this->mainClass->mainWindowClass->LFSWM2_removeProp(e->window,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_HIDDEN")));
|
||||
@ -550,7 +537,6 @@ SHOWXERRORS
|
||||
XRaiseWindow(this->mainClass->display,ccmessage->contentWindow);
|
||||
XSetInputFocus(this->mainClass->display,ccmessage->contentWindow,RevertToNone,CurrentTime);
|
||||
this->LFSWM2_shuffle(ccmessage->contentWindow);
|
||||
HIDEXERRORS
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -595,8 +581,6 @@ HIDEXERRORS
|
||||
|
||||
if(e->message_type==this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE")) && e->format==32)
|
||||
{
|
||||
SHOWXERRORS
|
||||
|
||||
/*
|
||||
Atom 0x14d name=_NET_WM_STATE
|
||||
data[0]=0x1
|
||||
@ -674,7 +658,6 @@ Atom (nil) name=(null)
|
||||
}
|
||||
exitit://TODO//just to even up poperror to be removed.
|
||||
true;
|
||||
HIDEXERRORS
|
||||
}
|
||||
this->mainClass->mainWindowClass->LFSWM2_reloadWindowState(id);
|
||||
}
|
||||
@ -682,7 +665,6 @@ HIDEXERRORS
|
||||
void LFSWM2_eventsClass::LFSWM2_sendConfigureEvent(Window wid,rectStruct r)
|
||||
{
|
||||
XConfigureEvent ce;
|
||||
SHOWXERRORS
|
||||
ce.type=ConfigureNotify;
|
||||
ce.event=wid;
|
||||
ce.window=wid;
|
||||
@ -696,7 +678,6 @@ SHOWXERRORS
|
||||
ce.send_event=true;
|
||||
|
||||
XSendEvent(this->mainClass->display,wid,true,StructureNotifyMask,(XEvent*)&ce);
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
void LFSWM2_eventsClass::LFSWM2_restack(void)
|
||||
@ -704,7 +685,6 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)
|
||||
std::vector<Window> wl;
|
||||
std::vector<Window> cl;
|
||||
LFSWM2_clientClass *cc;
|
||||
SHOWXERRORS
|
||||
|
||||
for(int j=0;j<this->mainClass->mainWindowClass->windowIDList.size();j++)
|
||||
{
|
||||
@ -728,7 +708,6 @@ SHOWXERRORS
|
||||
|
||||
this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CLIENT_LIST")),XA_WINDOW,32,cl.data(),cl.size());
|
||||
this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CLIENT_LIST_STACKING")),XA_WINDOW,32,cl.data(),cl.size());
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
void LFSWM2_eventsClass::LFSWM2_shuffle(Window id)
|
||||
@ -771,7 +750,6 @@ void LFSWM2_eventsClass::LFSWM2_shuffle(Window id)
|
||||
{
|
||||
n=0;
|
||||
Atom *v=NULL;
|
||||
SHOWXERRORS
|
||||
v=(Atom*)this->mainClass->mainWindowClass->LFSWM2_getProp(this->mainClass->mainWindowClass->windowIDList.at(cnt),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("WM_TRANSIENT_FOR")),XA_WINDOW,&n);
|
||||
HIDEXERRORS
|
||||
if((v!=NULL) && (this->mainClass->mainWindowClass->windowIDList.at(cnt)!=transid))
|
||||
@ -788,7 +766,6 @@ HIDEXERRORS
|
||||
LFSWM2_clientClass *cc3;
|
||||
cc2=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(to));
|
||||
cc3=this->mainClass->mainWindowClass->LFSWM2_getClientClass(*v);
|
||||
SHOWXERRORS
|
||||
if(cc2!=NULL)
|
||||
{
|
||||
if(cc3!=NULL)
|
||||
@ -798,7 +775,6 @@ SHOWXERRORS
|
||||
else
|
||||
cc2->LFSWM2_hideWindow(false);
|
||||
}
|
||||
HIDEXERRORS
|
||||
}
|
||||
}
|
||||
cnt++;
|
||||
@ -853,7 +829,6 @@ HIDEXERRORS
|
||||
}
|
||||
}
|
||||
this->mainClass->mainWindowClass->windowIDList=wlb;
|
||||
HIDEXERRORS
|
||||
}
|
||||
|
||||
void LFSWM2_eventsClass::LFSWM2_moveToBottom(Window id)
|
||||
|
@ -6,9 +6,15 @@
|
||||
const char *errorFile=NULL;
|
||||
int errorLine=-1;
|
||||
|
||||
int xIOError(Display *display)
|
||||
{
|
||||
fprintf(stderr,"\nXError From file=%s @~ line=%i\n",errorFile,errorLine);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int xError(Display *display,XErrorEvent *e)
|
||||
{
|
||||
return(0);
|
||||
if(errorFile==NULL)
|
||||
return(0);
|
||||
|
||||
|
@ -17,6 +17,6 @@ extern const char *errorFile;
|
||||
extern int errorLine;
|
||||
|
||||
int xError(Display *display,XErrorEvent *e);
|
||||
|
||||
int xIOError(Display *display);
|
||||
|
||||
#endif
|
@ -171,7 +171,6 @@ LFSWM2_Class::LFSWM2_Class(int argc,char **argv)
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("framefg"),{TYPESTRING,"framefg","","white",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","","black",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("forcedocksstack"),{TYPEINT,"forcedocksstack","","",false,1}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("rescanprefs"),{TYPEINT,"rescanprefs","","",false,10}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","","",false,0}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("resizemode"),{TYPEINT,"resizemode","","",false,2}},
|
||||
{LFSTK_UtilityClass::LFSTK_hashFromKey("modkeys"),{TYPEINT,"modkeys","","",false,MOVEKEYS}},
|
||||
@ -220,7 +219,6 @@ LFSWM2_Class::LFSWM2_Class(int argc,char **argv)
|
||||
this->mainWindowClass->LFSWM2_loadTheme(this->prefs.LFSTK_getString("theme"));
|
||||
|
||||
this->messages=new LFSWM2_messageClass(this,this->msgQueueKey);
|
||||
this->messages->delay=this->prefs.LFSTK_getInt("rescanprefs");
|
||||
}
|
||||
|
||||
void LFSWM2_Class::LFSWM2_initRootWindow(void)
|
||||
|
@ -154,7 +154,7 @@ __attribute__((unused)) static unsigned char menuWindowBits[]=
|
||||
|
||||
//source (data[0]) client messgae:0=no source 1=application 2=pager
|
||||
enum MESSAGESOURCE {NOSRC=0,APPLICATIONSRC,PAGERSRC};
|
||||
enum MESSAGETYPE {REFRESHTHEME,QUITLFSWM,RESTARTLFSWM,NOMSG};
|
||||
enum MESSAGETYPE {REFRESHTHEME,QUITLFSWM,RESTARTLFSWM,DEBUGMSG,NOMSG};
|
||||
enum TRISTATE {INVALID=-1,LOGIC0=0,LOGIC1=1};
|
||||
enum RUNLEVEL {RL_STARTUP,RL_NORMAL,RL_SHUTDOWN};
|
||||
enum {NOPLACE=0,UNDERMOUSE,CENTREMMONITOR,CENTRESCREEN,MOUSEMONITOR};
|
||||
|
@ -43,6 +43,8 @@ int main(int argc,char **argv)
|
||||
|
||||
mainLFSWM2Class=new LFSWM2_Class(argc,argv);
|
||||
XSetErrorHandler(&xError);
|
||||
XSetIOErrorHandler(xIOError);
|
||||
//setjmp ??TODO..
|
||||
HIDEXERRORS
|
||||
mainLFSWM2Class->mainEventClass->LFSWM2_mainEventLoop();
|
||||
do
|
||||
|
@ -24,21 +24,11 @@ static void alarmCallBack(int sig)
|
||||
{
|
||||
XExposeEvent event;
|
||||
bool needsRefresh=false;
|
||||
|
||||
needsRefresh=theMainClass->messages->LFSWM2_readMsg();
|
||||
if(needsRefresh==true)
|
||||
{
|
||||
event.type=Expose;
|
||||
event.window=theMainClass->rootWindow;
|
||||
XSendEvent(theMainClass->display,theMainClass->rootWindow,true,ExposureMask,(XEvent*)&event);
|
||||
XFlush(theMainClass->display);
|
||||
}
|
||||
alarm(theMainClass->messages->delay);
|
||||
}
|
||||
|
||||
LFSWM2_messageClass::~LFSWM2_messageClass(void)
|
||||
{
|
||||
alarm(0);
|
||||
}
|
||||
|
||||
LFSWM2_messageClass::LFSWM2_messageClass(LFSWM2_Class *mainclass,int newkey)
|
||||
@ -50,36 +40,53 @@ LFSWM2_messageClass::LFSWM2_messageClass(LFSWM2_Class *mainclass,int newkey)
|
||||
if((this->queueID=msgget(this->key,IPC_CREAT|0660))==-1)
|
||||
fprintf(stderr,"Can't create message queue\n");
|
||||
|
||||
signal(SIGALRM,alarmCallBack);
|
||||
alarm(this->delay);
|
||||
signal(SIGUSR1,alarmCallBack);
|
||||
}
|
||||
|
||||
bool LFSWM2_messageClass::LFSWM2_readMsg(void)
|
||||
{
|
||||
int retcode;
|
||||
int retcode;
|
||||
msgBuffer buffer;
|
||||
|
||||
bool retval=false;
|
||||
bool allDone=false;
|
||||
|
||||
this->whatMsg=NOMSG;
|
||||
buffer.mText[0]=0;
|
||||
retcode=msgrcv(this->queueID,&buffer,MAX_MSG_SIZE,LFSWM2_MSG,IPC_NOWAIT);
|
||||
|
||||
if(retcode>0)
|
||||
{
|
||||
//fprintf(stderr,"message=%s\n",buffer.mText);
|
||||
if(strcmp(buffer.mText,"debugmsg")==0)
|
||||
{
|
||||
this->whatMsg=DEBUGMSG;
|
||||
retval=true;
|
||||
}
|
||||
if(strcmp(buffer.mText,"reloadtheme")==0)
|
||||
{
|
||||
whatMsg=REFRESHTHEME;
|
||||
return(true);
|
||||
this->whatMsg=REFRESHTHEME;
|
||||
retval=true;
|
||||
}
|
||||
if(strcmp(buffer.mText,"restartwm")==0)
|
||||
{
|
||||
this->whatMsg=RESTARTLFSWM;
|
||||
return(true);
|
||||
retval=true;
|
||||
}
|
||||
if(strcmp(buffer.mText,"quit")==0)
|
||||
{
|
||||
this->whatMsg=QUITLFSWM;
|
||||
return(true);
|
||||
retval=true;
|
||||
}
|
||||
}
|
||||
return(false);
|
||||
|
||||
// while(allDone==false)
|
||||
// {
|
||||
// retcode=msgrcv(this->queueID,&buffer,MAX_MSG_SIZE,LFSWM2_MSG,IPC_NOWAIT);
|
||||
// if(retcode<=1)
|
||||
// allDone=true;
|
||||
// }
|
||||
|
||||
#ifdef __DEBUG__
|
||||
fprintf(stderr,"what=%i whattxt=%s\n",this->mainClass->messages->whatMsg,buffer.mText);
|
||||
#endif
|
||||
return(retval);
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
#include <sys/msg.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include "lfswm2Class.h"
|
||||
|
||||
class LFSWM2_messageClass
|
||||
@ -44,7 +44,6 @@ class LFSWM2_messageClass
|
||||
|
||||
int queueID=-1;
|
||||
int key=999;
|
||||
int delay=2;
|
||||
//messages
|
||||
int whatMsg=-1;
|
||||
|
||||
|
Reference in New Issue
Block a user