Exemplo n.º 1
0
void Selection::SelectionReceivedCallback(GtkWidget* widget,GtkSelectionData *selection_data, guint time, Selection *oSelection)
{	
	gchar *result;
	result = (gchar *)gtk_selection_data_get_text (selection_data);
	if (!result) {
		/* If we asked for UTF8 and didn't get it, try compound_text;
		* if we asked for compound_text and didn't get it, try string;
		* If we asked for anything else and didn't get it, give up.
		*/
		if (selection_data->target == oSelection->UTF8_STRING_Atom) {
			gtk_selection_convert (widget, GDK_SELECTION_PRIMARY, oSelection->COMPOUND_TEXT_Atom, GDK_CURRENT_TIME);
		}
		else if (selection_data->target == oSelection->COMPOUND_TEXT_Atom)
		{
			gtk_selection_convert (widget, GDK_SELECTION_PRIMARY, GDK_TARGET_STRING, GDK_CURRENT_TIME);
		}
		else {
			oSelection->IsBusy = 0;
			oSelection->LastClipWord.clear();
		}
		return;
    }
	oSelection->IsBusy = 0;

	oSelection->SelectionReceived(result);	
	g_free (result);
}
Exemplo n.º 2
0
gint Selection::TimeOutCallback(gpointer data)
{
    Selection *oSelection = (Selection *)data;
  
    if (oSelection->IsBusy) {
        oSelection->IsBusy++;
        if (oSelection->IsBusy*SELECTION_INTERVAL > 8000 ) {
            //"selection_received" signal is not received for 8 seconds.
            //there encounter some error,and i find that this often take a long time (serveral minutes) to get the signal at last,
            //during this perioed,if you call gtk_selection_convert(),the "selection_received" signal will not be received also,
            //and at last these signals are received at almost the same time...BAD.
            //so here create a new selection_widget, then call gtk_selection_convert(). this should can throw that 
            //error selection.            
            g_warning("Error, selection data didn't received, retring!\n");
            oSelection->create_selection_widget();
            oSelection->IsBusy = 0;
        }
    } else {
        oSelection->IsBusy = 1;
        gtk_selection_convert (oSelection->selection_widget, GDK_SELECTION_PRIMARY, oSelection->UTF8_STRING_Atom, 
                               GDK_CURRENT_TIME);
    }

    return TRUE;
}
Exemplo n.º 3
0
gint Selection::TimeOutCallback(gpointer data)
{
  Selection *oSelection = (Selection *)data;
  if (oSelection->Enable()) {

		if (conf->get_bool("/apps/stardict/preferences/dictionary/only_scan_while_modifier_key")) {
      bool do_scan = gpAppFrame->unlock_keys->is_pressed();
      if (!do_scan)
				return true;
    }

    if (oSelection->IsBusy) {
      oSelection->IsBusy++;
      if (oSelection->IsBusy*SELECTION_INTERVAL > 8000 ) {
				//"selection_received" signal is not received for 8 seconds.
				//there encounter some error,and i find that this often take a long time (serveral minutes) to get the signal at last,
				//during this perioed,if you call gtk_selection_convert(),the "selection_received" signal will not be received also,
				//and at last these signals are received at almost the same time...BAD.
				
				//so here create a new selection_widget, then call gtk_selection_convert()...this should can throw that error selection.
				//!!!:
				//But this seems(i am not sure) will make the widgets in StarDict become unselectable! see BUGS.
				g_warning("Error, selection data didn't received, retring!\n");
				oSelection->create_selection_widget();
				oSelection->IsBusy = 0;
      }
    } else {
      oSelection->IsBusy = 1;
      gtk_selection_convert (oSelection->selection_widget, GDK_SELECTION_PRIMARY, oSelection->UTF8_STRING_Atom, GDK_CURRENT_TIME);
    }
  }

  return true;
}
Exemplo n.º 4
0
static VALUE
gtkdrag_selection_convert(VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE time)
{
    gboolean ret = gtk_selection_convert(RVAL2WIDGET(widget), 
                                         RVAL2ATOM(selection), RVAL2ATOM(target),
                                         NUM2INT(time));
    return CBOOL2RVAL(ret);
}
Exemplo n.º 5
0
gboolean DockLet::ButtonPressCallback(GtkWidget *button, GdkEventButton *event, DockLet *oDockLet)
{
	if (event->type != GDK_BUTTON_PRESS)
		return false;

	if (event->button ==1) {
		
		if ((event->state & GDK_CONTROL_MASK) && 
				!(event->state & GDK_MOD1_MASK) && 
				!(event->state & GDK_SHIFT_MASK)) {
      conf->set_bool("/apps/stardict/preferences/dictionary/scan_selection",
										 !conf->get_bool("/apps/stardict/preferences/dictionary/scan_selection"));
			return true;
    } else {			
			if (GTK_WIDGET_VISIBLE(gpAppFrame->window)) {
				//if (GTK_WINDOW(gpAppFrame->window)->is_active) {
				//if (my_gtk_window_get_active(gpAppFrame->window)) {
				gtk_widget_hide(gpAppFrame->window);
      }	else {
				gtk_window_present(GTK_WINDOW(gpAppFrame->window));
				if (gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(gpAppFrame->oTopWin.WordCombo)->entry))[0]) {
				  gtk_widget_grab_focus(gpAppFrame->oMidWin.oTextWin.view->Widget()); //so user can input word directly.
				} else {
					gtk_widget_grab_focus(GTK_COMBO(gpAppFrame->oTopWin.WordCombo)->entry); //this won't change selection text.
				}
			}
		}		
  } else if (event->button ==2) {
		if (conf->get_bool("/apps/stardict/preferences/notification_area_icon/query_in_floatwin")) {
			gpAppFrame->oSelection.LastClipWord.clear();
			gtk_selection_convert(gpAppFrame->oSelection.selection_widget, GDK_SELECTION_PRIMARY, gpAppFrame->oSelection.UTF8_STRING_Atom, GDK_CURRENT_TIME);
    } else {
			gtk_window_present(GTK_WINDOW(gpAppFrame->window));
			gtk_selection_convert (gpAppFrame->oMidWin.oTextWin.view->Widget(), GDK_SELECTION_PRIMARY, gpAppFrame->oSelection.UTF8_STRING_Atom, GDK_CURRENT_TIME);
		}
		return true;
  } else if (event->button ==3) {
		oDockLet->PopupMenu(event);
		return true;
	}
	return false;
}
Exemplo n.º 6
0
/*
 * clipboard conversion - inspired by Downloader for X too :)
 */
gboolean
time_conv_select()
{
	begin_func("time_conv_select");

	gtk_selection_convert(main_window,
			GDK_SELECTION_PRIMARY,
			GDK_TARGET_STRING,
			GDK_CURRENT_TIME);
	return_val(TRUE);
}
Exemplo n.º 7
0
/*
 * clipboard conversion - inspired by Downloader for X too :)
 */
gboolean
time_conv_select()
{
	begin_func("time_conv_select");

	gtk_selection_convert(main_window,
			clipboard,
			GDK_TARGET_STRING,
			GDK_CURRENT_TIME);
	return_val(TRUE);
}
Exemplo n.º 8
0
Arquivo: t31.cpp Projeto: ombt/ombt
/* Signal handler invoked when user clicks on the "Get Targets" button */
static void get_targets( GtkWidget *widget,
                         gpointer data )
{
    static GdkAtom targets_atom = GDK_NONE;
    GtkWidget *window = (GtkWidget *)data;

    /* Get the atom corresponding to the string "TARGETS" */
    if (targets_atom == GDK_NONE)
        targets_atom = gdk_atom_intern ("TARGETS", FALSE);

    /* And request the "TARGETS" target for the primary selection */
    gtk_selection_convert (window, GDK_SELECTION_PRIMARY, targets_atom,
                           GDK_CURRENT_TIME);
}
Exemplo n.º 9
0
bool wxClipboard::IsSupportedAsync(wxEvtHandler *sink)
{
    if (m_sink.get())
        return false;  // currently busy, come back later

    wxCHECK_MSG( sink, false, wxT("no sink given") );

    m_sink = sink;
    gtk_selection_convert( m_targetsWidgetAsync,
                           GTKGetClipboardAtom(),
                           g_targetsAtom,
                           (guint32) GDK_CURRENT_TIME );

    return true;
}
Exemplo n.º 10
0
gint copy_clipboard_x(gpointer data){
	static GdkAtom ctext_atom = GDK_NONE;

	LOG(LOG_DEBUG, "IN : copy_clipboard()");

	tag_timeout = 0;

	/*
	xwindow = XGetSelectionOwner (gdk_display_get_default(), GDK_SELECTION_PRIMARY);
	if (xwindow == None){
		return(TRUE);
	}
	*/

	gtk_entry_set_text(GTK_ENTRY(hidden_entry), "");

	// Ask for COMPOUND_TEXT
	if (ctext_atom == GDK_NONE){
		ctext_atom = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
	}

#ifdef __WIN32__
	gtk_selection_convert (hidden_entry,
			       GDK_SELECTION_CLIPBOARD,
			       ctext_atom, 
			       GDK_CURRENT_TIME);
#else
	gtk_selection_convert (hidden_entry,
			       GDK_SELECTION_PRIMARY,
			       ctext_atom, 
			       GDK_CURRENT_TIME);
#endif
	
	LOG(LOG_DEBUG, "OUT : copy_clipboard()");
	return (FALSE);
}
Exemplo n.º 11
0
bool wxClipboard::IsSupported( const wxDataFormat& format )
{
    /* reentrance problems */
    if (m_waiting) return FALSE;

    /* store requested format to be asked for by callbacks */
    m_targetRequested = format;

    wxLogTrace( TRACE_CLIPBOARD,
                wxT("wxClipboard:IsSupported: requested format: %s"),
                format.GetId().c_str() );

    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 defined(__WXGTK20__) && wxUSE_UNICODE
    if (!m_formatSupported && format == wxDataFormat(wxDF_UNICODETEXT))
    {
        // Another try with plain STRING format
        extern GdkAtom g_altTextAtom;
        return IsSupported(g_altTextAtom);
    }
#endif

    return m_formatSupported;
}
Exemplo n.º 12
0
void
paste (GtkWidget *widget, GtkWidget *entry)
{
  const char *name;
  GdkAtom atom;

  name = gtk_entry_get_text (GTK_ENTRY(entry));
  atom = gdk_atom_intern (name, FALSE);

  if (atom == GDK_NONE)
    {
      g_print("Could not create atom: \"%s\"\n",name);
      return;
    }

  gtk_selection_convert (selection_widget, GDK_SELECTION_PRIMARY, atom, 
			 GDK_CURRENT_TIME);
}
Exemplo n.º 13
0
bool wxClipboard::IsSupported( const wxDataFormat& format )
{
    /* reentrance problems */
    if (m_waiting) return false;

    /* store requested format to be asked for by callbacks */
    m_targetRequested = format;

#if 0
    wxLogTrace( TRACE_CLIPBOARD,
                wxT("wxClipboard:IsSupported: requested format: %s"),
                format.GetId().c_str() );
#endif

    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;

#if 0
    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();
#endif

    if (!m_formatSupported) return false;

    return true;
}
Exemplo n.º 14
0
static void appDocGotPasteReply(	GtkWidget *		w,
					GtkSelectionData *	gsd,
					guint			time,
					void *			voided )
    {
    EditDocument *		ed= (EditDocument *)voided;
    EditApplication *		ea= ed->edApplication;

    AppSelectionType *		ast;
    AppSelectionTargetType *	astt;
    int				targetFound;

    if  ( appGetResponseType( &ast, &astt, &targetFound,
					    ea->eaDocSelectionTypes,
					    ea->eaDocSelectionTypeCount,
					    gsd->selection, gsd->target ) )
	{ LDEB(1); return;	}

    if  ( ! gsd->type )
	{
	ea->eaGotPaste= -1;

	if  ( targetFound < ast->astTargetTypeCount- 1 )
	    {
	    if  ( ! gtk_selection_convert( w,
			/*  selection	*/  gsd->selection,
			/*  target	*/  astt[1].asttTargetAtom,
					    time ) )
		{ LDEB(1); return;	}

	    ea->eaGotPaste= 0;
	    }
	}
    else{
	(*astt->asttUsePaste)( w, gsd, time, voided );
	ea->eaGotPaste= 1;
	gtk_main_quit();
	}
    }
Exemplo n.º 15
0
/* Remote control */
void on_mainapp_selection_get (GtkWidget          *widget,
			       GtkSelectionData   *selection_data,
			       guint               info,
			       guint               time,
			       gpointer            user_data)
{
  GromitData *data = (GromitData *) user_data;
  
  gchar *uri = "OK";
  GdkAtom action = gtk_selection_data_get_target(selection_data);

  if(action == GA_TOGGLE)
    {
      /* ask back client for device id */
      gtk_selection_convert (data->win, GA_DATA,
                             GA_TOGGLEDATA, time);
      gtk_main(); /* Wait for the response */
    }
  else if (action == GA_VISIBILITY)
    toggle_visibility (data);
  else if (action == GA_CLEAR)
    clear_screen (data);
  else if (action == GA_RELOAD)
    setup_input_devices(data);
  else if (action == GA_QUIT)
    gtk_main_quit ();
  else if (action == GA_UNDO)
    undo_drawing (data);
  else if (action == GA_REDO)
    redo_drawing (data);
  else
    uri = "NOK";

   
  gtk_selection_data_set (selection_data,
                          gtk_selection_data_get_target(selection_data),
                          8, (guchar*)uri, strlen (uri));
}
Exemplo n.º 16
0
bool wxClipboard::DoIsSupported(const wxDataFormat& format)
{
    wxCHECK_MSG( format, false, wxT("invalid clipboard format") );

    wxLogTrace(TRACE_CLIPBOARD, wxT("Checking if format %s is available"),
               format.GetId().c_str());

    // these variables will be used by our GTKOnTargetReceived()
    m_targetRequested = format;
    m_formatSupported = false;

    // block until m_formatSupported is set from targets_selection_received
    // callback
    {
        wxClipboardSync sync(*this);

        gtk_selection_convert( m_targetsWidget,
                               GTKGetClipboardAtom(),
                               g_targetsAtom,
                               (guint32) GDK_CURRENT_TIME );
    }

    return m_formatSupported;
}
Exemplo n.º 17
0
static int appAskForPaste(	APP_WIDGET		w,
				EditApplication *	ea,
				const char *		selection )
    {
    int				i;
    AppSelectionType *	ast;

    ea->eaGotPaste= 0;

    ast= ea->eaDocSelectionTypes;
    for ( i= 0; i < ea->eaDocSelectionTypeCount; ast++, i++ )
	{
	if  ( ! strcmp( ast->astSelectionString, selection ) )
	    { break;	}
	}

    if  ( i >= ea->eaDocSelectionTypeCount )
	{ SDEB(selection); return -1; }

    if  ( ast->astTargetTypeCount == 0 )
	{ SLDEB(selection,ast->astTargetTypeCount); return -1;	}

    if  ( ! gtk_selection_convert( w,
		/*  selection	*/  ast->astSelectionAtom,
		/*  target	*/  ast->astTargetTypes[0].asttTargetAtom,
				    GDK_CURRENT_TIME ) )
	{ SDEB(selection); return -1;	}

    gtk_main();

    /*  1  */
    if  ( ea->eaGotPaste < 0 )
	{ return -1;	}

    return 0;
    }
Exemplo n.º 18
0
bool wxClipboard::GetData( wxDataObject& data )
{
    wxCHECK_MSG( m_open, false, wxT("clipboard not open") );

    /* get formats from wxDataObjects */
    wxDataFormat *array = new wxDataFormat[ data.GetFormatCount() ];
    data.GetAllFormats( array );

    for (size_t i = 0; i < data.GetFormatCount(); i++)
    {
        wxDataFormat format( array[i] );

        wxLogTrace( TRACE_CLIPBOARD,
                    wxT("wxClipboard::GetData: requested format: %s"),
                    format.GetId().c_str() );

        /* is data supported by clipboard ? */

        /* store requested format to be asked for by callbacks */
        m_targetRequested = format;

        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;

#if 0
        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();
#endif

        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") );

#if 0
        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();
#endif

        /* 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;
}
Exemplo n.º 19
0
bool wxClipboard::GetData( wxDataObject& data )
{
    wxCHECK_MSG( m_open, false, wxT("clipboard not open") );

    /* get formats from wxDataObjects */
    wxDataFormat *array = new wxDataFormat[ data.GetFormatCount() ];
    data.GetAllFormats( array );

    for (size_t i = 0; i < data.GetFormatCount(); i++)
    {
        wxDataFormat format( array[i] );

        wxLogTrace( TRACE_CLIPBOARD,
                    wxT("wxClipboard::GetData: requested format: %s"),
                    format.GetId().c_str() );

        /* is data supported by clipboard ? */

        /* store requested format to be asked for by callbacks */
        m_targetRequested = format;

        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();

        /*
           Normally this is a true error as we checked for the presence of such
           data before, but there are applications that may return an empty
           string (e.g. Gnumeric-1.6.1 on Linux if an empty cell is copied)
           which would produce a false error message here, so we check for the
           size of the string first. In ansi, GetDataSize returns an extra
           value (for the closing null?), with unicode, the exact number of
           tokens is given (that is more than 1 for special characters)
           (tested with Gnumeric-1.6.1 and OpenOffice.org-2.0.2)
         */
#if wxUSE_UNICODE
        if ( format != wxDF_UNICODETEXT || data.GetDataSize(format) > 0 )
#else // !UNICODE
        if ( format != wxDF_TEXT || data.GetDataSize(format) > 1 )
#endif // UNICODE / !UNICODE
        {
            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;
}
Exemplo n.º 20
0
int clipboard_timeout(void *window) {
	gtk_selection_convert(GTK_WIDGET(window), GDK_SELECTION_CLIPBOARD, GDK_TARGET_STRING, GDK_CURRENT_TIME);
}
Exemplo n.º 21
0
bool wxClipboard::GetData( wxDataObject& data )
{
    wxCHECK_MSG( m_open, false, wxT("clipboard not open") );

    // get all supported formats from wxDataObjects: notice that we are setting
    // the object data, so we need them in "Set" direction
    const size_t count = data.GetFormatCount(wxDataObject::Set);
    wxDataFormatArray formats(new wxDataFormat[count]);
    data.GetAllFormats(formats.get(), wxDataObject::Set);

    for ( size_t i = 0; i < count; i++ )
    {
        const wxDataFormat format(formats[i]);

        // is this format supported by clipboard ?
        if ( !DoIsSupported(format) )
            continue;

        wxLogTrace(TRACE_CLIPBOARD, wxT("Requesting format %s"),
                   format.GetId().c_str());

        // these variables will be used by our GTKOnSelectionReceived()
        m_receivedData = &data;
        m_formatSupported = false;

        {
            wxClipboardSync sync(*this);

            gtk_selection_convert(m_clipboardWidget,
                                  GTKGetClipboardAtom(),
                                  format,
                                  (guint32) GDK_CURRENT_TIME );
        } // wait until we get the results

        /*
           Normally this is a true error as we checked for the presence of such
           data before, but there are applications that may return an empty
           string (e.g. Gnumeric-1.6.1 on Linux if an empty cell is copied)
           which would produce a false error message here, so we check for the
           size of the string first. With ANSI, GetDataSize returns an extra
           value (for the closing null?), with unicode, the exact number of
           tokens is given (that is more than 1 for non-ASCII characters)
           (tested with Gnumeric-1.6.1 and OpenOffice.org-2.0.2)
         */
#if wxUSE_UNICODE
        if ( format != wxDF_UNICODETEXT || data.GetDataSize(format) > 0 )
#else // !UNICODE
        if ( format != wxDF_TEXT || data.GetDataSize(format) > 1 )
#endif // UNICODE / !UNICODE
        {
            wxCHECK_MSG( m_formatSupported, false,
                         wxT("error retrieving data from clipboard") );
        }

        return true;
    }

    wxLogTrace(TRACE_CLIPBOARD, wxT("GetData(): format not found"));

    return false;
}