Re: Unbreaking the gnome clipboard



On Sun, 2003-06-15 at 19:08, Mark Finlay wrote:
> > I'd be more than happy to mentor you (or anyone else pursuing this) on
> > the gnome-settings-daemon. I used to work on the control center so I
> > have some experience with it. Let me know if you're interested.
> 
> A kind offer Rachel, hope someone takes you up on it :)
> 
> After looking more at gcm I'm starting to think that it would be much better 
> to start from scratch. Gcm is very complicated, IMHO all we need in gnome is:

Well take a look at 

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gcm/Gcm.Net/Daemon/ClipboardManager.cs?rev=1.9

In C# its so easy that it even impressed me, the author of it. Yet, it
works.

This daemon is everything you guys need. That is what you are asking
for. If you run it .. it will do exactly what you want: maintain a copy
of the clipboard for when the clipboard-owning application dies...

The only thing that needs to be added is the possibility to limit the
amount of clipboards that you want to keep in memory... if you set that
to "1" then this is 100% want you want.

The plans for Gcm.Net are to create a lightweight XML interface so that
external applications can tell the manager-deamon to do things (like set
a specific clipboard or give a preview of such a collected clipboard).
Gcm.Net will also include end-user applications like a TrayIcon (or
PanelApplet) and a Hotkey-menu (For example Ctrl+Shift+c will open a
menu with all possible Clipboards to paste).

ps. Two other C# dudes have already showed interest in helping me
getting this application working.

I have been thinking about writing the daemon in C because then the
happy hippo people of gnome.org would not start wining about Mono as
dependancy. Well, maybe thats an option for later. For now I will go for
the C# version of this Clipboard Daemon. (Mainly because then I don't
have to worry about pointers and free-ing memory and all that sh*t
nobody really wants to care about)


> 1. The ability to press CTRL+C in a selection in an app, close the app, open another 
> app, then press CTRL+V



> 2. The ability to make a selection, and use the middle mouse button to paste the selection
> even after the selection is lost. ie. the middle mouse button pastes the last selection
> instead of being limited to the current one.


Well, you will have a VERY hard time getting that working :-). The
mouse-selection a.k.a. the PRIMARY selection is not very flexible
because selecting text happens to be one of the standard things a common
user does all the time, even when he or she is not planning to do
CopyPasting with it. If you steel the ownership of the PRIMARY... then
right after one selects some text, it will get unselected. If you create
a poller (this is what GCM does when you enable the mouse-selection in
the preferences) then you will have to compare the last
PRIMARY-clipboard with the current one to know if you have to collect it
or not. I do this by comparing the clipboard-owner (wich does not take
very much CPU) but then .. if you want to collect a new clipboard (from
the PRIMARY) you first have to make another Widget the clipboard
owner... 

Or you must get each clipboard everytime and compare all it's contents 
with the last collected clipboard (this means VERY much CPU for what it
is).

The not fun part of being a Clipboard Manager is that you can only know
when you LOST the clipboard... you cannot know when you don't OWN the
clipboard when another application receives ownership of the Clipboard.
IMHO the "REAL" fix would be fixing X and creating something like a
global event (signal) for that. But I don't see that happening in a
short time.


> Number 1 can probably be lifted straight out of gcm, but AFAICT gcm for all it's features
> can't do 2 (Klipper can so that code might be a pointer as to how to do it). What
> gcm does if you tell it to monitor selections is that it makes selecting something the 
> equivelent of selecting it and pressing CTRL+C which I think is very confusing behavior.


> 'nyway, as I said, I'll look at it in august if it's still not done by then :/

-- 
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
work: Philip dot VanHoof at cronos dot be
http://www.freax.be, http://www.freax.eu.org




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