SYNERGY-1061 - Add libnotify on Linux and create notifications (#7055)
* SYNERGY-1061 - Add libnotify on Linux and create notifications * SYNERGY-1061 - Update changelog * SYNERGY-1061 - Don't use libnotify for mac builds * SYNERGY-1061 - Use nullptr instead of 0 * SYNERGY-1061 - Fix CodeQL libs * SYNERGY-1061 - Remove Ubuntu 19.10 from CI * SYNERGY-1061 - Destroy notification object when done Co-authored-by: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com>
This commit is contained in:
parent
e317569057
commit
c87bedf938
6 changed files with 41 additions and 7 deletions
3
.github/workflows/codeql-analysis.yml
vendored
3
.github/workflows/codeql-analysis.yml
vendored
|
|
@ -61,6 +61,9 @@ jobs:
|
||||||
devscripts \
|
devscripts \
|
||||||
qttools5-dev \
|
qttools5-dev \
|
||||||
qttools5-dev-tools \
|
qttools5-dev-tools \
|
||||||
|
libnotify-dev \
|
||||||
|
libglib2.0-dev \
|
||||||
|
libgdk-pixbuf2.0-dev \
|
||||||
&& rm -rf /var/lib/apt/lists'
|
&& rm -rf /var/lib/apt/lists'
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
|
|
||||||
1
.github/workflows/job-test-linux-ubuntu.yml
vendored
1
.github/workflows/job-test-linux-ubuntu.yml
vendored
|
|
@ -16,7 +16,6 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- distro: ubuntu20.04
|
- distro: ubuntu20.04
|
||||||
- distro: ubuntu19.10
|
|
||||||
- distro: ubuntu21.04
|
- distro: ubuntu21.04
|
||||||
# - distro: ubuntu18.04 #Need to install git 2.18+
|
# - distro: ubuntu18.04 #Need to install git 2.18+
|
||||||
# - distro: ubuntu16.04 #Need to install git 2.18+
|
# - distro: ubuntu16.04 #Need to install git 2.18+
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ Bug fixes:
|
||||||
- #7036 Fix tray icon not changing theme on Big Sur
|
- #7036 Fix tray icon not changing theme on Big Sur
|
||||||
- #7046 Fix MacOS 10.13 build
|
- #7046 Fix MacOS 10.13 build
|
||||||
- #7049 Scroll doesn't work in case of macOS is server
|
- #7049 Scroll doesn't work in case of macOS is server
|
||||||
|
- #7055 Add secure input notification on Linux
|
||||||
- #7052 Add secure input notification on Windows
|
- #7052 Add secure input notification on Windows
|
||||||
- #7047 Fix prevent sleep option on Mac and Windows
|
- #7047 Fix prevent sleep option on Mac and Windows
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,6 @@ jobs:
|
||||||
image: symless/synergy-core:ubuntu18.04
|
image: symless/synergy-core:ubuntu18.04
|
||||||
packager: deb
|
packager: deb
|
||||||
name: ubuntu18
|
name: ubuntu18
|
||||||
ubuntu1910:
|
|
||||||
image: symless/synergy-core:ubuntu19.10
|
|
||||||
packager: deb
|
|
||||||
name: ubuntu19
|
|
||||||
ubuntu2004:
|
ubuntu2004:
|
||||||
image: symless/synergy-core:ubuntu20.04
|
image: symless/synergy-core:ubuntu20.04
|
||||||
packager: deb
|
packager: deb
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,14 @@ add_library(synlib STATIC ${sources})
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
target_link_libraries(synlib arch client ipc net base platform mt server)
|
target_link_libraries(synlib arch client ipc net base platform mt server)
|
||||||
|
if (NOT APPLE)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(lib_glib REQUIRED IMPORTED_TARGET glib-2.0)
|
||||||
|
pkg_search_module( PC_GDKPIXBUF gdk-pixbuf-2.0 )
|
||||||
|
include_directories(${PC_GDKPIXBUF_INCLUDE_DIRS})
|
||||||
|
pkg_check_modules(lib_gdkpixbuf REQUIRED IMPORTED_TARGET gdk-pixbuf-2.0 )
|
||||||
|
pkg_check_modules(lib_notify REQUIRED IMPORTED_TARGET libnotify)
|
||||||
|
target_link_libraries(synlib PkgConfig::lib_glib PkgConfig::lib_gdkpixbuf PkgConfig::lib_notify)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/log_outputters.h"
|
#include "base/log_outputters.h"
|
||||||
|
|
||||||
|
#if WINAPI_XWINDOWS
|
||||||
|
#include <libnotify/notify.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
AppUtilUnix::AppUtilUnix(IEventQueue* events)
|
AppUtilUnix::AppUtilUnix(IEventQueue* events)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +56,27 @@ AppUtilUnix::showNotification(const String & title, const String & text) const
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG "Showing notification. Title: \"%s\". Text: \"%s\"", title.c_str(), text.c_str()));
|
LOG((CLOG_DEBUG "Showing notification. Title: \"%s\". Text: \"%s\"", title.c_str(), text.c_str()));
|
||||||
#if WINAPI_XWINDOWS
|
#if WINAPI_XWINDOWS
|
||||||
|
if (!notify_init("Synergy"))
|
||||||
|
{
|
||||||
|
LOG((CLOG_INFO "Failed to initialize libnotify"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto notification = notify_notification_new (title.c_str(), text.c_str(), nullptr);
|
||||||
|
if (notification == nullptr)
|
||||||
|
{
|
||||||
|
LOG((CLOG_INFO "Failed to create notification"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notify_notification_set_timeout(notification, 10000);
|
||||||
|
|
||||||
|
if (!notify_notification_show(notification, nullptr))
|
||||||
|
{
|
||||||
|
LOG((CLOG_INFO "Failed to show notification"));
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref(G_OBJECT(notification));
|
||||||
|
notify_uninit();
|
||||||
|
|
||||||
#elif WINAPI_CARBON
|
#elif WINAPI_CARBON
|
||||||
// synergys and synergyc are not allowed to send native notifications on MacOS
|
// synergys and synergyc are not allowed to send native notifications on MacOS
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue