Comment 95 for bug 21202

Revision history for this message
In , Mozbugz (mozbugz) wrote :

(From update of attachment 411182)
>+nsClipboard::Store(void)
>+{
>+ if (mSelectionTransferable) {
>+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
>+ gtk_clipboard_store(clipboard);
>+ }
>+ if (mGlobalTransferable) {

http://freedesktop.org/wiki/ClipboardManager seems only intended for the
CLIPBOARD selection, not the PRIMARY. Also _gtk_clipboard_store_all() only
stores the CLIPBOARD, and gtk_clipboard_set_can_store() doesn't do anything when
clipboard->selection != GDK_SELECTION_CLIPBOARD so this first block won't do
anything, and so should be removed.

>+ PRBool ImagesAdded = PR_FALSE;

Variables in Mozilla usually start with lower case, so |imagesAdded|.
(Class names and function names start with upper case.)

>+ if (gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets,
>+ clipboard_get_cb, clipboard_clear_cb, (gpointer)this))

The (gpointer) cast should be unnecessary because |this| is a |void*|.

>+ if (aWhichClipboard == kSelectionClipboard) {
>+ mSelectionOwner = aOwner;
>+ mSelectionTransferable = aTransferable;
>+ }
>+ else {
>+ mGlobalOwner = aOwner;
>+ mGlobalTransferable = aTransferable;
>+ }
>
>+ gtk_clipboard_set_can_store(gtkClipboard, gtkTargets, numTargets);

Can you move gtk_clipboard_set_can_store to the else block, please. There's
no difference in functionality because it won't do anything when
aWhichClipboard == kSelectionClipboard, but it makes the intentions clearer.

r=karlt with these changes.