roxane 0.0.1-aarch64-linux → 0.0.2-aarch64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faec5f1692f7ff017a218b758cf2a3004d33f0b7c32e2e6f7d39ad21faaa8565
4
- data.tar.gz: b1e453f8a9bf1aee47b8cf26d3c5013049f28d95e507620afa934dc907e74eed
3
+ metadata.gz: bd28d0d2ac6598afa01cf1ebad17f7f0762af8dba743a7a51b0da26aa206eeb7
4
+ data.tar.gz: 0bdb9e3e6b9edcb91a0e8fed7c30de86477f06c762ec225780fe3add72c94df4
5
5
  SHA512:
6
- metadata.gz: 53c6aa83f847e8107ab64e77a0d99b01abc8761dacab65b206d7d4f5879b86019448e126b99ab554bb492222343881dc3a0eb3f722978b5e23139505b16e96d8
7
- data.tar.gz: e59272d790d7f25c050d2e95d1f51aa0551535a1f3ae5781a00de49b56ec814008e11c6bb7b21b5c2932864f809845015c46e465447b6b8b5f886add10790025
6
+ metadata.gz: 569e6dcdb54fbcfc5066379493e2bb05cfce234fa737fe2501d57982f084781b961daee126d11b51ad77981533cfded29ade72cf081d36f89e9450a4cffc7e37
7
+ data.tar.gz: a6383978dd1bf4e2cbc836330f4461c03d7cd34c85a312ec91218b49e8dcea21813c18f582e546711e3875326d3b8938628208ab4bffc1a8836968f7366bfebf
data/lib/roxane/ffi.rb CHANGED
@@ -15,6 +15,12 @@ module Roxane
15
15
  HINT_MAX = 2
16
16
  HINT_FIXED = 3
17
17
 
18
+ # webview_native_handle_kind_t — BROWSER_CONTROLLER is the engine view
19
+ # (WebKitWebView* on GTK), the door to engine calls webview doesn't wrap.
20
+ NATIVE_HANDLE_UI_WINDOW = 0
21
+ NATIVE_HANDLE_UI_WIDGET = 1
22
+ NATIVE_HANDLE_BROWSER_CONTROLLER = 2
23
+
18
24
  begin
19
25
  ffi_lib Roxane.library_path
20
26
 
@@ -31,6 +37,7 @@ module Roxane
31
37
  attach_function :webview_set_html, [:pointer, :string], :int
32
38
  attach_function :webview_init, [:pointer, :string], :int
33
39
  attach_function :webview_eval, [:pointer, :string], :int
40
+ attach_function :webview_get_native_handle, [:pointer, :int], :pointer
34
41
 
35
42
  callback :bind_fn, [:string, :string, :pointer], :void
36
43
  attach_function :webview_bind, [:pointer, :string, :bind_fn, :pointer], :int
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Roxane
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Roxane
4
+ # Direct WebKitGTK bindings for the few affordances the webview C API doesn't
5
+ # wrap (today: full-content zoom). On Linux the library is already linked into
6
+ # the process by libwebview — we bind the soname libwebview itself links (4.1,
7
+ # falling back to 4.0). Where neither loads (macOS/Windows — their engines get
8
+ # their own bindings later), AVAILABLE is false and callers no-op gracefully.
9
+ module WebKit
10
+ extend ::FFI::Library
11
+
12
+ begin
13
+ ffi_lib ["libwebkit2gtk-4.1.so.0", "libwebkit2gtk-4.0.so.37"]
14
+ attach_function :webkit_web_view_set_zoom_level, [:pointer, :double], :void
15
+ attach_function :webkit_web_view_get_zoom_level, [:pointer], :double
16
+ AVAILABLE = true
17
+ rescue LoadError, ::FFI::NotFoundError
18
+ AVAILABLE = false
19
+ end
20
+ end
21
+
22
+ # GLib main-loop scheduling. g_idle_add is thread-safe and runs the callback
23
+ # as a TOP-LEVEL main-loop iteration — a clean stack, never nested inside a
24
+ # webview dispatch callback (layout-triggering WebKit calls made from inside
25
+ # one can reenter the engine and crash; see the zoom work, 2026-07-03).
26
+ module GLib
27
+ extend ::FFI::Library
28
+
29
+ begin
30
+ ffi_lib "libglib-2.0.so.0"
31
+ callback :g_source_func, [:pointer], :int
32
+ attach_function :g_idle_add, [:g_source_func, :pointer], :uint
33
+ AVAILABLE = true
34
+ rescue LoadError, ::FFI::NotFoundError
35
+ AVAILABLE = false
36
+ end
37
+ end
38
+ end
data/lib/roxane/window.rb CHANGED
@@ -26,6 +26,7 @@ module Roxane
26
26
  @on_close = nil
27
27
  @server = nil
28
28
  @ui_queue = Queue.new # procs to run on the UI thread
29
+ @zoom = 1.0
29
30
 
30
31
  @w = FFI.webview_create(debug ? 1 : 0, nil)
31
32
  raise Error, "could not create webview" if @w.null?
@@ -83,6 +84,31 @@ module Roxane
83
84
  self
84
85
  end
85
86
 
87
+ # Full-content zoom, like a browser's Ctrl+± (1.0 = natural size). Backed by
88
+ # the engine's native zoom (WebKitGTK today); where that binding isn't
89
+ # available the setter no-ops and the reader reports the last requested
90
+ # level. Safe from any thread: scheduled with g_idle_add, which runs on the
91
+ # UI thread as a TOP-LEVEL loop iteration — never nested inside a webview
92
+ # dispatch callback, where a layout-triggering WebKit call can reenter the
93
+ # engine mid-resolve and crash it. Rapid calls coalesce (each application
94
+ # reads the latest requested level; extra idles are harmless).
95
+ def zoom
96
+ @zoom
97
+ end
98
+
99
+ def zoom=(factor)
100
+ @zoom = Float(factor)
101
+ return unless WebKit::AVAILABLE && GLib::AVAILABLE
102
+
103
+ @apply_zoom ||= ::FFI::Function.new(:int, [:pointer]) do |_data|
104
+ view = FFI.webview_get_native_handle(@w, FFI::NATIVE_HANDLE_BROWSER_CONTROLLER)
105
+ WebKit.webkit_web_view_set_zoom_level(view, @zoom) unless view.null?
106
+ 0 # G_SOURCE_REMOVE
107
+ end
108
+ @callbacks << @apply_zoom unless @callbacks.include?(@apply_zoom)
109
+ GLib.g_idle_add(@apply_zoom, nil)
110
+ end
111
+
86
112
  def on_close(&block)
87
113
  @on_close = block
88
114
  self
data/lib/roxane.rb CHANGED
@@ -36,5 +36,6 @@ module Roxane
36
36
  end
37
37
 
38
38
  require_relative "roxane/ffi"
39
+ require_relative "roxane/webkit"
39
40
  require_relative "roxane/static_server"
40
41
  require_relative "roxane/window"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roxane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - BKK Riese
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-18 00:00:00.000000000 Z
11
+ date: 2026-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -41,6 +41,7 @@ files:
41
41
  - lib/roxane/ffi.rb
42
42
  - lib/roxane/static_server.rb
43
43
  - lib/roxane/version.rb
44
+ - lib/roxane/webkit.rb
44
45
  - lib/roxane/window.rb
45
46
  - vendor/aarch64-linux/libwebview.so
46
47
  homepage: https://github.com/quarterstack/roxane