iamscottxu / obs-rtspserver

RTSP server plugin for obs-studio
https://obsproject.com/forum/resources/obs-rtspserver.1037/
GNU General Public License v2.0
441 stars 55 forks source link

OBS Studio not hiding in system tray after installing obs-rtspserver v.1.0.1 and later #6

Closed Seamas73 closed 3 years ago

Seamas73 commented 3 years ago

After I've installed obs-rtspserver v.1.0.1 I couldn't hide OBS Studio in Windows 10 system tray by clicking on system-tray OBS icon or by right click on icon and choosing "hide" item of the context menu. When I click on icon I just turn off the preview mode In OBS Studio. In v.1.1.0 I found the same bug. This bug I observed also when I used StreamFX plugin v.0.9.0. This bug was fixed by Xaymar in later releases https://github.com/obsproject/obs-studio/issues/3518 Another plugin, which breaked "hide" option in my obs-studio, is obs-ndi v.4.9.0 and below. I had to delete it to use "hide" option.

iamscottxu commented 3 years ago

Reason

//obs-studio/UI/window-basic-main.cpp
void OBSBasic::ToggleShowHide()
{
    bool showing = isVisible();
    if (showing) {
        /* check for modal dialogs */
        EnumDialogs();
        if (!modalDialogs.isEmpty() || !visMsgBoxes.isEmpty())
            return;
    }
    SetShowing(!showing);
}

The value of modalDialogs.isEmpty() remains false after the RTSP server's dialog is closed. Because this dialog is still a modal dialog after it is closed.

Solution

//obs-rtspserver/rtsp_main.cpp
obs_frontend_push_ui_translation(obs_module_get_string);
rtspProperties = new RtspProperties(mainWindow);
//rtspProperties->setModal(true); //remove
obs_frontend_pop_ui_translation();

auto menu_cb = [] {
        rtspProperties->exec(); //rtspProperties->setModal(true);
};