Added support for systray (Windows Notification Area) icon. Modified the default OBS icon (added a red dot) to signal running state (broadcasting, previewing, etc). Added two General Settings options for displaying the Notification Area icon and minimizing to it.
parent
b4887f748f
commit
058537cdfa
5
OBS.rc
5
OBS.rc
|
@ -160,6 +160,10 @@ BEGIN
|
|||
PUSHBUTTON "Rename",IDC_RENAME,224,58,76,14
|
||||
PUSHBUTTON "Remove",IDC_REMOVE,301,58,75,14
|
||||
LTEXT "Settings.General.Restart",IDC_INFO,7,145,409,48,NOT WS_VISIBLE
|
||||
CONTROL "Settings.General.Notification",IDC_NOTIFICATIONICON,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,94,108,10,WS_EX_RIGHT
|
||||
CONTROL "Settings.General.NotificationMinimize",IDC_MINIZENOTIFICATION,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,110,134,10,WS_EX_RIGHT
|
||||
END
|
||||
|
||||
IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336
|
||||
|
@ -646,6 +650,7 @@ IDI_SOUND_MIC ICON "ui\\mic2.ico"
|
|||
IDI_SOUND_MIC_MUTED ICON "ui\\mic2-muted.ico"
|
||||
IDI_SOUND_DESKTOP ICON "ui\\speaker.ico"
|
||||
IDI_SOUND_DESKTOP_MUTED ICON "ui\\speaker-muted.ico"
|
||||
IDI_ICON2 ICON "ui\\test2\\recording.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -299,6 +299,7 @@
|
|||
<None Include="ui\mic2.ico" />
|
||||
<None Include="ui\speaker-muted.ico" />
|
||||
<None Include="ui\speaker.ico" />
|
||||
<None Include="ui\test2\recording.ico" />
|
||||
<None Include="ui\test2\test.ico" />
|
||||
<None Include="ui\test2\test48.ico" />
|
||||
<None Include="rundir\shaders\DownscaleYUV1.5.pShader" />
|
||||
|
|
|
@ -230,6 +230,9 @@
|
|||
<None Include="rundir\shaders\DrawTexture.vShader">
|
||||
<Filter>Shaders</Filter>
|
||||
</None>
|
||||
<None Include="ui\test2\recording.ico">
|
||||
<Filter>Resources</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Headers">
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#define ISOLATION_AWARE_ENABLED 1
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
#include <commdlg.h>
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
@ -446,6 +446,16 @@ OBS::OBS()
|
|||
0, 0, 0, 0, hwndMain, (HMENU)ID_SOURCES_TEXT, 0, 0);
|
||||
SendMessage(hwndTemp, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// notification area
|
||||
|
||||
bNotificationAreaIcon = false;
|
||||
wmExplorerRestarted = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||
if (AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0)
|
||||
{
|
||||
ShowNotificationAreaIcon();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// populate scenes
|
||||
|
||||
|
@ -661,6 +671,11 @@ OBS::~OBS()
|
|||
pluginInfo.strFile.Clear();
|
||||
}
|
||||
|
||||
if (AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0)
|
||||
{
|
||||
App->HideNotificationAreaIcon();
|
||||
}
|
||||
|
||||
//DestroyWindow(hwndMain);
|
||||
|
||||
// Remember window state for next launch
|
||||
|
@ -1541,3 +1556,51 @@ void OBS::SetSourceRender(CTSTR sourceName, bool render)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL OBS::SetNotificationAreaIcon(DWORD dwMessage, int idIcon, const String &tooltip)
|
||||
{
|
||||
NOTIFYICONDATA niData;
|
||||
ZeroMemory(&niData, sizeof(NOTIFYICONDATA));
|
||||
niData.cbSize = sizeof(niData);
|
||||
niData.hWnd = hwndMain;
|
||||
niData.uID = 0;
|
||||
if (NIM_DELETE != dwMessage)
|
||||
{
|
||||
niData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||
niData.uCallbackMessage = OBS_NOTIFICATIONAREA;
|
||||
niData.hIcon = LoadIcon(hinstMain, MAKEINTRESOURCE(idIcon));
|
||||
lstrcpy(niData.szTip, tooltip);
|
||||
}
|
||||
return Shell_NotifyIcon(dwMessage, &niData);
|
||||
}
|
||||
|
||||
BOOL OBS::ShowNotificationAreaIcon()
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
int idIcon = bRunning ? IDI_ICON2 : IDI_ICON1;
|
||||
String tooltip(TEXT("OBS"));
|
||||
|
||||
if (!bNotificationAreaIcon)
|
||||
{
|
||||
bNotificationAreaIcon = true;
|
||||
result = SetNotificationAreaIcon(NIM_ADD, idIcon, tooltip);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = SetNotificationAreaIcon(NIM_MODIFY, idIcon, tooltip);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL OBS::UpdateNotificationAreaIcon()
|
||||
{
|
||||
if (bNotificationAreaIcon)
|
||||
return ShowNotificationAreaIcon();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL OBS::HideNotificationAreaIcon()
|
||||
{
|
||||
bNotificationAreaIcon = false;
|
||||
return SetNotificationAreaIcon(NIM_DELETE, 0, TEXT(""));
|
||||
}
|
||||
|
|
11
Source/OBS.h
11
Source/OBS.h
|
@ -341,6 +341,7 @@ enum
|
|||
OBS_SETSOURCEORDER,
|
||||
OBS_SETSOURCERENDER,
|
||||
OBS_UPDATESTATUSBAR,
|
||||
OBS_NOTIFICATIONAREA,
|
||||
};
|
||||
|
||||
//----------------------------
|
||||
|
@ -655,6 +656,12 @@ private:
|
|||
bool QueryNewAudio(QWORD ×tamp);
|
||||
void MainAudioLoop();
|
||||
|
||||
//---------------------------------------------------
|
||||
// notification area icon
|
||||
UINT wmExplorerRestarted;
|
||||
bool bNotificationAreaIcon;
|
||||
BOOL SetNotificationAreaIcon(DWORD dwMessage, int idIcon, const String &tooltip);
|
||||
|
||||
//---------------------------------------------------
|
||||
// random bla-haa
|
||||
|
||||
|
@ -929,6 +936,10 @@ public:
|
|||
virtual void ReportMicVolumeChange(float level, bool muted, bool finalValue);
|
||||
virtual void ReportDesktopVolumeChange(float level, bool muted, bool finalValue);
|
||||
|
||||
// notification area icon functions
|
||||
BOOL ShowNotificationAreaIcon();
|
||||
BOOL UpdateNotificationAreaIcon();
|
||||
BOOL HideNotificationAreaIcon();
|
||||
};
|
||||
|
||||
LONG CALLBACK OBSExceptionHandler (PEXCEPTION_POINTERS exceptionInfo);
|
||||
|
|
|
@ -308,6 +308,7 @@ void OBS::Start()
|
|||
//-------------------------------------------------------------
|
||||
|
||||
bRunning = true;
|
||||
UpdateNotificationAreaIcon();
|
||||
|
||||
if(sceneElement)
|
||||
{
|
||||
|
@ -480,6 +481,7 @@ void OBS::Stop()
|
|||
ReportStopStreamTrigger();
|
||||
|
||||
bRunning = false;
|
||||
UpdateNotificationAreaIcon();
|
||||
if(hMainThread)
|
||||
{
|
||||
OSTerminateThread(hMainThread, 20000);
|
||||
|
|
|
@ -79,6 +79,17 @@ void SettingsGeneral::DestroyPane()
|
|||
|
||||
void SettingsGeneral::ApplySettings()
|
||||
{
|
||||
//--------------------------------------------------
|
||||
|
||||
bool bShowNotificationAreaIcon = SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_GETCHECK, 0, 0) == BST_CHECKED;
|
||||
AppConfig->SetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), bShowNotificationAreaIcon);
|
||||
if (bShowNotificationAreaIcon)
|
||||
App->ShowNotificationAreaIcon();
|
||||
else
|
||||
App->HideNotificationAreaIcon();
|
||||
|
||||
bool bMinimizeToNotificationArea = SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_GETCHECK, 0, 0) == BST_CHECKED;
|
||||
AppConfig->SetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), bMinimizeToNotificationArea);
|
||||
}
|
||||
|
||||
void SettingsGeneral::CancelSettings()
|
||||
|
@ -145,6 +156,14 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
//----------------------------------------------
|
||||
|
||||
bool bShowNotificationAreaIcon = AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0;
|
||||
SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_SETCHECK, bShowNotificationAreaIcon ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
|
||||
bool bMinimizeToNotificationArea = AppConfig->GetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), 0) != 0;
|
||||
SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_SETCHECK, bMinimizeToNotificationArea ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
|
||||
//----------------------------------------------
|
||||
|
||||
SetChangedSettings(false);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -322,6 +341,22 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_NOTIFICATIONICON:
|
||||
if (SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_GETCHECK, 0, 0) == BST_UNCHECKED)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
}
|
||||
SetChangedSettings(true);
|
||||
break;
|
||||
|
||||
case IDC_MINIZENOTIFICATION:
|
||||
if (SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_SETCHECK, BST_CHECKED, 0);
|
||||
}
|
||||
SetChangedSettings(true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2484,6 +2484,10 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
if(!App->bDragResize)
|
||||
App->bSizeChanging = false;
|
||||
}
|
||||
else if (wParam == SIZE_MINIMIZED && AppConfig->GetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), 0) != 0)
|
||||
{
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2537,11 +2541,44 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
App->SetStatusBarData();
|
||||
break;
|
||||
|
||||
case OBS_NOTIFICATIONAREA:
|
||||
switch (lParam) {
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
bool bMinimizeToNotificationArea = AppConfig->GetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), 0) != 0;
|
||||
if (bMinimizeToNotificationArea)
|
||||
{
|
||||
if (IsWindowVisible(hwnd))
|
||||
{
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
ShowWindow(hwnd, SW_RESTORE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsIconic(hwnd))
|
||||
ShowWindow(hwnd, SW_RESTORE);
|
||||
else
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (message == App->wmExplorerRestarted)
|
||||
{
|
||||
App->UpdateNotificationAreaIcon();
|
||||
}
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define IDD_BUILDINGMP4 137
|
||||
#define IDD_CONFIGURETEXTSOURCE 139
|
||||
#define IDD_ENDINGDELAY 140
|
||||
#define IDI_ICON2 142
|
||||
#define IDC_SETTINGSLIST 1006
|
||||
#define IDC_SUBDIALOG 1007
|
||||
#define IDC_MODE 1008
|
||||
|
@ -82,6 +83,7 @@
|
|||
#define IDC_OPACITY 1041
|
||||
#define IDC_USETEXTEXTENTS 1041
|
||||
#define IDC_CUSTOMBUFFER 1041
|
||||
#define IDC_NOTIFICATIONICON 1041
|
||||
#define IDC_SERVEREDIT 1042
|
||||
#define IDC_USESENDBUFFER 1042
|
||||
#define IDC_FORCEMONO 1042
|
||||
|
@ -192,6 +194,7 @@
|
|||
#define IDC_CAPTURELAYERED 1099
|
||||
#define IDC_USEOUTLINE 1099
|
||||
#define IDC_LOWLATENCYMODE 1099
|
||||
#define IDC_MINIZENOTIFICATION 1099
|
||||
#define IDC_TIMER1 1100
|
||||
#define IDC_CAPTURERAM 1100
|
||||
#define IDC_COMPATIBILITYMODE 1100
|
||||
|
@ -281,7 +284,7 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 141
|
||||
#define _APS_NEXT_RESOURCE_VALUE 143
|
||||
#define _APS_NEXT_COMMAND_VALUE 40051
|
||||
#define _APS_NEXT_CONTROL_VALUE 1157
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
|
|
@ -169,6 +169,8 @@ Settings.General.ConfirmDelete "Are you sure you wish to remove the profile '$1
|
|||
Settings.General.InvalidName "Profile names cannot use the following characters:\r\n\\ / : * ? \" < > |"
|
||||
Settings.General.Language "Language:"
|
||||
Settings.General.Profile "Setting Profile:"
|
||||
Settings.General.Notification "Notification Area Icon"
|
||||
Settings.General.NotificationMinimize "Minimize to Notification Area"
|
||||
Settings.General.Restart "Changing the language will require restarting OBS.\r\n\r\n..Though I suppose if you're changing the language you can't understand this"
|
||||
|
||||
Settings.Publish.AutoReconnect "Auto-Reconnect:"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Loading…
Reference in New Issue