+ wxCHECK_MSG( m_targetRequested, false, wxT("invalid clipboard format") );
+
+ m_formatSupported = false;
+
+ /* perform query. this will set m_formatSupported to
+ true if m_targetRequested is supported.
+ also, we have to wait for the "answer" from the
+ clipboard owner which is an asynchronous process.
+ therefore we set m_waiting = true here and wait
+ until the callback "targets_selection_received"
+ sets it to false */
+
+ m_waiting = true;
+
+ gtk_selection_convert( m_targetsWidget,
+ m_usePrimary ? (GdkAtom)GDK_SELECTION_PRIMARY
+ : g_clipboardAtom,
+ g_targetsAtom,
+ (guint32) GDK_CURRENT_TIME );
+
+ while (m_waiting) gtk_main_iteration();
+
+ if (!m_formatSupported) continue;
+
+ /* store pointer to data object to be filled up by callbacks */
+ m_receivedData = &data;
+
+ /* store requested format to be asked for by callbacks */
+ m_targetRequested = format;
+
+ wxCHECK_MSG( m_targetRequested, false, wxT("invalid clipboard format") );
+
+ /* start query */
+ m_formatSupported = false;
+
+ /* ask for clipboard contents. this will set
+ m_formatSupported to true if m_targetRequested
+ is supported.
+ also, we have to wait for the "answer" from the
+ clipboard owner which is an asynchronous process.
+ therefore we set m_waiting = true here and wait
+ until the callback "targets_selection_received"
+ sets it to false */
+
+ m_waiting = true;
+
+ wxLogTrace( TRACE_CLIPBOARD,
+ wxT("wxClipboard::GetData: format found, start convert") );
+
+ gtk_selection_convert( m_clipboardWidget,
+ m_usePrimary ? (GdkAtom)GDK_SELECTION_PRIMARY
+ : g_clipboardAtom,
+ m_targetRequested,
+ (guint32) GDK_CURRENT_TIME );
+
+ while (m_waiting) gtk_main_iteration();
+
+ /* this is a true error as we checked for the presence of such data before */
+ wxCHECK_MSG( m_formatSupported, false, wxT("error retrieving data from clipboard") );
+
+ /* return success */
+ delete[] array;
+ return true;
+ }
+
+ wxLogTrace( TRACE_CLIPBOARD,
+ wxT("wxClipboard::GetData: format not found") );
+
+ /* return failure */
+ delete[] array;
+ return false;