The Linux GUI Experience

The Linux GUI Experience

Sections: 1 | 2 | 3 | 4 | 5 | 6 | Index | Next >

The Clipboard, Text, And Objects

Learning objective: Explain issues with the use of the clipboard in Linux


Click on image to enlarge.

The X Window System commonly used on Unix and Linux systems provides a clipboard implementation via selections. Selections are asynchronous, so data is copied and converted into the desired format only on-demand. 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. One selection, CLIPBOARD, is used for traditional clipboard semantics, with shortcuts similar to Windows. Another selection, PRIMARY, is an X11-specific mechanism. Data is "copied" immediately upon highlighting and pasted with the third (middle) mouse button. This is usually separate from the CLIPBOARD selection and does not change its contents. [Wikipedia]

In the Linux GUI environment, there are a series of clipboard managers that can be used by any given Linux desktop. They have their own set of protocols that, in general, achieve the same results in the same ways. Linux is text centric when it comes to copying content.

Text and objects*

You can cut, copy and paste almost anything between supported applications: images, tables, text formatting like bold and italic, URLs and almost all other elements for that matter. Too bad supported applications currently means OpenOffice.org, Mozilla and KDE based. [Linux Reviews]

Glipper

Glipper is a clipboard utility for the GNOME panel. It allows users of Unix-like operating systems to access a history of X Selections, any item of which can be reselected for pasting. Glipper is often described as the GNOME counterpart to KDE's Klipper. Older versions of Glipper could also be run outside of GNOME, but the newest version 1.0 is GNOME only because of its heavy integration into different GNOME techniques. [Wikipedia]

Klipper

Klipper is a clipboard utility for the KDE interface. It allows users of Unix-like operating systems running the KDE desktop environment to access a history of X Selections, any item of which can be reselected for pasting. It can also be used to react automatically if a certain text is selected (e.g. opening an URL in a browser). [Wikipedia]

XDND Drag-and-drop

Drag-and-drop in the X Window System is regulated by the Xdnd convention. When the user drags the selected text into a window and releases the mouse button, the exchange of data is done as for the primary selection. Drag-and-drop is complicated by what happens during the drag. Namely, when the user drags the selection to different parts of the desktop or a window, the user expects to be able to tell whether text can be dropped or not. In particular, the target should display visual feedback on whether or not it will accept the drop, and the cursor should change to indicate the action that will be taken; e.g., copy or move. In the Xdnd protocol, the window where the text is selected and the drag begins is called the source; the window over which the cursor hovers is called the target. The communication between the source and the target is driven by the source because the source "grabs" the cursor. An exchange between source and target is therefore necessary in order for the target to even know that drag-and-drop is happening. Since the source decides the shape of the cursor, the source must receive a response from the target in order to update the cursor. In addition, since the target may need to draw a bombsight to indicate where the drop will occur, and since acceptance of the drop may depend on the exact location of the cursor, this exchange must happen repeatedly as the cursor moves. In fact, even if the cursor does not move, messages must be exchanged to allow the target to scroll when the cursor is near an edge of the viewing area. Otherwise, the user will only be able to drop on the visible portion of the target. [Wikipedia]

Cut buffers

Cut buffers are another mechanism to transfer data, in particular selected text. They are window properties of the root window, named CUT_BUFFER1, etc. Unlike selections, cut buffers do not involve a direct interaction between clients. Rather, when text is selected in a window, the window owner copies this text into the property of the root window called CUT_BUFFER1. When the user pastes the text in another window, the window owner reads this property of the root window. The xcutsel program transfers data between selections and cut buffers, and the xcb program allows various kinds of access to the cut buffers. Cut buffers are considered obsolete. [Wikipedia]

Thinking: Why favor text over objects with respect to the clipboard in Linux?

Key terms: clipboard, objects, text

Resources:
To maximize your learning, please visit these Web sites and review their content to help reinforce the concepts presented in this section.

Quick links:
Clipboard @ Wikipedia
X11 clipboard @ Linux Reviews
Glipper @ Wikipedia
Klipper @ Wikipedia
X Window selection @ Wikipedia

Embedded Resources

Notes on navigation: Click inside the frame to navigate the embedded Web page. - Click outside the frame to navigate this page to scroll up/down between the embedded Web pages. - Click on the frame title to open that page in a new tab in most browsers. - Click on the the "Reload page" link to reload the original page for that frame.

Clipboard @ Wikipedia | Reload page | If frame is empty, click on the link to view the page in a new tab or window

X11 clipboard @ Linux Reviews | Reload page | If frame is empty, click on the link to view the page in a new tab or window

Glipper @ Wikipedia | Reload page | If frame is empty, click on the link to view the page in a new tab or window

Klipper @ Wikipedia | Reload page | If frame is empty, click on the link to view the page in a new tab or window

X Window selection @ Wikipedia | Reload page | If frame is empty, click on the link to view the page in a new tab or window

Sections: 1 | 2 | 3 | 4 | 5 | 6 | Index | Next >