fixes ...

This commit is contained in:
K D Hedger
2023-10-18 14:29:38 +01:00
parent 5e20060820
commit 9d12f43dc1
4 changed files with 59 additions and 21 deletions

View File

@ -1,4 +1,5 @@
0.2.0
Fixed occasional segfault in window menu.
Fixed menu items from bad window names.
Fixed segfault on window list.
Fixed blank window names on window list.

View File

@ -206,6 +206,7 @@ Window doTreeWalk(Window wind,bool thisdesktop)
thewin=children[j];
winid=children[j];
st=XFetchName(mainwind->app->display,children[j],&wname);
break;
}
thewin=None;
@ -222,32 +223,35 @@ Window doTreeWalk(Window wind,bool thisdesktop)
break;
}
if(winid!=-1)
if(wname!=NULL)
{
ptr=NULL;
count=32;
n=0;
if(strlen(wname)==0)
if(winid!=-1)
{
st=XGetWindowProperty( mainwind->app->display,winid,NET_WM_NAME,0,count,false,UTF8_STRING,&rtype,&rfmt,&n,&rafter,(unsigned char **)&ptr);
if(st==Success && n != 0 && ptr != NULL)
wname=strdup((char*)ptr);
ptr=NULL;
count=32;
n=0;
if(strlen(wname)==0)
{
st=XGetWindowProperty( mainwind->app->display,winid,NET_WM_NAME,0,count,false,UTF8_STRING,&rtype,&rfmt,&n,&rafter,(unsigned char **)&ptr);
if(st==Success && n != 0 && ptr != NULL)
wname=strdup((char*)ptr);
}
for(int j=0;j<strlen(wname);j++)
if(!isalnum(wname[j]))
wname[j]=' ';
XGetWindowProperty(mainwind->app->display,winid,NET_WM_DESKTOP,0L,count,false,XA_CARDINAL,&rtype,&rfmt,&n,&rafter,(unsigned char **)&ptr);
windowList[windowListCnt]=new menuStruct;
windowList[windowListCnt]->label=strdup(wname);
windowList[windowListCnt++]->userData=(void*)winid;
}
for(int j=0;j<strlen(wname);j++)
if(!isalnum(wname[j]))
wname[j]=' ';
XGetWindowProperty(mainwind->app->display,winid,NET_WM_DESKTOP,0L,count,false,XA_CARDINAL,&rtype,&rfmt,&n,&rafter,(unsigned char **)&ptr);
windowList[windowListCnt]=new menuStruct;
windowList[windowListCnt]->label=strdup(wname);
windowList[windowListCnt++]->userData=(void*)winid;
}
if(wname!=NULL)
XFree(wname);
XFree(ptr);
XFree(children);
return thewin;

View File

@ -672,6 +672,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code
if(this->mainClass->mainWindowClass->windowIDList.size()==0)
return;
//fprintf(stderr,"crapwin=0x%x\n",crapwin);
v=(Atom*)this->mainClass->mainWindowClass->LFSWM2_getProp(this->mainClass->rootWindow,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_ACTIVE_WINDOW")),XA_WINDOW,&nitems_return);
@ -809,6 +810,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code
}
if((this->mainClass->mainWindowClass->LFSWM2_getWindowType(wid)==MENUWINDOW))
{
XRaiseWindow(this->mainClass->display,wid);
move(framel,j,0);
}
}
@ -823,6 +825,7 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code
if(this->mainClass->mainWindowClass->LFSWM2_hasState(wid,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_STATE_BELOW"))))
{
move(framel,j,framel.size()-1);
XLowerWindow(this->mainClass->display,wid);
}
}
@ -845,6 +848,26 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code
#endif
//above
//TODO//
for(int j=0;j<framel.size();j++)
{
cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(framel.at(j));
if(cc!=NULL)
{
wid=cc->contentWindow;
}
else
{
wid=framel.at(j);
//XRaiseWindow(this->mainClass->display,wid);
}
if(this->mainClass->mainWindowClass->LFSWM2_hasState(wid,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_STATE_ABOVE"))))
{
//XRaiseWindow(this->mainClass->display,wid);
move(framel,j,0);
//move(framel,j,framel.size()-1);
}
}
for(int j=0;j<framel.size();j++)
{
cc=this->mainClass->mainWindowClass->LFSWM2_getClientClass(framel.at(j));
@ -852,10 +875,20 @@ void LFSWM2_eventsClass::LFSWM2_restack(void)//TODO// still dont like this code
wid=cc->contentWindow;
else
wid=framel.at(j);
if(this->mainClass->mainWindowClass->LFSWM2_hasState(wid,this->mainClass->atomshashed.at(this->mainClass->prefs.LFSTK_hashFromKey("_NET_WM_STATE_ABOVE"))))
move(framel,j,0);
if((this->mainClass->mainWindowClass->LFSWM2_getWindowType(wid)==MENUWINDOW))
{
XRaiseWindow(this->mainClass->display,wid);
//move(framel,j,0);
// move(framel,j,framel.size()-1);
}
}
//framel.erase(framel.begin()+framel.size()-1);
XRestackWindows(this->mainClass->display,framel.data(),framel.size());

View File

@ -46,7 +46,7 @@
#include "config.h"
#define __DEBUG__
//#define __DEBUG__
#ifdef __DEBUG__
#define MOVEKEYS (Mod4Mask|ControlMask)
#else