mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
fix some keyboard issues, chat tab, fix loadScript exception
This commit is contained in:
@@ -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)
|
||||
|
@@ -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];
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user