fix x11 keyboard modifiers

This commit is contained in:
Eduardo Bart 2012-01-09 17:00:53 -02:00
parent ef82fc1554
commit 911584e816
4 changed files with 11 additions and 16 deletions

1
TODO
View File

@ -41,7 +41,6 @@
[bart] find a way to add new widgets without focusing them
[bart] fix moving windows and tooltips conflicts
[bart] break UILabel lines
[bart] padding
[bart] review and make more error prone with more warnings
[bart] a real working border and background property in otui
[bart] reapply anchor styles when adding new childs

View File

@ -1,12 +1,9 @@
function UIMap:onMouseRelease(mousePos, mouseButton)
local tile = self:getTile(mousePos)
if not tile then return false end
local keyboardModifiers = g_window.getKeyboardModifiers()
print ("lol " .. keyboardModifiers)
if not Options.classicControl then
if keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton then
-- auto walk
return true
@ -23,7 +20,6 @@ function UIMap:onMouseRelease(mousePos, mouseButton)
Game.attack(tile:getTopCreature())
return true
end
end
return false

View File

@ -35,6 +35,7 @@ WIN32Window::WIN32Window()
m_maximized = false;
m_minimumSize = Size(16,16);
m_size = m_minimumSize;
m_inputEvent.keyboardModifiers = 0;
m_keyMap[VK_ESCAPE] = Fw::KeyEscape;
m_keyMap[VK_TAB] = Fw::KeyTab;

View File

@ -37,6 +37,7 @@ X11Window::X11Window()
m_screen = 0;
m_wmDelete = 0;
m_size = Size(16,16);
m_inputEvent.keyboardModifiers = 0;
#ifndef OPENGL_ES2
m_glxContext = 0;
@ -543,6 +544,13 @@ void X11Window::poll()
m_inputEvent.keyText = "";
m_inputEvent.mouseMoved = Point();
m_inputEvent.wheelDirection = Fw::MouseNoWheel;
m_inputEvent.keyboardModifiers = 0;
if(event.xkey.state & ControlMask)
m_inputEvent.keyboardModifiers |= Fw::KeyboardCtrlModifier;
if(event.xkey.state & ShiftMask)
m_inputEvent.keyboardModifiers |= Fw::KeyboardShiftModifier;
if(event.xkey.state & Mod1Mask)
m_inputEvent.keyboardModifiers |= Fw::KeyboardAltModifier;
switch(event.type) {
case ClientMessage: {
@ -611,15 +619,6 @@ void X11Window::poll()
memset(buf, 0, 32);
int len;
m_inputEvent.keyboardModifiers = 0;
m_inputEvent.keyText = "";
if(event.xkey.state & ControlMask)
m_inputEvent.keyboardModifiers |= Fw::KeyboardCtrlModifier;
if(event.xkey.state & ShiftMask)
m_inputEvent.keyboardModifiers |= Fw::KeyboardShiftModifier;
if(event.xkey.state & Mod1Mask)
m_inputEvent.keyboardModifiers |= Fw::KeyboardAltModifier;
// lookup for keyText
if(event.type == KeyPress && !(event.xkey.state & ControlMask) && !(event.xkey.state & Mod1Mask)) {
if(m_xic) { // with xim we can get latin1 input correctly