From: ayin Date: Mon, 12 Nov 2007 14:41:42 +0000 (+0000) Subject: Initialize appkit only once. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=c00ffe02ce23a5a271c930e955f6f1613559c3db;p=dana%2Furxvt.git Initialize appkit only once. --- diff --git a/src/perl/macosx-clipboard b/src/perl/macosx-clipboard index b4e7ae46..2a500f4d 100644 --- a/src/perl/macosx-clipboard +++ b/src/perl/macosx-clipboard @@ -37,6 +37,20 @@ use utf8; our($appkit, $pasteboard); +$appkit = NSBundle->alloc->init->initWithPath_('/System/Library/Frameworks/AppKit.framework'); +$appkit->load if $appkit; + +if ($appkit->isLoaded) { + no strict 'refs'; + for my $class (qw(NSPasteboard)) { + @{$class . '::ISA'} = 'PerlObjCBridge'; + } +} else { + undef $appkit; +} + +$pasteboard = NSPasteboard->generalPasteboard; + sub copy { my ($self) = @_; @@ -59,25 +73,6 @@ sub paste { () } -sub on_start { - my ($self) = @_; - - $appkit = NSBundle->alloc->init->initWithPath_('/System/Library/Frameworks/AppKit.framework'); - $appkit->load if $appkit; - - if ($appkit->isLoaded) { - no strict 'refs'; - for my $class (qw(NSPasteboard)) { - @{$class . '::ISA'} = 'PerlObjCBridge'; - } - } else { - undef $appkit; - } - - $pasteboard = NSPasteboard->generalPasteboard; - () -} - sub on_user_command { my ($self, $cmd) = @_;