#include "clipboard.h"
+#include "globaldefs.h"
#include "stream/memstream.h"
#include "stream/textstream.h"
/// \file
/// \brief Platform-independent GTK clipboard support.
/// \todo Using GDK_SELECTION_CLIPBOARD fails on win32, so we use the win32 API directly for now.
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
const char* c_clipboard_format = "RadiantClippings";
#else
-#include <gtk/gtkclipboard.h>
+#include <gtk/gtk.h>
enum
{
RADIANT_CLIPPINGS = 23,
};
+static char RADIANT_CLIPPINGS_STR[] = "RADIANT_CLIPPINGS";
+
static const GtkTargetEntry clipboard_targets[] = {
- { "RADIANT_CLIPPINGS", 0, RADIANT_CLIPPINGS, },
+ {RADIANT_CLIPPINGS_STR, 0, RADIANT_CLIPPINGS, },
};
static void clipboard_get( GtkClipboard *clipboard, GtkSelectionData *selection_data, guint info, gpointer data ){
}
static void clipboard_received( GtkClipboard *clipboard, GtkSelectionData *data, gpointer user_data ){
- if ( data->length < 0 ) {
+ if ( gtk_selection_data_get_length(data) < 0 ) {
globalErrorStream() << "Error retrieving selection\n";
}
- else if ( strcmp( gdk_atom_name( data->type ), clipboard_targets[0].target ) == 0 ) {
- BufferInputStream istream( reinterpret_cast<const char*>( data->data ), data->length );
+ else if ( strcmp( gdk_atom_name( gtk_selection_data_get_data_type(data) ), clipboard_targets[0].target ) == 0 ) {
+ BufferInputStream istream( reinterpret_cast<const char*>( gtk_selection_data_get_data(data) ), gtk_selection_data_get_length(data) );
( *reinterpret_cast<ClipboardPasteFunc*>( user_data ) )( istream );
}
}