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);
|
||||
}
|
||||
|
||||
m_inputEvent.keyboardModifiers = 0;
|
||||
|
||||
for(int i=0;i<4;++i)
|
||||
m_mouseButtonStates[i] = false;
|
||||
}
|
||||
|
|
|
@ -773,6 +773,7 @@ void X11Window::poll()
|
|||
break;
|
||||
case FocusIn:
|
||||
m_focused = true;
|
||||
releaseAllKeys();
|
||||
break;
|
||||
case FocusOut:
|
||||
m_focused = false;
|
||||
|
@ -1008,7 +1009,7 @@ std::string X11Window::getClipboardText()
|
|||
|
||||
std::string clipboardText;
|
||||
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);
|
||||
|
||||
// hack to wait SelectioNotify event, otherwise we will get wrong clipboard pastes
|
||||
|
@ -1018,33 +1019,17 @@ std::string X11Window::getClipboardText()
|
|||
// check for data
|
||||
Atom type;
|
||||
int format;
|
||||
ulong numItems, bytesLeft, dummy;
|
||||
ulong len, bytesLeft;
|
||||
uchar *data;
|
||||
XGetWindowProperty(m_display, ownerWindow,
|
||||
XA_STRING,
|
||||
0, 0, 0,
|
||||
AnyPropertyType,
|
||||
XA_PRIMARY, 0, 10000000L, 0, XA_STRING,
|
||||
&type,
|
||||
&format,
|
||||
&numItems,
|
||||
&len,
|
||||
&bytesLeft,
|
||||
&data);
|
||||
if(bytesLeft > 0) {
|
||||
// get the data get
|
||||
int result = XGetWindowProperty(m_display, ownerWindow,
|
||||
XA_STRING,
|
||||
0,
|
||||
bytesLeft,
|
||||
0,
|
||||
AnyPropertyType,
|
||||
&type,
|
||||
&format,
|
||||
&numItems,
|
||||
&dummy,
|
||||
&data);
|
||||
if(result == Success)
|
||||
if(len > 0) {
|
||||
clipboardText = Fw::utf8StringToLatin1(data);
|
||||
XFree(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue