Last Comment Bug 392159 - Middle-click paste doesn't work under Mac OS X when middlemouse.paste is true
: Middle-click paste doesn't work under Mac OS X when middlemouse.paste is true
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Editor (show other bugs)
: Trunk
: All Mac OS X
: -- normal (vote)
: mozilla11
Assigned To: Masayuki Nakano [:masayuki] (Mozilla Japan)
:
: Makoto Kato [:m_kato]
Mentors:
Depends on: 674770
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-14 02:16 PDT by Vincent Lefevre
Modified: 2011-11-30 03:59 PST (History)
8 users (show)
masayuki: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (5.87 KB, patch)
2011-10-28 01:11 PDT, Masayuki Nakano [:masayuki] (Mozilla Japan)
no flags Details | Diff | Splinter Review
Patch (4.93 KB, patch)
2011-11-26 19:52 PST, Masayuki Nakano [:masayuki] (Mozilla Japan)
ehsan: review+
Details | Diff | Splinter Review

Description Vincent Lefevre 2007-08-14 02:16:29 PDT
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Build Identifier: 

As documented in http://kb.mozillazine.org/Middlemouse.paste, I've set middlemouse.paste to true to be able to paste with the middle button, but this has no effect.

Reproducible: Always

Steps to Reproduce:
1. Set middlemouse.paste to true.
2. Copy something to the clipboard.
3. Middle-click over an editable text field.
Actual Results:  
Nothing happens.

Expected Results:  
The contents of the clipboard should be pasted, like under Linux.
Comment 1 Steven Michaud [:smichaud] (Retired) 2007-08-14 08:26:57 PDT
This is a problem with both Firefox 2.0.0.6 and yesterday's Minefield
nightly, and so (presumably) with both Cocoa widgets and Mac widgets.
Comment 2 Wayne Mery (:wsmwk, NI for questions) 2010-08-04 07:56:32 PDT
ludo, can you reproduce?
Comment 3 Masayuki Nakano [:masayuki] (Mozilla Japan) 2011-10-27 19:27:38 PDT
MacOS X doesn't have a clipboard for primary selection.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/Reference/Reference.html

So, we should use global clipboard for the middle paste.

# And we should get rid of #ifdef from the nsEditorEventHandler.cpp.
Comment 4 Masayuki Nakano [:masayuki] (Mozilla Japan) 2011-10-28 01:11:59 PDT
Created attachment 570206 [details] [diff] [review]
Patch
Comment 5 :Ehsan Akhgari 2011-11-25 08:53:05 PST
Comment on attachment 570206 [details] [diff] [review]
Patch

Review of attachment 570206 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the nits below.

::: editor/libeditor/base/nsEditorEventListener.cpp
@@ +59,5 @@
>  
>  // Drag & Drop, Clipboard
>  #include "nsIServiceManager.h"
>  #include "nsIClipboard.h"
> +#include "nsWidgetsCID.h"

This can be removed (see below).

@@ +75,5 @@
>  #include "nsIBidiKeyboard.h"
>  
>  using namespace mozilla;
>  
> +static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);

This can be removed (see below).

@@ +572,5 @@
>          mailEditor = do_QueryObject(mEditor);
>  
> +      PRInt32 clipboard = nsIClipboard::kGlobalClipboard;
> +      nsCOMPtr<nsIClipboard> clipboardService =
> +        do_GetService(kCClipboardCID, &rv);

Please use do_GetService("@mozilla.org/widget/clipboard;1", &rv).
Comment 6 Masayuki Nakano [:masayuki] (Mozilla Japan) 2011-11-26 19:52:33 PST
Created attachment 577120 [details] [diff] [review]
Patch
Comment 7 :Ehsan Akhgari 2011-11-29 11:34:13 PST
Comment on attachment 577120 [details] [diff] [review]
Patch

Looks great, thanks!
Comment 8 Masayuki Nakano [:masayuki] (Mozilla Japan) 2011-11-29 18:59:11 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/f739602236da
Comment 9 Marco Bonardo [::mak] 2011-11-30 03:59:35 PST
https://hg.mozilla.org/mozilla-central/rev/f739602236da

Note You need to log in before you can comment on or make changes to this bug.