]> git.saurik.com Git - wxWidgets.git/commitdiff
1. Moved m_usePrimary to wxClipboardBase as it's now also used by wxMSW/wxMac
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 31 Mar 2007 02:57:55 +0000 (02:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 31 Mar 2007 02:57:55 +0000 (02:57 +0000)
2. Added IsUsingPrimarySelection()
3. Fail all clipboard operations when IsUsingPrimarySelection() is true on
   non-X11 platforms

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45183 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

16 files changed:
docs/latex/wx/clipbrd.tex
include/wx/clipbrd.h
include/wx/gtk/clipbrd.h
include/wx/gtk1/clipbrd.h
include/wx/mac/carbon/clipbrd.h
include/wx/mgl/clipbrd.h
include/wx/motif/clipbrd.h
include/wx/msw/clipbrd.h
include/wx/os2/clipbrd.h
include/wx/palmos/clipbrd.h
include/wx/x11/clipbrd.h
src/gtk/clipbrd.cpp
src/gtk1/clipbrd.cpp
src/mac/carbon/clipbrd.cpp
src/msw/clipbrd.cpp
src/x11/clipbrd.cpp

index a216479e018081c9fc45bedf2bb07b0794c47b64..cba1926fb16a755ae0f120a49f0507c212cd3ea5 100644 (file)
@@ -52,18 +52,21 @@ For example:
 
 \latexignore{\rtfignore{\wxheading{Members}}}
 
 
 \latexignore{\rtfignore{\wxheading{Members}}}
 
+
 \membersection{wxClipboard::wxClipboard}\label{wxclipboardctor}
 
 \func{}{wxClipboard}{\void}
 
 Constructor.
 
 \membersection{wxClipboard::wxClipboard}\label{wxclipboardctor}
 
 \func{}{wxClipboard}{\void}
 
 Constructor.
 
+
 \membersection{wxClipboard::\destruct{wxClipboard}}\label{wxclipboarddtor}
 
 \func{}{\destruct{wxClipboard}}{\void}
 
 Destructor.
 
 \membersection{wxClipboard::\destruct{wxClipboard}}\label{wxclipboarddtor}
 
 \func{}{\destruct{wxClipboard}}{\void}
 
 Destructor.
 
+
 \membersection{wxClipboard::AddData}\label{wxclipboardadddata}
 
 \func{bool}{AddData}{\param{wxDataObject*}{ data}}
 \membersection{wxClipboard::AddData}\label{wxclipboardadddata}
 
 \func{bool}{AddData}{\param{wxDataObject*}{ data}}
@@ -78,18 +81,21 @@ the data explicitly.
 
 \helpref{wxClipboard::SetData}{wxclipboardsetdata}
 
 
 \helpref{wxClipboard::SetData}{wxclipboardsetdata}
 
+
 \membersection{wxClipboard::Clear}\label{wxclipboardclear}
 
 \func{void}{Clear}{\void}
 
 Clears the global clipboard object and the system's clipboard if possible.
 
 \membersection{wxClipboard::Clear}\label{wxclipboardclear}
 
 \func{void}{Clear}{\void}
 
 Clears the global clipboard object and the system's clipboard if possible.
 
+
 \membersection{wxClipboard::Close}\label{wxclipboardclose}
 
 \func{void}{Close}{\void}
 
 Call this function to close the clipboard, having opened it with \helpref{wxClipboard::Open}{wxclipboardopen}.
 
 \membersection{wxClipboard::Close}\label{wxclipboardclose}
 
 \func{void}{Close}{\void}
 
 Call this function to close the clipboard, having opened it with \helpref{wxClipboard::Open}{wxclipboardopen}.
 
+
 \membersection{wxClipboard::Flush}\label{wxclipboardflush}
 
 \func{bool}{Flush}{\void}
 \membersection{wxClipboard::Flush}\label{wxclipboardflush}
 
 \func{bool}{Flush}{\void}
@@ -99,6 +105,7 @@ clipboard will stay available even after the application exits (possibly
 eating memory), otherwise the clipboard will be emptied on exit.
 Returns false if the operation is unsuccessful for any reason.
 
 eating memory), otherwise the clipboard will be emptied on exit.
 Returns false if the operation is unsuccessful for any reason.
 
+
 \membersection{wxClipboard::GetData}\label{wxclipboardgetdata}
 
 \func{bool}{GetData}{\param{wxDataObject\&}{ data}}
 \membersection{wxClipboard::GetData}\label{wxclipboardgetdata}
 
 \func{bool}{GetData}{\param{wxDataObject\&}{ data}}
@@ -106,18 +113,29 @@ Returns false if the operation is unsuccessful for any reason.
 Call this function to fill {\it data} with data on the clipboard, if available in the required
 format. Returns true on success.
 
 Call this function to fill {\it data} with data on the clipboard, if available in the required
 format. Returns true on success.
 
+
 \membersection{wxClipboard::IsOpened}\label{wxclipboardisopened}
 
 \constfunc{bool}{IsOpened}{\void}
 
 Returns true if the clipboard has been opened.
 
 \membersection{wxClipboard::IsOpened}\label{wxclipboardisopened}
 
 \constfunc{bool}{IsOpened}{\void}
 
 Returns true if the clipboard has been opened.
 
+
 \membersection{wxClipboard::IsSupported}\label{wxclipboardissupported}
 
 \func{bool}{IsSupported}{\param{const wxDataFormat\&}{ format}}
 
 Returns true if there is data which matches the data format of the given data object currently {\bf available} (IsSupported sounds like a misnomer, FIXME: better deprecate this name?) on the clipboard.
 
 \membersection{wxClipboard::IsSupported}\label{wxclipboardissupported}
 
 \func{bool}{IsSupported}{\param{const wxDataFormat\&}{ format}}
 
 Returns true if there is data which matches the data format of the given data object currently {\bf available} (IsSupported sounds like a misnomer, FIXME: better deprecate this name?) on the clipboard.
 
+
+\membersection{wxClipboard::IsUsingPrimarySelection}\label{wxclipboardisusingprimaryselection}
+
+\constfunc{bool}{IsUsingPrimarySelection}{\void}
+
+Returns \true if we are using the primary selection, \false if clipboard one.
+See \helpref{UsePrimarySelection}{wxclipboarduseprimary} for more information.
+
+
 \membersection{wxClipboard::Open}\label{wxclipboardopen}
 
 \func{bool}{Open}{\void}
 \membersection{wxClipboard::Open}\label{wxclipboardopen}
 
 \func{bool}{Open}{\void}
@@ -130,6 +148,7 @@ should keep the clipboard open for only a very short time.
 
 Returns true on success. This should be tested (as in the sample shown above).
 
 
 Returns true on success. This should be tested (as in the sample shown above).
 
+
 \membersection{wxClipboard::SetData}\label{wxclipboardsetdata}
 
 \func{bool}{SetData}{\param{wxDataObject*}{ data}}
 \membersection{wxClipboard::SetData}\label{wxclipboardsetdata}
 
 \func{bool}{SetData}{\param{wxDataObject*}{ data}}
@@ -145,12 +164,21 @@ the data explicitly.
 
 \helpref{wxClipboard::AddData}{wxclipboardadddata}
 
 
 \helpref{wxClipboard::AddData}{wxclipboardadddata}
 
+
 \membersection{wxClipboard::UsePrimarySelection}\label{wxclipboarduseprimary}
 
 \func{void}{UsePrimarySelection}{\param{bool}{ primary = true}}
 
 \membersection{wxClipboard::UsePrimarySelection}\label{wxclipboarduseprimary}
 
 \func{void}{UsePrimarySelection}{\param{bool}{ primary = true}}
 
-On platforms supporting it (currently only GTK), selects the so called
-PRIMARY SELECTION as the clipboard as opposed to the normal clipboard,
-if {\it primary} is true.
-
+On platforms supporting it (all X11-based ports), wxClipboard uses the
+CLIPBOARD X11 selection by default. When this function is called with \true
+argument, all subsequent clipboard operations will use PRIMARY selection until
+this function is called again with \false.
+
+On the other platforms, there is no PRIMARY selection and so all clipboard
+operations will fail. This allows to implement the standard X11 handling of the
+clipboard which consists in copying data to the CLIPBOARD selection only when
+the user explicitly requests it (i.e. by selection \texttt{"Copy"} menu
+command) but putting the currently selected text into the PRIMARY selection
+automatically, without overwriting the normal clipboard contents with the
+currently selected text on the other platforms.
 
 
index c749a4e675c8cd11d98ba5f31f0e90ce87076e5e..122bbf7227c8d35281009bb5662c17d4123b3884 100644 (file)
@@ -35,7 +35,7 @@ class WXDLLEXPORT wxClipboard;
 class WXDLLEXPORT wxClipboardBase : public wxObject
 {
 public:
 class WXDLLEXPORT wxClipboardBase : public wxObject
 {
 public:
-    wxClipboardBase() {}
+    wxClipboardBase() { m_usePrimary = false; }
 
     // open the clipboard before Add/SetData() and GetData()
     virtual bool Open() = 0;
 
     // open the clipboard before Add/SetData() and GetData()
     virtual bool Open() = 0;
@@ -70,11 +70,28 @@ public:
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush() { return false; }
 
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush() { return false; }
 
-    // X11 has two clipboards which get selected by this call. Empty on MSW.
-    virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { }
+    // this allows to choose whether we work with CLIPBOARD (default) or
+    // PRIMARY selection on X11-based systems
+    //
+    // on the other ones, working with primary selection does nothing: this
+    // allows to write code which sets the primary selection when something is
+    // selected without any ill effects (i.e. without overwriting the
+    // clipboard which would be wrong on the platforms without X11 PRIMARY)
+    virtual void UsePrimarySelection(bool usePrimary = false)
+    {
+        m_usePrimary = usePrimary;
+    }
+
+    // return true if we're using primary selection
+    bool IsUsingPrimarySelection() const { return m_usePrimary; }
 
     // Returns global instance (wxTheClipboard) of the object:
     static wxClipboard *Get();
 
     // Returns global instance (wxTheClipboard) of the object:
     static wxClipboard *Get();
+
+
+    // don't use this directly, it is public for compatibility with some ports
+    // (wxX11, wxMotif, ...) only
+    bool m_usePrimary;
 };
 
 // ----------------------------------------------------------------------------
 };
 
 // ----------------------------------------------------------------------------
index d9f59e75b1ab4fdcb1f140b9e8f9410f808881f0..df956005426450f824b76ddad05f91f2bd57cdf6 100644 (file)
@@ -52,11 +52,7 @@ public:
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
-    // If primary == TRUE, use primary selection in all further ops,
-    // primary == FALSE resets it.
-    virtual void UsePrimarySelection(bool primary = TRUE)
-        { m_usePrimary = primary; }
-    
+
 
     // implementation from now on
     // --------------------------
 
     // implementation from now on
     // --------------------------
@@ -111,7 +107,6 @@ private:
     GtkWidget *m_targetsWidget;    // for getting list of supported formats
 
     bool m_open;
     GtkWidget *m_targetsWidget;    // for getting list of supported formats
 
     bool m_open;
-    bool m_usePrimary;
     bool m_formatSupported;
 
 
     bool m_formatSupported;
 
 
index c5cda19136961f22e6ebb0e6a09c62b4b047959f..eb0240467841464186c1704195f099df4b6c5e2c 100644 (file)
@@ -53,11 +53,6 @@ public:
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
-    // If primary == TRUE, use primary selection in all further ops,
-    // primary == FALSE resets it.
-    virtual void UsePrimarySelection(bool primary = TRUE)
-        { m_usePrimary = primary; }
-
     // implementation from now on
     bool              m_open;
     bool              m_ownsClipboard;
     // implementation from now on
     bool              m_open;
     bool              m_ownsClipboard;
@@ -70,7 +65,6 @@ public:
 
     bool              m_formatSupported;
     GdkAtom           m_targetRequested;
 
     bool              m_formatSupported;
     GdkAtom           m_targetRequested;
-    bool              m_usePrimary;
     wxDataObject     *m_receivedData;
 
 private:
     wxDataObject     *m_receivedData;
 
 private:
index f484bbd7d3c044f0834c40f7f623ef83db565d3b..1ad2c356ae4951140be01499002da5578bce2869 100644 (file)
@@ -63,9 +63,6 @@ public:
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
-    // X11 has two clipboards which get selected by this call. Empty on MSW.
-    void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
-
 private:
     wxDataObject     *m_data;
     bool              m_open;
 private:
     wxDataObject     *m_data;
     bool              m_open;
@@ -73,5 +70,4 @@ private:
 
 #endif // wxUSE_CLIPBOARD
 
 
 #endif // wxUSE_CLIPBOARD
 
-#endif
-    // _WX_CLIPBRD_H_
+#endif // _WX_CLIPBRD_H_
index 98a82d114954689ceb8c8a39b7488f9ab4751943..307cc8de0bb52c802de69947b72792c175f952c8 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        clipboard.h
+// Name:        wx/mgl/clipboard.h
 // Purpose:
 // Author:      Vaclav Slavik
 // Id:          $Id$
 // Purpose:
 // Author:      Vaclav Slavik
 // Id:          $Id$
@@ -52,11 +52,6 @@ public:
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear() {}
 
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear() {}
 
-    // If primary == TRUE, use primary selection in all further ops,
-    // primary == FALSE resets it.
-    virtual void UsePrimarySelection(bool primary = TRUE)
-        { m_usePrimary = primary; }
-    
     // implementation from now on
     bool              m_open;
     bool              m_ownsClipboard;
     // implementation from now on
     bool              m_open;
     bool              m_ownsClipboard;
@@ -69,7 +64,6 @@ public:
 
     bool              m_formatSupported;
     GdkAtom           m_targetRequested;
 
     bool              m_formatSupported;
     GdkAtom           m_targetRequested;
-    bool              m_usePrimary;
     wxDataObject     *m_receivedData;
 
 private:
     wxDataObject     *m_receivedData;
 
 private:
index 7aecda908dcb8b92b7821b50adfb7dcef3c7ac6b..00210ca1ffc68ebed7ead7bf31d02ada23a6282f 100644 (file)
@@ -67,13 +67,9 @@ public:
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
-    virtual void UsePrimarySelection(bool primary = true)
-    { m_usePrimary = primary; }
-
     // implementation from now on
     bool              m_open;
     wxDataObjectList  m_data;
     // implementation from now on
     bool              m_open;
     wxDataObjectList  m_data;
-    bool              m_usePrimary;
     wxDataIdToDataObjectList m_idToObject;
 
 private:
     wxDataIdToDataObjectList m_idToObject;
 
 private:
@@ -82,5 +78,4 @@ private:
 
 #endif // wxUSE_CLIPBOARD
 
 
 #endif // wxUSE_CLIPBOARD
 
-#endif
-// _WX_CLIPBRD_H_
+#endif // _WX_CLIPBRD_H_
index 3d0277004e3af44620df922dff0b683ce68013f9..2a760e267641ebe5d40337a3173f09fb765deed7 100644 (file)
@@ -85,14 +85,11 @@ public:
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
-    // X11 has two clipboards which get selected by this call. Empty on MSW.
-    void UsePrimarySelection( bool WXUNUSED(primary) = false ) { }
-
 private:
     IDataObject *m_lastDataObject;
     bool m_isOpened;
 };
 
 #endif // wxUSE_CLIPBOARD
 private:
     IDataObject *m_lastDataObject;
     bool m_isOpened;
 };
 
 #endif // wxUSE_CLIPBOARD
-#endif
-    // _WX_CLIPBRD_H_
+
+#endif // _WX_CLIPBRD_H_
index 522d5641a0b34426ab9c714d31d6cc9e6dee0e0a..729b956dfe28c6cabb75ee1aad62eeeb95fc0aac 100644 (file)
@@ -88,13 +88,9 @@ public:
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
-    // X11 has two clipboards which get selected by this call. Empty on MSW.
-    void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
-
 private:
     bool m_clearOnExit;
 };
 
 #endif // wxUSE_CLIPBOARD
 private:
     bool m_clearOnExit;
 };
 
 #endif // wxUSE_CLIPBOARD
-#endif
-    // _WX_CLIPBRD_H_
+#endif // _WX_CLIPBRD_H_
index 3f8023f4ec47c1ec25b945438cc4b9726f35ecc8..8d6e19fab9d89444444b9acac8bd7fe7915fa39b 100644 (file)
@@ -85,9 +85,6 @@ public:
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
     // eating memory), otherwise the clipboard will be emptied on exit
     virtual bool Flush();
 
-    // X11 has two clipboards which get selected by this call. Empty on MSW.
-    void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
-
 private:
     bool m_clearOnExit;
     bool m_isOpened;
 private:
     bool m_clearOnExit;
     bool m_isOpened;
index 326e70c48a52e3329edfa8b39c110d83afa731e6..48a7c70350257b07261cabc9a9e2f3f585423914 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        clipbrd.h
+// Name:        wx/x11/clipbrd.h
 // Purpose:     Clipboard functionality.
 // Author:      Robert Roebling
 // Created:     17/09/98
 // Purpose:     Clipboard functionality.
 // Author:      Robert Roebling
 // Created:     17/09/98
@@ -8,8 +8,8 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifndef __X11CLIPBOARDH__
-#define __X11CLIPBOARDH__
+#ifndef _WX_X11_CLIPBRD_H_
+#define _WX_X11_CLIPBRD_H_
 
 #if wxUSE_CLIPBOARD
 
 
 #if wxUSE_CLIPBOARD
 
@@ -53,11 +53,6 @@ public:
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
     // clears wxTheClipboard and the system's clipboard if possible
     virtual void Clear();
 
-    // If primary == TRUE, use primary selection in all further ops,
-    // primary == FALSE resets it.
-    virtual void UsePrimarySelection(bool primary = TRUE)
-        { m_usePrimary = primary; }
-    
     // implementation from now on
     bool              m_open;
     bool              m_ownsClipboard;
     // implementation from now on
     bool              m_open;
     bool              m_ownsClipboard;
@@ -70,15 +65,12 @@ public:
 
     bool              m_formatSupported;
     Atom              m_targetRequested;
 
     bool              m_formatSupported;
     Atom              m_targetRequested;
-    bool              m_usePrimary;
     wxDataObject     *m_receivedData;
 
 private:
     DECLARE_DYNAMIC_CLASS(wxClipboard)
 };
 
     wxDataObject     *m_receivedData;
 
 private:
     DECLARE_DYNAMIC_CLASS(wxClipboard)
 };
 
-#endif
-   // wxUSE_CLIPBOARD
+#endif // wxUSE_CLIPBOARD
 
 
-#endif
-    // __X11CLIPBOARDH__
+#endif // _WX_X11_CLIPBRD_H_
index e6b79180a1788863e5edceef654a7f47c18bc9b8..628a663fbd4a8de9357e351628c793a1ea28ee78 100644 (file)
@@ -347,8 +347,6 @@ wxClipboard::wxClipboard()
     m_formatSupported = false;
     m_targetRequested = 0;
 
     m_formatSupported = false;
     m_targetRequested = 0;
 
-    m_usePrimary = false;
-
     // we use m_targetsWidget to query what formats are available
     m_targetsWidget = gtk_window_new( GTK_WINDOW_POPUP );
     gtk_widget_realize( m_targetsWidget );
     // we use m_targetsWidget to query what formats are available
     m_targetsWidget = gtk_window_new( GTK_WINDOW_POPUP );
     gtk_widget_realize( m_targetsWidget );
index fc8309b47bda74895a589c9c1fd98895d9d5d4bd..2d1ade92eccd9e7d8693f876022a2754e92ee708 100644 (file)
@@ -347,8 +347,6 @@ wxClipboard::wxClipboard()
 
     m_formatSupported = false;
     m_targetRequested = 0;
 
     m_formatSupported = false;
     m_targetRequested = 0;
-
-    m_usePrimary = false;
 }
 
 wxClipboard::~wxClipboard()
 }
 
 wxClipboard::~wxClipboard()
index d0ea791e8b9a7509530637a118b2b23e64473557..413b80df02e48e5b2580af1f659667d422e0c5d8 100644 (file)
@@ -173,6 +173,9 @@ wxClipboard::~wxClipboard()
 
 void wxClipboard::Clear()
 {
 
 void wxClipboard::Clear()
 {
+    if ( IsUsingPrimarySelection() )
+        return;
+
     if (m_data != NULL)
     {
         delete m_data;
     if (m_data != NULL)
     {
         delete m_data;
@@ -214,6 +217,9 @@ bool wxClipboard::IsOpened() const
 
 bool wxClipboard::SetData( wxDataObject *data )
 {
 
 bool wxClipboard::SetData( wxDataObject *data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
     wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
     wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
@@ -226,6 +232,9 @@ bool wxClipboard::SetData( wxDataObject *data )
 
 bool wxClipboard::AddData( wxDataObject *data )
 {
 
 bool wxClipboard::AddData( wxDataObject *data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
     wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
     wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
@@ -320,6 +329,9 @@ void wxClipboard::Close()
 
 bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
 {
 
 bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
     if ( m_data )
         return m_data->IsSupported( dataFormat );
 
     if ( m_data )
         return m_data->IsSupported( dataFormat );
 
@@ -370,6 +382,9 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
 
 bool wxClipboard::GetData( wxDataObject& data )
 {
 
 bool wxClipboard::GetData( wxDataObject& data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
     wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
 
     size_t formatcount = data.GetFormatCount() + 1;
     wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
 
     size_t formatcount = data.GetFormatCount() + 1;
index 4a1518b0ff247fe687f53a67f20627cde559030b..2369d769fb015b47c5ced071a2ac781c701010dc 100644 (file)
@@ -547,6 +547,9 @@ wxClipboard::~wxClipboard()
 
 void wxClipboard::Clear()
 {
 
 void wxClipboard::Clear()
 {
+    if ( IsUsingPrimarySelection() )
+        return;
+
 #if wxUSE_OLE_CLIPBOARD
     if (m_lastDataObject)
     {
 #if wxUSE_OLE_CLIPBOARD
     if (m_lastDataObject)
     {
@@ -613,6 +616,9 @@ bool wxClipboard::IsOpened() const
 
 bool wxClipboard::SetData( wxDataObject *data )
 {
 
 bool wxClipboard::SetData( wxDataObject *data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
 #if !wxUSE_OLE_CLIPBOARD
     (void)wxEmptyClipboard();
 #endif // wxUSE_OLE_CLIPBOARD
 #if !wxUSE_OLE_CLIPBOARD
     (void)wxEmptyClipboard();
 #endif // wxUSE_OLE_CLIPBOARD
@@ -625,6 +631,9 @@ bool wxClipboard::SetData( wxDataObject *data )
 
 bool wxClipboard::AddData( wxDataObject *data )
 {
 
 bool wxClipboard::AddData( wxDataObject *data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
 #if wxUSE_OLE_CLIPBOARD
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
 #if wxUSE_OLE_CLIPBOARD
@@ -718,11 +727,14 @@ void wxClipboard::Close()
 
 bool wxClipboard::IsSupported( const wxDataFormat& format )
 {
 
 bool wxClipboard::IsSupported( const wxDataFormat& format )
 {
-    return wxIsClipboardFormatAvailable(format);
+    return !IsUsingPrimarySelection() && wxIsClipboardFormatAvailable(format);
 }
 
 bool wxClipboard::GetData( wxDataObject& data )
 {
 }
 
 bool wxClipboard::GetData( wxDataObject& data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
 #if wxUSE_OLE_CLIPBOARD
     IDataObject *pDataObject = NULL;
     HRESULT hr = OleGetClipboard(&pDataObject);
 #if wxUSE_OLE_CLIPBOARD
     IDataObject *pDataObject = NULL;
     HRESULT hr = OleGetClipboard(&pDataObject);
index 69494fb10b592c9b90c5546a1520926c3081bbb5..a523296de8f9179c56a05b398c8832896534deca 100644 (file)
@@ -306,8 +306,6 @@ wxClipboard::wxClipboard()
 
     m_formatSupported = false;
     m_targetRequested = 0;
 
     m_formatSupported = false;
     m_targetRequested = 0;
-
-    m_usePrimary = false;
 }
 
 wxClipboard::~wxClipboard()
 }
 
 wxClipboard::~wxClipboard()