Skip to content

Commit b26fe54

Browse files
committed
major changes to lfstray, changes to lfstoolkit, see changelogs
1 parent d25db9c commit b26fe54

34 files changed

+240
-6037
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@ devtests
7272

7373
LFSTray/lfstray.sample
7474
LFSTray/LFSTray/app/lfstray
75-
*config.h.in
75+
*config.h.in
76+
77+
*/*/src.*

LFSToolKit/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
0.6.1
2+
Added LFSTK_moveResizeWindow to lib.
23
Fix window tile cario surface getting occasional wrong size.
34
Added extra positioning for window context window.
45
Updated Window example.

LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,29 @@ void LFSTK_applicationClass::LFSTK_setTimerCallBack(bool (*timer)(LFSTK_applicat
263263
this->callBacks.ignoreOrphanModKeys=true;
264264
}
265265

266+
/**
267+
* Set event callback for main loop,
268+
* \param bool functionname (LFSTK_applicationClass *p,void* ud)
269+
* \param void* ud User data passed to function.
270+
*/
271+
void LFSTK_applicationClass::LFSTK_setEventCallBack(bool (*evcb)(LFSTK_applicationClass*,XEvent*),void* ud)
272+
{
273+
// this->callBacks.validCallbacks|=EVENTCB;
274+
this->eventCallback=evcb;
275+
//this->callBacks.keyUserData=ud;
276+
//this->callBacks.runTheCallback=true;
277+
//this->callBacks.ignoreOrphanModKeys=true;
278+
}
279+
266280
/**
267281
* Run main loop,
268282
* \note default to this->mainWindow.
269283
*/
270284
int LFSTK_applicationClass::LFSTK_runApp(void)
271285
{
272286
XEvent event;
287+
bool retval=false;
288+
273289
this->mainLoop=true;
274290
fd_set readfd;
275291
struct timeval tv={0,0};
@@ -301,6 +317,14 @@ int LFSTK_applicationClass::LFSTK_runApp(void)
301317
while(XPending(this->display))
302318
{
303319
XNextEvent(this->display,&event);
320+
321+
if(this->eventCallback!=NULL)
322+
{
323+
retval=this->eventCallback(this,&event);
324+
if(retval==true)
325+
continue;
326+
}
327+
304328
mappedListener *ml=this->mainWindow->LFSTK_getMappedListener(event.xany.window);
305329

306330
if(ml!=NULL)
@@ -322,6 +346,7 @@ int LFSTK_applicationClass::LFSTK_runApp(void)
322346
}
323347
}
324348
}
349+
usleep(1000);
325350
}
326351
else
327352
{

LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ class LFSTK_applicationClass
6464
void LFSTK_setTimer(int delay,bool usemicroseconds=false);
6565
void LFSTK_setTimerCallBack(bool (*timer)(LFSTK_applicationClass*,void*),void* ud);
6666

67+
//events
68+
void LFSTK_setEventCallBack(bool (*evcb)(LFSTK_applicationClass*,XEvent*),void* ud);
69+
bool (*eventCallback)(LFSTK_applicationClass*,XEvent *ev)=NULL;
70+
6771
//gui
6872
bool mainLoop=false;
6973
int exitValue=0;
@@ -92,6 +96,7 @@ class LFSTK_applicationClass
9296
std::string iconThemeName="";
9397
std::map<unsigned long,Atom> appAtomsHashed;
9498

99+
95100
private:
96101
int displayNum;
97102
bool useTimer=false;

LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ class LFSTK_applicationClass;
257257
#define TIMERCB 0x80
258258
#define MOUSEENTERCB 0x100
259259
#define MOUSEEXITCB 0x200
260-
#define ALLCB 0x2ff
260+
#define ALLCB 0x3ff
261+
#define EVENTCB 0x400
261262

262263
struct propertyStruct
263264
{
@@ -296,6 +297,7 @@ struct callbackStruct
296297
bool runTheCallback=true;
297298
bool ignoreOrphanModKeys=true;
298299
int validCallbacks=NOCB;
300+
// bool (*evCallback)(LFSTK_applicationClass*,void*)=NULL;
299301

300302
};
301303

LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,25 @@ void LFSTK_windowClass::LFSTK_moveWindow(int x,int y,bool tellx)
404404
this->LFSTK_clearWindow();
405405
}
406406

407+
/**
408+
* Move and resize window.
409+
* \param x New X.
410+
* \param y New Y.
411+
* \param w New W.
412+
* \param h New H.
413+
* \param tellx Inform X (default=true).
414+
*/
415+
void LFSTK_windowClass::LFSTK_moveResizeWindow(int x,int y,int w,int h,bool tellx)
416+
{
417+
this->setWindowGeom(x,y,w,h,WINDSETALL);
418+
if(tellx==true)
419+
XMoveResizeWindow(this->app->display,this->window,x,y,w,h);
420+
421+
this->globalLib->LFSTK_setCairoSurface(this->app->display,this->window,this->visual,&this->sfc,&this->cr,w,h);
422+
this->w=w;
423+
this->h=h;
424+
this->LFSTK_clearWindow();
425+
}
407426
/**
408427
* Set default font string.
409428
* \param s Font string.
@@ -738,7 +757,7 @@ void LFSTK_windowClass::windowClassInitCommon(windowInitStruct *wi)
738757
this->window=XCreateWindow(this->app->display,this->app->rootWindow,wi->x,wi->y,wi->w,wi->h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWOverrideRedirect,&wa);
739758
}
740759

741-
XSelectInput(this->app->display,this->window,SubstructureRedirectMask|StructureNotifyMask|ButtonPressMask | ButtonReleaseMask | ExposureMask|LeaveWindowMask|FocusChangeMask|SelectionClear|SelectionRequest);
760+
XSelectInput(this->app->display,this->window,SubstructureRedirectMask|StructureNotifyMask|ButtonPressMask | ButtonReleaseMask | ExposureMask|LeaveWindowMask|FocusChangeMask|SelectionClear|SelectionRequest | PropertyChangeMask);
742761

743762
XSetWMProtocols(this->app->display,this->window,&wm_delete_window,1);
744763
xa=XInternAtom(this->app->display,"_NET_WM_ALLOWED_ACTIONS",False);
@@ -829,7 +848,7 @@ LFSTK_windowClass::LFSTK_windowClass(windowInitStruct *wi,LFSTK_applicationClass
829848
{
830849
this->window=XCreateWindow(this->app->display,this->app->rootWindow,wi->x,wi->y,wi->w,wi->h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWOverrideRedirect,&wa);
831850
}
832-
XSelectInput(this->app->display,this->window,SubstructureRedirectMask|StructureNotifyMask|ButtonPressMask | ButtonReleaseMask|ButtonMotionMask | ExposureMask | EnterWindowMask|LeaveWindowMask|FocusChangeMask|SelectionClear|SelectionRequest|KeyReleaseMask|KeyPressMask);
851+
XSelectInput(this->app->display,this->window,SubstructureRedirectMask|StructureNotifyMask|ButtonPressMask | ButtonReleaseMask|ButtonMotionMask | ExposureMask | EnterWindowMask|LeaveWindowMask|FocusChangeMask|SelectionClear|SelectionRequest|KeyReleaseMask|KeyPressMask|PropertyChangeMask);
833852

834853
XSetWMProtocols(this->app->display,this->window,&wm_delete_window,1);
835854
xa=XInternAtom(this->app->display,"_NET_WM_ALLOWED_ACTIONS",False);
@@ -1677,6 +1696,7 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
16771696
break;
16781697

16791698
case ClientMessage:
1699+
fprintf(stderr,"ClientMessage SelectionNotify ev=%p\n",event);
16801700
case SelectionNotify:
16811701
{
16821702
if(event->xclient.message_type == XInternAtom(this->app->display, "WM_PROTOCOLS", 1) && (Atom)event->xclient.data.l[0] == XInternAtom(this->app->display, "WM_DELETE_WINDOW", 1))
@@ -1704,6 +1724,9 @@ int LFSTK_windowClass::LFSTK_handleWindowEvents(XEvent *event)
17041724
}
17051725
}
17061726
break;
1727+
case PropertyNotify:
1728+
//fprintf(stderr,"PropertyNotify ev=%p\n",event);
1729+
break;
17071730
}
17081731
this->ignoreContext=false;
17091732
return(retval);

LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class LFSTK_windowClass
8484
void LFSTK_clearWindow(bool cleargadgets=false);
8585
void LFSTK_resizeWindow(int w,int h,bool tellx=true);
8686
void LFSTK_moveWindow(int x,int y,bool tellx=true);
87+
void LFSTK_moveResizeWindow(int x,int y,int w,int h,bool tellx=true);
8788
const geometryStruct *LFSTK_getWindowGeom(void);
8889
void setWindowGeom(int x,int y,int h,int w,setWindowGeomFlags flags);
8990

LFSTray/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
1.0.4
2+
Reduced flickering when adding/removing icons.
3+
4+
1.0.1
5+
Added aboveall/belowall.
6+
Auto set layout to vertical/horizontal for N,S,W,E.
7+
Added reposition window to N,S,E,W.
8+
Added choose montior to display on.
9+
Added vertical layout.
10+
Added reposition window to NW,NE,SW,SE.
11+
Reduced flikering when adding icon.
12+
Set BG to root pixmap.
13+
Integrate with liblfstoolkit.
14+
Complete rewrite from scratch to c++.
15+
Dumped all Stalonetray code ( temp step back ).
16+
117
1.0.0
218
Added to LFSDesktopProject
319

LFSTray/LFSTray/flagsandlibs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ AM_CPPFLAGS = -I$(top_srcdir) \
44
$(XFT_CFLAGS) \
55
$(CAIRO_CFLAGS) \
66
$(LIBGLIB_CFLAGS)
7+
$(IMLIB_CFLAGS) \
78
$(LFSTK_CFLAGS)
89
-DPREFIX=\""${prefix}\"" \
910
-DDATADIR=\""${pkgdatadir}"\" \
@@ -15,5 +16,6 @@ LIBS = $(X11_LIBS) \
1516
$(XFT_LIBS) \
1617
$(LIBGLIB_LIBS) \
1718
$(LFSTK_LIBS) \
19+
$(IMLIB_LIBS) \
1820
-lm \
1921
-lstdc++fs

LFSTray/LFSTray/sources

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
COMMONSRC = ../src/embed.cpp ../src/globals.cpp ../src/icons.cpp ../src/image.cpp ../src/layout.cpp ../src/main.cpp ../src/settings.cpp ../src/tray.cpp ../src/wmh.cpp ../src/xembed.cpp ../src/xutils.cpp
1+
COMMONSRC = ../src/callbacks.cpp ../src/embedClass.cpp ../src/globals.cpp ../src/main.cpp ../src/trayClass.cpp

0 commit comments

Comments
 (0)