Kephalized plasma and kwin: replaced usage of QDesktopWidget by Kephal
svn path=/trunk/KDE/kdebase/workspace/; revision=884482
This commit is contained in:
parent
e1d4d50cd6
commit
f780e8b68b
8 changed files with 49 additions and 65 deletions
|
@ -5,7 +5,7 @@
|
|||
# Adds effect plugin with given name. Sources are given after the name
|
||||
macro(KWIN4_ADD_EFFECT name)
|
||||
kde4_add_plugin(kwin4_effect_${name} ${ARGN})
|
||||
target_link_libraries(kwin4_effect_${name} kwineffects ${KDE4_KDEUI_LIBS})
|
||||
target_link_libraries(kwin4_effect_${name} kwineffects ${KDE4_KDEUI_LIBS} kephal)
|
||||
install(TARGETS kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
endmacro(KWIN4_ADD_EFFECT)
|
||||
|
||||
|
@ -21,7 +21,7 @@ macro(KWIN4_ADD_EFFECT_CONFIG name)
|
|||
endforeach(file)
|
||||
kde4_add_ui_files(kwin4_effect_src ${kwin4_effect_ui})
|
||||
kde4_add_plugin(kcm_kwin4_effect_${name} ${kwin4_effect_src})
|
||||
target_link_libraries(kcm_kwin4_effect_${name} kwineffects ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS})
|
||||
target_link_libraries(kcm_kwin4_effect_${name} kwineffects ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} kephal)
|
||||
install(TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
endmacro(KWIN4_ADD_EFFECT_CONFIG)
|
||||
|
||||
|
@ -223,7 +223,7 @@ KWIN4_ADD_EFFECT(builtins ${kwin4_effect_builtins_sources})
|
|||
KWIN4_ADD_EFFECT_CONFIG(builtins ${kwin4_effect_builtins_config_sources})
|
||||
# link to xrender if necessary
|
||||
if (KWIN_HAVE_XRENDER_COMPOSITING)
|
||||
target_link_libraries(kwin4_effect_builtins ${X11_Xrender_LIB} ${X11_LIBRARIES})
|
||||
target_link_libraries(kwin4_effect_builtins ${X11_Xrender_LIB} ${X11_LIBRARIES} kephal)
|
||||
endif (KWIN_HAVE_XRENDER_COMPOSITING)
|
||||
|
||||
|
||||
|
|
52
geometry.cpp
52
geometry.cpp
|
@ -40,7 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "rules.h"
|
||||
#include "effects.h"
|
||||
#include <QX11Info>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <kephal/screens.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -54,7 +55,7 @@ namespace KWin
|
|||
*/
|
||||
void Workspace::desktopResized()
|
||||
{
|
||||
QRect geom = QApplication::desktop()->geometry();
|
||||
QRect geom = Kephal::ScreenUtils::desktopGeometry();
|
||||
NETSize desktop_geometry;
|
||||
desktop_geometry.width = geom.width();
|
||||
desktop_geometry.height = geom.height();
|
||||
|
@ -84,18 +85,17 @@ void Workspace::desktopResized()
|
|||
|
||||
void Workspace::updateClientArea( bool force )
|
||||
{
|
||||
QDesktopWidget *desktopwidget = KApplication::desktop();
|
||||
int nscreens = desktopwidget -> numScreens ();
|
||||
// kDebug () << "screens: " << nscreens;
|
||||
int nscreens = Kephal::ScreenUtils::numScreens();
|
||||
kDebug() << "screens: " << nscreens << "desktops: " << numberOfDesktops();
|
||||
QVector< QRect > new_wareas( numberOfDesktops() + 1 );
|
||||
QVector< QVector< QRect > > new_sareas( numberOfDesktops() + 1 );
|
||||
QVector< QRect > screens( nscreens );
|
||||
QRect desktopArea = desktopwidget -> geometry ();
|
||||
QRect desktopArea = Kephal::ScreenUtils::desktopGeometry();
|
||||
for( int iS = 0;
|
||||
iS < nscreens;
|
||||
iS ++ )
|
||||
{
|
||||
screens [iS] = desktopwidget -> screenGeometry (iS);
|
||||
screens [iS] = Kephal::ScreenUtils::screenGeometry( iS );
|
||||
}
|
||||
for( int i = 1;
|
||||
i <= numberOfDesktops();
|
||||
|
@ -230,12 +230,11 @@ QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) con
|
|||
desktop = currentDesktop();
|
||||
if( screen == -1 )
|
||||
screen = activeScreen();
|
||||
QDesktopWidget *desktopwidget = KApplication::desktop();
|
||||
QRect sarea = !screenarea.isEmpty() // may be empty during KWin initialization
|
||||
? screenarea[ desktop ][ screen ]
|
||||
: desktopwidget->screenGeometry( screen );
|
||||
: Kephal::ScreenUtils::screenGeometry( screen );
|
||||
QRect warea = workarea[ desktop ].isNull()
|
||||
? QApplication::desktop()->geometry()
|
||||
? Kephal::ScreenUtils::desktopGeometry()
|
||||
: workarea[ desktop ];
|
||||
switch (opt)
|
||||
{
|
||||
|
@ -246,14 +245,14 @@ QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) con
|
|||
return warea;
|
||||
case MaximizeFullArea:
|
||||
if (options->xineramaMaximizeEnabled)
|
||||
return desktopwidget->screenGeometry( screen );
|
||||
return Kephal::ScreenUtils::screenGeometry( screen );
|
||||
else
|
||||
return desktopwidget->geometry();
|
||||
return Kephal::ScreenUtils::desktopGeometry();
|
||||
case FullScreenArea:
|
||||
if (options->xineramaFullscreenEnabled)
|
||||
return desktopwidget->screenGeometry( screen );
|
||||
return Kephal::ScreenUtils::screenGeometry( screen );
|
||||
else
|
||||
return desktopwidget->geometry();
|
||||
return Kephal::ScreenUtils::desktopGeometry();
|
||||
case PlacementArea:
|
||||
if (options->xineramaPlacementEnabled)
|
||||
return sarea;
|
||||
|
@ -261,25 +260,22 @@ QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) con
|
|||
return warea;
|
||||
case MovementArea:
|
||||
if (options->xineramaMovementEnabled)
|
||||
return desktopwidget->screenGeometry( screen );
|
||||
return Kephal::ScreenUtils::screenGeometry( screen );
|
||||
else
|
||||
return desktopwidget->geometry();
|
||||
return Kephal::ScreenUtils::desktopGeometry();
|
||||
case WorkArea:
|
||||
return warea;
|
||||
case FullArea:
|
||||
return desktopwidget->geometry();
|
||||
return Kephal::ScreenUtils::desktopGeometry();
|
||||
case ScreenArea:
|
||||
return desktopwidget->screenGeometry( screen );
|
||||
return Kephal::ScreenUtils::screenGeometry( screen );
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
QRect Workspace::clientArea( clientAreaOption opt, const QPoint& p, int desktop ) const
|
||||
{
|
||||
QDesktopWidget *desktopwidget = KApplication::desktop();
|
||||
int screen = desktopwidget->isVirtualDesktop() ? desktopwidget->screenNumber( p ) : desktopwidget->primaryScreen();
|
||||
if( screen < 0 )
|
||||
screen = desktopwidget->primaryScreen();
|
||||
int screen = Kephal::ScreenUtils::screenId( p );
|
||||
return clientArea( opt, screen, desktop );
|
||||
}
|
||||
|
||||
|
@ -871,7 +867,7 @@ QRect Client::adjustedClientArea( const QRect &desktopArea, const QRect& area )
|
|||
// 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 == kapp->desktop()->geometry())
|
||||
if( area == Kephal::ScreenUtils::desktopGeometry())
|
||||
{
|
||||
if( stareaL.left() < screenarea.left())
|
||||
stareaL = QRect();
|
||||
|
@ -992,17 +988,7 @@ int Client::computeWorkareaDiff( int left, int right, int a_left, int a_right )
|
|||
void Client::checkWorkspacePosition()
|
||||
{
|
||||
if( isDesktop())
|
||||
{
|
||||
if (geometry() == workspace()->clientArea( ScreenArea, this ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRect area = workspace()->clientArea( FullArea, this );
|
||||
if( geometry() != area )
|
||||
setGeometry( area );
|
||||
return;
|
||||
}
|
||||
if( isFullScreen())
|
||||
{
|
||||
QRect area = workspace()->clientArea( FullScreenArea, this );
|
||||
|
|
|
@ -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})
|
||||
target_link_libraries(kcm_kwinoptions ${KDE4_KDEUI_LIBS} kephal)
|
||||
install(TARGETS kcm_kwinoptions DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <KButtonGroup>
|
||||
#include <klocale.h>
|
||||
|
@ -44,6 +43,8 @@
|
|||
|
||||
#include "windows.h"
|
||||
|
||||
#include <kephal/screens.h>
|
||||
|
||||
// kwin config keywords
|
||||
#define KWIN_FOCUS "FocusPolicy"
|
||||
#define KWIN_PLACEMENT "Placement"
|
||||
|
@ -257,8 +258,7 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, const KComponent
|
|||
activeMouseScreen->setWhatsThis( wtstr );
|
||||
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));
|
||||
|
||||
if (!QApplication::desktop()->isVirtualDesktop() ||
|
||||
QApplication::desktop()->numScreens() == 1) // No Ximerama
|
||||
if (Kephal::ScreenUtils::numScreens() == 1) // No Ximerama
|
||||
{
|
||||
separateScreenFocus->hide();
|
||||
activeMouseScreen->hide();
|
||||
|
|
|
@ -11,7 +11,7 @@ set(kdecorations_LIB_SRCS
|
|||
|
||||
kde4_add_library(kdecorations SHARED ${kdecorations_LIB_SRCS})
|
||||
|
||||
target_link_libraries(kdecorations ${KDE4_KDEUI_LIBS})
|
||||
target_link_libraries(kdecorations ${KDE4_KDEUI_LIBS} kephal)
|
||||
|
||||
set_target_properties(kdecorations PROPERTIES
|
||||
VERSION ${GENERIC_LIB_VERSION}
|
||||
|
@ -40,7 +40,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})
|
||||
target_link_libraries(kwineffects ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} kephal)
|
||||
set_target_properties(kwineffects PROPERTIES VERSION 1.0.0 SOVERSION 1 )
|
||||
|
||||
install(TARGETS kwineffects ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
#include <kapplication.h>
|
||||
#include "kdecorationfactory.h"
|
||||
#include <klocale.h>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <kephal/screens.h>
|
||||
|
||||
#include "kcommondecoration.moc"
|
||||
|
||||
|
@ -799,11 +800,10 @@ void KCommonDecoration::updateWindowShape()
|
|||
|
||||
bool tl=true,tr=true,bl=true,br=true; // is there a transparent rounded corner in top-left? etc
|
||||
|
||||
QDesktopWidget *desktop=KApplication::desktop();
|
||||
// no transparent rounded corners if this window corner lines up with a screen corner
|
||||
for(int screen=0; screen < desktop->numScreens(); ++screen)
|
||||
for(int screen=0; screen < Kephal::ScreenUtils::numScreens(); ++screen)
|
||||
{
|
||||
QRect fullscreen(desktop->screenGeometry(screen));
|
||||
QRect fullscreen(Kephal::ScreenUtils::screenGeometry(screen));
|
||||
QRect window = geometry();
|
||||
|
||||
if(window.topLeft() == fullscreen.topLeft() ) tl = false;
|
||||
|
|
|
@ -234,11 +234,7 @@ bool Client::manage( Window w, bool isMapped )
|
|||
|
||||
if ( isDesktop() )
|
||||
{
|
||||
// desktops are treated slightly special
|
||||
if (geom != workspace()->clientArea( ScreenArea, geom.center(), desktop()))
|
||||
{
|
||||
geom = workspace()->clientArea( FullArea, geom.center(), desktop());
|
||||
}
|
||||
// kwin doesn't manage desktop windows
|
||||
placementDone = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <kmenubar.h>
|
||||
#include <kprocess.h>
|
||||
#include <kglobalaccel.h>
|
||||
#include <QDesktopWidget>
|
||||
#include <QToolButton>
|
||||
#include <kactioncollection.h>
|
||||
#include <kaction.h>
|
||||
|
@ -67,6 +66,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <ktoolinvocation.h>
|
||||
#include <kglobalsettings.h>
|
||||
|
||||
#include <kephal/screens.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
|
@ -176,8 +177,6 @@ Workspace::Workspace( bool restore )
|
|||
|
||||
loadWindowRules();
|
||||
|
||||
(void) QApplication::desktop(); // trigger creation of desktop widget
|
||||
|
||||
// call this before XSelectInput() on the root window
|
||||
startup = new KStartupInfo(
|
||||
KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this );
|
||||
|
@ -217,7 +216,10 @@ Workspace::Workspace( bool restore )
|
|||
|
||||
init();
|
||||
|
||||
connect( kapp->desktop(), SIGNAL( resized( int )), SLOT( desktopResized()));
|
||||
connect( Kephal::Screens::self(), SIGNAL( screenAdded( Kephal::Screen *)), SLOT( desktopResized()));
|
||||
connect( Kephal::Screens::self(), SIGNAL( screenRemoved(int)), SLOT( desktopResized()));
|
||||
connect( Kephal::Screens::self(), SIGNAL( screenResized( Kephal::Screen *, QSize, QSize)), SLOT( desktopResized()));
|
||||
connect( Kephal::Screens::self(), SIGNAL( screenMoved( Kephal::Screen *, QPoint, QPoint)), SLOT( desktopResized()));
|
||||
}
|
||||
|
||||
void Workspace::init()
|
||||
|
@ -405,7 +407,7 @@ void Workspace::init()
|
|||
NETPoint* viewports = new NETPoint[ number_of_desktops ];
|
||||
rootInfo->setDesktopViewport( number_of_desktops, *viewports );
|
||||
delete[] viewports;
|
||||
QRect geom = QApplication::desktop()->geometry();
|
||||
QRect geom = Kephal::ScreenUtils::desktopGeometry();
|
||||
NETSize desktop_geometry;
|
||||
desktop_geometry.width = geom.width();
|
||||
desktop_geometry.height = geom.height();
|
||||
|
@ -1017,7 +1019,7 @@ void Workspace::slotReconfigure()
|
|||
#if 0 // This actually seems to make things worse now
|
||||
QWidget curtain;
|
||||
curtain.setBackgroundMode( NoBackground );
|
||||
curtain.setGeometry( QApplication::desktop()->geometry() );
|
||||
curtain.setGeometry( Kephal::ScreenUtils::desktopGeometry() );
|
||||
curtain.show();
|
||||
#endif
|
||||
for( ClientList::ConstIterator it = clients.constBegin();
|
||||
|
@ -1205,7 +1207,7 @@ bool Workspace::isNotManaged( const QString& title )
|
|||
void Workspace::refresh()
|
||||
{
|
||||
QWidget w( NULL, Qt::X11BypassWindowManagerHint );
|
||||
w.setGeometry( QApplication::desktop()->geometry() );
|
||||
w.setGeometry( Kephal::ScreenUtils::desktopGeometry() );
|
||||
w.show();
|
||||
w.hide();
|
||||
QApplication::flush();
|
||||
|
@ -1646,7 +1648,7 @@ int Workspace::numScreens() const
|
|||
{
|
||||
if( !options->xineramaEnabled )
|
||||
return 1;
|
||||
return qApp->desktop()->numScreens();
|
||||
return Kephal::ScreenUtils::numScreens();
|
||||
}
|
||||
|
||||
int Workspace::activeScreen() const
|
||||
|
@ -1659,7 +1661,7 @@ int Workspace::activeScreen() const
|
|||
return activeClient()->screen();
|
||||
return active_screen;
|
||||
}
|
||||
return qApp->desktop()->screenNumber( cursorPos());
|
||||
return Kephal::ScreenUtils::screenId( cursorPos());
|
||||
}
|
||||
|
||||
// check whether a client moved completely out of what's considered the active screen,
|
||||
|
@ -1680,21 +1682,21 @@ void Workspace::setActiveScreenMouse( const QPoint &mousepos )
|
|||
{
|
||||
if( !options->xineramaEnabled )
|
||||
return;
|
||||
active_screen = qApp->desktop()->screenNumber( mousepos );
|
||||
active_screen = Kephal::ScreenUtils::screenId( mousepos );
|
||||
}
|
||||
|
||||
QRect Workspace::screenGeometry( int screen ) const
|
||||
{
|
||||
if( !options->xineramaEnabled )
|
||||
return qApp->desktop()->geometry();
|
||||
return qApp->desktop()->screenGeometry( screen );
|
||||
return Kephal::ScreenUtils::desktopGeometry();
|
||||
return Kephal::ScreenUtils::screenGeometry( screen );
|
||||
}
|
||||
|
||||
int Workspace::screenNumber( const QPoint &pos ) const
|
||||
{
|
||||
if( !options->xineramaEnabled )
|
||||
return 0;
|
||||
return qApp->desktop()->screenNumber( pos );
|
||||
return Kephal::ScreenUtils::screenId( pos );
|
||||
}
|
||||
|
||||
void Workspace::sendClientToScreen( Client* c, int screen )
|
||||
|
@ -2106,7 +2108,7 @@ void Workspace::updateElectricBorders()
|
|||
electric_time_first = xTime();
|
||||
electric_time_last = xTime();
|
||||
electric_current_border = ElectricNone;
|
||||
QRect r = QApplication::desktop()->geometry();
|
||||
QRect r = Kephal::ScreenUtils::desktopGeometry();
|
||||
electricTop = r.top();
|
||||
electricBottom = r.bottom();
|
||||
electricLeft = r.left();
|
||||
|
|
Loading…
Reference in a new issue