views:

104

answers:

4

Hi, I'm just wondering where in the source files of a linux kernel I would be able to find the code which takes care of copying and pasting? I'm interested in modifying it but don't know where to look to find it.

Thanks

+1  A: 

I don't think Linux handles copy paste. The kernel's function is to handle interaction between the hardware and the OS.

Usually that behavior(copy/paste) is part of the applications you may use.

Try looking in the source code for emacs or vi for examples.

Joao Heleno
how then you can copy from one app and past to another?
Andrey
@Andrey It's handled by X.
anon
I think the confusion of Andrey (and indeed this entire question) is a by-product of the poor separation of concerns in MS Windows.
rmeador
+11  A: 

Clipboard functionality is indeed not handled by the kernel but instead by the X window system and the active desktop manager (Gnome, KDE).

Take a look here: http://en.wikipedia.org/wiki/Clipboard_%28software%29#X_Window_System

The usage and handling of various selections is not standardized. However most modern toolkits and desktop environments, such as GNOME or KDE, follow a widely accepted convention, outlined in the freedesktop.org specification.

Tiberiu Ana
you might more properly say that it's handled by X _or_ the desktop manager. AFAIK, the X and KDE clipboards are separate (the former accessible by highlight/middle-click, the latter by ctrl+x/ctrl+v)
rmeador
+1  A: 

This sort of thing is not handled by the kernel, but by the X windowing system and applications.

I suggest you read this wikipedia article on X Window selection

Hasturkun
+2  A: 

All you X addicts forget about the lovely console (and with that I don't mean terminal emulators like xterm and urxvt)! At the console, the copy-paste functionality is provided by gpm.

Marcel Korpel
It would be useful if the questioner confirmed. Do people still run gpm? I recall it being around in old Red Hat days but notice there is no sign of it on my current systems.
stsquad
@stsquad: I know several people running Linux who still use the console. In my distribution, installing gpm is as easy as `pacman -S gpm` and I guess it's equally easy on other distro's.
Marcel Korpel