summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2009-10-08 18:19:46 +0800
committerSam Spilsbury <smspillaz@gmail.com>2009-10-08 18:19:46 +0800
commite6945a6badbe3ebd62a52cf3979f9a46d73a1470 (patch)
tree599ffc8012b2d4a8461e51f14e75643caa3e3b12
parentc6386416828d21a24d5a3890e6f8efe76cdf5161 (diff)
downloadwinrules-e6945a6badbe3ebd62a52cf3979f9a46d73a1470.tar.gz
winrules-e6945a6badbe3ebd62a52cf3979f9a46d73a1470.tar.bz2
Update settings on option update and initialize window actions variable
-rw-r--r--src/winrules.cpp116
-rw-r--r--src/winrules.h7
2 files changed, 99 insertions, 24 deletions
diff --git a/src/winrules.cpp b/src/winrules.cpp
index 68f39cb..f2bcb6f 100644
--- a/src/winrules.cpp
+++ b/src/winrules.cpp
@@ -54,7 +54,22 @@ WinrulesWindow::is ()
return true;
}
-/* FIXME? Directly set inputHint, not a problem for now */
+bool
+WinrulesWindow::isFocussable ()
+{
+ window->isFocussable ();
+
+ return false; // We only want to return false else where we are not wrapped
+}
+
+bool
+WinrulesWindow::alpha ()
+{
+ window->alpha ();
+
+ return false; // We only want to return false else where we are not wrapped
+}
+
void
WinrulesWindow::setNoFocus (int optNum)
{
@@ -73,22 +88,15 @@ WinrulesWindow::setNoFocus (int optNum)
CompWindowProtocolTakeFocusMask);
newProtocol = window->protocols () & ~CompWindowProtocolTakeFocusMask;
}
- oldIsFocussable = window->isFocussable ();
-#warning * [FIXME] Core patch needed top make isFocussable () wrappable
-/*
- window->setInputHint (false);
-*/
+ window->isFocussableSetEnabled (this, true);// causes w->isFocussable ()
+ // to return false
}
- else if (oldIsFocussable ||
- (protocolSetMask & CompWindowProtocolTakeFocusMask))
+ else if ((protocolSetMask & CompWindowProtocolTakeFocusMask))
{
newProtocol = window->protocols () |
(protocolSetMask & CompWindowProtocolTakeFocusMask);
protocolSetMask &= ~CompWindowProtocolTakeFocusMask;
-#warning * [FIXME] Core patch needed top make isFocussable () wrappable
-/*
- window->setInputHint (oldIsFocussable);
-*/
+ window->isFocussableSetEnabled (this, false);
}
if (newProtocol != window->protocols ())
@@ -107,14 +115,12 @@ WinrulesWindow::setNoAlpha (int optNum)
if (ws->getOptions ().at (optNum). value ().match ().evaluate (window))
{
- hasAlpha = window->alpha ();
-#warning * [FIXME] Core patch needed to make window->alpha () wrappable
- //window->setAlpha (false); Core patch needed
+ window->alphaSetEnabled (this, true); // Causes w->alpha () to return
+ // false
}
else
{
-#warning * [FIXME] Core patch needed for window->alpha () wrappable
- //window->setAlpha (hasAlpha); Core patch needed
+ window->alphaSetEnabled (this, false);
}
}
@@ -402,6 +408,8 @@ void
WinrulesWindow::getAllowedActions (unsigned int &setActions,
unsigned int &clearActions)
{
+ fprintf (stderr, "getAllowedActions called\n");
+
window->getAllowedActions (setActions, clearActions);
clearActions |= ~allowedActions;
@@ -435,18 +443,84 @@ WinrulesScreen::WinrulesScreen (CompScreen *screen) :
PluginClassHandler <WinrulesScreen, CompScreen> (screen)
{
ScreenInterface::setHandler (screen);
+
+ optionSetSkiptaskbarMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetSkippagerMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetAboveMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetBelowMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetFullscreenMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetStickyMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetMaximizeMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoArgbMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoMoveMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoResizeMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoMinimizeMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoMaximizeMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoCloseMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
+ optionSetNoFocusMatchNotify (boost::bind
+ (&WinrulesScreen::optionChanged, this,
+ _1, _2));
+
}
WinrulesWindow::WinrulesWindow (CompWindow *window) :
PluginClassHandler <WinrulesWindow, CompWindow> (window),
window (window),
- allowedActions (0),
+ allowedActions (~0),
stateSetMask (0),
- protocolSetMask (0),
- oldIsFocussable (window->isFocussable ()),
- hasAlpha (window->alpha ())
+ protocolSetMask (0)
{
+ CompTimer timer;
+
WindowInterface::setHandler (window);
+
+ window->isFocussableSetEnabled (this, false);
+ window->alphaSetEnabled (this, false);
+
+ timer.setCallback (boost::bind(&WinrulesWindow::applyRules, this));
+ timer.setTimes (0, 0);
+
+ timer.start ();
+
}
bool
diff --git a/src/winrules.h b/src/winrules.h
index be4f53c..7d3694a 100644
--- a/src/winrules.h
+++ b/src/winrules.h
@@ -23,6 +23,7 @@
#include <core/core.h>
#include <core/pluginclasshandler.h>
+#include <core/timer.h>
#include <core/atoms.h>
#include <X11/Xatom.h>
#include "winrules_options.h"
@@ -103,12 +104,12 @@ class WinrulesWindow :
bool applyRules ();
+ bool alpha ();
+ bool isFocussable ();
+
unsigned int allowedActions;
unsigned int stateSetMask;
unsigned int protocolSetMask;
-
- bool oldIsFocussable;
- bool hasAlpha;
};
#define WINRULES_WINDOW(window) \