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 +4 -4
- data/ext/webview/webview.h +20 -1
- data/lib/webview_ruby/version.rb +1 -1
- data/lib/webview_ruby.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 877b4375e719e91491c5fff9cb8f6a700d602e932ff720d7d194f0b1e033ced5
|
4
|
+
data.tar.gz: accdb93f959e780245d3bca2582c050efa91cbd39fce4e11a2bbc761c4c7341e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fb30bec7976d17bd17373bc80c765899c55d137e6bdf4e48b80c578c5fbe149975aedb073ff93036ade1793d3fb5824686659ca15523fdc35d837bacc5452a3
|
7
|
+
data.tar.gz: d2c802736667fa4e36f4a32ee5d0f391c82162fbb325ef0189aa101f32f7f9a5294ffaf62cd95a534cdeb0bef603ea3d5324dea6ebfe6e5e92d2ae45e48cf6ac
|
data/ext/webview/webview.h
CHANGED
@@ -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
|
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
|
}
|
data/lib/webview_ruby/version.rb
CHANGED
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
|