Merge lp:~compiz-team/compiz-snap-plugin/compiz-snap-plugin.fix_860646 into lp:compiz-snap-plugin

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 54
Proposed branch: lp:~compiz-team/compiz-snap-plugin/compiz-snap-plugin.fix_860646
Merge into: lp:compiz-snap-plugin
Diff against target: 126 lines (+17/-15)
2 files modified
src/snap.cpp (+16/-14)
src/snap.h (+1/-1)
To merge this branch: bzr merge lp:~compiz-team/compiz-snap-plugin/compiz-snap-plugin.fix_860646
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+77181@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1

review: Approve
54. By Sam Spilsbury

Merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/snap.cpp'
--- src/snap.cpp 2011-03-14 16:04:25 +0000
+++ src/snap.cpp 2011-09-27 15:14:23 +0000
@@ -396,7 +396,7 @@
396 // Update snapping data396 // Update snapping data
397 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)397 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
398 {398 {
399 snapped = true;399 snapGeometry = window->serverGeometry ();
400 this->snapDirection |= snapDirection;400 this->snapDirection |= snapDirection;
401 }401 }
402 // Attract the window if needed, moving it of the correct dist402 // Attract the window if needed, moving it of the correct dist
@@ -487,7 +487,7 @@
487 // Update snapping data487 // Update snapping data
488 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)488 if (ss->optionGetSnapTypeMask () & SnapTypeEdgeResistanceMask)
489 {489 {
490 snapped = true;490 snapGeometry = window->serverGeometry ();
491 this->snapDirection |= snapDirection;491 this->snapDirection |= snapDirection;
492 }492 }
493 // FIXME : this needs resize-specific code.493 // FIXME : this needs resize-specific code.
@@ -591,7 +591,7 @@
591 // If there's horizontal snapping, add dx to current buffered591 // If there's horizontal snapping, add dx to current buffered
592 // dx and resist (move by -dx) or release the window and move592 // dx and resist (move by -dx) or release the window and move
593 // by buffered dx - dx, same for dh593 // by buffered dx - dx, same for dh
594 if (snapped && snapDirection & HorizontalSnap)594 if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
595 {595 {
596 m_dx += dx;596 m_dx += dx;
597 if (m_dx < ss->optionGetResistanceDistance ()597 if (m_dx < ss->optionGetResistanceDistance ()
@@ -622,7 +622,7 @@
622 }622 }
623623
624 // Same for vertical snapping and dy/dh624 // Same for vertical snapping and dy/dh
625 if (snapped && snapDirection & VerticalSnap)625 if (snapGeometry.isEmpty () && snapDirection & VerticalSnap)
626 {626 {
627 m_dy += dy;627 m_dy += dy;
628 if (m_dy < ss->optionGetResistanceDistance ()628 if (m_dy < ss->optionGetResistanceDistance ()
@@ -652,8 +652,8 @@
652 }652 }
653 }653 }
654 // If we are no longer snapping in any direction, reset snapped654 // If we are no longer snapping in any direction, reset snapped
655 if (snapped && !snapDirection)655 if (!snapGeometry.isEmpty () && !snapDirection)
656 snapped = false;656 snapGeometry = CompWindow::Geometry ();
657 }657 }
658658
659 // If we don't already snap vertically and horizontally,659 // If we don't already snap vertically and horizontally,
@@ -691,13 +691,14 @@
691 // If there's horizontal snapping, add dx to current buffered691 // If there's horizontal snapping, add dx to current buffered
692 // dx and resist (move by -dx) or release the window and move692 // dx and resist (move by -dx) or release the window and move
693 // by buffered dx - dx693 // by buffered dx - dx
694 if (snapped && snapDirection & HorizontalSnap)694 if (!snapGeometry.isEmpty () && snapDirection & HorizontalSnap)
695 {695 {
696 m_dx += dx;696 m_dx += dx;
697 if (m_dx < ss->optionGetResistanceDistance ()697 if (m_dx < ss->optionGetResistanceDistance ()
698 && m_dx > -ss->optionGetResistanceDistance ())698 && m_dx > -ss->optionGetResistanceDistance ())
699 {699 {
700 move (-dx, 0);700 dx = snapGeometry.x () - window->geometry ().x ();
701 move (dx, 0);
701 }702 }
702 else703 else
703 {704 {
@@ -707,13 +708,14 @@
707 }708 }
708 }709 }
709 // Same for vertical snapping and dy710 // Same for vertical snapping and dy
710 if (snapped && snapDirection & VerticalSnap)711 if (!snapGeometry.isEmpty () && snapDirection & VerticalSnap)
711 {712 {
712 m_dy += dy;713 m_dy += dy;
713 if (m_dy < ss->optionGetResistanceDistance ()714 if (m_dy < ss->optionGetResistanceDistance ()
714 && m_dy > -ss->optionGetResistanceDistance ())715 && m_dy > -ss->optionGetResistanceDistance ())
715 {716 {
716 move (0, -dy);717 dy = snapGeometry.y () - window->geometry ().y ();
718 move (0, dy);
717 }719 }
718 else720 else
719 {721 {
@@ -723,8 +725,8 @@
723 }725 }
724 }726 }
725 // If we are no longer snapping in any direction, reset snapped727 // If we are no longer snapping in any direction, reset snapped
726 if (snapped && !snapDirection)728 if (!snapGeometry.isEmpty () && !snapDirection)
727 snapped = false;729 snapGeometry = CompWindow::Geometry ();
728 }730 }
729 // If we don't already snap vertically and horizontally,731 // If we don't already snap vertically and horizontally,
730 // check edges status732 // check edges status
@@ -753,7 +755,7 @@
753{755{
754 edges.clear ();756 edges.clear ();
755757
756 snapped = false;758 snapGeometry = CompWindow::Geometry ();
757 snapDirection = 0;759 snapDirection = 0;
758 grabbed = 0;760 grabbed = 0;
759 m_dx = m_dy = m_dwidth = m_dheight = 0;761 m_dx = m_dy = m_dwidth = m_dheight = 0;
@@ -809,7 +811,7 @@
809 m_dy (0),811 m_dy (0),
810 m_dwidth (0),812 m_dwidth (0),
811 m_dheight (0),813 m_dheight (0),
812 snapped (false),814 snapGeometry (0, 0, 0, 0, 0),
813 grabbed (0),815 grabbed (0),
814 skipNotify (false)816 skipNotify (false)
815{817{
816818
=== modified file 'src/snap.h'
--- src/snap.h 2009-07-28 13:58:37 +0000
+++ src/snap.h 2011-09-27 15:14:23 +0000
@@ -127,7 +127,7 @@
127 int m_dheight;127 int m_dheight;
128128
129 // internals129 // internals
130 bool snapped;130 CompWindow::Geometry snapGeometry;
131 int grabbed;131 int grabbed;
132132
133 // internal, avoids infinite notify loops133 // internal, avoids infinite notify loops

Subscribers

People subscribed via source and target branches

to all changes: