@@ -1073,6 +1073,7 @@ private void initQam() {
10731073
10741074 qamPerfSwitch = qamView .findViewById (R .id .qam_perf_overlay_switch );
10751075 qamOscSwitch = qamView .findViewById (R .id .qam_osc_switch );
1076+ qamMouseSwitch = qamView .findViewById (R .id .qam_mouse_switch );
10761077 final View oscRow = qamView .findViewById (R .id .qam_osc_row );
10771078
10781079 if (virtualController == null ) {
@@ -1092,19 +1093,33 @@ public void onClick(View v) {
10921093 oscRow .setOnClickListener (new View .OnClickListener () {
10931094 @ Override
10941095 public void onClick (View v ) {
1095- if (virtualController == null ) {
1096- return ;
1097- }
10981096 oscVisible = !oscVisible ;
10991097 if (oscVisible ) {
1098+ if (virtualController == null ) {
1099+ virtualController = new VirtualController (controllerHandler ,
1100+ (FrameLayout )streamView .getParent (), Game .this );
1101+ virtualController .refreshLayout ();
1102+ oscRow .setAlpha (1.0f );
1103+ }
11001104 virtualController .show ();
1101- } else {
1102- virtualController .hide ();
1105+ }
1106+ else {
1107+ if (virtualController != null ) {
1108+ virtualController .hide ();
1109+ }
11031110 }
11041111 qamOscSwitch .setChecked (oscVisible );
11051112 }
11061113 });
11071114
1115+ qamView .findViewById (R .id .qam_mouse_row ).setOnClickListener (new View .OnClickListener () {
1116+ @ Override
1117+ public void onClick (View v ) {
1118+ setInputGrabState (!grabbedInput );
1119+ qamMouseSwitch .setChecked (grabbedInput );
1120+ }
1121+ });
1122+
11081123 qamView .findViewById (R .id .qam_disconnect ).setOnClickListener (new View .OnClickListener () {
11091124 @ Override
11101125 public void onClick (View v ) {
@@ -1140,13 +1155,20 @@ public void run() {
11401155 private void showQam () {
11411156 qamPerfSwitch .setChecked (perfOverlayVisible );
11421157 qamOscSwitch .setChecked (oscVisible );
1158+ qamMouseSwitch .setChecked (grabbedInput );
1159+ if (oscVisible && virtualController != null ) {
1160+ virtualController .hide ();
1161+ }
11431162 qamView .setVisibility (View .VISIBLE );
11441163 qamView .findViewById (R .id .qam_perf_row ).requestFocus ();
11451164 qamVisible = true ;
11461165 }
11471166
11481167 private void hideQam () {
11491168 qamView .setVisibility (View .GONE );
1169+ if (oscVisible && virtualController != null ) {
1170+ virtualController .show ();
1171+ }
11501172 streamView .requestFocus ();
11511173 qamVisible = false ;
11521174 }
0 commit comments