diff options
| author | Andrea Azzarone <azzaronea@gmail.com> | 2012-11-26 21:04:54 +0000 | 
|---|---|---|
| committer | Tarmac <> | 2012-11-26 21:04:54 +0000 | 
| commit | 7fb9d10432f9554aa624680cd4b871c4fbed2d89 (patch) | |
| tree | b118feba1dd08b22554719668660782987fc41e3 | |
| parent | 21ad3865685fcaf163815c2cf862d9d8e9544285 (diff) | |
| parent | 15b46a38d184906b0a426dbebf087d325e59dc59 (diff) | |
Disable sticky edges during drag and drop. Fixes: https://bugs.launchpad.net/bugs/1035304.
Approved by Marco Trevisan (TreviƱo). (bzr r2931)
| -rw-r--r-- | launcher/Launcher.cpp | 12 | ||||
| -rw-r--r-- | tests/test_launcher.cpp | 21 | 
2 files changed, 29 insertions, 4 deletions
| diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp index 95072c72c..ff6ff1046 100644 --- a/launcher/Launcher.cpp +++ b/launcher/Launcher.cpp @@ -1119,7 +1119,6 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,  // function is not smooth it is continuous, which is more important for our visual representation (icons  // wont start jumping around). As a general rule ANY if () statements that modify center.y should be seen  // as bugs. - int index = 1;  for (it = _model->main_begin(); it != _model->main_end(); ++it)  {  RenderArg arg; @@ -1128,7 +1127,6 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,  autohide_offset, folded_z_distance, animation_neg_rads, current);  arg.colorify = colorify;  launcher_args.push_back(arg); - index++;  }  // compute maximum height of shelf @@ -2261,7 +2259,13 @@ void Launcher::RecvMouseWheel(int x, int y, int wheel_delta, unsigned long butto  bool Launcher::HandleBarrierEvent(ui::PointerBarrierWrapper* owner, ui::BarrierEvent::Ptr event)  { - nux::Geometry abs_geo = GetAbsoluteGeometry(); + if (_hide_machine.GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE)) + { + owner->ReleaseBarrier(event->event_id); + return true; + } + + nux::Geometry const& abs_geo = GetAbsoluteGeometry();  bool apply_to_reveal = false;  if (_hidden && event->x >= abs_geo.x && event->x <= abs_geo.x + abs_geo.width) @@ -2631,7 +2635,7 @@ void Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)  SetMousePosition(x - _parent->GetGeometry().x, y - _parent->GetGeometry().y); - if (!IsOverlayOpen() && _mouse_position.x == 0 && _mouse_position.y <= (_parent->GetGeometry().height - _icon_size - 2 * _space_between_icons) && !_drag_edge_touching) + if (monitor() == 0 && !IsOverlayOpen() && _mouse_position.x == 0 && _mouse_position.y <= (_parent->GetGeometry().height - _icon_size - 2 * _space_between_icons) && !_drag_edge_touching)  {  if (_dnd_hovered_icon)  _dnd_hovered_icon->SendDndLeave(); diff --git a/tests/test_launcher.cpp b/tests/test_launcher.cpp index 9e76866a2..2edcb89ed 100644 --- a/tests/test_launcher.cpp +++ b/tests/test_launcher.cpp @@ -54,6 +54,11 @@ public:  MOCK_METHOD1(Stick, void(bool));  }; +struct MockPointerBarrierWrapper : ui::PointerBarrierWrapper +{ + MOCK_METHOD1(ReleaseBarrier, void(int event_id)); +}; +  }  class TestLauncher : public Test @@ -114,6 +119,11 @@ public:  _dnd_hovered_icon = MouseIconIntersection(x, y);  } + + bool HandleBarrierEvent(ui::PointerBarrierWrapper* barrier, ui::BarrierEvent::Ptr event) + { + return Launcher::HandleBarrierEvent(barrier, event); + }  };  TestLauncher() @@ -437,6 +447,17 @@ TEST_F(TestLauncher, DragLauncherIconHidesOutsideLauncherEmitsMouseEnter)  EXPECT_FALSE(mouse_entered);  } +TEST_F(TestLauncher, EdgeResistDuringDnd) +{ + auto barrier = std::make_shared<MockPointerBarrierWrapper>(); + auto event = std::make_shared<ui::BarrierEvent>(0, 0, 0, 100); + + launcher_->DndStarted(""); + + EXPECT_CALL(*barrier, ReleaseBarrier(100)); + EXPECT_TRUE(launcher_->HandleBarrierEvent(barrier.get(), event)); +} +  TEST_F(TestLauncher, DndIsSpecialRequest)  {  EXPECT_TRUE(launcher_->DndIsSpecialRequest("MyFile.desktop")); | 
