587
587
if (!ss->snapping)
590
// apply edge resistance
591
if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
593
// If there's horizontal snapping, add dx to current buffered
594
// dx and resist (move by -dx) or release the window and move
595
// by buffered dx - dx, same for dh
596
if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
599
if (m_dx < ss->optionGetResistanceDistance ()
600
&& m_dx > -ss->optionGetResistanceDistance ())
602
resize (-dx, 0, 0, 0);
606
resize (m_dx - dx, 0, 0, 0);
609
snapDirection &= VerticalSnap;
612
if (m_dwidth < ss->optionGetResistanceDistance ()
613
&& m_dwidth > -ss->optionGetResistanceDistance ())
615
resize (0, 0, -dwidth, 0);
619
resize (0, 0, m_dwidth - dwidth, 0);
622
snapDirection &= VerticalSnap;
626
// Same for vertical snapping and dy/dh
627
if (snapGeometry.isEmpty () && snapDirection & VerticalSnap)
630
if (m_dy < ss->optionGetResistanceDistance ()
631
&& m_dy > -ss->optionGetResistanceDistance ())
633
resize (0, -dy, 0, 0);
637
resize (0, m_dy - dy, 0, 0);
640
snapDirection &= HorizontalSnap;
642
m_dheight += dheight;
643
if (m_dheight < ss->optionGetResistanceDistance ()
644
&& m_dheight > -ss->optionGetResistanceDistance ())
646
resize (0, 0, 0, -dheight);
650
resize (0, 0, 0, m_dheight - dheight);
653
snapDirection &= HorizontalSnap;
656
// If we are no longer snapping in any direction, reset snapped
657
if (!snapGeometry.isEmpty () && !snapDirection)
658
snapGeometry = CompWindow::Geometry ();
661
590
// If we don't already snap vertically and horizontally,
662
591
// check edges status
663
592
if (snapDirection != (VerticalSnap | HorizontalSnap))