fixes in x11 platform
* fix clipboard paste on x11 * fix alt tab and keyboard issues
This commit is contained in:
parent
6b020b94a4
commit
f8d4ef60d9
|
@ -119,6 +119,8 @@ void PlatformWindow::releaseAllKeys()
|
||||||
processKeyUp(keyCode);
|
processKeyUp(keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_inputEvent.keyboardModifiers = 0;
|
||||||
|
|
||||||
for(int i=0;i<4;++i)
|
for(int i=0;i<4;++i)
|
||||||
m_mouseButtonStates[i] = false;
|
m_mouseButtonStates[i] = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -773,6 +773,7 @@ void X11Window::poll()
|
||||||
break;
|
break;
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
m_focused = true;
|
m_focused = true;
|
||||||
|
releaseAllKeys();
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
m_focused = false;
|
m_focused = false;
|
||||||
|
@ -1008,7 +1009,7 @@ std::string X11Window::getClipboardText()
|
||||||
|
|
||||||
std::string clipboardText;
|
std::string clipboardText;
|
||||||
if(ownerWindow != None) {
|
if(ownerWindow != None) {
|
||||||
XConvertSelection(m_display, clipboard, XA_STRING, 0, ownerWindow, CurrentTime);
|
XConvertSelection(m_display, clipboard, XA_STRING, XA_PRIMARY, ownerWindow, CurrentTime);
|
||||||
XFlush(m_display);
|
XFlush(m_display);
|
||||||
|
|
||||||
// hack to wait SelectioNotify event, otherwise we will get wrong clipboard pastes
|
// hack to wait SelectioNotify event, otherwise we will get wrong clipboard pastes
|
||||||
|
@ -1018,33 +1019,17 @@ std::string X11Window::getClipboardText()
|
||||||
// check for data
|
// check for data
|
||||||
Atom type;
|
Atom type;
|
||||||
int format;
|
int format;
|
||||||
ulong numItems, bytesLeft, dummy;
|
ulong len, bytesLeft;
|
||||||
uchar *data;
|
uchar *data;
|
||||||
XGetWindowProperty(m_display, ownerWindow,
|
XGetWindowProperty(m_display, ownerWindow,
|
||||||
XA_STRING,
|
XA_PRIMARY, 0, 10000000L, 0, XA_STRING,
|
||||||
0, 0, 0,
|
|
||||||
AnyPropertyType,
|
|
||||||
&type,
|
&type,
|
||||||
&format,
|
&format,
|
||||||
&numItems,
|
&len,
|
||||||
&bytesLeft,
|
&bytesLeft,
|
||||||
&data);
|
&data);
|
||||||
if(bytesLeft > 0) {
|
if(len > 0) {
|
||||||
// get the data get
|
clipboardText = Fw::utf8StringToLatin1(data);
|
||||||
int result = XGetWindowProperty(m_display, ownerWindow,
|
|
||||||
XA_STRING,
|
|
||||||
0,
|
|
||||||
bytesLeft,
|
|
||||||
0,
|
|
||||||
AnyPropertyType,
|
|
||||||
&type,
|
|
||||||
&format,
|
|
||||||
&numItems,
|
|
||||||
&dummy,
|
|
||||||
&data);
|
|
||||||
if(result == Success)
|
|
||||||
clipboardText = Fw::utf8StringToLatin1(data);
|
|
||||||
XFree(data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue