fix some keyboard issues, chat tab, fix loadScript exception

This commit is contained in:
Eduardo Bart
2012-01-13 18:37:44 -02:00
parent f57d46de0e
commit aae784468b
11 changed files with 62 additions and 29 deletions

View File

@@ -297,9 +297,13 @@ void LuaInterface::loadScript(const std::string& fileName)
if(!boost::starts_with(fileName, "/"))
filePath = getCurrentSourcePath() + "/" + filePath;
std::string buffer = g_resources.loadFile(filePath);
std::string source = "@" + filePath;
loadBuffer(buffer, source);
try {
std::string buffer = g_resources.loadFile(filePath);
std::string source = "@" + filePath;
loadBuffer(buffer, source);
} catch(Exception& e) {
throw LuaException(e.what());
}
}
void LuaInterface::loadFunction(const std::string& buffer, const std::string& source)

View File

@@ -77,8 +77,8 @@ X11Window::X11Window()
m_keyMap[XK_Control_R] = Fw::KeyCtrl;
m_keyMap[XK_Shift_R] = Fw::KeyShift;
m_keyMap[XK_Shift_L] = Fw::KeyShift;
m_keyMap[XK_Alt_R] = Fw::KeyAlt;
m_keyMap[XK_Alt_L] = Fw::KeyAltGr;
m_keyMap[XK_Alt_R] = Fw::KeyAltGr;
m_keyMap[XK_Alt_L] = Fw::KeyAlt;
m_keyMap[XK_Meta_L] = Fw::KeyMeta;
m_keyMap[XK_Meta_R] = Fw::KeyMeta;
m_keyMap[XK_Menu] = Fw::KeyMenu;
@@ -642,13 +642,14 @@ void X11Window::poll()
//logDebug("char: ", buf[0], " code: ", (uint)buf[0]);
m_inputEvent.keyText = buf;
}
} else {
len = XLookupString(&event.xkey, buf, sizeof(buf), &keysym, 0);
if(len > 0)
m_inputEvent.keyText = buf;
}
XKeyEvent xkey = event.xkey;
xkey.state = xkey.state & ~(ShiftMask);
len = XLookupString(&xkey, buf, sizeof(buf), &keysym, 0);
if(len > 0 && m_inputEvent.keyText.length() == 0)
m_inputEvent.keyText = buf;
if(m_keyMap.find(keysym) != m_keyMap.end())
m_inputEvent.keyCode = m_keyMap[keysym];

View File

@@ -27,6 +27,9 @@
bool UIGame::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifiers)
{
if(UIWidget::onKeyPress(keyCode, keyText, keyboardModifiers))
return true;
UILineEditPtr chatLineEdit = std::dynamic_pointer_cast<UILineEdit>(getParent()->recursiveGetChildById("consoleLineEdit"));
if(keyboardModifiers == Fw::KeyboardNoModifier) {
@@ -108,5 +111,5 @@ bool UIGame::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifier
return true;
}
return UIWidget::onKeyPress(keyCode, keyText, keyboardModifiers);
return false;
}