noobs 0.0.150 → 0.0.157
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.
- package/binding.gyp +1 -1
- package/dist/noobs.node +0 -0
- package/package.json +1 -1
- package/src/obs_interface.cpp +31 -10
- package/src/utils.cpp +39 -0
- package/src/utils.h +1 -0
package/binding.gyp
CHANGED
package/dist/noobs.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/obs_interface.cpp
CHANGED
|
@@ -14,7 +14,6 @@ void call_jscb(Napi::Env env, Napi::Function cb, SignalData* sd) {
|
|
|
14
14
|
obj.Set("type", Napi::String::New(env, sd->type));
|
|
15
15
|
obj.Set("id", Napi::String::New(env, sd->id));
|
|
16
16
|
obj.Set("code", Napi::Number::New(env, sd->code));
|
|
17
|
-
|
|
18
17
|
|
|
19
18
|
if (sd->value.has_value()) {
|
|
20
19
|
obj.Set("value", Napi::Number::New(env, sd->value.value()));
|
|
@@ -220,6 +219,7 @@ void ObsInterface::init_obs(const std::string& distPath) {
|
|
|
220
219
|
}
|
|
221
220
|
|
|
222
221
|
obs_post_load_modules();
|
|
222
|
+
register_preview_window_class();
|
|
223
223
|
|
|
224
224
|
list_encoders();
|
|
225
225
|
list_source_types();
|
|
@@ -753,14 +753,14 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
753
753
|
if (!preview_hwnd) {
|
|
754
754
|
blog(LOG_INFO, "Creating preview child window");
|
|
755
755
|
|
|
756
|
-
preview_hwnd =
|
|
757
|
-
0,
|
|
758
|
-
"
|
|
759
|
-
"OBS Preview", // Window name
|
|
760
|
-
|
|
756
|
+
preview_hwnd = CreateWindowEx(
|
|
757
|
+
0,
|
|
758
|
+
TEXT("PreviewWindowClass"), // Window class we already registered earlier
|
|
759
|
+
TEXT("OBS Preview"), // Window name
|
|
760
|
+
WS_POPUP,
|
|
761
761
|
0, 0, // Initial position (x, y)
|
|
762
762
|
0, 0, // Initial size (width, height)
|
|
763
|
-
|
|
763
|
+
NULL, // No parent yet
|
|
764
764
|
NULL, // No menu
|
|
765
765
|
GetModuleHandle(NULL),
|
|
766
766
|
NULL
|
|
@@ -770,6 +770,17 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
770
770
|
blog(LOG_ERROR, "Failed to create preview child window");
|
|
771
771
|
return;
|
|
772
772
|
}
|
|
773
|
+
|
|
774
|
+
SetParent(preview_hwnd, parent);
|
|
775
|
+
|
|
776
|
+
LONG_PTR style = GetWindowLongPtr(preview_hwnd, GWL_STYLE);
|
|
777
|
+
style &= ~WS_POPUP;
|
|
778
|
+
style |= WS_CHILD;
|
|
779
|
+
SetWindowLongPtr(preview_hwnd, GWL_STYLE, style);
|
|
780
|
+
|
|
781
|
+
LONG_PTR exStyle = GetWindowLongPtr(preview_hwnd, GWL_EXSTYLE);
|
|
782
|
+
exStyle |= WS_EX_TRANSPARENT;
|
|
783
|
+
SetWindowLongPtr(preview_hwnd, GWL_EXSTYLE, exStyle);
|
|
773
784
|
}
|
|
774
785
|
|
|
775
786
|
if (!display) {
|
|
@@ -800,11 +811,16 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
800
811
|
void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
801
812
|
blog(LOG_INFO, "ObsInterface::configurePreview");
|
|
802
813
|
|
|
803
|
-
if (!preview_hwnd
|
|
814
|
+
if (!preview_hwnd) {
|
|
804
815
|
blog(LOG_ERROR, "Preview window not initialized");
|
|
805
816
|
return;
|
|
806
817
|
}
|
|
807
818
|
|
|
819
|
+
if (!display) {
|
|
820
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
|
|
808
824
|
blog(LOG_INFO, "Moving preview child window to (%d, %d) with size (%d x %d)", x, y, width, height);
|
|
809
825
|
|
|
810
826
|
// Resize and move the existing child window.
|
|
@@ -828,11 +844,16 @@ void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
|
828
844
|
void ObsInterface::showPreview() {
|
|
829
845
|
blog(LOG_INFO, "ObsInterface::showPreview");
|
|
830
846
|
|
|
831
|
-
if (!preview_hwnd
|
|
847
|
+
if (!preview_hwnd) {
|
|
832
848
|
blog(LOG_ERROR, "Preview window not initialized");
|
|
833
849
|
return;
|
|
834
850
|
}
|
|
835
851
|
|
|
852
|
+
if (!display) {
|
|
853
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
|
|
836
857
|
ShowWindow(preview_hwnd, SW_SHOW);
|
|
837
858
|
obs_display_set_enabled(display, true);
|
|
838
859
|
}
|
|
@@ -850,7 +871,7 @@ void ObsInterface::disablePreview() {
|
|
|
850
871
|
blog(LOG_INFO, "ObsInterface::disablePreview");
|
|
851
872
|
|
|
852
873
|
if (!display) {
|
|
853
|
-
blog(LOG_ERROR, "Preview
|
|
874
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
854
875
|
return;
|
|
855
876
|
}
|
|
856
877
|
|
package/src/utils.cpp
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include <iomanip>
|
|
6
6
|
#include <sstream>
|
|
7
7
|
#include "utils.h"
|
|
8
|
+
#include <windows.h>
|
|
8
9
|
|
|
9
10
|
void log_handler(int lvl, const char *msg, va_list args, void *p) {
|
|
10
11
|
static std::ofstream logFile;
|
|
@@ -381,3 +382,41 @@ std::string get_current_date_time() {
|
|
|
381
382
|
ss << std::put_time(std::localtime(&time_t), "%Y-%m-%d %H-%M-%S");
|
|
382
383
|
return ss.str();
|
|
383
384
|
}
|
|
385
|
+
|
|
386
|
+
LRESULT CALLBACK DisplayWndProc(
|
|
387
|
+
_In_ HWND hwnd,
|
|
388
|
+
_In_ UINT uMsg,
|
|
389
|
+
_In_ WPARAM wParam,
|
|
390
|
+
_In_ LPARAM lParam)
|
|
391
|
+
{
|
|
392
|
+
switch (uMsg) {
|
|
393
|
+
case WM_NCHITTEST:
|
|
394
|
+
return HTTRANSPARENT;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
void register_preview_window_class() {
|
|
401
|
+
WNDCLASSEX klass;
|
|
402
|
+
|
|
403
|
+
klass.cbSize = sizeof(WNDCLASSEX);
|
|
404
|
+
klass.style = CS_NOCLOSE | CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
|
405
|
+
klass.lpfnWndProc = DisplayWndProc;
|
|
406
|
+
klass.cbClsExtra = 0;
|
|
407
|
+
klass.cbWndExtra = 0;
|
|
408
|
+
klass.hInstance = GetModuleHandle(NULL);
|
|
409
|
+
klass.hIcon = NULL;
|
|
410
|
+
klass.hCursor = NULL;
|
|
411
|
+
klass.hbrBackground = NULL;
|
|
412
|
+
klass.lpszMenuName = NULL;
|
|
413
|
+
klass.lpszClassName = TEXT("PreviewWindowClass");
|
|
414
|
+
klass.hIconSm = NULL;
|
|
415
|
+
|
|
416
|
+
if (RegisterClassEx(&klass) == NULL) {
|
|
417
|
+
blog(LOG_ERROR, "Failed to register window class");
|
|
418
|
+
throw new std::runtime_error("Failed to register window class");
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
blog(LOG_INFO, "Registered preview window class");
|
|
422
|
+
}
|