Skip to content

Commit

Permalink
CollageViewer: Ignore button presses from dnd
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperair committed May 6, 2012
1 parent 7f817cd commit 9b334c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/imgpack/gtkui/collage-viewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ inline Glib::RefPtr<Gdk::Pixbuf> PixbufRectangle::pixbuf () const
struct ipg::CollageViewer::Private : public sigc::trackable
{
Private (ipg::CollageViewer &parent) :
parent (parent), zoom_factor (1.0) {}
parent (parent), zoom_factor (1.0), dragging (false) {}

CollageViewer &parent;
ipa::BinPacker::Ptr packer;
Expand All @@ -125,6 +125,7 @@ struct ipg::CollageViewer::Private : public sigc::trackable
ipa::Rectangle::Ptr selected;

double zoom_factor;
bool dragging;

void on_binpack_finish ();
};
Expand Down Expand Up @@ -327,6 +328,9 @@ bool ipg::CollageViewer::on_button_release_event (GdkEventButton *ev)
if (!_priv->collage)
return true;

if (_priv->dragging)
return true;

auto selection_leaf =
_priv->collage->find_rect (ev->x / _priv->zoom_factor,
ev->y / _priv->zoom_factor);
Expand Down Expand Up @@ -381,6 +385,7 @@ bool ipg::CollageViewer::on_scroll_event (GdkEventScroll *ev)

void ipg::CollageViewer::on_drag_begin (const Glib::RefPtr<Gdk::DragContext> &)
{
_priv->dragging = true;
g_assert (_priv->selected);

double width = _priv->selected->width ();
Expand All @@ -403,6 +408,7 @@ bool ipg::CollageViewer::on_drag_drop (
int x, int y,
guint time)
{
_priv->dragging = false;
double real_x = x / _priv->zoom_factor;
double real_y = y / _priv->zoom_factor;

Expand Down

0 comments on commit 9b334c5

Please sign in to comment.