kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.38k stars 127 forks source link

Ticket 266 #268

Closed cfraizer closed 3 years ago

cfraizer commented 3 years ago

Of course, I'd be happy to make any changes you suggest.

cfraizer commented 3 years ago

I incorporated your changes, but I made one additional change.

I found that some windows (those from Emacs.app) would fail in PHAXUIElement's processIdentifier method. So I changed line 174 in PHApp.m to call [self.app processIdentifier].

(I'm a total Mac programming n00b, so I apologize if I've made this more difficult than it should be! I really appreciate all your help with this.)

cfraizer commented 3 years ago

Hmn. Something is still wrong. I don't really understand it.

Now PHWindow's focused method is broken. That is, Window.focused() returns null. My guess is that changing the focus through SetFrontProcess doesn't do the right thing that PHWindow's focused method looks at.

kasper commented 3 years ago

@cfraizer Hmm, could you also verify that it triggers the relevant events for focusing?

cfraizer commented 3 years ago

I'm not sure what you mean. (Sorry that I'm a bozo!) It certainly moves the focus—that is, it raises the correct window and that window has keyboard input focus, but after moving it, then Window.focused() returns null.

cfraizer commented 3 years ago

Ah, never mind on that other problem. I was returning the wrong value from PHApp's focus method and that uncovered a weird (ancient) bug in my own JavaScript that caused it to try to call the JS Window.focus() method on a null object.

I've tested as many variations I can think of and the problem no longer occurs.