Introduce an XServerGrabber helper class
Performs grabXServer in ctor and ungrabXServer in dtor. Useful to ensure that each grab is matched by an ungrab.
This commit is contained in:
parent
41f6a2c7d2
commit
e96ff7a31a
1 changed files with 16 additions and 0 deletions
16
utils.h
16
utils.h
|
@ -286,6 +286,22 @@ bool grabbedXServer();
|
||||||
bool grabXKeyboard(Window w = rootWindow());
|
bool grabXKeyboard(Window w = rootWindow());
|
||||||
void ungrabXKeyboard();
|
void ungrabXKeyboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Small helper class which performs @link grabXServer in the ctor and
|
||||||
|
* @link ungrabXServer in the dtor. Use this class to ensure that grab and
|
||||||
|
* ungrab are matched.
|
||||||
|
**/
|
||||||
|
class XServerGrabber
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XServerGrabber() {
|
||||||
|
grabXServer();
|
||||||
|
}
|
||||||
|
~XServerGrabber() {
|
||||||
|
ungrabXServer();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// the docs say it's UrgencyHint, but it's often #defined as XUrgencyHint
|
// the docs say it's UrgencyHint, but it's often #defined as XUrgencyHint
|
||||||
#ifndef UrgencyHint
|
#ifndef UrgencyHint
|
||||||
#define UrgencyHint XUrgencyHint
|
#define UrgencyHint XUrgencyHint
|
||||||
|
|
Loading…
Reference in a new issue