dingusdev / dingusppc

An experimental emulator
GNU General Public License v3.0
200 stars 21 forks source link

Add a basic mouse grab mode #76

Closed mihaip closed 3 months ago

mihaip commented 6 months ago

Take 2 of 587eb48f613583236bd5c14d3e2158521bdee05f. We now implement this at the SDL level, which works cross-platform and allows us to ensure that the guest never gets the Control-G event.

maximumspatium commented 6 months ago
warning: instance method '-convertPointToScreen:' not found (return type defaults to 'id') [-Wobjc-method-access]
            center = [mainWindow convertPointToScreen:center];

error: assigning to 'NSPoint' (aka 'struct CGPoint') from incompatible type 'id'
            center = [mainWindow convertPointToScreen:center];
mihaip commented 6 months ago

https://developer.apple.com/documentation/appkit/nswindow/2967182-convertpointtoscreen?language=objc has it as being in 10.12 and later. Which version of Xcode are you building with?

maximumspatium commented 6 months ago

I'm building with Clang 11.1.0 installed via Macports. I'll double-check wether it's using the proper SDK.

mihaip commented 4 months ago

@maximumspatium any luck with figuring out the build errors you were seeing? It sounds like @joevt has patched this in and it works for him.

joevt commented 4 months ago

I have Xcode 14.2 on macOS 12.7.2.

I cherry picked the commit into my fork but haven't pushed latest changes to my fork origin.

It builds with both methods:

mkdir -p /Volumes/Work/Programming/dingusppc/joevt-dingusppc/build
cd       /Volumes/Work/Programming/dingusppc/joevt-dingusppc/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make clean
make dingusppc
mkdir -p /Volumes/Work/Programming/dingusppc/joevt-dingusppc/build-xcode
cd       /Volumes/Work/Programming/dingusppc/joevt-dingusppc/build-xcode
cmake -DDPPC_BUILD_PPC_TESTS=ON -DDPPC_68K_DEBUGGER=ON -DCAPSTONE_BUILD_CSTOOL=ON -G Xcode ..
xcodebuild -configuration Release

I use the latter without xcodebuild. Edit, build, and debug with Xcode.

open dingusppc.xcodeproj
maximumspatium commented 4 months ago

@maximumspatium any luck with figuring out the build errors you were seeing? It sounds like @joevt has patched this in and it works for him.

Unfortunately no. It still breaks compilation in my development machine with Clang 11 installed via Macports. I'm running OS X 10.13.6 with SDK 10.14. But Clang seems to pick anything else instead. I'm afraid that the issue is caused by SW updates over decades making it hard to figure out the cause. I'd need to do a clean install but that would be a nightmare TBH.

maximumspatium commented 4 months ago

BTW, is there a possibility to implement a generic mouse grabbing without platform specific code? I mean your patch does it for Mac OS only but DPPC also runs on Windows and Linux so we need to make it work on those platforms as well.

joevt commented 4 months ago

One issue with this mouse-grab fix is that using the keyboard shortcut Control-G does not stop the key combination from being sent to the host.

mihaip commented 4 months ago

@maximumspatium I've redone this to be at the SDL level, which makes it cross-platform. It means the command is no longer discoverable via the macOS "Window" menu, but I understand we're not really concerned with the GUI at this point.

@joevt this also ends up handling your concerns -- key/down up events of control-G are not sent to the guest anymore.

joevt commented 3 months ago

@mihaip, works great. Tested using SimpleText app from Darwin 1.0 CD (stripped version of Mac OS 9.0.4) booted on pm7500.

dingusdev commented 3 months ago

Builds in Windows, but doesn't seem to work. Will fix at a later date.