bare-gtk 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.c +0 -2
- package/lib/entry.d.ts +4 -10
- package/lib/entry.h +8 -25
- package/lib/entry.js +1 -3
- package/package.json +6 -3
- package/prebuilds/linux-arm64/bare +1 -1
- package/prebuilds/linux-arm64/bare-gtk.bare +0 -0
- package/prebuilds/linux-x64/bare +1 -1
- package/prebuilds/linux-x64/bare-gtk.bare +0 -0
package/binding.c
CHANGED
|
@@ -391,8 +391,6 @@ bare_gtk_exports(js_env_t *env, js_value_t *exports) {
|
|
|
391
391
|
V("ENTRY_EVENT_CURSOR_POSITION", bare_gtk_entry_event_cursor_position)
|
|
392
392
|
V("ENTRY_EVENT_INSERT_TEXT", bare_gtk_entry_event_insert_text)
|
|
393
393
|
V("ENTRY_EVENT_DELETE_TEXT", bare_gtk_entry_event_delete_text)
|
|
394
|
-
V("ENTRY_EVENT_HAS_FOCUS", bare_gtk_entry_event_has_focus)
|
|
395
|
-
V("ENTRY_EVENT_IS_FOCUS", bare_gtk_entry_event_is_focus)
|
|
396
394
|
|
|
397
395
|
V("TEXT_VIEW_EVENT_HAS_FOCUS", bare_gtk_text_view_event_has_focus)
|
|
398
396
|
V("TEXT_VIEW_EVENT_IS_FOCUS", bare_gtk_text_view_event_is_focus)
|
package/lib/entry.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import GTKWidget = require('./widget')
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* A single line of editable text, as a `GtkEntry`. The focus goes to the text inside the entry
|
|
5
|
+
* rather than the entry itself, so follow it with a `GTKEventControllerFocus`.
|
|
6
|
+
*/
|
|
4
7
|
interface GTKEntry extends GTKWidget<GTKEntry.Events> {
|
|
5
8
|
text: string
|
|
6
9
|
|
|
@@ -78,15 +81,6 @@ declare namespace GTKEntry {
|
|
|
78
81
|
|
|
79
82
|
/** The text from `start` to `end` is about to be deleted. `text` is empty. */
|
|
80
83
|
'delete-text': [text: string, start: number, end: number]
|
|
81
|
-
|
|
82
|
-
/** The entry got or lost the keyboard. `focused` is 1 or 0. */
|
|
83
|
-
'has-focus': [focused: number]
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The entry became or stopped being the focus widget of its window. `focused` is 1 or 0.
|
|
87
|
-
* A window that is not active still has a focus widget.
|
|
88
|
-
*/
|
|
89
|
-
'is-focus': [focused: number]
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
86
|
|
package/lib/entry.h
CHANGED
|
@@ -15,8 +15,6 @@ enum {
|
|
|
15
15
|
bare_gtk_entry_event_cursor_position = 1 << 2,
|
|
16
16
|
bare_gtk_entry_event_insert_text = 1 << 3,
|
|
17
17
|
bare_gtk_entry_event_delete_text = 1 << 4,
|
|
18
|
-
bare_gtk_entry_event_has_focus = 1 << 5,
|
|
19
|
-
bare_gtk_entry_event_is_focus = 1 << 6,
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
typedef struct {
|
|
@@ -31,8 +29,6 @@ typedef struct {
|
|
|
31
29
|
gulong on_cursor_position;
|
|
32
30
|
gulong on_insert_text;
|
|
33
31
|
gulong on_delete_text;
|
|
34
|
-
gulong on_has_focus;
|
|
35
|
-
gulong on_is_focus;
|
|
36
32
|
} BareEntry;
|
|
37
33
|
|
|
38
34
|
typedef struct {
|
|
@@ -73,22 +69,6 @@ bare_gtk_entry__on_cursor_position(GObject *object, GParamSpec *spec, gpointer d
|
|
|
73
69
|
bare_gtk__emit(self->state, object, "cursor-position", 0, NULL);
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
static void
|
|
77
|
-
bare_gtk_entry__on_has_focus(GObject *object, GParamSpec *spec, gpointer data) {
|
|
78
|
-
BareEntry *self = (BareEntry *) object;
|
|
79
|
-
|
|
80
|
-
bare_gtk__emit(self->state, object, "has-focus", 1, (const double[]) {gtk_widget_has_focus(GTK_WIDGET(object)) ? 1 : 0});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Whether this is the focus widget of its window. That is not the same as
|
|
84
|
-
// having the keyboard: a window that is not active still has a focus widget.
|
|
85
|
-
static void
|
|
86
|
-
bare_gtk_entry__on_is_focus(GObject *object, GParamSpec *spec, gpointer data) {
|
|
87
|
-
BareEntry *self = (BareEntry *) object;
|
|
88
|
-
|
|
89
|
-
bare_gtk__emit(self->state, object, "is-focus", 1, (const double[]) {gtk_widget_is_focus(GTK_WIDGET(object)) ? 1 : 0});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
72
|
// GTK reports an insertion and a deletion separately, where other toolkits
|
|
93
73
|
// report one replacement, so both are sent as a replacement.
|
|
94
74
|
static void
|
|
@@ -163,8 +143,6 @@ bare_gtk_entry_event_mask(js_env_t *env, js_callback_info_t *info) {
|
|
|
163
143
|
V(bare_gtk_entry_event_cursor_position, on_cursor_position, "notify::cursor-position", bare_gtk_entry__on_cursor_position)
|
|
164
144
|
V(bare_gtk_entry_event_insert_text, on_insert_text, "insert-text", bare_gtk_entry__on_insert_text)
|
|
165
145
|
V(bare_gtk_entry_event_delete_text, on_delete_text, "delete-text", bare_gtk_entry__on_delete_text)
|
|
166
|
-
V(bare_gtk_entry_event_has_focus, on_has_focus, "notify::has-focus", bare_gtk_entry__on_has_focus)
|
|
167
|
-
V(bare_gtk_entry_event_is_focus, on_is_focus, "notify::is-focus", bare_gtk_entry__on_is_focus)
|
|
168
146
|
#undef V
|
|
169
147
|
|
|
170
148
|
return NULL;
|
|
@@ -192,11 +170,16 @@ bare_gtk_entry_placeholder_text(js_env_t *env, js_callback_info_t *info) {
|
|
|
192
170
|
if (argc == 1) {
|
|
193
171
|
const char *text = gtk_entry_get_placeholder_text(entry);
|
|
194
172
|
|
|
195
|
-
|
|
196
|
-
|
|
173
|
+
if (text) {
|
|
174
|
+
err = js_create_string_utf8(env, (const utf8_t *) text, (size_t) -1, &result);
|
|
175
|
+
assert(err == 0);
|
|
176
|
+
} else {
|
|
177
|
+
err = js_get_null(env, &result);
|
|
178
|
+
assert(err == 0);
|
|
179
|
+
}
|
|
197
180
|
} else {
|
|
198
181
|
char *text;
|
|
199
|
-
err =
|
|
182
|
+
err = bare_gtk__read_string_or_null(env, argv[1], "text", &text);
|
|
200
183
|
if (err < 0) return NULL;
|
|
201
184
|
|
|
202
185
|
gtk_entry_set_placeholder_text(entry, text);
|
package/lib/entry.js
CHANGED
|
@@ -7,9 +7,7 @@ module.exports = exports = class GTKEntry extends GTKWidget {
|
|
|
7
7
|
activate: binding.ENTRY_EVENT_ACTIVATE,
|
|
8
8
|
'cursor-position': binding.ENTRY_EVENT_CURSOR_POSITION,
|
|
9
9
|
'insert-text': binding.ENTRY_EVENT_INSERT_TEXT,
|
|
10
|
-
'delete-text': binding.ENTRY_EVENT_DELETE_TEXT
|
|
11
|
-
'has-focus': binding.ENTRY_EVENT_HAS_FOCUS,
|
|
12
|
-
'is-focus': binding.ENTRY_EVENT_IS_FOCUS
|
|
10
|
+
'delete-text': binding.ENTRY_EVENT_DELETE_TEXT
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
_init(opts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-gtk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "GTK bindings and runtime for Bare",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package": "./package.json",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"format": "prettier --write . && lunte --fix",
|
|
30
30
|
"lint": "prettier --check . && lunte",
|
|
31
|
-
"test": "
|
|
31
|
+
"test": "bare-native-test --runtime bare-gtk/runtime test.js"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
@@ -48,7 +48,10 @@
|
|
|
48
48
|
"bare-build": "^1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"
|
|
51
|
+
"bare-animation-frame": "^0.1.0",
|
|
52
|
+
"bare-gtk": "file:.",
|
|
53
|
+
"bare-native-test": "^0.1.0",
|
|
54
|
+
"bare-tap": "^1.1.0",
|
|
52
55
|
"cmake-bare": "^1.6.5",
|
|
53
56
|
"cmake-fetch": "^1.4.0",
|
|
54
57
|
"lunte": "^1.8.0",
|
|
Binary file
|
package/prebuilds/linux-x64/bare
CHANGED
|
Binary file
|