Commit acb2bc04 authored by Rafał Malinowski's avatar Rafał Malinowski

qt5: better X11 support

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 32972786
......@@ -75,7 +75,7 @@
#include "main-configuration-window.h"
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include "os/x11tools.h" // this should be included as last one,
#undef KeyPress
#undef Status // and Status defined by Xlib.h must be undefined
......@@ -184,15 +184,15 @@ MainConfigurationWindow::MainConfigurationWindow() :
widget()->widgetById("hideMainWindowFromTaskbar")->hide();
#endif
#ifndef Q_WS_X11
#if !defined(Q_OS_UNIX) || defined(Q_OS_MAC)
widget()->widgetById("windowActivationMethod")->hide();
#endif
#if !defined(Q_WS_X11) && !defined(Q_OS_WIN32)
#if !(defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && !defined(Q_OS_WIN32)
widget()->widgetById("notify/fullscreenSilentMode")->hide();
#endif
#if !defined(Q_WS_X11)
#if !defined(Q_OS_UNIX) || defined(Q_OS_MAC)
widget()->widgetById("useTransparency")->hide();
widget()->widgetById("userboxTransparency")->hide();
widget()->widgetById("userboxAlpha")->hide();
......
......@@ -41,8 +41,8 @@
#include "main-window.h"
#ifdef Q_WS_X11
#include <QtGui/QX11Info>
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <QtX11Extras/QX11Info>
#include "os/x11tools.h" // this should be included as last one,
#undef KeyPress
......@@ -473,7 +473,7 @@ ActionContext * MainWindow::actionContext()
void MainWindow::setBlur(bool enable)
{
#if !defined(Q_WS_X11)
#if !defined(Q_OS_UNIX) || defined(Q_OS_MAC)
Q_UNUSED(enable);
#else
BlurEnabled = enable;
......
......@@ -35,22 +35,22 @@
#include "kadu-application.h"
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <X11/Xatom.h>
#include <X11/extensions/Xfixes.h>
#undef KeyPress
#undef Status
#include <QtGui/QX11Info>
#include <QtX11Extras/QX11Info>
#include "os/generic/compositing-aware-object.h"
#endif // Q_WS_X11
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
KaduApplication::KaduApplication(int &argc, char *argv[]) :
QApplication(argc, argv)
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
, net_wm_state{}
#endif // Q_WS_X11
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#if QT_VERSION < 0x050000
, SavingSession(false)
#endif
......@@ -63,7 +63,7 @@ KaduApplication::KaduApplication(int &argc, char *argv[]) :
setStyleSheet("QToolBar{border:0px}");
#endif
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
xfixes_event_base = -1;
int dummy;
if (XFixesQueryExtension(QX11Info::display(), &xfixes_event_base, &dummy))
......@@ -74,9 +74,11 @@ KaduApplication::KaduApplication(int &argc, char *argv[]) :
XFixesSelectionWindowDestroyNotifyMask |
XFixesSelectionClientCloseNotifyMask);
}
#if QT_VERSION < 0x050000
if (QX11Info::isCompositingManagerRunning())
CompositingAwareObject::compositingStateChanged();
#endif // Q_WS_X11
CompositingAwareObject::compositingStateChanged(); // not defined in Qt5.2
#endif // QT_VERSION < 0x050000
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
}
#if QT_VERSION < 0x050000
......@@ -89,7 +91,7 @@ void KaduApplication::commitData(QSessionManager &manager)
SavingSession = false;
}
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
bool KaduApplication::x11EventFilter(XEvent *event)
{
if (xfixes_event_base != -1 && event->type == xfixes_event_base + XFixesSelectionNotify)
......@@ -100,7 +102,7 @@ bool KaduApplication::x11EventFilter(XEvent *event)
}
return false;
}
#endif // Q_WS_X11
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
bool KaduApplication::isSavingSession() const
{
......
......@@ -41,11 +41,11 @@
#include <Carbon/Carbon.h>
#endif // Q_OS_MAC
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <X11/Xdefs.h>
#undef KeyPress
#undef Status
#endif // Q_WS_X11
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include "exports.h"
......@@ -53,10 +53,10 @@ class KADUAPI KaduApplication : public QApplication
{
Q_OBJECT
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
Atom net_wm_state;
int xfixes_event_base;
#endif // Q_WS_X11
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#ifdef Q_OS_MAC
AEEventHandlerUPP m_appleEventProcessorUPP;
#endif // Q_OS_MAC
......@@ -71,9 +71,9 @@ public:
#if QT_VERSION < 0x050000
virtual void commitData(QSessionManager &manager);
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
virtual bool x11EventFilter(XEvent *event);
#endif // Q_WS_X11
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
bool isSavingSession() const;
#endif
......
......@@ -39,7 +39,7 @@ set (notify_MOC_SRCS
if (WIN32)
list (APPEND notify_SRCS "windows-screen-mode-checker.cpp")
elseif (UNIX AND NOT APPLE AND NOT Qt5Core_FOUND)
elseif (UNIX AND NOT APPLE)
list (APPEND notify_SRCS "x11-screen-mode-checker.cpp")
endif ()
......
......@@ -19,7 +19,7 @@
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusReply>
#include <QtGui/QX11Info>
#include <QtX11Extras/QX11Info>
#include "x11-screen-mode-checker.h"
......
......@@ -28,7 +28,7 @@
#include <X11/Xlib.h>
#include <time.h>
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include "os/x11tools.h" // this should be included as last one,
#undef KeyPress
#undef Status // and Status defined by Xlib.h must be undefined
......
......@@ -40,7 +40,7 @@
#include "status/status-type-data.h"
#include "status/status-type-manager.h"
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include "notify/x11-screen-mode-checker.h"
#elif defined(Q_OS_WIN32)
#include "notify/windows-screen-mode-checker.h"
......@@ -220,7 +220,7 @@ void NotificationService::startScreenModeChecker()
if (FullscreenChecker)
return;
#if defined(Q_WS_X11)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
FullscreenChecker = new X11ScreenModeChecker();
#elif defined(Q_OS_WIN32)
FullscreenChecker = new WindowsScreenModeChecker();
......@@ -284,6 +284,6 @@ void checkNotify(Action *action)
action->setChecked(notifyAll);
}
#undef Bool
#include "moc_notification-service.cpp"
......@@ -668,7 +668,7 @@ void HintManager::import_0_6_5_configuration()
void HintManager::createDefaultConfiguration()
{
// TODO: this should be more like: if (plugins.loaded(freedesktop_notify) && this_is_first_time_we_are_loaded_or_whatever)
#if !defined(Q_WS_X11)
#if !defined(Q_OS_UNIX) || defined(Q_OS_MAC)
config_file.addVariable("Notify", "ConnectionError_Hints", true);
config_file.addVariable("Notify", "NewChat_Hints", true);
config_file.addVariable("Notify", "NewMessage_Hints", true);
......
......@@ -40,7 +40,7 @@
#include <windows.h>
#endif
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <unistd.h>
......@@ -77,7 +77,7 @@ void PCSpeaker::beep(int pitch, int duration)
else
Beep(pitch, duration);
}
#elif defined(Q_WS_X11)
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
void PCSpeaker::beep(int pitch, int duration)
{
if (pitch == 0)
......@@ -110,7 +110,7 @@ void PCSpeaker::beep(int pitch, int duration)
PCSpeaker::PCSpeaker(QObject *parent) :
Notifier{"PC Speaker", QT_TRANSLATE_NOOP("@default", "PC Speaker"), KaduIcon("audio-volume-low"), parent},
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
xdisplay{},
#endif
configWidget{},
......@@ -245,7 +245,7 @@ void PCSpeaker::ParseStringToSound(QString line, int tab[21], int tab2[21])
void PCSpeaker::play(int sound[21], int soundlength[20])
{
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
xdisplay = XOpenDisplay(NULL);
#endif
for (int i=0; i<20; ++i)
......@@ -253,7 +253,7 @@ void PCSpeaker::play(int sound[21], int soundlength[20])
if (sound[i] == -1) break;
beep(sound[i], soundlength[i]);
}
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
XCloseDisplay(xdisplay);
#endif
}
......
......@@ -4,6 +4,7 @@
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtWidgets/QWidget>
#include <QtX11Extras/QX11Info>
#include "gui/windows/main-configuration-window.h"
#include "notify/notifier.h"
......@@ -33,7 +34,7 @@ class PCSpeaker : public Notifier, public PluginRootComponent
static PCSpeaker *instance() { return Instance; }
private:
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
Display *xdisplay;
#endif
PCSpeakerConfigurationWidget *configWidget;
......
......@@ -26,8 +26,8 @@
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QHBoxLayout>
#include <QtGui/QMouseEvent>
#ifdef Q_WS_X11
#include <QtGui/QX11Info>
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <QtX11Extras/QX11Info>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#endif
......@@ -47,7 +47,7 @@ ScreenshotWidget::ScreenshotWidget(QWidget *parent) :
setWindowRole("kadu-screenshot");
setFocusPolicy(Qt::StrongFocus);
#ifdef Q_WS_X11
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// set always-on-top and force taskbar and pager skipping
Atom win_state = XInternAtom( QX11Info::display(), "_NET_WM_STATE", False );
Atom win_state_setting[] =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment