diff --git a/LFSApplications/LFSApplications/src/lfstkprefs.cpp b/LFSApplications/LFSApplications/src/lfstkprefs.cpp index 58971d5..a71bced 100644 --- a/LFSApplications/LFSApplications/src/lfstkprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfstkprefs.cpp @@ -284,7 +284,10 @@ void setPreviewData(void) if((!ml->empty()) ) { if(useTheme->LFSTK_getValue()==true) + { wc->LFSTK_setTile(windowTileEdit->LFSTK_getCStr(),-1); + wc->LFSTK_clearWindow(true); + } else { wc->LFSTK_setTile(NULL,0); @@ -359,13 +362,39 @@ void setPreviewData(void) { if(mls->gadget!=NULL) { - if(mls->type!=LINEEDITGADGET) + int gtype=mls->type; + switch(gtype) { - if(useTheme->LFSTK_getValue()==true) - mls->gadget->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); - else - mls->gadget->LFSTK_setTile(NULL,-1); + //fprintf(stderr,"SEPERATORGADGET\n"); + //mls->gadget->LFSTK_setTile(windowTileEdit->LFSTK_getCStr(),-1); + //break; + case SEPERATORGADGET: + case LABELGADGET: + //fprintf(stderr,"LABELGADGET\n"); + if(useTheme->LFSTK_getValue()==true) + mls->gadget->LFSTK_setTile(windowTileEdit->LFSTK_getCStr(),-1); + else + mls->gadget->LFSTK_setTile(NULL,-1); + break; + default: + if(useTheme->LFSTK_getValue()==true) + mls->gadget->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); + else + mls->gadget->LFSTK_setTile(NULL,-1); + break; } +// if(mls->type!=LINEEDITGADGET) +// { +// if(useTheme->LFSTK_getValue()==true) +// mls->gadget->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); +// else +// mls->gadget->LFSTK_setTile(NULL,-1); +// } +// else if(mls->type==LABELGADGET) +// { +// fprintf(stderr,"LABELGADGET\n"); +// mls->gadget->LFSTK_setTile(windowTileEdit->LFSTK_getCStr(),-1); +// } } } } @@ -806,7 +835,7 @@ int main(int argc, char **argv) sy+=YSPACING; setPreviewData(); - wc->LFSTK_resizeWindow(sx,sy,true); + wc->LFSTK_resizeWindow(DIALOGWIDTH+BORDER,sy,true); wc->LFSTK_showWindow(); wc->LFSTK_setKeepAbove(true); if(parentWindow!=-1) diff --git a/LFSDock/ChangeLog b/LFSDock/ChangeLog index dc27df6..8e53e01 100644 --- a/LFSDock/ChangeLog +++ b/LFSDock/ChangeLog @@ -1,4 +1,6 @@ 0.2.0 +Added a couple of background examples. +UI updates. Added use end caps ( optional ) when setting BG image. Better display of transparent BG image. Added optional background image to dock. diff --git a/LFSDock/LFSDock/resources/pixmaps/gradgreen-2-ls.png b/LFSDock/LFSDock/resources/pixmaps/gradgreen-2-ls.png new file mode 100644 index 0000000..06920e2 Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/gradgreen-2-ls.png differ diff --git a/LFSDock/LFSDock/resources/pixmaps/gradgreen-2-rs.png b/LFSDock/LFSDock/resources/pixmaps/gradgreen-2-rs.png new file mode 100644 index 0000000..52a335f Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/gradgreen-2-rs.png differ diff --git a/LFSDock/LFSDock/resources/pixmaps/gradgreen-2.png b/LFSDock/LFSDock/resources/pixmaps/gradgreen-2.png new file mode 100644 index 0000000..a886311 Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/gradgreen-2.png differ diff --git a/LFSDock/LFSDock/resources/pixmaps/rage-ls.png b/LFSDock/LFSDock/resources/pixmaps/rage-ls.png new file mode 100644 index 0000000..f363899 Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/rage-ls.png differ diff --git a/LFSDock/LFSDock/resources/pixmaps/rage-rs.png b/LFSDock/LFSDock/resources/pixmaps/rage-rs.png new file mode 100644 index 0000000..1a43cac Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/rage-rs.png differ diff --git a/LFSDock/LFSDock/resources/pixmaps/rage.png b/LFSDock/LFSDock/resources/pixmaps/rage.png new file mode 100644 index 0000000..6b2b5a5 Binary files /dev/null and b/LFSDock/LFSDock/resources/pixmaps/rage.png differ diff --git a/LFSDock/LFSDock/src/callbacks.cpp b/LFSDock/LFSDock/src/callbacks.cpp index a0008bf..97e7136 100644 --- a/LFSDock/LFSDock/src/callbacks.cpp +++ b/LFSDock/LFSDock/src/callbacks.cpp @@ -22,6 +22,8 @@ LFSTK_windowClass *launcherContextWindow; LFSTK_windowClass *taskContextWindow; +int cnt=0; +int cnt2=0; void sendClientMessage(Window win,const char *msg,unsigned long data0,unsigned long data1,unsigned long data2,unsigned long data3,unsigned long data4) { @@ -80,9 +82,6 @@ bool gadgetDrop(void *lwc,propertyStruct *data,void* ud) return(true); } -int cnt=0; -int cnt2=0; - bool timerCB(LFSTK_applicationClass *p,void* ud) { readMsg(); @@ -224,7 +223,6 @@ void showhidetActionList(LFSTK_gadgetClass *bc,LFSTK_windowClass *winc,LFSTK_lis { winc->LFSTK_hideWindow(); apc->windows->at(apc->LFSTK_findWindow(winc)).showing=false; - // XSync(apc->display,false); } } diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp index 214e3ea..e7d9356 100644 --- a/LFSDock/LFSDock/src/globals.cpp +++ b/LFSDock/LFSDock/src/globals.cpp @@ -338,6 +338,8 @@ void resizeDock(int wid,int hite) dockBGWindow->LFSTK_resizeWindow(wid,hite,true); if(bgrs!=NULL) bgrs->LFSTK_moveGadget(wid-sidewid,0); + dockWindow->LFSTK_clearWindow(true); + dockBGWindow->LFSTK_clearWindow(true); } void moveDock(int extra) diff --git a/LFSDock/LFSDock/src/launchers.cpp b/LFSDock/LFSDock/src/launchers.cpp index 4908b93..3330845 100644 --- a/LFSDock/LFSDock/src/launchers.cpp +++ b/LFSDock/LFSDock/src/launchers.cpp @@ -29,7 +29,7 @@ std::vector launchersArray; LFSTK_findClass *findlaunchers=NULL; LFSTK_gadgetClass *currentLauncher=NULL; -bool launcherEnterCB(LFSTK_gadgetClass*p,void* ud) +bool launcherEnterCB(LFSTK_gadgetClass* p,void* ud) { if(p!=NULL) { @@ -58,8 +58,6 @@ bool launcherEnterCB(LFSTK_gadgetClass*p,void* ud) inSomeWindow=true; } - //else - // currentLauncher=NULL; return(true); } @@ -85,11 +83,9 @@ bool launcherCB(void *p,void* ud) std::string command; std::string args; std::string str; - //std::string whch; propReturn pr; showhidetActionList(NULL,popActionWindow,popActionList); - //XSync(apc->display,false); if(p!=NULL) { @@ -130,19 +126,13 @@ bool launcherCB(void *p,void* ud) args=""; } - //whch=apc->globalLib->LFSTK_oneLiner("which '%S'",command); - sendNotify("Launching ",lds.name); - -// XSync(apc->display,false); if(lds.inTerm==false) str=apc->globalLib->LFSTK_oneLiner("exec %S %S &\necho $!",command,args); else str=apc->globalLib->LFSTK_oneLiner("exec %S %S %S &\necho $!",prefs.LFSTK_getString("termcommand"),command,args); lds.pid=std::stoul(str); - //XFlush(apc->display); - //apc->mainWindow->LFSTK_handleWindowEvents(NULL); if(useTaskBar==true) updateTaskBar(); @@ -248,10 +238,8 @@ int addLaunchers(int x,int y,int grav) bc->LFSTK_setImageFromPath(DATADIR "/pixmaps/command.png",LEFT,true); setGadgetDetails(bc); -// bc->LFSTK_setStyle(BEVELOUT); launchersArray.push_back(lds); xpos+=iconWidth+ICONSPACE; } - return(xpos); } diff --git a/LFSDock/LFSDock/src/main.cpp b/LFSDock/LFSDock/src/main.cpp index fcb7b13..564ec4a 100644 --- a/LFSDock/LFSDock/src/main.cpp +++ b/LFSDock/LFSDock/src/main.cpp @@ -217,7 +217,7 @@ int main(int argc,char **argv) win->windowType=apc->appAtomsHashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_DOCK")); win->level=ABOVEALL; win->decorated=false; - //win->className="LFSDOCK"; + win->className="LFSDOCK"; apc->LFSTK_addWindow(win,"LFSDock"); dockWindow=apc->mainWindow; @@ -315,23 +315,26 @@ int main(int argc,char **argv) psize=windowWidth; win=apc->LFSTK_getDefaultWInit(); - win->windowType=apc->appAtomsHashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_NORMAL")); + win->windowType=apc->appAtomsHashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_DOCK")); win->level=ABOVEALL; win->overRide=false; win->decorated=false; apc->LFSTK_addWindow(win,"DOCKBG"); - dockBGWindow=apc->windows->back().window; - apc->windows->back().showing=true; + dockBGWindow=apc->windows->back().window; dockBGWindow->LFSTK_setTile(dockBGImage.c_str(),-1); + dockWindow->LFSTK_setTransientFor(dockBGWindow->window); + apc->windows->back().showing=true; - moveDock(0); resizeDock(psize,iconWidth+extraSpace); - + moveDock(0); //max hite for end caps should be 120 - +//size = 2 = 60 +//fprintf(stderr,"dock hite=%i\n",iconWidth+extraSpace); if(useBG==true) { + //hack :( + LFSTK_labelClass *label=new LFSTK_labelClass(dockBGWindow,"XX",0,0,1,1,NorthGravity); cairo_status_t st; cairo_surface_t *tsfc; std::string suffix=LFSTK_UtilityClass::LFSTK_deleteSuffix(&dockBGImage); @@ -339,14 +342,9 @@ int main(int argc,char **argv) dockBGImageLS=dockBGImage+"-ls."+suffix; dockBGImageRS=dockBGImage+"-rs."+suffix; dockBGWindow->LFSTK_showWindow(true); - tsfc=apc->globalLib->LFSTK_lib::LFSTK_createSurfaceFromPath(dockBGImageLS.c_str()); if(tsfc!=NULL) { -//fprintf(stderr,"dock hite=%i\n",iconWidth+extraSpace); -//fprintf(stderr,"sfc=%p\n",tsfc); -//fprintf(stderr,"hite===%i\n",cairo_image_surface_get_height(tsfc)); -//fprintf(stderr,"wid===%i\n",cairo_image_surface_get_width(tsfc)); sidehite=cairo_image_surface_get_height(tsfc); sidewid=cairo_image_surface_get_width(tsfc); cairo_surface_destroy (tsfc); @@ -356,7 +354,7 @@ int main(int argc,char **argv) st=bgls->LFSTK_setImageFromPath(dockBGImageLS,LEFT,false); if(st!=CAIRO_STATUS_SUCCESS) { - dockBGWindow->LFSTK_deleteGadget(bgls); + //dockBGWindow->LFSTK_deleteGadget(bgls); bgls=NULL; } @@ -365,13 +363,15 @@ int main(int argc,char **argv) st=bgrs->LFSTK_setImageFromPath(dockBGImageRS,RIGHT,false); if(st!=CAIRO_STATUS_SUCCESS) { - dockBGWindow->LFSTK_deleteGadget(bgrs); + //dockBGWindow->LFSTK_deleteGadget(bgrs); bgrs=NULL; } } - + dockBGWindow->LFSTK_clearWindow(true); } - + + tasks.clear(); + holdtasks.clear(); if(useTaskBar==true) updateTaskBar(true); diff --git a/LFSDock/LFSDock/src/taskBar.cpp b/LFSDock/LFSDock/src/taskBar.cpp index 1931206..4e3627d 100644 --- a/LFSDock/LFSDock/src/taskBar.cpp +++ b/LFSDock/LFSDock/src/taskBar.cpp @@ -32,7 +32,6 @@ bool taskSwitcherExitCB(LFSTK_gadgetClass*p,void* ud) { setGadgetPosition(p,false); inSomeWindow=false; - //dockWindow->LFSTK_clearWindow(true); currentTask=NULL; return(true); } @@ -121,7 +120,6 @@ bool taskListCB(void* p,void* ud) if(bc!=NULL) { sendClientMessage((Window)filltasks.at((unsigned long)bc->userData).winid,"_NET_ACTIVE_WINDOW",0,0,0,0,0); - //XSync(apc->display,false); } return(true); } @@ -252,11 +250,6 @@ skiplabel: oldwidth=0; moveDock(0); resizeDock(windowWidth,iconWidth+extraSpace); -// dockWindow->LFSTK_resizeWindow(windowWidth,iconWidth+extraSpace,true); -// dockBGWindow->LFSTK_resizeWindow(windowWidth,iconWidth+extraSpace,true); -// dockBGWindow->LFSTK_clearWindow(true); -// dockWindow->LFSTK_clearWindow(true); - return; } @@ -341,12 +334,7 @@ skiplabel: { moveDock(filltasks.size()*iconWidth); resizeDock(windowWidth+((iconWidth+ICONSPACE)*filltasks.size()),iconWidth+extraSpace); -// dockWindow->LFSTK_resizeWindow(windowWidth+((iconWidth+ICONSPACE)*filltasks.size()),iconWidth+extraSpace,true); -// dockBGWindow->LFSTK_resizeWindow(windowWidth+((iconWidth+ICONSPACE)*filltasks.size()),iconWidth+extraSpace,true); -// dockBGWindow->LFSTK_clearWindow(true); - oldwidth=windowWidth+(iconWidth*filltasks.size()); -// dockWindow->LFSTK_clearWindow(true); } } diff --git a/LFSDock/README.md b/LFSDock/README.md index 0d5b729..a0cb712 100644 --- a/LFSDock/README.md +++ b/LFSDock/README.md @@ -40,6 +40,7 @@ End caps can be optionally set and fshould be in the same folder and be the same /home/keithhedger/Backgrounds/rage-rs.png < Images can be (semi-)transparent.
The main tile can be any size but the end caps height shoud be at least 120, the width can be any size>=1.
+A couple of examples are included in /usr/share/LFSDock/pixmaps

More gadgets to come and improvements to the graphics.
The dock looks best with a transparent background at the bottom.
diff --git a/LFSPanel/LFSPanel/src/slider.cpp b/LFSPanel/LFSPanel/src/slider.cpp index 32ce6e9..4121a02 100644 --- a/LFSPanel/LFSPanel/src/slider.cpp +++ b/LFSPanel/LFSPanel/src/slider.cpp @@ -215,11 +215,21 @@ int addSlider(int x,int y,int grav,bool fromleft) direction=false; } + //win->x=100; + //win->y=100; + //w=w; + //h=h; win->w=w; win->h=h; + win->app=apc; apc->LFSTK_addToolWindow(win); scwindow=apc->windows->back().window; +// win->w=w; +// win->h=h; +// apc->LFSTK_addToolWindow(win); +// scwindow=apc->windows->back().window; + vsb=new LFSTK_scrollBarClass(scwindow,direction,0,0,w,h,BUTTONGRAV); vsb->LFSTK_setMouseCallBack(NULL,valChanged,NULL); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp index 7c4bce1..f784873 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp @@ -61,6 +61,7 @@ LFSTK_buttonClass::LFSTK_buttonClass(LFSTK_windowClass* parentwc,const char* lab this->ml->function=&LFSTK_lib::LFSTK_gadgetEvent; this->ml->gadget=this; this->ml->type=BUTTONGADGET; + this->gadgetType=BUTTONGADGET; wc->LFSTK_addMappedListener(this->window,ml); if(this->wc->globalLib->LFSTK_getUseTheme()==true) @@ -69,7 +70,11 @@ LFSTK_buttonClass::LFSTK_buttonClass(LFSTK_windowClass* parentwc,const char* lab this->useTile=false; if(this->label.compare("--")==0) - gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,true}; + { + this->ml->type=SEPERATORGADGET; + this->gadgetType=SEPERATORGADGET; + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,true}; + } else gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp index 8684c08..b074893 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp @@ -225,9 +225,12 @@ void LFSTK_fontDialogClass::buildDialog(void) delete win; this->dialog->autoLabelColour=false; - this->dialog->LFSTK_reloadGlobals(); + this->dialog->LFSTK_reloadGlobals(); this->dialog->LFSTK_clearWindow(); +//hack + LFSTK_labelClass *label=new LFSTK_labelClass(this->dialog,"XX",0,0,DIALOGWIDTH,DIALOGHITE,NorthGravity); + //list this->fontlist=new LFSTK_listGadgetClass(this->dialog,"",BORDER,sy,DIALOGWIDTH-(BORDER*2),GADGETHITE*5); this->loadFontStrings(); @@ -322,6 +325,7 @@ LFSTK_fontDialogClass::LFSTK_fontDialogClass(LFSTK_windowClass* parentwc,const c this->ml->function=&LFSTK_lib::LFSTK_gadgetEvent; this->ml->gadget=this; this->ml->type=BUTTONGADGET; + this->gadgetType=BUTTONGADGET; this->wc->LFSTK_addMappedListener(this->window,ml); if(this->wc->globalLib->LFSTK_getUseTheme()==true) diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp index bdacce1..27b77c5 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp @@ -327,8 +327,9 @@ void LFSTK_gadgetClass::LFSTK_setUseWindowPixmap(bool usepixmap) void LFSTK_gadgetClass::clearBox(gadgetStruct* details) { cairo_pattern_t *patt; - colourStruct *usecolour; + colourStruct *usecolour; geometryStruct geom; + this->LFSTK_getGeom(&geom); if(details->useWindowPixmap==true) @@ -1571,12 +1572,12 @@ void LFSTK_gadgetClass::LFSTK_setTile(const char *path,int size) if(cs==CAIRO_STATUS_SUCCESS) { - if((this->gadgetDetails.gadgetGeom.w!=0) && (this->gadgetDetails.gadgetGeom.h!=0)) - cairo_xlib_surface_set_size(this->sfc,cairo_image_surface_get_width(tempimage)+1,cairo_image_surface_get_height(tempimage)+1); - if((cairo_xlib_surface_get_width(this->sfc)==0) || (cairo_xlib_surface_get_height(this->sfc)==0)) - cairo_xlib_surface_set_size(this->sfc,this->gadgetDetails.gadgetGeom.w,this->gadgetDetails.gadgetGeom.h); - + if((cairo_image_surface_get_width(tempimage)>cairo_xlib_surface_get_width(this->sfc)) ) + cairo_xlib_surface_set_size(this->sfc,cairo_image_surface_get_width(tempimage)+1,this->gadgetGeom.h); + else + cairo_xlib_surface_set_size(this->sfc,this->gadgetGeom.w,this->gadgetGeom.h); + this->pattern=cairo_pattern_create_for_surface(tempimage); cairo_surface_destroy(tempimage); cairo_pattern_set_extend(pattern,CAIRO_EXTEND_REPEAT); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h index 75b2095..7df8217 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h @@ -185,6 +185,8 @@ class LFSTK_gadgetClass cairo_pattern_t *pattern=NULL; unsigned pad; + int gadgetType=NOGADGET; + private: void initGadget(void); void selectBevel(bool mousedown); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h index 440e8ee..27959d6 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h @@ -78,7 +78,7 @@ enum {CANCEL=0,APPLY}; enum {NONE=0,LEFT,CENTRE,RIGHT,AUTO,MENU,PRESERVEASPECT,TOOLBAR}; enum gadgetState {NORMALCOLOUR=0,PRELIGHTCOLOUR,ACTIVECOLOUR,INACTIVECOLOUR,MAXCOLOURS}; -enum {BUTTONGADGET=1,MENUBUTTONGADGET,LINEEDITGADGET,LABELGADGET,TOGGLEGADGET,IMAGEGADGET,LISTGADGET,DIALOGGADGET,MULTILINEGADGET,SCROLLBARGADGET,MENUGADGET,MENUITEMGADGET,MULTIGADGET,TRANSPARENTGADGET,NOGADGET}; +enum {BUTTONGADGET=1,MENUBUTTONGADGET,LINEEDITGADGET,LABELGADGET,TOGGLEGADGET,IMAGEGADGET,LISTGADGET,DIALOGGADGET,MULTILINEGADGET,SCROLLBARGADGET,MENUGADGET,MENUITEMGADGET,MULTIGADGET,TRANSPARENTGADGET,SEPERATORGADGET,NOGADGET}; //enum {TYPEINT=1,TYPESTRING,TYPEBOOL}; enum {NORMAL=0,ABOVEALL,BELOWALL}; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp index a68b04f..ee08b66 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp @@ -67,6 +67,7 @@ LFSTK_labelClass::LFSTK_labelClass(LFSTK_windowClass* parentwc,const char* label this->ml->function=&LFSTK_lib::LFSTK_gadgetEvent; this->ml->gadget=this; this->ml->type=LABELGADGET; + this->gadgetType=LABELGADGET; this->wc->LFSTK_addMappedListener(this->window,ml); if(this->wc->globalLib->LFSTK_getUseTheme()==true) @@ -74,6 +75,28 @@ LFSTK_labelClass::LFSTK_labelClass(LFSTK_windowClass* parentwc,const char* label else this->useTile=false; +/* +struct gadgetStruct +{ + colourStruct *colour=NULL; + bevelType bevel=BEVELNONE; + indicatorType indic=NOINDICATOR; + int state=NORMALCOLOUR; + int reserveSpace=0; + bool buttonTile=false; + geometryStruct gadgetGeom={0,0,1,1}; + geometryStruct indicatorGeom={0,0,1,1}; + bool hasIndicator=false; + bool useWindowPixmap=false; + bool geomRelativeToMainWindow=false; + bool showLink=false; + bool showBroken=false; +}; +*/ gadgetDetails={&this->wc->windowColourNames[NORMALCOLOUR],BEVELNONE,NOINDICATOR,NORMALCOLOUR,0,false,{0,0,w,h},{0,0,0,0},false,false,true}; this->LFSTK_setLabelGravity(gravity); +// fprintf(stderr,"w=%i\n",gadgetGeom.w); +//this->gadgetDetails.gadgetGeom.w=1000; +//this->gadgetDetails.gadgetGeom.h=h; + } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp index d3e9715..484c40f 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp @@ -338,16 +338,6 @@ void LFSTK_windowClass::LFSTK_redrawAllGadgets(void) void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) { int state=NORMALCOLOUR; -// -// XClearWindow(this->app->display,this->window); -// cairo_save(this->cr); -// cairo_reset_clip (this->cr); -// fprintf(stderr,"--->>>here\n"); -// cairo_set_source_rgba(this->cr,1.0,1.0,1.0,1.0); -// cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); -// cairo_paint(this->cr); -// cairo_surface_flush (this->sfc); -// cairo_restore(this->cr); if(cleargadgets==true) this->LFSTK_redrawAllGadgets(); @@ -358,16 +348,14 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) if(this->isActive==false) state=INACTIVECOLOUR; - if(this->useTile==true) { - cairo_save(this->cr); cairo_reset_clip (this->cr); cairo_set_source(this->cr,this->pattern); cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_paint(this->cr); - cairo_surface_flush (this->sfc); + cairo_surface_flush(this->sfc); cairo_restore(this->cr); } else @@ -396,6 +384,8 @@ void LFSTK_windowClass::LFSTK_resizeWindow(int w,int h,bool tellx) 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->w=w; + this->h=h; this->LFSTK_clearWindow(true); } @@ -985,7 +975,7 @@ void LFSTK_windowClass::LFSTK_setTile(const char *path,int size) { cairo_surface_t *tempimage; cairo_status_t cs=CAIRO_STATUS_SUCCESS; - char *suffix=NULL; + char *suffix=NULL; if(this->pattern!=NULL) { @@ -999,32 +989,32 @@ void LFSTK_windowClass::LFSTK_setTile(const char *path,int size) return; } + if(this->sfc==NULL) + this->sfc=cairo_xlib_surface_create(this->app->display,this->window,this->visual,this->w,this->h); + suffix=strrchr((char*)path,'.'); if((suffix!=NULL) && (strcasecmp(suffix,".png")==0)) { tempimage=cairo_image_surface_create_from_png(path); cs=cairo_surface_status(tempimage); } - else - cs=CAIRO_STATUS_INVALID_FORMAT; - - if(cs!=CAIRO_STATUS_SUCCESS) + else if((suffix!=NULL) && (strcasecmp(suffix,".jpg")==0)) { tempimage=this->globalLib->LFSTK_cairo_image_surface_create_from_jpeg(path); cs=cairo_surface_status(tempimage); - if(tempimage==NULL) - printf("Unkown Format : %s\n",path); } + else + cs=CAIRO_STATUS_INVALID_FORMAT; if(cs==CAIRO_STATUS_SUCCESS) { - //if((this->gadgetDetails.gadgetGeom.w!=0) && (this->gadgetDetails.gadgetGeom.h!=0)) - if(this->sfc==NULL) - this->sfc=cairo_xlib_surface_create(this->app->display,this->window,this->visual,w,h); - cairo_xlib_surface_set_size(this->sfc,cairo_image_surface_get_width(tempimage)+1,cairo_image_surface_get_height(tempimage)+1); + if((this->w!=0) && (h!=0)) + // cairo_xlib_surface_set_size(this->sfc,cairo_image_surface_get_width(tempimage)+1,cairo_image_surface_get_height(tempimage)+1); + cairo_xlib_surface_set_size(this->sfc,this->w,this->h); + //cairo_xlib_surface_set_size(this->sfc,1000,1000); this->pattern=cairo_pattern_create_for_surface(tempimage); cairo_surface_destroy(tempimage); - cairo_pattern_set_extend (pattern,CAIRO_EXTEND_REPEAT); + cairo_pattern_set_extend(pattern,CAIRO_EXTEND_REPEAT); this->useTile=true; } else diff --git a/LFSToolKit/examples/basic.cpp b/LFSToolKit/examples/basic.cpp index 579797e..46e0908 100755 --- a/LFSToolKit/examples/basic.cpp +++ b/LFSToolKit/examples/basic.cpp @@ -309,6 +309,8 @@ int main(int argc, char **argv) popWindow->LFSTK_resizeWindow(poplabel->LFSTK_getTextRealWidth("This is a mouse enter callback"),GADGETHITE); popWindow->LFSTK_setWindowColourName(NORMALCOLOUR,"#c0808080"); +//wc->LFSTK_setTile("/home/keithhedger/Backgrounds/bc3h.png",-1); + int retval=apc->LFSTK_runApp(); delete apc; diff --git a/LFSToolKit/examples/toggle.cpp b/LFSToolKit/examples/toggle.cpp index 32b5c8c..22c84f7 100755 --- a/LFSToolKit/examples/toggle.cpp +++ b/LFSToolKit/examples/toggle.cpp @@ -122,12 +122,12 @@ int main(int argc, char **argv) //check button check=new LFSTK_toggleButtonClass(wc,"Check Box",DIALOGMIDDLE-HALFGADGETWIDTH,sy,GADGETWIDTH,CHECKBOXSIZE); check->LFSTK_setValue(true); - check->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)check->LFSTK_getLabel().c_str()); + check->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"Check Box"); sy+=YSPACING; //toggle button toggle=new LFSTK_toggleButtonClass(wc,"Toggle",DIALOGMIDDLE-HALFGADGETWIDTH,sy,GADGETWIDTH,GADGETWIDTH); - toggle->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)toggle->LFSTK_getLabel().c_str()); + toggle->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"Toggle"); toggle->LFSTK_setMouseMoveCallBack(enterCB,exitCB,USERDATA(0)); toggle->LFSTK_setToggleStyle(TOGGLENORMAL); toggle->userData=USERDATA(1); diff --git a/LFSWM2/ChangeLog b/LFSWM2/ChangeLog index 1021e32..fa6cb3d 100644 --- a/LFSWM2/ChangeLog +++ b/LFSWM2/ChangeLog @@ -1,4 +1,7 @@ 1.0.1 +Removed some unnecessary code. +Added --enable-debug to configure. +Redone restack and window shuffle. Minor stack tweak. Unknown window types now set to normal type. Minor gui tweak on new app start. diff --git a/LFSWM2/LFSWM2/src/clientClass.cpp b/LFSWM2/LFSWM2/src/clientClass.cpp index a845856..73f95d8 100644 --- a/LFSWM2/LFSWM2/src/clientClass.cpp +++ b/LFSWM2/LFSWM2/src/clientClass.cpp @@ -251,7 +251,6 @@ bool LFSWM2_clientClass::doResizeDraggers(XEvent *e) steps=0; this->setWindowRects(false); this->dragRect=this->frameWindowRect; - this->mainClass->restackCnt=2; switch(this->resizeMode) { @@ -313,13 +312,11 @@ bool LFSWM2_clientClass::doResizeDraggers(XEvent *e) XMoveResizeWindow(this->mainClass->display,this->resizeWindow,this->mainClass->displayWidth+10,0,1,1); this->setWindowRects(true); - this->mainClass->restackCnt=0; break; case MotionNotify: if(buttonDown==true) { - this->mainClass->restackCnt=2; this->steps++; if(this->steps>this->smoothness) { @@ -534,13 +531,22 @@ bool LFSWM2_clientClass::wmCB(void *p,void* ud) { if(cc->onTop==false) { + XSetInputFocus(cc->mainClass->display,cc->contentWindow,RevertToNone,CurrentTime); + cc->isActive=true; + cc->mainClass->mainWindowClass->LFSWM2_setProp(cc->mainClass->rootWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,32,&cc->contentWindow,1); cc->mainClass->mainWindowClass->LFSWM2_addState(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_BELOW"))); + cc->mainClass->mainEventClass->LFSWM2_shuffle(cc->contentWindow); } else { + XSetInputFocus(cc->mainClass->display,None,RevertToNone,CurrentTime); 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->mainClass->rootWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW"))); + cc->mainClass->mainEventClass->LFSWM2_shuffle(None); + cc->mainClass->mainWindowClass->LFSWM2_refreshFrame(cc); } + cc->mainClass->mainEventClass->LFSWM2_restack(); usealt=!cc->onTop; stringnum=ONTOPLABEL; @@ -552,12 +558,18 @@ bool LFSWM2_clientClass::wmCB(void *p,void* ud) { cc->mainClass->mainWindowClass->LFSWM2_addState(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW"))); cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE"))); + cc->mainClass->mainEventClass->LFSWM2_shuffle(None); } else - cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW"))); + { + cc->mainClass->mainWindowClass->LFSWM2_removeProp(cc->contentWindow,cc->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW"))); + cc->mainClass->mainEventClass->LFSWM2_shuffle(None); + } + cc->mainClass->mainEventClass->LFSWM2_restack(); usealt=!cc->onBottom; stringnum=ONBOTTOMLABEL; + cc->mainClass->mainEventClass->LFSWM2_restack(); } if(LFSTK_UtilityClass::LFSTK_strStr(comp,cc->menuNames.at(ONALLDESKSLABEL)).empty()==false) @@ -903,7 +915,6 @@ void LFSWM2_clientClass::LFSWM2_setWMState(XEvent *e) this->onBottom=true; this->onTop=false; XLowerWindow(this->mainClass->display,this->contentWindow); - this->mainClass->restackCnt++; } if(this->mainClass->mainWindowClass->LFSWM2_hasState(e->xproperty.window,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE")))) @@ -912,7 +923,6 @@ void LFSWM2_clientClass::LFSWM2_setWMState(XEvent *e) this->onTop=true; XRaiseWindow(this->mainClass->display,this->contentWindow); this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,32,&this->contentWindow,1); - this->mainClass->restackCnt++; } if(states!=NULL) XFree(states); @@ -1038,6 +1048,14 @@ bool LFSWM2_clientClass::LFSWM2_handleEvents(XEvent *e) //this->mainClass->DEBUG_printEventData(e,true); switch(e->type) { + case ButtonPress: + //fprintf(stderr,"ButtonPress\n"); + if((e->xbutton.state&(this->mainClass->modKeys))!=(this->mainClass->modKeys))//TODO//???windows key for now used to move window wihout restacking + { + this->mainClass->mainEventClass->LFSWM2_shuffle(this->contentWindow); + this->mainClass->mainEventClass->LFSWM2_restack(); + } + break; case ButtonRelease: this->adjustContentWindow(); break; @@ -1056,7 +1074,6 @@ bool LFSWM2_clientClass::LFSWM2_handleEvents(XEvent *e) { this->mainClass->mainEventClass->noRestack=true; this->LFSWM2_doFrameMoveEvents(e); - this->mainClass->restackCnt=2; return(true); } break; @@ -1080,19 +1097,19 @@ bool LFSWM2_clientClass::LFSWM2_handleEvents(XEvent *e) //std::cerr<<"client MapNotify"<LFSWM2_hideWindow(true); - return(true); - } - break; case MapRequest: //std::cerr<<"client MapRequest"<LFSWM2_showWindow(false); break; + case UnmapNotify: + { + //fprintf(stderr,"UnmapNotify from client\n"); + this->LFSWM2_hideWindow(true); + return(true); + } + //break; case DestroyNotify: { //fprintf(stderr,"DestroyNotify from client\n"); @@ -1186,7 +1203,6 @@ void LFSWM2_clientClass::renderFrame(bool isfirst,int x,int y) this->setWindowRects(true); this->rendered=true; this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,32,(void*)&this->contentWindow,1); - this->mainClass->restackCnt=0; if(this->isBorderless==true) { XMoveWindow(this->mainClass->display,this->frameWindow,this->firstx+this->mainClass->leftSideBarSize,this->firsty+this->mainClass->titleBarSize); diff --git a/LFSWM2/LFSWM2/src/eventsClass.cpp b/LFSWM2/LFSWM2/src/eventsClass.cpp index 55e7c9e..ffbd51e 100644 --- a/LFSWM2/LFSWM2/src/eventsClass.cpp +++ b/LFSWM2/LFSWM2/src/eventsClass.cpp @@ -44,25 +44,25 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) int lastbutton=-1; int lasttime=0; -//XSynchronize(this->mainClass->display,true); this->mainClass->runLevel=RL_STARTUP; this->mainClass->LFSWM2_pushXErrorHandler(); this->mainClass->mainWindowClass->LFSWM2_buildClientList(); this->mainClass->LFSWM2_popXErrorHandler(); this->mainClass->runLevel=RL_NORMAL; - this->mainClass->restackCnt=0; this->mainClass->LFSWM2_setCurrentDesktop(this->mainClass->currentDesktop,true); this->LFSWM2_restack(); while(true) { XEvent e; + //if(XPending(this->mainClass->display)==0) + //fprintf(stderr,">>>>>e->type=%i\n",e.type); + if(firstrun==true) { if(XPending(this->mainClass->display)==0) { - this->mainClass->restackCnt=0; this->LFSWM2_restack(); firstrun=false; } @@ -115,7 +115,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) XGrabKey(this->mainClass->display,XKeysymToKeycode(this->mainClass->display,XK_Escape),(this->mainClass->modKeys),ccs->contentWindow,False,GrabModeSync,GrabModeAsync); } } - this->mainClass->restackCnt=1; this->noRestack=false; } @@ -144,7 +143,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) } cccontrol=NULL; e.type=0; - this->mainClass->restackCnt=1; continue; } } @@ -160,9 +158,8 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) { cc->renderFrame(false); this->noRestack=false; - this->mainClass->restackCnt=0; - XRaiseWindow(this->mainClass->display,cc->frameWindow); - //continue; + this->LFSWM2_shuffle(cc->contentWindow); + this->LFSWM2_restack(); } } } @@ -170,7 +167,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) switch(e.type) { case KeyRelease: - //fprintf(stderr,"e.xkey.keycode=%i\n",e.xkey.keycode); if((e.xkey.keycode==XKeysymToKeycode(this->mainClass->display,XK_Escape)) && (e.xkey.state&(this->mainClass->modKeys))==(this->mainClass->modKeys)) { cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(e.xkey.window); @@ -183,7 +179,7 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) break; case ButtonRelease: -// fprintf(stderr,"ButtonRelease eventnumber %i button number %i win=%x time=%d\n",when++,e.xbutton.button,e.xbutton.window,e.xbutton.time); + //fprintf(stderr,"ButtonRelease eventnumber %i button number %i win=%x time=%d\n",when++,e.xbutton.button,e.xbutton.window,e.xbutton.time); if((e.xbutton.window==this->mainClass->rootWindow) && (e.xbutton.time-lasttime>250)) { this->noRestack=false; @@ -199,7 +195,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) if(cd>=this->mainClass->numberOfDesktops) cd=0; this->mainClass->LFSWM2_setCurrentDesktop(cd); - this->mainClass->restackCnt=0; lasttime=e.xbutton.time; } } @@ -211,14 +206,16 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) //fprintf(stderr,"ButtonPress eventnumber %i\n",when++); this->noRestack=false; start=e.xbutton; - this->mainClass->restackCnt=0; this->sy=e.xbutton.y; cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(e.xbutton.window); if(cc!=NULL) { inmenu=false; if((e.xbutton.state&(this->mainClass->modKeys))==(this->mainClass->modKeys))//TODO//???windows key for now used to move window wihout restacking - break; + { + this->noRestack=true; + break; + } this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,32,&cc->contentWindow,1); XSetInputFocus(this->mainClass->display,cc->contentWindow,RevertToNone,CurrentTime); @@ -235,7 +232,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) long unsigned int nitems_return; if(overide==false) - this->mainClass->restackCnt=4; v=(Atom*)this->mainClass->mainWindowClass->LFSWM2_getProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,&nitems_return); if(v!=NULL) { @@ -256,14 +252,12 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) hs=this->mainClass->mainWindowClass->LFSWM2_getWindowHints(e.xmaprequest.window); XGetWindowAttributes(this->mainClass->display,e.xmaprequest.window,&x_window_attrs); XMapWindow(this->mainClass->display,e.xmaprequest.window); - //hs=this->mainClass->mainWindowClass->LFSWM2_getWindowHints(e.xmaprequest.window); //this->mainClass->DEBUG_printCurrentHintsDataStruct(hs); if((hs.mHints!=NULL) && (hs.mHints->decorations==0)) { if(this->mainClass->mainWindowClass->LFSWM2_createUnframedWindow(e.xmaprequest.window)==true) { this->noRestack=false; - this->mainClass->restackCnt=0; break; } break; @@ -274,9 +268,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) XMoveResizeWindow(this->mainClass->display,e.xmaprequest.window,this->mainClass->leftSideBarSize,this->mainClass->titleBarSize,x_window_attrs.width,x_window_attrs.height); this->noRestack=false; - this->mainClass->restackCnt=0; - //XRaiseWindow(this->mainClass->display,); - //XRaiseWindow(this->mainClass->display,this->mainClass->mainWindowClass->clientList.at(e.xmaprequest.window)->frameWindow); } break; @@ -348,9 +339,7 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) changes.sibling=e.xconfigurerequest.above; changes.stack_mode=e.xconfigurerequest.detail; - XConfigureWindow(this->mainClass->display,e.xconfigurerequest.window,e.xconfigurerequest.value_mask,&changes); - this->mainClass->restackCnt=1; - + XConfigureWindow(this->mainClass->display,e.xconfigurerequest.window,e.xconfigurerequest.value_mask,&changes); break; if((e.xconfigurerequest.value_mask & (CWX|CWY)) == (CWX|CWY)) @@ -381,7 +370,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) { //fprintf(stderr,"PropertyNotify IN eventnumber %i atom name=%s\n",when++,XGetAtomName(this->mainClass->display,e.xproperty.atom)); LFSWM2_clientClass *cc; - this->mainClass->restackCnt++;//??? if(false) { fprintf(stderr,"PropertyNotify eventnumber %i\n",when++); @@ -404,7 +392,6 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) if(e.xproperty.window==this->mainClass->rootWindow) { this->noRestack=false; - this->mainClass->restackCnt=0; this->mainClass->LFSWM2_setCurrentDesktopFromRoot(); } break; @@ -447,39 +434,28 @@ void LFSWM2_eventsClass::LFSWM2_mainEventLoop(void) case ClientMessage: //fprintf(stderr,"ClientMessage eventnumber %i\n",when++); this->noRestack=false; - this->mainClass->restackCnt=0; this->LFSWM2_doClientMsg(e.xclient.window,&e.xclient); break; case DestroyNotify: - //std::cout<<"DestroyNotify from main event loop"<::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); + } break; default: //fprintf(stderr,"default eventnumber %i\n",when++); - if(overide==false) - this->mainClass->restackCnt=2;//TODO// break; } if(this->noRestack==false) { - this->mainClass->restackCnt--; - if(this->mainClass->restackCnt<1) - { - //fprintf(stderr,"this->mainClass->restackCnt<1 eventnumber %i\n",when++); - Atom *v=NULL; - long unsigned int n; - v=(Atom*)this->mainClass->mainWindowClass->LFSWM2_getProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CURRENT_DESKTOP")),XA_CARDINAL,&n); - - this->LFSWM2_restack(); - if((v!=NULL) && (this->mainClass->currentDesktop!=(long unsigned int)v[0])) - this->mainClass->mainWindowClass->LFSWM2_setVisibilityForDesk(this->mainClass->currentDesktop); - - this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CURRENT_DESKTOP")),XA_CARDINAL,32,&this->mainClass->currentDesktop,1); - - this->mainClass->restackCnt=1; - overide=false; - } + //fprintf(stderr,"this->mainClass->restackCnt<1 eventnumber %i\n",when++); + this->LFSWM2_restack(); } XAllowEvents(this->mainClass->display,ReplayPointer,CurrentTime); } @@ -530,8 +506,7 @@ void LFSWM2_eventsClass::LFSWM2_doClientMsg(Window id,XClientMessageEvent *e) ccmessage->visible=true; XRaiseWindow(this->mainClass->display,ccmessage->contentWindow); XSetInputFocus(this->mainClass->display,ccmessage->contentWindow,RevertToNone,CurrentTime); - //XSetInputFocus(this->mainClass->display,None,RevertToNone,0); - this->mainClass->restackCnt=0; + this->LFSWM2_shuffle(ccmessage->contentWindow); this->mainClass->LFSWM2_popXErrorHandler(); } @@ -548,12 +523,10 @@ void LFSWM2_eventsClass::LFSWM2_doClientMsg(Window id,XClientMessageEvent *e) if(this->mainClass->currentDesktop!=(unsigned long)e->data.l[0]) { this->mainClass->currentDesktop=(unsigned long)e->data.l[0]; - this->mainClass->restackCnt++; this->noRestack=true; return; } this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CURRENT_DESKTOP")),XA_CARDINAL,32,&this->mainClass->currentDesktop,1); - this->mainClass->restackCnt++; this->noRestack=true; return; } @@ -574,7 +547,6 @@ void LFSWM2_eventsClass::LFSWM2_doClientMsg(Window id,XClientMessageEvent *e) { this->mainClass->mainWindowClass->LFSWM2_addState(e->window,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_HIDDEN"))); this->mainClass->mainWindowClass->LFSWM2_reloadWindowState(e->window); - this->mainClass->restackCnt++; return; } } @@ -616,8 +588,7 @@ Atom (nil) name=(null) ccmessage->onTop=true; ccmessage->onBottom=false; this->mainClass->mainWindowClass->LFSWM2_changeState(ccmessage->contentWindow,NET_WM_STATE_REMOVE,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW"))); - this->LFSWM2_moveToTop(ccmessage->contentWindow); - this->mainClass->restackCnt++; + this->LFSWM2_shuffle(ccmessage->contentWindow); } goto exitit; return; @@ -638,7 +609,6 @@ Atom (nil) name=(null) if(ccmessage->isBorderless==false) XLowerWindow(this->mainClass->display,ccmessage->frameWindow); ccmessage->onBottom=true; - this->mainClass->restackCnt++; } goto exitit; } @@ -685,240 +655,127 @@ void LFSWM2_eventsClass::LFSWM2_sendConfigureEvent(Window wid,rectStruct r) XSendEvent(this->mainClass->display,wid,true,StructureNotifyMask,(XEvent*)&ce); } -void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code +void LFSWM2_eventsClass::LFSWM2_restack(void) { - std::vector fromwl; - std::vector towldesktop; - std::vector towlbelow; - std::vector towlnormal; - //std::vector towlunknown; - std::vector towlabove; - std::vector towlpanel; - std::vector towlmenu; - std::vector towl; - std::vector netclientwl; - std::vector netclientstackwl; - - long unsigned int nitems_return; - int wtype; - Atom *v=NULL; - LFSWM2_clientClass *cc=NULL; - int a=0; - - v=(Atom*)this->mainClass->mainWindowClass->LFSWM2_getProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,&nitems_return); - - if((v!=NULL) && (v[0]!=None)) - { - hintsDataStruct hs; - hs=this->mainClass->mainWindowClass->LFSWM2_getWindowHints(v[0]); - if((hs.mHints!=NULL) && (hs.mHints->decorations==0)) - { - this->mainClass->mainWindowClass->LFSWM2_removeProp(this->mainClass->rootWindow,LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")); - v[0]=0; - } - } - - for(int a=0;amainClass->mainWindowClass->windowIDList.size();a++) - { - cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(a)); - if(cc!=NULL) - { - if(cc->rendered==false) - continue; - cc->doneRestack=false; - if((v!=NULL) && (cc->contentWindow==v[0]) && (cc->isActive==false)) - { - cc->isActive=true; - cc->mainClass->mainWindowClass->LFSWM2_refreshFrame(cc); - move(this->mainClass->mainWindowClass->windowIDList,a,0); - } - else if((v!=NULL) && (cc->contentWindow!=v[0]) && (cc->isActive==true)) - { - cc->isActive=false; - cc->mainClass->mainWindowClass->LFSWM2_refreshFrame(cc); - } - } - } + std::vector wl; + std::vector cl; + LFSWM2_clientClass *cc; for(int j=0;jmainClass->mainWindowClass->windowIDList.size();j++) { cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(j)); if(cc!=NULL) { - cc->doneRestack=false; - } - } - -//move transients - a=0; - while(amainClass->mainWindowClass->windowIDList.size()) - { - cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(a)); - if(cc!=NULL) - { - if((cc->transientFor!=0) && (cc->doneRestack==false)) - { - for(int b=0;bmainClass->mainWindowClass->windowIDList.size();b++) - { - if((this->mainClass->mainWindowClass->windowIDList.at(b)==cc->transientFor) && ((v!=NULL) && (this->mainClass->mainWindowClass->windowIDList.at(b)==v[0]))) - { - cc->doneRestack=true; - move(this->mainClass->mainWindowClass->windowIDList,a,0); - a=0; - continue; - } - } - } - } - a++; - } - - if(v!=NULL) - XFree(v); - - fromwl=this->mainClass->mainWindowClass->windowIDList; - towldesktop.clear(); - towlbelow.clear(); - towlnormal.clear(); - //towlunknown.clear(); - towlabove.clear(); - towlpanel.clear(); - towlmenu.clear(); - netclientwl.clear(); - netclientstackwl.clear(); - towl.clear(); - - for(int j=0;jmainClass->mainWindowClass->LFSWM2_getWindowType(fromwl.at(j)); - switch(wtype) - { - case MENUWINDOW: - case NOTIFICATION: - //menus - towlmenu.push_back(fromwl.at(j)); - break; - case DESKTOPWINDOW: - //desktop windows - towldesktop.push_back(fromwl.at(j)); - break; - case NORMALWINDOW: - case DIALOGWINDOW: - case TOOLWINDOW: - //case UNKNOWNTYPE: - if(this->mainClass->mainWindowClass->LFSWM2_hasState(fromwl.at(j),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW")))) - { - cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); - if(cc!=NULL) - towlbelow.push_back(cc->frameWindow); - else - towlbelow.push_back(fromwl.at(j)); - break; - } - if(this->mainClass->mainWindowClass->LFSWM2_hasState(fromwl.at(j),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE")))) - { - cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); - if(cc!=NULL) - towlabove.push_back(cc->frameWindow); - else - towlabove.push_back(fromwl.at(j)); - break; - } - cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); - if(cc!=NULL) - { - //if (wtype==UNKNOWNTYPE) - //fprintf(stderr,"wid=0x%x\n",fromwl.at(j)); - towlnormal.push_back(cc->frameWindow); - } - else - towlnormal.push_back(fromwl.at(j)); - break; -// case UNKNOWNTYPE: -// cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); -// if(cc!=NULL) -// { -// if (wtype==UNKNOWNTYPE) -// fprintf(stderr,"wid=0x%x\n",fromwl.at(j)); -// towlnormal.push_back(cc->frameWindow); -// } -// else -// towlnormal.push_back(fromwl.at(j)); -// break; - case DOCKWINDOW: - //panels - towlpanel.push_back(fromwl.at(j)); - break; - } - } - - towl=towlmenu; - - if(this->mainClass->forceDockStackingOrder==FORCEABOVE) - towl.insert(towl.end(),towlpanel.begin(),towlpanel.end()); - towl.insert(towl.end(),towlabove.begin(),towlabove.end()); - towl.insert(towl.end(),towlnormal.begin(),towlnormal.end()); - towl.insert(towl.end(),towlbelow.begin(),towlbelow.end()); - - if(this->mainClass->forceDockStackingOrder==FORCEBELOW) - towl.insert(towl.end(),towlpanel.begin(),towlpanel.end()); - - towl.insert(towl.end(),towldesktop.begin(),towldesktop.end()); - - XRestackWindows(this->mainClass->display,towl.data(),towl.size()); - - for(int j=0;jmainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); - if(cc!=NULL) - { - if(cc->isWithdrawn==false) - netclientwl.push_back(cc->contentWindow); + cl.push_back(this->mainClass->mainWindowClass->clientList.at(this->mainClass->mainWindowClass->windowIDList.at(j))->contentWindow); + wl.push_back(this->mainClass->mainWindowClass->clientList.at(this->mainClass->mainWindowClass->windowIDList.at(j))->frameWindow); } else { - if(this->mainClass->mainWindowClass->LFSWM2_getWindowType(fromwl.at(j))!=DESKTOPWINDOW) - netclientwl.push_back(fromwl.at(j)); + cl.push_back(this->mainClass->mainWindowClass->windowIDList.at(j)); + wl.push_back(this->mainClass->mainWindowClass->windowIDList.at(j)); } } - this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CLIENT_LIST")),XA_WINDOW,32,netclientwl.data(),netclientwl.size()); -//this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CLIENT_LIST_STACKING")),XA_WINDOW,32,netclientwl.data(),netclientwl.size()); -// -// - for(int j=towl.size()-1;j>-1;j--) - { - cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(towl.at(j)); - if(cc!=NULL) - { - if(cc->isWithdrawn==false) - netclientstackwl.push_back(cc->contentWindow); - } - else - { - if(this->mainClass->mainWindowClass->LFSWM2_getWindowType(towl.at(j))!=DESKTOPWINDOW) - netclientstackwl.push_back(towl.at(j)); - } - } - this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_CLIENT_LIST_STACKING")),XA_WINDOW,32,netclientstackwl.data(),netclientstackwl.size()); - //XRestackWindows(this->mainClass->display,towl.data(),towl.size()); + XRestackWindows(this->mainClass->display,wl.data(),wl.size()); + 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()); } -void LFSWM2_eventsClass::LFSWM2_moveToTop(Window id) +void LFSWM2_eventsClass::LFSWM2_shuffle(Window id) { - for(long unsigned j=0;jmainClass->mainWindowClass->windowIDList.size();j++) + std::vector wl; + std::vector wlb; + std::vector::iterator it; + LFSWM2_clientClass *cc; + int findid=0; + int lastdock=0; + int lastabove=0; + int cnt=0; + long unsigned int n=0; + int to=0; + + if(id!=None) { - if(this->mainClass->mainWindowClass->windowIDList.at(j)==id) + findid=std::find(this->mainClass->mainWindowClass->windowIDList.begin(),this->mainClass->mainWindowClass->windowIDList.end(),id)-this->mainClass->mainWindowClass->windowIDList.begin(); + this->mainClass->mainWindowClass->windowIDList.erase(this->mainClass->mainWindowClass->windowIDList.begin()+findid); + this->mainClass->mainWindowClass->windowIDList.emplace (this->mainClass->mainWindowClass->windowIDList.begin(),id); + cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(id); + if(cc!=NULL) { - this->mainClass->mainWindowClass->windowIDList.erase(this->mainClass->mainWindowClass->windowIDList.begin()+j); - this->mainClass->mainWindowClass->windowIDList.emplace (this->mainClass->mainWindowClass->windowIDList.begin(),id); + cc->isActive=true; + this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,32,&cc->contentWindow,1); + XSetInputFocus(this->mainClass->display,cc->contentWindow,RevertToNone,CurrentTime); + this->mainClass->mainWindowClass->LFSWM2_refreshFrame(cc); } } + + for(int j=0;jmainClass->mainWindowClass->windowIDList.size();j++) + { + cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(this->mainClass->mainWindowClass->windowIDList.at(j)); + if((cc!=NULL) && (id!=cc->contentWindow)) + { + cc->isActive=false; + this->mainClass->mainWindowClass->LFSWM2_refreshFrame(cc); + } + if(this->mainClass->mainWindowClass->LFSWM2_getWindowType(this->mainClass->mainWindowClass->windowIDList.at(j))==DOCKWINDOW) + { + wl.emplace(wl.begin()+lastdock,this->mainClass->mainWindowClass->windowIDList.at(j)); + lastdock++; + continue; + } + if(this->mainClass->mainWindowClass->LFSWM2_hasState(this->mainClass->mainWindowClass->windowIDList.at(j),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE")))==true) + { + wl.emplace(wl.begin()+lastabove+lastdock,this->mainClass->mainWindowClass->windowIDList.at(j)); + lastabove++; + continue; + } + } + + for(int j=0;jmainClass->mainWindowClass->windowIDList.size();j++) + { + it=std::find(wl.begin(),wl.end(),this->mainClass->mainWindowClass->windowIDList.at(j)); + if(it != wl.end()) + continue; + wl.push_back(this->mainClass->mainWindowClass->windowIDList.at(j)); + } + +//transients + while(cntmainClass->mainWindowClass->LFSWM2_getProp(wl.at(cnt),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("WM_TRANSIENT_FOR")),XA_WINDOW,&n); + if(n>0) + { + for(int j=0;jmainClass->mainWindowClass->LFSWM2_hasState(wl.at(j),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW")))==false) + { + wlb.push_back(wl.at(j)); + } + } + + for(int j=0;jmainClass->mainWindowClass->LFSWM2_hasState(wl.at(j),this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW")))==true) + { + wlb.push_back(wl.at(j)); + } + } + + this->mainClass->mainWindowClass->windowIDList=wlb; } void LFSWM2_eventsClass::LFSWM2_moveToBottom(Window id) { +//fprintf(stderr,"LFSWM2_moveToBottom\n"); for(long unsigned j=0;jmainClass->mainWindowClass->windowIDList.size();j++) { if(this->mainClass->mainWindowClass->windowIDList.at(j)==id) diff --git a/LFSWM2/LFSWM2/src/eventsClass.h b/LFSWM2/LFSWM2/src/eventsClass.h index 714dd0b..ae6cb22 100644 --- a/LFSWM2/LFSWM2/src/eventsClass.h +++ b/LFSWM2/LFSWM2/src/eventsClass.h @@ -35,7 +35,7 @@ class LFSWM2_eventsClass void LFSWM2_mainEventLoop(void); void LFSWM2_sendConfigureEvent(Window wid,struct rectStruct r); void LFSWM2_doClientMsg(Window id,XClientMessageEvent *e); - void LFSWM2_moveToTop(Window id); + void LFSWM2_shuffle(Window id); void LFSWM2_moveToBottom(Window id); void LFSWM2_restack(void); diff --git a/LFSWM2/LFSWM2/src/lfswm2Class.h b/LFSWM2/LFSWM2/src/lfswm2Class.h index b61fe7a..c455d29 100644 --- a/LFSWM2/LFSWM2/src/lfswm2Class.h +++ b/LFSWM2/LFSWM2/src/lfswm2Class.h @@ -46,7 +46,6 @@ #include "config.h" -//#define __DEBUG__ #ifdef __DEBUG__ #define MOVEKEYS (Mod4Mask|ControlMask|ShiftMask) #else @@ -253,7 +252,6 @@ class LFSWM2_Class Cursor bottomLeftCursor; Cursor leftCursor; Cursor rootCursor; - int restackCnt=-1; LFSWM2_eventsClass *mainEventClass; LFSWM2_windowClass *mainWindowClass; diff --git a/LFSWM2/LFSWM2/src/main.cpp b/LFSWM2/LFSWM2/src/main.cpp index 8c39386..76ebe80 100644 --- a/LFSWM2/LFSWM2/src/main.cpp +++ b/LFSWM2/LFSWM2/src/main.cpp @@ -39,6 +39,7 @@ int main(int argc, char **argv) do { + fprintf(stderr,"<<<<<\n"); loop=false; for(auto& x:mainLFSWM2Class->mainWindowClass->clientList) { diff --git a/LFSWM2/LFSWM2/src/windowsClass.cpp b/LFSWM2/LFSWM2/src/windowsClass.cpp index f8b0b3f..d818351 100644 --- a/LFSWM2/LFSWM2/src/windowsClass.cpp +++ b/LFSWM2/LFSWM2/src/windowsClass.cpp @@ -85,7 +85,6 @@ void LFSWM2_windowClass::LFSWM2_destroyClient(Window id) { delete cc; } - this->mainClass->restackCnt++; } struct fontColour* LFSWM2_windowClass::LFSWM2_xftLoadColour(const char *name,const char *fallback) @@ -138,6 +137,7 @@ bool LFSWM2_windowClass::LFSWM2_createUnframedWindow(Window wid) // case FORCEABOVE: // this->LFSWM2_removeProp(wid,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_BELOW"))); // this->LFSWM2_addState(wid,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE"))); +// // break; // case FORCEBELOW: // this->LFSWM2_removeProp(wid,this->mainClass->atomshashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_STATE_ABOVE"))); @@ -146,9 +146,11 @@ bool LFSWM2_windowClass::LFSWM2_createUnframedWindow(Window wid) // default: // break; // } -// this->LFSWM2_setClientList(wid,true); -// return(true); -// break; + this->LFSWM2_setClientList(wid,true); + this->mainClass->mainEventClass->LFSWM2_shuffle(wid); + this->mainClass->mainEventClass->LFSWM2_restack(); + return(true); + break; case NORMALWINDOW: case DIALOGWINDOW: case TOOLWINDOW: @@ -200,7 +202,6 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs) { if(premaphs.mHints->decorations==0) { - this->mainClass->restackCnt=1; noborder=true; } } @@ -500,14 +501,12 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs) } XAddToSaveSet(this->mainClass->display,id); - this->mainClass->restackCnt++; if(states!=NULL) XFree(states); this->LFSWM2_setControlRects(cc); cc->LFSWM2_setFrameExtents(); } - this->mainClass->restackCnt=0; return(true); } @@ -704,7 +703,6 @@ void LFSWM2_windowClass::LFSWM2_reloadWindowState(Window id) else cc->LFSWM2_hideWindow(false); } - this->mainClass->restackCnt++; XFree(states); return; @@ -863,6 +861,8 @@ void LFSWM2_windowClass::LFSWM2_setClientList(Window id,bool addwindow) } } } +//for(long unsigned j=0;jwindowIDList.size();j++) +// fprintf(stderr,"this->windowIDList.at(j)=%p\n",this->windowIDList.at(j)); } void LFSWM2_windowClass::LFSWM2_setWindowState(Window w,long state) diff --git a/LFSWM2/config.h.in b/LFSWM2/config.h.in index dd3b02c..cee8bdd 100644 --- a/LFSWM2/config.h.in +++ b/LFSWM2/config.h.in @@ -23,3 +23,6 @@ /* Version number of package */ #undef VERSION + +/* Enable debug code */ +#undef __DEBUG__ diff --git a/LFSWM2/configure.ac b/LFSWM2/configure.ac index bda7d4c..95e6672 100644 --- a/LFSWM2/configure.ac +++ b/LFSWM2/configure.ac @@ -56,6 +56,13 @@ PKG_CHECK_MODULES(LFSTK, $LFSTK_MODULES) AC_SUBST(LFSTK_LIBS) AC_SUBST(LFSTK_CFLAGS) +AC_MSG_CHECKING(whether to build debug code) +AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug],[Enable debug code]),[enable_debug=$enableval],[enable_debug="no"]) +AC_MSG_RESULT($enable_debug) +if test "$enable_debug" = "yes"; then + AC_DEFINE([__DEBUG__], [], [Enable debug code]) +fi + AC_SUBST(CXXFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS)