This commit is contained in:
DavidXanatos 2022-06-29 08:40:58 +02:00
parent e372da76ad
commit c9fbb20918
3 changed files with 15 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2020, David Xanatos
* Copyright (c) 2020-2022, David Xanatos
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -53,6 +53,8 @@ const WCHAR *Sandboxie_WindowClassName = L"Sandboxie_BorderWindow";
CBoxBorder::CBoxBorder(CSbieAPI* pApi, QObject* parent) : QThread(parent)
{
m = NULL;
m_Api = pApi;
m_Running = true;
@ -186,6 +188,7 @@ void CBoxBorder::run()
m->ActiveWnd = NULL;
m->ActivePid = 0;
hide:
if (m->IsBorderVisible)
{
::ShowWindow(m->BorderWnd, SW_HIDE);
@ -199,35 +202,31 @@ void CBoxBorder::run()
if (NothingChanged(hWnd, &rect, pid))
continue;
if (m->IsBorderVisible)
::ShowWindow(m->BorderWnd, SW_HIDE);
m->IsBorderVisible = FALSE;
m->ActiveWnd = hWnd;
m->ActivePid = pid;
memcpy(&m->ActiveRect, &rect, sizeof(RECT));
m->TitleState = 0;
if (rect.right - rect.left <= 2 || rect.bottom - rect.top <= 2)
continue;
goto hide;
HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL);
if (!hMonitor)
continue;
goto hide;
MONITORINFO Monitor;
memset(&Monitor, 0, sizeof(MONITORINFO));
Monitor.cbSize = sizeof(MONITORINFO);
if (!GetMonitorInfo(hMonitor, &Monitor))
continue;
goto hide;
const RECT *Desktop = &Monitor.rcMonitor;
if (rect.left <= Desktop->left && rect.top <= Desktop->top &&
if (rect.left <= Desktop->left && rect.top <= Desktop->top &&
rect.right >= Desktop->right && rect.bottom >= Desktop->bottom &&
(Style & WS_CAPTION) != WS_CAPTION)
continue;
goto hide;
if (m->BorderMode == 2) {
if(!IsMounseOnTitle(hWnd, &rect, Desktop))
continue;
goto hide;
}
@ -261,7 +260,6 @@ void CBoxBorder::run()
if (rect.bottom == Monitor.rcWork.bottom)
ah -= 1;
POINT Points[10];
int PointCount = 0;
@ -282,8 +280,9 @@ void CBoxBorder::run()
HRGN hrgn = CreatePolygonRgn(Points, PointCount, ALTERNATE);
SetWindowRgn(m->BorderWnd, hrgn, TRUE);
SetWindowPos(m->BorderWnd, NULL, ax, ay, aw, ah, SWP_SHOWWINDOW | SWP_NOACTIVATE);
DeleteObject(hrgn);
SetWindowPos(m->BorderWnd, NULL, ax, ay, aw, ah, SWP_SHOWWINDOW | SWP_NOACTIVATE);
m->IsBorderVisible = TRUE;
}
}
@ -296,6 +295,7 @@ void CBoxBorder::run()
}
delete m;
m = NULL;
}

View File

@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2020, David Xanatos
* Copyright (c) 2020-2022, David Xanatos
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@ -741,7 +741,7 @@ void CSettingsWindow::OnTab()
QSharedPointer<CSbieIni> pTemplate = QSharedPointer<CSbieIni>(new CSbieIni("Template_" + I.key(), theAPI));
QString Title = pTemplate->GetText("Tmpl.Title");
QString Title = pTemplate->GetText("Tmpl.Title", "", false, true, true);
if (Title.left(1) == "#")
{
int End = Title.mid(1).indexOf(",");