mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-06-16 04:29:31 +00:00
support bluetooth HID pointing devices through BTC Mouse
This commit is contained in:
parent
81d985f190
commit
9f2e3f87c0
|
@ -274,6 +274,7 @@
|
|||
283423EC1CFA329C0088B634 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
|
||||
283423ED1CFA329C0088B634 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
|
||||
283423EE1CFA329C0088B634 /* Icon@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@3x.png"; sourceTree = "<group>"; };
|
||||
283CA9821DF47AF300B33D5E /* BTCMouse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BTCMouse.h; sourceTree = "<group>"; };
|
||||
285A8C901D05AFD3002993DE /* PlugIn-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "PlugIn-Info.plist"; sourceTree = "<group>"; };
|
||||
28848B601CDE97D600B86C45 /* InsertDiskViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertDiskViewController.h; sourceTree = "<group>"; };
|
||||
28848B611CDE97D600B86C45 /* InsertDiskViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InsertDiskViewController.m; sourceTree = "<group>"; };
|
||||
|
@ -628,6 +629,7 @@
|
|||
28F6B4511CF07C48002D76D0 /* UIImage+DiskImageIcon.m */,
|
||||
28F6B4C91CF1FA7A002D76D0 /* about.plist */,
|
||||
28F6B4CE1CF77099002D76D0 /* compat.m */,
|
||||
283CA9821DF47AF300B33D5E /* BTCMouse.h */,
|
||||
283422EF1CF8F33A0088B634 /* Emulator Bundles */,
|
||||
);
|
||||
path = "Mini vMac";
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "EmulatorProtocol.h"
|
||||
#import "BTCMouse.h"
|
||||
|
||||
extern NSString *DocumentsChangedNotification;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ static AppDelegate *sharedAppDelegate = nil;
|
|||
static NSObject<Emulator> *sharedEmulator = nil;
|
||||
NSString *DocumentsChangedNotification = @"documentsChanged";
|
||||
|
||||
@interface AppDelegate () <UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning>
|
||||
@interface AppDelegate () <UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning, BTCMouseDelegate>
|
||||
|
||||
@end
|
||||
|
||||
|
@ -40,6 +40,11 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
|
|||
[self initDefaults];
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:NULL];
|
||||
[sharedEmulator performSelector:@selector(run) withObject:nil afterDelay:0.1];
|
||||
|
||||
if ([application respondsToSelector:@selector(btcMouseSetRawMode:)]) {
|
||||
[application btcMouseSetRawMode:YES];
|
||||
[application btcMouseSetDelegate:self];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -109,6 +114,11 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
|
|||
}
|
||||
}
|
||||
|
||||
- (void)handleEventWithMove:(CGPoint)move andWheel:(float)wheel andPan:(float)pan andButtons:(int)buttons {
|
||||
[sharedEmulator moveMouseX:move.x/2.0 Y:move.y/2.0];
|
||||
[sharedEmulator setMouseButton:buttons == 1];
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
if (sharedEmulator.running) {
|
||||
|
|
20
Mini vMac/BTCMouse.h
Normal file
20
Mini vMac/BTCMouse.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// BTCMouse.h
|
||||
// Mini vMac
|
||||
//
|
||||
// Created by Jesús A. Álvarez on 04/12/2016.
|
||||
// Copyright © 2016 namedfork. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
@protocol BTCMouseDelegate
|
||||
- (void)handleEventWithMove:(CGPoint)move andWheel:(float)wheel andPan:(float)pan andButtons:(int)buttons;
|
||||
@end
|
||||
|
||||
@interface UIApplication (BTCMouse)
|
||||
- (void)btcMouseSetPanning:(BOOL)panning;
|
||||
- (void)btcMouseSetZooming:(BOOL)zooming;
|
||||
- (void)btcMouseSetDelegate:(id<BTCMouseDelegate>)delegate;
|
||||
- (void)btcMouseSetRawMode:(BOOL)rawMode;
|
||||
@end
|
||||
|
|
@ -65,6 +65,9 @@
|
|||
[nc addObserver:self selector:@selector(reloadData:) name:[AppDelegate sharedEmulator].insertDiskNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(reloadData:) name:[AppDelegate sharedEmulator].ejectDiskNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(reloadData:) name:DocumentsChangedNotification object:nil];
|
||||
if ([UIApplication instancesRespondToSelector:@selector(btcMouseSetRawMode:)]) {
|
||||
[[UIApplication sharedApplication] btcMouseSetRawMode:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
|
|
|
@ -90,6 +90,9 @@ typedef enum : NSInteger {
|
|||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[AppDelegate sharedEmulator].running = NO;
|
||||
if ([UIApplication instancesRespondToSelector:@selector(btcMouseSetRawMode:)]) {
|
||||
[[UIApplication sharedApplication] btcMouseSetRawMode:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
|
|
@ -64,6 +64,9 @@
|
|||
pointingDeviceView = [[pointingDeviceClass alloc] initWithFrame:self.view.bounds];
|
||||
pointingDeviceView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
[self.view insertSubview:pointingDeviceView aboveSubview:self.screenView];
|
||||
if ([UIApplication instancesRespondToSelector:@selector(btcMouseSetRawMode:)]) {
|
||||
[[UIApplication sharedApplication] btcMouseSetRawMode:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
|
||||
|
|
Loading…
Reference in New Issue
Block a user