[aquaskk-changes 44] CVS update: AquaSKK

Back to archive index

Tomotaka SUWA t-suw****@users*****
2005年 9月 23日 (金) 11:27:44 JST


Index: AquaSKK/PrivateRunLoop.cpp
diff -u /dev/null AquaSKK/PrivateRunLoop.cpp:1.1.2.1
--- /dev/null	Fri Sep 23 11:27:44 2005
+++ AquaSKK/PrivateRunLoop.cpp	Fri Sep 23 11:27:44 2005
@@ -0,0 +1,84 @@
+/*
+  $Id: PrivateRunLoop.cpp,v 1.1.2.1 2005/09/23 02:27:44 t-suwa Exp $
+
+  MacOS X implementation of the SKK input method.
+
+  Copyright (C) 2005 Tomotaka SUWA <t.suw****@mac*****>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreServices/CoreServices.h>
+#include "PrivateRunLoop.h"
+
+PrivateRunLoop::PrivateRunLoop(
+    const CFStringRef mode, CFRunLoopSourceRef runLoopSource)
+    : mode_(mode), runLoop_(0)
+{
+    // •ÛŽ
+    runLoopSource_ = (CFRunLoopSourceRef)CFRetain(runLoopSource);
+
+    // ƒ^ƒXƒN(=ƒXƒŒƒbƒh)Š®—¹’Ê’m—p‚̃ƒbƒZ[ƒWƒLƒ…[‚ðì¬‚·‚é
+    MPCreateQueue(&notifyQueue_);
+
+    // ƒ^ƒXƒN‚𑖂点‚é
+    MPCreateTask(PrivateRunLoop::entryPoint,
+		 this,
+		 0,
+		 notifyQueue_,
+		 NULL,
+		 NULL,
+		 0,
+		 &taskID_);
+}
+
+PrivateRunLoop::~PrivateRunLoop()
+{
+    // ƒ^ƒXƒN‚ðŽ~‚ß‚é
+    CFRunLoopStop(runLoop_);
+
+    // Š®‘S‚ÉŠ®—¹‚·‚é‚Ì‚ð‘Ò‚Â
+    MPWaitOnQueue(notifyQueue_, NULL, NULL, NULL, kDurationForever);
+    MPDeleteQueue(notifyQueue_);
+
+    // ”jŠü
+    CFRelease(runLoopSource_);
+}
+
+// ƒ^ƒXƒN–{‘Ì
+OSStatus PrivateRunLoop::entryPoint(void* param)
+{
+    PrivateRunLoop* self = (PrivateRunLoop*)param;
+    self->runLoop_ = CFRunLoopGetCurrent();
+
+    // ŠÄŽ‹‘Ώۂð’ljÁ
+    CFRunLoopAddSource(self->runLoop_,
+		       self->runLoopSource_,
+		       self->mode_);
+
+    // CFRunLoopStop() ‚ªŒÄ‚΂ê‚é‚܂ŃCƒxƒ“ƒg‚ðˆ—‚·‚é
+    SInt32 result;
+    do {
+	result = CFRunLoopRunInMode(self->mode_, 1, true);
+    } while(result != kCFRunLoopRunStopped);
+
+    // ŒãŽn––
+    CFRunLoopRemoveSource(self->runLoop_,
+			  self->runLoopSource_,
+			  self->mode_);
+
+    return 0;
+}
Index: AquaSKK/PrivateRunLoop.h
diff -u /dev/null AquaSKK/PrivateRunLoop.h:1.1.2.1
--- /dev/null	Fri Sep 23 11:27:44 2005
+++ AquaSKK/PrivateRunLoop.h	Fri Sep 23 11:27:44 2005
@@ -0,0 +1,39 @@
+/*
+  $Id: PrivateRunLoop.h,v 1.1.2.1 2005/09/23 02:27:44 t-suwa Exp $
+
+  MacOS X implementation of the SKK input method.
+
+  Copyright (C) 2005 Tomotaka SUWA <t.suw****@mac*****>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#pragma once
+
+// “ÆŽ©‚Ì RunLoop ‚𑖂点‚éƒNƒ‰ƒX
+class PrivateRunLoop {
+    const CFStringRef mode_;
+    CFRunLoopRef runLoop_;
+    CFRunLoopSourceRef runLoopSource_;
+    MPQueueID notifyQueue_;
+    MPTaskID taskID_;
+
+    // ƒ^ƒXƒN–{‘Ì
+    static OSStatus entryPoint(void* param);
+
+public:
+    PrivateRunLoop(const CFStringRef mode, CFRunLoopSourceRef runLoopSource);
+    ~PrivateRunLoop();
+};


aquaskk-changes メーリングリストの案内
Back to archive index