New clipboard handling notes (XFree86-xserv-4.3.0-31)

Harold L Hunt II huntharo@msu.edu
Mon Jan 5 07:40:00 GMT 2004


Here are my notes that I put together to convince myself that the new 
clipboard handling was complete and would not cause infinite loops. 
Please examine the notes if you are interested in the new code or if you 
would like to double-check my logic for errors.

Please review the steps and post to the list if you think you have found 
an error.  Also, if you find a bug or a crash, look at these steps and 
try to identify the approximate location of your problem so that we can 
do a better job of debugging.

Harold


Copy in X11
===========
1) winProcSetSelectionOwner gets called and takes ownership of the Win32 
clipboard (OpenClipboard, EmptyClipboard, SetClipboardData (foo, NULL)).

2) Selection is owned by another X11 client (the one that called 
XSetSelectionOwner).

3) EmptyClipboard() in step #1 files WM_DRAWCLIPBOARD message, which is 
ignored since hwnd == GetClipboardOwner ().

4) Paste in X11
     a) Owning X11 client handles SelectionRequest events.

     b) Item is pasted within X11 without round-trip to Win32.

5) Paste in Win32
     a) WM_RENDERFORMAT fires.

     b) SelectionRequest is sent, conversion from X11 to Win32 is done.

     c) SetClipboardData is called, passing converted text.

6) Copy in X11 (different app)
     a) Goto Step #1.

7) Copy in Win32
     a) Clipboard is emptied and owned by the other application.

     b) WM_DRAWCLIPBOARD fires, XSetSelectionOwner is called, owning the
     selection for the clipboard integration manager.


Copy in Win32
=============
1) WM_DRAWCLIPBOARD fires, calls XSetSelectionOwner for itself.

2) winProcSetSelectionOwner gets called, does nothing since clipboard 
X11 window is the window that is taking ownership.

3) Paste in Win32
     a) Clipboard owning Win32 app handles GetClipboardData call.

     b) Item is pasted without round-trip to X11.

4) Paste in X11
     a) Clipboard integration manager receives SelectionRequest.

     b) GetClipboardData is called, returning Win32 clipboard contents.

     c) Conversion from Win32 to X11 is done and text is pasted.

5) Copy in X11
     a) winProcSetSelectionOwner is called.

     b) Clipboard integration manager takes ownership of Win32 clipboard.

     c) WM_DRAWCLIPBOARD fires and is ignored since hwnd ==
     GetClipboardOwner ().

6) Copy in Win32 (different app)
     a) Goto Step #1.



More information about the Cygwin-xfree mailing list