webview_ruby2 0.2.5 → 0.2.6

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: dd858452ab97d305a97f2f5f1f8092498c2b72d6253cf496e3e81907c70fafa6
4
- data.tar.gz: f7250853a555bae8926c63e6eb0e6c9f13895f7d490c7a4a64ced3814731172b
3
+ metadata.gz: 877b4375e719e91491c5fff9cb8f6a700d602e932ff720d7d194f0b1e033ced5
4
+ data.tar.gz: accdb93f959e780245d3bca2582c050efa91cbd39fce4e11a2bbc761c4c7341e
5
5
  SHA512:
6
- metadata.gz: f480c462b9dfec4aaf969987f1e07799d33cdddd619d9bf80b36fb5de34a157b1b768f43e1aea3d92fe63b161b84e070061c36654e10c566e52a86b0dfdbfa4d
7
- data.tar.gz: 1f9071a4f90d17da7240689474779491f8ee55b108094d73bf94dba8a5538620adef32da0d8b9cd87d616792a6fa1bdd6cb74682726c3f7b7da91f43a35873b3
6
+ metadata.gz: 5fb30bec7976d17bd17373bc80c765899c55d137e6bdf4e48b80c578c5fbe149975aedb073ff93036ade1793d3fb5824686659ca15523fdc35d837bacc5452a3
7
+ data.tar.gz: d2c802736667fa4e36f4a32ee5d0f391c82162fbb325ef0189aa101f32f7f9a5294ffaf62cd95a534cdeb0bef603ea3d5324dea6ebfe6e5e92d2ae45e48cf6ac
@@ -69,6 +69,9 @@ WEBVIEW_API void webview_set_title(webview_t w, const char *title);
69
69
  // Hide from dock
70
70
  WEBVIEW_API void webview_hide_from_dock(webview_t w, int hide);
71
71
 
72
+ // Show/hide webview window
73
+ WEBVIEW_API void webview_show(webview_t w, int show);
74
+
72
75
  // Update the background color of the native window
73
76
  WEBVIEW_API void webview_set_bg(webview_t w, double r, double g, double b, double a);
74
77
 
@@ -631,7 +634,7 @@ public:
631
634
  objc_allocateClassPair((Class) "NSResponder"_cls, "AppDelegate", 0);
632
635
  class_addProtocol(cls, objc_getProtocol("NSTouchBarProvider"));
633
636
  class_addMethod(cls, "applicationShouldTerminateAfterLastWindowClosed:"_sel,
634
- (IMP)(+[](id, SEL, id) -> BOOL { return 1; }), "c@:@");
637
+ (IMP)(+[](id, SEL, id) -> BOOL { return 0; }), "c@:@");
635
638
  class_addMethod(cls, "userContentController:didReceiveScriptMessage:"_sel,
636
639
  (IMP)(+[](id self, SEL, id, id msg) {
637
640
  auto w =
@@ -784,6 +787,18 @@ public:
784
787
  this->dock_hide = hide;
785
788
  }
786
789
 
790
+ void show(int yes) {
791
+ if(yes == 0) {
792
+ ((void (*)(id, SEL, id))objc_msgSend)(
793
+ m_window, "orderOut:"_sel,
794
+ nullptr);
795
+ } else {
796
+ ((void (*)(id, SEL, id))objc_msgSend)(
797
+ m_window, "makeKeyAndOrderFront:"_sel,
798
+ nullptr);
799
+ }
800
+ }
801
+
787
802
  void set_title(const std::string title) {
788
803
  ((void (*)(id, SEL, id))objc_msgSend)(
789
804
  m_window, "setTitle:"_sel,
@@ -1407,6 +1422,10 @@ WEBVIEW_API void webview_hide_from_dock(webview_t w, int hide) {
1407
1422
  static_cast<webview::webview *>(w)->hide_from_dock(hide);
1408
1423
  }
1409
1424
 
1425
+ WEBVIEW_API void webview_show(webview_t w, int show) {
1426
+ static_cast<webview::webview *>(w)->show(show);
1427
+ }
1428
+
1410
1429
  WEBVIEW_API void webview_set_bg(webview_t w, double r, double g, double b, double a) {
1411
1430
  static_cast<webview::webview *>(w)->set_bg(r, g, b, a);
1412
1431
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebviewRuby
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
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_show, [:pointer, :int], :void
15
16
  attach_function :webview_hide_from_dock, [:pointer, :int], :void
16
17
  attach_function :webview_set_pos, [:pointer, :int, :int], :void
17
18
  attach_function :webview_set_bg, [:pointer, :double, :double, :double, :double], :void
@@ -32,6 +33,14 @@ module WebviewRuby
32
33
  @window = WebviewRuby.webview_create(debug ? 1 : 0, nil)
33
34
  end
34
35
 
36
+ def show(yes)
37
+ if yes
38
+ WebviewRuby.webview_show(@window, 1)
39
+ else
40
+ WebviewRuby.webview_show(@window, 0)
41
+ end
42
+ end
43
+
35
44
  def hide_from_dock(hide)
36
45
  WebviewRuby.webview_hide_from_dock(@window, hide)
37
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webview_ruby2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Concetto Rudilosso