This commit is contained in:
2015-02-14 11:27:11 -05:00

View File

@@ -1052,18 +1052,18 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
} }
// Sometimes it seems like the Cocoa menu handling clobbers the active rendering context. // Sometimes it seems like the Cocoa menu handling clobbers the active rendering context.
// For whatever reason, delaying 100 milliseconds appears to fix this. // For whatever reason, delaying 100 milliseconds appears to fix this.
sf::sleep(sf::milliseconds(100)); sf::sleep(sf::milliseconds(100)); // So this little section of code is a real-life valley
win.create(sf::VideoMode(1,1),""); // of dying things. Instantiating a window and then closing
win.close(); // it seems to fix the update error, because magic.
win.create(sf::VideoMode(winRect.width(), winRect.height()), "Dialog", sf::Style::Titlebar); win.create(sf::VideoMode(winRect.width(), winRect.height()), "Dialog", sf::Style::Titlebar);
draw(); draw();
win.setVisible(true);
makeFrontWindow(parent ? parent-> win : mainPtr); makeFrontWindow(parent ? parent-> win : mainPtr);
makeFrontWindow(win); makeFrontWindow(win);
ModalSession dlog(win, *parentWin); ModalSession dlog(win, *parentWin); // This is a loose modal session, as it doesn't prevent you
if(onopen) onopen(*this); if(onopen) onopen(*this); // from clicking away, but it does prevent editing other
animTimer.restart(); animTimer.restart(); // dialogs, and it also keeps this window on top even when
while(dialogNotToast){ while(dialogNotToast){ // it loses focus.
draw(); draw(); // dlog.pumpEvents();
dlog.pumpEvents();
if(!win.pollEvent(currentEvent)) continue; if(!win.pollEvent(currentEvent)) continue;
location where; location where;
switch(currentEvent.type){ switch(currentEvent.type){