AyuGramDesktop/Telegram/SourceFiles/ayu/features/streamer_mode/streamer_mode_windows.cpp
ZavaruKitsu e1babcf69a feat: new message history viewer initial
fix: use Qt formatting

kanged from `admin_log` and cleaned up a bit
2023-09-14 17:36:14 +03:00

55 lines
1 KiB
C++

// This is the source code of AyuGram for Desktop.
//
// We do not and cannot prevent the use of our code,
// but be respectful and credit the original author.
//
// Copyright @Radolyn, 2023
#ifdef WIN32
#include "streamer_mode.h"
#include "core/application.h"
#include "window/window_controller.h"
namespace AyuFeatures::StreamerMode
{
bool isEnabledVal;
bool isEnabled()
{
return isEnabledVal;
}
void enable()
{
auto handle = Core::App().activeWindow()->widget()->psHwnd();
SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE);
isEnabledVal = true;
}
void disable()
{
auto handle = Core::App().activeWindow()->widget()->psHwnd();
SetWindowDisplayAffinity(handle, WDA_NONE);
isEnabledVal = false;
}
void hideWidgetWindow(QWidget *widget)
{
auto handle = reinterpret_cast<HWND>(widget->window()->winId());
SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE);
}
void showWidgetWindow(QWidget *widget)
{
auto handle = reinterpret_cast<HWND>(widget->window()->winId());
SetWindowDisplayAffinity(handle, WDA_NONE);
}
}
#endif