mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 22:55:53 +08:00
Compare commits
5 Commits
v2.0.0-RC1
...
v2.0.0-RC2
| Author | SHA1 | Date | |
|---|---|---|---|
| 3edbc00397 | |||
| e396f8d55e | |||
| 5362dbc297 | |||
| 5b31036cdc | |||
| 625253a7e8 |
@@ -157,9 +157,14 @@ if (UNIX)
|
||||
)
|
||||
|
||||
else() # not-apple
|
||||
|
||||
# add include dir for bsd (posix uses /usr/include/)
|
||||
set (CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
|
||||
# FreeBSD uses /usr/local for anything not part of base
|
||||
# Also package avahi-libdns puts dns_sd.h a bit deeper
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/local/include;/usr/local/include/avahi-compat-libdns_sd")
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L/usr/local/lib")
|
||||
include_directories("/usr/local/include" "/usr/local/include/avahi-compat-libdns_sd")
|
||||
link_directories("/usr/local/lib")
|
||||
endif()
|
||||
|
||||
set (XKBlib "X11/Xlib.h;X11/XKBlib.h")
|
||||
set (CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h")
|
||||
@@ -174,6 +179,7 @@ if (UNIX)
|
||||
check_include_files ("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H)
|
||||
check_include_files ("${XKBlib}" HAVE_X11_XKBLIB_H)
|
||||
check_include_files ("X11/extensions/XInput2.h" HAVE_XI2)
|
||||
check_include_files ("dns_sd.h" HAVE_DNSSD)
|
||||
|
||||
if (HAVE_X11_EXTENSIONS_DPMS_H)
|
||||
# Assume that function prototypes declared, when include exists.
|
||||
@@ -184,6 +190,10 @@ if (UNIX)
|
||||
message (FATAL_ERROR "Missing header: " ${XKBlib})
|
||||
endif()
|
||||
|
||||
if (NOT HAVE_DNSSD)
|
||||
message (FATAL_ERROR "Missing header: dns_sd.h")
|
||||
endif()
|
||||
|
||||
check_library_exists ("SM;ICE" IceConnectionNumber "" HAVE_ICE)
|
||||
check_library_exists ("Xext;X11" DPMSQueryExtension "" HAVE_Xext)
|
||||
check_library_exists ("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst)
|
||||
@@ -202,7 +212,7 @@ if (UNIX)
|
||||
if (HAVE_Xtst)
|
||||
|
||||
# Xtxt depends on X11.
|
||||
set (HAVE_X11)
|
||||
set (HAVE_X11 1)
|
||||
list (APPEND libs Xtst X11)
|
||||
|
||||
else()
|
||||
@@ -305,7 +315,14 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set (OPENSSL_LIBS ssl crypto)
|
||||
else()
|
||||
message (FATAL_ERROR "Couldn't find OpenSSL")
|
||||
find_library (lib_ssl ssl)
|
||||
find_library (lib_crypto crypto)
|
||||
if (NOT lib_ssl)
|
||||
message(FATAL_ERROR "openssl library not found")
|
||||
elseif (NOT lib_crypto)
|
||||
message(FATAL_ERROR "crypto library not found")
|
||||
endif()
|
||||
set (OPENSSL_LIBS ${lib_ssl} ${lib_crypto})
|
||||
endif()
|
||||
|
||||
#
|
||||
|
||||
@@ -13,11 +13,11 @@ B_BUILD_TYPE=${B_BUILD_TYPE:-Debug}
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
# OSX needs a lot of extra help, poor thing
|
||||
# run the osx_environment.sh script to fix paths
|
||||
source ./osx_environment.sh
|
||||
. ./osx_environment.sh
|
||||
B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS"
|
||||
fi
|
||||
# allow local customizations to build environment
|
||||
[ -r ./build_env.sh ] && source ./build_env.sh
|
||||
[ -r ./build_env.sh ] && . ./build_env.sh
|
||||
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS"
|
||||
rm -rf build
|
||||
mkdir build || exit 1
|
||||
|
||||
@@ -36,10 +36,13 @@ if (WIN32)
|
||||
elseif (APPLE)
|
||||
find_library(APPSERVICES_LIB ApplicationServices)
|
||||
target_link_libraries(barrier ${APPSERVICES_LIB})
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR
|
||||
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
target_link_libraries (barrier dns_sd)
|
||||
else()
|
||||
target_link_libraries (barrier)
|
||||
endif()
|
||||
|
||||
if (HAVE_X11)
|
||||
target_link_libraries (barrier X11)
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
14
src/gui/src/DisplayIsValid.cpp
Normal file
14
src/gui/src/DisplayIsValid.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifdef WINAPI_XWINDOWS
|
||||
|
||||
#include "DisplayIsValid.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
bool display_is_valid()
|
||||
{
|
||||
auto dsp = XOpenDisplay(NULL);
|
||||
if (dsp != NULL)
|
||||
XCloseDisplay(dsp);
|
||||
return dsp != NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
5
src/gui/src/DisplayIsValid.h
Normal file
5
src/gui/src/DisplayIsValid.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef WINAPI_XWINDOWS
|
||||
bool display_is_valid();
|
||||
#endif
|
||||
@@ -288,6 +288,8 @@ void MainWindow::setIcon(qBarrierState state)
|
||||
QIcon icon;
|
||||
icon.addFile(barrierIconFiles[state]);
|
||||
|
||||
setWindowIcon(icon);
|
||||
|
||||
if (m_pTrayIcon)
|
||||
m_pTrayIcon->setIcon(icon);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "DisplayIsValid.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@@ -54,6 +55,14 @@ bool checkMacAssistiveDevices();
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef WINAPI_XWINDOWS
|
||||
// QApplication's constructor will call a fscking abort() if
|
||||
// DISPLAY is bad. Let's check it first and handle it gracefully
|
||||
if (!display_is_valid()) {
|
||||
fprintf(stderr, "The Barrier GUI requires a display. Quitting...\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_DARWIN
|
||||
/* Workaround for QTBUG-40332 - "High ping when QNetworkAccessManager is instantiated" */
|
||||
::setenv ("QT_BEARER_POLL_TIMEOUT", "-1", 1);
|
||||
|
||||
@@ -40,5 +40,8 @@ endif()
|
||||
add_library(arch STATIC ${sources})
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(arch dl ${libs})
|
||||
target_link_libraries(arch ${libs})
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
target_link_libraries(arch dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1405,9 +1405,9 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*)
|
||||
|
||||
#if HAVE_X11_EXTENSIONS_XRANDR_H
|
||||
if (m_xrandr) {
|
||||
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify
|
||||
|| xevent->type == m_xrandrEventBase + RRNotify
|
||||
&& reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) {
|
||||
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify ||
|
||||
(xevent->type == m_xrandrEventBase + RRNotify &&
|
||||
reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange)) {
|
||||
LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received"));
|
||||
|
||||
// we're required to call back into XLib so XLib can update its internal state
|
||||
|
||||
Reference in New Issue
Block a user