Skip to content

Commit 2544e7b

Browse files
authored
Merge pull request #247 from chrisws/12_29
12 29
2 parents 3269fe4 + 0a77735 commit 2544e7b

40 files changed

+1183
-784
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ function(buildSDL)
101101
)
102102

103103
# message("SDL version: ${_SDL_VERSION}")
104-
set(BUILD_DATE `date +"%a, %d %b %Y"`)
105104
set(_SDL_VERSION ${_SDL_VERSION})
106105
set(_SDL ON)
107106
set(_UnixOS ON)

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [12.29])
10+
AC_INIT([smallbasic], [12.30])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET

images/keypad/build.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ declare -a IMAGE_FILES=(\
1010
"backspace"\
1111
"arrow-enter"\
1212
"search"\
13-
"keyboard-shift"\
14-
"keyboard"\
13+
"layers"\
14+
"arrow-down"\
15+
"arrow-download"\
16+
"arrow-up" \
17+
"arrow-upload" \
18+
"tag"
1519
)
1620

1721
echo "#pragma once" > keypad_icons.h

src/lib/maapi.h

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,29 @@
1616
02111-1307, USA.
1717
*/
1818

19-
#if !defined(MAAPI_H)
20-
#define MAAPI_H
21-
22-
#include <stdint.h>
19+
#pragma once
20+
#include <cstdint>
2321

2422
#define EXTENT_Y(e) ((short)(e))
2523
#define EXTENT_X(e) ((short)((e) >> 16))
2624
#define TRANS_NONE 0
2725
#define FONT_TYPE_SERIF 0
2826
#define FONT_TYPE_SANS_SERIF 1
2927
#define FONT_TYPE_MONOSPACE 2
30-
// same values as tizen enum FontStyle
3128
#define FONT_STYLE_NORMAL 0x0001
3229
#define FONT_STYLE_BOLD 0x0002
3330
#define FONT_STYLE_ITALIC 0x0004
34-
#define HANDLE_LOCAL 0
35-
#define RES_OUT_OF_MEMORY -1
36-
#define RES_BAD_INPUT -2
3731
#define RES_OK 1
3832
#define HANDLE_SCREEN 0
3933
#define RES_FONT_OK 1
40-
#define MAK_MENU 293
4134
#define EVENT_TYPE_POINTER_PRESSED 8
4235
#define EVENT_TYPE_POINTER_RELEASED 9
4336
#define EVENT_TYPE_POINTER_DRAGGED 10
4437
#define EVENT_TYPE_KEY_PRESSED 11
4538
#define EVENT_TYPE_OPTIONS_BOX_BUTTON_CLICKED 41
4639
#define EVENT_TYPE_SCREEN_CHANGED 21
4740

48-
#ifndef _WCHAR_DEFINED
49-
#define _WCHAR_DEFINED
50-
typedef wchar_t wchar;
51-
#endif //_WCHAR_DEFINED
52-
53-
#ifndef _SYSV_TYPES_DEFINED
54-
#define _SYSV_TYPES_DEFINED
55-
typedef unsigned short ushort;
56-
typedef unsigned int uint;
57-
#endif //_SYSV_TYPES_DEFINED
58-
5941
typedef int MAExtent;
60-
typedef void* MAAddress;
6142
typedef intptr_t MAHandle;
6243

6344
typedef struct MARect {
@@ -170,7 +151,7 @@ void maDrawText(int left, int top, const char *str, int length);
170151
/**
171152
* Copies the back buffer to the physical screen.
172153
*/
173-
void maUpdateScreen(void);
154+
void maUpdateScreen();
174155

175156
/**
176157
* Returns the size in pixels of Latin-1 text as it would appear on-screen.
@@ -181,7 +162,7 @@ MAExtent maGetTextSize(const char *str);
181162
* Returns the screen size.
182163
* Returns the screen size.
183164
*/
184-
MAExtent maGetScrSize(void);
165+
MAExtent maGetScrSize();
185166

186167
/**
187168
* Returns a handle to one of the default fonts of the device, in the style and size you specify.
@@ -231,14 +212,14 @@ void maDrawImageRegion(MAHandle image, const MARect *srcRect, const MAPoint2d *d
231212
* \param width Width, in pixels, of the new image. Must be \> 0.
232213
* \param height Height, in pixels, of the new image. Must be \> 0.
233214
* \see maSetDrawTarget()
234-
* \returns #RES_OK if succeded and #RES_OUT_OF_MEMORY if failed.
215+
* \returns #RES_OK if succeeded and #RES_OUT_OF_MEMORY if failed.
235216
*/
236217
int maCreateDrawableImage(MAHandle placeholder, int width, int height);
237218

238219
/**
239220
* Creates a new placeholder and returns the handle to it.
240221
*/
241-
MAHandle maCreatePlaceholder(void);
222+
MAHandle maCreatePlaceholder();
242223

243224
/**
244225
* Releases a handle returned by maCreatePlaceholder().
@@ -264,13 +245,13 @@ void maDestroyPlaceholder(MAHandle handle);
264245
* The destination rectangle is defined as { 0,0, \a srcRect.width, \a srcRect.height }.
265246
* Parts of the destination array that are outside the destination rectangle are not modified.
266247
* If \a srcRect is outside the bounds of the source image,
267-
* or if \a srcRect.width is greater than \a scanlength, a MoSync Panic is thrown.
248+
* or if \a srcRect.width is greater than \a scanLength, a MoSync Panic is thrown.
268249
* \param image The handle to the source image.
269250
* \param dst The address of the destination array.
270-
* \param scanlength The width of the image, in pixels, represented by the destination array.
251+
* \param scanLength The width of the image, in pixels, represented by the destination array.
271252
* \param srcRect The portion of the source image to be copied.
272253
*/
273-
void maGetImageData(MAHandle image, void *dst, const MARect *srcRect, int scanlength);
254+
void maGetImageData(MAHandle image, void *dst, const MARect *srcRect, int scanLength);
274255

275256
/**
276257
* Sets the current draw target.
@@ -287,17 +268,17 @@ MAHandle maSetDrawTarget(MAHandle image);
287268
* Returns the number of milliseconds that has passed since some unknown point in time.
288269
* Accuracy is platform-specific, but should be better than 20 ms.
289270
*/
290-
int maGetMilliSecondCount(void);
271+
int maGetMilliSecondCount();
291272

292273
/**
293274
* Shows the virtual keyboard.
294275
*/
295-
void maShowVirtualKeyboard(void);
276+
void maShowVirtualKeyboard();
296277

297278
/**
298279
* Hides the virtual keyboard.
299280
*/
300-
void maHideVirtualKeyboard(void);
281+
void maHideVirtualKeyboard();
301282

302283
/**
303284
* There is a FIFO buffer that contains up to #EVENT_BUFFER_SIZE events.
@@ -339,4 +320,3 @@ void maPushEvent(MAEvent *event);
339320
*/
340321
void maWait(int timeout);
341322

342-
#endif

src/platform/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ apply plugin: 'com.android.application'
22

33
android {
44
// app can use the API features included in this API level and lower.
5-
compileSdk 34
5+
compileSdk 36
66

77
// can override some attributes in main/AndroidManifest.xml
88
defaultConfig {
99
applicationId 'net.sourceforge.smallbasic'
1010
minSdkVersion 21
11-
targetSdkVersion 34
12-
versionCode 78
13-
versionName '12.29'
11+
targetSdkVersion 36
12+
versionCode 80
13+
versionName '12.30'
1414
resourceConfigurations += ['en']
1515
}
1616

src/platform/android/app/src/main/java/net/sourceforge/smallbasic/EditorBar.java

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
import android.view.View;
3737
import android.view.inputmethod.InputMethodManager;
3838
import android.widget.Toast;
39+
import android.window.OnBackInvokedCallback;
40+
import android.window.OnBackInvokedDispatcher;
3941

4042
import androidx.annotation.RequiresPermission;
4143
import androidx.core.app.ActivityCompat;
@@ -118,6 +120,7 @@ public class MainActivity extends NativeActivity {
118120
public static native void consoleLog(String value);
119121
public static native boolean libraryMode();
120122
public static native void onActivityPaused(boolean paused);
123+
public static native void onBack();
121124
public static native void onResize(int width, int height);
122125
public static native void onUnicodeChar(int ch);
123126
public static native boolean optionSelected(int index);
@@ -766,6 +769,7 @@ protected void onCreate(Bundle savedInstanceState) {
766769
super.onCreate(savedInstanceState);
767770
setImmersiveMode();
768771
setupStorageEnvironment();
772+
setupPredictiveBack();
769773
if (!libraryMode()) {
770774
processIntent();
771775
processSettings();
@@ -1055,6 +1059,24 @@ private void setImmersiveMode() {
10551059
}
10561060
}
10571061

1062+
//
1063+
// Hook into Predictive Back (Android 13+)
1064+
//
1065+
private void setupPredictiveBack() {
1066+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
1067+
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
1068+
OnBackInvokedDispatcher.PRIORITY_DEFAULT,
1069+
new OnBackInvokedCallback() {
1070+
@Override
1071+
public void onBackInvoked() {
1072+
Log.d(TAG, "onBackInvoked");
1073+
onBack();
1074+
}
1075+
}
1076+
);
1077+
}
1078+
}
1079+
10581080
private void setupStorageEnvironment() {
10591081
_storage = new Storage();
10601082
setenv("EXTERNAL_DIR", _storage.getExternal());

src/platform/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:8.10.0'
8+
classpath 'com.android.tools.build:gradle:8.11.1'
99
}
1010
}
1111

src/platform/android/jni/Android.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ LOCAL_SRC_FILES := main.cpp \
4747
../../../ui/image.cpp \
4848
../../../ui/inputs.cpp \
4949
../../../ui/textedit.cpp \
50+
../../../ui/keypad.cpp \
51+
../../../ui/image_codec.cpp\
5052
../../../ui/strlib.cpp \
5153
../../../ui/graphics.cpp \
5254
../../../ui/system.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
APP_ABI := all
22
APP_STL := c++_shared
3+
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true

0 commit comments

Comments
 (0)