This commit is contained in:
igor725 2021-08-22 19:03:46 +03:00
parent 58ed353cca
commit ce8c7efae7
No known key found for this signature in database
GPG key ID: 46F13BBE46F8569D
2 changed files with 5 additions and 5 deletions

View file

@ -1424,7 +1424,7 @@ static struct SettingsScreen {
#if defined CC_BUILD_ANDROID #if defined CC_BUILD_ANDROID
static void SettingsScreen_LockOrientation(void* w, int idx) { static void SettingsScreen_LockOrientation(void* w, int idx) {
struct LCheckbox* cb = (struct LCheckbox*)w; struct LCheckbox* cb = (struct LCheckbox*)w;
cb->value ^= true; cb->value = !cb->value;
Options_SetBool(OPT_LANDSCAPE_MODE, cb->value); Options_SetBool(OPT_LANDSCAPE_MODE, cb->value);
Window_LockLandscapeOrientation(cb->value); Window_LockLandscapeOrientation(cb->value);
Launcher_Redraw(); Launcher_Redraw();
@ -1445,7 +1445,7 @@ static void SettingsScreen_Init(struct LScreen* s_) {
LLabel_Init(s_, &s->lblColours, "&eChange how the launcher looks"); LLabel_Init(s_, &s->lblColours, "&eChange how the launcher looks");
#if defined CC_BUILD_ANDROID #if defined CC_BUILD_ANDROID
LLabel_Init(s_, &s->lblOrientlock, "Portrait orientation lock"); LLabel_Init(s_, &s->lblOrientlock, "Force landscape");
LCheckbox_Init(s_, &s->cbOrientlock); LCheckbox_Init(s_, &s->cbOrientlock);
s->cbOrientlock.OnClick = SettingsScreen_LockOrientation; s->cbOrientlock.OnClick = SettingsScreen_LockOrientation;
#endif #endif
@ -1480,7 +1480,7 @@ static void SettingsScreen_Layout(struct LScreen* s_) {
#if defined CC_BUILD_ANDROID #if defined CC_BUILD_ANDROID
LWidget_SetLocation(&s->cbOrientlock, ANCHOR_CENTRE, ANCHOR_CENTRE, -178, 24); LWidget_SetLocation(&s->cbOrientlock, ANCHOR_CENTRE, ANCHOR_CENTRE, -178, 24);
LWidget_SetLocation(&s->lblOrientlock, ANCHOR_CENTRE, ANCHOR_CENTRE, -58, 24); LWidget_SetLocation(&s->lblOrientlock, ANCHOR_CENTRE, ANCHOR_CENTRE, -84, 24);
#endif #endif
LWidget_SetLocation(&s->btnBack, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 170); LWidget_SetLocation(&s->btnBack, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 170);

View file

@ -410,8 +410,8 @@ void Window_LockLandscapeOrientation(cc_bool lock) {
JavaGetCurrentEnv(env); JavaGetCurrentEnv(env);
/* SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 0x00000006 */ /* SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 0x00000006 */
/* SCREEN_ORIENTATION_USER = 0x00000002 */ /* SCREEN_ORIENTATION_UNSPECIFIED = 0xffffffff */
args[0].i = lock ? 0x00000006 : 0x00000002; args[0].i = lock ? 0x00000006 : 0xffffffff;
JavaCallVoid(env, "setRequestedOrientation", "(I)V", args); JavaCallVoid(env, "setRequestedOrientation", "(I)V", args);
} }