-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Damage.Destroy not work? #108
Comments
I think you need to DamageSubtract your region to stop updates but not 100% sure |
en, I have already add substract on event callback. |
can you post your code? |
the main process is get window info when start it, just like a window manager. function recover(cwconn){
var X = cwconn.display.client;
X.require('damage', function(err, Damage){
for(var i in cwconn.damages){
console.log('deleting damages');
Damage.Destroy(cwconn.damages[i]);
}
cwconn.damages = [];
X.QueryTree(cwconn.display.screen[0].root, function(err, tree) {
tree.children.forEach(function(subwin) {
var damage = X.AllocID();
Damage.Create(damage, subwin, Damage.ReportLevel.DeltaRectangles);
cwconn.damages.push(damage);
X.GetGeometry(subwin, function(err, geom) {
...
});
});
});
});
} bellow is event handle: X.require('composite', function(err, Composite){
Composite.RedirectSubwindows(root, Composite.Redirect.Automatic);
X.require('damage', function(err, Damage){
var windows = cwconn.windows;
X.on('event', function(ev){
console.log(ev);
if(ev.type == 19){ // MapNotify
var damage = X.AllocID();
Damage.Create(damage, ev.wid, Damage.ReportLevel.DeltaRectangles);
cwconn.damages.push(damage);
}
if(ev.name == 'DamageNotify'){
Damage.Subtract(ev.damage, 0, 0);
}
....other events
});
// after init event listeners, recover rendered windows, and register damage
recover(cwconn);
})
})
}).on('error', function(err) {
//console.log(err);
}); |
I use Damage.Create when receiving mapnotify, and use Damage.Destroy(damageId) later, but after that, I can still receive DamageNotify on that damage, or I shoud use other ways to destroy a damage?
And, I found that if I restart program, the damage seems not exists.
So, how to destroy a damage in program to prevent receive DamageNotify?
The text was updated successfully, but these errors were encountered: