~focus-follows-mouse/ubuntu/precise/compiz/fix-883383

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-03-22 21:45:34 UTC
  • mfrom: (0.168.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110322214534-l6i6ds54os5uoqt1
Tags: 1:0.9.4git20110322-0ubuntu1
* New upstream bug fix snapshot:
  - Application windows can sometimes fail to display and will
    mask regions of the screen (LP: #709461)
  - Compiz switcher Alt-Tab order is not predictable - should
    maintain LIFO ordering in application switcher (LP: #175874)
  - after compiz crashed, gnome-panel isn't mapped again (LP: #711378)
  - invisible windows border problem (LP: #710271)
  - Compiz thinks you are clicking in an edge window when you
    are not (LP: #734250)
  - Add test case for invisible window regressions (LP: #736876)
  - often can't alt-click-dnd to move the focussed dialog (LP: #711911)
  - When windows open for the first time they should not hide (LP: #723878)
  - Unity Grid is broken for multi-monitor setups (LP: #709221)
  - Pixmaps trashed during animations when window is unmapped (LP: #733331)
  - Windows have blank decorations when rapidly closing and
    reopening (LP: #733328)
  - Unity is not restored on unity/compiz crash: compiz doesn't register
    properly with gnome-session (LP: #716462)
* remove the patch taken from upstream
* refresh u-w-d patch with latest upstream work
* debian/compiz-core.install:
  - image move to the final destination
* debian/patches/100_bump_core.h.patch:
  - bump for ABI breakage
* debian/compiz-decorator:
  - use gtk-window-decorator and not unity-window-decorator as it's really
    crashy for now (will probably redo an upload tomorrow with a fixed
    decorator)

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
void
41
41
ResizeScreen::getPaintRectangle (BoxPtr pBox)
42
42
{
43
 
    pBox->x1 = geometry.x - w->input ().left;
44
 
    pBox->y1 = geometry.y - w->input ().top;
 
43
    pBox->x1 = geometry.x - w->border ().left;
 
44
    pBox->y1 = geometry.y - w->border ().top;
45
45
    pBox->x2 = geometry.x + geometry.width +
46
 
               w->serverGeometry ().border () * 2 + w->input ().right;
 
46
               w->serverGeometry ().border () * 2 + w->border ().right;
47
47
 
48
48
    if (w->shaded ())
49
 
        pBox->y2 = geometry.y + w->size ().height () + w->input ().bottom;
 
49
        pBox->y2 = geometry.y + w->size ().height () + w->border ().bottom;
50
50
    else
51
51
        pBox->y2 = geometry.y + geometry.height +
52
 
                   w->serverGeometry ().border () * 2 + w->input ().bottom;
 
52
                   w->serverGeometry ().border () * 2 + w->border ().bottom;
53
53
}
54
54
 
55
55
void
56
56
ResizeWindow::getStretchScale (BoxPtr pBox, float *xScale, float *yScale)
57
57
{
58
 
    CompRect rect (window->inputRect ());
 
58
    CompRect rect (window->borderRect ());
59
59
 
60
60
    *xScale = (rect.width ())  ? (pBox->x2 - pBox->x1) /
61
61
                                 (float) rect.width () : 1.0f;
72
72
    getPaintRectangle (&box);
73
73
    ResizeWindow::get (w)->getStretchScale (&box, &xScale, &yScale);
74
74
 
75
 
    pBox->x1 = (int) (box.x1 - (w->output ().left - w->input ().left) * xScale);
76
 
    pBox->y1 = (int) (box.y1 - (w->output ().top - w->input ().top) * yScale);
 
75
    pBox->x1 = (int) (box.x1 - (w->output ().left - w->border ().left) * xScale);
 
76
    pBox->y1 = (int) (box.y1 - (w->output ().top - w->border ().top) * yScale);
77
77
    pBox->x2 = (int) (box.x2 + w->output ().right * xScale);
78
78
    pBox->y2 = (int) (box.y2 + w->output ().bottom * yScale);
79
79
}
712
712
                int x, y, left, top, width, height;
713
713
 
714
714
                CompWindow::Geometry server = w->serverGeometry ();
715
 
                CompWindowExtents    input  = w->input ();
 
715
                const CompWindowExtents    &border  = w->border ();
716
716
 
717
 
                left   = server.x () - input.left;
718
 
                top    = server.y () - input.top;
719
 
                width  = input.left + server.width () + input.right;
720
 
                height = input.top  + server.height () + input.bottom;
 
717
                left   = server.x () - border.left;
 
718
                top    = server.y () - border.top;
 
719
                width  = border.left + server.width () + border.right;
 
720
                height = border.top  + server.height () + border.bottom;
721
721
 
722
722
                x = left + width  * (rKeys[i].dx + 1) / 2;
723
723
                y = top  + height * (rKeys[i].dy + 1) / 2;
801
801
 
802
802
                if (mask & ResizeRightMask)
803
803
                        pointerAdjustX = server.x () + server.width () +
804
 
                                         w->input ().right - xRoot;
 
804
                                         w->border ().right - xRoot;
805
805
                else if (mask & ResizeLeftMask)
806
 
                        pointerAdjustX = server.x () - w->input ().left -
 
806
                        pointerAdjustX = server.x () - w->border ().left -
807
807
                                         xRoot;
808
808
 
809
809
                if (mask & ResizeDownMask)
810
810
                        pointerAdjustY = server.y () + server.height () +
811
 
                                         w->input ().bottom - yRoot;
 
811
                                         w->border ().bottom - yRoot;
812
812
                else if (mask & ResizeUpMask)
813
 
                        pointerAdjustY = server.y () - w->input ().top - yRoot;
 
813
                        pointerAdjustY = server.y () - w->border ().top - yRoot;
814
814
 
815
815
                screen->warpPointer (pointerAdjustX, pointerAdjustY);
816
816
 
847
847
                if (mask == ResizeLeftMask)
848
848
                {
849
849
                    if (xRoot == 0 &&
850
 
                        geometry.x - w->input ().left > grabWindowWorkArea->left ())
 
850
                        geometry.x - w->border ().left > grabWindowWorkArea->left ())
851
851
                        pointerDx += abs (yRoot - lastPointerY) * -1;
852
852
                }
853
853
                else if (mask == ResizeRightMask)
854
854
                {
855
855
                    if (xRoot == screen->width () -1 &&
856
 
                        geometry.x + geometry.width + w->input ().right < grabWindowWorkArea->right ())
 
856
                        geometry.x + geometry.width + w->border ().right < grabWindowWorkArea->right ())
857
857
                        pointerDx += abs (yRoot - lastPointerY);
858
858
                }
859
859
                if (mask == ResizeUpMask)
860
860
                {
861
861
                    if (yRoot == 0 &&
862
 
                        geometry.y - w->input ().top > grabWindowWorkArea->top ())
 
862
                        geometry.y - w->border ().top > grabWindowWorkArea->top ())
863
863
                        pointerDy += abs (xRoot - lastPointerX) * -1;
864
864
                }
865
865
                else if (mask == ResizeDownMask)
866
866
                {
867
867
                    if (yRoot == screen->height () -1 &&
868
 
                        geometry.y + geometry.height + w->input ().bottom < grabWindowWorkArea->bottom ())
 
868
                        geometry.y + geometry.height + w->border ().bottom < grabWindowWorkArea->bottom ())
869
869
                        pointerDx += abs (yRoot - lastPointerY);
870
870
                }
871
871
            }
910
910
            if (mask & ResizeUpMask)
911
911
            {
912
912
                int decorTop = savedGeometry.y + savedGeometry.height -
913
 
                    (che + w->input ().top);
 
913
                    (che + w->border ().top);
914
914
 
915
915
                if (grabWindowWorkArea->y () > decorTop)
916
916
                    che -= grabWindowWorkArea->y () - decorTop;
917
917
            }
918
918
            if (mask & ResizeDownMask)
919
919
            {
920
 
                int decorBottom = savedGeometry.y + che + w->input ().bottom;
 
920
                int decorBottom = savedGeometry.y + che + w->border ().bottom;
921
921
 
922
922
                if (decorBottom >
923
923
                    grabWindowWorkArea->y () + grabWindowWorkArea->height ())
927
927
            if (mask & ResizeLeftMask)
928
928
            {
929
929
                int decorLeft = savedGeometry.x + savedGeometry.width -
930
 
                    (cwi + w->input ().left);
 
930
                    (cwi + w->border ().left);
931
931
 
932
932
                if (grabWindowWorkArea->x () > decorLeft)
933
933
                    cwi -= grabWindowWorkArea->x () - decorLeft;
934
934
            }
935
935
            if (mask & ResizeRightMask)
936
936
            {
937
 
                int decorRight = savedGeometry.x + cwi + w->input ().right;
 
937
                int decorRight = savedGeometry.x + cwi + w->border ().right;
938
938
 
939
939
                if (decorRight >
940
940
                    grabWindowWorkArea->x () + grabWindowWorkArea->width ())
947
947
        he = che;
948
948
 
949
949
        /* compute rect. for window + borders */
950
 
        wWidth  = wi + w->input ().left + w->input ().right;
951
 
        wHeight = he + w->input ().top + w->input ().bottom;
 
950
        wWidth  = wi + w->border ().left + w->border ().right;
 
951
        wHeight = he + w->border ().top + w->border ().bottom;
952
952
 
953
953
        if (centered)
954
954
        {
955
955
            if (mask & ResizeLeftMask)
956
956
                wX = geometry.x + geometry.width -
957
 
                     (wi + w->input ().left);
 
957
                     (wi + w->border ().left);
958
958
            else
959
 
                wX = geometry.x - w->input ().left;
 
959
                wX = geometry.x - w->border ().left;
960
960
 
961
961
            if (mask & ResizeUpMask)
962
962
                wY = geometry.y + geometry.height -
963
 
                     (he + w->input ().top);
 
963
                     (he + w->border ().top);
964
964
            else
965
 
                wY = geometry.y - w->input ().top;
 
965
                wY = geometry.y - w->border ().top;
966
966
        }
967
967
        else
968
968
        {
969
969
            if (mask & ResizeLeftMask)
970
970
                wX = savedGeometry.x + savedGeometry.width -
971
 
                     (wi + w->input ().left);
 
971
                     (wi + w->border ().left);
972
972
            else
973
 
                wX = savedGeometry.x - w->input ().left;
 
973
                wX = savedGeometry.x - w->border ().left;
974
974
 
975
975
            if (mask & ResizeUpMask)
976
976
                wY = savedGeometry.y + savedGeometry.height -
977
 
                     (he + w->input ().top);
 
977
                     (he + w->border ().top);
978
978
            else
979
 
                wY = savedGeometry.y - w->input ().top;
 
979
                wY = savedGeometry.y - w->border ().top;
980
980
        }
981
981
 
982
982
        /* Check if resized edge(s) are near output work-area boundaries */
1047
1047
            /* rect. for a minimal height window + borders
1048
1048
               (used for the constraining in X axis) */
1049
1049
            int minimalInputHeight = minHeight +
1050
 
                                     w->input ().top + w->input ().bottom;
 
1050
                                     w->border ().top + w->border ().bottom;
1051
1051
 
1052
1052
            /* small hot-spot square (on window's corner or edge) that is to be
1053
1053
               constrained to the combined output work-area region */
1054
1054
            int x, y;
1055
 
            int width = w->input ().top; /* square size = title bar height */
 
1055
            int width = w->border ().top; /* square size = title bar height */
1056
1056
            int height = width;
1057
1057
            bool status; /* whether or not hot-spot is in the region */
1058
1058
 
1592
1592
        x = window->geometry (). x ();
1593
1593
        y = window->geometry (). y ();
1594
1594
 
1595
 
        xOrigin = x - window->input ().left;
1596
 
        yOrigin = y - window->input ().top;
 
1595
        xOrigin = x - window->border ().left;
 
1596
        yOrigin = y - window->border ().top;
1597
1597
 
1598
1598
        wTransform.translate (xOrigin, yOrigin, 0.0f);
1599
1599
        wTransform.scale (xScale, yScale, 1.0f);