~thomas-voss/compiz-core/fix-globals

« back to all changes in this revision

Viewing changes to plugins/rotate/src/rotate.cpp

  • Committer: Thomas Voß
  • Date: 2012-01-17 15:51:49 UTC
  • Revision ID: thomas.voss@rub.de-20120117155149-7vx59w01tomlquz0
Removed all public externals and put them in a class CompGlobal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
606
606
    if (screen->otherGrabExist ("rotate", "move", "group-drag", NULL))
607
607
        return false;
608
608
 
609
 
    warpX = pointerX - (screen->width () * direction);
 
609
    warpX = CompGlobal::instance ().pointerX () - (screen->width () * direction);
610
610
    if (direction == -1)
611
611
        screen->warpPointer (screen->width () - 10, 0);
612
612
    else
613
613
        screen->warpPointer (10 - screen->width (), 0);
614
 
    lastPointerX = warpX;
 
614
    CompGlobal::instance ().setLastPointerX (warpX);
615
615
 
616
616
    o.push_back (CompOption ("root", CompOption::TypeInt));
617
617
    o.push_back (CompOption ("x", CompOption::TypeInt));
619
619
 
620
620
    o[0].value ().set ((int) screen->root ());
621
621
    o[1].value ().set (0);
622
 
    o[2].value ().set (pointerY);
 
622
    o[2].value ().set (CompGlobal::instance ().pointerY ());
623
623
 
624
624
    rotate (NULL, 0, o, direction);
625
625
 
626
626
    XWarpPointer (screen->dpy (), None, None, 0, 0, 0, 0, direction, 0);
627
 
    mSavedPointer.setX (lastPointerX + (9 * direction));
 
627
    mSavedPointer.setX (CompGlobal::instance ().lastPointerX () + (9 * direction));
628
628
 
629
629
    return false;
630
630
}
690
690
 
691
691
    if (optionGetFlipTime () == 0 || (mMoving && !mSlow))
692
692
    {
693
 
        int pointerDx = pointerX - lastPointerX;
 
693
        int pointerDx = CompGlobal::instance ().pointerX () - CompGlobal::instance ().lastPointerX ();
694
694
        int warpX;
695
695
        
696
696
        if (direction == -1)
697
697
        {
698
 
            warpX = pointerX + screen->width ();
 
698
            warpX = CompGlobal::instance ().pointerX () + screen->width ();
699
699
            screen->warpPointer (screen->width () - 10, 0);
700
 
            lastPointerX = warpX - pointerDx;
 
700
            CompGlobal::instance ().setLastPointerX (warpX - pointerDx);
701
701
            rotate (NULL, 0, o, direction);
702
702
 
703
703
            XWarpPointer (screen->dpy (), None, None, 0, 0, 0, 0, -1, 0);
704
 
            mSavedPointer.setX (lastPointerX - 9);
 
704
            mSavedPointer.setX (CompGlobal::instance ().lastPointerX () - 9);
705
705
        }
706
706
        else
707
707
        {
708
 
            warpX = pointerX - screen->width ();
 
708
            warpX = CompGlobal::instance ().pointerX () - screen->width ();
709
709
            screen->warpPointer (10 - screen->width (), 0);
710
 
            lastPointerX = warpX - pointerDx;
 
710
            CompGlobal::instance ().setLastPointerX (warpX - pointerDx);
711
711
            rotate (NULL, 0, o, direction);
712
712
 
713
713
            XWarpPointer (screen->dpy (), None, None, 0, 0, 0, 0, 1, 0);
714
 
            mSavedPointer.setX (lastPointerX + 9);
 
714
            mSavedPointer.setX (CompGlobal::instance ().lastPointerX () + 9);
715
715
        }
716
716
 
717
717
    }
807
807
    o.push_back (CompOption ("y", CompOption::TypeInt));
808
808
 
809
809
    o[0].value ().set ((int) screen->root ());
810
 
    o[1].value ().set (CompOption::getIntOptionNamed (options, "x", pointerX));
811
 
    o[2].value ().set (CompOption::getIntOptionNamed (options, "y", pointerY));
 
810
    o[1].value ().set (CompOption::getIntOptionNamed (options, "x", CompGlobal::instance ().pointerX ()));
 
811
    o[2].value ().set (CompOption::getIntOptionNamed (options, "y", CompGlobal::instance ().pointerY ()));
812
812
 
813
813
    if (withWindow)
814
814
    {
835
835
                    {
836
836
                        GLfloat pointerDx, pointerDy;
837
837
 
838
 
                        pointerDx = pointerX - lastPointerX;
839
 
                        pointerDy = pointerY - lastPointerY;
 
838
                        pointerDx = CompGlobal::instance ().pointerX () - CompGlobal::instance ().lastPointerX ();
 
839
                        pointerDy = CompGlobal::instance ().pointerY () - CompGlobal::instance ().lastPointerY ();
840
840
 
841
841
                        if (event->xmotion.x_root < 50         ||
842
842
                            event->xmotion.y_root < 50         ||
843
843
                            event->xmotion.x_root > screen->width () - 50 ||
844
844
                            event->xmotion.y_root > screen->height () - 50)
845
845
                        {
846
 
                            screen->warpPointer ((screen->width () / 2) - pointerX,
847
 
                                                 (screen->height () / 2) - pointerY);
 
846
                            screen->warpPointer ((screen->width () / 2) - CompGlobal::instance ().pointerX (),
 
847
                                                 (screen->height () / 2) - CompGlobal::instance ().pointerY ());
848
848
                        }
849
849
 
850
850
                        if (optionGetInvertY ())
858
858
                    }
859
859
                    else
860
860
                    {
861
 
                        mSavedPointer.setX (mSavedPointer.x () + pointerX - lastPointerX);
862
 
                        mSavedPointer.setY (mSavedPointer.y () + pointerY - lastPointerY);
 
861
                        mSavedPointer.setX (mSavedPointer.x () + CompGlobal::instance ().pointerX () - CompGlobal::instance ().lastPointerX ());
 
862
                        mSavedPointer.setY (mSavedPointer.y () + CompGlobal::instance ().pointerY () - CompGlobal::instance ().lastPointerY ());
863
863
                    }
864
864
                }
865
865
            }