From 167658ec624079c3912581e6721ad408a1a2a2f0 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 3 Apr 2019 15:19:06 -0400 Subject: Tweak mouseButtonUp code a bit It's still kind of confusing. --- freecell.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/freecell.c b/freecell.c index f6562b8..da8729d 100644 --- a/freecell.c +++ b/freecell.c @@ -275,18 +275,18 @@ static bool mouseButtonDown(SDL_MouseButtonEvent button) { } static bool mouseButtonUp(SDL_MouseButtonEvent button) { + struct SDL_Point point = { button.x, button.y }; + if (button.button == SDL_BUTTON_RIGHT) { if (!reveal.len) return false; reveal.len = 0; return true; } - struct SDL_Point point = { button.x, button.y }; - struct Item *item = listFind(&layout.main, &point); - if (button.clicks % 2 == 0) { Card card = layout.dragItem.card; if (!card) { + struct Item *item = listFind(&layout.main, &point); if (!item) return false; card = item->card; } @@ -308,6 +308,7 @@ static bool mouseButtonUp(SDL_MouseButtonEvent button) { return true; } + struct Item *item = listFind(&layout.main, &point); if (!item) return false; if (!gameAvail(item->card)) return false; layout.dragItem = *item; -- cgit 1.4.1