From 57b78efdbf185fb1f4deacdb98f4bf8bdf52aba3 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 28 Mar 2019 15:13:09 -0400 Subject: Fix double-click regardless of selection --- freecell.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/freecell.c b/freecell.c index 487ef79..d50b641 100644 --- a/freecell.c +++ b/freecell.c @@ -191,16 +191,22 @@ static bool keyDown(SDL_KeyboardEvent key) { static bool mouseButtonDown(SDL_MouseButtonEvent button) { struct SDL_Point point = { button.x, button.y }; + struct Item *item = listFind(&layout.main, &point); - if (layout.dragItem.card) { - if (button.clicks % 2 == 0) { - for (uint dest = Cell1; dest <= Cell4; ++dest) { - if (gameMove(dest, layout.dragItem.card)) { - layout.dragItem.card = 0; - return true; - } - } + if (button.clicks % 2 == 0) { + Card card = layout.dragItem.card; + if (!card) { + if (!item) return false; + card = item->card; } + for (uint dest = Cell1; dest <= Cell4; ++dest) { + if (gameMove(dest, card)) break; + } + layout.dragItem.card = 0; + return true; + } + + if (layout.dragItem.card) { for (uint dest = 0; dest < StacksLen; ++dest) { if (SDL_PointInRect(&point, &stackRects[dest])) { if (gameMove(dest, layout.dragItem.card)) break; @@ -211,7 +217,6 @@ static bool mouseButtonDown(SDL_MouseButtonEvent button) { } // TODO: Right click to reveal? - struct Item *item = listFind(&layout.main, &point); if (!item) return false; if (!gameAvail(item->card)) return false; layout.dragItem = *item; -- cgit 1.4.1 alue='grep'>log msg
path: root/bin/1sh/var.c (unfollow)
Commit message (Expand)Author
2020-03-03Remove setoptJune McEnroe
2020-03-03Use getopts in shell scriptsJune McEnroe
2020-02-27Style %T outside of Rs in italicJune McEnroe
2020-02-26Add Fierce Femmes and Notorious LiarsJune McEnroe
2020-02-23Add This Is How You Lose the Time WarJune McEnroe
2020-02-22Add See Ya LaterJune McEnroe
2020-02-20Remove wiki scriptJune McEnroe
2020-02-19Add The Obelisk GateJune McEnroe
2020-02-17Add Four Tet — HandsJune McEnroe
2020-02-12Simplify macOS notify-sendJune McEnroe
2020-02-12Add imbox and notemap to pageJune McEnroe
2020-02-12Collapse simple linksJune McEnroe
2020-02-12Move catgirl up the pageJune McEnroe
2020-02-12Update catgirl pty grabJune McEnroe
2020-02-12Link to cgit /about pages where appropriateJune McEnroe
2020-02-11Separate LINKS from BINS for html to workJune McEnroe
2020-02-11Add margin to Bl-bullet itemsJune McEnroe
2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe
2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe
2020-02-09Add To Be Taught, If FortunateJune McEnroe
2020-02-04Add The Future of Another TimelineJune McEnroe
2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe
2020-01-28Change scout sensitivity to 1.4June McEnroe
2020-01-28Import shows.txtJune McEnroe