[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] [BUG] pygame.scrap crashes on X.Org



On, Wed Jul 26, 2006, Renï Dudfield wrote:

> Thanks Marcus.
> 
> there seems to be a problem with the changes on my Debian machine.
> 
> I used the examples/scrap_clipboard.py to test it.  With that example
> the g key gets from the clipboard, and the p key puts to the
> clipboard.
> 
> I select some text in a different window.  Then go back to the
> scrap_clipboard.py window and press g.  I need to press g twice before
> the correct text is given back.
> 
> If I try the same thing and paste into other windows it pastes correctly.

Confirmed. Unfortunately my clipboard buffer seemed to stay the same all
the time, so this problem did not turn up.

When trying to fix that, you will encounter numerous other problems,
ranging from crashes of pygame to dead locks in other windows, you want
to paste to wrong data within the selection buffer (because of lost
selection information).

As far as I can see - and if I understand the X11 xlipboard support
right - a better implementation would be to store the copied data
locally in the pygame scope and place it into the SelectionRequest event
handlers on demand using XChangeProperty() and co.. This should ensure
that data is received and pasted correctly.

put_scrap() and get_scrap() must be changed accordingly to support a
minimum conversion set of data types (e.g. COMPOUND_TEXT, X_UTF8_STRING,
etc.) besides XA_STRING (else we could run into trouble with uncode
strings, I did not recheck that however) and fit the request handlers.

If there are no opinions against that, I'll go ahead and fix the X11
support and post a patch set within the next days.

Regards
Marcus

Attachment: pgpEsT5dJauXI.pgp
Description: PGP signature