webview_ruby2 0.2.3 → 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 +4 -4
- data/ext/webview/webview.h +25 -0
- data/lib/webview_ruby/version.rb +1 -1
- data/lib/webview_ruby.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd858452ab97d305a97f2f5f1f8092498c2b72d6253cf496e3e81907c70fafa6
|
4
|
+
data.tar.gz: f7250853a555bae8926c63e6eb0e6c9f13895f7d490c7a4a64ced3814731172b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f480c462b9dfec4aaf969987f1e07799d33cdddd619d9bf80b36fb5de34a157b1b768f43e1aea3d92fe63b161b84e070061c36654e10c566e52a86b0dfdbfa4d
|
7
|
+
data.tar.gz: 1f9071a4f90d17da7240689474779491f8ee55b108094d73bf94dba8a5538620adef32da0d8b9cd87d616792a6fa1bdd6cb74682726c3f7b7da91f43a35873b3
|
data/ext/webview/webview.h
CHANGED
@@ -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
|
|
@@ -596,6 +599,8 @@ using browser_engine = gtk_webkit_engine;
|
|
596
599
|
|
597
600
|
#define NSWindowTitleHidden 1
|
598
601
|
|
602
|
+
#define NSWindowStyleMaskFullScreen (1 << 14)
|
603
|
+
|
599
604
|
#define NSApplicationActivationPolicyRegular 0
|
600
605
|
|
601
606
|
#define WKUserScriptInjectionTimeAtDocumentStart 0
|
@@ -732,6 +737,15 @@ public:
|
|
732
737
|
void run() {
|
733
738
|
id app = ((id(*)(id, SEL))objc_msgSend)("NSApplication"_cls,
|
734
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
|
+
|
735
749
|
dispatch([&]() {
|
736
750
|
((void (*)(id, SEL, BOOL))objc_msgSend)(
|
737
751
|
app, "activateIgnoringOtherApps:"_sel, 1);
|
@@ -766,6 +780,10 @@ public:
|
|
766
780
|
"NSColor"_cls, "colorWithRed:green:blue:alpha:"_sel, r, g, b, a));
|
767
781
|
}
|
768
782
|
|
783
|
+
void hide_from_dock(int hide) {
|
784
|
+
this->dock_hide = hide;
|
785
|
+
}
|
786
|
+
|
769
787
|
void set_title(const std::string title) {
|
770
788
|
((void (*)(id, SEL, id))objc_msgSend)(
|
771
789
|
m_window, "setTitle:"_sel,
|
@@ -773,8 +791,10 @@ public:
|
|
773
791
|
"NSString"_cls, "stringWithUTF8String:"_sel, title.c_str()));
|
774
792
|
}
|
775
793
|
void set_size(int width, int height, int hints, int margin_top) {
|
794
|
+
|
776
795
|
auto style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
|
777
796
|
NSWindowStyleMaskMiniaturizable;
|
797
|
+
style &= ~NSWindowStyleMaskFullScreen;
|
778
798
|
/*
|
779
799
|
((void (*)(id, SEL, unsigned long))objc_msgSend)(
|
780
800
|
m_window, "setTitleVisibility:"_sel, NSWindowTitleHidden);
|
@@ -848,6 +868,7 @@ private:
|
|
848
868
|
id m_window;
|
849
869
|
id m_webview;
|
850
870
|
id m_manager;
|
871
|
+
int dock_hide = 0;
|
851
872
|
};
|
852
873
|
|
853
874
|
using browser_engine = cocoa_wkwebview_engine;
|
@@ -1382,6 +1403,10 @@ WEBVIEW_API void webview_set_title(webview_t w, const char *title) {
|
|
1382
1403
|
static_cast<webview::webview *>(w)->set_title(title);
|
1383
1404
|
}
|
1384
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
|
+
|
1385
1410
|
WEBVIEW_API void webview_set_bg(webview_t w, double r, double g, double b, double a) {
|
1386
1411
|
static_cast<webview::webview *>(w)->set_bg(r, g, b, a);
|
1387
1412
|
}
|
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_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
|
+
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-
|
10
|
+
date: 2025-06-28 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: ffi
|