summaryrefslogtreecommitdiffstats
path: root/kxkb/layoutmap.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kxkb/layoutmap.h
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kxkb/layoutmap.h')
-rw-r--r--kxkb/layoutmap.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/kxkb/layoutmap.h b/kxkb/layoutmap.h
new file mode 100644
index 000000000..198990327
--- /dev/null
+++ b/kxkb/layoutmap.h
@@ -0,0 +1,75 @@
+//
+// C++ Interface: layoutmap
+//
+// Description:
+//
+//
+// Author: Andriy Rysin <[email protected]>, (C) 2006
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef __LAYOUTMAP_H
+#define __LAYOUTMAP_H
+
+#include <assert.h>
+
+#include <qptrqueue.h>
+#include <qmap.h>
+
+#include <kwinmodule.h>
+#include <kdebug.h>
+
+#include "kxkbconfig.h"
+
+
+// LayoutInfo is used for sticky switching and per-window/application switching policy
+struct LayoutState {
+ const LayoutUnit& layoutUnit;
+ int group;
+
+ LayoutState(const LayoutUnit& layoutUnit_):
+ layoutUnit(layoutUnit_),
+ group(layoutUnit_.defaultGroup)
+ {
+// kdDebug() << "new LayoutState " << layoutUnit.toPair() << " group: " << group << endl;
+ }
+};
+
+
+// LayoutMap is used for per-window or per-application switching policy
+class LayoutMap {
+ typedef QPtrQueue<LayoutState> LayoutQueue;
+ typedef QMap<WId, LayoutQueue> WinLayoutMap;
+ typedef QMap<QString, LayoutQueue> WinClassLayoutMap;
+
+public:
+ LayoutMap(const KxkbConfig& kxkbConfig);
+// void setConfig(const KxkbConfig& kxkbConfig);
+
+ void setCurrentLayout(const LayoutUnit& layoutUnit);
+ void setCurrentGroup(int group);
+ LayoutState& getNextLayout();
+ LayoutState& getCurrentLayout();
+
+ void setCurrentWindow(WId winId);
+ void reset();
+
+private:
+ // pseudo-union
+ LayoutQueue m_globalLayouts;
+ WinLayoutMap m_winLayouts;
+ WinClassLayoutMap m_appLayouts;
+
+ const KxkbConfig& m_kxkbConfig;
+ WId m_currentWinId;
+ QString m_currentWinClass; // only for SWITCH_POLICY_WIN_CLASS
+
+ void initLayoutQueue(LayoutQueue& layoutQueue);
+ LayoutQueue& getCurrentLayoutQueue(WId winId);
+ LayoutQueue& getCurrentLayoutQueueInternal(WId winId);
+ void clearMaps();
+};
+
+#endif