}
}
+void KWinGrid::toScreen(int screen)
+{
+ initGeometry();
+ if (activeWindow_) {
+ int xSize = (outer_.width()+hsize_/2)/hsize_;
+ if (xSize<1) xSize = 1;
+ if (xSize>hsplit_) xSize = hsplit_;
+
+ int ySize = (outer_.height()+vsize_/2)/vsize_;
+ if (ySize<1) ySize = 1;
+ if (ySize>vsplit_) ySize = vsplit_;
+
+ int xSlot = (outer_.left()-region_.left()+hsize_/2)/hsize_;
+ if (xSlot<0) xSlot = 0;
+ if (xSlot>=hsplit_) xSlot = hsplit_-1;
+
+ int ySlot = (outer_.top()-region_.top()+vsize_/2)/vsize_;
+ if (ySlot<0) ySlot = 0;
+ if (ySlot>=vsplit_) ySlot = vsplit_-1;
+
+ initGeometry(screen);
+ QRect newGeometry = doMoveResize(xSlot,ySlot,xSize,ySize);
+ updateGeometry(newGeometry);
+ applyGeometry();
+ }
+}
+
QRect KWinGrid::doMoveResize(int __xslot, int __yslot,
int __xsize, int __ysize)
{
// slots
-void KWinGrid::move_TL()
-{
- moveSlot(2, 2, 0, 0);
-}
-
-void KWinGrid::move_TR()
-{
- moveSlot(2, 2, 1, 0);
-}
-
-void KWinGrid::move_BL()
-{
- moveSlot(2, 2, 0, 1);
-}
-
-void KWinGrid::move_BR()
-{
- moveSlot(2, 2, 1, 1);
-}
-
-void KWinGrid::resize_Q()
-{
- resizeSlot(2, 2, 0, 0);
-}
-
-void KWinGrid::resize_H()
-{
- resizeSlot(2, 2, 1, 0);
-}
-
-void KWinGrid::resize_V()
-{
- resizeSlot(2, 2, 0, 1);
-}
-
-void KWinGrid::resize_F()
-{
- resizeSlot(2, 2, 1, 1);
-}
-
-void KWinGrid::move_00()
-{
- moveSlot(3, 2, 0, 0);
-}
-
-void KWinGrid::move_10()
-{
- moveSlot(3, 2, 1, 0);
-}
-
-void KWinGrid::move_20()
-{
- moveSlot(3, 2, 2, 0);
-}
-
-void KWinGrid::move_01()
-{
- moveSlot(3, 2, 0, 1);
-}
-
-void KWinGrid::move_11()
-{
- moveSlot(3, 2, 1, 1);
-}
-
-void KWinGrid::move_21()
-{
- moveSlot(3, 2, 2, 1);
-}
-
-void KWinGrid::resize_00()
-{
- resizeSlot(3, 2, 0, 0);
-}
-
-void KWinGrid::resize_10()
-{
- resizeSlot(3, 2, 1, 0);
-}
-
-void KWinGrid::resize_20()
-{
- resizeSlot(3, 2, 2, 0);
-}
-
-void KWinGrid::resize_01()
-{
- resizeSlot(3, 2, 0, 1);
-}
-
-void KWinGrid::resize_11()
-{
- resizeSlot(3, 2, 1, 1);
-}
-
-void KWinGrid::resize_21()
-{
- resizeSlot(3, 2, 2, 1);
-}
-
-void KWinGrid::move_L()
-{
- moveRelative(-1,0);
-}
-
-void KWinGrid::move_R()
-{
- moveRelative(1,0);
-}
-
-void KWinGrid::move_U()
-{
- moveRelative(0,-1);
-}
-
-void KWinGrid::move_D()
-{
- moveRelative(0,1);
-}
-
-void KWinGrid::resize_IH()
-{
- resizeRelative(1,0);
-}
-
-void KWinGrid::resize_DH()
-{
- resizeRelative(-1,0);
-}
-
-void KWinGrid::resize_IV()
-{
- resizeRelative(0,1);
-}
-
-void KWinGrid::resize_DV()
-{
- resizeRelative(0,-1);
-}
-
+void KWinGrid::move_TL() { moveSlot(2, 2, 0, 0); }
+void KWinGrid::move_TR() { moveSlot(2, 2, 1, 0); }
+void KWinGrid::move_BL() { moveSlot(2, 2, 0, 1); }
+void KWinGrid::move_BR() { moveSlot(2, 2, 1, 1); }
+void KWinGrid::resize_Q() { resizeSlot(2, 2, 0, 0); }
+void KWinGrid::resize_H() { resizeSlot(2, 2, 1, 0); }
+void KWinGrid::resize_V() { resizeSlot(2, 2, 0, 1); }
+void KWinGrid::resize_F() { resizeSlot(2, 2, 1, 1); }
+
+void KWinGrid::move32_00() { moveSlot(3, 2, 0, 0); }
+void KWinGrid::move32_10() { moveSlot(3, 2, 1, 0); }
+void KWinGrid::move32_20() { moveSlot(3, 2, 2, 0); }
+void KWinGrid::move32_01() { moveSlot(3, 2, 0, 1); }
+void KWinGrid::move32_11() { moveSlot(3, 2, 1, 1); }
+void KWinGrid::move32_21() { moveSlot(3, 2, 2, 1); }
+void KWinGrid::resize32_00() { resizeSlot(3, 2, 0, 0); }
+void KWinGrid::resize32_10() { resizeSlot(3, 2, 1, 0); }
+void KWinGrid::resize32_20() { resizeSlot(3, 2, 2, 0); }
+void KWinGrid::resize32_01() { resizeSlot(3, 2, 0, 1); }
+void KWinGrid::resize32_11() { resizeSlot(3, 2, 1, 1); }
+void KWinGrid::resize32_21() { resizeSlot(3, 2, 2, 1); }
+
+void KWinGrid::move43_00() { moveSlot(4, 3, 0, 0); }
+void KWinGrid::move43_10() { moveSlot(4, 3, 1, 0); }
+void KWinGrid::move43_20() { moveSlot(4, 3, 2, 0); }
+void KWinGrid::move43_30() { moveSlot(4, 3, 3, 0); }
+void KWinGrid::move43_01() { moveSlot(4, 3, 0, 1); }
+void KWinGrid::move43_11() { moveSlot(4, 3, 1, 1); }
+void KWinGrid::move43_21() { moveSlot(4, 3, 2, 1); }
+void KWinGrid::move43_31() { moveSlot(4, 3, 3, 1); }
+void KWinGrid::move43_02() { moveSlot(4, 3, 0, 2); }
+void KWinGrid::move43_12() { moveSlot(4, 3, 1, 2); }
+void KWinGrid::move43_22() { moveSlot(4, 3, 2, 2); }
+void KWinGrid::move43_32() { moveSlot(4, 3, 3, 2); }
+void KWinGrid::resize43_00() { resizeSlot(4, 3, 0, 0); }
+void KWinGrid::resize43_10() { resizeSlot(4, 3, 1, 0); }
+void KWinGrid::resize43_20() { resizeSlot(4, 3, 2, 0); }
+void KWinGrid::resize43_30() { resizeSlot(4, 3, 3, 0); }
+void KWinGrid::resize43_01() { resizeSlot(4, 3, 0, 1); }
+void KWinGrid::resize43_11() { resizeSlot(4, 3, 1, 1); }
+void KWinGrid::resize43_21() { resizeSlot(4, 3, 2, 1); }
+void KWinGrid::resize43_31() { resizeSlot(4, 3, 3, 1); }
+void KWinGrid::resize43_02() { resizeSlot(4, 3, 0, 2); }
+void KWinGrid::resize43_12() { resizeSlot(4, 3, 1, 2); }
+void KWinGrid::resize43_22() { resizeSlot(4, 3, 2, 2); }
+void KWinGrid::resize43_32() { resizeSlot(4, 3, 3, 2); }
+
+void KWinGrid::move_L() { moveRelative(-1,0); }
+void KWinGrid::move_R() { moveRelative(1,0); }
+void KWinGrid::move_U() { moveRelative(0,-1); }
+void KWinGrid::move_D() { moveRelative(0,1); }
+void KWinGrid::resize_IH() { resizeRelative(1,0); }
+void KWinGrid::resize_DH() { resizeRelative(-1,0); }
+void KWinGrid::resize_IV() { resizeRelative(0,1); }
+void KWinGrid::resize_DV() { resizeRelative(0,-1); }
+
+void KWinGrid::move_Screen0() { toScreen(0); }
+void KWinGrid::move_Screen1() { toScreen(1); }
ACTION("bottom-left", K, move_BL);
ACTION("bottom-right", L, move_BR);
- ACTION("top-left (3x2 grid)", T, move_00);
- ACTION("top-middle (3x2 grid)", Y, move_10);
- ACTION("top-right (3x2 grid)", U, move_20);
- ACTION("bottom-left (3x2 grid)", G, move_01);
- ACTION("bottom-middle (3x2 grid)", H, move_11);
- ACTION("bottom-right (3x2 grid)", J, move_21);
+ ACTION("top-left (3x2 grid)", T, move32_00);
+ ACTION("top-middle (3x2 grid)", Y, move32_10);
+ ACTION("top-right (3x2 grid)", U, move32_20);
+ ACTION("bottom-left (3x2 grid)", G, move32_01);
+ ACTION("bottom-middle (3x2 grid)", H, move32_11);
+ ACTION("bottom-right (3x2 grid)", J, move32_21);
+
+ ACTION(" 0,0 (4x3 grid)", Q, move43_00);
+ ACTION(" 1,0 (4x3 grid)", W, move43_10);
+ ACTION(" 2,0 (4x3 grid)", E, move43_20);
+ ACTION(" 3,0 (4x3 grid)", R, move43_30);
+ ACTION(" 0,1 (4x3 grid)", A, move43_01);
+ ACTION(" 1,1 (4x3 grid)", S, move43_11);
+ ACTION(" 2,1 (4x3 grid)", D, move43_21);
+ ACTION(" 3,1 (4x3 grid)", F, move43_31);
+ ACTION(" 0,2 (4x3 grid)", Z, move43_02);
+ ACTION(" 1,2 (4x3 grid)", X, move43_12);
+ ACTION(" 2,2 (4x3 grid)", C, move43_22);
+ ACTION(" 3,2 (4x3 grid)", V, move43_32);
#undef ACTION
+
+#define ACTION(pos, key, slot) \
+ KAction * slot = new KAction(winGrid); \
+ actions->addAction("Move to Screen " pos, slot); \
+ slot->setHelpText("Move to Screen " pos); \
+ slot->setGlobalShortcut(KShortcut( \
+ Qt::ALT+Qt::SHIFT+Qt::Key_ ## key, Qt::META+Qt::SHIFT+Qt::Key_ ## key)); \
+ QObject::connect(slot, SIGNAL(triggered(bool)), winGrid, SLOT(slot()))
+
+ ACTION("0", B, move_Screen0);
+ ACTION("1", M, move_Screen1);
+#undef ACTION
+
#define ACTION(size, key, slot) \
KAction * slot = new KAction(winGrid); \
actions->addAction("Resize " size, slot); \
ACTION("vertical", K, resize_V);
ACTION("full", L, resize_F);
- ACTION("top-left (3x2 grid)", T, resize_00);
- ACTION("top-middle (3x2 grid)", Y, resize_10);
- ACTION("top-right (3x2 grid)", U, resize_20);
- ACTION("bottom-left (3x2 grid)", G, resize_01);
- ACTION("bottom-middle (3x2 grid)", H, resize_11);
- ACTION("bottom-right (3x2 grid)", J, resize_21);
-
+ ACTION("top-left (3x2 grid)", T, resize32_00);
+ ACTION("top-middle (3x2 grid)", Y, resize32_10);
+ ACTION("top-right (3x2 grid)", U, resize32_20);
+ ACTION("bottom-left (3x2 grid)", G, resize32_01);
+ ACTION("bottom-middle (3x2 grid)", H, resize32_11);
+ ACTION("bottom-right (3x2 grid)", J, resize32_21);
+
+ ACTION(" 0,0 (4x3 grid)", Q, resize43_00);
+ ACTION(" 1,0 (4x3 grid)", W, resize43_10);
+ ACTION(" 2,0 (4x3 grid)", E, resize43_20);
+ ACTION(" 3,0 (4x3 grid)", R, resize43_30);
+ ACTION(" 0,1 (4x3 grid)", A, resize43_01);
+ ACTION(" 1,1 (4x3 grid)", S, resize43_11);
+ ACTION(" 2,1 (4x3 grid)", D, resize43_21);
+ ACTION(" 3,1 (4x3 grid)", F, resize43_31);
+ ACTION(" 0,2 (4x3 grid)", Z, resize43_02);
+ ACTION(" 1,2 (4x3 grid)", X, resize43_12);
+ ACTION(" 2,2 (4x3 grid)", C, resize43_22);
+ ACTION(" 3,2 (4x3 grid)", V, resize43_32);
#undef ACTION
+
#define ACTION(dir, key, slot) \
KAction * slot = new KAction(winGrid); \
actions->addAction("Move " dir, slot); \
ACTION("right", Right, move_R);
ACTION("up", Up, move_U);
ACTION("down", Down, move_D);
-
#undef ACTION
+
#define ACTION(resize, key, slot) \
KAction * slot = new KAction(winGrid); \
actions->addAction(resize " size", slot); \
ACTION("Increase vertical", Down, resize_IV);
ACTION("Decrease horizontal", Left, resize_DH);
ACTION("Decrease vertical", Up, resize_DV);
-
#undef ACTION
int ret = app->exec();