summaryrefslogtreecommitdiff
path: root/plugins/VoiceService/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-08-11 16:25:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-08-11 16:25:06 +0300
commit4f99191f837b1fdb6a84622fa2d2cee6278ce91b (patch)
tree9373db18b8d8673d1bb4d364c0ee6751c5ba996c /plugins/VoiceService/src
parent176921f0efaf0242d1687477e369658066467d88 (diff)
fixes #3155 (VoiceService: фрейм то появляется, то пропадает)
Diffstat (limited to 'plugins/VoiceService/src')
-rw-r--r--plugins/VoiceService/src/frame.cpp26
-rw-r--r--plugins/VoiceService/src/hooks.cpp2
-rw-r--r--plugins/VoiceService/src/stdafx.h2
3 files changed, 17 insertions, 13 deletions
diff --git a/plugins/VoiceService/src/frame.cpp b/plugins/VoiceService/src/frame.cpp
index 365a357e15..acbad61551 100644
--- a/plugins/VoiceService/src/frame.cpp
+++ b/plugins/VoiceService/src/frame.cpp
@@ -78,7 +78,7 @@ void ResizeFrame(int id, HWND hwnd)
GetWindowRect(hwnd, &r_window);
int diff = (parent_window.bottom - parent_window.top) - (parent_client.bottom - parent_client.top);
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (g_plugin.bFramesExist)
diff += (r_window.top - parent_window.top);
SetWindowPos(parent, 0, 0, 0, parent_window.right - parent_window.left, height + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
@@ -95,16 +95,18 @@ void ResizeFrame(int id, HWND hwnd)
void ShowFrame(int id, HWND hwnd, int show)
{
- BOOL is_visible = IsWindowVisible(hwnd);
- if ((is_visible && show == SW_SHOW) || (!is_visible && show == SW_HIDE))
+ if (!g_plugin.bFramesExist || id == -1) {
+ ShowWindow(GetParent(hwnd), show);
return;
+ }
- if (ServiceExists(MS_CLIST_FRAMES_SHFRAME) && id != -1)
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)id, 0);
- else
- ShowWindow(GetParent(hwnd), show);
+ BOOL bIsVisible = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS) & F_VISIBLE;
+ if ((bIsVisible && show == SW_SHOW) || (!bIsVisible && show == SW_HIDE))
+ CallService(MS_CLIST_FRAMES_SHFRAME, id, 0);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int dialCtrls[] = {
IDC_DIALPAD, IDC_NUMBER, IDC_CALL,
IDC_1, IDC_2, IDC_3,
@@ -715,7 +717,7 @@ static INT_PTR CALLBACK FrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
void InitFrames()
{
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ if (g_plugin.bFramesExist) {
hwnd_frame = CreateDialogW(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CALLS), g_clistApi.hwndContactList, FrameWndProc);
CLISTFrame Frame = {};
@@ -723,18 +725,16 @@ void InitFrames()
Frame.szName.w = TranslateT("Voice Calls");
Frame.hWnd = hwnd_frame;
Frame.align = alBottom;
- Frame.Flags = F_VISIBLE | F_NOBORDER | F_LOCKED | F_UNICODE;
- Frame.height = 0;
+ Frame.Flags = F_NOBORDER | F_LOCKED | F_UNICODE;
Frame.hIcon = g_plugin.getIcon(IDI_MAIN, true);
-
frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
}
}
void DeInitFrames()
{
- if (ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME) && frame_id != -1)
- CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)frame_id, 0);
+ if (g_plugin.bFramesExist && frame_id != -1)
+ CallService(MS_CLIST_FRAMES_REMOVEFRAME, frame_id, 0);
if (hwnd_frame != NULL)
DestroyWindow(hwnd_frame);
diff --git a/plugins/VoiceService/src/hooks.cpp b/plugins/VoiceService/src/hooks.cpp
index d25a4ccdaa..45fea47d59 100644
--- a/plugins/VoiceService/src/hooks.cpp
+++ b/plugins/VoiceService/src/hooks.cpp
@@ -633,6 +633,8 @@ static INT_PTR CMDrop(WPARAM wParam, LPARAM)
int ModulesLoaded(WPARAM, LPARAM)
{
+ g_plugin.bFramesExist = ServiceExists(MS_CLIST_FRAMES_ADDFRAME);
+
// add our modules to the KnownModules list
CallService("DBEditorpp/RegisterSingleModule", (WPARAM)MODULE_NAME, 0);
diff --git a/plugins/VoiceService/src/stdafx.h b/plugins/VoiceService/src/stdafx.h
index b0d759deed..45fd220cdf 100644
--- a/plugins/VoiceService/src/stdafx.h
+++ b/plugins/VoiceService/src/stdafx.h
@@ -67,6 +67,8 @@ using namespace std;
struct CMPlugin : public PLUGIN<CMPlugin>
{
+ bool bFramesExist = false;
+
CMPlugin();
int Load() override;