Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove full screen occlusion and stop recording function #322

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ project(deepin-camera VERSION 1.0.0)

add_subdirectory(src)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_subdirectory(tests)
endif()
#if (CMAKE_BUILD_TYPE STREQUAL "Debug")
# add_subdirectory(tests)
#endif()


5 changes: 1 addition & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Build-Depends:
libv4l-dev,libsdl2-dev,portaudio19-dev,libpng-dev,libasound2-dev,libpciaccess-dev,
libusb-1.0-0-dev,zlib1g-dev,libudev-dev,libswscale-dev,libswresample-dev,libffmpegthumbnailer-dev,
libx11-dev,libva-dev,libimageeditor-dev,
libdwayland-dev | libkf5wayland-dev,
libwayland-dev,
libgstreamer1.0-dev,libgstreamer-plugins-base1.0-dev,gstreamer1.0-plugins-good
Standards-Version: 4.1.2
Homepage: http://www.deepin.org
Expand All @@ -24,8 +22,7 @@ Depends:
libavcodec58 (>= 7:4.0) | libavcodec60, libavformat58 (>= 7:4.1) | libavformat60, libavutil56 (>= 7:4.0) | libavutil58, libswresample3 (>= 7:4.0) | libswresample4, libswscale5 (>= 7:4.0) | libswscale7,
libdtkcore5, libdtkgui5, libdtkwidget5, libffmpegthumbnailer4v5, libgl1, libpng16-16 (>= 1.6.2-1), libportaudio2 (>= 19+svn20101113), libqt5concurrent5 (>= 5.0.2), libqt5core5a (>= 5.11.0~rc1),
libqt5dbus5 (>= 5.0.2), libqt5gui5 (>= 5.8.0), libqt5network5 (>= 5.0.2), libqt5printsupport5 (>= 5.0.2), libqt5widgets5 (>= 5.2.0~alpha1), libqt5x11extras5 (>= 5.6.0), libasound2 (>= 1.0.16),
libqt5xml5 (>= 5.0.2), libsdl2-2.0-0 (>= 2.0.9), libstdc++6 (>= 7), libudev1 (>= 183), libusb-1.0-0 (>= 2:1.0.8), libv4l-0 (>= 0.5.0), zlib1g (>= 1:1.1.4), libgstreamer-plugins-base1.0-0 (>= 1.0.0), libgstreamer1.0-0 (>= 1.4.0), dde-api,
libdwaylandclient5 | libkf5waylandclient5, libdwaylandserver5 | libkf5waylandserver5
libqt5xml5 (>= 5.0.2), libsdl2-2.0-0 (>= 2.0.9), libstdc++6 (>= 7), libudev1 (>= 183), libusb-1.0-0 (>= 2:1.0.8), libv4l-0 (>= 0.5.0), zlib1g (>= 1:1.1.4), libgstreamer-plugins-base1.0-0 (>= 1.0.0), libgstreamer1.0-0 (>= 1.4.0), dde-api
Recommends: libimageeditor, uos-reporter, deepin-event-log
Description:this package software for UOS
deepin-camera is a tool to view camera, and also a smart take photo and video in life.
34 changes: 2 additions & 32 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
project(deepin-camera VERSION 1.0.0)
set(CMD_NAME deepin-camera)
set(TARGET_NAME deepin-camera)
find_package(DWayland)
find_package(KF5Wayland)
if (NOT DWayland_FOUND)
if (${KF5Wayland_VERSION} VERSION_GREATER 5.54.1)
option(USE_DEEPIN_WAYLAND "option for wayland support" ON)
endif()
else()
option(USE_DEEPIN_WAYLAND "option for wayland support" ON)
endif()

#option (__mips__ "Use UNITTEST" ON)

# cube文件目录,libvisualresult在打包时,会自动将cube文件安装到share目录下
Expand All @@ -45,12 +37,6 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr)
endif ()

if (USE_DEEPIN_WAYLAND)
if(!USE_DEEPIN_V25)
add_definitions("-DUSE_DEEPIN_WAYLAND")
endif()
endif()

if(DEFINED LINGLONG_BUILD_ON)
# 玲珑构建编译开关
add_definitions(-DLINGLONG_BUILD)
Expand Down Expand Up @@ -100,15 +86,7 @@ find_package(Qt5 REQUIRED ${QtModule})
find_package(PkgConfig REQUIRED)

include(FindPkgConfig)
if (USE_DEEPIN_WAYLAND)
if (DWayland_FOUND)
message("DWayland founded.")
add_definitions(-DDWAYLAND)
elseif(KF5Wayland_FOUND)
message("KF5Wayland founded.")
add_definitions(-DKF5WAYLAND)
endif()
endif()


file (GLOB_RECURSE CXXSOURCES
./src/*.cpp
Expand Down Expand Up @@ -171,14 +149,6 @@ endif ()
# 设置不删除生成的文件夹内容文件
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)

if (USE_DEEPIN_WAYLAND)
if (DWayland_FOUND)
set(LIBS DWaylandClient DWaylandServer)
else()
message("KF5 environment")
set(LIBS KF5::WaylandClient KF5::WaylandServer)
endif()
endif()

add_executable( ${TARGET_NAME} ${CXXSOURCES} ${CSOURCES} ${RESOURCES} ${QM} )

Expand Down
94 changes: 3 additions & 91 deletions src/src/windowstatethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,11 @@ windowStateThread::windowStateThread(bool isWayland, QObject *parent /*= nullptr
: QThread (parent)
{
setObjectName("windowStateThread");
#ifdef USE_DEEPIN_WAYLAND
if (isWayland) {
qInfo() << __FUNCTION__ << __LINE__ << "KF5_WAYLAND_FLAGE_ON is open!!";
//wayland自动识别窗口
m_connectionThread = new QThread(this);
m_connectionThreadObject = new ConnectionThread();
connect(m_connectionThreadObject, &ConnectionThread::connected, this,
[this] {
m_eventQueue = new EventQueue(this);
m_eventQueue->setup(m_connectionThreadObject);

Registry *registry = new Registry(this);
setupRegistry(registry);
},
Qt::QueuedConnection
);
m_connectionThreadObject->moveToThread(m_connectionThread);
m_connectionThread->start();
m_connectionThreadObject->initConnection();
}
#endif
}

windowStateThread::~windowStateThread()
{
#ifdef USE_DEEPIN_WAYLAND
if (m_connectionThread != nullptr) {
m_connectionThread->terminate();
m_connectionThread->wait();
}
#endif

}

void windowStateThread::run()
Expand All @@ -55,7 +29,8 @@ void windowStateThread::run()

foreach(DForeignWindow *window, list) {
if (window && window->windowState() == Qt::WindowState::WindowFullScreen) {
emit someWindowFullScreen();
//去掉全屏的窗口信号处理
//emit someWindowFullScreen();
}
}
//线程休眠1秒
Expand Down Expand Up @@ -101,67 +76,4 @@ QList<DForeignWindow *> windowStateThread::workspaceWindows() const
return windowList;
}

#ifdef USE_DEEPIN_WAYLAND
void windowStateThread::setupRegistry(Registry *registry)
{
connect(registry, &Registry::compositorAnnounced, this,
[this, registry](quint32 name, quint32 version) {
m_compositor = registry->createCompositor(name, version, this);
}
);

connect(registry, &Registry::clientManagementAnnounced, this,
[this, registry](quint32 name, quint32 version) {
m_clientManagement = registry->createClientManagement(name, version, this);
connect(m_clientManagement, &ClientManagement::windowStatesChanged, this,
[this] {
m_windowStates = m_clientManagement->getWindowStates();
this->waylandwindowinfo(m_windowStates);
}
);
}
);

connect(registry, &Registry::interfacesAnnounced, this,
[this] {
Q_ASSERT(m_compositor);
Q_ASSERT(m_clientManagement);
m_windowStates = m_clientManagement->getWindowStates();
this->waylandwindowinfo(m_windowStates);
}
);

registry->setEventQueue(m_eventQueue);
registry->create(m_connectionThreadObject);
registry->setup();
}

void windowStateThread::waylandwindowinfo(const QVector<ClientManagement::WindowState> &windowStates)
{
if (windowStates.count() == 0) {
return;
}

bool aheandInCamera = false;
QRect rect;
for (int i = 0; i < windowStates.count(); ++i) {
if (QString(windowStates[i].resourceName) != "deepin-camera") {
if (!aheandInCamera)
continue;
else {
if (windowStates[i].isFullScreen) {
QRect fullscreenRect(windowStates[i].geometry.x, windowStates[i].geometry.y,
windowStates[i].geometry.width, windowStates[i].geometry.height);
if (fullscreenRect.contains(rect))
emit someWindowFullScreen();
}
}
} else {
aheandInCamera = true;
rect = QRect(windowStates[i].geometry.x, windowStates[i].geometry.y,
windowStates[i].geometry.width, windowStates[i].geometry.height);
}
}
}
#endif

46 changes: 0 additions & 46 deletions src/src/windowstatethread.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@
#include <QThread>
#include <QMutex>

#ifdef USE_DEEPIN_WAYLAND
#ifdef DWAYLAND
#include <DWayland/Client/clientmanagement.h>
#include <DWayland/Client/registry.h>
#include <DWayland/Client/connection_thread.h>
#include <DWayland/Client/event_queue.h>
#else
#include <KF5/KWayland/Client/connection_thread.h>
#include <KF5/KWayland/Client/clientmanagement.h>
#include <KF5/KWayland/Client/event_queue.h>
#include <KF5/KWayland/Client/registry.h>
#endif

using namespace KWayland::Client;
#endif // USE_DEEPIN_WAYLAND

DGUI_USE_NAMESPACE

Expand All @@ -44,37 +29,6 @@ class windowStateThread : public QThread
signals:
void someWindowFullScreen();

private:
#ifdef USE_DEEPIN_WAYLAND
/**
* @brief wayland获取屏幕窗口信息的安装注册函数
* @param registry
*/
void setupRegistry(Registry *registry);

/**
* @brief wayland获取屏幕窗口信息
* @param m_windowStates
*/
void waylandwindowinfo(const QVector<ClientManagement::WindowState> &m_windowStates);
#endif

private:
#ifdef USE_DEEPIN_WAYLAND
// 获取wayland窗口信息相关。 wayland获取窗口的方法对于x11有很大的区别
QThread *m_connectionThread = nullptr;
EventQueue *m_eventQueue = nullptr;
ConnectionThread *m_connectionThreadObject;
Compositor *m_compositor = nullptr;
PlasmaWindowManagement *m_windowManagement = nullptr;
ClientManagement *m_clientManagement = nullptr;
QVector<ClientManagement::WindowState> m_windowStates;
/**
* @brief mips平台创建缓存文件的路径
*/
std::string m_tempPath;
#endif

};

#endif // WINDOWSTATETHREAD_H
Loading