Fix scrollbars not updating while mouse pressed on Windows

This commit is contained in:
2015-08-19 16:45:05 -04:00
committed by Celtic Minstrel
parent 36ad3b5420
commit 5ae96f2c45
3 changed files with 5 additions and 1 deletions

View File

@@ -335,18 +335,21 @@ void Mouse_Pressed() {
location mousePos(event.mouseButton.x, event.mouseButton.y);
volatile bool doneScrolling = false;
if(mousePos.in(text_sbar->getBounds())) {
mainPtr.setActive(false);
boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling), REFRESH_TRANS));
text_sbar->handleClick(mousePos);
doneScrolling = true;
updater.join();
redraw_screen(REFRESH_TRANS);
} else if(mousePos.in(item_sbar->getBounds())) {
mainPtr.setActive(false);
boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling), REFRESH_INVEN));
item_sbar->handleClick(mousePos);
doneScrolling = true;
updater.join();
redraw_screen(REFRESH_INVEN);
} else if(overall_mode == MODE_SHOPPING && mousePos.in(shop_sbar->getBounds())) {
mainPtr.setActive(false);
boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling), REFRESH_DLOG));
shop_sbar->handleClick(mousePos);
doneScrolling = true;

View File

@@ -68,7 +68,6 @@ bool cScrollbar::handleClick(location where) {
if(max == 0) return false;
sf::Event e;
bool done = false, clicked = false;
inWindow->setActive();
depressed = true;
int bar_height = frame.height() - 32;
rectangle thumbRect = frame;

View File

@@ -563,12 +563,14 @@ void Mouse_Pressed() {
location mousePos(event.mouseButton.x, event.mouseButton.y);
volatile bool doneScrolling = false;
if(right_sbar->isVisible() && mousePos.in(right_sbar->getBounds())) {
mainPtr.setActive(false);
boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling)));
right_sbar->handleClick(mousePos);
doneScrolling = true;
updater.join();
redraw_screen(/*REFRESH_RIGHT_BAR*/);
} else if(pal_sbar->isVisible() && mousePos.in(pal_sbar->getBounds())) {
mainPtr.setActive(false);
boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling)));
pal_sbar->handleClick(mousePos);
doneScrolling = true;