JDK-5078787 : Improve perf. of Windows clipboard and clear the way to enrich its functionality
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-07-27
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Currently our clipboard implementation on Windows employs
standard Clipboard API. In order to address issues like
4475722, 4696186, 4451371, 4808793 and one mentioned in
the comments section, it should be rewritten using
the OLE data transfer mechanism.

###@###.### 2004-07-27
###@###.### 2004-07-27
On Windows, when a Java app places data into the system
clipboard, then the app is queried for data in each available
data flavor. This may be expensive (e.g., lead to freezing of
the app for some time) if data are available in multiple flavors
(e.g., plain text, html text, image). However, data from the
clipboard are requested in only 1-2 flavors typically.
Our current implementation of the Windows clipboard is based on
Win32 functions SetClipboardData(), GetClipboardData() in essence.
I propose to change this inefficient behavior so that
data in a chosen flavor are queried only on demand of an app
that performs paste; in short, we'll use the functions
OLESetClipboard(IDataObject*), OLEGetClipboard(IDataObject**)
and the COM interface IDataObject.

Motivation

(a) Performance improvement, as explained above. 

(b) Microsoft Vista applications will mostly use the way of accessing
the clipboard using IDataObject COM interface since it's the only
way WinFX SDK provides. (Evidences will be given below.)

(c) Data in some clipboard formats (at least Shell clipboard formats)
can only be transferred via IDataObject and thus we'll clear the way
for further improvements of our clipboard data transfer.

(d) There is the RFE 4808793 (Allow initiation of drags without local data) 
that requests us to allow initiation of drags and copying of files that 
aren't available locally, which becomes more popular on SDN.
To implement this RFE on Windows, we need to support some 
Shell clipboard formats, therefore, according to (c),
we need to have the feature 'OLE clipboard' implemented.

(e) Improve commonality across platforms: Windows clipboard
behavior will be similar to the clipboard behavior on X platforms:
data set into the clipboard will be queried only on demand.

(f) Several bugs (partially) caused by prefetching data in
all flavors will disappear.

-----------------------------------------------------------


Below are my findings, which acknowledge the fact that Microsoft Vista
applications will mostly use the way of accessing the clipboard using
IDataObject COM interface, compatible with the proposed way.

1.
http://msdn.microsoft.com/windowsvista/about

Developer Platform Evolution

An evolution for both Win32? and WinFX? begins with Windows Vista-era
advances to the .NET Framework. These two programming models will
enable every developer to target the advances in Windows Vista,
including improved presentation and communication subsystems, improved
connectivity, and substantial advances in the core security,
manageability, and reliability of Windows.

It's important to note that Windows Vista is heavily emphasizing both
application compatibility (existing applications should always just
run) and developer compatibility (all features are accessible through
both WinFX and Win32). All existing source code and programming skills
apply for Windows Vista developers, whether they're C++/MFC developers
or Visual Basic .NET/Windows Forms developers.

2.
http://www.microsoft.com/com/default.mspx

Is COM still supported? Is it going away?

COM is a feature of Windows. Each version of Windows has a support
policy described in the Windows Product Lifecycle. COM continues to be
supported as part of Windows. COM is a feature of the next version of
Windows, Windows Vista.

3.
http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/T_System_Windows_Forms_Clipboard.asp
http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/T_System_Runtime_InteropServices_ComTypes_IDataObject.asp

WinFX SDK provides only one way for setting/getting data to/from
the clipboard: via the Clipboard class, which uses IDataObject
COM interface. So new Vista applications will mostly use this
way of accessing the clipboard.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
20-09-2004

EVALUATION It's better to implement this RFE before fixing 4818143 (NetBeans Hungs on sun.awt.datatransfer.ClipboardTransferable.getClipboardData) to provide more uniform behavior on Windows and X platforms. ###@###.### 2004-08-11
11-08-2004