This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"Paste" from clipboard can failed (XWin bug)


Hi,

>From X application, I select some text. I switch on Windows
application and I try to paste the text.
I do "Ctrl-V" => nothing happens
I do a second "Ctrl-V" => the text is pasted

This problem depends on the X application

When a "paste" occurs, XWin receives a WM_RENDERFORMAT message :
(cf. winClipboardWindowProc())

step 1/ XWin try to get the selection in COMPOUND_TEXT format
    (cf. winProcessXEventsTimeout() calls XConvertSelection("COMPOUND_TEXT "))

step 2/ If the owner of the selection (the X app) can't handle
COMPOUND_TEXT format, XWin try to get the selection in UTF8_STRING
format
    (cf. winClipboardFlushXEvents(), on receive an SelectionNotify
event with "event.xselection.property == None", XWin calls
XConvertSelection("UTF8_STRING"))

step 3/ If the owner of the selection (the X app) can't handle
UTF8_STRING format, XWin try to get the selection in XA_STRING format
    (cf. winClipboardFlushXEvents(), on receive an SelectionNotify
event with "event.xselection.property == None", XWin calls
XConvertSelection("XA_STRING"))

But there is a bug in XWin :
XWin calls winProcessXEventsTimeout() only twice. If the X app handles
only handles XA_STRING format, the "step 3" is never invoked !
As the result, XWin can't get "paste data" and log the message:
    "winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY"


XWin.log with my comment:
...
(receive WM_RENDER_FORMAT message)
winClipboardWindowProc - WM_RENDER*FORMAT - Hello.
(call XConvertSelection("COMPOUND_TEXT "))
(first call winProcessXEventsTimeout())
winClipboardFlushXEvents - SelectionNotify
winClipboardFlushXEvents - SelectionNotify - ATOM: PRIMARY
(receive event.xselection.target == atomCompoundText aka COMPOUND_TEXT)
(the X app can't handle COMPOUND_TEXT format)
winClipboardFlushXEvents - SelectionNotify - Requesting conversion of
CompoundText target.
(call XConvertSelection("UTF8_STRING") and return)
(second call winProcessXEventsTimeout())
winClipboardFlushXEvents - SelectionNotify
winClipboardFlushXEvents - SelectionNotify - ATOM: PRIMARY
(receive event.xselection.target == atomUTF8String aka UTF8_STRING)
(the X app can't handle UTF8_STRING format)
winClipboardFlushXEvents - SelectionNotify - Requesting conversion of
UTF8 target.
(call XConvertSelection("XA_STRING") and return)
(XWin can't get paste data, also it logs an error :)
(and reset the clipboard => SetClipboardData (CF_UNICODETEXT,
NULL);SetClipboardData (CF_TEXT, NULL);)
winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY
...

Solution 1 :
Call a third time the function winProcessXEventsTimeout()
(see paste_bug_solution1.patch file attached)
but this is not a very elegant solution ...

Solution 2 :
call winProcessXEventsTimeout() only one time
winProcessXEventsTimeout() must process all notification until
* time out expired
* getting the paste data
* error occurred
(see paste_bug_solution2.patch file attached)

note: the actual timeout is set to 1 second.

Greetings,

Attachment: paste_bug_solution1.patch
Description: Binary data

Attachment: paste_bug_solution2.patch
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]