PDA

View Full Version : Using GTK for ClanLib 0.9 Linux



rombust
09-17-2008, 01:27 PM
There is currently a lack of clipboard support with the ClanLib 0.9 Linux platform.

This is for: CL_DisplayWindow::get_clipboard_text()

As ClanLib "should" work on different window managers, this causes a problem (As XLib does not provide a clipboard.)

I was thinking that GTK could be an option.

This works on Gnome. Also i believe it runs on KDE (as kde can run gnome apps).

See http://www.gtk.org/

See http://www.vector-seven.com/2007/06/ for an example on how to use it.

Any recommendations / suggestions?

kbluck
09-17-2008, 06:46 PM
A clipboard is implemented via the window manager. As such, you can get to it using ICCCM via XLib, if the current window manager supports that standard, as modern ones do. But like all things Linux, there's no guarantees.

Here's a nice bit of sample code with extensive explanatory comments on how to do it through XLib:

http://mi.eng.cam.ac.uk/~er258/code/dist/x_clipboard/paste.cc

--- Kevin

rombust
09-19-2008, 01:06 PM
I have now implemented: get_clipboard_text()

The set_clipboard_text() is more of a challenge, as it needs to tie up with processing XEvents.

See (qt-2.1.0/src/kernel/qclipboard_x11.cpp) for how they do it.

I do not have time at the moment to look at it further.

rombust
09-23-2008, 04:03 PM
Clipboard support is now fully implemented for linux (I hope!)