Drop kephal dependency from KWin

Kephal has turned into not being more than a wrapper around
QDesktopWidget and does not even provide syntax sugar.

REVIEW: 104427
This commit is contained in:
Martin Gräßlin 2012-03-27 19:14:53 +02:00
parent a0c6f70a0e
commit 27643f5a9e
15 changed files with 58 additions and 66 deletions

View file

@ -54,7 +54,6 @@ include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/libkdecorations
${CMAKE_CURRENT_SOURCE_DIR}/effects
${CMAKE_CURRENT_SOURCE_DIR}/tabbox
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kephal
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kworkspace
)
@ -174,7 +173,7 @@ qt4_add_dbus_interface( kwin_KDEINIT_SRCS
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB})
set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative kworkspace kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB})
find_library(XF86VM_LIBRARY Xxf86vm)
if (XF86VM_LIBRARY)

View file

@ -55,7 +55,7 @@ public Q_SLOTS:
/**
* Saves a screenshot of the screen identified by @p screen into a file and returns the path to the file.
* Functionality requires hardware support, if not available a null string is returned.
* @param screen Number of screen as numbered by kephal
* @param screen Number of screen as numbered by QDesktopWidget
* @returns Path to stored screenshot, or null string in failure case.
**/
Q_SCRIPTABLE QString screenshotScreen(int screen);

View file

@ -41,6 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QWhatsThis>
#include <QApplication>
#include <QtGui/QDesktopWidget>
#include <kkeyserver.h>
@ -49,8 +50,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/Xatom.h>
#include <QX11Info>
#include <kephal/screens.h>
namespace KWin
{
@ -1323,14 +1322,14 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot)
{
QuickTileMode mode = QuickTileNone;
foreach (Kephal::Screen * screen, Kephal::Screens::self()->screens()) {
for (int i=0; i<QApplication::desktop()->screenCount(); ++i) {
const QRect &area = screen->geom();
const QRect &area = QApplication::desktop()->screenGeometry(i);
if (!area.contains(QPoint(xroot, yroot)))
continue;
if (options->electricBorderTiling()) {
if (xroot <= screen->geom().x() + 20)
if (xroot <= area.x() + 20)
mode |= QuickTileLeft;
else if (xroot >= area.x() + area.width() - 20)
mode |= QuickTileRight;

View file

@ -39,11 +39,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "geometrytip.h"
#include "rules.h"
#include "effects.h"
#include <QtGui/QDesktopWidget>
#include <QPainter>
#include <QVarLengthArray>
#include <QX11Info>
#include <kephal/screens.h>
#include <KDE/KGlobalSettings>
#include "outline.h"
#ifdef KWIN_BUILD_TILING
@ -65,7 +65,10 @@ extern bool is_multihead;
*/
void Workspace::desktopResized()
{
QRect geom = Kephal::ScreenUtils::desktopGeometry();
QRect geom;
for (int i = 0; i < QApplication::desktop()->screenCount(); i++) {
geom |= QApplication::desktop()->screenGeometry(i);
}
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
desktop_geometry.height = geom.height();
@ -105,17 +108,20 @@ void Workspace::saveOldScreenSizes()
void Workspace::updateClientArea(bool force)
{
int nscreens = Kephal::ScreenUtils::numScreens();
int nscreens = QApplication::desktop()->screenCount();
kDebug(1212) << "screens: " << nscreens << "desktops: " << numberOfDesktops();
QVector< QRect > new_wareas(numberOfDesktops() + 1);
QVector< StrutRects > new_rmoveareas(numberOfDesktops() + 1);
QVector< QVector< QRect > > new_sareas(numberOfDesktops() + 1);
QVector< QRect > screens(nscreens);
QRect desktopArea = Kephal::ScreenUtils::desktopGeometry();
QRect desktopArea;
for (int i = 0; i < QApplication::desktop()->screenCount(); i++) {
desktopArea |= QApplication::desktop()->screenGeometry(i);
}
for (int iS = 0;
iS < nscreens;
iS ++) {
screens [iS] = Kephal::ScreenUtils::screenGeometry(iS);
screens [iS] = QApplication::desktop()->screenGeometry(iS);
}
for (int i = 1;
i <= numberOfDesktops();
@ -257,17 +263,17 @@ QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const
sarea = (!screenarea.isEmpty()
&& screen < screenarea[ desktop ].size()) // screens may be missing during KWin initialization or screen config changes
? screenarea[ desktop ][ screen_number ]
: Kephal::ScreenUtils::screenGeometry(screen_number);
: QApplication::desktop()->screenGeometry(screen_number);
warea = workarea[ desktop ].isNull()
? Kephal::ScreenUtils::screenGeometry(screen_number)
? QApplication::desktop()->screenGeometry(screen_number)
: workarea[ desktop ];
} else {
sarea = (!screenarea.isEmpty()
&& screen < screenarea[ desktop ].size()) // screens may be missing during KWin initialization or screen config changes
? screenarea[ desktop ][ screen ]
: Kephal::ScreenUtils::screenGeometry(screen);
: QApplication::desktop()->screenGeometry(screen);
warea = workarea[ desktop ].isNull()
? Kephal::ScreenUtils::desktopGeometry()
? QRect(0, 0, displayWidth(), displayHeight())
: workarea[ desktop ];
}
@ -280,19 +286,16 @@ QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const
case MovementArea:
case ScreenArea:
if (is_multihead)
return Kephal::ScreenUtils::screenGeometry(screen_number);
return QApplication::desktop()->screenGeometry(screen_number);
else
return Kephal::ScreenUtils::screenGeometry(screen);
return QApplication::desktop()->screenGeometry(screen);
case WorkArea:
if (is_multihead)
return sarea;
else
return warea;
case FullArea:
if (is_multihead)
return Kephal::ScreenUtils::screenGeometry(screen_number);
else
return Kephal::ScreenUtils::desktopGeometry();
return QRect(0, 0, displayWidth(), displayHeight());
}
abort();
}
@ -300,7 +303,7 @@ QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const
QRect Workspace::clientArea(clientAreaOption opt, const QPoint& p, int desktop) const
{
int screen = Kephal::ScreenUtils::screenId(p);
int screen = QApplication::desktop()->screenNumber(p);
return clientArea(opt, screen, desktop);
}
@ -876,7 +879,7 @@ QRect Client::adjustedClientArea(const QRect &desktopArea, const QRect& area) co
// HACK: workarea handling is not xinerama aware, so if this strut
// reserves place at a xinerama edge that's inside the virtual screen,
// ignore the strut for workspace setting.
if (area == Kephal::ScreenUtils::desktopGeometry()) {
if (area == QRect(0, 0, displayWidth(), displayHeight())) {
if (stareaL.left() < screenarea.left())
stareaL = QRect();
if (stareaR.right() > screenarea.right())
@ -1011,9 +1014,9 @@ bool Client::hasOffscreenXineramaStrut() const
region += strutRect(StrutAreaLeft);
// Remove all visible areas so that only the invisible remain
int numScreens = Kephal::ScreenUtils::numScreens();
int numScreens = QApplication::desktop()->screenCount();
for (int i = 0; i < numScreens; i ++)
region -= Kephal::ScreenUtils::screenGeometry(i);
region -= QApplication::desktop()->screenGeometry(i);
// If there's anything left then we have an offscreen strut
return !region.isEmpty();
@ -2356,7 +2359,7 @@ void Client::setFullScreen(bool set, bool user)
void Client::updateFullscreenMonitors(NETFullscreenMonitors topology)
{
int nscreens = Kephal::ScreenUtils::numScreens();
int nscreens = QApplication::desktop()->screenCount();
// kDebug( 1212 ) << "incoming request with top: " << topology.top << " bottom: " << topology.bottom
// << " left: " << topology.left << " right: " << topology.right
@ -2384,10 +2387,10 @@ QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) co
{
QRect top, bottom, left, right, total;
top = Kephal::ScreenUtils::screenGeometry(requestedTopology.top);
bottom = Kephal::ScreenUtils::screenGeometry(requestedTopology.bottom);
left = Kephal::ScreenUtils::screenGeometry(requestedTopology.left);
right = Kephal::ScreenUtils::screenGeometry(requestedTopology.right);
top = QApplication::desktop()->screenGeometry(requestedTopology.top);
bottom = QApplication::desktop()->screenGeometry(requestedTopology.bottom);
left = QApplication::desktop()->screenGeometry(requestedTopology.left);
right = QApplication::desktop()->screenGeometry(requestedTopology.right);
total = top.united(bottom.united(left.united(right)));
// kDebug( 1212 ) << "top: " << top << " bottom: " << bottom
@ -3142,12 +3145,12 @@ void Client::setQuickTileMode(QuickTileMode mode, bool keyboard)
// If trying to tile to the side that the window is already tiled to move the window to the next
// screen if it exists, otherwise ignore the request to prevent corrupting geom_pretile.
if (quick_tile_mode == mode) {
const int numScreens = Kephal::ScreenUtils::numScreens();
const int numScreens = QApplication::desktop()->screenCount();
const int curScreen = screen();
int nextScreen = curScreen;
QVarLengthArray<QRect> screens(numScreens);
for (int i = 0; i < numScreens; ++i) // Cache
screens[i] = Kephal::ScreenUtils::screenGeometry(i);
screens[i] = QApplication::desktop()->screenGeometry(i);
for (int i = 0; i < numScreens; ++i) {
if (i == curScreen)
continue;

View file

@ -2,7 +2,7 @@
set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp )
kde4_add_plugin(kcm_kwinoptions ${kcm_kwinoptions_PART_SRCS})
target_link_libraries(kcm_kwinoptions ${KDE4_KDEUI_LIBS} kephal)
target_link_libraries(kcm_kwinoptions ${KDE4_KDEUI_LIBS})
install(TARGETS kcm_kwinoptions DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -30,6 +30,7 @@
#include <KComboBox>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QtGui/QDesktopWidget>
#include <QtDBus/QtDBus>
#include <KButtonGroup>
@ -43,8 +44,6 @@
#include "windows.h"
#include <kephal/screens.h>
// kwin config keywords
#define KWIN_FOCUS "FocusPolicy"
#define KWIN_PLACEMENT "Placement"
@ -253,7 +252,7 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD
activeMouseScreen->setWhatsThis(wtstr);
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));
if (Kephal::ScreenUtils::numScreens() == 1) { // No Ximerama
if (QApplication::desktop()->screenCount() == 1) { // No Ximerama
separateScreenFocus->hide();
activeMouseScreen->hide();
}

View file

@ -19,7 +19,7 @@ kde4_add_ui_files( kcm_kwintabbox_PART_SRCS main.ui )
kde4_add_plugin(kcm_kwintabbox ${kcm_kwintabbox_PART_SRCS})
target_link_libraries(kcm_kwintabbox ${KDE4_KDEUI_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_PLASMA_LIBS} ${X11_LIBRARIES} kephal ${QT_QTDECLARATIVE_LIBRARY} kdeclarative)
target_link_libraries(kcm_kwintabbox ${KDE4_KDEUI_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_PLASMA_LIBS} ${X11_LIBRARIES} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative)
install(TARGETS kcm_kwintabbox DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -9,7 +9,7 @@ set(kdecorations_LIB_SRCS
kde4_add_library(kdecorations SHARED ${kdecorations_LIB_SRCS})
target_link_libraries(kdecorations ${KDE4_KDEUI_LIBS} kephal)
target_link_libraries(kdecorations ${KDE4_KDEUI_LIBS})
target_link_libraries(kdecorations LINK_INTERFACE_LIBRARIES ${KDE4_KDEUI_LIBS})
set_target_properties(kdecorations PROPERTIES

View file

@ -39,8 +39,6 @@
#include "kdecorationfactory.h"
#include <klocale.h>
#include <kephal/screens.h>
#include "kcommondecoration.moc"
/** @addtogroup kdecoration */

View file

@ -11,7 +11,7 @@ set(kwin_EFFECTSLIB_SRCS
kde4_add_library(kwineffects SHARED ${kwin_EFFECTSLIB_SRCS})
target_link_libraries(kwineffects ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY}
${X11_LIBRARIES} kephal
${X11_LIBRARIES}
${X11_Xrender_LIB}
${X11_Xrandr_LIB}
${X11_Xcomposite_LIB}
@ -33,7 +33,7 @@ set(kwin_GLUTILSLIB_SRCS
macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
include_directories(${glinclude})
kde4_add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
target_link_libraries(${name} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} kephal kwineffects)
target_link_libraries(${name} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} kwineffects)
set_target_properties(${name} PROPERTIES VERSION 1.0.0 SOVERSION 1 )
target_link_libraries(${name} ${ARGN})
target_link_libraries(${name} LINK_INTERFACE_LIBRARIES ${ARGN})

View file

@ -39,8 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "compositingprefs.h"
#include <kwinglplatform.h>
#include <kephal/screens.h>
#include <X11/extensions/Xrandr.h>
#ifndef KWIN_HAVE_OPENGLES
#ifndef KWIN_NO_XF86VM

View file

@ -83,7 +83,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "overlaywindow.h"
#include "shadow.h"
#include <kephal/screens.h>
#include "thumbnailitem.h"
namespace KWin

View file

@ -42,9 +42,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QTextStream>
#include <QtDBus/QDBusInterface>
// KDE-Workspace
#include <kephal/screens.h>
namespace KWin {
ScreenEdge::ScreenEdge()
@ -73,7 +70,7 @@ void ScreenEdge::update(bool force)
m_screenEdgeTimeLast = xTime();
m_screenEdgeTimeLastTrigger = xTime();
m_currentScreenEdge = ElectricNone;
QRect r = Kephal::ScreenUtils::desktopGeometry();
QRect r = QRect(0, 0, displayWidth(), displayHeight());
m_screenEdgeTop = r.top();
m_screenEdgeBottom = r.bottom();
m_screenEdgeLeft = r.left();
@ -120,7 +117,7 @@ void ScreenEdge::restoreSize(ElectricBorder border)
{
if (m_screenEdgeWindows[border] == None)
return;
QRect r = Kephal::ScreenUtils::desktopGeometry();
QRect r(0, 0, displayWidth(), displayHeight());
int xywh[ELECTRIC_COUNT][4] = {
{ r.left() + 1, r.top(), r.width() - 2, 1 }, // Top
{ r.right(), r.top(), 1, 1 }, // Top-right

View file

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtGui/QDesktopWidget>
#include <QtGui/QGraphicsObject>
#include <QtGui/QResizeEvent>
#include <QX11Info>
@ -39,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/Plasma/Theme>
#include <KDE/Plasma/WindowEffects>
#include <kdeclarative.h>
#include <kephal/screens.h>
// KWin
#include "thumbnailitem.h"
#include <kwindowsystem.h>
@ -160,7 +160,7 @@ void DeclarativeView::showEvent(QShowEvent *event)
}
#endif
updateQmlSource();
m_currentScreenGeometry = Kephal::ScreenUtils::screenGeometry(tabBox->activeScreen());
m_currentScreenGeometry = QApplication::desktop()->screenGeometry(tabBox->activeScreen());
rootObject()->setProperty("screenWidth", m_currentScreenGeometry.width());
rootObject()->setProperty("screenHeight", m_currentScreenGeometry.height());
rootObject()->setProperty("allDesktops", tabBox->config().tabBoxMode() == TabBoxConfig::ClientTabBox &&

View file

@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kconfig.h>
#include <kglobal.h>
#include <klocale.h>
#include <QtGui/QDesktopWidget>
#include <QRegExp>
#include <QPainter>
#include <QBitmap>
@ -78,8 +79,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwindowsystem.h>
#include <kwindowinfo.h>
#include <kephal/screens.h>
namespace KWin
{
@ -241,10 +240,8 @@ Workspace::Workspace(bool restore)
init();
connect(Kephal::Screens::self(), SIGNAL(screenAdded(Kephal::Screen*)), &screenChangedTimer, SLOT(start()));
connect(Kephal::Screens::self(), SIGNAL(screenRemoved(int)), &screenChangedTimer, SLOT(start()));
connect(Kephal::Screens::self(), SIGNAL(screenResized(Kephal::Screen*,QSize,QSize)), &screenChangedTimer, SLOT(start()));
connect(Kephal::Screens::self(), SIGNAL(screenMoved(Kephal::Screen*,QPoint,QPoint)), &screenChangedTimer, SLOT(start()));
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), &screenChangedTimer, SLOT(start()));
connect(QApplication::desktop(), SIGNAL(resized(int)), &screenChangedTimer, SLOT(start()));
#ifdef KWIN_BUILD_ACTIVITIES
connect(&activityController_, SIGNAL(currentActivityChanged(QString)), SLOT(updateCurrentActivity(QString)));
@ -441,7 +438,10 @@ void Workspace::init()
NETPoint* viewports = new NETPoint[numberOfDesktops()];
rootInfo->setDesktopViewport(numberOfDesktops(), *viewports);
delete[] viewports;
QRect geom = Kephal::ScreenUtils::desktopGeometry();
QRect geom;
for (int i = 0; i < QApplication::desktop()->screenCount(); i++) {
geom |= QApplication::desktop()->screenGeometry(i);
}
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
desktop_geometry.height = geom.height();
@ -1658,7 +1658,7 @@ void Workspace::toggleClientOnActivity(Client* c, const QString &activity, bool
int Workspace::numScreens() const
{
return Kephal::ScreenUtils::numScreens();
return QApplication::desktop()->screenCount();
}
int Workspace::activeScreen() const
@ -1668,7 +1668,7 @@ int Workspace::activeScreen() const
return activeClient()->screen();
return active_screen;
}
return Kephal::ScreenUtils::screenId(cursorPos());
return QApplication::desktop()->screenNumber(cursorPos());
}
/**
@ -1689,17 +1689,17 @@ void Workspace::checkActiveScreen(const Client* c)
*/
void Workspace::setActiveScreenMouse(const QPoint& mousepos)
{
active_screen = Kephal::ScreenUtils::screenId(mousepos);
active_screen = QApplication::desktop()->screenNumber(mousepos);
}
QRect Workspace::screenGeometry(int screen) const
{
return Kephal::ScreenUtils::screenGeometry(screen);
return QApplication::desktop()->screenGeometry(screen);
}
int Workspace::screenNumber(const QPoint& pos) const
{
return Kephal::ScreenUtils::screenId(pos);
return QApplication::desktop()->screenNumber(pos);
}
void Workspace::sendClientToScreen(Client* c, int screen)