From 5539e697fdff03ad94b0d6c6c2a0c0127e126fca Mon Sep 17 00:00:00 2001 From: K D Hedger Date: Wed, 15 Nov 2023 11:32:52 +0000 Subject: [PATCH] see change log for changes ... --- LFSApplications/ChangeLog | 1 + .../LFSApplications/src/lfsappearance.cpp | 71 ++++++++-- .../LFSApplications/src/lfspanelprefs.cpp | 44 +++++- LFSPanel/ChangeLog | 1 + LFSPanel/LFSPanel/src/appmenu.cpp | 10 ++ LFSPanel/LFSPanel/src/clock.cpp | 4 +- LFSPanel/LFSPanel/src/cpu.cpp | 2 + LFSPanel/LFSPanel/src/disks.cpp | 2 + LFSPanel/LFSPanel/src/globals.cpp | 27 +++- LFSPanel/LFSPanel/src/globals.h | 7 +- LFSPanel/LFSPanel/src/launchers.cpp | 3 + LFSPanel/LFSPanel/src/logout.cpp | 2 + LFSPanel/LFSPanel/src/main.cpp | 17 ++- LFSPanel/LFSPanel/src/slider.cpp | 2 + LFSPanel/LFSPanel/src/windowlist.cpp | 3 + LFSToolKit/ChangeLog | 6 + LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp | 10 ++ LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp | 45 +++++- LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h | 2 + LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h | 5 +- LFSToolKit/LFSToolKit/lfstk/LFSTKImage.cpp | 4 + LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp | 1 - LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp | 1 + LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp | 132 ++++++++++++++++-- LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h | 23 +++ LFSToolKit/configure.ac | 4 +- LFSToolKit/examples/image.cpp | 1 + LFSToolKit/examples/imagebutton.cpp | 25 ++-- LFSToolKit/examples/lineedit.cpp | 2 + LFSToolKit/examples/subwindowtest.cpp | 55 ++++++-- LFSToolKit/examples/window.cpp | 1 + LFSWM2/LFSWM2/src/eventsClass.cpp | 31 +++- LFSWM2/LFSWM2/src/windowsClass.cpp | 116 ++++++++++++--- makeall | 20 +++ 34 files changed, 594 insertions(+), 86 deletions(-) diff --git a/LFSApplications/ChangeLog b/LFSApplications/ChangeLog index 736ca01..5965fcf 100644 --- a/LFSApplications/ChangeLog +++ b/LFSApplications/ChangeLog @@ -1,4 +1,5 @@ 0.2.0 +Added extra options to lfspanelprefs. Removed unnecessary meunitem from dock stacking. Temp removed scale resize. Added frame alpha ( 0-255 ) to lfswm2 prefs. diff --git a/LFSApplications/LFSApplications/src/lfsappearance.cpp b/LFSApplications/LFSApplications/src/lfsappearance.cpp index 0fa302a..dde7690 100644 --- a/LFSApplications/LFSApplications/src/lfsappearance.cpp +++ b/LFSApplications/LFSApplications/src/lfsappearance.cpp @@ -54,6 +54,7 @@ LFSTK_buttonClass *loadSet=NULL; LFSTK_lineEditClass *currentSet=NULL; LFSTK_lineEditClass *key=NULL; +LFSTK_ExpanderGadgetClass *multi=NULL; int queueID=-1; @@ -258,15 +259,23 @@ bool menuCB(void *p,void* ud) int main(int argc, char **argv) { - XEvent event; - int sy=0; - int sx=BORDER; - char *buffer=NULL; + XEvent event; + int sy=0; + int sx=BORDER; + char *buffer=NULL; + std::vector hrs; apc=new LFSTK_applicationClass(); apc->LFSTK_addWindow(NULL,BOXLABEL); wc=apc->mainWindow; + multi=new LFSTK_ExpanderGadgetClass(wc,"",0,0,1,1); + multi->stretchX=false; + multi->stretchY=false; + multi->lockY=LOCKTOTOP; + multi->lockX=LOCKTOCENTRE; + multi->gadgetStretch=STRETCH; + find=new LFSTK_findClass; find->LFSTK_setFindType(FOLDERTYPE); find->LFSTK_setFullPath(true); @@ -275,51 +284,80 @@ int main(int argc, char **argv) find->LFSTK_setIgnoreNavLinks(true); addGroup(); + + multi->LFSTK_setHitRects(hrs); + hrs.clear(); - copyrite=new LFSTK_labelClass(wc,COPYRITE,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE); + hrs.push_back({0,sy,DIALOGWIDTH,GADGETHITE,NULL}); + + copyrite=new LFSTK_labelClass(wc,COPYRITE,0,0,1,1); + copyrite->LFSTK_setLabelGravity(CENTRE); + hrs.back().gadget=copyrite; sy+=HALFYSPACING; - personal=new LFSTK_labelClass(wc,PERSONAL,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE); + + hrs.push_back({0,sy,DIALOGWIDTH,GADGETHITE,NULL}); + personal=new LFSTK_labelClass(wc,PERSONAL,0,0,1,1); + personal->LFSTK_setLabelGravity(CENTRE); + hrs.back().gadget=personal; personal->LFSTK_setCairoFontDataParts("B"); sy+=YSPACING; //launch sub-prefs //wallpaper - launchButton=new LFSTK_buttonClass(wc,"Wallpaper Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); + launchButton=new LFSTK_buttonClass(wc,"Wallpaper Prefs",0,0,1,1,BUTTONGRAV); launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"WALLPAPERPREFS"); - launchLabel=new LFSTK_labelClass(wc,"Launch Wallpaper Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton}); + launchLabel=new LFSTK_labelClass(wc,"Launch Wallpaper Prefs Dialog",0,0,1,1,LEFT); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel}); sy+=YSPACING; + //toolkit launchButton=new LFSTK_buttonClass(wc,"Toolkit Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"TOOLKITPREFS"); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton}); launchLabel=new LFSTK_labelClass(wc,"Launch Toolkit Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel}); sy+=YSPACING; + //desktop launchButton=new LFSTK_buttonClass(wc,"Desktop Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"DESKTOPPREFS"); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton}); launchLabel=new LFSTK_labelClass(wc,"Launch Desktop Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel}); sy+=YSPACING; + //wmanager launchButton=new LFSTK_buttonClass(wc,"WM Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"WMPREFS"); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton}); launchLabel=new LFSTK_labelClass(wc,"Launch Window Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT); launchLabel->LFSTK_setLabelGravity(LEFT); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel}); sy+=YSPACING; + //lfswm2 launchButton=new LFSTK_buttonClass(wc,"LFSWM2 Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"LFSWM2PREFS"); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton}); launchLabel=new LFSTK_labelClass(wc,"Launch LFSWM2 Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT); launchLabel->LFSTK_setLabelGravity(LEFT); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel}); sy+=YSPACING; + //panel launchButton=new LFSTK_buttonClass(wc,"Panel Prefs",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); launchButton->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"PANELPREFS"); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchButton}); launchLabel=new LFSTK_labelClass(wc,"Launch Panel Prefs Dialog",BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,LEFT); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,launchLabel}); sy+=YSPACING; //load set loadSet=new LFSTK_buttonClass(wc,"Load Set",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); loadSet->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"SHOWGROUPS"); loadSet->LFSTK_setIndicator(DISCLOSURE); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,loadSet}); setMenu=new LFSTK_menuClass(wc,BORDER+GADGETWIDTH,sy,1,1); setMenu->LFSTK_setMouseCallBack(NULL,menuCB,NULL); @@ -327,36 +365,45 @@ int main(int argc, char **argv) buffer=wc->globalLib->LFSTK_oneLiner("sed -n '1p' %s/lfsappearance.rc",apc->configDir); currentSet=new LFSTK_lineEditClass(wc,buffer,BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,BUTTONGRAV); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,currentSet}); free(buffer); sy+=YSPACING; //msg key buffer=wc->globalLib->LFSTK_oneLiner("sed -n '2p' %s/lfsappearance.rc",apc->configDir); launchLabel=new LFSTK_labelClass(wc,"Msg Key",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT); + hrs.push_back({BORDER,sy,GADGETWIDTH,GADGETHITE,launchLabel}); key=new LFSTK_lineEditClass(wc,buffer,BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,BUTTONGRAV); + hrs.push_back({BORDER*2+GADGETWIDTH,sy,LABELWIDTH,GADGETHITE,key}); free(buffer); sy+=YSPACING; //line - seperator=new LFSTK_buttonClass(wc,"--",0,sy,DIALOGWIDTH,GADGETHITE,BUTTONGRAV); - seperator->LFSTK_setStyle(BEVELNONE); - seperator->gadgetDetails.buttonTile=false; - seperator->gadgetDetails.colour=&wc->windowColourNames[NORMALCOLOUR]; +// seperator=new LFSTK_buttonClass(wc,"--",0,sy,10000,GADGETHITE,BUTTONGRAV); +// seperator->LFSTK_setStyle(BEVELNONE); +// seperator->gadgetDetails.buttonTile=false; +// seperator->gadgetDetails.colour=&wc->windowColourNames[NORMALCOLOUR]; +// hrs.push_back({0,sy,10000,GADGETHITE,seperator});//HHMMMMmmmmm sy+=YSPACING; //quit quit=new LFSTK_buttonClass(wc,"Quit",sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); quit->LFSTK_setMouseCallBack(NULL,doQuit,NULL); + hrs.push_back({sx,sy,GADGETWIDTH,GADGETHITE,quit}); sx+=GADGETWIDTH+BORDER; //update update=new LFSTK_buttonClass(wc,"Update",sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); update->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"UPDATE"); + hrs.push_back({sx,sy,GADGETWIDTH,GADGETHITE,update}); sx+=GADGETWIDTH+BORDER; //apply apply=new LFSTK_buttonClass(wc,"Apply",sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); apply->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)"APPLY"); + hrs.push_back({sx,sy,GADGETWIDTH,GADGETHITE,apply}); sy+=YSPACING; + multi->LFSTK_setGadgetSize(DIALOGWIDTH,sy); + multi->LFSTK_setHitRects(hrs); wc->LFSTK_resizeWindow(BORDER*3+GADGETWIDTH+LABELWIDTH,sy,true); wc->LFSTK_showWindow(); diff --git a/LFSApplications/LFSApplications/src/lfspanelprefs.cpp b/LFSApplications/LFSApplications/src/lfspanelprefs.cpp index b0aa7f3..578e577 100644 --- a/LFSApplications/LFSApplications/src/lfspanelprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfspanelprefs.cpp @@ -30,11 +30,11 @@ #define BOXLABEL "LFS Panel Prefs" LFSTK_applicationClass *apc=NULL; -LFSTK_prefsClass prefs; +LFSTK_prefsClass prefs; LFSTK_windowClass *wc=NULL; -LFSTK_labelClass *label=NULL; -LFSTK_labelClass *personal=NULL; -LFSTK_labelClass *copyrite=NULL; +LFSTK_labelClass *label=NULL; +LFSTK_labelClass *personal=NULL; +LFSTK_labelClass *copyrite=NULL; LFSTK_buttonClass *seperator=NULL; LFSTK_buttonClass *quit=NULL; LFSTK_buttonClass *apply=NULL; @@ -67,6 +67,11 @@ LFSTK_lineEditClass *panelOnMonitor=NULL; LFSTK_lineEditClass *panelLeftGadgets=NULL; LFSTK_lineEditClass *panelrightGadgets=NULL; +LFSTK_toggleButtonClass *useTheme=NULL; +LFSTK_toggleButtonClass *noButtons=NULL; +LFSTK_lineEditClass *panelColourEdit=NULL; +LFSTK_lineEditClass *panelTextColourEdit=NULL; + std::map panelWidthConvertToStr={{-1,"Fill"},{-2,"Shrink"}}; std::map panelPosConvertToStr={{-1,"Left"},{-2,"Centre"},{-3,"Right"}}; std::map panelGravConvertToStr={{1,"North"},{2,"East"},{3,"South",},{4,"West"}}; @@ -119,6 +124,10 @@ void getEdits(void) {prefs.LFSTK_hashFromKey("shutdowncommand"),{TYPESTRING,"shutdowncommand",shutdown->LFSTK_getCStr(),false,0}}, {prefs.LFSTK_hashFromKey("gadgetsright"),{TYPESTRING,"gadgetsright",panelrightGadgets->LFSTK_getCStr(),false,0}}, {prefs.LFSTK_hashFromKey("gadgetsleft"),{TYPESTRING,"gadgetsleft",panelLeftGadgets->LFSTK_getCStr(),false,0}}, + {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",useTheme->LFSTK_getValue(),0}}, + {prefs.LFSTK_hashFromKey("nobuttons"),{TYPEBOOL,"nobuttons","",noButtons->LFSTK_getValue(),0}}, + {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour",panelColourEdit->LFSTK_getCStr(),false,0}}, + {prefs.LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour",panelTextColourEdit->LFSTK_getCStr(),false,0}}, }; } @@ -192,6 +201,10 @@ void setEdits(void) shutdown->LFSTK_setBuffer(prefs.LFSTK_getCString("shutdowncommand")); panelLeftGadgets->LFSTK_setBuffer(prefs.LFSTK_getCString("gadgetsleft")); panelrightGadgets->LFSTK_setBuffer(prefs.LFSTK_getCString("gadgetsright")); + useTheme->LFSTK_setValue(prefs.LFSTK_getBool("usetheme")); + noButtons->LFSTK_setValue(prefs.LFSTK_getBool("nobuttons")); + panelColourEdit->LFSTK_setBuffer(prefs.LFSTK_getCString("panelcolour")); + panelTextColourEdit->LFSTK_setBuffer(prefs.LFSTK_getCString("textcolour")); } void getPrefs(void) @@ -211,6 +224,10 @@ void getPrefs(void) {prefs.LFSTK_hashFromKey("shutdowncommand"),{TYPESTRING,"shutdowncommand","",false,0}}, {prefs.LFSTK_hashFromKey("gadgetsright"),{TYPESTRING,"gadgetsright","",false,0}}, {prefs.LFSTK_hashFromKey("gadgetsleft"),{TYPESTRING,"gadgetsleft","",false,0}}, + {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",true,0}}, + {prefs.LFSTK_hashFromKey("nobuttons"),{TYPEBOOL,"nobuttons","",false,0}}, + {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour","",false,0}}, + {prefs.LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","black",false,0}}, }; asprintf(&env,"%s/%s",apc->configDir,panelNameEdit->LFSTK_getCStr()); @@ -393,6 +410,25 @@ int main(int argc, char **argv) panelGravEdit=new LFSTK_lineEditClass(wc,"",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); sy+=YSPACING; +//use theme + useTheme=new LFSTK_toggleButtonClass(wc,"Use Theme",BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + useTheme->LFSTK_setValue(prefs.LFSTK_getBool("usetheme")); + +//no button graphics + noButtons=new LFSTK_toggleButtonClass(wc,"No Button Graphics",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + noButtons->LFSTK_setValue(prefs.LFSTK_getBool("nobuttons")); + sy+=YSPACING; + +//panel colour + label=new LFSTK_labelClass(wc,"Panel Colour",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT); + panelColourEdit=new LFSTK_lineEditClass(wc,"",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + sy+=YSPACING; + +//panel text colour + label=new LFSTK_labelClass(wc,"Text Colour",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT); + panelTextColourEdit=new LFSTK_lineEditClass(wc,"black",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + sy+=YSPACING; + //on monitor label=new LFSTK_labelClass(wc,"On Monitor",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT); panelOnMonitor=new LFSTK_lineEditClass(wc,"",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); diff --git a/LFSPanel/ChangeLog b/LFSPanel/ChangeLog index 6215873..563d754 100644 --- a/LFSPanel/ChangeLog +++ b/LFSPanel/ChangeLog @@ -1,4 +1,5 @@ 0.2.0 +Added extra prefs to handle transparent windows, etc. Fixed occasional segfault in window menu. Fixed menu items from bad window names. Fixed segfault on window list. diff --git a/LFSPanel/LFSPanel/src/appmenu.cpp b/LFSPanel/LFSPanel/src/appmenu.cpp index 99d3d99..9d87e89 100755 --- a/LFSPanel/LFSPanel/src/appmenu.cpp +++ b/LFSPanel/LFSPanel/src/appmenu.cpp @@ -277,6 +277,9 @@ int addAppmenu(int x,int y,int grav,bool fromleft) appButton=new LFSTK_buttonClass(mainwind,"",xpos,ypos,width,height,thisgrav); appButton->LFSTK_setImageFromPath("/usr/share/pixmaps/LFSTux.png",LEFT,true); appButton->LFSTK_setMouseCallBack(NULL,buttonCB,NULL); + + setGadgetDetails(appButton); + appMenu=new LFSTK_menuClass(mainwind,xpos,ypos+panelHeight,1,1); addEntries(); @@ -319,6 +322,13 @@ int addAppmenu(int x,int y,int grav,bool fromleft) appMenu->LFSTK_setMouseCallBack(NULL,menuCB,NULL); appMenu->LFSTK_addMainMenus(catagoryMenus,catagoryCnt); XMapWindow(mainwind->app->display,appButton->LFSTK_getWindow()); + +// if(useTheme==false) +// { +// appButton->LFSTK_setTile(NULL,0); +// appButton->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true);//TODO// +// } + appButton->LFSTK_clearWindow(); return(width); diff --git a/LFSPanel/LFSPanel/src/clock.cpp b/LFSPanel/LFSPanel/src/clock.cpp index 0b97b8c..16e617e 100644 --- a/LFSPanel/LFSPanel/src/clock.cpp +++ b/LFSPanel/LFSPanel/src/clock.cpp @@ -62,6 +62,8 @@ int addClock(int x,int y,int grav) xpos=x-width; clockButton=new LFSTK_labelClass(mainwind,"--:--:--",xpos,0,width,panelHeight,CENTRE,grav); - + + setGadgetDetails(clockButton); + return(retval); } diff --git a/LFSPanel/LFSPanel/src/cpu.cpp b/LFSPanel/LFSPanel/src/cpu.cpp index 4a5a03e..7112b88 100644 --- a/LFSPanel/LFSPanel/src/cpu.cpp +++ b/LFSPanel/LFSPanel/src/cpu.cpp @@ -95,6 +95,8 @@ int addCpuData(int x,int y,int grav) setNewData(); cpuButton=new LFSTK_labelClass(mainwind,"CPU=0.0%",xpos,0,width,panelHeight,CENTRE,grav); cpuButton->LFSTK_setLabelGravity(LEFT); + setGadgetDetails(cpuButton); + return(retval); } diff --git a/LFSPanel/LFSPanel/src/disks.cpp b/LFSPanel/LFSPanel/src/disks.cpp index 266f279..e6aff4b 100644 --- a/LFSPanel/LFSPanel/src/disks.cpp +++ b/LFSPanel/LFSPanel/src/disks.cpp @@ -96,5 +96,7 @@ int addDiskData(int x,int y,int grav) oldWrite=getWriteStats(); diskButton=new LFSTK_labelClass(mainwind,"R=0Mb/s W=0Mb/s",xpos,0,width,panelHeight,CENTRE,grav); diskButton->LFSTK_setLabelGravity(LEFT); + setGadgetDetails(diskButton); + return(retval); } diff --git a/LFSPanel/LFSPanel/src/globals.cpp b/LFSPanel/LFSPanel/src/globals.cpp index 29c0695..cd1856d 100644 --- a/LFSPanel/LFSPanel/src/globals.cpp +++ b/LFSPanel/LFSPanel/src/globals.cpp @@ -22,20 +22,28 @@ //prefs LFSTK_prefsClass prefs; +/* + {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",useTheme->LFSTK_getValue(),0}}, + {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour",panelColourEdit->LFSTK_getCStr(),false,0}}, +*/ int panelHeight=16; int panelWidth=-1; const monitorStruct *mons=NULL; int onMonitor=0; int panelPos=PANELCENTRE; int panelGravity=PANELNORTH; +bool useTheme=true; +const char *panelColour=""; +const char *panelTextColour=""; +bool noButtons=false; int queueID; msgBuffer buffer; const char *desktopTheme=NULL; const char *panelID=""; -bool realMainLoop=true; +bool realMainLoop=true; int refreshRate=1; @@ -146,3 +154,20 @@ void dropDesktopFile(const char *data,launcherList *launcher) } } +void setGadgetDetails(LFSTK_gadgetClass *gadget) +{ + if(useTheme==false) + { + gadget->LFSTK_setAlpha(1.0); + gadget->LFSTK_setTile(NULL,0); + gadget->LFSTK_setColourName(NORMALCOLOUR,panelColour); + gadget->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); + if(noButtons==true) + { + gadget->gadgetDetails.bevel=BEVELNONE; + gadget->LFSTK_setColourName(PRELIGHTCOLOUR,panelColour); + gadget->LFSTK_setColourName(ACTIVECOLOUR,panelColour); + gadget->LFSTK_setColourName(INACTIVECOLOUR,panelColour); + } + } +} diff --git a/LFSPanel/LFSPanel/src/globals.h b/LFSPanel/LFSPanel/src/globals.h index 4231db4..64977a3 100644 --- a/LFSPanel/LFSPanel/src/globals.h +++ b/LFSPanel/LFSPanel/src/globals.h @@ -75,9 +75,13 @@ extern const monitorStruct *mons; extern int onMonitor; extern int panelPos; extern int panelGravity; +extern bool useTheme; +extern const char *panelColour; +extern const char *panelTextColour; +extern bool noButtons; extern int queueID; -extern msgBuffer buffer; +extern msgBuffer buffer; extern bool realMainLoop; extern const char *desktopTheme; @@ -109,5 +113,6 @@ void printError(const char *err); void setSizes(int *x,int *y,int *w,int *h,int *size,int *grav,bool fromleft); void dropDesktopFile(const char *data,launcherList *launcher); void sendNotify(const char *message1,const char *message2); +void setGadgetDetails(LFSTK_gadgetClass *gadget); #endif diff --git a/LFSPanel/LFSPanel/src/launchers.cpp b/LFSPanel/LFSPanel/src/launchers.cpp index dd33519..c02dfe0 100644 --- a/LFSPanel/LFSPanel/src/launchers.cpp +++ b/LFSPanel/LFSPanel/src/launchers.cpp @@ -149,6 +149,9 @@ int addLaunchers(int x,int y,int grav,bool fromleft) loopll->bc->LFSTK_setImageFromPath(icon,LEFT,true); else loopll->bc->LFSTK_setImageFromPath(DATADIR "/pixmaps/command.png",LEFT,true); + + setGadgetDetails(loopll->bc); + if(icon!=NULL) free(icon); loopll=loopll->next; diff --git a/LFSPanel/LFSPanel/src/logout.cpp b/LFSPanel/LFSPanel/src/logout.cpp index 7040429..d7ddad9 100644 --- a/LFSPanel/LFSPanel/src/logout.cpp +++ b/LFSPanel/LFSPanel/src/logout.cpp @@ -102,6 +102,8 @@ int addLogout(int x,int y,int grav,bool fromleft) else logoutButton->LFSTK_setImageFromPath(DATADIR "/pixmaps/exit.png",LEFT,true); + setGadgetDetails(logoutButton); + logoutButton->LFSTK_setMouseCallBack(NULL,logoutCB,NULL); logoutMenu=new LFSTK_menuClass(mainwind,xpos,ypos+panelHeight,1,1); diff --git a/LFSPanel/LFSPanel/src/main.cpp b/LFSPanel/LFSPanel/src/main.cpp index 825bc34..536422f 100644 --- a/LFSPanel/LFSPanel/src/main.cpp +++ b/LFSPanel/LFSPanel/src/main.cpp @@ -45,6 +45,10 @@ void loadPrefs(const char *env) onMonitor=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("onmonitor")); panelPos=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelpos")); panelGravity=prefs.LFSTK_getInt(prefs.LFSTK_hashFromKey("panelgrav")); + useTheme=prefs.LFSTK_getBool(prefs.LFSTK_hashFromKey("usetheme")); + panelColour=prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("panelcolour")); + panelTextColour=prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("textcolour")); + noButtons=prefs.LFSTK_getBool(prefs.LFSTK_hashFromKey("nobuttons")); } void addLeftGadgets(void) @@ -196,7 +200,12 @@ int main(int argc,char **argv) {prefs.LFSTK_hashFromKey("gadgetsleft"),{TYPESTRING,"gadgetsleft","l",false,0}}, {prefs.LFSTK_hashFromKey("panelpos"),{TYPEINT,"panelpos","",false,0}}, - {prefs.LFSTK_hashFromKey("panelgrav"),{TYPEINT,"panelgrav","",false,0}} + {prefs.LFSTK_hashFromKey("panelgrav"),{TYPEINT,"panelgrav","",false,0}}, + + {prefs.LFSTK_hashFromKey("usetheme"),{TYPEBOOL,"usetheme","",false,0}}, + {prefs.LFSTK_hashFromKey("nobuttons"),{TYPEBOOL,"nobuttons","",false,0}}, + {prefs.LFSTK_hashFromKey("panelcolour"),{TYPESTRING,"panelcolour","",false,0}}, + {prefs.LFSTK_hashFromKey("textcolour"),{TYPESTRING,"textcolour","black",false,0}} }; realMainLoop=true; @@ -258,6 +267,12 @@ int main(int argc,char **argv) rightOffset=0; leftOffset=0; + if(useTheme==false) + { + mainwind->LFSTK_setTile(NULL,0); + mainwind->LFSTK_setWindowColourName(NORMALCOLOUR,panelColour); + } + addLeftGadgets(); addRightGadgets(); diff --git a/LFSPanel/LFSPanel/src/slider.cpp b/LFSPanel/LFSPanel/src/slider.cpp index 82ee4f6..244dae9 100644 --- a/LFSPanel/LFSPanel/src/slider.cpp +++ b/LFSPanel/LFSPanel/src/slider.cpp @@ -176,6 +176,8 @@ int addSlider(int x,int y,int grav,bool fromleft) volumeButton->LFSTK_setToggleStyle(TOGGLENORMAL); volumeButton->LFSTK_setMouseCallBack(NULL,sliderCB,(void*)volumeButton->LFSTK_getLabel()); + setGadgetDetails(volumeButton);//TODO// + iconH=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"volume-high",""); iconM=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"volume-medium",""); iconL=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"volume-low",""); diff --git a/LFSPanel/LFSPanel/src/windowlist.cpp b/LFSPanel/LFSPanel/src/windowlist.cpp index 67a6ae8..123b4c8 100644 --- a/LFSPanel/LFSPanel/src/windowlist.cpp +++ b/LFSPanel/LFSPanel/src/windowlist.cpp @@ -311,6 +311,7 @@ int addWindowDeskMenu(int x,int y,int grav,bool fromleft) else windowDesk->LFSTK_setImageFromPath(DATADIR "/pixmaps/windows.png",LEFT,true); + setGadgetDetails(windowDesk); if(windowMenu==NULL) { @@ -345,6 +346,8 @@ int addWindowMenu(int x,int y,int grav,bool fromleft) windowAll=new LFSTK_buttonClass(mainwind,"",xpos,ypos,width,height,thisgrav); icon=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"computer",""); + setGadgetDetails(windowAll); + if(icon!=NULL) { windowAll->LFSTK_setImageFromPath(icon,LEFT,true); diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog index 9b04d5d..66eb7d7 100644 --- a/LFSToolKit/ChangeLog +++ b/LFSToolKit/ChangeLog @@ -1,3 +1,9 @@ +0.5.2 +Added support for colour names including a 8 bit alpha def eg "#80ff00ff". +Added transparent windows ( see examples/subwindows ). +Loads of gui fixes. +Moved to 32bit tru colour windows. + 0.5.1 Minor gui fix on scrollable menus. Fixed scrolling sub menus. diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp index 1058990..ac96f13 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp @@ -58,8 +58,18 @@ LFSTK_buttonClass::LFSTK_buttonClass(LFSTK_windowClass* parentwc,const char* lab wa.win_gravity=gravity; wa.save_under=true; +// wa.border_pixel=0; +// wa.background_pixel=0; +// +// XVisualInfo vinfo; +// XMatchVisualInfo(this->wc->app->display,DefaultScreen(this->wc->app->display),32,TrueColor,&vinfo); +// +// this->visual=vinfo.visual; +// this->cmap=XCreateColormap(this->wc->app->display,DefaultRootWindow(this->wc->app->display),this->visual,AllocNone); +// wa.colormap=this->cmap; this->window=XCreateWindow(this->wc->app->display,this->parent,x,y,w,h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWSaveUnder,&wa); + //this->window=XCreateWindow(this->wc->app->display,this->parent,x,y,w,h,0,32,InputOutput,CopyFromParent,(CWColormap | CWBorderPixel| CWBackPixel|CWWinGravity|CWSaveUnder),&wa); this->gc=XCreateGC(this->wc->app->display,this->window,0,NULL); this->wc->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->window,this->wc->app->visual,&this->sfc,&this->cr,w,h); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp index 04e0f69..341bead 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp @@ -107,7 +107,7 @@ void LFSTK_gadgetClass::LFSTK_setFontColourName(int p,const char* colour,bool us this->fontColourNames[p].pixel=tc.pixel; if(usewindow==true) - col=this->wc->windowColourNames[0]; + col=this->wc->windowColourNames[0];//TODO// if((this->autoLabelColour==true) && (p!=INACTIVECOLOUR)) { @@ -183,21 +183,49 @@ void LFSTK_gadgetClass::LFSTK_setLabelBGColour(const char* colour,double alpha) * Set the colour name for gadget. * \param p Gadget state. * \param colour Colour name. -* \note state is NORMALCOLOUR=0,PRELIGHTCOLOUR=1,ACTIVECOLOUR=2,INACTIVECOLOUR=3. +* \note State is NORMALCOLOUR=0,PRELIGHTCOLOUR=1,ACTIVECOLOUR=2,INACTIVECOLOUR=3. +* \note Alpha of colour is set to alpha of window normal, unless specifically set. */ void LFSTK_gadgetClass::LFSTK_setColourName(int p,const char* colour) { - XColor tc,sc; + XColor tc,sc; + std::string str=colour; + int alphaint=-1; + if(this->colourNames[p].name!=NULL) free(this->colourNames[p].name); + this->colourNames[p].name=strdup(colour); - XAllocNamedColor(this->wc->app->display,this->wc->app->cm,colour,&sc,&tc); + + if(str.at(0)=='#') + { + if(str.length()>7) + { + alphaint=std::stoi (str.substr(1,2),nullptr,16); + str.erase(str.begin()+1,str.begin()+3); + } + } + + XAllocNamedColor(this->wc->app->display,this->wc->app->cm,str.c_str(),&sc,&tc); this->colourNames[p].pixel=sc.pixel; this->colourNames[p].RGBAColour.r=((this->colourNames[p].pixel>>16) & 0xff)/256.0; this->colourNames[p].RGBAColour.g=((this->colourNames[p].pixel>>8) & 0xff)/256.0; this->colourNames[p].RGBAColour.b=((this->colourNames[p].pixel>>0) & 0xff)/256.0; - this->colourNames[p].RGBAColour.a=1.0; + + if(alphaint!=-1) + this->colourNames[p].RGBAColour.a=alphaint/256.0; + else + this->colourNames[p].RGBAColour.a=this->wc->windowColourNames[NORMALCOLOUR].RGBAColour.a; +// +// +//if(p==PRELIGHTCOLOUR) +//{ +//fprintf(stderr,"window alpha=%f\n",this->wc->windowColourNames[p].RGBAColour.a); +// fprintf(stderr,"r=%f g=%f b=%f a=%f\n",this->colourNames[p].RGBAColour.r,this->colourNames[p].RGBAColour.g,this->colourNames[p].RGBAColour.b,this->colourNames[p].RGBAColour.a); +// std::cout<<"str="<imageWidth=0; this->gadgetAcceptsDnD=false; this->showIndicator=true; + this->LFSTK_setAlpha(this->wc->windowColourNames[NORMALCOLOUR].RGBAColour.a); } /** @@ -433,6 +462,7 @@ void LFSTK_gadgetClass::clearBox(gadgetStruct* details) cairo_save(this->cr); cairo_reset_clip(this->cr); cairo_set_source_rgba(this->cr,details->colour->RGBAColour.r,details->colour->RGBAColour.g,details->colour->RGBAColour.b,details->colour->RGBAColour.a); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_paint(this->cr); cairo_restore(this->cr); } @@ -467,12 +497,14 @@ void LFSTK_gadgetClass::drawBevel(geometryStruct* geom,bevelType bevel) cairo_set_antialias (this->cr,CAIRO_ANTIALIAS_NONE); cairo_set_line_width(this->cr,1.0); cairo_set_source_rgba(this->cr,tlcolour.r,tlcolour.g,tlcolour.b,1.0); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_move_to(this->cr,geom->x+1,geom->h+geom->y+1); cairo_line_to(this->cr,geom->x+1,geom->y+1); cairo_line_to(this->cr,geom->x+geom->w,geom->y+1); cairo_stroke(this->cr); cairo_set_source_rgba(this->cr,brcolour.r,brcolour.g,brcolour.b,1.0); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_move_to(this->cr,geom->x+geom->w,geom->y+1); cairo_line_to(this->cr,geom->x+geom->w,geom->y+geom->h); cairo_line_to(this->cr,geom->x+1,geom->y+geom->h); @@ -573,6 +605,7 @@ void LFSTK_gadgetClass::drawLabel(gadgetStruct* details) } cairo_set_source_rgba(this->cr,colptr->r,colptr->g,colptr->b,colptr->a); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_rectangle(this->cr,labelrect.x,labelrect.y,labelrect.w,labelrect.h); cairo_fill(this->cr); } @@ -1589,7 +1622,7 @@ void LFSTK_gadgetClass::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) { diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h index 063ab91..2bae98d 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h @@ -144,6 +144,8 @@ class LFSTK_gadgetClass Window parent; GC gc; Window window; + Visual *visual; + Colormap cmap; bool drawLabelBG=false; bool autoLabelBGColour=false; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h index 860d0d1..e57c031 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h @@ -291,14 +291,14 @@ struct rectStruct struct cairoColor { - double r,g,b,a; + double r,g,b,a; }; struct colourStruct { char *name; long pixel; - cairoColor RGBAColour; + cairoColor RGBAColour; }; class LFSTK_gadgetClass; @@ -331,7 +331,6 @@ struct gadgetStruct bool geomRelativeToMainWindow=false; bool showLink=false; bool showBroken=false; - }; class LFSTK_applicationClass; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKImage.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKImage.cpp index b50ce5f..0b959d4 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKImage.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKImage.cpp @@ -86,6 +86,7 @@ void LFSTK_imageClass::LFSTK_clearWindow(void) cairo_save(this->shapecr); cairo_reset_clip(this->shapecr); cairo_set_source_surface(this->cr,this->cImage,xoffset,yoffset); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_paint_with_alpha(this->cr,this->alpha); cairo_set_operator(this->shapecr,CAIRO_OPERATOR_CLEAR); cairo_rectangle(this->shapecr,0,0,this->gadgetGeom.w,this->gadgetGeom.h); @@ -115,7 +116,10 @@ LFSTK_imageClass::LFSTK_imageClass(LFSTK_windowClass* parentwc,const char* image wa.win_gravity=gravity; wa.save_under=true; + //this->window=XCreateWindow(this->wc->app->display,this->parent,x,y,w,this->gadgetGeom.h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWSaveUnder,&wa); + this->window=XCreateWindow(this->wc->app->display,this->parent,x,y,w,this->gadgetGeom.h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWSaveUnder,&wa); + this->gc=XCreateGC(this->wc->app->display,this->window,0,NULL); this->wc->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->window,this->wc->app->visual,&this->sfc,&this->cr,w,h); this->LFSTK_setCairoFontData(); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp index f5c146e..9bf23bc 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp @@ -795,7 +795,6 @@ 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(*sfc==NULL) *sfc=cairo_xlib_surface_create(display,window,visual,width,height); else diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp index f6299e3..990134d 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp @@ -305,6 +305,7 @@ void LFSTK_lineEditClass::drawLabel(void) cairo_save(this->cr); cairo_reset_clip(this->cr); cairo_set_source_rgba(this->cr,this->colourNames[NORMALCOLOUR].RGBAColour.r,this->colourNames[NORMALCOLOUR].RGBAColour.g,this->colourNames[NORMALCOLOUR].RGBAColour.b,this->colourNames[NORMALCOLOUR].RGBAColour.a); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_paint(this->cr); cairo_restore(this->cr); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp index 0ba9b89..a2601a3 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp @@ -37,10 +37,10 @@ struct Hints { - unsigned long flags; + unsigned long flags; unsigned long functions; unsigned long decorations; - long inputMode; + long inputMode; unsigned long status; }; @@ -369,10 +369,13 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) } else { + cairo_save(this->cr); cairo_reset_clip (this->cr); - cairo_set_source_rgba(this->cr,this->windowColourNames[state].RGBAColour.r,this->windowColourNames[state].RGBAColour.g,this->windowColourNames[state].RGBAColour.b,this->windowColourNames[state].RGBAColour.a); - cairo_paint(this->cr); + cairo_set_source_rgba(this->cr,this->windowColourNames[state].RGBAColour.r,this->windowColourNames[state].RGBAColour.g,this->windowColourNames[state].RGBAColour.b,this->windowColourNames[state].RGBAColour.a); + cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); + cairo_paint(this->cr); + cairo_surface_flush (this->sfc); cairo_restore(this->cr); } } @@ -390,8 +393,18 @@ void LFSTK_windowClass::LFSTK_resizeWindow(int w,int h,bool tellx) if(tellx==true) XResizeWindow(this->app->display,this->window,w,h); - this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->app->visual,&this->sfc,&this->cr,w,h); - this->LFSTK_clearWindow(); +//cairo_xlib_surface_set_drawable (this->sfc, +// this->window, +// w, +// h); +//XSync(this->app->display,false); + this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->visual,&this->sfc,&this->cr,w,h); +// this->LFSTK_clearWindow(); + +//XUnmapWindow(this->app->display,this->window); +//XSync(this->app->display,false); +//XMapWindow(this->app->display,this->window); +//XSync(this->app->display,false); } /** @@ -444,6 +457,55 @@ void LFSTK_windowClass::LFSTK_setDecorated(bool isDecorated) } } +/** +* Set window decorations. +* \param bool canmax=true,bool canmin=true,bool canresize=true. +//motif +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) + +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) + +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) +*/ +void LFSTK_windowClass::LFSTK_setDecorations(bool canmax,bool canmin,bool canresize,bool canclose) +{ + Atom xa_prop[10]; + Hints hints; + + hints.flags=MWM_HINTS_DECORATIONS; + hints.decorations=MWM_DECOR_BORDER; + hints.functions=0; + hints.inputMode=0; + hints.status=0; + + if(canmax==true) + hints.decorations|=MWM_DECOR_MAXIMIZE; + if(canmin==true) + hints.decorations|=MWM_DECOR_MINIMIZE; + if(canresize==true) + hints.decorations|=MWM_DECOR_RESIZEH; + if(canclose==true) + hints.functions|=MWM_FUNC_CLOSE; + + xa_prop[9]=XInternAtom(this->app->display,"_MOTIF_WM_HINTS",True); + if(xa_prop[9]!=None) + XChangeProperty(this->app->display,this->window,xa_prop[9],xa_prop[9],32,PropModeReplace,(unsigned char *)&hints,5); + +} + + /** * Set the colour name for font. * \param p Font state. @@ -465,19 +527,36 @@ void LFSTK_windowClass::LFSTK_setFontColourName(int p,const char *colour) */ void LFSTK_windowClass::LFSTK_setWindowColourName(int p,const char* colour) { - XColor tc,sc; + XColor tc,sc; + std::string str=colour; + int alphaint=255; if(this->windowColourNames[p].name!=NULL) free(this->windowColourNames[p].name); this->windowColourNames[p].name=strdup(colour); - XAllocNamedColor(this->app->display,this->app->cm,colour,&sc,&tc); + if(str.at(0)=='#') + { + if(str.length()>7) + { + alphaint=std::stoi (str.substr(1,2),nullptr,16); + str.erase(str.begin()+1,str.begin()+3); + } + } + XAllocNamedColor(this->app->display,this->app->cm,str.c_str(),&sc,&tc); this->windowColourNames[p].pixel=tc.pixel; + this->windowColourNames[p].RGBAColour.a=alphaint/256.0; this->windowColourNames[p].RGBAColour.r=((this->windowColourNames[p].pixel>>16) & 0xff)/256.0; this->windowColourNames[p].RGBAColour.g=((this->windowColourNames[p].pixel>>8) & 0xff)/256.0; this->windowColourNames[p].RGBAColour.b=((this->windowColourNames[p].pixel>>0) & 0xff)/256.0; - this->windowColourNames[p].RGBAColour.a=1.0; + + if(p==NORMALCOLOUR) + { + + this->windowNormalAlpha=this->windowColourNames[NORMALCOLOUR].RGBAColour.a; + fprintf(stderr,"windowNormalAlpha=%f\n",this->windowNormalAlpha); + } } /** @@ -753,16 +832,29 @@ LFSTK_windowClass::LFSTK_windowClass(windowInitStruct *wi,LFSTK_applicationClass wa.override_redirect=wi->overRide; wm_delete_window=XInternAtom(this->app->display,"WM_DELETE_WINDOW",0); + XVisualInfo vinfo; + XMatchVisualInfo(this->app->display, DefaultScreen(this->app->display), 32, TrueColor, &vinfo); + + this->visual=vinfo.visual; + this->cmap=XCreateColormap(this->app->display, DefaultRootWindow(this->app->display), this->visual, AllocNone); + if(wi->app->gotARGB==true) { - wa.colormap=this->app->cm; + //fprintf(stderr,"got argb\n"); + //wa.colormap=this->app->cm; + wa.colormap=this->cmap; wa.border_pixel=0; wa.background_pixel=0; - this->window=XCreateWindow(this->app->display,this->app->rootWindow,wi->x,wi->y,wi->w,wi->h,0,this->app->depth,InputOutput,this->app->visual,CWColormap | CWBorderPixel |CWWinGravity|CWOverrideRedirect,&wa); + //this->window=XCreateWindow(this->app->display,this->app->rootWindow,wi->x,wi->y,wi->w,wi->h,0,this->app->depth,InputOutput,this->app->visual,CWColormap | CWBorderPixel |CWWinGravity|CWOverrideRedirect,&wa); + this->window=XCreateWindow(this->app->display,this->app->rootWindow,wi->x,wi->y,wi->w,wi->h,0,vinfo.depth,InputOutput,this->visual,(CWColormap | CWBorderPixel| CWBackPixel |CWWinGravity|CWOverrideRedirect),&wa); + //this->setWindowGeom(0,0,wi->w,wi->h,WINDSETALL); + } else { + //fprintf(stderr,"no got argb\n"); + //exit(0); this->window=XCreateWindow(this->app->display,this->app->rootWindow,wi->x,wi->y,wi->w,wi->h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWOverrideRedirect,&wa); } XSelectInput(this->app->display,this->window,SubstructureRedirectMask|StructureNotifyMask|ButtonPressMask | ButtonReleaseMask|ButtonMotionMask | ExposureMask | EnterWindowMask|LeaveWindowMask|FocusChangeMask|SelectionClear|SelectionRequest|KeyReleaseMask|KeyPressMask); @@ -1405,7 +1497,20 @@ void LFSTK_windowClass::sendUTF8(XSelectionRequestEvent *sev) static bool flag=false; static geometryStruct oldwindowGeom{0,0,0,0}; int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event) -{ +{ + //this->LFSTK_clearWindow(false); + +//if(this->customwindow==true) +//{ +// cairo_save(this->cr); +// cairo_reset_clip (this->cr); +// cairo_set_source_rgba(this->cr,0,0.1,.4,0.2); +// cairo_paint(this->cr); +// cairo_restore(this->cr); +// return(1); +// +//} + int retval=0; switch(event->type) { @@ -1476,8 +1581,7 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event) flag=true; } this->LFSTK_resizeWindow(event->xconfigurerequest.width,event->xconfigurerequest.height,false); - this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->app->visual,&this->sfc,&this->cr,event->xconfigurerequest.width,event->xconfigurerequest.height); - this->LFSTK_clearWindow(false); + this->LFSTK_clearWindow(); if((this->windowGeom.w!=oldwindowGeom.w) ||(this->windowGeom.h!=oldwindowGeom.h)) { diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h index a141564..0f3142c 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h @@ -44,6 +44,25 @@ enum {XDNDENTER=0,XDNDPOSITION,XDNDSTATUS,XDNDTYPELIST,XDNDACTIONCOPY,XDNDDROP,X enum setWindowGeomFlags {WINDSETXY,WINDSETWH,WINDSETALL}; +//motif hints +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) + +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) + +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) + /** * \brief Window class for LFSToolKit. * \note The main window class MUST be passed to child widgets. @@ -72,6 +91,7 @@ class LFSTK_windowClass void LFSTK_setFontColourName(int p,const char *colour); void LFSTK_setWindowColourName(int p,const char* colour); void LFSTK_setDecorated(bool isDecorated); + void LFSTK_setDecorations(bool canmax=true,bool canmin=true,bool canresize=true,bool canclose=true); void LFSTK_setKeepAbove(bool set); void LFSTK_setKeepBelow(bool set); void LFSTK_setActive(bool set); @@ -116,6 +136,8 @@ class LFSTK_windowClass cairo_surface_t *sfc=NULL; cairo_t *cr=NULL; cairo_pattern_t *pattern=NULL; + Visual *visual; + Colormap cmap; char *fontString; char *fontColourNames[MAXCOLOURS]={NULL,}; @@ -126,6 +148,7 @@ class LFSTK_windowClass int y; int w; int h; + double windowNormalAlpha=-1; //user data and dirs Window parentWindow=None; diff --git a/LFSToolKit/configure.ac b/LFSToolKit/configure.ac index 1b422a6..512911c 100644 --- a/LFSToolKit/configure.ac +++ b/LFSToolKit/configure.ac @@ -1,12 +1,12 @@ m4_define([LFSTOOLKIT_MAJ_N],[0]) m4_define([LFSTOOLKIT_MIN_N],[5]) -m4_define([LFSTOOLKIT_REV_N],[1]) +m4_define([LFSTOOLKIT_REV_N],[2]) m4_define([lfstk_api_version], [2.0]) m4_define([lfstk_version],[LFSTOOLKIT_MAJ_N.LFSTOOLKIT_MIN_N.LFSTOOLKIT_REV_N]) -AC_INIT([LFSToolKit],[0.5.1],[PROJ],[LFSToolKit]) +AC_INIT([LFSToolKit],[0.5.2],[PROJ],[LFSToolKit]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CXX diff --git a/LFSToolKit/examples/image.cpp b/LFSToolKit/examples/image.cpp index 3eda56b..c736bef 100755 --- a/LFSToolKit/examples/image.cpp +++ b/LFSToolKit/examples/image.cpp @@ -104,6 +104,7 @@ int main(int argc, char **argv) tux=new LFSTK_imageClass(wc,NULL,DIALOGMIDDLE-(IMAGESIZE/2),sy,IMAGESIZE,IMAGESIZE,BUTTONGRAV,true); tux->LFSTK_setImageFromPath("./AspellGUI.png",PRESERVEASPECT,true); //tux->LFSTK_setMouseCallBack(NULL,buttonCB,NULL); + //tux->LFSTK_setAlpha(1); tux->LFSTK_setCanDrag(true); //tux->LFSTK_snapSize(24); tux->LFSTK_setTile(NULL,0); diff --git a/LFSToolKit/examples/imagebutton.cpp b/LFSToolKit/examples/imagebutton.cpp index 9f4b342..ee64502 100755 --- a/LFSToolKit/examples/imagebutton.cpp +++ b/LFSToolKit/examples/imagebutton.cpp @@ -19,17 +19,18 @@ exit $retval #define BOXLABEL "Image Buttons" -LFSTK_applicationClass *apc=NULL; -LFSTK_windowClass *wc=NULL; +LFSTK_applicationClass *apc=NULL; +LFSTK_windowClass *wc=NULL; LFSTK_labelClass *label=NULL; LFSTK_labelClass *personal=NULL; LFSTK_labelClass *copyrite=NULL; -LFSTK_buttonClass *imagebuttonL=NULL; -LFSTK_buttonClass *imagebuttonC=NULL; -LFSTK_buttonClass *imagebuttonR=NULL; -LFSTK_buttonClass *imagebuttonT=NULL; -LFSTK_buttonClass *seperator=NULL; -LFSTK_buttonClass *quit=NULL; +LFSTK_buttonClass *imagebuttonL=NULL; +LFSTK_buttonClass *imagebuttonC=NULL; +LFSTK_buttonClass *imagebuttonR=NULL; +LFSTK_buttonClass *imagebuttonT=NULL; +LFSTK_buttonClass *imagebuttonNA=NULL; +LFSTK_buttonClass *seperator=NULL; +LFSTK_buttonClass *quit=NULL; bool doQuit(void *p,void* ud) { @@ -99,6 +100,14 @@ int main(int argc, char **argv) imagebuttonR->LFSTK_setImageFromPath("./casper2.JPG",MENU,true); sy+=YSPACING; +//image button no alpha + imagebuttonNA=new LFSTK_buttonClass(wc,"Image No Alpha",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,GADGETHITE*2,BUTTONGRAV); + imagebuttonNA->LFSTK_setMouseCallBack(NULL,buttonCB,USERDATA(0xdeadbeef5)); + imagebuttonNA->LFSTK_setImageFromPath("./casper2.JPG",LEFT,true); + imagebuttonNA->LFSTK_setLabelGravity(CENTRE); + imagebuttonNA->LFSTK_setAlpha(255); + sy+=YSPACING*2; + //line seperator=new LFSTK_buttonClass(wc,"--",0,sy,DIALOGWIDTH,GADGETHITE,BUTTONGRAV); seperator->LFSTK_setStyle(BEVELNONE); diff --git a/LFSToolKit/examples/lineedit.cpp b/LFSToolKit/examples/lineedit.cpp index 2db0a98..9165e90 100755 --- a/LFSToolKit/examples/lineedit.cpp +++ b/LFSToolKit/examples/lineedit.cpp @@ -101,6 +101,8 @@ int main(int argc, char **argv) hrs.back().gadget->LFSTK_setMouseCallBack(NULL,doMouseUp,NULL); hrs.back().gadget->LFSTK_setKeyCallBack(NULL,doKeyUp,USERDATA(12345)); hrs.back().gadget->LFSTK_setGadgetDropCallBack(doDropped); + //hrs.back().gadget->LFSTK_setAlpha(0.9); + //hrs.back().gadget->LFSTK_setColourName(NORMALCOLOUR,"#e0ffffff"); //printf(">>>>hrs.back().gadget=%p\n",hrs.back().gadget); static_cast(hrs.back().gadget)->LFSTK_setCallbackOnReturn(false); diff --git a/LFSToolKit/examples/subwindowtest.cpp b/LFSToolKit/examples/subwindowtest.cpp index 1a37476..e91e389 100755 --- a/LFSToolKit/examples/subwindowtest.cpp +++ b/LFSToolKit/examples/subwindowtest.cpp @@ -19,14 +19,16 @@ exit $retval #define BOXLABEL "Sub Window Test" -LFSTK_applicationClass *apc=NULL; -LFSTK_windowClass *wc=NULL; +LFSTK_applicationClass *apc=NULL; +LFSTK_windowClass *wc=NULL; +LFSTK_windowClass *transwc=NULL; LFSTK_labelClass *label=NULL; LFSTK_labelClass *personal=NULL; LFSTK_labelClass *copyrite=NULL; -LFSTK_buttonClass *seperator=NULL; -LFSTK_buttonClass *quit=NULL; -LFSTK_buttonClass *test=NULL; +LFSTK_buttonClass *seperator=NULL; +LFSTK_buttonClass *quit=NULL; +LFSTK_buttonClass *test=NULL; +LFSTK_buttonClass *transtest=NULL; bool doQuit(void *p,void* ud) { @@ -45,15 +47,34 @@ bool doSubQuit(void *p,void* ud) bool buttonCB(void *p,void* ud) { LFSTK_buttonClass *button=NULL; - long subwin=(long)ud; + long subwin=(long)ud; apc->LFSTK_runWindowLoop(subwin); return(true); } +bool transButtonCB(void *p,void* ud) +{ + LFSTK_buttonClass *button=NULL; + long subwin=(long)ud; + + fprintf(stderr,"windowNormalAlpha=%f\n",apc->windows->at(subwin).window->windowNormalAlpha); + + apc->LFSTK_runWindowLoop(subwin); + return(true); +} + +bool doTransSubQuit(void *p,void* ud) +{ + long subwin=(long)ud; + apc->windows->at(subwin).loopFlag=false; + return(false); +} + int cnt=1; bool timerCB(LFSTK_applicationClass *p,void* ud) { +return(true); printf("From window %s\n",ud); printf("Timer callback number %i of 10\n",cnt); cnt++; @@ -72,12 +93,26 @@ int main(int argc, char **argv) apc->LFSTK_addWindow(NULL,BOXLABEL); wc=apc->mainWindow; wc->userData=USERDATA("Main Window"); + //wc->LFSTK_setWindowColourName(NORMALCOLOUR,"#20ff0000"); + apc->LFSTK_addWindow(NULL,"SUB WINDOW"); apc->windows->back().window->LFSTK_resizeWindow(400,400,true); apc->windows->back().window->userData=USERDATA("Sub Window"); button=new LFSTK_buttonClass(apc->windows->back().window,"Close",200-HALFGADGETWIDTH,200,GADGETWIDTH,GADGETHITE,BUTTONGRAV); button->LFSTK_setMouseCallBack(NULL,doSubQuit,(void*)apc->windows->size()-1); + apc->LFSTK_addWindow(NULL,"TRANSPARENT SUB WINDOW"); + apc->windows->back().window->LFSTK_resizeWindow(400,400,true); + apc->windows->back().window->userData=USERDATA("Trans Sub Window"); + apc->windows->back().window->LFSTK_setTile(NULL,0); + apc->windows->back().window->LFSTK_setWindowColourName(NORMALCOLOUR,"#40ff0000"); + //apc->windows->back().window->customwindow=true; + + button=new LFSTK_buttonClass(apc->windows->back().window,"Close",200-HALFGADGETWIDTH,200,GADGETWIDTH,GADGETHITE,BUTTONGRAV); + button->LFSTK_setMouseCallBack(NULL,doTransSubQuit,(void*)apc->windows->size()-1); +//button->LFSTK_setColourName(NORMALCOLOUR,"#20ffff00"); + button->LFSTK_setTile(NULL,0); + label=new LFSTK_labelClass(wc,BOXLABEL,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE); label->LFSTK_setCairoFontDataParts("sB",20); sy+=YSPACING; @@ -96,8 +131,12 @@ int main(int argc, char **argv) sy+=YSPACING; //test - test=new LFSTK_buttonClass(wc,"Sub-Window",DIALOGMIDDLE-HALFGADGETWIDTH,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); - test->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)apc->windows->size()-1); + test=new LFSTK_buttonClass(wc,"Sub-Window",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + test->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)apc->windows->size()-2); + sy+=YSPACING; + + transtest=new LFSTK_buttonClass(wc,"Transparent Sub-Window",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + transtest->LFSTK_setMouseCallBack(NULL,transButtonCB,(void*)apc->windows->size()-1); sy+=YSPACING; //quit diff --git a/LFSToolKit/examples/window.cpp b/LFSToolKit/examples/window.cpp index 3d0ec6c..b5bdf7c 100755 --- a/LFSToolKit/examples/window.cpp +++ b/LFSToolKit/examples/window.cpp @@ -56,6 +56,7 @@ int main(int argc, char **argv) sy+=200; wc->LFSTK_resizeWindow(DIALOGWIDTH,sy,true); + //wc->LFSTK_setDecorations(true,true,true,true); wc->LFSTK_showWindow(); //fprintf(stderr,"%s\n",wc->globalLib->LFSTK_getGlobalString(-1,TYPEMONOFONT)); printf("Number of gadgets in window=%i\n",wc->LFSTK_gadgetCount()); diff --git a/LFSWM2/LFSWM2/src/eventsClass.cpp b/LFSWM2/LFSWM2/src/eventsClass.cpp index effb842..ee3b57b 100644 --- a/LFSWM2/LFSWM2/src/eventsClass.cpp +++ b/LFSWM2/LFSWM2/src/eventsClass.cpp @@ -687,6 +687,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code std::vector towldesktop; std::vector towlbelow; std::vector towlnormal; + //std::vector towlunknown; std::vector towlabove; std::vector towlpanel; std::vector towlmenu; @@ -775,6 +776,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code towldesktop.clear(); towlbelow.clear(); towlnormal.clear(); + //towlunknown.clear(); towlabove.clear(); towlpanel.clear(); towlmenu.clear(); @@ -798,6 +800,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code case NORMALWINDOW: case DIALOGWINDOW: case TOOLWINDOW: + //case UNKNOWNTYPE: if(this->mainClass->mainWindowClass->LFSWM2_hasState(fromwl.at(j),this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_STATE_BELOW")))) { cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); @@ -817,11 +820,26 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code break; } cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(fromwl.at(j)); - if(cc!=NULL) - towlnormal.push_back(cc->frameWindow); - else - towlnormal.push_back(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)); @@ -860,7 +878,9 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code } this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_CLIENT_LIST")),XA_WINDOW,32,netclientwl.data(),netclientwl.size()); - +//this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(this->mainClass->prefs.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)); @@ -876,6 +896,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code } } this->mainClass->mainWindowClass->LFSWM2_setProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_CLIENT_LIST_STACKING")),XA_WINDOW,32,netclientstackwl.data(),netclientstackwl.size()); + //XRestackWindows(this->mainClass->display,towl.data(),towl.size()); } diff --git a/LFSWM2/LFSWM2/src/windowsClass.cpp b/LFSWM2/LFSWM2/src/windowsClass.cpp index 15f5cc9..163d1a1 100644 --- a/LFSWM2/LFSWM2/src/windowsClass.cpp +++ b/LFSWM2/LFSWM2/src/windowsClass.cpp @@ -153,6 +153,7 @@ bool LFSWM2_windowClass::LFSWM2_createUnframedWindow(Window wid) case DIALOGWINDOW: case TOOLWINDOW: case DESKTOPWINDOW: + case UNKNOWNTYPE: { this->LFSWM2_setClientList(wid,true); return(true); @@ -209,17 +210,75 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs) return(false); } +// if(this->LFSWM2_getWindowType(id)==UNKNOWNTYPE) +// fprintf(stderr,"id=0x%x\n",id); +// { +// Atom xa; +// Atom xa_prop[1]; +// +// xa=XInternAtom(this->mainClass->display,"_NET_WM_WINDOW_TYPE",False); +// xa_prop[0]=this->mainClass->atomshashed.at(this->mainClass->prefs.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=new LFSWM2_clientClass(this->mainClass,id); cc->isBorderless=noborder; cc->windowHints=premaphs; cc->renderFrame(true,premaphs.pt.x,premaphs.pt.y); + + + + if((this->LFSWM2_getWindowType(id)==NORMALWINDOW) ) + { + cc->canMaximize=true; + cc->canMinimize=true; + cc->canResize=true; + cc->canClose=true; + } + +//fprintf(stderr,"premaphs.mHints=%p\n",premaphs.mHints); if(premaphs.mHints!=NULL) { + //cc->isBorderless=false; + cc->canMaximize=false; + cc->canMinimize=false; + cc->canClose=false; + + fprintf(stderr,">>>>premaphs.mHints->functions & MWM_FUNC_CLOSE=%x MWM_FUNC_CLOSE=%x\n",premaphs.mHints->functions,MWM_FUNC_CLOSE); + cc->canClose=(premaphs.mHints->functions & MWM_FUNC_CLOSE); //cc->canClose=(premaphs.mHints->decorations & MWM_FUNC_CLOSE); cc->canMaximize=(premaphs.mHints->decorations & MWM_DECOR_MAXIMIZE); cc->canMinimize=(premaphs.mHints->decorations & MWM_DECOR_MINIMIZE); cc->canResize=(premaphs.mHints->decorations & MWM_DECOR_RESIZEH); } + allowed=(Atom*)this->LFSWM2_getProp(id,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_ALLOWED_ACTIONS")),XA_ATOM,&nitems_return); if(allowed!=NULL) { @@ -232,32 +291,45 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs) } XFree(allowed); } - cc->canClose=true;//TODO// + //cc->canClose=true;//TODO// - if((this->LFSWM2_getWindowType(id)==NORMALWINDOW)) - { - cc->canMaximize=true; - cc->canMinimize=true; - cc->canResize=true; - } +// if((this->LFSWM2_getWindowType(id)==NORMALWINDOW)) +// { +// cc->canMaximize=true; +// cc->canMinimize=true; +// cc->canResize=true; +// } if(this->LFSWM2_getWindowType(id)==UNKNOWNTYPE) { - cc->canMaximize=false; - cc->canMinimize=false; - cc->canResize=false; - if(cc->windowHints.sh->flags==0) - { +// Atom xa; +// Atom xa_prop[1]; + +// xa=XInternAtom(this->mainClass->display,"_NET_WM_WINDOW_TYPE",False); +// xa_prop[0]=this->mainClass->atomshashed.at(this->mainClass->prefs.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; - } - 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->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; +// } } if(cc->isBorderless==true) @@ -265,6 +337,7 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs) cc->canMaximize=false; cc->canMinimize=false; cc->canResize=false; + cc->canClose=false; } wa.win_gravity=NorthWestGravity; @@ -338,6 +411,11 @@ bool LFSWM2_windowClass::LFSWM2_createClient(Window id,hintsDataStruct premaphs) v[vcnt++]=this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_ACTION_RESIZE")); } + if(cc->canClose==true) + { + v[vcnt++]=this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_ACTION_CLOSE")); + } + cc->onDesk=thisdesk; this->LFSWM2_setProp(id,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_ALLOWED_ACTIONS")),XA_ATOM,32,v,vcnt); diff --git a/makeall b/makeall index 2e6bcd7..d47faf8 100755 --- a/makeall +++ b/makeall @@ -54,6 +54,21 @@ runCommand () $1||true } +help () +{ + echo "Usage:" + echo " makeall OPTION" + echo + echo "OPTIONS:" + echo -e "${RED}distcleanup${NORMAL}\n\trun 'make distclean' on all project folders" + echo -e "${RED}cleanup\n\t${NORMAL}run 'make clean' on all project folders" + echo -e "${RED}uninstall\n\t${NORMAL}run 'make distclean;./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make uninstall' on all project folders" + echo -e "${RED}deploy\n\t${NORMAL}run 'make distclean;./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make $MAKEFLAGS;make install' on all project folders" + echo -e "${RED}deploytest\n\t${NORMAL}run 'make distclean;./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make $MAKEFLAGS;make install DESTDIR=/tmp/lfsdesktop-deploy' on all project folders" + echo -e "${RED}makeit\n\t${NORMAL}run './autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make $MAKEFLAGS' on all project folders" + echo -e "${RED}ownit\n\t${NORMAL}run 'chown -vR $CHANGEUSER:$CHANGEUSER .;find -mindepth 1 -exec touch {} ;' on all project folders" +} + distcleanup () { runCommand "make distclean" @@ -100,6 +115,11 @@ ownit () runCommand "find -mindepth 1 -exec touch {} ;" } +if [[ $action = "help" ]];then + help + exit +fi + for app in "LFSToolKit" $BUILDLFSWMANAGER "LFSWM2" "LFSDesktop" "LFSSetWallpaper" "LFSApplications" "LFSPanel" do pushd $app