Skip to content

Commit

Permalink
fix: Full screen screenshot mode on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
XMuli committed Oct 21, 2022
1 parent 1459c1e commit be6a3d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
set(PROJECT_NAME PicShot)
project(${PROJECT_NAME} VERSION 0.4.5 LANGUAGES CXX)
project(${PROJECT_NAME} VERSION 0.4.6 LANGUAGES CXX)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
file(COPY config/config.ini DESTINATION ${CMAKE_BINARY_DIR}/bin)
Expand Down
6 changes: 5 additions & 1 deletion src/screen/screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,12 @@ void ScreenShot::getScrnShots()
getScrnInfo();
XLOG_INFO("---------------@#2----------------");
getVirScrnPixmap(); // 因 QWidget 启动后 事件执行顺序,sizeHint() -> showEvent() -> paintEvent();故全屏 show() 之前先获取桌面截图

#ifdef Q_OS_MAC
showFullScreen();
#elif
show();
#endif

if (m_bSmartWin)
updateGetWindowsInfo();
Expand All @@ -1522,7 +1527,6 @@ void ScreenShot::getScrnShots()
if (!isActiveWindow()) {
XLOG_INFO("---------------@#3----------------");
activateWindow();
//setFocus();
}
}

Expand Down
18 changes: 3 additions & 15 deletions src/screen/tray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "../preference/preference.h"
#include "../widget/xkeysequenceedit.h"
#include "../pluginsinterface/iplugininterface.h"
#include "../screen/drawhelper.h"
#include <QSystemTrayIcon>
#include <QAction>
#include <QMenu>
Expand Down Expand Up @@ -165,28 +166,15 @@ void Tray::onSrnShot()
if (!hk && !act)
return;

if (act || hk->objectName() == "Active Window") { // TODO 2022.07.17: 替换为枚举
if (act || hk->objectName() == "Active Window") // TODO 2022.07.17: 替换为枚举
m_pSrnShot->getScrnShots();
}

m_pSrnShot->activateWindow();
m_pSrnShot->setFocus();

#ifdef Q_OS_MAC
// m_pSrnShot->showMaximized();
// m_pSrnShot->setWindowFlags(Qt::Window); // Fix: MACOS 下全屏截图显示的仅壁纸桌面
// m_pSrnShot->showFullScreen();
#endif
}

void Tray::onPreference(bool checked)
{
Q_UNUSED(checked);

if (!m_pPref)
m_pPref = new Preference();

m_pPref->setMinimumWidth(910);
if (!m_pPref) m_pPref = new Preference();
m_pPref->setVisible(true);
}

Expand Down

0 comments on commit be6a3d6

Please sign in to comment.