Skip to content

Commit 30c8a33

Browse files
Merge pull request #2 from minetest/master
Update
2 parents 99fe5cb + 128d22e commit 30c8a33

File tree

177 files changed

+5057
-2740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+5057
-2740
lines changed

.clang-format

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ IndentWidth: 4
33
UseTab: Always
44
TabWidth: 4
55
BreakBeforeBraces: Custom
6-
Standard: Cpp11
6+
Standard: c++17
77
BraceWrapping:
88
AfterClass: true
9-
AfterControlStatement: false
9+
AfterControlStatement: Never
1010
AfterEnum: true
1111
AfterFunction: true
1212
AfterNamespace: true
@@ -20,7 +20,7 @@ IndentCaseLabels: false
2020
AccessModifierOffset: -4
2121
ColumnLimit: 90
2222
AllowShortFunctionsOnASingleLine: InlineOnly
23-
SortIncludes: false
23+
SortIncludes: Never
2424
IncludeCategories:
2525
- Regex: '^".*'
2626
Priority: 2

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ You can use `minetest --version` to find it.
1616
1717
```
1818

19+
<!-- For graphical and input-related issues. You can find these in the About tab in the mainmenu. -->
20+
Active renderer:
21+
Irrlicht device:
22+
1923
##### OS / Hardware
2024
<!-- General information about your hardware and operating system -->
2125
Operating system:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Add compact, short information about your PR for easier understanding:
33
- Goal of the PR
44
- How does the PR work?
55
- Does it resolve any reported issue?
6-
- Does this relate to a goal in [the roadmap](../doc/direction.md)?
6+
- Does this relate to a goal in [the roadmap](https://github.com/minetest/minetest/blob/master/doc/direction.md)?
77
- If not a bug fix, why is this PR needed? What usecases does it solve?
88

99
## To do

.github/workflows/build.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,21 @@ env:
3434

3535
jobs:
3636
# Older gcc version (should be close to our minimum supported version)
37-
gcc_5:
38-
runs-on: ubuntu-18.04
39-
if: "false" # FIXME
37+
gcc_7:
38+
runs-on: ubuntu-20.04
4039
steps:
4140
- uses: actions/checkout@v3
4241
- name: Install deps
4342
run: |
4443
source ./util/ci/common.sh
45-
install_linux_deps g++-5
44+
install_linux_deps g++-7
4645
4746
- name: Build
4847
run: |
4948
./util/ci/build.sh
5049
env:
51-
CC: gcc-5
52-
CXX: g++-5
50+
CC: gcc-7
51+
CXX: g++-7
5352

5453
- name: Test
5554
run: |
@@ -77,22 +76,21 @@ jobs:
7776
./bin/minetest --run-unittests
7877
7978
# Older clang version (should be close to our minimum supported version)
80-
clang_3_9:
81-
runs-on: ubuntu-18.04
82-
if: "false" # FIXME
79+
clang_6_0:
80+
runs-on: ubuntu-20.04
8381
steps:
8482
- uses: actions/checkout@v3
8583
- name: Install deps
8684
run: |
8785
source ./util/ci/common.sh
88-
install_linux_deps clang-3.9 valgrind
86+
install_linux_deps clang-6.0 valgrind
8987
9088
- name: Build
9189
run: |
9290
./util/ci/build.sh
9391
env:
94-
CC: clang-3.9
95-
CXX: clang++-3.9
92+
CC: clang-6.0
93+
CXX: clang++-6.0
9694

9795
- name: Unittest
9896
run: |
@@ -249,6 +247,8 @@ jobs:
249247
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
250248
-DCMAKE_BUILD_TYPE=Release `
251249
-DENABLE_POSTGRESQL=OFF `
250+
-DENABLE_LUAJIT=TRUE `
251+
-DREQUIRE_LUAJIT=TRUE `
252252
-DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
253253
254254
- name: Build Minetest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ gtags.files
2828
# Visual Studio Code & plugins
2929
.vscode/
3030
build/.cmake/
31+
# Fleet
32+
.fleet
3133
# Gradle
3234
.gradle
3335
# Clang

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ endif()
1111
project(minetest)
1212
set(PROJECT_NAME_CAPITALIZED "Minetest")
1313

14-
set(CMAKE_CXX_STANDARD 14)
14+
set(CMAKE_CXX_STANDARD 17)
1515
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
16-
set(GCC_MINIMUM_VERSION "5.1")
17-
set(CLANG_MINIMUM_VERSION "3.5")
16+
set(GCC_MINIMUM_VERSION "7.5")
17+
set(CLANG_MINIMUM_VERSION "6.0")
1818

1919
# You should not need to edit these manually, use util/bump_version.sh
2020
set(VERSION_MAJOR 5)

LICENSE.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,13 @@ SmallJoker:
8383
DS:
8484
games/devtest/mods/soundstuff/textures/soundstuff_bigfoot.png
8585
games/devtest/mods/soundstuff/textures/soundstuff_jukebox.png
86+
games/devtest/mods/soundstuff/textures/soundstuff_racecar.png
87+
games/devtest/mods/soundstuff/sounds/soundstuff_sinus.ogg
8688
games/devtest/mods/testtools/textures/testtools_branding_iron.png
8789

90+
grorp:
91+
textures/base/pack/exit_btn.png
92+
8893
License of Minetest source code
8994
-------------------------------
9095

android/app/src/main/java/net/minetest/minetest/CustomEditText.java

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Minetest
33
Copyright (C) 2014-2020 MoNTE48, Maksim Gamarnik <[email protected]>
44
Copyright (C) 2014-2020 ubulem, Bektur Mambetov <[email protected]>
5+
Copyright (C) 2023 srifqi, Muhammad Rifqi Priyo Susanto
6+
57
68
This program is free software; you can redistribute it and/or modify
79
it under the terms of the GNU Lesser General Public License as published by
@@ -29,17 +31,52 @@
2931
import java.util.Objects;
3032

3133
public class CustomEditText extends AppCompatEditText {
34+
private int editType = 2; // single line text input as default
35+
private boolean wantsToShowKeyboard = false;
36+
3237
public CustomEditText(Context context) {
3338
super(context);
3439
}
3540

41+
public CustomEditText(Context context, int _editType) {
42+
super(context);
43+
editType = _editType;
44+
}
45+
3646
@Override
3747
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
38-
if (keyCode == KeyEvent.KEYCODE_BACK) {
48+
// For multi-line, do not close the dialog after pressing back button
49+
if (editType != 1 && keyCode == KeyEvent.KEYCODE_BACK) {
3950
InputMethodManager mgr = (InputMethodManager)
4051
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
4152
Objects.requireNonNull(mgr).hideSoftInputFromWindow(this.getWindowToken(), 0);
4253
}
4354
return false;
4455
}
56+
57+
@Override
58+
public void onWindowFocusChanged(boolean hasWindowFocus) {
59+
super.onWindowFocusChanged(hasWindowFocus);
60+
tryShowKeyboard();
61+
}
62+
63+
public void requestFocusTryShow() {
64+
requestFocus();
65+
wantsToShowKeyboard = true;
66+
tryShowKeyboard();
67+
}
68+
69+
private void tryShowKeyboard() {
70+
if (hasWindowFocus() && wantsToShowKeyboard) {
71+
if (isFocused()) {
72+
CustomEditText that = this;
73+
post(() -> {
74+
final InputMethodManager imm = (InputMethodManager)
75+
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
76+
imm.showSoftInput(that, 0);
77+
});
78+
}
79+
wantsToShowKeyboard = false;
80+
}
81+
}
4582
}

android/app/src/main/java/net/minetest/minetest/GameActivity.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import android.view.WindowManager;
3232
import android.view.inputmethod.InputMethodManager;
3333
import android.widget.Button;
34-
import android.widget.EditText;
3534
import android.widget.LinearLayout;
3635

3736
import androidx.annotation.Keep;
@@ -96,21 +95,11 @@ private void showDialogUI(String hint, String current, int editType) {
9695
container.setOrientation(LinearLayout.VERTICAL);
9796
builder.setView(container);
9897
AlertDialog alertDialog = builder.create();
99-
EditText editText;
100-
// For multi-line, do not close the dialog after pressing back button
101-
if (editType == 1) {
102-
editText = new EditText(this);
103-
} else {
104-
editText = new CustomEditText(this);
105-
}
98+
CustomEditText editText = new CustomEditText(this, editType);
10699
container.addView(editText);
107100
editText.setMaxLines(8);
108-
editText.requestFocus();
109101
editText.setHint(hint);
110102
editText.setText(current);
111-
final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
112-
Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.SHOW_FORCED,
113-
InputMethodManager.HIDE_IMPLICIT_ONLY);
114103
if (editType == 1)
115104
editText.setInputType(InputType.TYPE_CLASS_TEXT |
116105
InputType.TYPE_TEXT_FLAG_MULTI_LINE);
@@ -119,7 +108,8 @@ else if (editType == 3)
119108
InputType.TYPE_TEXT_VARIATION_PASSWORD);
120109
else
121110
editText.setInputType(InputType.TYPE_CLASS_TEXT);
122-
editText.setSelection(editText.getText().length());
111+
editText.setSelection(Objects.requireNonNull(editText.getText()).length());
112+
final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
123113
editText.setOnKeyListener((view, keyCode, event) -> {
124114
// For multi-line, do not submit the text after pressing Enter key
125115
if (keyCode == KeyEvent.KEYCODE_ENTER && editType != 1) {
@@ -143,12 +133,13 @@ else if (editType == 3)
143133
alertDialog.dismiss();
144134
}));
145135
}
146-
alertDialog.show();
147136
alertDialog.setOnCancelListener(dialog -> {
148137
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
149138
messageReturnValue = current;
150139
messageReturnCode = -1;
151140
});
141+
alertDialog.show();
142+
editText.requestFocusTryShow();
152143
}
153144

154145
public int getDialogState() {

android/icons/exit_btn.svg

Lines changed: 111 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)