diff options
author | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-06-26 15:23:14 +0800 |
---|---|---|
committer | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-06-26 15:23:14 +0800 |
commit | 54e6600fd3e9d25ede6553aeffbe9d572f924592 (patch) | |
tree | 2b5582ae9e2861e1ed5a666517a65ba21ad91db4 | |
parent | 34d63f5ef406a40bac431e4a2805edf196433efb (diff) |
plugin: make use of new XCompositeRedirectWindowInput function
-rw-r--r-- | plugin/ir.xml.in | 6 | ||||
-rw-r--r-- | plugin/src/ir.cpp | 36 | ||||
-rw-r--r-- | plugin/src/ir.h | 14 |
3 files changed, 47 insertions, 9 deletions
diff --git a/plugin/ir.xml.in b/plugin/ir.xml.in index 54e0f8f..888f3a7 100644 --- a/plugin/ir.xml.in +++ b/plugin/ir.xml.in @@ -13,7 +13,11 @@ <options> <group> <_short>Bindings</_short> - <option name="trigger" type="key"> + <option name="transform" type="key"> + <_short>Transform window</_short> + <_long>Transforms a window</_long> + </option> + <option name="redirect" type="key"> <_short>Redirect window</_short> <_long>Redirects a window</_long> </option> diff --git a/plugin/src/ir.cpp b/plugin/src/ir.cpp index 61ae5a2..88c92e6 100644 --- a/plugin/src/ir.cpp +++ b/plugin/src/ir.cpp @@ -111,9 +111,33 @@ IrWindow::updateMesh () } bool -IrScreen::trigger (CompAction *action, - CompAction::State state, - CompOption::Vector &options) +IrScreen::redirect (CompAction *action, + CompAction::State state, + CompOption::Vector &options) +{ + IR_SCREEN (screen); + + Window xid = CompOption::getIntOptionNamed (options, "window"); + CompWindow *w = screen->findTopLevelWindow (xid); + if(!w) return false; + + if(!is->rw) + { + is->rw = w; + } + else + { + XCompositeRedirectWindowInput (screen->dpy(), ROOTPARENT(is->rw), ROOTPARENT(w)); + is->rw = NULL; + } + + return true; +} + +bool +IrScreen::transform (CompAction *action, + CompAction::State state, + CompOption::Vector &options) { IR_SCREEN (screen); @@ -132,7 +156,7 @@ is->cScreen->damageScreen(); is->n += iw->enabled ? 1 : -1; iw->updateMesh (); - + return true; } void @@ -237,7 +261,9 @@ IrScreen::IrScreen (CompScreen *screen) : CompositeScreenInterface::setHandler (cScreen); GLScreenInterface::setHandler (gScreen); - optionSetTriggerInitiate (trigger); + optionSetTransformInitiate (transform); + optionSetRedirectInitiate (redirect); + rw = NULL; n=0; } diff --git a/plugin/src/ir.h b/plugin/src/ir.h index 16674da..5d7d615 100644 --- a/plugin/src/ir.h +++ b/plugin/src/ir.h @@ -55,11 +55,19 @@ class IrScreen : CompOutput *, unsigned int); static bool - trigger (CompAction *action, - CompAction::State state, - CompOption::Vector &options); + transform (CompAction *action, + CompAction::State state, + CompOption::Vector &options); + + static bool + redirect (CompAction *action, + CompAction::State state, + CompOption::Vector &options); int n; + + private: + CompWindow *rw; }; class IrWindow : |