Merge pull request #144 from foxx1337/trayicon
Added Notification Area Icon and minimize to Notification Area
This commit is contained in:
commit
11d93fa48b
5
OBS.rc
5
OBS.rc
@ -162,6 +162,10 @@ BEGIN
|
|||||||
PUSHBUTTON "Rename",IDC_RENAME,224,58,76,14
|
PUSHBUTTON "Rename",IDC_RENAME,224,58,76,14
|
||||||
PUSHBUTTON "Remove",IDC_REMOVE,301,58,75,14
|
PUSHBUTTON "Remove",IDC_REMOVE,301,58,75,14
|
||||||
LTEXT "Settings.General.Restart",IDC_INFO,7,145,409,48,NOT WS_VISIBLE
|
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
|
END
|
||||||
|
|
||||||
IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336
|
IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336
|
||||||
@ -648,6 +652,7 @@ IDI_SOUND_MIC ICON "ui\\mic2.ico"
|
|||||||
IDI_SOUND_MIC_MUTED ICON "ui\\mic2-muted.ico"
|
IDI_SOUND_MIC_MUTED ICON "ui\\mic2-muted.ico"
|
||||||
IDI_SOUND_DESKTOP ICON "ui\\speaker.ico"
|
IDI_SOUND_DESKTOP ICON "ui\\speaker.ico"
|
||||||
IDI_SOUND_DESKTOP_MUTED ICON "ui\\speaker-muted.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\mic2.ico" />
|
||||||
<None Include="ui\speaker-muted.ico" />
|
<None Include="ui\speaker-muted.ico" />
|
||||||
<None Include="ui\speaker.ico" />
|
<None Include="ui\speaker.ico" />
|
||||||
|
<None Include="ui\test2\recording.ico" />
|
||||||
<None Include="ui\test2\test.ico" />
|
<None Include="ui\test2\test.ico" />
|
||||||
<None Include="ui\test2\test48.ico" />
|
<None Include="ui\test2\test48.ico" />
|
||||||
<None Include="rundir\shaders\DownscaleYUV1.5.pShader" />
|
<None Include="rundir\shaders\DownscaleYUV1.5.pShader" />
|
||||||
|
@ -230,6 +230,9 @@
|
|||||||
<None Include="rundir\shaders\DrawTexture.vShader">
|
<None Include="rundir\shaders\DrawTexture.vShader">
|
||||||
<Filter>Shaders</Filter>
|
<Filter>Shaders</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="ui\test2\recording.ico">
|
||||||
|
<Filter>Resources</Filter>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Headers">
|
<Filter Include="Headers">
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#define ISOLATION_AWARE_ENABLED 1
|
#define ISOLATION_AWARE_ENABLED 1
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <shellapi.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -446,6 +446,16 @@ OBS::OBS()
|
|||||||
0, 0, 0, 0, hwndMain, (HMENU)ID_SOURCES_TEXT, 0, 0);
|
0, 0, 0, 0, hwndMain, (HMENU)ID_SOURCES_TEXT, 0, 0);
|
||||||
SendMessage(hwndTemp, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
|
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
|
// populate scenes
|
||||||
|
|
||||||
@ -661,6 +671,11 @@ OBS::~OBS()
|
|||||||
pluginInfo.strFile.Clear();
|
pluginInfo.strFile.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0)
|
||||||
|
{
|
||||||
|
App->HideNotificationAreaIcon();
|
||||||
|
}
|
||||||
|
|
||||||
//DestroyWindow(hwndMain);
|
//DestroyWindow(hwndMain);
|
||||||
|
|
||||||
// Remember window state for next launch
|
// 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_SETSOURCEORDER,
|
||||||
OBS_SETSOURCERENDER,
|
OBS_SETSOURCERENDER,
|
||||||
OBS_UPDATESTATUSBAR,
|
OBS_UPDATESTATUSBAR,
|
||||||
|
OBS_NOTIFICATIONAREA,
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------
|
//----------------------------
|
||||||
@ -656,6 +657,12 @@ private:
|
|||||||
bool QueryNewAudio(QWORD ×tamp);
|
bool QueryNewAudio(QWORD ×tamp);
|
||||||
void MainAudioLoop();
|
void MainAudioLoop();
|
||||||
|
|
||||||
|
//---------------------------------------------------
|
||||||
|
// notification area icon
|
||||||
|
UINT wmExplorerRestarted;
|
||||||
|
bool bNotificationAreaIcon;
|
||||||
|
BOOL SetNotificationAreaIcon(DWORD dwMessage, int idIcon, const String &tooltip);
|
||||||
|
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
// random bla-haa
|
// random bla-haa
|
||||||
|
|
||||||
@ -930,6 +937,10 @@ public:
|
|||||||
virtual void ReportMicVolumeChange(float level, bool muted, bool finalValue);
|
virtual void ReportMicVolumeChange(float level, bool muted, bool finalValue);
|
||||||
virtual void ReportDesktopVolumeChange(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);
|
LONG CALLBACK OBSExceptionHandler (PEXCEPTION_POINTERS exceptionInfo);
|
||||||
|
@ -312,6 +312,7 @@ void OBS::Start()
|
|||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
bRunning = true;
|
bRunning = true;
|
||||||
|
UpdateNotificationAreaIcon();
|
||||||
|
|
||||||
if(sceneElement)
|
if(sceneElement)
|
||||||
{
|
{
|
||||||
@ -484,6 +485,7 @@ void OBS::Stop()
|
|||||||
ReportStopStreamTrigger();
|
ReportStopStreamTrigger();
|
||||||
|
|
||||||
bRunning = false;
|
bRunning = false;
|
||||||
|
UpdateNotificationAreaIcon();
|
||||||
if(hMainThread)
|
if(hMainThread)
|
||||||
{
|
{
|
||||||
OSTerminateThread(hMainThread, 20000);
|
OSTerminateThread(hMainThread, 20000);
|
||||||
|
@ -79,6 +79,17 @@ void SettingsGeneral::DestroyPane()
|
|||||||
|
|
||||||
void SettingsGeneral::ApplySettings()
|
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()
|
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);
|
SetChangedSettings(false);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -322,6 +341,22 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
break;
|
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)
|
if(!App->bDragResize)
|
||||||
App->bSizeChanging = false;
|
App->bSizeChanging = false;
|
||||||
}
|
}
|
||||||
|
else if (wParam == SIZE_MINIMIZED && AppConfig->GetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), 0) != 0)
|
||||||
|
{
|
||||||
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2537,11 +2541,44 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
App->SetStatusBarData();
|
App->SetStatusBarData();
|
||||||
break;
|
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:
|
case WM_CLOSE:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (message == App->wmExplorerRestarted)
|
||||||
|
{
|
||||||
|
App->UpdateNotificationAreaIcon();
|
||||||
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define IDD_BUILDINGMP4 137
|
#define IDD_BUILDINGMP4 137
|
||||||
#define IDD_CONFIGURETEXTSOURCE 139
|
#define IDD_CONFIGURETEXTSOURCE 139
|
||||||
#define IDD_ENDINGDELAY 140
|
#define IDD_ENDINGDELAY 140
|
||||||
|
#define IDI_ICON2 142
|
||||||
#define IDC_SETTINGSLIST 1006
|
#define IDC_SETTINGSLIST 1006
|
||||||
#define IDC_SUBDIALOG 1007
|
#define IDC_SUBDIALOG 1007
|
||||||
#define IDC_MODE 1008
|
#define IDC_MODE 1008
|
||||||
@ -84,6 +85,7 @@
|
|||||||
#define IDC_OPACITY 1041
|
#define IDC_OPACITY 1041
|
||||||
#define IDC_USETEXTEXTENTS 1041
|
#define IDC_USETEXTEXTENTS 1041
|
||||||
#define IDC_CUSTOMBUFFER 1041
|
#define IDC_CUSTOMBUFFER 1041
|
||||||
|
#define IDC_NOTIFICATIONICON 1041
|
||||||
#define IDC_SERVEREDIT 1042
|
#define IDC_SERVEREDIT 1042
|
||||||
#define IDC_USESENDBUFFER 1042
|
#define IDC_USESENDBUFFER 1042
|
||||||
#define IDC_FORCEMONO 1042
|
#define IDC_FORCEMONO 1042
|
||||||
@ -194,6 +196,7 @@
|
|||||||
#define IDC_CAPTURELAYERED 1099
|
#define IDC_CAPTURELAYERED 1099
|
||||||
#define IDC_USEOUTLINE 1099
|
#define IDC_USEOUTLINE 1099
|
||||||
#define IDC_LOWLATENCYMODE 1099
|
#define IDC_LOWLATENCYMODE 1099
|
||||||
|
#define IDC_MINIZENOTIFICATION 1099
|
||||||
#define IDC_TIMER1 1100
|
#define IDC_TIMER1 1100
|
||||||
#define IDC_CAPTURERAM 1100
|
#define IDC_CAPTURERAM 1100
|
||||||
#define IDC_COMPATIBILITYMODE 1100
|
#define IDC_COMPATIBILITYMODE 1100
|
||||||
@ -283,7 +286,7 @@
|
|||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#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_COMMAND_VALUE 40051
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1157
|
#define _APS_NEXT_CONTROL_VALUE 1157
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#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.InvalidName "Profile names cannot use the following characters:\r\n\\ / : * ? \" < > |"
|
||||||
Settings.General.Language "Language:"
|
Settings.General.Language "Language:"
|
||||||
Settings.General.Profile "Setting Profile:"
|
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.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:"
|
Settings.Publish.AutoReconnect "Auto-Reconnect:"
|
||||||
|
BIN
ui/test2/recording.ico
Normal file
BIN
ui/test2/recording.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Loading…
x
Reference in New Issue
Block a user