webview_ruby2 0.2.4 → 0.2.5

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: 1cefbf9ba714c336ab0e375c9a3ed17e128a85159dbd54606266d097d40fe296
4
- data.tar.gz: fa6e1132f23ec33d90d89c4a86aa13b1bf44ba5595e8c50e0d78e6d4bdc73673
3
+ metadata.gz: dd858452ab97d305a97f2f5f1f8092498c2b72d6253cf496e3e81907c70fafa6
4
+ data.tar.gz: f7250853a555bae8926c63e6eb0e6c9f13895f7d490c7a4a64ced3814731172b
5
5
  SHA512:
6
- metadata.gz: 69b5a735bce1fdc189e91e7cdc66182a8a3f07fea9c549e782e9a56a94a63369ef98217eb5b14c84fbaea44db11a91c8dfc1e0787c1545f8e22cada0cd5d1ded
7
- data.tar.gz: 670c47c11bfb4a267233eb1e16a08d197ac04fc0c6e121e6b14b5f0632d8227969b26ce9565469310d905736996cee07265fcb7d1b5e6deaba03d031974d16a0
6
+ metadata.gz: f480c462b9dfec4aaf969987f1e07799d33cdddd619d9bf80b36fb5de34a157b1b768f43e1aea3d92fe63b161b84e070061c36654e10c566e52a86b0dfdbfa4d
7
+ data.tar.gz: 1f9071a4f90d17da7240689474779491f8ee55b108094d73bf94dba8a5538620adef32da0d8b9cd87d616792a6fa1bdd6cb74682726c3f7b7da91f43a35873b3
@@ -66,6 +66,9 @@ WEBVIEW_API void *webview_get_window(webview_t w);
66
66
  // Updates the title of the native window. Must be called from the UI thread.
67
67
  WEBVIEW_API void webview_set_title(webview_t w, const char *title);
68
68
 
69
+ // Hide from dock
70
+ WEBVIEW_API void webview_hide_from_dock(webview_t w, int hide);
71
+
69
72
  // Update the background color of the native window
70
73
  WEBVIEW_API void webview_set_bg(webview_t w, double r, double g, double b, double a);
71
74
 
@@ -734,6 +737,15 @@ public:
734
737
  void run() {
735
738
  id app = ((id(*)(id, SEL))objc_msgSend)("NSApplication"_cls,
736
739
  "sharedApplication"_sel);
740
+
741
+ #define NSApplicationActivationPolicyAccessory 1
742
+ if (this->dock_hide) {
743
+ dispatch([&]() {
744
+ ((void (*)(id, SEL, BOOL))objc_msgSend)(
745
+ app, "setActivationPolicy:"_sel, NSApplicationActivationPolicyAccessory);
746
+ });
747
+ }
748
+
737
749
  dispatch([&]() {
738
750
  ((void (*)(id, SEL, BOOL))objc_msgSend)(
739
751
  app, "activateIgnoringOtherApps:"_sel, 1);
@@ -768,6 +780,10 @@ public:
768
780
  "NSColor"_cls, "colorWithRed:green:blue:alpha:"_sel, r, g, b, a));
769
781
  }
770
782
 
783
+ void hide_from_dock(int hide) {
784
+ this->dock_hide = hide;
785
+ }
786
+
771
787
  void set_title(const std::string title) {
772
788
  ((void (*)(id, SEL, id))objc_msgSend)(
773
789
  m_window, "setTitle:"_sel,
@@ -852,6 +868,7 @@ private:
852
868
  id m_window;
853
869
  id m_webview;
854
870
  id m_manager;
871
+ int dock_hide = 0;
855
872
  };
856
873
 
857
874
  using browser_engine = cocoa_wkwebview_engine;
@@ -1386,6 +1403,10 @@ WEBVIEW_API void webview_set_title(webview_t w, const char *title) {
1386
1403
  static_cast<webview::webview *>(w)->set_title(title);
1387
1404
  }
1388
1405
 
1406
+ WEBVIEW_API void webview_hide_from_dock(webview_t w, int hide) {
1407
+ static_cast<webview::webview *>(w)->hide_from_dock(hide);
1408
+ }
1409
+
1389
1410
  WEBVIEW_API void webview_set_bg(webview_t w, double r, double g, double b, double a) {
1390
1411
  static_cast<webview::webview *>(w)->set_bg(r, g, b, a);
1391
1412
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebviewRuby
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
data/lib/webview_ruby.rb CHANGED
@@ -12,6 +12,7 @@ module WebviewRuby
12
12
  attach_function :webview_run, [:pointer], :void
13
13
  attach_function :webview_terminate, [:pointer], :void
14
14
  attach_function :webview_set_title, [:pointer, :string], :void
15
+ attach_function :webview_hide_from_dock, [:pointer, :int], :void
15
16
  attach_function :webview_set_pos, [:pointer, :int, :int], :void
16
17
  attach_function :webview_set_bg, [:pointer, :double, :double, :double, :double], :void
17
18
  attach_function :webview_set_size, [:pointer, :int, :int, :int, :int], :void
@@ -31,6 +32,10 @@ module WebviewRuby
31
32
  @window = WebviewRuby.webview_create(debug ? 1 : 0, nil)
32
33
  end
33
34
 
35
+ def hide_from_dock(hide)
36
+ WebviewRuby.webview_hide_from_dock(@window, hide)
37
+ end
38
+
34
39
  def get_x()
35
40
  WebviewRuby.webview_get_x(@window)
36
41
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webview_ruby2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Concetto Rudilosso
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-06-23 00:00:00.000000000 Z
10
+ date: 2025-06-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ffi