UPDATE あ、CGDisplayRelease しないと画面が止まってしまうという致命的なバグがw。治しました。けど、command+tab でアプリケーションのメニューに表示されてしまうになってしまったな。しかも、クライアント側のスクリーンから離れると iTunes とかのフルスクリーンが解除されてしまう。
patch を使わずに、Cursorcerer を使う方がいいかもしれません。
前回は(といっても5ヶ月前ですが)fakeMouseMove(0, 0)として画面中央に君臨するカーソルを左上に移動させていたのですが、以下のパッチ(synergy-1.3.1用)でカーソルがクライアントから離れた時(とsynergycがサーバに繋いだとき)にカーソルを消すことができましたよという話。
もともと CGDisplayHideCursor と CGDisplayShowCursor を呼ぶ部分は synergy には入っているんですよね。コメントアウトされてるのは、該当部分のコメントアウトを外してもカーソルが隠れることはないから。そこで Apple のドキュメントや google codesearch を使って調べてみたところキャプチャしてからじゃないと CGDisplayHideCursor は効かないようなので、kCGCaptureNoFill オプション付きで CGDisplayCaptureWithOptions を呼んでから CGDisplayHideCursor を呼んでみたら動きましたよと。
まぁ、Flash, DVD Player, QuickTime Player とかでは Full Screen にしてしまえばカーソルは消えるので、困っていたのは LocationFree のプレーヤーだけだったんですけどね。しかし、Apple の ドキュメントは素晴らしいですな。 http://developer.apple.com/documentation/
I've added my comment with the Gist url to SourceFourge synergy tracker: Mouse cursor doesn't hide on OS X - ID: 1516490. I'm not sure who is gonna find out this patch though :(
Now I got the idea how "SourceFourge Tracker:Patches" works so that the patch has been put into it. Fix to hide cursor on Mac OS X - ID: 2626889
--- lib/platform/COSXScreen.cpp.orig 2006-03-21 21:40:27.000000000 -0800
+++ lib/platform/COSXScreen.cpp 2009-02-22 16:52:45.000000000 -0800
@@ -560,7 +560,9 @@
// hide cursor
if (!m_cursorHidden) {
-// CGDisplayHideCursor(m_displayID);
+ CGDisplayCaptureWithOptions(m_displayID, kCGCaptureNoFill);
+ CGDisplayHideCursor(m_displayID);
+ CGDisplayRelease(m_displayID);
m_cursorHidden = true;
}
@@ -580,7 +582,7 @@
else {
// show cursor
if (m_cursorHidden) {
-// CGDisplayShowCursor(m_displayID);
+ CGDisplayShowCursor(m_displayID);
m_cursorHidden = false;
}
@@ -619,7 +621,7 @@
else {
// show cursor
if (m_cursorHidden) {
-// CGDisplayShowCursor(m_displayID);
+ CGDisplayShowCursor(m_displayID);
m_cursorHidden = false;
}
@@ -669,7 +671,9 @@
else {
// hide cursor
if (!m_cursorHidden) {
-// CGDisplayHideCursor(m_displayID);
+ CGDisplayCaptureWithOptions(m_displayID, kCGCaptureNoFill);
+ CGDisplayHideCursor(m_displayID);
+ CGDisplayRelease(m_displayID);
m_cursorHidden = true;
}
Gist にも置いておいたです。 http://gist.github.com/68351

Comments