wrap pollEvent() to guarantee all loops handle modifiers (#477)
This commit is contained in:
@@ -552,7 +552,7 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
|
||||
handle_events();
|
||||
|
||||
win.setVisible(false);
|
||||
while(parentWin->pollEvent(currentEvent));
|
||||
while(pollEvent(parentWin, currentEvent));
|
||||
set_cursor(former_curs);
|
||||
topWindow = formerTop;
|
||||
makeFrontWindow(*parentWin);
|
||||
@@ -584,7 +584,7 @@ void cDialog::handle_events() {
|
||||
cTextField& text_field = dynamic_cast<cTextField&>(getControl(currentFocus));
|
||||
text_field.replay_selection(pop_next_action());
|
||||
}else{
|
||||
while(win.pollEvent(currentEvent)){
|
||||
while(pollEvent(win, currentEvent)){
|
||||
handle_one_event(currentEvent, fps_limiter);
|
||||
}
|
||||
}
|
||||
@@ -618,8 +618,6 @@ void cDialog::handle_one_event(const sf::Event& currentEvent, cFramerateLimiter&
|
||||
std::string itemHit = "";
|
||||
location where;
|
||||
|
||||
if(kb.handleModifier(currentEvent)) return;
|
||||
|
||||
switch(currentEvent.type) {
|
||||
case sf::Event::KeyPressed:
|
||||
switch(currentEvent.key.code){
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "tools/cursors.hpp"
|
||||
#include "replay.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "winutil.hpp"
|
||||
|
||||
void cControl::setText(std::string l){
|
||||
lbl = l;
|
||||
@@ -228,7 +229,7 @@ bool cControl::handleClick(location, cFramerateLimiter& fps_limiter){
|
||||
depressed = true;
|
||||
while(!done){
|
||||
redraw();
|
||||
while(inWindow->pollEvent(e)){
|
||||
while(pollEvent(inWindow, e)){
|
||||
if(e.type == sf::Event::MouseButtonReleased){
|
||||
done = true;
|
||||
location clickPos(e.mouseButton.x, e.mouseButton.y);
|
||||
|
@@ -163,7 +163,7 @@ bool cTextField::handleClick(location clickLoc, cFramerateLimiter& fps_limiter)
|
||||
int initial_ip = insertionPoint, initial_sp = selectionPoint;
|
||||
while(!done) {
|
||||
redraw();
|
||||
while(inWindow->pollEvent(e)){
|
||||
while(pollEvent(inWindow, e)){
|
||||
if(e.type == sf::Event::MouseButtonReleased){
|
||||
done = true;
|
||||
} else if(e.type == sf::Event::MouseMoved){
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "tools/cursors.hpp"
|
||||
#include "replay.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "winutil.hpp"
|
||||
|
||||
std::string cScrollbar::scroll_textures[NUM_STYLES] = {
|
||||
"dlogscrollwh",
|
||||
@@ -319,7 +320,7 @@ bool cScrollbar::handleClick(location where, cFramerateLimiter& fps_limiter) {
|
||||
int diff = clickPos - thumbPos;
|
||||
while(!done){
|
||||
redraw();
|
||||
while(inWindow->pollEvent(e)){
|
||||
while(pollEvent(inWindow, e)){
|
||||
location mouseLoc = sf::Mouse::getPosition(*inWindow);
|
||||
mouseLoc = inWindow->mapPixelToCoords(mouseLoc);
|
||||
int mousePos = vert ? mouseLoc.y : mouseLoc.x;
|
||||
|
Reference in New Issue
Block a user