Files
haikuports/net-im/psi_plus/patches/psi_plus-1.2.105.patchset
Sergei Reznikov 95039741ac Psi+: add recipe for version 1.2.105
disabled for now as it can't conntect to xmpp, likely due to a bug in qca
see https://bugs.archlinux.org/task/19175
2017-11-15 21:23:38 +03:00

587 lines
16 KiB
Plaintext

From 6244ed29c821eb5f231dbf3470d90982f86f03ce Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Wed, 15 Nov 2017 13:36:45 +0300
Subject: Haiku fixes
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38821af..e84a453 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,7 +185,7 @@ elseif( NOT IS_PSIPLUS AND APP_VERSION )
endif()
# Define LINUX on Linux like as WIN32 on Windows and APPLE on Mac OS X
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT( APPLE OR HAIKU ))
set(LINUX ON)
add_definitions(
-DHAVE_X11
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5567acd..43fd934 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -467,6 +467,28 @@ if(LINUX)
endif()
endif()
+if(HAIKU)
+ if(IS_PSIPLUS)
+ set(SHARE_SUFF "data/psi-plus")
+ install(FILES ${PROJECT_SOURCE_DIR}/psi.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/data/applications RENAME psi-plus.desktop)
+ install(FILES ${PROJECT_SOURCE_DIR}/iconsets/system/default/psiplus/logo_128.png DESTINATION ${CMAKE_INSTALL_PREFIX}/data/pixmaps RENAME psi-plus.png)
+ else()
+ set(SHARE_SUFF "data/psi")
+ install(FILES ${PROJECT_SOURCE_DIR}/psi.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/data/applications)
+ install(FILES ${PROJECT_SOURCE_DIR}/iconsets/system/default/logo_128.png DESTINATION ${CMAKE_INSTALL_PREFIX}/data/pixmaps RENAME psi.png)
+ endif()
+ install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX})
+ install(FILES ${PROJECT_SOURCE_DIR}/client_icons.txt DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF})
+ install(DIRECTORY ${OTHER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF})
+ if(ENABLE_WEBKIT)
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/themes DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF})
+ endif()
+ if(LANGS_EXISTS)
+ install(FILES ${QM} DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF}/translations)
+ endif()
+endif()
+
+
if(WIN32)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${PROJECT_SOURCE_DIR}/client_icons.txt DESTINATION ${CMAKE_INSTALL_PREFIX})
diff --git a/src/applicationinfo.cpp b/src/applicationinfo.cpp
index 66624aa..0f0ce0b 100644
--- a/src/applicationinfo.cpp
+++ b/src/applicationinfo.cpp
@@ -150,7 +150,7 @@ QString ApplicationInfo::getCertificateStoreSaveDir()
QString ApplicationInfo::resourcesDir()
{
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || defined(Q_OS_HAIKU)
return qApp->applicationDirPath();
#elif defined(Q_OS_MAC)
// FIXME: Clean this up (remko)
@@ -196,7 +196,7 @@ QString ApplicationInfo::resourcesDir()
QString ApplicationInfo::libDir()
{
-#if defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_HAIKU)
return PSI_LIBDIR;
#else
return QString();
@@ -295,6 +295,10 @@ QString ApplicationInfo::homeDir(ApplicationInfo::HomedirType type)
QMessageBox::information(0, QObject::tr("Conversion Error"), QObject::tr("Configuration data for a previous version of Psi was found, but it was not possible to convert it to work with the current version. Ensure you have appropriate permission and that another copy of Psi is not running, and try again."));
exit(0);
}
+#elif defined Q_OS_HAIKU
+ QDir configDir(QDir::homePath() + "/config/settings/Qt/.config/" + sname());
+ QDir cacheDir(QDir::homePath() + "/config/cache/" + sname());
+ QDir dataDir(configDir);
#endif
configDir_ = configDir.path();
cacheDir_ = cacheDir.path();
diff --git a/src/libpsi/tools/CMakeLists.txt b/src/libpsi/tools/CMakeLists.txt
index 9f83472..a6de073 100644
--- a/src/libpsi/tools/CMakeLists.txt
+++ b/src/libpsi/tools/CMakeLists.txt
@@ -124,6 +124,23 @@ elseif(WIN32)
# spellchecker
spellchecker/hunspellchecker.cpp
)
+elseif(HAIKU)
+ list(APPEND HEADERS
+ # systemwatch
+ systemwatch/systemwatch_unix.h
+ )
+
+ list(APPEND PLAIN_SOURCES
+ #idle
+ idle/idle_x11.cpp
+
+ # systemwatch
+ systemwatch/systemwatch_unix.cpp
+
+
+ # globalshortcut
+ globalshortcut/globalshortcutmanager_haiku.cpp
+ )
else()
list(APPEND HEADERS
# systemwatch
diff --git a/src/libpsi/tools/globalshortcut/globalshortcut.pri b/src/libpsi/tools/globalshortcut/globalshortcut.pri
index 0c788ac..9a0a1a2 100644
--- a/src/libpsi/tools/globalshortcut/globalshortcut.pri
+++ b/src/libpsi/tools/globalshortcut/globalshortcut.pri
@@ -2,7 +2,7 @@ HEADERS += $$PWD/globalshortcutmanager.h $$PWD/globalshortcuttrigger.h
SOURCES += $$PWD/globalshortcutmanager.cpp
DEPENDPATH += $$PWD
-unix:!mac {
+unix:!mac!haiku {
SOURCES += $$PWD/globalshortcutmanager_x11.cpp
}
win32: {
diff --git a/src/libpsi/tools/globalshortcut/globalshortcutmanager_haiku.cpp b/src/libpsi/tools/globalshortcut/globalshortcutmanager_haiku.cpp
new file mode 100644
index 0000000..0c4985a
--- /dev/null
+++ b/src/libpsi/tools/globalshortcut/globalshortcutmanager_haiku.cpp
@@ -0,0 +1,337 @@
+/*
+ * globalshortcutmanager_haiku.cpp - Haiku implementation of global shortcuts by Vitaly (Diger)
+ * Based on X11 implementation of global shortcuts
+ * Copyright (C) 2003-2006 Justin Karneges, Maciej Niedzielski
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "globalshortcutmanager.h"
+#include "globalshortcuttrigger.h"
+
+#include <InterfaceDefs.h>
+
+#include <QWidget>
+#include <QKeyEvent>
+#include <QCoreApplication>
+#ifdef HAVE_QT5
+# include <QAbstractNativeEventFilter>
+# include <QApplication>
+#endif
+
+class HKeyTrigger
+{
+public:
+ virtual ~HKeyTrigger() {}
+ virtual void activate() = 0;
+ virtual bool isAccepted(int qkey) const = 0;
+};
+
+class HKeyTriggerManager : public QObject
+{
+public:
+ static HKeyTriggerManager* instance()
+ {
+ if(!instance_)
+ instance_ = new HKeyTriggerManager();
+ return instance_;
+ }
+
+ void addTrigger(HKeyTrigger* trigger)
+ {
+ triggers_ << trigger;
+ }
+
+ void removeTrigger(HKeyTrigger* trigger)
+ {
+ triggers_.removeAll(trigger);
+ }
+
+ struct Qt_HK_Keygroup
+ {
+ char num;
+ int sym[3];
+ };
+
+protected:
+ // reimplemented
+ bool eventFilter(QObject* o, QEvent* e)
+ {
+ if(e->type() == QEvent::KeyPress) {
+ QKeyEvent* k = static_cast<QKeyEvent*>(e);
+ int qkey = k->key();
+ if (k->modifiers() & Qt::ShiftModifier)
+ qkey |= Qt::SHIFT;
+ if (k->modifiers() & Qt::ControlModifier)
+ qkey |= Qt::CTRL;
+ if (k->modifiers() & Qt::AltModifier)
+ qkey |= Qt::ALT;
+ if (k->modifiers() & Qt::MetaModifier)
+ qkey |= Qt::META;
+
+ foreach(HKeyTrigger* trigger, triggers_) {
+ if (trigger->isAccepted(qkey)) {
+ trigger->activate();
+ return true;
+ }
+ }
+ }
+
+ return QObject::eventFilter(o, e);
+ }
+
+private:
+ HKeyTriggerManager()
+ : QObject(QCoreApplication::instance())
+ {
+ QCoreApplication::instance()->installEventFilter(this);
+ }
+
+ static HKeyTriggerManager* instance_;
+ QList<HKeyTrigger*> triggers_;
+
+private:
+ struct Qt_HK_Keymap
+ {
+ int key;
+ Qt_HK_Keygroup hk;
+ };
+
+ static Qt_HK_Keymap qt_hk_table[];
+ static long alt_mask;
+ static long meta_mask;
+ static long super_mask;
+ static long hyper_mask;
+ static long numlock_mask;
+ static bool haveMods;
+
+ // adapted from qapplication_x11.cpp
+ static void ensureModifiers()
+ {
+ if (haveMods)
+ return;
+ }
+
+public:
+ static bool convertKeySequence(const QKeySequence& ks, unsigned int* _mod, Qt_HK_Keygroup* _kg)
+ {
+ int code = ks[0];
+ ensureModifiers();
+
+ unsigned int mod = 0;
+ /*
+ if (code & Qt::META)
+ mod |= meta_mask;
+ if (code & Qt::SHIFT)
+ mod |= ShiftMask;
+ if (code & Qt::CTRL)
+ mod |= ControlMask;
+ if (code & Qt::ALT)
+ mod |= alt_mask;
+ */
+ Qt_HK_Keygroup kg;
+ kg.num = 0;
+ kg.sym[0] = 0;
+ code &= ~Qt::KeyboardModifierMask;
+
+ bool found = false;
+ for (int n = 0; qt_hk_table[n].key != Qt::Key_unknown; ++n) {
+ if (qt_hk_table[n].key == code) {
+ kg = qt_hk_table[n].hk;
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ // try latin1
+ if (code >= 0x20 && code <= 0x7f) {
+ kg.num = 1;
+ kg.sym[0] = code;
+ }
+ }
+
+ if (!kg.num)
+ return false;
+
+ if (_mod)
+ *_mod = mod;
+ if (_kg)
+ *_kg = kg;
+
+ return true;
+ }
+
+ static QList<long> ignModifiersList()
+ {
+ QList<long> ret;
+ /*
+ if (numlock_mask) {
+ ret << 0 << LockMask << numlock_mask << (LockMask | numlock_mask);
+ }
+ else {
+ ret << 0 << LockMask;
+ }
+ */
+ return ret;
+ }
+};
+
+
+HKeyTriggerManager* HKeyTriggerManager::instance_ = NULL;
+class GlobalShortcutManager::KeyTrigger::Impl : public HKeyTrigger
+{
+private:
+ KeyTrigger* trigger_;
+ int qkey_;
+
+ struct GrabbedKey {
+ int code;
+ uint mod;
+ };
+ QList<GrabbedKey> grabbedKeys_;
+
+ static bool failed;
+
+public:
+ /**
+ * Constructor registers the hotkey.
+ */
+ Impl(GlobalShortcutManager::KeyTrigger* t, const QKeySequence& ks)
+ : trigger_(t)
+ , qkey_(ks[0])
+ {
+ HKeyTriggerManager::instance()->addTrigger(this);
+
+ HKeyTriggerManager::Qt_HK_Keygroup kg;
+ unsigned int mod;
+ }
+
+ /**
+ * Destructor unregisters the hotkey.
+ */
+ ~Impl()
+ {
+ HKeyTriggerManager::instance()->removeTrigger(this);
+
+ }
+
+ void activate()
+ {
+ emit trigger_->triggered();
+ }
+
+ bool isAccepted(int qkey) const
+ {
+ return qkey_ == qkey;
+ }
+};
+
+bool GlobalShortcutManager::KeyTrigger::Impl::failed;
+long HKeyTriggerManager::alt_mask = 0;
+long HKeyTriggerManager::meta_mask = 0;
+long HKeyTriggerManager::super_mask = 0;
+long HKeyTriggerManager::hyper_mask = 0;
+long HKeyTriggerManager::numlock_mask = 0;
+bool HKeyTriggerManager::haveMods = false;
+
+
+HKeyTriggerManager::Qt_HK_Keymap
+HKeyTriggerManager::qt_hk_table[] = {
+ { Qt::Key_Escape, {1, { B_ESCAPE }}},
+ { Qt::Key_Tab, {1, { B_TAB }}},
+ { Qt::Key_Backtab, {0, { 0 }}},
+ { Qt::Key_Backspace, {1, { B_BACKSPACE }}},
+ { Qt::Key_Return, {1, { B_RETURN }}},
+ { Qt::Key_Enter, {1, { B_ENTER }}},
+ { Qt::Key_Insert, {1, { B_INSERT }}},
+ { Qt::Key_Delete, {1, { B_DELETE }}},
+ { Qt::Key_Pause, {1, { B_PAUSE_KEY }}},
+ { Qt::Key_Print, {1, { B_PRINT_KEY }}},
+ { Qt::Key_SysReq, {0, { 0 }}},
+ //{ Qt::Key_Clear, B_CLEAR_KEY},
+ { Qt::Key_Home, {1, { B_HOME }}},
+ { Qt::Key_End, {1, { B_END }}},
+ { Qt::Key_Left, {1, { B_LEFT_ARROW }}},
+ { Qt::Key_Up, {1, { B_UP_ARROW }}},
+ { Qt::Key_Right, {1, { B_RIGHT_ARROW }}},
+ { Qt::Key_Down, {1, { B_DOWN_ARROW }}},
+ { Qt::Key_PageUp, {1, { B_PAGE_UP }}},
+ { Qt::Key_PageDown, {1, { B_PAGE_DOWN }}},
+ { Qt::Key_Shift, {1, { B_SHIFT_KEY }}},
+ { Qt::Key_Control, {1, { B_CONTROL_KEY }}},
+ { Qt::Key_Meta, {1, { B_LEFT_OPTION_KEY }}},
+ { Qt::Key_Alt, {1, { B_MENU_KEY }}},
+ { Qt::Key_CapsLock, {1, { B_CAPS_LOCK }}},
+ { Qt::Key_NumLock, {1, { B_NUM_LOCK }}},
+ { Qt::Key_ScrollLock, {1, { B_SCROLL_KEY }}},
+ { Qt::Key_F1, {1, { B_F1_KEY }}},
+ { Qt::Key_F2, {1, { B_F2_KEY }}},
+ { Qt::Key_F3, {1, { B_F3_KEY }}},
+ { Qt::Key_F4, {1, { B_F4_KEY }}},
+ { Qt::Key_F5, {1, { B_F5_KEY }}},
+ { Qt::Key_F6, {1, { B_F6_KEY }}},
+ { Qt::Key_F7, {1, { B_F7_KEY }}},
+ { Qt::Key_F8, {1, { B_F8_KEY }}},
+ { Qt::Key_F9, {1, { B_F9_KEY }}},
+ { Qt::Key_F10, {1, { B_F10_KEY }}},
+ { Qt::Key_F11, {1, { B_F11_KEY }}},
+ { Qt::Key_F12, {1, { B_F12_KEY }}},
+ { Qt::Key_F13, {0, { 0 }}},
+ { Qt::Key_F14, {0, { 0 }}},
+ { Qt::Key_F15, {0, { 0 }}},
+ { Qt::Key_F16, {0, { 0 }}},
+ { Qt::Key_F17, {0, { 0 }}},
+ { Qt::Key_F18, {0, { 0 }}},
+ { Qt::Key_F19, {0, { 0 }}},
+ { Qt::Key_F20, {0, { 0 }}},
+ { Qt::Key_F21, {0, { 0 }}},
+ { Qt::Key_F22, {0, { 0 }}},
+ { Qt::Key_F23, {0, { 0 }}},
+ { Qt::Key_F24, {0, { 0 }}},
+ { Qt::Key_F25, {0, { 0 }}},
+ { Qt::Key_F26, {0, { 0 }}},
+ { Qt::Key_F27, {0, { 0 }}},
+ { Qt::Key_F28, {0, { 0 }}},
+ { Qt::Key_F29, {0, { 0 }}},
+ { Qt::Key_F30, {0, { 0 }}},
+ { Qt::Key_F31, {0, { 0 }}},
+ { Qt::Key_F32, {0, { 0 }}},
+ { Qt::Key_F33, {0, { 0 }}},
+ { Qt::Key_F34, {0, { 0 }}},
+ { Qt::Key_F35, {0, { 0 }}},
+ { Qt::Key_Super_L, {0, { 0 }}},
+ { Qt::Key_Super_R, {0, { 0 }}},
+ { Qt::Key_Menu, {0, { 0 }}},
+ { Qt::Key_Hyper_L, {0, { 0 }}},
+ { Qt::Key_Hyper_R, {0, { 0 }}},
+ { Qt::Key_Help, {0, { 0 }}},
+ { Qt::Key_Direction_L, {0, { 0 }}},
+ { Qt::Key_Direction_R, {0, { 0 }}},
+
+ { Qt::Key_unknown, {0, { 0 }}},
+};
+
+GlobalShortcutManager::KeyTrigger::KeyTrigger(const QKeySequence& key)
+{
+ d = new Impl(this, key);
+}
+
+GlobalShortcutManager::KeyTrigger::~KeyTrigger()
+{
+ delete d;
+ d = 0;
+}
diff --git a/src/plugins/generic/screenshotplugin/CMakeLists.txt b/src/plugins/generic/screenshotplugin/CMakeLists.txt
index f487c2a..6ccfa25 100644
--- a/src/plugins/generic/screenshotplugin/CMakeLists.txt
+++ b/src/plugins/generic/screenshotplugin/CMakeLists.txt
@@ -28,7 +28,7 @@ include_directories(
${CMAKE_CURRENT_LIST_DIR}/qxt/core
${CMAKE_CURRENT_LIST_DIR}/qxt/gui
)
-if( UNIX AND NOT( APPLE OR CYGWIN ) )
+if( UNIX AND NOT( APPLE OR CYGWIN OR HAIKU ) )
find_package( X11 REQUIRED )
add_definitions( -DX11 )
set( qxt_X11_SRCS
@@ -110,7 +110,7 @@ set(QT_DEPLIBS
Qt5::Network
Qt5::PrintSupport
)
-if( UNIX AND NOT( APPLE OR CYGWIN ) )
+if( UNIX AND NOT( APPLE OR CYGWIN OR HAIKU ) )
find_package( Qt5 COMPONENTS X11Extras REQUIRED )
set(QT_DEPLIBS
${QT_DEPLIBS}
diff --git a/src/plugins/generic/videostatusplugin/CMakeLists.txt b/src/plugins/generic/videostatusplugin/CMakeLists.txt
index b57dfd2..b76f4cb 100644
--- a/src/plugins/generic/videostatusplugin/CMakeLists.txt
+++ b/src/plugins/generic/videostatusplugin/CMakeLists.txt
@@ -20,7 +20,7 @@ else()
Please set path to this file to PLUGINS_ROOT_DIR variable")
endif()
-if( NOT WIN32 )
+if( NOT WIN32 AND NOT HAIKU)
add_definitions( -Ddbus -DHAVE_DBUS )
find_package( X11 REQUIRED )
endif()
@@ -31,7 +31,7 @@ include_directories(
${PLUGINS_ROOT_DIR}/include
${CMAKE_CURRENT_LIST_DIR}
)
-if( NOT WIN32 )
+if( NOT WIN32 AND NOT HAIKU)
set( x11_SRCS
x11info.cpp
)
@@ -55,7 +55,7 @@ set(QT_DEPLIBS
Qt5::Widgets
Qt5::Xml
)
-IF( UNIX AND NOT( APPLE OR CYGWIN ) )
+IF( UNIX AND NOT( APPLE OR CYGWIN OR HAIKU ) )
find_package( Qt5 COMPONENTS DBus X11Extras REQUIRED )
find_package( XCB REQUIRED )
add_definitions(
@@ -78,7 +78,7 @@ add_library(
${UIS}
${RSCS}
)
-if( UNIX AND NOT( APPLE OR CYGWIN ) )
+if( UNIX AND NOT( APPLE OR CYGWIN OR HAIKU ) )
target_link_libraries(
${PLUGIN}
${X11_LIBRARIES}
diff --git a/src/plugins/generic/videostatusplugin/videostatusplugin.cpp b/src/plugins/generic/videostatusplugin/videostatusplugin.cpp
old mode 100755
new mode 100644
index 57acce8..071c345
--- a/src/plugins/generic/videostatusplugin/videostatusplugin.cpp
+++ b/src/plugins/generic/videostatusplugin/videostatusplugin.cpp
@@ -648,7 +648,11 @@ void VideoStatusChanger::fullSTTimeout()
#elif defined (Q_OS_WIN)
bool full = isFullscreenWindow();
#endif
- if(full) {
+#elif defined (Q_OS_WIN)
+ bool full = isFullscreenWindow();
+#elif defined (Q_OS_HAIKU)
+ bool full = false;
+#endif
if(!isStatusSet) {
setStatusTimer(setDelay, true);
}
diff --git a/src/src.cmake b/src/src.cmake
index 9703fa1..5a95af7 100644
--- a/src/src.cmake
+++ b/src/src.cmake
@@ -9,7 +9,7 @@ add_definitions(
-DQT_STATICPLUGIN
)
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT (APPLE OR HAIKU))
add_definitions(
-DUSE_DBUS
)
@@ -238,7 +238,7 @@ list(APPEND SOURCES
xdata_widget.cpp
)
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT (APPLE OR HAIKU))
list(APPEND SOURCES
dbus.cpp
)
@@ -275,6 +275,10 @@ elseif(WIN32)
list(APPEND PLAIN_SOURCES
activeprofiles_win.cpp
)
+elseif(HAIKU)
+ list(APPEND PLAIN_SOURCES
+ activeprofiles_stub.cpp
+ )
endif()
list(APPEND PLAIN_HEADERS
--
2.14.2