-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ctrl+n+n for settings panel #2260
Conversation
7ba0fde
to
a4aa0e6
Compare
If all looks good, I'll update documentation |
public static final int TYPE_COLLAPSE_NOTIFICATION_PANEL = 6; | ||
public static final int TYPE_GET_CLIPBOARD = 7; | ||
public static final int TYPE_SET_CLIPBOARD = 8; | ||
public static final int TYPE_SET_SCREEN_POWER_MODE = 9; | ||
public static final int TYPE_ROTATE_DEVICE = 10; | ||
public static final int TYPE_EXPAND_SETTINGS_PANEL = 6; | ||
public static final int TYPE_COLLAPSE_PANELS = 7; | ||
public static final int TYPE_GET_CLIPBOARD = 8; | ||
public static final int TYPE_SET_CLIPBOARD = 9; | ||
public static final int TYPE_SET_SCREEN_POWER_MODE = 10; | ||
public static final int TYPE_ROTATE_DEVICE = 11; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fully sure about changing the value of the constants as I did (and related) as it will make the previous server incompatible.
- On one hand, as I did,
- breaks backwards compatibility.
- making this change allows cleaner code on both ends.
- On the other hand, by just adding at the end
- Keeps backwards compatibility
- The code is less readable and maintainable.
I ended up going with 1
, but I don't mind changing to 2
if you prefer.
Maybe doing as 2
and change to 1
soon, though, later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fully sure about changing the value of the constants as I did (and related) as it will make the previous server incompatible.
That's totally acceptable, servers are not expected to be compatible at all with any other scrcpy client version. This would add annoying constraints for absolutely no benefit for scrcpy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the principle, probably ok.
However, on my Android 6 device, I don't understand what it should open, it does nothing more than if I press Alt+n only once.
On my Android 10:
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: com.android.internal.statusbar.IStatusBarService$Stub$Proxy.expandSettingsPanel []
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getMethod(Class.java:1693)
at com.genymobile.scrcpy.wrappers.StatusBarManager.getExpandSettingsPanel(StatusBarManager.java:30)
at com.genymobile.scrcpy.wrappers.StatusBarManager.expandSettingsPanel(StatusBarManager.java:52)
at com.genymobile.scrcpy.Device.expandSettingsPanel(Device.java:231)
at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:111)
at com.genymobile.scrcpy.Controller.control(Controller.java:71)
at com.genymobile.scrcpy.Server$2.run(Server.java:100)
at java.lang.Thread.run(Thread.java:919)
Also, it doesn't build/link tests on debug mode:
error
[2/10] Compiling C object app/test_control_msg_serialize.p/tests_test_control_msg_serialize.c.o
../app/tests/test_control_msg_serialize.c: In function ‘main’:
../app/tests/test_control_msg_serialize.c:292:5: warning: implicit declaration of function ‘test_serialize_collapse_notification_panel’; did you mean ‘test_serialize_expand_notification_panel’? [-Wimplicit-function-declaration]
292 | test_serialize_collapse_notification_panel();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| test_serialize_expand_notification_panel
At top level:
../app/tests/test_control_msg_serialize.c:195:13: warning: ‘test_serialize_collapse_panels’ defined but not used [-Wunused-function]
195 | static void test_serialize_collapse_panels(void) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../app/tests/test_control_msg_serialize.c:180:13: warning: ‘test_serialize_expand_settings_panel’ defined but not used [-Wunused-function]
180 | static void test_serialize_expand_settings_panel(void) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[7/10] Linking target app/test_control_msg_serialize
FAILED: app/test_control_msg_serialize
cc -o app/test_control_msg_serialize app/test_control_msg_serialize.p/tests_test_control_msg_serialize.c.o app/test_control_msg_serialize.p/src_control_msg.c.o app/test_control_msg_serialize.p/src_util_str_util.c.o -fsanitize=address,undefined -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib/x86_64-linux-gnu/libavformat.so /usr/lib/x86_64-linux-gnu/libavcodec.so /usr/lib/x86_64-linux-gnu/libavutil.so /usr/lib/x86_64-linux-gnu/libSDL2.so -Wl,--end-group
/usr/bin/ld: app/test_control_msg_serialize.p/tests_test_control_msg_serialize.c.o: in function `main':
../app/tests/test_control_msg_serialize.c:292: undefined reference to `test_serialize_collapse_notification_panel'
collect2: error: ld returned 1 exit status
[8/10] Compiling C object app/scrcpy.p/src_input_manager.c.o
ninja: build stopped: subcommand failed.
app/src/input_manager.c
Outdated
collapse_notification_panel(controller); | ||
} else { | ||
collapse_panels(controller); | ||
} else if(repeatCount == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could also probably be done on double-click on mouse button 5 now 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly! That PR is nearly ready ^^
I'll see those settings problems. I only own an android 6 phone. I will try to see why that exception happens with an emulator. |
89ad79d
to
7b4679b
Compare
@rom1v Please confirm if it works now on your Android 10. |
It's the same as scrolling the panel down a 2nd time. You get the buttons to turn on/off wifi, autorotate, etc... Edit: |
a070911
to
764975e
Compare
Yes, it works 👍 Could you please rebase your commits (with |
@rom1v Fine to me. |
02efbf9
to
aa60476
Compare
aa60476
to
cd533a9
Compare
Thank you, this shortcut is very practical. 👍 I rebased/changed some minor things:
Here is a branch: Please test/review if it's ok for you. |
The collapsing action collapses any panels. By the way, the Android method is named collapsePanels(). PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
This will allow shortcuts such as MOD+n+n to open the settings panel. PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
OK. I'll work on taking these into account for next times.
Overall looks good. I only have nitpicks: StatusBarManager.java: Is it OK if I rebase this branch on the one you did and make the changes to the README? |
The collapsing action collapses any panels. By the way, the Android method is named collapsePanels(). PR Genymobile#2260 <Genymobile#2260> Signed-off-by: Romain Vimont <[email protected]>
This will allow shortcuts such as MOD+n+n to open the settings panel. PR Genymobile#2260 <Genymobile#2260> Signed-off-by: Romain Vimont <[email protected]>
PR Genymobile#2260 <Genymobile#2260> Signed-off-by: Romain Vimont <[email protected]>
PR Genymobile#2260 <Genymobile#2260> Signed-off-by: Romain Vimont <[email protected]>
Double-click on extra mouse button to open the settings panel (a single-click opens the notification panel). This is consistent with the keyboard shortcut MOD+n+n. PR Genymobile#2264 <Genymobile#2264> Signed-off-by: Romain Vimont <[email protected]>
OK, I first made the change for the existing code: ba47b33 New branch:
Yes, just push force |
cd533a9
to
01f424e
Compare
What do you think of the README like that? |
PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
The collapsing action collapses any panels. By the way, the Android method is named collapsePanels(). PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
This will allow shortcuts such as MOD+n+n to open the settings panel. PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
PR #2260 <#2260> Signed-off-by: Romain Vimont <[email protected]>
👌 (I just changed left-double-click to double-left-click, and the same for double-5th-click). Merged into |
Show the settings panel if pressing
CTRL
+n
and then, without releasing CTRL, pressn
againStill not done/updated:
README:
CTRL
+SHIFT
+n
doesCloses: #2264