quartz: move atom/pasteboard type conversions functions to GDK
(cherry picked from commit a269c2f8d26a588c4b61ad605ef496e89759cc03)
This commit is contained in:
committed by
Michael Natterer
parent
40c5d37340
commit
6f607fc8b4
@ -55,6 +55,10 @@ typedef enum
|
||||
|
||||
GdkOSXVersion gdk_quartz_osx_version (void);
|
||||
|
||||
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
|
||||
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);
|
||||
NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#define __GDKQUARTZ_H_INSIDE__
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "gdkselection.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkquartz.h"
|
||||
|
||||
gboolean
|
||||
_gdk_quartz_display_set_selection_owner (GdkDisplay *display,
|
||||
@ -171,3 +172,42 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
GdkAtom
|
||||
gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type)
|
||||
{
|
||||
if ([type isEqualToString:NSStringPboardType])
|
||||
return gdk_atom_intern_static_string ("UTF8_STRING");
|
||||
else if ([type isEqualToString:NSTIFFPboardType])
|
||||
return gdk_atom_intern_static_string ("image/tiff");
|
||||
else if ([type isEqualToString:NSColorPboardType])
|
||||
return gdk_atom_intern_static_string ("application/x-color");
|
||||
else if ([type isEqualToString:NSURLPboardType])
|
||||
return gdk_atom_intern_static_string ("text/uri-list");
|
||||
else
|
||||
return gdk_atom_intern ([type UTF8String], FALSE);
|
||||
}
|
||||
|
||||
NSString *
|
||||
gdk_quartz_target_to_pasteboard_type_libgtk_only (const char *target)
|
||||
{
|
||||
if (strcmp (target, "UTF8_STRING") == 0)
|
||||
return NSStringPboardType;
|
||||
else if (strcmp (target, "image/tiff") == 0)
|
||||
return NSTIFFPboardType;
|
||||
else if (strcmp (target, "application/x-color") == 0)
|
||||
return NSColorPboardType;
|
||||
else if (strcmp (target, "text/uri-list") == 0)
|
||||
return NSURLPboardType;
|
||||
else
|
||||
return [NSString stringWithUTF8String:target];
|
||||
}
|
||||
|
||||
NSString *
|
||||
gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom)
|
||||
{
|
||||
gchar *target = gdk_atom_name (atom);
|
||||
NSString *ret = gdk_quartz_target_to_pasteboard_type_libgtk_only (target);
|
||||
g_free (target);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user