Skip to content

Commit e9d4d7f

Browse files
committed
(#17) Exported getWindowTitle
1 parent 4e92f3c commit e9d4d7f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ Napi::Number _highlight(const Napi::CallbackInfo &info)
672672
Napi::Array _getWindows(const Napi::CallbackInfo &info) {
673673
Napi::Env env = info.Env();
674674

675-
std::vector<int32_t> windowHandles = getWindows();
675+
std::vector<int64_t> windowHandles = getWindows();
676676
auto arr = Napi::Array::New(env, windowHandles.size());
677677

678678
for (size_t idx = 0; idx < windowHandles.size(); ++idx) {
@@ -685,7 +685,7 @@ Napi::Array _getWindows(const Napi::CallbackInfo &info) {
685685
Napi::Object _getWindowRect(const Napi::CallbackInfo &info) {
686686
Napi::Env env = info.Env();
687687

688-
MMRect windowRect = getWindowRect(info[0].As<Napi::Number>().Int32Value());
688+
MMRect windowRect = getWindowRect(info[0].As<Napi::Number>().Int64Value());
689689
Napi::Object obj = Napi::Object::New(env);
690690
obj.Set(Napi::String::New(env, "x"), Napi::Number::New(env, windowRect.origin.x));
691691
obj.Set(Napi::String::New(env, "y"), Napi::Number::New(env, windowRect.origin.y));
@@ -695,6 +695,12 @@ Napi::Object _getWindowRect(const Napi::CallbackInfo &info) {
695695
return obj;
696696
}
697697

698+
Napi::String _getWindowTitle(const Napi::CallbackInfo &info) {
699+
Napi::Env env = info.Env();
700+
701+
return Napi::String::New(env, getWindowTitle(info[0].As<Napi::Number>().Int64Value()));
702+
}
703+
698704
Napi::Object _captureScreen(const Napi::CallbackInfo &info)
699705
{
700706
Napi::Env env = info.Env();
@@ -778,6 +784,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
778784
exports.Set(Napi::String::New(env, "highlight"), Napi::Function::New(env, _highlight));
779785
exports.Set(Napi::String::New(env, "getWindows"), Napi::Function::New(env, _getWindows));
780786
exports.Set(Napi::String::New(env, "getWindowRect"), Napi::Function::New(env, _getWindowRect));
787+
exports.Set(Napi::String::New(env, "getWindowTitle"), Napi::Function::New(env, _getWindowTitle));
781788
exports.Set(Napi::String::New(env, "captureScreen"), Napi::Function::New(env, _captureScreen));
782789
exports.Set(Napi::String::New(env, "getXDisplayName"), Napi::Function::New(env, _getXDisplayName));
783790
exports.Set(Napi::String::New(env, "setXDisplayName"), Napi::Function::New(env, _setXDisplayName));

0 commit comments

Comments
 (0)