ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/macosx-clipboard
(Generate patch)

Comparing rxvt-unicode/src/perl/macosx-clipboard (file contents):
Revision 1.1 by root, Thu Dec 7 20:59:59 2006 UTC vs.
Revision 1.2 by ayin, Mon Nov 12 14:41:42 2007 UTC

35use locale; 35use locale;
36use utf8; 36use utf8;
37 37
38our($appkit, $pasteboard); 38our($appkit, $pasteboard);
39 39
40$appkit = NSBundle->alloc->init->initWithPath_('/System/Library/Frameworks/AppKit.framework');
41$appkit->load if $appkit;
42
43if ($appkit->isLoaded) {
44 no strict 'refs';
45 for my $class (qw(NSPasteboard)) {
46 @{$class . '::ISA'} = 'PerlObjCBridge';
47 }
48} else {
49 undef $appkit;
50}
51
52$pasteboard = NSPasteboard->generalPasteboard;
53
40sub copy { 54sub copy {
41 my ($self) = @_; 55 my ($self) = @_;
42 56
43 $pasteboard->declareTypes_owner_(NSArray->arrayWithObject_('NSStringPboardType'), undef); 57 $pasteboard->declareTypes_owner_(NSArray->arrayWithObject_('NSStringPboardType'), undef);
44 $pasteboard->setString_forType_($self->selection, 'NSStringPboardType'); 58 $pasteboard->setString_forType_($self->selection, 'NSStringPboardType');
57 $self->tt_write($self->locale_encode($str)); 71 $self->tt_write($self->locale_encode($str));
58 } 72 }
59 () 73 ()
60} 74}
61 75
62sub on_start {
63 my ($self) = @_;
64
65 $appkit = NSBundle->alloc->init->initWithPath_('/System/Library/Frameworks/AppKit.framework');
66 $appkit->load if $appkit;
67
68 if ($appkit->isLoaded) {
69 no strict 'refs';
70 for my $class (qw(NSPasteboard)) {
71 @{$class . '::ISA'} = 'PerlObjCBridge';
72 }
73 } else {
74 undef $appkit;
75 }
76
77 $pasteboard = NSPasteboard->generalPasteboard;
78 ()
79}
80
81sub on_user_command { 76sub on_user_command {
82 my ($self, $cmd) = @_; 77 my ($self, $cmd) = @_;
83 78
84 if ($cmd eq "macosx-clipboard:copy") { 79 if ($cmd eq "macosx-clipboard:copy") {
85 $self->copy; 80 $self->copy;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines