~compiz-team/compiz-grid-plugin/compiz-grid-plugin.fix_860257

« back to all changes in this revision

Viewing changes to src/grid.cpp

  • Committer: Sam Spilsbury
  • Date: 2011-09-16 04:49:30 UTC
  • mfrom: (92.1.1)
  • Revision ID: git-v1:7f0210320c0ee3260de7eb82dc3791aa4854e5d0
MergeĀ lp:~compiz-team/compiz-grid-plugin/compiz-grid-plugin.fix_850985

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                            CompAction::State  state,
120
120
                            CompOption::Vector &option,
121
121
                            GridType           where,
122
 
                            bool               resize)
 
122
                            bool               resize,
 
123
                            bool               key)
123
124
{
124
125
    Window     xid;
125
126
    CompWindow *cw = 0;
138
139
 
139
140
        if (gw->lastTarget != where)
140
141
            gw->resizeCount = 0;
 
142
        else if (!key)
 
143
            return false;
141
144
 
142
145
        props = gridProps[where];
143
146
 
515
518
{
516
519
    CompOutput out;
517
520
    CompWindow *w;
 
521
    bool       check = false;
518
522
 
519
523
    screen->handleEvent (event);
520
524
 
568
572
        if (cScreen)
569
573
            cScreen->damageRegion (desiredSlot);
570
574
 
571
 
        initiateCommon (0, 0, o, edgeToGridType (), false);
 
575
        initiateCommon (0, 0, o, edgeToGridType (), false, false);
572
576
 
573
577
        if (cScreen)
574
578
            cScreen->damageRegion (desiredSlot);
586
590
                if (cScreen)
587
591
                        cScreen->damageRegion (desiredSlot);
588
592
 
589
 
                initiateCommon (0, 0, o, edgeToGridType (), false);
 
593
                check = initiateCommon (0, 0, o, edgeToGridType (), false, false);
590
594
 
591
595
                if (cScreen)
592
596
                        cScreen->damageRegion (desiredSlot);
597
601
                                /* Begin fading previous animation instance */
598
602
                                animations.at (animations.size () - 1).fadingOut = true;
599
603
 
600
 
                        if (edge != NoEdge)
 
604
                        if (edge != NoEdge && check)
601
605
                        {
602
606
                                CompWindow *cw = screen->findWindow (screen->activeWindow ());
603
607
                                animations.push_back (Animation ());
645
649
{
646
650
    if (screen->grabExist ("move"))
647
651
    {
648
 
        gScreen->o.push_back (CompOption ("window", CompOption::TypeInt));
649
652
        gScreen->o[0].value ().set ((int) window->id ());
650
653
 
651
654
        screen->handleEventSetEnabled (gScreen, true);
673
676
    if (window == gScreen->mGrabWindow)
674
677
    {
675
678
        gScreen->initiateCommon
676
 
                        (0, 0, gScreen->o, gScreen->edgeToGridType (), true);
 
679
                        (0, 0, gScreen->o, gScreen->edgeToGridType (), true,
 
680
                         gScreen->edge != gScreen->lastResizeEdge);
677
681
 
678
682
        screen->handleEventSetEnabled (gScreen, false);
679
683
        gScreen->mGrabWindow = NULL;
681
685
        gScreen->cScreen->damageRegion (gScreen->desiredSlot);
682
686
    }
683
687
 
 
688
    gScreen->lastResizeEdge = gScreen->edge;
684
689
    gScreen->edge = NoEdge;
685
690
 
686
691
    window->ungrabNotify ();
834
839
    mGrabWindow (NULL),
835
840
    animating (false)
836
841
{
 
842
    o.push_back (CompOption ("window", CompOption::TypeInt));
837
843
 
838
844
    ScreenInterface::setHandler (screen, false);
839
845
    CompositeScreenInterface::setHandler (cScreen, false);
840
846
    GLScreenInterface::setHandler (glScreen, false);
841
847
 
842
 
    edge = lastEdge = NoEdge;
 
848
    edge = lastEdge = lastResizeEdge = NoEdge;
843
849
    currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
844
850
                            (screen->outputDeviceForPoint (pointerX, pointerY));
845
851
 
846
852
        animations.clear ();
847
853
 
848
 
#define GRIDSET(opt,where,resize)                                              \
 
854
#define GRIDSET(opt,where,resize,key)                                          \
849
855
    optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this,  \
850
 
                                           _1, _2, _3, where, resize))
 
856
                                           _1, _2, _3, where, resize, key))
851
857
 
852
 
    GRIDSET (PutCenterKey, GridCenter, true);
853
 
    GRIDSET (PutLeftKey, GridLeft, true);
854
 
    GRIDSET (PutRightKey, GridRight, true);
855
 
    GRIDSET (PutTopKey, GridTop, true);
856
 
    GRIDSET (PutBottomKey, GridBottom, true);
857
 
    GRIDSET (PutTopleftKey, GridTopLeft, true);
858
 
    GRIDSET (PutToprightKey, GridTopRight, true);
859
 
    GRIDSET (PutBottomleftKey, GridBottomLeft, true);
860
 
    GRIDSET (PutBottomrightKey, GridBottomRight, true);
861
 
    GRIDSET (PutMaximizeKey, GridMaximize, true);
 
858
    GRIDSET (PutCenterKey, GridCenter, true, true);
 
859
    GRIDSET (PutLeftKey, GridLeft, true, true);
 
860
    GRIDSET (PutRightKey, GridRight, true, true);
 
861
    GRIDSET (PutTopKey, GridTop, true, true);
 
862
    GRIDSET (PutBottomKey, GridBottom, true, true);
 
863
    GRIDSET (PutTopleftKey, GridTopLeft, true, true);
 
864
    GRIDSET (PutToprightKey, GridTopRight, true, true);
 
865
    GRIDSET (PutBottomleftKey, GridBottomLeft, true, true);
 
866
    GRIDSET (PutBottomrightKey, GridBottomRight, true, true);
 
867
    GRIDSET (PutMaximizeKey, GridMaximize, true, true);
862
868
 
863
869
#undef GRIDSET
864
870