diff --git a/LFSApplications/ChangeLog b/LFSApplications/ChangeLog
index 76b8c1d..2f0da05 100644
--- a/LFSApplications/ChangeLog
+++ b/LFSApplications/ChangeLog
@@ -1,4 +1,6 @@
0.2.0
+Fixed initing window to be above/below/normal.
+Added file chooser.
Added include alpha switch to lfscolourchooser.
Added setting desktop names to lfsdesktopprefs.
Apply in dockprefs kills all docks.
diff --git a/LFSApplications/LFSApplications/app/Makefile.am b/LFSApplications/LFSApplications/app/Makefile.am
index 53c212d..c7ba7ce 100644
--- a/LFSApplications/LFSApplications/app/Makefile.am
+++ b/LFSApplications/LFSApplications/app/Makefile.am
@@ -10,6 +10,7 @@ lfspanelprefs_SOURCES = ../src/lfspanelprefs.cpp
lfswm2prefs_SOURCES = ../src/lfswm2prefs.cpp
lfsdockprefs_SOURCES = ../src/lfsdockprefs.cpp
+lfsfilechooser_SOURCES = ../src/lfsfilechooser.cpp
lfscolourchooser_SOURCES = ../src/lfscolourchooser.cpp
lfsabout_SOURCES = ../src/lfsabout.cpp
lfsfontselect_SOURCES = ../src/lfsfontselect.cpp
@@ -20,4 +21,4 @@ lfswmprefs_SOURCES = ../src/lfswmprefs.cpp
man1_MANS = ../resources/man/lfsapplications.1
-bin_PROGRAMS = lfstkprefs lfsappearance lfsbackdropprefs lfsdesktopprefs lfspanelprefs lfswm2prefs lfsdockprefs lfscolourchooser lfsabout lfsfontselect lfsruncommand lfsmimeeditor lfswmprefs
+bin_PROGRAMS = lfstkprefs lfsappearance lfsbackdropprefs lfsdesktopprefs lfspanelprefs lfswm2prefs lfsdockprefs lfsfilechooser lfscolourchooser lfsabout lfsfontselect lfsruncommand lfsmimeeditor lfswmprefs
diff --git a/LFSApplications/LFSApplications/src/lfsabout.cpp b/LFSApplications/LFSApplications/src/lfsabout.cpp
index b30ad05..8e4226b 100644
--- a/LFSApplications/LFSApplications/src/lfsabout.cpp
+++ b/LFSApplications/LFSApplications/src/lfsabout.cpp
@@ -50,12 +50,19 @@ bool doQuit(void *p,void* ud)
int main(int argc, char **argv)
{
- XEvent event;
- int sy=BORDER;
- int dw=WINDOWWIDTH;
+ XEvent event;
+ windowInitStruct *win;
+ int sy=BORDER;
+ int dw=WINDOWWIDTH;
apc=new LFSTK_applicationClass();
- apc->LFSTK_addWindow(NULL,BOXLABEL);
+
+ win=apc->LFSTK_getDefaultWInit();
+ win->windowName=BOXLABEL;
+ win->windowType=win->app->appAtomsHashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_DIALOG"));
+ win->level=ABOVEALL;
+
+ apc->LFSTK_addWindow(win,BOXLABEL);
wc=apc->mainWindow;
tux=new LFSTK_imageClass(wc,NULL,WINDOWMIDDLE-(IMAGESIZE/2),sy,IMAGESIZE,IMAGESIZE,BUTTONGRAV,true);
diff --git a/LFSApplications/LFSApplications/src/lfsfilechooser.cpp b/LFSApplications/LFSApplications/src/lfsfilechooser.cpp
new file mode 100755
index 0000000..a08289f
--- /dev/null
+++ b/LFSApplications/LFSApplications/src/lfsfilechooser.cpp
@@ -0,0 +1,114 @@
+/*
+ *
+ * ©K. D. Hedger. Wed 17 Jan 15:59:32 GMT 2024 keithdhedger@gmail.com
+
+ * This file (lfsfilechooser.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 .
+ */
+
+#include
+
+#include "config.h"
+#include
+
+LFSTK_applicationClass *apc=NULL;
+LFSTK_windowClass *wc=NULL;
+LFSTK_fileDialogClass *filedialogfile;
+LFSTK_fileDialogClass *filedialogdir;
+
+bool showFolder=false;
+Window parentWindow=-1;
+char *wd;
+
+int main(int argc, char **argv)
+{
+ int c=0;
+ int option_index=0;
+ const char *shortOpts="fh?w:";
+ int retval=1;
+
+ option longOptions[]=
+ {
+ {"window",1,0,'w'},
+ {"folder",0,0,'f'},
+ {"help",0,0,'h'},
+ {0, 0, 0, 0}
+ };
+
+ while(1)
+ {
+ option_index=0;
+ c=getopt_long_only(argc,argv,shortOpts,longOptions,&option_index);
+ if (c==-1)
+ break;
+ switch (c)
+ {
+ case 'f':
+ showFolder=true;
+ break;
+ case 'h':
+ case '?':
+ printf("-?,-h,--help\t\tPrint this help\n");
+ printf("-f,--folder\t\tSelect folder instead of file\n");
+ printf("-w,--window\t\tSet transient for window\n");
+ exit(0);
+ case 'w':
+ parentWindow=atoi(optarg);
+ break;
+ }
+ }
+
+ apc=new LFSTK_applicationClass();
+ apc->LFSTK_addWindow(NULL,"","");
+ wc=apc->mainWindow;
+
+ asprintf(&wd,"%s",apc->userHome.c_str());
+ if(parentWindow!=-1)
+ wc->LFSTK_setTransientFor(parentWindow);
+
+ if(showFolder==false)
+ {
+ std::string mimetype;
+
+ filedialogfile=new LFSTK_fileDialogClass(wc,"Select File",wd,FILEDIALOG);
+ filedialogfile->LFSTK_showFileDialog(NULL,"Select A File");
+
+ if(filedialogfile->LFSTK_isValid()==true)
+ {
+ printf("Selected File Path=%s\n",filedialogfile->LFSTK_getCurrentPath().c_str());
+ printf("Selected Dir Path=%s\n",filedialogfile->LFSTK_getCurrentDir().c_str());
+ printf("Selected File Name=%s\n",filedialogfile->LFSTK_getCurrentFile().c_str());
+ mimetype=wc->globalLib->LFSTK_getMimeType(filedialogfile->LFSTK_getCurrentPath());
+ printf("File Mime-Type=%s\n",mimetype.c_str());
+ retval=0;
+ }
+ }
+ else
+ {
+ filedialogdir=new LFSTK_fileDialogClass(wc,"Select Folder",NULL,FOLDERDIALOG);
+ filedialogdir->LFSTK_showFileDialog(NULL,"Select A Folder");
+ if(filedialogdir->LFSTK_isValid()==true)
+ {
+ printf("Selected Folder=%s\n",filedialogdir->LFSTK_getCurrentDir().c_str());
+ }
+ }
+
+ delete filedialogfile;
+ delete filedialogdir;
+ delete apc;
+ free(wd);
+ cairo_debug_reset_static_data();
+ return(retval);
+}
\ No newline at end of file
diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog
index c924548..8ee86f4 100644
--- a/LFSToolKit/ChangeLog
+++ b/LFSToolKit/ChangeLog
@@ -1,4 +1,7 @@
0.6.1
+Improvements to expander gadget.
+Various dialog tweaks.
+Ignore spurious scroll events in list class.
Fixed setting scrollbar inactive.
LFSTK_oneLiner and LFSTK_runAndGet now handle std::strings in the arg list ( '%S' ).
Added parsing group names in desktop file.
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp
index 35d826a..4b7e535 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp
@@ -207,6 +207,10 @@ void LFSTK_applicationClass::LFSTK_addWindow(windowInitStruct *wi,const char *na
this->windows->push_back({new LFSTK_windowClass(win,this),false,false});
if(this->windows->size()==1)
this->mainWindow=this->windows->back().window;
+ if(win->level==ABOVEALL)
+ this->windows->back().window->LFSTK_setKeepAbove(true);
+ if(win->level==BELOWALL)
+ this->windows->back().window->LFSTK_setKeepBelow(true);
delete win;
}
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp
index 311c1e6..740893d 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp
@@ -176,7 +176,7 @@ void LFSTK_ExpanderGadgetClass::LFSTK_resetGadgets(void)
void LFSTK_ExpanderGadgetClass::LFSTK_updateGadget(geometryStruct oldgeom)
{
geometryStruct oldgadggeom;
- const geometryStruct *wgeom=this->wc->LFSTK_getWindowGeom();
+ const geometryStruct *wgeom=this->wc->LFSTK_getWindowGeom();
int diffw=wgeom->w-oldgeom.w;
int diffh=wgeom->h-oldgeom.h;
@@ -194,6 +194,8 @@ void LFSTK_ExpanderGadgetClass::LFSTK_updateGadget(geometryStruct oldgeom)
if(this->stretchY==true)
sh=oldgadggeom.h+diffh;
+ //this->wc->app->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->wc->window,this->wc->visual,&this->wc->sfc,&this->wc->cr,sw,sh);
+ //this->wc->app->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->window,this->visual,&this->sfc,&this->cr,sw,sh);
this->LFSTK_resizeWindow(sw,sh);
switch(this->lockY)
@@ -229,6 +231,9 @@ void LFSTK_ExpanderGadgetClass::LFSTK_updateGadget(geometryStruct oldgeom)
}
this->LFSTK_moveGadget(newx,newy);
this->updateInternalGadgets(oldgadggeom);
+ //this->wc->LFSTK_clearWindow();
+//void LFSTK_lib::LFSTK_setCairoSurface(Display *display,Window window,Visual *visual,cairo_surface_t **sfc,cairo_t **cr,int width,int height)
+
}
/**
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp
index c37f4b7..f68469f 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.cpp
@@ -71,6 +71,12 @@ void LFSTK_fileDialogClass::getFileList(void)
this->fileListCnt=this->fc->LFSTK_getDataCount();
this->fileListGadget->freeCairoImages=false;
this->fileListGadget->LFSTK_freeList();
+ if(fileListGadget->maxShowing>this->fileListCnt)
+ this->fileListGadget->scrollBar->LFSTK_setActive(false);
+ else
+ this->fileListGadget->scrollBar->LFSTK_setActive(true);
+
+
for(int j=0;jfileListCnt;j++)
{
ls.label=this->fc->data.at(j).name.c_str();
@@ -126,8 +132,10 @@ void LFSTK_fileDialogClass::getFileList(void)
fileListGadget->LFSTK_appendToList(ls);
}
this->fileListGadget->LFSTK_updateList();
+ this->fileListGadget->LFSTK_selectByIndex(0);
}
+
/**
* Set select dialog type.
*
@@ -170,7 +178,7 @@ void LFSTK_fileDialogClass::LFSTK_setWorkingDir(std::string dir)
this->getFileList();
this->fileListGadget->LFSTK_clearWindow();
- this->dirEdit->LFSTK_setBuffer(this->currentDir.c_str());
+ this->dirEdit->LFSTK_setBuffer(this->currentDir);
}
/**
@@ -216,12 +224,14 @@ std::string LFSTK_fileDialogClass::LFSTK_getCurrentPath(void)
*/
LFSTK_fileDialogClass::LFSTK_fileDialogClass(LFSTK_windowClass* parentwc,const char *label,const char *startdir,bool type,const char *recentname)
{
- int hite=600;
LFSTK_labelClass *spacer;
int midprev;
- int yoffset=BORDER+PREVIEWWIDTH;
+ windowInitStruct *win;
+ int hite=600;
int yspacing=0;
- int dwidth=DIALOGWIDTH+PREVIEWWIDTH;
+ int yoffset=BORDER+PREVIEWWIDTH;
+ unsigned dwidth=DIALOGWIDTH+PREVIEWWIDTH;
+
this->wc=parentwc;
this->dialog=NULL;
this->fileListCnt=0;
@@ -245,14 +255,16 @@ LFSTK_fileDialogClass::LFSTK_fileDialogClass(LFSTK_windowClass* parentwc,const c
if(type==FOLDERDIALOG)
dwidth=DIALOGWIDTH;
- windowInitStruct *win;
win=this->wc->app->LFSTK_getDefaultWInit();
win->windowName=label;
win->w=dwidth;
win->h=hite;
win->wc=parentwc;
+ win->windowType=win->app->appAtomsHashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_DIALOG"));
this->dialog=new LFSTK_windowClass(win,parentwc->app);
+
+ this->dialogGeom={0,0,dwidth,600,0};
delete win;
//find files
@@ -284,7 +296,7 @@ LFSTK_fileDialogClass::LFSTK_fileDialogClass(LFSTK_windowClass* parentwc,const c
//butons
spacer=new LFSTK_labelClass(this->dialog,"--",0,yspacing,DIALOGWIDTH+PREVIEWWIDTH,8,NorthWestGravity);
yspacing+=GADGETHITE;
- this->buttonCancel=new LFSTK_buttonClass(this->dialog,"Cancel",BORDER,yspacing,GADGETWIDTH,GADGETHITE,SouthWestGravity);
+ this->buttonCancel=new LFSTK_buttonClass(this->dialog,"Cancel",BORDER,yspacing,GADGETWIDTH,GADGETHITE,NorthWestGravity);
if(this->dialogType==FOLDERDIALOG)
this->buttonHidden=new LFSTK_buttonClass(this->dialog,"Hidden",DIALOGMIDDLE-HALFGADGETWIDTH,yspacing,GADGETWIDTH,GADGETHITE,NorthWestGravity);
else
@@ -327,14 +339,12 @@ bool LFSTK_fileDialogClass::LFSTK_isValid(void)
if(this->dialogType==FILEDIALOG)
{
- //if((this->currentFile!=NULL) && (this->currentDir!=NULL))
- if((this->currentFile!="") && (this->currentDir!=""))
+ if((this->currentFile.empty()==false) && (this->currentDir.empty()==false))
return(true);
}
else
{
- //if(this->currentDir!=NULL)
- if(this->currentDir!="")
+ if(this->currentDir.empty()==false)
return(true);
}
return(false);
@@ -402,25 +412,25 @@ void LFSTK_fileDialogClass::setPreviewData(bool fromlist)
this->wc->globalLib->LFSTK_getFileInfo(filepath.c_str(),&info);
this->previewMimeType->LFSTK_setLabel(info.mimeType.c_str());
- if((info.mimeType.compare("image/jpeg")==0) || (info.mimeType.compare("image/png")==0))
- this->tux->LFSTK_setImageFromPath(filepath.c_str(),PRESERVEASPECT,true);
- else
- this->tux->LFSTK_setImageFromPath(info.iconPath.c_str(),PRESERVEASPECT,true);
+ if((info.mimeType.compare("image/jpeg")==0) || (info.mimeType.compare("image/png")==0))
+ this->tux->LFSTK_setImageFromPath(filepath,PRESERVEASPECT,true);
+ else
+ this->tux->LFSTK_setImageFromPath(info.iconPath,PRESERVEASPECT,true);
this->previewFileName->LFSTK_setLabel(this->LFSTK_getCurrentFileSelection().c_str());
previewlabel+="Size:"+std::to_string(info.fileSize);
this->previewSize->LFSTK_setLabel(previewlabel.c_str());
infostream << "Mode:"<previewMode->LFSTK_setLabel(infostream.str().c_str());
+ this->previewMode->LFSTK_setLabel(infostream.str());
if(info.isLink==true)
this->previewIsLink->LFSTK_setLabel("Symlink");
else
this->previewIsLink->LFSTK_setLabel("");
- this->wc->LFSTK_clearWindow();
+//TODO//HMMMmmmmmmm
+ this->dialog->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->dialog->window,this->dialog->visual,&this->dialog->sfc,&this->dialog->cr,this->dialogGeom.w,this->dialogGeom.h);
this->tux->LFSTK_clearWindow();
- this->wc->LFSTK_clearWindow();
}
/**
@@ -451,19 +461,18 @@ void LFSTK_fileDialogClass::resizeWindow(int w,int h)
void LFSTK_fileDialogClass::LFSTK_showFileDialog(void)
{
XEvent event;
- unsigned lasttime=0;
- unsigned lastdiritem=0;
- unsigned lastfileitem=0;
+ unsigned lasttime=0;
+ unsigned lastdiritem=0;
+ unsigned lastfileitem=0;
geometryStruct geomdir;
geometryStruct geomfile;
pointStruct pt;
- char *lastdir=NULL;
+ char *lastdir=NULL;
this->apply=false;
if(this->dialog!=NULL)
{
- this->dirEdit->LFSTK_setBuffer(this->currentDir.c_str());
- this->LFSTK_setWorkingDir(this->currentDir.c_str());
+ this->LFSTK_setWorkingDir(this->currentDir);
this->dialog->LFSTK_showWindow();
this->dialog->LFSTK_setKeepAbove(true);
this->dialog->LFSTK_setTransientFor(this->wc->window);
@@ -477,7 +486,7 @@ void LFSTK_fileDialogClass::LFSTK_showFileDialog(void)
if(this->dialog->LFSTK_handleWindowEvents(&event)<0)
this->mainLoop=false;
-
+
if(ml==NULL)
continue;
@@ -611,9 +620,9 @@ bool LFSTK_fileDialogClass::select(void *object,void* userdata)
realpath=fd->wc->globalLib->LFSTK_getRealPath(fd->LFSTK_getCurrentDir()+"/"+list->LFSTK_getSelectedLabel());
if(fd->isADir(realpath.c_str())==false)
- fd->dirEdit->LFSTK_setBuffer(realpath.c_str());
-
+ fd->dirEdit->LFSTK_setBuffer(realpath);
fd->setPreviewData(true);
+
if(list->isDoubleClick==true)
{
fd->dirEdit->LFSTK_setBuffer(realpath.c_str());
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.h
index 8e9d0cb..08fab1d 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.h
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKFileDialog.h
@@ -120,6 +120,8 @@ class LFSTK_fileDialogClass
bool isADir(const char *path);
//callbacks
static bool select(void *object,void* userdata);
+ geometryStruct dialogGeom;
+
};
#endif
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp
index 8cf6b96..f7b0d21 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp
@@ -818,6 +818,9 @@ unsigned long LFSTK_lib::LFSTK_getColourFromName(Display *display,Colormap cm,co
*/
void LFSTK_lib::LFSTK_setCairoSurface(Display *display,Window window,Visual *visual,cairo_surface_t **sfc,cairo_t **cr,int width,int height)
{
+ if((height<1) || (width<1))
+ return;
+
if(*sfc==NULL)
*sfc=cairo_xlib_surface_create(display,window,visual,width,height);
else
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp
index b1e40b3..6b04c19 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp
@@ -32,7 +32,6 @@ LFSTK_listGadgetClass::~LFSTK_listGadgetClass()
delete this->labelsArray;
delete this->listDataArray;
delete[] this->data;
- //XSync(this->wc->app->display,true);
}
bool LFSTK_listGadgetClass::setFocusToList(void *object,void* userdata)
@@ -194,7 +193,7 @@ void LFSTK_listGadgetClass::LFSTK_updateList(void)
if(this->listDataArray->at(j+this->listOffset).imageType==FILETHUMB)
this->labelsArray->at(j)->LFSTK_setImageFromPath(this->listDataArray->at(j+this->listOffset).imagePath,MENU,true);
this->labelsArray->at(j)->LFSTK_showGadget();
- this->labelsArray->at(j)->LFSTK_clearWindow();
+ //this->labelsArray->at(j)->LFSTK_clearWindow();
}
}
}
@@ -223,6 +222,24 @@ void LFSTK_listGadgetClass::setNavSensitive(void)
//TODO//
}
+/**
+* Reset list items highlight.
+*
+*/
+bool LFSTK_listGadgetClass::labelExit(LFSTK_gadgetClass *object,void* userdata)
+{
+ LFSTK_listGadgetClass *list=static_cast(userdata);
+
+ for(int j=0;jlabelsArray->size();j++)
+ {
+ list->labelsArray->at(j)->gadgetDetails.colour=&list->labelsArray->at(j)->newGadgetBGColours.at(NORMALCOLOUR);
+ list->labelsArray->at(j)->gadgetDetails.state=NORMALCOLOUR;
+ list->labelsArray->at(j)->inWindow=false;
+ list->labelsArray->at(j)->LFSTK_clearWindow();
+ }
+ return(true);
+}
+
/**
* Reset list size on window, not needed by user.
*
@@ -246,6 +263,7 @@ void LFSTK_listGadgetClass::LFSTK_resetListHeight(int newheight)
button->LFSTK_setTile(NULL,0);
button->LFSTK_setFontString(this->monoFontString);
button->LFSTK_setCairoFontData();
+ button->LFSTK_setMouseMoveCallBack(NULL,this->labelExit,this);
this->labelsArray->push_back(button);
button->LFSTK_setGadgetColours(GADGETBG,this->labelsArray->at(0)->newGadgetBGColours.at(NORMALCOLOUR).name,
@@ -352,11 +370,8 @@ void LFSTK_listGadgetClass::freeList(void)
{
for(int j=0;jlistDataArray->size();j++)
{
- //freeAndNull(&this->listDataArray->at(j).label);
if((this->listDataArray->at(j).imageType==CAIROTHUMB) && (this->listDataArray->at(j).surface!=NULL) && (this->freeCairoImages==true))
cairo_surface_destroy(this->listDataArray->at(j).surface);
- //if((this->listDataArray->at(j).imageType==FILETHUMB) && (this->listDataArray->at(j).imagePath.length()>0))
- // freeAndNull(&this->listDataArray->at(j).imagePath);
}
this->listDataArray->clear();
}
@@ -402,10 +417,16 @@ bool LFSTK_listGadgetClass::mouseUp(XButtonEvent *e)
{
XSetInputFocus(this->wc->app->display,this->window,RevertToParent,CurrentTime);
if(e->button==Button5)
- this->scrollBar->LFSTK_scrollByLine(false);
+ {
+ this->scrollBar->LFSTK_scrollByLine(false);
+ XSync(this->wc->app->display,true);
+ }
if(e->button==Button4)
- this->scrollBar->LFSTK_scrollByLine(true);
- return(true);
+ {
+ this->scrollBar->LFSTK_scrollByLine(true);
+ XSync(this->wc->app->display,true);
+ }
+ return(true);
}
/**
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h
index 1cd0d1c..2096f48 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h
@@ -83,6 +83,7 @@ class LFSTK_listGadgetClass : public LFSTK_gadgetClass
static bool selectKey(void *object,void* userdata);
static bool scrollCB(void *object,void* userdata);
static bool scrollListCB(void *object,void* userdata);
+ static bool labelExit(LFSTK_gadgetClass *object,void* userdata);
};
#endif
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.h
index 62468e4..c6e2a7b 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.h
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.h
@@ -48,7 +48,7 @@ class LFSTK_menuClass
void LFSTK_setMouseCallBack(bool (*downcb)(void*,void*),bool (*releasecb)(void*,void*),void* ud);
void LFSTK_freeMenus(infoDataStruct **menus,int menucnt);
- //int LFSTK_getTextWidthForFont(const char *text);
+ //int LFSTK_getTextWidthForFont(const char *text);
int LFSTK_getTextWidthForFont(std::string text);
bool mainLoop=false;
@@ -57,7 +57,7 @@ class LFSTK_menuClass
static bool menuScroll(void *object,void* userdata);
int mainMenuCnt=0;
- infoDataStruct **mainMenu=NULL;
+ infoDataStruct **mainMenu=NULL;
private:
void resizeMenu(void);
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp
index da8e343..47480c2 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp
@@ -347,6 +347,7 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets)
if(this->isActive==false)
state=INACTIVECOLOUR;
+
if(this->useTile==true)
{
cairo_save(this->cr);
@@ -354,6 +355,7 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets)
cairo_set_source(this->cr,this->pattern);
cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE);
cairo_paint(this->cr);
+ cairo_surface_flush (this->sfc);
cairo_restore(this->cr);
}
else
@@ -378,9 +380,9 @@ 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);
+
this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->visual,&this->sfc,&this->cr,w,h);
this->LFSTK_clearWindow(true);
}
@@ -870,8 +872,8 @@ LFSTK_windowClass::LFSTK_windowClass(windowInitStruct *wi,LFSTK_applicationClass
this->gadgetMap.clear();
this->x=wi->x;
this->y=wi->y;
- this->x=wi->w;
- this->y=wi->h;
+ this->w=wi->w;
+ this->h=wi->h;
}
/**
@@ -1470,6 +1472,7 @@ static geometryStruct oldwindowGeom{0,0,0,0};
int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
{
int retval=0;
+
switch(event->type)
{
case ButtonPress:
@@ -1528,6 +1531,7 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
case ConfigureNotify:
{
+ //fprintf(stderr,"evcnt=%i\n",eventcnt);
Window w;
Window root_return,child_return;
int root_x_return,root_y_return;
@@ -1541,10 +1545,17 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
flag=true;
}
if(event->xconfigure.send_event==true)
- this->LFSTK_resizeWindow(event->xconfigure.width,event->xconfigure.height,false);
- this->LFSTK_clearWindow();
+ {
+ if(((event->xconfigure.width-this->windowGeom.w)>2) || ((event->xconfigure.height-this->windowGeom.h)>2))
+ {
+ this->LFSTK_resizeWindow(event->xconfigure.width,event->xconfigure.height,false);
+ this->LFSTK_clearWindow();
+ return(0);
+ }
+ }
- if((this->windowGeom.w!=oldwindowGeom.w) ||(this->windowGeom.h!=oldwindowGeom.h))
+//TODO//dont like this!!
+ if((this->windowGeom.w!=oldwindowGeom.w) ||(this->windowGeom.h!=oldwindowGeom.h) && ((this->windowGeom.h!=0) && (this->windowGeom.w!=0)))
{
if(!this->gadgetMap.empty())
{
@@ -1558,10 +1569,10 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
LFSTK_ExpanderGadgetClass *gadget=static_cast(ml->gadget);
if((mask_return==0) || (gadget->liveUpdate==true))
{
+ XEvent discard;
+ while(XCheckMaskEvent(this->app->display,StructureNotifyMask,&discard)==true);
gadget->LFSTK_updateGadget(oldwindowGeom);
flag=false;
- XEvent discard;
- while(XCheckMaskEvent(this->app->display,EnterNotify|LeaveNotify|MotionNotify|FocusIn|FocusOut|ConfigureNotify,&discard)==true);
}
}
}
@@ -1605,6 +1616,8 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
}
break;
}
+
+ this->LFSTK_clearWindow();
return(retval);
}
diff --git a/LFSToolKit/examples/RunExamples.cpp b/LFSToolKit/examples/RunExamples.cpp
index 5a19df3..43a1cad 100755
--- a/LFSToolKit/examples/RunExamples.cpp
+++ b/LFSToolKit/examples/RunExamples.cpp
@@ -84,7 +84,8 @@ int main(int argc, char **argv)
{
XEvent event;
int sy=0;
- std::vector hrs;
+ std::vector hrs;
+ bool useliveupdate=true;
dbg="";
apc=new LFSTK_applicationClass();
@@ -162,6 +163,7 @@ int main(int argc, char **argv)
multi->stretchX=true;
multi->stretchY=true;
multi->gadgetStretch=STRETCH;
+ multi->liveUpdate=useliveupdate;
//lineedit
hrs.push_back({0,internalsy,GADGETWIDTH,GADGETHITE,new LFSTK_buttonClass(wc,"Line Edit",0,0,1,1)});
@@ -248,6 +250,8 @@ int main(int argc, char **argv)
multi->stretchX=true;
multi->lockY=LOCKTOBOTTOM;
multi->gadgetStretch=STRETCH;
+ multi->liveUpdate=useliveupdate;
+
//line
hrs.push_back({0,0,DIALOGWIDTH,2,NULL});
@@ -262,6 +266,7 @@ int main(int argc, char **argv)
//quit
multi=new LFSTK_ExpanderGadgetClass(wc,"",DIALOGMIDDLE-HALFGADGETWIDTH,sy+12,GADGETWIDTH,GADGETHITE);
multi->lockY=LOCKTOBOTTOM;
+ multi->liveUpdate=useliveupdate;
hrs.push_back({0,0,GADGETWIDTH,GADGETHITE,new LFSTK_buttonClass(wc,"Quit",0,0,1,1)});
hrs.back().gadget->LFSTK_setMouseCallBack(NULL,doQuit,NULL);
diff --git a/LFSToolKit/examples/expander.cpp b/LFSToolKit/examples/expander.cpp
index 5b69ae3..2fece5f 100755
--- a/LFSToolKit/examples/expander.cpp
+++ b/LFSToolKit/examples/expander.cpp
@@ -93,6 +93,7 @@ int main(int argc, char **argv)
multi->lockY=LOCKTOBOTTOM;
multi->lockX=LOCKTOCENTRE;
multi->gadgetStretch=STRETCH;
+ multi->LFSTK_setHitRects(hrs);
//vertical
// hrs.push_back({0,0,GADGETWIDTH*2,GADGETHITE,NULL});
diff --git a/LFSWM2/ChangeLog b/LFSWM2/ChangeLog
index f64fd45..e97dee0 100644
--- a/LFSWM2/ChangeLog
+++ b/LFSWM2/ChangeLog
@@ -1,4 +1,6 @@
1.0.1
+Set menu labels to reflect changing window state.
+Added sticky option to menu list.
Better motif hints detection.
Fixed setting wrong window property whene dragging window to nex/prev desktop.
Fixed telling root window to change desktops.
diff --git a/LFSWM2/LFSWM2/src/clientClass.cpp b/LFSWM2/LFSWM2/src/clientClass.cpp
index d4351ac..a845856 100644
--- a/LFSWM2/LFSWM2/src/clientClass.cpp
+++ b/LFSWM2/LFSWM2/src/clientClass.cpp
@@ -22,9 +22,13 @@
LFSWM2_clientClass::LFSWM2_clientClass(LFSWM2_Class *mainclass,Window id)
{
+ int menucnt=0;
+
this->mainClass=mainclass;
this->picFormat=XRenderFindStandardFormat(this->mainClass->display,PictStandardRGB24);
this->pa.subwindow_mode=IncludeInferiors;
+ while(menuItemlabels[menucnt]!=NULL)
+ menuNames.push_back(menuItemlabels[menucnt++]);
}
LFSWM2_clientClass::~LFSWM2_clientClass(void)
@@ -32,44 +36,43 @@ LFSWM2_clientClass::~LFSWM2_clientClass(void)
XWindowAttributes x_window_attrs;
this->mainClass->LFSWM2_pushXErrorHandler();
- this->mainClass->mainWindowClass->LFSWM2_freeHints(this->windowHints);
- this->mainClass->mainWindowClass->LFSWM2_setClientList(this->contentWindow,false);
+ this->mainClass->mainWindowClass->LFSWM2_freeHints(this->windowHints);
+ this->mainClass->mainWindowClass->LFSWM2_setClientList(this->contentWindow,false);
- //if(this->frameWindow!=None)
- this->mainClass->mainWindowClass->LFSWM2_deleteClientEntry(this->frameWindow);
- this->mainClass->mainWindowClass->LFSWM2_deleteClientEntry(this->contentWindow);
+ this->mainClass->mainWindowClass->LFSWM2_deleteClientEntry(this->frameWindow);
+ this->mainClass->mainWindowClass->LFSWM2_deleteClientEntry(this->contentWindow);
- if(this->isBorderless==true)
- {
- XGetWindowAttributes(this->mainClass->display,this->frameWindow,&x_window_attrs);
- XReparentWindow(this->mainClass->display,this->contentWindow,this->mainClass->rootWindow,x_window_attrs.x,x_window_attrs.y);
- }
- else
- {
- if(this->transientFor==None)
- XReparentWindow(this->mainClass->display,this->contentWindow,this->mainClass->rootWindow,this->frameWindowRect.x+this->mainClass->leftSideBarSize,frameWindowRect.y+this->mainClass->titleBarSize);
- else
- XReparentWindow(this->mainClass->display,this->contentWindow,this->mainClass->rootWindow,-10000,-1000);
- }
+ if(this->isBorderless==true)
+ {
+ XGetWindowAttributes(this->mainClass->display,this->frameWindow,&x_window_attrs);
+ XReparentWindow(this->mainClass->display,this->contentWindow,this->mainClass->rootWindow,x_window_attrs.x,x_window_attrs.y);
+ }
+ else
+ {
+ if(this->transientFor==None)
+ XReparentWindow(this->mainClass->display,this->contentWindow,this->mainClass->rootWindow,this->frameWindowRect.x+this->mainClass->leftSideBarSize,frameWindowRect.y+this->mainClass->titleBarSize);
+ else
+ XReparentWindow(this->mainClass->display,this->contentWindow,this->mainClass->rootWindow,-10000,-1000);
+ }
- XRemoveFromSaveSet(this->mainClass->display,this->contentWindow);
- XUnmapWindow(this->mainClass->display,this->frameWindow);
+ XRemoveFromSaveSet(this->mainClass->display,this->contentWindow);
+ XUnmapWindow(this->mainClass->display,this->frameWindow);
- if(resizeWindow!=None)
- XDestroyWindow(this->mainClass->display,this->resizeWindow);
+ if(resizeWindow!=None)
+ XDestroyWindow(this->mainClass->display,this->resizeWindow);
- if(this->closeControlStruct.controlGC!=None)
- XFreeGC(this->mainClass->display,this->closeControlStruct.controlGC);
- if(this->maximizeControlStruct.controlGC!=None)
- XFreeGC(this->mainClass->display,this->maximizeControlStruct.controlGC);
- if(this->minimizeControlStruct.controlGC!=None)
- XFreeGC(this->mainClass->display,this->minimizeControlStruct.controlGC);
- if(this->shadeControlStruct.controlGC!=None)
- XFreeGC(this->mainClass->display,this->shadeControlStruct.controlGC);
- if(this->menuControlStruct.controlGC!=None)
- XFreeGC(this->mainClass->display,this->menuControlStruct.controlGC);
- if(this->frameGC!=None)
- XFreeGC(this->mainClass->display,this->frameGC);
+ if(this->closeControlStruct.controlGC!=None)
+ XFreeGC(this->mainClass->display,this->closeControlStruct.controlGC);
+ if(this->maximizeControlStruct.controlGC!=None)
+ XFreeGC(this->mainClass->display,this->maximizeControlStruct.controlGC);
+ if(this->minimizeControlStruct.controlGC!=None)
+ XFreeGC(this->mainClass->display,this->minimizeControlStruct.controlGC);
+ if(this->shadeControlStruct.controlGC!=None)
+ XFreeGC(this->mainClass->display,this->shadeControlStruct.controlGC);
+ if(this->menuControlStruct.controlGC!=None)
+ XFreeGC(this->mainClass->display,this->menuControlStruct.controlGC);
+ if(this->frameGC!=None)
+ XFreeGC(this->mainClass->display,this->frameGC);
this->mainClass->LFSWM2_popXErrorHandler();
}
@@ -499,25 +502,35 @@ void LFSWM2_clientClass::LFSWM2_shadeWindow(void)
bool LFSWM2_clientClass::wmCB(void *p,void* ud)
{
- LFSWM2_clientClass *cc=static_cast(ud);
+ int stringnum=-1;
+ bool usealt=false;
+ LFSWM2_clientClass *cc=static_cast(ud);
+ std::string comp=static_cast(p)->LFSTK_getLabel();
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Maximize")==0)
- if(static_cast(p)->LFSTK_getLabel().compare("Maximize")==0)
- cc->LFSWM2_maxWindow();
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Minimize")==0)
- if(static_cast(p)->LFSTK_getLabel().compare("Minimize")==0)
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(MAXLABEL)).empty()==false)
+ {
+ cc->LFSWM2_maxWindow();
+ usealt=cc->isMaximized;
+ stringnum=MAXLABEL;
+ }
+
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(MINLABEL)).empty()==false)
cc->LFSWM2_minWindow();
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Shade")==0)
- if(static_cast(p)->LFSTK_getLabel().compare("Shade")==0)
- cc->LFSWM2_shadeWindow();
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Fullscreen")==0)
- if(static_cast(p)->LFSTK_getLabel().compare("Fullscreen")==0)
+
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(SHADELABEL)).empty()==false)
+ {
+ cc->LFSWM2_shadeWindow();
+ usealt=cc->isShaded;
+ stringnum=SHADELABEL;
+ }
+
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(FSLABEL)).empty()==false)
{
cc->LFSWM2_fullscreenWindow(true,true);
cc->mainClass->mainWindowClass->LFSWM2_addState(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_FULLSCREEN")));
}
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"On Top")==0)
- if(static_cast(p)->LFSTK_getLabel().compare("On Top")==0)
+
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(ONTOPLABEL)).empty()==false)
{
if(cc->onTop==false)
{
@@ -525,11 +538,15 @@ bool LFSWM2_clientClass::wmCB(void *p,void* ud)
cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW")));
}
else
- cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE")));
+ {
+ cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE")));
+ }
cc->mainClass->mainEventClass->LFSWM2_restack();
+ usealt=!cc->onTop;
+ stringnum=ONTOPLABEL;
}
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"On Bottom")==0)
- if(static_cast(p)->LFSTK_getLabel().compare("On Bottom")==0)
+
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(ONBOTTOMLABEL)).empty()==false)
{
if(cc->onBottom==false)
{
@@ -539,25 +556,42 @@ bool LFSWM2_clientClass::wmCB(void *p,void* ud)
else
cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW")));
cc->mainClass->mainEventClass->LFSWM2_restack();
+ usealt=!cc->onBottom;
+ stringnum=ONBOTTOMLABEL;
+ }
+
+ if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(ONALLDESKSLABEL)).empty()==false)
+ {
+ cc->visibleOnAllDesks=!cc->visibleOnAllDesks;
+ if(cc->visibleOnAllDesks==true)
+ {
+ cc->mainClass->mainWindowClass->LFSWM2_addState(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_STICKY")));
+ }
+ else
+ cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_STICKY")));
+ cc->mainClass->mainEventClass->LFSWM2_restack();
+ usealt=cc->visibleOnAllDesks;
+ stringnum=ONALLDESKSLABEL;
}
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Close")==0)
if(static_cast(p)->LFSTK_getLabel().compare("Close")==0)
cc->LFSWM2_sendCloseWindow();
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Fast Resize")==0)
if(static_cast(p)->LFSTK_getLabel().compare("Fast Resize")==0)
cc->resizeMode=FASTRESIZE;
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"Live Resize")==0)
if(static_cast(p)->LFSTK_getLabel().compare("Live Resize")==0)
cc->resizeMode=LIVERESIZE;
-// if(strcmp(static_cast(p)->LFSTK_getLabel(),"Scale Resize")==0)
-// cc->resizeMode=SCALERESIZE;
- //if(strcmp(static_cast(p)->LFSTK_getLabel(),"About")==0)
if(static_cast(p)->LFSTK_getLabel().compare("About")==0)
system("lfsabout &");
static_cast(p)->wc->LFSTK_hideWindow();
+ if(stringnum!=-1)
+ {
+ if(usealt==true)
+ cc->menuNames.at(stringnum)=altMenuitemlabels[stringnum];
+ else
+ cc->menuNames.at(stringnum)=menuItemlabels[stringnum];
+ }
return(true);
}
@@ -567,10 +601,6 @@ void LFSWM2_clientClass::showWMMenu(int x,int y)
LFSTK_windowClass *wc=NULL;
LFSTK_menuClass *menu=NULL;
- int NUMMENUS=14;
-// const char *menuitemlabels[]={"Maximize","Minimize","Shade","Fullscreen","--","On Top","On Bottom","--","Fast Resize","Live Resize","Scale Resize","Close","--","About"};
- const char *menuitemlabels[]={"Maximize","Minimize","Shade","Fullscreen","--","On Top","On Bottom","--","Fast Resize","Live Resize","--","Close","--","About"};
-
apc=new LFSTK_applicationClass();
apc->LFSTK_addWindow(NULL,"");
wc=apc->mainWindow;
@@ -580,12 +610,11 @@ void LFSWM2_clientClass::showWMMenu(int x,int y)
wc->LFSTK_resizeWindow(1,1,true);
wc->LFSTK_hideWindow();
- infoDataStruct **mms=new infoDataStruct*[NUMMENUS];
- for (int j=0; jlabel,"%s",menuitemlabels[j]);
- mms[j]->label=menuitemlabels[j];
+ mms[j]->label=this->menuNames.at(j);
mms[j]->hasSubMenu=false;
mms[j]->subMenus=NULL;
mms[j]->userData=(void*)this;
@@ -593,7 +622,7 @@ void LFSWM2_clientClass::showWMMenu(int x,int y)
}
menu->LFSTK_setMouseCallBack(NULL,wmCB,(void*)0x888);
- menu->LFSTK_addMainMenus(mms,NUMMENUS);
+ menu->LFSTK_addMainMenus(mms,NUMOFMENUS);
menu->LFSTK_showMenu();
diff --git a/LFSWM2/LFSWM2/src/clientClass.h b/LFSWM2/LFSWM2/src/clientClass.h
index 188cf41..abcc0d9 100644
--- a/LFSWM2/LFSWM2/src/clientClass.h
+++ b/LFSWM2/LFSWM2/src/clientClass.h
@@ -26,12 +26,16 @@
#include
#include
-class LFSWM2_Class;
#include "lfswm2Class.h"
#define SKIPTIME 10
#define MAXCONFIGCNT 8
+static const char *menuItemlabels[]={"Maximize","Minimize","Shade","Fullscreen","--","On Top","On Bottom","On All Desks","--","Fast Resize","Live Resize","--","Close","--","About",NULL};
+static const char *altMenuitemlabels[]={"Un-Maximize","Un-Minimize","Un-Shade","Un-Fullscreen","--","Not On Top","Not On Bottom","Only This Desk","--","Fast Resize","Live Resize","--","Close","--","About",NULL};
+
+enum {MAXLABEL=0,MINLABEL,SHADELABEL,FSLABEL,PASS1,ONTOPLABEL,ONBOTTOMLABEL,ONALLDESKSLABEL,PASS2,FASTSIZELABEL,LIVESIZELABEL,PASS3,CLOSELABEL,PASS4,ABOUTLABEL,NUMOFMENUS};
+
class LFSWM2_clientClass
{
public:
@@ -50,6 +54,9 @@ class LFSWM2_clientClass
Window transientFor=None;
GC frameGC=None;
+ //bool useAlternate=false;
+ std::vector menuNames;
+
std::string name="";
int windowType=-1;
bool visible=true;
diff --git a/LFSWM2/LFSWM2/src/windowsClass.cpp b/LFSWM2/LFSWM2/src/windowsClass.cpp
index d6a7092..9336252 100644
--- a/LFSWM2/LFSWM2/src/windowsClass.cpp
+++ b/LFSWM2/LFSWM2/src/windowsClass.cpp
@@ -271,45 +271,15 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs)
}
XFree(allowed);
}
- //cc->canClose=true;//TODO//
-
-// if((this->LFSWM2_getWindowType(id)==NORMALWINDOW))
-// {
-// cc->canMaximize=true;
-// cc->canMinimize=true;
-// cc->canResize=true;
-// }
if(this->LFSWM2_getWindowType(id)==UNKNOWNTYPE)
{
-// Atom xa;
-// Atom xa_prop[1];
-// xa=XInternAtom(this->mainClass->display,"_NET_WM_WINDOW_TYPE",False);
-// xa_prop[0]=this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_NORMAL"));
-
-// if(xa!=None)
-// XChangeProperty(this->mainClass->display,id,xa,XA_ATOM,32,PropModeReplace,(unsigned char *)&xa_prop,1);
-//cc->windowType=NORMALWINDOW;
-// cc->canMaximize=false;
-// cc->canMinimize=false;
-// cc->canResize=false;
-// cc->canClose=false;
-// if(cc->windowHints.sh->flags==0)
-// {
- cc->canMaximize=true;
- cc->canMinimize=true;
- cc->canResize=true;
- cc->canClose=true;
- cc->isBorderless=false;
-// }
-// else if((cc->windowHints.sh->max_width==0) || (cc->windowHints.sh->max_height==0))
-// {
-// cc->canMaximize=true;
-// cc->canMinimize=true;
-// cc->canResize=true;
-// cc->canClose=true;
-// }
+ cc->canMaximize=true;
+ cc->canMinimize=true;
+ cc->canResize=true;
+ cc->canClose=true;
+ cc->isBorderless=false;
}
if(cc->isBorderless==true)