Skip to content

Commit

Permalink
fix: respond to clear_all() from plugin
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
benthillerkus committed Feb 24, 2023
1 parent 55431e9 commit 00aa236
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/src/plugin.dart
Expand Up @@ -146,6 +146,8 @@ class BetrayalPlugin {
"message: 10b$message ${message.hex}, id: ${id.hex}, event: ${code.toRadixString(16)}, position: $position}, hWnd: $hWnd");
}
break;
default:
_logger.warning("asked to call unknown method by plugin!");
}
}

Expand Down
4 changes: 3 additions & 1 deletion windows/betrayal_plugin.cpp
Expand Up @@ -40,7 +40,7 @@ namespace Betrayal
int window_proc_id = -1;
IconManager icons;

// Called when a method is called on this plugin's channel from Dart.
// Called by the Windows Event Loop
std::optional<LRESULT> BetrayalPlugin::HandleWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
std::optional<LRESULT> result;
Expand Down Expand Up @@ -98,6 +98,7 @@ namespace Betrayal
#define WITH_ID const int id = std::get<int>(args.at(flutter::EncodableValue("id")));
#define WITH_ARGS_HWND_ID WITH_ARGS WITH_HWND WITH_ID

// Called when a method is called on this plugin's channel from Dart.
void HandleMethodCall(
const flutter::MethodCall<flutter::EncodableValue> &method_call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result)
Expand All @@ -106,6 +107,7 @@ namespace Betrayal
if (method.compare("reset") == 0)
{
icons.clear_all();
result->Success(flutter::EncodableValue(0));
}
else if (method.compare("getSystemMetrics") == 0)
{
Expand Down

0 comments on commit 00aa236

Please sign in to comment.