@lynx-js/lynx-library-headers 0.0.1-alpha.4
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/README.md +53 -0
- package/include/base/include/value/lynx_api_types.h +57 -0
- package/include/base/include/value/lynx_value_api.h +204 -0
- package/include/base/include/value/lynx_value_types.h +73 -0
- package/include/capi/lynx_env_capi.h +47 -0
- package/include/capi/lynx_event_reporter_service_capi.h +67 -0
- package/include/capi/lynx_export.h +27 -0
- package/include/capi/lynx_extension_module_capi.h +148 -0
- package/include/capi/lynx_extension_module_types_capi.h +17 -0
- package/include/capi/lynx_generic_resource_fetcher_capi.h +124 -0
- package/include/capi/lynx_group_capi.h +42 -0
- package/include/capi/lynx_http_service_capi.h +113 -0
- package/include/capi/lynx_load_meta_capi.h +52 -0
- package/include/capi/lynx_log_capi.h +69 -0
- package/include/capi/lynx_memory_capi.h +28 -0
- package/include/capi/lynx_native_module_capi.h +51 -0
- package/include/capi/lynx_native_view_capi.h +163 -0
- package/include/capi/lynx_resource_request_capi.h +71 -0
- package/include/capi/lynx_resource_response_capi.h +92 -0
- package/include/capi/lynx_runtime_lifecycle_observer_capi.h +62 -0
- package/include/capi/lynx_security_service_capi.h +52 -0
- package/include/capi/lynx_service_center_capi.h +50 -0
- package/include/capi/lynx_template_bundle_capi.h +39 -0
- package/include/capi/lynx_template_data_capi.h +33 -0
- package/include/capi/lynx_trace_capi.h +62 -0
- package/include/capi/lynx_trail_service_capi.h +35 -0
- package/include/capi/lynx_types.h +750 -0
- package/include/capi/lynx_update_meta_capi.h +33 -0
- package/include/capi/lynx_view_builder_capi.h +113 -0
- package/include/capi/lynx_view_capi.h +174 -0
- package/include/capi/lynx_view_client_capi.h +81 -0
- package/include/capi/lynx_vsync_monitor_capi.h +38 -0
- package/include/capi/lynx_windowless_renderer_capi.h +213 -0
- package/include/js_native_api.h +608 -0
- package/include/js_native_api_types.h +202 -0
- package/include/lynx/base/include/value/lynx_api_types.h +57 -0
- package/include/lynx/base/include/value/lynx_value_api.h +204 -0
- package/include/lynx/base/include/value/lynx_value_types.h +73 -0
- package/include/lynx/extension.h +6 -0
- package/include/lynx/platform/embedder/public/capi/lynx_env_capi.h +47 -0
- package/include/lynx/platform/embedder/public/capi/lynx_event_reporter_service_capi.h +67 -0
- package/include/lynx/platform/embedder/public/capi/lynx_export.h +27 -0
- package/include/lynx/platform/embedder/public/capi/lynx_extension_module_capi.h +148 -0
- package/include/lynx/platform/embedder/public/capi/lynx_extension_module_types_capi.h +17 -0
- package/include/lynx/platform/embedder/public/capi/lynx_generic_resource_fetcher_capi.h +124 -0
- package/include/lynx/platform/embedder/public/capi/lynx_group_capi.h +42 -0
- package/include/lynx/platform/embedder/public/capi/lynx_http_service_capi.h +113 -0
- package/include/lynx/platform/embedder/public/capi/lynx_load_meta_capi.h +52 -0
- package/include/lynx/platform/embedder/public/capi/lynx_log_capi.h +69 -0
- package/include/lynx/platform/embedder/public/capi/lynx_memory_capi.h +28 -0
- package/include/lynx/platform/embedder/public/capi/lynx_native_module_capi.h +51 -0
- package/include/lynx/platform/embedder/public/capi/lynx_native_view_capi.h +163 -0
- package/include/lynx/platform/embedder/public/capi/lynx_resource_request_capi.h +71 -0
- package/include/lynx/platform/embedder/public/capi/lynx_resource_response_capi.h +92 -0
- package/include/lynx/platform/embedder/public/capi/lynx_runtime_lifecycle_observer_capi.h +62 -0
- package/include/lynx/platform/embedder/public/capi/lynx_security_service_capi.h +52 -0
- package/include/lynx/platform/embedder/public/capi/lynx_service_center_capi.h +50 -0
- package/include/lynx/platform/embedder/public/capi/lynx_template_bundle_capi.h +39 -0
- package/include/lynx/platform/embedder/public/capi/lynx_template_data_capi.h +33 -0
- package/include/lynx/platform/embedder/public/capi/lynx_trace_capi.h +62 -0
- package/include/lynx/platform/embedder/public/capi/lynx_trail_service_capi.h +35 -0
- package/include/lynx/platform/embedder/public/capi/lynx_types.h +750 -0
- package/include/lynx/platform/embedder/public/capi/lynx_update_meta_capi.h +33 -0
- package/include/lynx/platform/embedder/public/capi/lynx_view_builder_capi.h +113 -0
- package/include/lynx/platform/embedder/public/capi/lynx_view_capi.h +174 -0
- package/include/lynx/platform/embedder/public/capi/lynx_view_client_capi.h +81 -0
- package/include/lynx/platform/embedder/public/capi/lynx_vsync_monitor_capi.h +38 -0
- package/include/lynx/platform/embedder/public/capi/lynx_windowless_renderer_capi.h +213 -0
- package/include/lynx/platform/embedder/public/lynx_env.h +104 -0
- package/include/lynx/platform/embedder/public/lynx_event_reporter_service.h +96 -0
- package/include/lynx/platform/embedder/public/lynx_event_simulation_proxy.h +31 -0
- package/include/lynx/platform/embedder/public/lynx_extension_module.h +521 -0
- package/include/lynx/platform/embedder/public/lynx_generic_resource_fetcher.h +178 -0
- package/include/lynx/platform/embedder/public/lynx_group.h +70 -0
- package/include/lynx/platform/embedder/public/lynx_http_service.h +211 -0
- package/include/lynx/platform/embedder/public/lynx_load_meta.h +120 -0
- package/include/lynx/platform/embedder/public/lynx_native_module.h +9 -0
- package/include/lynx/platform/embedder/public/lynx_native_view.h +201 -0
- package/include/lynx/platform/embedder/public/lynx_resource_request.h +56 -0
- package/include/lynx/platform/embedder/public/lynx_resource_response.h +63 -0
- package/include/lynx/platform/embedder/public/lynx_runtime_lifecycle_observer.h +102 -0
- package/include/lynx/platform/embedder/public/lynx_security_service.h +78 -0
- package/include/lynx/platform/embedder/public/lynx_service_center.h +64 -0
- package/include/lynx/platform/embedder/public/lynx_template_bundle.h +65 -0
- package/include/lynx/platform/embedder/public/lynx_template_data.h +104 -0
- package/include/lynx/platform/embedder/public/lynx_trail_service.h +81 -0
- package/include/lynx/platform/embedder/public/lynx_update_meta.h +56 -0
- package/include/lynx/platform/embedder/public/lynx_value.h +270 -0
- package/include/lynx/platform/embedder/public/lynx_view.h +364 -0
- package/include/lynx/platform/embedder/public/lynx_view_client.h +226 -0
- package/include/lynx/platform/embedder/public/lynx_vsync_monitor.h +70 -0
- package/include/lynx/platform/embedder/public/lynx_windowless_renderer.h +302 -0
- package/include/lynx/registration.h +178 -0
- package/include/lynx_env.h +104 -0
- package/include/lynx_event_reporter_service.h +96 -0
- package/include/lynx_event_simulation_proxy.h +31 -0
- package/include/lynx_extension.h +10 -0
- package/include/lynx_extension_module.h +521 -0
- package/include/lynx_generic_resource_fetcher.h +178 -0
- package/include/lynx_group.h +70 -0
- package/include/lynx_http_service.h +211 -0
- package/include/lynx_load_meta.h +120 -0
- package/include/lynx_native_module.h +9 -0
- package/include/lynx_native_view.h +201 -0
- package/include/lynx_resource_request.h +56 -0
- package/include/lynx_resource_response.h +63 -0
- package/include/lynx_runtime_lifecycle_observer.h +102 -0
- package/include/lynx_security_service.h +78 -0
- package/include/lynx_service_center.h +64 -0
- package/include/lynx_template_bundle.h +65 -0
- package/include/lynx_template_data.h +104 -0
- package/include/lynx_trail_service.h +81 -0
- package/include/lynx_update_meta.h +56 -0
- package/include/lynx_value.h +270 -0
- package/include/lynx_view.h +364 -0
- package/include/lynx_view_client.h +226 -0
- package/include/lynx_vsync_monitor.h +70 -0
- package/include/lynx_windowless_renderer.h +302 -0
- package/include/napi-inl.deprecated.h +186 -0
- package/include/napi-inl.h +6607 -0
- package/include/napi.h +3208 -0
- package/include/node_api.h +276 -0
- package/include/node_api_types.h +59 -0
- package/include/third_party/weak-node-api/headers/js_native_api.h +608 -0
- package/include/third_party/weak-node-api/headers/js_native_api_types.h +202 -0
- package/include/third_party/weak-node-api/headers/napi-inl.deprecated.h +186 -0
- package/include/third_party/weak-node-api/headers/napi-inl.h +6607 -0
- package/include/third_party/weak-node-api/headers/napi.h +3208 -0
- package/include/third_party/weak-node-api/headers/node_api.h +276 -0
- package/include/third_party/weak-node-api/headers/node_api_types.h +59 -0
- package/include/third_party/weak-node-api/headers/weak_napi_defines.h +331 -0
- package/include/third_party/weak-node-api/headers/weak_napi_undefs.h +282 -0
- package/include/weak_napi_defines.h +331 -0
- package/include/weak_napi_undefs.h +282 -0
- package/package.json +29 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_UPDATE_META_CAPI_H_
|
|
5
|
+
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_UPDATE_META_CAPI_H_
|
|
6
|
+
|
|
7
|
+
#include "lynx_export.h"
|
|
8
|
+
#include "lynx_template_bundle_capi.h"
|
|
9
|
+
#include "lynx_template_data_capi.h"
|
|
10
|
+
|
|
11
|
+
LYNX_EXTERN_C_BEGIN
|
|
12
|
+
|
|
13
|
+
// LynxUpdateMeta is the metadata structure used by LynxView to update template
|
|
14
|
+
// data. It will serve as the input parameter for UpdateData. Users can specify
|
|
15
|
+
// various parameters required for the update through LynxUpdateMeta, such as
|
|
16
|
+
// template data and globalProps, among others.
|
|
17
|
+
typedef struct lynx_update_meta_t lynx_update_meta_t;
|
|
18
|
+
|
|
19
|
+
LYNX_CAPI_EXPORT lynx_update_meta_t* lynx_update_meta_create();
|
|
20
|
+
// The content of the data to update the template.
|
|
21
|
+
LYNX_CAPI_EXPORT void lynx_update_meta_set_update_data(
|
|
22
|
+
lynx_update_meta_t*, lynx_template_data_t* data);
|
|
23
|
+
|
|
24
|
+
// The globalProps content for updating the template;
|
|
25
|
+
LYNX_CAPI_EXPORT void lynx_update_meta_set_global_props(
|
|
26
|
+
lynx_update_meta_t*, lynx_template_data_t* data);
|
|
27
|
+
|
|
28
|
+
// Release the update meta.
|
|
29
|
+
LYNX_CAPI_EXPORT void lynx_update_meta_release(lynx_update_meta_t*);
|
|
30
|
+
|
|
31
|
+
LYNX_EXTERN_C_END
|
|
32
|
+
|
|
33
|
+
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_UPDATE_META_CAPI_H_
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_BUILDER_CAPI_H_
|
|
5
|
+
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_BUILDER_CAPI_H_
|
|
6
|
+
|
|
7
|
+
#include "lynx_export.h"
|
|
8
|
+
#include "lynx_extension_module_types_capi.h"
|
|
9
|
+
#include "lynx_generic_resource_fetcher_capi.h"
|
|
10
|
+
#include "lynx_group_capi.h"
|
|
11
|
+
#include "lynx_native_module_capi.h"
|
|
12
|
+
#include "lynx_native_view_capi.h"
|
|
13
|
+
#include "lynx_windowless_renderer_capi.h"
|
|
14
|
+
|
|
15
|
+
LYNX_EXTERN_C_BEGIN
|
|
16
|
+
|
|
17
|
+
typedef void* NativeWindow;
|
|
18
|
+
|
|
19
|
+
typedef struct lynx_view_builder_t lynx_view_builder_t;
|
|
20
|
+
LYNX_CAPI_EXPORT lynx_view_builder_t* lynx_view_builder_create();
|
|
21
|
+
|
|
22
|
+
// Sets the screen size and pixel ratio for the LynxView being built. This
|
|
23
|
+
// function allows you to specify the screen size and pixel ratio of the device
|
|
24
|
+
// for the LynxView that is being constructed using the provided builder. The
|
|
25
|
+
// screen size affects the layout and rendering of the LynxView, and the pixel
|
|
26
|
+
// ratio is used to adjust the rendering quality of high - DPI displays.
|
|
27
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_screen_size(
|
|
28
|
+
lynx_view_builder_t*, const float& width, const float& height,
|
|
29
|
+
const float& pixel_ratio);
|
|
30
|
+
|
|
31
|
+
// Set the initial position and size of the LynxView. This function allows you
|
|
32
|
+
// to specify the initial position and dimensions of the LynxView being built
|
|
33
|
+
// using the provided builder. The position is defined by the `x` and `y`
|
|
34
|
+
// coordinates, and the size is defined by the `width` and `height` parameters.
|
|
35
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_frame(lynx_view_builder_t*,
|
|
36
|
+
const float& x,
|
|
37
|
+
const float& y,
|
|
38
|
+
const float& width,
|
|
39
|
+
const float& height);
|
|
40
|
+
|
|
41
|
+
// Sets the font scaling ratio for the LynxView being built. This function
|
|
42
|
+
// allows you to specify a scaling factor for the font size within the LynxView.
|
|
43
|
+
// The text size in the LynxView will be multiplied by this scaling ratio. For
|
|
44
|
+
// example, a value of 1.5 will increase the text size by 50%, while 0.8 will
|
|
45
|
+
// reduce it by 20%.
|
|
46
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_font_scale(lynx_view_builder_t*,
|
|
47
|
+
const float& scale);
|
|
48
|
+
|
|
49
|
+
// Sets the ICU data path for the LynxView being built. This function allows you
|
|
50
|
+
// to specify the path to the ICU (International Components for Unicode) data
|
|
51
|
+
// file that the LynxView will use for Unicode-related operations such as text
|
|
52
|
+
// processing, collation, and formatting. The ICU data is essential for proper
|
|
53
|
+
// handling of international text and multilingual support in the LynxView.
|
|
54
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_icu_data_path(
|
|
55
|
+
lynx_view_builder_t*, const char* icu_data_path);
|
|
56
|
+
|
|
57
|
+
// Sets the fixed WebView2 runtime path for the LynxView being built. Windows
|
|
58
|
+
// WebView native views first try the system WebView2 runtime, then retry with
|
|
59
|
+
// this fixed runtime path if the system runtime is unavailable or fails.
|
|
60
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_webview2_fixed_runtime_path(
|
|
61
|
+
lynx_view_builder_t*, const char* webview2_fixed_runtime_path);
|
|
62
|
+
|
|
63
|
+
// Associates a Lynx group with the LynxView being built. This function allows
|
|
64
|
+
// you to assign a specific Lynx group to the LynxView that is currently under
|
|
65
|
+
// construction using the provided builder. The Lynx group can contain shared
|
|
66
|
+
// resources, configurations, or state that the LynxView may utilize. By
|
|
67
|
+
// associating a Lynx group, the LynxView can inherit and interact with the
|
|
68
|
+
// group's context, which can be useful for managing resources and coordinating
|
|
69
|
+
// behavior across multiple views.
|
|
70
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_lynx_group(lynx_view_builder_t*,
|
|
71
|
+
lynx_group_t* group);
|
|
72
|
+
|
|
73
|
+
// Sets the parent window for the Lynx view being built. This function assigns a
|
|
74
|
+
// parent native window to the Lynx view that is being constructed using the
|
|
75
|
+
// provided builder. The parent window will contain the Lynx view, and the
|
|
76
|
+
// view's position and behavior may be influenced by its parent.
|
|
77
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_parent(lynx_view_builder_t*,
|
|
78
|
+
NativeWindow parent);
|
|
79
|
+
|
|
80
|
+
// Sets the windowless renderer for the Lynx view being built. This function
|
|
81
|
+
// assigns a windowless renderer to the Lynx view that is being constructed
|
|
82
|
+
// using the provided builder. The windowless renderer is responsible for
|
|
83
|
+
// rendering the Lynx view without a visible window, which can be useful for
|
|
84
|
+
// offscreen rendering or headless scenarios.
|
|
85
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_windowless_renderer(
|
|
86
|
+
lynx_view_builder_t*, lynx_windowless_renderer_t*);
|
|
87
|
+
|
|
88
|
+
// generic fetcher.
|
|
89
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_set_generic_resource_fetcher(
|
|
90
|
+
lynx_view_builder_t*, lynx_generic_resource_fetcher_t* fetcher);
|
|
91
|
+
|
|
92
|
+
// Register instance-level native module, which have a higher priority than
|
|
93
|
+
// global modules.
|
|
94
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_register_native_module(
|
|
95
|
+
lynx_view_builder_t* builder, const char* name, napi_module_creator creator,
|
|
96
|
+
void* opaque);
|
|
97
|
+
|
|
98
|
+
// Register instance-level extension module, which have a higher priority than
|
|
99
|
+
// global extension modules.
|
|
100
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_register_extension_module(
|
|
101
|
+
lynx_view_builder_t* builder, const char* name,
|
|
102
|
+
extension_module_creator creator, bool is_lazy_create, void* opaque);
|
|
103
|
+
|
|
104
|
+
// Register instance-level view factory.
|
|
105
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_register_native_view(
|
|
106
|
+
lynx_view_builder_t* builder, const char* name,
|
|
107
|
+
lynx_native_view_creator creator, void* opaque);
|
|
108
|
+
|
|
109
|
+
LYNX_CAPI_EXPORT void lynx_view_builder_release(lynx_view_builder_t* builder);
|
|
110
|
+
|
|
111
|
+
LYNX_EXTERN_C_END
|
|
112
|
+
|
|
113
|
+
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_BUILDER_CAPI_H_
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_CAPI_H_
|
|
5
|
+
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_CAPI_H_
|
|
6
|
+
|
|
7
|
+
#include "lynx_export.h"
|
|
8
|
+
#include "lynx_load_meta_capi.h"
|
|
9
|
+
#include "lynx_runtime_lifecycle_observer_capi.h"
|
|
10
|
+
#include "lynx_update_meta_capi.h"
|
|
11
|
+
#include "lynx_view_builder_capi.h"
|
|
12
|
+
#include "lynx_view_client_capi.h"
|
|
13
|
+
#include "lynx_vsync_monitor_capi.h"
|
|
14
|
+
|
|
15
|
+
LYNX_EXTERN_C_BEGIN
|
|
16
|
+
|
|
17
|
+
// LynxView is the main entry point for rendering and interacting with Lynx.
|
|
18
|
+
// It provides methods for loading and rendering templates, updating data, and
|
|
19
|
+
// sending events. Users should call lynx_view_release() to release the LynxView
|
|
20
|
+
// when it is no longer needed.
|
|
21
|
+
typedef struct lynx_view_t lynx_view_t;
|
|
22
|
+
|
|
23
|
+
// Create lynx view with builder.
|
|
24
|
+
LYNX_CAPI_EXPORT lynx_view_t* lynx_view_create(lynx_view_builder_t* builder,
|
|
25
|
+
void* user_data);
|
|
26
|
+
LYNX_CAPI_EXPORT void* lynx_view_get_user_data(lynx_view_t*);
|
|
27
|
+
|
|
28
|
+
// Get the fixed WebView2 runtime path configured by the builder. Returns an
|
|
29
|
+
// empty string if no fixed runtime path was configured.
|
|
30
|
+
LYNX_CAPI_EXPORT const char* lynx_view_get_webview2_fixed_runtime_path(
|
|
31
|
+
lynx_view_t*);
|
|
32
|
+
|
|
33
|
+
// Register lifecycle event observer for LynxView. The client passed in is the
|
|
34
|
+
// structure implemented by user and registered to the LynxView instance is used
|
|
35
|
+
// to obtain the callbacks of each process in the LynxView lifecycle.
|
|
36
|
+
LYNX_CAPI_EXPORT void lynx_view_add_client(lynx_view_t*,
|
|
37
|
+
lynx_view_client_t* client);
|
|
38
|
+
LYNX_CAPI_EXPORT void lynx_view_remove_client(lynx_view_t*,
|
|
39
|
+
lynx_view_client_t* client);
|
|
40
|
+
|
|
41
|
+
// Register a runtime lifecycle observer for the LynxView.
|
|
42
|
+
// This function allows you to associate a runtime lifecycle observer with a
|
|
43
|
+
// specific LynxView instance. The observer will be notified of various runtime
|
|
44
|
+
// lifecycle events, such as runtime attachment, and detachment. This can be
|
|
45
|
+
// useful for monitoring and responding to changes in the runtime state.
|
|
46
|
+
LYNX_CAPI_EXPORT void lynx_view_register_runtime_lifecycle_observer(
|
|
47
|
+
lynx_view_t*, lynx_runtime_lifecycle_observer_t*);
|
|
48
|
+
|
|
49
|
+
// Using LynxLoadMeta to render LynxView, it is the main entrance for the client
|
|
50
|
+
// to load Lynx templates.
|
|
51
|
+
LYNX_CAPI_EXPORT void lynx_view_load_template(lynx_view_t*,
|
|
52
|
+
lynx_load_meta_t* data);
|
|
53
|
+
|
|
54
|
+
// Using LynxUpdateMeta to update LynxView, it is the main entrance for the
|
|
55
|
+
// client to update template data.
|
|
56
|
+
LYNX_CAPI_EXPORT void lynx_view_update_data(lynx_view_t*,
|
|
57
|
+
lynx_update_meta_t* data);
|
|
58
|
+
|
|
59
|
+
// Reload the template of the LynxView with the given data. This function
|
|
60
|
+
// reloads the template of the specified LynxView using the provided template
|
|
61
|
+
// data and global properties. It can be used when you need to refresh the view
|
|
62
|
+
// with updated data or different template configurations.
|
|
63
|
+
LYNX_CAPI_EXPORT void lynx_view_reload_template(
|
|
64
|
+
lynx_view_t*, lynx_template_data_t* data,
|
|
65
|
+
lynx_template_data_t* global_props);
|
|
66
|
+
|
|
67
|
+
// Send global events to the front end through the client, and the front end can
|
|
68
|
+
// listen to the event through GlobalEventEmitter.
|
|
69
|
+
LYNX_CAPI_EXPORT void lynx_view_send_global_event(lynx_view_t*,
|
|
70
|
+
const char* name,
|
|
71
|
+
const char* json);
|
|
72
|
+
|
|
73
|
+
// Update the screen metrics of the LynxView. This function allows you to modify
|
|
74
|
+
// the screen-related properties of an existing LynxView, including the screen
|
|
75
|
+
// width, height, and pixel ratio.
|
|
76
|
+
LYNX_CAPI_EXPORT void lynx_view_update_screen_metrics(lynx_view_t*,
|
|
77
|
+
const float& width,
|
|
78
|
+
const float& height,
|
|
79
|
+
const float& pixel_ratio);
|
|
80
|
+
|
|
81
|
+
// Updates the position and size of the LynxView. This function allows you to
|
|
82
|
+
// change the position and dimensions of an existing LynxView. The position is
|
|
83
|
+
// defined by the `x` and `y` coordinates of the top-left corner of the view,
|
|
84
|
+
// and the size is defined by the `width` and `height` parameters.
|
|
85
|
+
LYNX_CAPI_EXPORT void lynx_view_set_frame(lynx_view_t*, const float& x,
|
|
86
|
+
const float& y, const float& width,
|
|
87
|
+
const float& height);
|
|
88
|
+
|
|
89
|
+
// Changing the font scaling ratio in client settings will automatically change
|
|
90
|
+
// the text size.
|
|
91
|
+
LYNX_CAPI_EXPORT void lynx_view_set_font_scale(lynx_view_t*,
|
|
92
|
+
const float& font_scale);
|
|
93
|
+
|
|
94
|
+
// Set the parent window of the LynxView.
|
|
95
|
+
LYNX_CAPI_EXPORT void lynx_view_set_parent(lynx_view_t*, NativeWindow parent);
|
|
96
|
+
|
|
97
|
+
// Get the native window of the LynxView.
|
|
98
|
+
LYNX_CAPI_EXPORT NativeWindow lynx_view_get_native_window(lynx_view_t*);
|
|
99
|
+
|
|
100
|
+
// Get the generic resource fetcher of the LynxView. This function increases the
|
|
101
|
+
// reference count of the returned fetcher. The caller assumes ownership and is
|
|
102
|
+
// responsible for calling `lynx_generic_resource_fetcher_release` to release
|
|
103
|
+
// it when no longer needed.
|
|
104
|
+
LYNX_CAPI_EXPORT lynx_generic_resource_fetcher_t*
|
|
105
|
+
lynx_view_get_generic_resource_fetcher(lynx_view_t*);
|
|
106
|
+
|
|
107
|
+
// Instruct the LynxView to enter the foreground state. This function should be
|
|
108
|
+
// called when the LynxView becomes visible or active again after being in the
|
|
109
|
+
// background. It may trigger necessary operations such as resuming animations,
|
|
110
|
+
// reloading resources, or updating the UI.
|
|
111
|
+
LYNX_CAPI_EXPORT void lynx_view_enter_foreground(lynx_view_t*);
|
|
112
|
+
|
|
113
|
+
// Instruct the LynxView to enter the background state. This function should be
|
|
114
|
+
// called when the LynxView is about to become hidden or inactive, such as when
|
|
115
|
+
// the app is sent to the background. It may trigger operations like pausing
|
|
116
|
+
// animations, releasing resources, or saving the current state to ensure
|
|
117
|
+
// efficient resource usage and a smooth transition when the view returns to the
|
|
118
|
+
// foreground.
|
|
119
|
+
LYNX_CAPI_EXPORT void lynx_view_enter_background(lynx_view_t*);
|
|
120
|
+
|
|
121
|
+
// Send bubble event to lynx view. This function is only used by test bench to
|
|
122
|
+
// replay the bubble event.
|
|
123
|
+
LYNX_CAPI_EXPORT void lynx_view_inject_bubble_event(lynx_view_t*,
|
|
124
|
+
const char* params);
|
|
125
|
+
// Register instance-level view factory.
|
|
126
|
+
LYNX_CAPI_EXPORT void lynx_view_register_native_view(
|
|
127
|
+
lynx_view_t*, const char* name, lynx_native_view_creator creator,
|
|
128
|
+
void* opaque);
|
|
129
|
+
|
|
130
|
+
// Register Input Method Editor (IME) handler for the LynxView.
|
|
131
|
+
// When registering IME (handler != NULL), the provided handler will be invoked
|
|
132
|
+
// to handle keyboard events. When releasing IME (handler == NULL), the IME
|
|
133
|
+
// will be hidden and no further keyboard events will be sent.
|
|
134
|
+
LYNX_CAPI_EXPORT void lynx_view_register_ime_handler(lynx_view_t* view,
|
|
135
|
+
void* handler,
|
|
136
|
+
void* opaque);
|
|
137
|
+
|
|
138
|
+
// Set a custom vsync monitor to request a synchronous vsync signal
|
|
139
|
+
LYNX_CAPI_EXPORT void lynx_view_set_custom_vsync_monitor(
|
|
140
|
+
lynx_view_t*, lynx_vsync_monitor_t* monitor);
|
|
141
|
+
|
|
142
|
+
// Users should call lynx_view_release() to release the LynxView when it is no
|
|
143
|
+
// longer needed.
|
|
144
|
+
LYNX_CAPI_EXPORT void lynx_view_release(lynx_view_t* view);
|
|
145
|
+
|
|
146
|
+
// Callback type for event simulation (devtool).
|
|
147
|
+
typedef void (*lynx_emulate_touch_fn)(void* context, const char* event_type,
|
|
148
|
+
int x, int y, const char* button,
|
|
149
|
+
float delta_x, float delta_y,
|
|
150
|
+
int modifiers, int click_count);
|
|
151
|
+
|
|
152
|
+
// Set event simulation proxy for devtool. The callback will be invoked to
|
|
153
|
+
// emulate touch/mouse events. Pass NULL callback to clear the proxy.
|
|
154
|
+
LYNX_CAPI_EXPORT void lynx_view_set_event_simulation_proxy(
|
|
155
|
+
lynx_view_t* view, lynx_emulate_touch_fn callback, void* context);
|
|
156
|
+
|
|
157
|
+
LYNX_CAPI_EXPORT void lynx_view_send_touch_event(lynx_view_t* view,
|
|
158
|
+
const char* name, int32_t id,
|
|
159
|
+
float x, float y,
|
|
160
|
+
float client_x, float client_y,
|
|
161
|
+
float page_x, float page_y);
|
|
162
|
+
|
|
163
|
+
LYNX_CAPI_EXPORT int lynx_view_get_node_for_location(lynx_view_t* view, int x,
|
|
164
|
+
int y);
|
|
165
|
+
|
|
166
|
+
LYNX_CAPI_EXPORT void lynx_view_emulate_mouse_event(lynx_view_t* view,
|
|
167
|
+
const char* event_name,
|
|
168
|
+
float x, float y,
|
|
169
|
+
float delta_x,
|
|
170
|
+
float delta_y);
|
|
171
|
+
|
|
172
|
+
LYNX_EXTERN_C_END
|
|
173
|
+
|
|
174
|
+
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_CAPI_H_
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_CLIENT_CAPI_H_
|
|
5
|
+
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_CLIENT_CAPI_H_
|
|
6
|
+
|
|
7
|
+
#include <stdint.h>
|
|
8
|
+
|
|
9
|
+
#include "lynx_export.h"
|
|
10
|
+
|
|
11
|
+
LYNX_EXTERN_C_BEGIN
|
|
12
|
+
|
|
13
|
+
// The LynxViewClient implemented by the client and registered to the LynxView
|
|
14
|
+
// instance is used to obtain the callbacks of each process in the LynxView
|
|
15
|
+
// lifecycle.
|
|
16
|
+
typedef struct lynx_view_client_t lynx_view_client_t;
|
|
17
|
+
|
|
18
|
+
// Callbacks of LynxViewClient
|
|
19
|
+
// Page starts preparing to load.
|
|
20
|
+
typedef void (*on_page_start)(lynx_view_client_t* client, const char* url);
|
|
21
|
+
// Page loaded successfully.
|
|
22
|
+
typedef void (*on_load_success)(lynx_view_client_t* client);
|
|
23
|
+
// First screen layout completed.
|
|
24
|
+
typedef void (*on_first_screen)(lynx_view_client_t* client);
|
|
25
|
+
// Page update callback.
|
|
26
|
+
typedef void (*on_page_updated)(lynx_view_client_t* client);
|
|
27
|
+
// Data update callback.
|
|
28
|
+
typedef void (*on_data_updated)(lynx_view_client_t* client);
|
|
29
|
+
// Callback after the page is destroyed.
|
|
30
|
+
typedef void (*on_destroy)(lynx_view_client_t* client);
|
|
31
|
+
// JS environment preparation completed.
|
|
32
|
+
// Note: The callback is in an asynchronous thread.
|
|
33
|
+
typedef void (*on_runtime_ready)(lynx_view_client_t* client);
|
|
34
|
+
// Error received.
|
|
35
|
+
typedef void (*on_received_error)(lynx_view_client_t* client, int error_code,
|
|
36
|
+
const char* message);
|
|
37
|
+
typedef void (*on_timing_setup)(lynx_view_client_t* client,
|
|
38
|
+
const char* timing_info);
|
|
39
|
+
typedef void (*on_timing_update)(lynx_view_client_t* client,
|
|
40
|
+
const char* timing_info,
|
|
41
|
+
const char* update_timing,
|
|
42
|
+
const char* update_flag);
|
|
43
|
+
typedef void (*on_enter_foreground)(lynx_view_client_t* client);
|
|
44
|
+
typedef void (*on_enter_background)(lynx_view_client_t* client);
|
|
45
|
+
typedef void (*on_frame_timing)(lynx_view_client_t* client,
|
|
46
|
+
int64_t frame_start_time_in_ns,
|
|
47
|
+
int64_t frame_finish_time_in_ns);
|
|
48
|
+
|
|
49
|
+
LYNX_CAPI_EXPORT lynx_view_client_t* lynx_view_client_create(void* user_data);
|
|
50
|
+
LYNX_CAPI_EXPORT void* lynx_view_client_get_user_data(lynx_view_client_t*);
|
|
51
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_page_start(lynx_view_client_t*,
|
|
52
|
+
on_page_start f);
|
|
53
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_load_success(lynx_view_client_t*,
|
|
54
|
+
on_load_success f);
|
|
55
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_first_screen(lynx_view_client_t*,
|
|
56
|
+
on_first_screen f);
|
|
57
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_page_updated(lynx_view_client_t*,
|
|
58
|
+
on_page_updated f);
|
|
59
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_data_updated(lynx_view_client_t*,
|
|
60
|
+
on_data_updated f);
|
|
61
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_destroy(lynx_view_client_t*,
|
|
62
|
+
on_destroy f);
|
|
63
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_runtime_ready(
|
|
64
|
+
lynx_view_client_t*, on_runtime_ready f);
|
|
65
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_received_error(
|
|
66
|
+
lynx_view_client_t*, on_received_error f);
|
|
67
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_timing_setup(lynx_view_client_t*,
|
|
68
|
+
on_timing_setup f);
|
|
69
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_timing_update(
|
|
70
|
+
lynx_view_client_t*, on_timing_update f);
|
|
71
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_enter_foreground(
|
|
72
|
+
lynx_view_client_t*, on_enter_foreground f);
|
|
73
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_enter_background(
|
|
74
|
+
lynx_view_client_t*, on_enter_background f);
|
|
75
|
+
LYNX_CAPI_EXPORT void lynx_view_client_bind_on_frame_timing(lynx_view_client_t*,
|
|
76
|
+
on_frame_timing f);
|
|
77
|
+
LYNX_CAPI_EXPORT void lynx_view_client_release(lynx_view_client_t*);
|
|
78
|
+
|
|
79
|
+
LYNX_EXTERN_C_END
|
|
80
|
+
|
|
81
|
+
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VIEW_CLIENT_CAPI_H_
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VSYNC_MONITOR_CAPI_H_
|
|
6
|
+
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VSYNC_MONITOR_CAPI_H_
|
|
7
|
+
|
|
8
|
+
#include <stdint.h>
|
|
9
|
+
|
|
10
|
+
#include "lynx_export.h"
|
|
11
|
+
|
|
12
|
+
LYNX_EXTERN_C_BEGIN
|
|
13
|
+
|
|
14
|
+
typedef struct lynx_vsync_monitor_t lynx_vsync_monitor_t;
|
|
15
|
+
|
|
16
|
+
typedef void (*lynx_vsync_monitor_on_vsync_callback)(void* user_data, int64_t,
|
|
17
|
+
int64_t);
|
|
18
|
+
typedef void (*lynx_vsync_monitor_request_vsync)(
|
|
19
|
+
lynx_vsync_monitor_t*, lynx_vsync_monitor_on_vsync_callback callback,
|
|
20
|
+
void* user_data);
|
|
21
|
+
|
|
22
|
+
// Creates a lynx_vsync_monitor_t instance with a finalizer. It associates
|
|
23
|
+
// the provided user data with the monitor, which can be retrieved later using
|
|
24
|
+
// `lynx_vsync_monitor_get_user_data`. The finalizer function will be called
|
|
25
|
+
// when the monitor is released.
|
|
26
|
+
LYNX_CAPI_EXPORT lynx_vsync_monitor_t* lynx_vsync_monitor_create_with_finalizer(
|
|
27
|
+
void* user_data, void (*finalizer)(lynx_vsync_monitor_t*, void*));
|
|
28
|
+
|
|
29
|
+
LYNX_CAPI_EXPORT void* lynx_vsync_monitor_get_user_data(lynx_vsync_monitor_t*);
|
|
30
|
+
|
|
31
|
+
// Binds a request_vsync function to lynx_vsync_monitor_t. This function is used
|
|
32
|
+
// to synchronize a Vsync signal.
|
|
33
|
+
LYNX_CAPI_EXPORT void lynx_vsync_monitor_bind_request_vsync_func(
|
|
34
|
+
lynx_vsync_monitor_t*, lynx_vsync_monitor_request_vsync func);
|
|
35
|
+
|
|
36
|
+
LYNX_EXTERN_C_END
|
|
37
|
+
|
|
38
|
+
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_VSYNC_MONITOR_CAPI_H_
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_WINDOWLESS_RENDERER_CAPI_H_
|
|
5
|
+
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_WINDOWLESS_RENDERER_CAPI_H_
|
|
6
|
+
|
|
7
|
+
#include <stdbool.h>
|
|
8
|
+
#include <stddef.h>
|
|
9
|
+
#include <stdint.h>
|
|
10
|
+
|
|
11
|
+
#include "lynx_export.h"
|
|
12
|
+
#include "lynx_types.h"
|
|
13
|
+
|
|
14
|
+
LYNX_EXTERN_C_BEGIN
|
|
15
|
+
|
|
16
|
+
/* ----- Global UI Task Runner Configuration ----- */
|
|
17
|
+
// These APIs provide a way to inject a host-provided task runner for Lynx's
|
|
18
|
+
// global UI thread. This is useful when embedding Lynx in a windowless mode
|
|
19
|
+
// where the host wants to control the UI thread execution.
|
|
20
|
+
//
|
|
21
|
+
// These functions are process-global and should be called only once, before
|
|
22
|
+
// any windowless renderer is created. After the first windowless renderer is
|
|
23
|
+
// initialized, subsequent calls will have no effect.
|
|
24
|
+
|
|
25
|
+
// Callback function type for checking if the current thread is the UI thread.
|
|
26
|
+
// Should return true if the calling thread is the UI thread where tasks should
|
|
27
|
+
// be executed.
|
|
28
|
+
typedef bool (*lynx_windowless_ui_task_runner_runs_on_current_thread_callback)(
|
|
29
|
+
void* user_data);
|
|
30
|
+
|
|
31
|
+
// Callback function type for posting a task to the UI thread.
|
|
32
|
+
// The target_time_nanos is the absolute time (in nanoseconds since epoch)
|
|
33
|
+
// when the task should be executed.
|
|
34
|
+
typedef void (*lynx_windowless_ui_task_runner_post_task_callback)(
|
|
35
|
+
lynx_task_t task, uint64_t target_time_nanos, void* user_data);
|
|
36
|
+
|
|
37
|
+
// Configuration structure for the global UI task runner.
|
|
38
|
+
// This structure must be zero-initialized before use.
|
|
39
|
+
typedef struct lynx_windowless_ui_task_runner_config_t {
|
|
40
|
+
// The size of this struct. Must be set to
|
|
41
|
+
// sizeof(lynx_windowless_ui_task_runner_config_t).
|
|
42
|
+
size_t struct_size;
|
|
43
|
+
// User data pointer that will be passed to the callbacks.
|
|
44
|
+
void* user_data;
|
|
45
|
+
// Callback to check if current thread is UI thread.
|
|
46
|
+
lynx_windowless_ui_task_runner_runs_on_current_thread_callback
|
|
47
|
+
runs_on_current_thread_callback;
|
|
48
|
+
// Callback to post a task to the UI thread.
|
|
49
|
+
lynx_windowless_ui_task_runner_post_task_callback post_task_callback;
|
|
50
|
+
} lynx_windowless_ui_task_runner_config_t;
|
|
51
|
+
|
|
52
|
+
// Configures the global UI task runner for windowless mode.
|
|
53
|
+
// This function must be called before creating any windowless renderer.
|
|
54
|
+
// Returns true if the configuration was successfully set, false if it was
|
|
55
|
+
// already set or UIThread has already been initialized.
|
|
56
|
+
LYNX_CAPI_EXPORT bool lynx_windowless_set_global_ui_task_runner(
|
|
57
|
+
const lynx_windowless_ui_task_runner_config_t* config);
|
|
58
|
+
|
|
59
|
+
// Runs a UI task that was posted via the global UI task runner.
|
|
60
|
+
// This function should be called by the host on the UI thread.
|
|
61
|
+
// Returns true if the task was found and executed successfully.
|
|
62
|
+
LYNX_CAPI_EXPORT bool lynx_windowless_run_ui_task(lynx_task_t task);
|
|
63
|
+
|
|
64
|
+
/* ----- End of Global UI Task Runner Configuration ----- */
|
|
65
|
+
|
|
66
|
+
// The type of the windowless renderer.
|
|
67
|
+
typedef enum lynx_windowless_renderer_type_e {
|
|
68
|
+
// The software renderer type that renders content on CPU.
|
|
69
|
+
kRendererTypeSoftware = 0,
|
|
70
|
+
// The GL renderer type that renders content with host OpenGL context.
|
|
71
|
+
// Unlike kRendererTypeGLDirect, this renderer type will be running as a
|
|
72
|
+
// bitmap uploader, underneath will render view using a SharedImageSink and
|
|
73
|
+
// readback GPU memory to a CPU bitmap. It may be SLOW for large views, but
|
|
74
|
+
// all components will work well.
|
|
75
|
+
kRendererTypeGL,
|
|
76
|
+
// The GL renderer type that renders content with host OpenGL context.
|
|
77
|
+
// This renderer type will be running directly on the host OpenGL context, it
|
|
78
|
+
// can speed normal UI rendering, but components using external textures like
|
|
79
|
+
// video or canvas maybe NOT work.
|
|
80
|
+
kRendererTypeGLDirect,
|
|
81
|
+
// The accelerated renderer type that uses shared texture.
|
|
82
|
+
kRendererTypeAccelerated,
|
|
83
|
+
} lynx_windowless_renderer_type_e;
|
|
84
|
+
|
|
85
|
+
// Forward declaration of the windowless renderer structure.
|
|
86
|
+
// This is an opaque type that represents the internal implementation
|
|
87
|
+
// of the windowless renderer. Users should not directly access its
|
|
88
|
+
// fields but instead use the provided API functions to interact with it.
|
|
89
|
+
typedef struct lynx_windowless_renderer_t lynx_windowless_renderer_t;
|
|
90
|
+
|
|
91
|
+
// Creates a new windowless handler instance.
|
|
92
|
+
// This function is the entry point for initializing a windowless handler
|
|
93
|
+
// with the specified type and optional user data. The finalizer function
|
|
94
|
+
// will be called when the renderer is released.
|
|
95
|
+
LYNX_CAPI_EXPORT lynx_windowless_renderer_t*
|
|
96
|
+
lynx_windowless_renderer_create_with_finalizer(
|
|
97
|
+
lynx_windowless_renderer_type_e type, void* user_data,
|
|
98
|
+
void (*finalizer)(lynx_windowless_renderer_t*, void*));
|
|
99
|
+
|
|
100
|
+
LYNX_CAPI_EXPORT void* lynx_windowless_renderer_get_user_data(
|
|
101
|
+
lynx_windowless_renderer_t*);
|
|
102
|
+
|
|
103
|
+
/* ----- Callbacks for GL renderer type ----- */
|
|
104
|
+
// The callback function type for making the current context. Returns true if
|
|
105
|
+
// the context is made successfully.
|
|
106
|
+
typedef bool (*on_gl_make_current)(lynx_windowless_renderer_t*);
|
|
107
|
+
// The callback function type for clearing the current context. Returns true if
|
|
108
|
+
// the context is cleared successfully.
|
|
109
|
+
typedef bool (*on_gl_clear_current)(lynx_windowless_renderer_t*);
|
|
110
|
+
// The callback function type for presenting the rendered content. The return
|
|
111
|
+
// value indicates success of the present call.
|
|
112
|
+
typedef bool (*on_gl_present)(lynx_windowless_renderer_t*);
|
|
113
|
+
// The callback function type for creating a framebuffer object. Returns the
|
|
114
|
+
// framebuffer object if the creation is successful.
|
|
115
|
+
typedef uint32_t (*on_gl_create_fbo)(lynx_windowless_renderer_t*, int w, int h);
|
|
116
|
+
// The callback function type for resolving the GL procedure. Returns the
|
|
117
|
+
// procedure address if the resolution is successful.
|
|
118
|
+
typedef void* (*on_gl_proc_resolver)(lynx_windowless_renderer_t*, const char*);
|
|
119
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_gl_make_current(
|
|
120
|
+
lynx_windowless_renderer_t*, on_gl_make_current);
|
|
121
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_gl_clear_current(
|
|
122
|
+
lynx_windowless_renderer_t*, on_gl_clear_current);
|
|
123
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_gl_present(
|
|
124
|
+
lynx_windowless_renderer_t*, on_gl_present);
|
|
125
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_gl_create_fbo(
|
|
126
|
+
lynx_windowless_renderer_t*, on_gl_create_fbo);
|
|
127
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_gl_proc_resolver(
|
|
128
|
+
lynx_windowless_renderer_t*, on_gl_proc_resolver);
|
|
129
|
+
/* ----- Callbacks for GL renderer type ----- */
|
|
130
|
+
|
|
131
|
+
/* ----- Callbacks for Software renderer type ----- */
|
|
132
|
+
// The callback function type for presenting the rendered content when the
|
|
133
|
+
// renderer is in software mode. The return value indicates success of the
|
|
134
|
+
// present call.
|
|
135
|
+
typedef bool (*on_software_present)(lynx_windowless_renderer_t*,
|
|
136
|
+
const void* allocation, size_t row_bytes,
|
|
137
|
+
size_t height);
|
|
138
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_software_present(
|
|
139
|
+
lynx_windowless_renderer_t*, on_software_present);
|
|
140
|
+
/* ----- Callbacks for Software renderer type ----- */
|
|
141
|
+
|
|
142
|
+
/* ----- Callbacks for accelerated renderer type ----- */
|
|
143
|
+
typedef bool (*on_accelerated_present)(lynx_windowless_renderer_t*);
|
|
144
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_accelerated_present(
|
|
145
|
+
lynx_windowless_renderer_t*, on_accelerated_present);
|
|
146
|
+
|
|
147
|
+
// Gets the accelerated paint info of the windowless renderer. The accelerated
|
|
148
|
+
// paint info used for presenting on screen is generally obtained by calling
|
|
149
|
+
// from the host's render thread. Returns true if the call is successful, false
|
|
150
|
+
// otherwise.
|
|
151
|
+
LYNX_CAPI_EXPORT bool lynx_windowless_renderer_get_accelerated_paint_info(
|
|
152
|
+
lynx_windowless_renderer_t*, lynx_accelerated_paint_info_t* paint_info);
|
|
153
|
+
/* ----- Callbacks for accelerated renderer type ----- */
|
|
154
|
+
|
|
155
|
+
// The callback function type for posting a task to the main thread.
|
|
156
|
+
// The task is a function pointer that will be executed on the main thread.
|
|
157
|
+
// The interval_nanoseconds is the time interval in nanoseconds at which the
|
|
158
|
+
// task should be executed.
|
|
159
|
+
typedef void (*on_post_task)(lynx_windowless_renderer_t*, lynx_task_t task,
|
|
160
|
+
uint64_t interval_nanoseconds);
|
|
161
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_on_post_task(
|
|
162
|
+
lynx_windowless_renderer_t*, on_post_task);
|
|
163
|
+
|
|
164
|
+
// Runs a task on the main thread.
|
|
165
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_run_task(
|
|
166
|
+
lynx_windowless_renderer_t*, lynx_task_t task);
|
|
167
|
+
|
|
168
|
+
// Sends a pointer event to the windowless renderer.
|
|
169
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_send_pointer_event(
|
|
170
|
+
lynx_windowless_renderer_t*, lynx_pointer_event_t* event);
|
|
171
|
+
// Sends a key event to the windowless renderer.
|
|
172
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_send_key_event(
|
|
173
|
+
lynx_windowless_renderer_t*, lynx_key_event_t* event);
|
|
174
|
+
|
|
175
|
+
/* ----- Callbacks for platform function ----- */
|
|
176
|
+
typedef const char* (*get_clipboard_data)(lynx_windowless_renderer_t*);
|
|
177
|
+
typedef void (*set_clipboard_data)(lynx_windowless_renderer_t*,
|
|
178
|
+
const char* data);
|
|
179
|
+
typedef void (*activate_system_cursor)(lynx_windowless_renderer_t*,
|
|
180
|
+
lynx_cursor_type_e type,
|
|
181
|
+
const char* path);
|
|
182
|
+
typedef void (*show_text_input)(lynx_windowless_renderer_t*, bool show);
|
|
183
|
+
typedef void (*update_caret_position)(lynx_windowless_renderer_t*, float x,
|
|
184
|
+
float y, float width, float height);
|
|
185
|
+
typedef void (*set_cursor_position)(lynx_windowless_renderer_t*, int position);
|
|
186
|
+
typedef void (*set_marked_text_rect)(lynx_windowless_renderer_t*, float x,
|
|
187
|
+
float y, float width, float height);
|
|
188
|
+
typedef void (*set_editable_transform)(lynx_windowless_renderer_t*,
|
|
189
|
+
const float transform_matrix[16]);
|
|
190
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_get_clipboard_data(
|
|
191
|
+
lynx_windowless_renderer_t*, get_clipboard_data);
|
|
192
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_set_clipboard_data(
|
|
193
|
+
lynx_windowless_renderer_t*, set_clipboard_data);
|
|
194
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_activate_system_cursor(
|
|
195
|
+
lynx_windowless_renderer_t*, activate_system_cursor);
|
|
196
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_show_text_input(
|
|
197
|
+
lynx_windowless_renderer_t*, show_text_input);
|
|
198
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_update_caret_position(
|
|
199
|
+
lynx_windowless_renderer_t*, update_caret_position);
|
|
200
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_set_cursor_position(
|
|
201
|
+
lynx_windowless_renderer_t*, set_cursor_position);
|
|
202
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_set_marked_text_rect(
|
|
203
|
+
lynx_windowless_renderer_t*, set_marked_text_rect);
|
|
204
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_bind_set_editable_transform(
|
|
205
|
+
lynx_windowless_renderer_t*, set_editable_transform);
|
|
206
|
+
/* ----- Callbacks for platform function ----- */
|
|
207
|
+
|
|
208
|
+
LYNX_CAPI_EXPORT void lynx_windowless_renderer_release(
|
|
209
|
+
lynx_windowless_renderer_t*);
|
|
210
|
+
|
|
211
|
+
LYNX_EXTERN_C_END
|
|
212
|
+
|
|
213
|
+
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_WINDOWLESS_RENDERER_CAPI_H_
|