commit
e07b56b646
@ -1,5 +1,11 @@
|
|||||||
package com.carriez.flutter_hbb
|
package com.carriez.flutter_hbb
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle remote input and dispatch android gesture
|
||||||
|
*
|
||||||
|
* Inspired by [droidVNC-NG] https://github.com/bk138/droidVNC-NG
|
||||||
|
*/
|
||||||
|
|
||||||
import android.accessibilityservice.AccessibilityService
|
import android.accessibilityservice.AccessibilityService
|
||||||
import android.accessibilityservice.GestureDescription
|
import android.accessibilityservice.GestureDescription
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
package com.carriez.flutter_hbb
|
package com.carriez.flutter_hbb
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle events from flutter
|
||||||
|
* Request MediaProjection permission
|
||||||
|
*
|
||||||
|
* Inspired by [droidVNC-NG] https://github.com/bk138/droidVNC-NG
|
||||||
|
*/
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
package com.carriez.flutter_hbb
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture screen,get video and audio,send to rust.
|
* Capture screen,get video and audio,send to rust.
|
||||||
* Handle notification
|
* Dispatch notifications
|
||||||
|
*
|
||||||
|
* Inspired by [droidVNC-NG] https://github.com/bk138/droidVNC-NG
|
||||||
*/
|
*/
|
||||||
package com.carriez.flutter_hbb
|
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
@ -168,6 +168,7 @@ class FfiModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleSwitchDisplay(Map<String, dynamic> evt) {
|
void handleSwitchDisplay(Map<String, dynamic> evt) {
|
||||||
|
final oldOrientation = _display.width > _display.height;
|
||||||
var old = _pi.currentDisplay;
|
var old = _pi.currentDisplay;
|
||||||
_pi.currentDisplay = int.parse(evt['display']);
|
_pi.currentDisplay = int.parse(evt['display']);
|
||||||
_display.x = double.parse(evt['x']);
|
_display.x = double.parse(evt['x']);
|
||||||
@ -176,6 +177,11 @@ class FfiModel with ChangeNotifier {
|
|||||||
_display.height = int.parse(evt['height']);
|
_display.height = int.parse(evt['height']);
|
||||||
if (old != _pi.currentDisplay)
|
if (old != _pi.currentDisplay)
|
||||||
FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y);
|
FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y);
|
||||||
|
|
||||||
|
// remote is mobile, and orientation changed
|
||||||
|
if ((_display.width > _display.height) != oldOrientation) {
|
||||||
|
FFI.canvasModel.updateViewStyle();
|
||||||
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
String _value = '';
|
String _value = '';
|
||||||
double _scale = 1;
|
double _scale = 1;
|
||||||
double _mouseScrollIntegral = 0; // mouse scroll speed controller
|
double _mouseScrollIntegral = 0; // mouse scroll speed controller
|
||||||
|
Orientation? _currentOrientation;
|
||||||
|
|
||||||
var _more = true;
|
var _more = true;
|
||||||
var _fn = false;
|
var _fn = false;
|
||||||
@ -258,12 +259,22 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
child: isDesktop
|
child: isDesktop
|
||||||
? getBodyForDesktopWithListener(keyboard)
|
? getBodyForDesktopWithListener(keyboard)
|
||||||
: SafeArea(
|
: SafeArea(child:
|
||||||
child: Container(
|
OrientationBuilder(builder: (ctx, orientation) {
|
||||||
|
if (_currentOrientation != orientation) {
|
||||||
|
debugPrint("on orientation changed");
|
||||||
|
Timer(Duration(milliseconds: 200), () {
|
||||||
|
resetMobileActionsOverlay();
|
||||||
|
_currentOrientation = orientation;
|
||||||
|
FFI.canvasModel.updateViewStyle();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
color: MyTheme.canvasColor,
|
color: MyTheme.canvasColor,
|
||||||
child: _isPhysicalMouse
|
child: _isPhysicalMouse
|
||||||
? getBodyForMobile()
|
? getBodyForMobile()
|
||||||
: getBodyForMobileWithGesture())));
|
: getBodyForMobileWithGesture());
|
||||||
|
})));
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
@ -228,6 +228,12 @@ class DraggableMobileActions extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetMobileActionsOverlay() {
|
||||||
|
if (mobileActionsOverlayEntry == null) return;
|
||||||
|
hideMobileActionsOverlay();
|
||||||
|
showMobileActionsOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
showMobileActionsOverlay() {
|
showMobileActionsOverlay() {
|
||||||
if (mobileActionsOverlayEntry != null) return;
|
if (mobileActionsOverlayEntry != null) return;
|
||||||
if (globalKey.currentContext == null ||
|
if (globalKey.currentContext == null ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user