diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-10-29 23:25:20 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-10-29 23:25:20 +0000 |
commit | 080ab1459d045b39fab0b024e17d4f640fcd33fe (patch) | |
tree | 13600df434bffb76138bf3285fd07803a34cca3d /rMD-exp | |
parent | 458b0756afae2b19b1083d76109d74f208943a26 (diff) |
proper xdamage event handling
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@129 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'rMD-exp')
-rw-r--r-- | rMD-exp/include/recordmydesktop.h | 3 | ||||
-rw-r--r-- | rMD-exp/src/poll_damage.c | 43 |
2 files changed, 38 insertions, 8 deletions
diff --git a/rMD-exp/include/recordmydesktop.h b/rMD-exp/include/recordmydesktop.h index be10596..6031614 100644 --- a/rMD-exp/include/recordmydesktop.h +++ b/rMD-exp/include/recordmydesktop.h @@ -305,8 +305,7 @@ unsigned char Yr[256],Yg[256],Yb[256], Vr[256],Vg[256],Vb[256]; //the following values are of no effect //but they might be usefull later for profiling -unsigned int inserts,//total insertions in the lists - frames_total,//frames calculated by total time expirations +unsigned int frames_total,//frames calculated by total time expirations frames_lost;//the value of shame //used to determine frame drop which can //happen on failure to receive a signal over a condition variable diff --git a/rMD-exp/src/poll_damage.c b/rMD-exp/src/poll_damage.c index 259039f..1f53349 100644 --- a/rMD-exp/src/poll_damage.c +++ b/rMD-exp/src/poll_damage.c @@ -28,17 +28,48 @@ #include <recordmydesktop.h> void *PollDamage(void *pdata){ - - Damage damage; + Window root_return, + parent_return, + *children; + unsigned int i, + nchildren, + inserts=0; XEvent event; - inserts=0; + + XSelectInput (((ProgData *)pdata)->dpy,((ProgData *)pdata)->specs.root, SubstructureNotifyMask); + + XQueryTree (((ProgData *)pdata)->dpy, + ((ProgData *)pdata)->specs.root, + &root_return, + &parent_return, + &children, + &nchildren); + + for (i = 0; i < nchildren; i++){ + XWindowAttributes attribs; + if (XGetWindowAttributes (((ProgData *)pdata)->dpy,children[i],&attribs)){ + if (!attribs.override_redirect && attribs.depth==((ProgData *)pdata)->specs.depth) + XDamageCreate (((ProgData *)pdata)->dpy, children[i],XDamageReportRawRectangles); + } + } + + XDamageCreate( ((ProgData *)pdata)->dpy, ((ProgData *)pdata)->brwin.windowid, XDamageReportRawRectangles); - damage= XDamageCreate( ((ProgData *)pdata)->dpy, ((ProgData *)pdata)->brwin.windowid, XDamageReportRawRectangles); while(((ProgData *)pdata)->running){ //damage polling doesn't stop,eventually full image may be needed + //30/10/2006 : when and why did I write the above line? what did I mean? XNextEvent(((ProgData *)pdata)->dpy,&event); - if(event.type == ((ProgData *)pdata)->damage_event + XDamageNotify ){ + if (event.type == MapNotify ){ + XWindowAttributes attribs; + if (XGetWindowAttributes (((ProgData *)pdata)->dpy, + event.xcreatewindow.window, + &attribs)){ + if (!attribs.override_redirect && attribs.depth==((ProgData *)pdata)->specs.depth) + XDamageCreate (((ProgData *)pdata)->dpy,event.xcreatewindow.window,XDamageReportRawRectangles); + } + } + else if(event.type == ((ProgData *)pdata)->damage_event + XDamageNotify ){ XDamageNotifyEvent *e =(XDamageNotifyEvent *)( &event ); WGeometry wgeom; CLIP_EVENT_AREA(e,&(((ProgData *)pdata)->brwin),&wgeom); @@ -50,8 +81,8 @@ void *PollDamage(void *pdata){ pthread_mutex_unlock(&((ProgData *)pdata)->list_mutex[tlist_sel]); } } + } - XDamageDestroy(((ProgData *)pdata)->dpy,damage); pthread_exit(&errno); } |