質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
OS

OS(オペレーティングシステム)は、システムソフトウェアの一種であり、一般的に、ハードウェアを直接的に管理・操作する最も中心的な機能を有するソフトウェアがオペレーティングシステムとして呼ばれます。

Q&A

1回答

1583閲覧

Can I change the current cursor from an inactive application?

onitail

総合スコア12

OS

OS(オペレーティングシステム)は、システムソフトウェアの一種であり、一般的に、ハードウェアを直接的に管理・操作する最も中心的な機能を有するソフトウェアがオペレーティングシステムとして呼ばれます。

0グッド

0クリップ

投稿2015/03/04 09:17

I’ve got a utility Mac application that runs in the background (LSUIElement enabled). Under some condition this application displays a menu window with several buttons. The problem is that when I hover over this window the mouse cursor still behaves according to the application beneath it – when there’s text under the menu, cursor changes to the insertion “I beam” shape.

Obviously I’d prefer a regular pointer arrow. I’ve dived into NSTrackingArea and friends after a bit of hacking I can detect the mouse-enter and mouse-exit events. But when I try to change the current cursor using NSCursor on mouse enter, nothing happens. Looks like the machine refuses to change cursor from an inactive application, because when I activate the application before the mouse-enter event, the cursor changes.

I don’t want to switch the active application just to change the cursor. Is there a way to fiddle with the cursor from an inactive application?

P.S. Same problem on cocoa-dev: one, two.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

Hi, onitail!

It’s a bothersome problem. I think you should uninstall that utility from your Mac, if it’s expendable, or you'll just have to grin and bear it.

As you know, an NSTrackingArea object defines a region of view that generates mouse-tracking and cursor-update events when the mouse is over that region. So you get rid of that soon.

And with NSTrackingArea, we can configure the scope of activity for mouse tracking. There are four options:

  1. The tracking area is active only when the view is first responder.
  2. The tracking area is active when the view is in the key window.
  3. The tracking area is active when the application is active.
  4. The tracking area is active always (even when the application is inactive).

Particularly 2nd and 4th are extremely troubling than we thought it would be. Maybe you won't have it so easy.

More power to your elbow. Good luck!

投稿2015/03/05 06:44

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問