Add a build option for screen edge support

icc-effect-5.14.5
Martin Gräßlin 2011-07-07 18:29:11 +02:00
parent d414f57c8d
commit 039c025bfb
9 changed files with 70 additions and 8 deletions

View File

@ -4,12 +4,14 @@ OPTION(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
OPTION(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
OPTION(KWIN_MOBILE_EFFECTS "Only build effects relevant for mobile devices" OFF)
OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
OPTION(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON)
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
if(KWIN_PLASMA_ACTIVE)
set(KWIN_BUILD_DECORATIONS OFF)
set(KWIN_BUILD_KCMS OFF)
set(KWIN_BUILD_TABBOX OFF)
set(KWIN_BUILD_SCREENEDGES OFF)
set(KWIN_MOBILE_EFFECTS ON)
set(KWIN_BUILD_WITH_OPENGLES ON)
endif(KWIN_PLASMA_ACTIVE)
@ -132,7 +134,6 @@ set(kwin_KDEINIT_SRCS
compositingprefs.cpp
desktoplayout.cpp
paintredirector.cpp
screenedge.cpp
tile.cpp
tiling.cpp
tilinglayout.cpp
@ -178,6 +179,13 @@ if(KWIN_BUILD_TABBOX)
)
endif(KWIN_BUILD_TABBOX)
if(KWIN_BUILD_SCREENEDGES)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
screenedge.cpp
)
endif(KWIN_BUILD_SCREENEDGES)
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWin::Workspace )
qt4_add_dbus_interface( kwin_KDEINIT_SRCS

View File

@ -2,3 +2,4 @@
#cmakedefine HAVE_CAPTURY 1
#cmakedefine KWIN_BUILD_DECORATIONS 1
#cmakedefine KWIN_BUILD_TABBOX 1
#cmakedefine KWIN_BUILD_SCREENEDGES 1

View File

@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "group.h"
#include "scene_xrender.h"
#include "scene_opengl.h"
#include "screenedge.h"
#include "unmanaged.h"
#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
@ -905,7 +904,9 @@ Window EffectsHandlerImpl::createInputWindow(Effect* e, int x, int y, int w, int
// Raise electric border windows above the input windows
// so they can still be triggered.
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->ensureOnTop();
#endif
return win;
}
@ -976,7 +977,9 @@ void EffectsHandlerImpl::checkInputWindowStacking()
delete[] wins;
// Raise electric border windows above the input windows
// so they can still be triggered. TODO: Do both at once.
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->ensureOnTop();
#endif
}
QPoint EffectsHandlerImpl::cursorPos() const
@ -986,22 +989,39 @@ QPoint EffectsHandlerImpl::cursorPos() const
void EffectsHandlerImpl::checkElectricBorder(const QPoint &pos, Time time)
{
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->check(pos, time);
#else
Q_UNUSED(pos)
Q_UNUSED(time)
#endif
}
void EffectsHandlerImpl::reserveElectricBorder(ElectricBorder border)
{
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->reserve(border);
#else
Q_UNUSED(border)
#endif
}
void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border)
{
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->unreserve(border);
#else
Q_UNUSED(border)
#endif
}
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve)
{
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->reserveDesktopSwitching(reserve);
#else
Q_UNUSED(reserve)
#endif
}
unsigned long EffectsHandlerImpl::xrenderBufferPicture()

View File

@ -36,7 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "group.h"
#include "rules.h"
#include "unmanaged.h"
#include "screenedge.h"
#include "effects.h"
#include <QWhatsThis>
@ -384,8 +383,10 @@ bool Workspace::workspaceEvent(XEvent * e)
if (w)
QWhatsThis::leaveWhatsThisMode();
}
#ifdef KWIN_BUILD_SCREENEDGES
if (m_screenEdge.isEntered(e))
return true;
#endif
break;
}
case LeaveNotify: {
@ -436,8 +437,10 @@ bool Workspace::workspaceEvent(XEvent * e)
case FocusOut:
return true; // always eat these, they would tell Qt that KWin is the active app
case ClientMessage:
#ifdef KWIN_BUILD_SCREENEDGES
if (m_screenEdge.isEntered(e))
return true;
#endif
break;
case Expose:
if (compositing()

View File

@ -40,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "notifications.h"
#include "geometrytip.h"
#include "rules.h"
#include "screenedge.h"
#include "effects.h"
#include <QPainter>
#include <QVarLengthArray>
@ -72,7 +71,9 @@ void Workspace::desktopResized()
rootInfo->setDesktopGeometry(-1, desktop_geometry);
updateClientArea();
#ifdef KWIN_BUILD_SCREENEDGES
m_screenEdge.update(true);
#endif
if (compositing())
compositeResetTimer.start(0);
}
@ -2519,10 +2520,12 @@ bool Client::startMoveResize()
checkUnrestrictedMoveResize();
Notify::raise(isResize() ? Notify::ResizeStart : Notify::MoveStart);
emit clientStartUserMovedResized(this);
#ifdef KWIN_BUILD_SCREENEDGES
if (options->electricBorders() == Options::ElectricMoveOnly ||
options->electricBorderMaximize() ||
options->electricBorderTiling())
workspace()->screenEdge()->reserveDesktopSwitching(true);
#endif
return true;
}
@ -2586,8 +2589,10 @@ void Client::finishMoveResize(bool cancel)
if (border == ElectricNone)
kDebug(1212) << "invalid electric mode" << electricMode << "leading to invalid array acces,\
this should not have happened!";
#ifdef KWIN_BUILD_SCREENEDGES
else
workspace()->screenEdge()->restoreSize(border);
#endif
electricMaximizing = false;
workspace()->outline()->hide();
}
@ -2614,10 +2619,12 @@ void Client::leaveMoveResize()
moveResizeMode = false;
delete sync_timeout;
sync_timeout = NULL;
#ifdef KWIN_BUILD_SCREENEDGES
if (options->electricBorders() == Options::ElectricMoveOnly ||
options->electricBorderMaximize() ||
options->electricBorderTiling())
workspace()->screenEdge()->reserveDesktopSwitching(false);
#endif
}
// This function checks if it actually makes sense to perform a restricted move/resize.
@ -2940,7 +2947,9 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
if (isMove()) {
workspace()->notifyTilingWindowMove(this, moveResizeGeom, initialMoveResizeGeom);
#ifdef KWIN_BUILD_SCREENEDGES
workspace()->screenEdge()->check(globalPos, xTime());
#endif
}
}

View File

@ -4,7 +4,9 @@ add_subdirectory( kwinoptions )
add_subdirectory( kwindecoration )
add_subdirectory( kwinrules )
add_subdirectory( kwincompositing )
add_subdirectory( kwinscreenedges )
if(KWIN_BUILD_SCREENEDGES)
add_subdirectory( kwinscreenedges )
endif(KWIN_BUILD_SCREENEDGES)
add_subdirectory( kwindesktop )
if( KWIN_BUILD_TABBOX )

View File

@ -79,7 +79,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h"
#include "client.h"
#include "workspace.h"
#include "screenedge.h"
#include "tabbox.h"
#include "group.h"
#include "rules.h"
@ -155,12 +154,14 @@ void Workspace::propagateClients(bool propagate_new_clients)
// it ensures that no client will be ever shown above override-redirect
// windows (e.g. popups).
newWindowStack << (Window*)supportWindow->winId();
#ifdef KWIN_BUILD_SCREENEDGES
QVectorIterator<Window> it(m_screenEdge.windows());
while (it.hasNext()) {
if ((Window)it.next() != None) {
newWindowStack << (Window*)&it;
}
}
#endif
for (int i = stacking_order.size() - 1; i >= 0; i--) {
if (stacking_order.at(i)->hiddenPreview()) {
continue;

View File

@ -59,7 +59,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "unmanaged.h"
#include "deleted.h"
#include "effects.h"
#include "screenedge.h"
#include "tilinglayout.h"
#include "scripting/scripting.h"
@ -250,7 +249,9 @@ Workspace::Workspace(bool restore)
void Workspace::init()
{
#ifdef KWIN_BUILD_SCREENEDGES
m_screenEdge.init();
#endif
// Not used yet
//topDock = 0L;
@ -911,9 +912,11 @@ void Workspace::slotReconfigure()
kDebug(1212) << "Workspace::slotReconfigure()";
reconfigureTimer.stop();
#ifdef KWIN_BUILD_SCREENEDGES
m_screenEdge.reserveActions(false);
if (options->electricBorders() == Options::ElectricAlways)
m_screenEdge.reserveDesktopSwitching(false);
#endif
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
@ -955,10 +958,12 @@ void Workspace::slotReconfigure()
c->triggerDecorationRepaint();
}
#ifdef KWIN_BUILD_SCREENEDGES
m_screenEdge.reserveActions(true);
if (options->electricBorders() == Options::ElectricAlways)
m_screenEdge.reserveDesktopSwitching(true);
m_screenEdge.update();
#endif
if (!compositingSuspended) {
setupCompositing();
@ -1009,7 +1014,9 @@ void Workspace::slotReinitCompositing()
KGlobal::config()->reparseConfiguration();
// Update any settings that can be set in the compositing kcm.
#ifdef KWIN_BUILD_SCREENEDGES
m_screenEdge.update();
#endif
// Restart compositing
finishCompositing();
@ -1096,7 +1103,10 @@ QStringList Workspace::configModules(bool controlCenter)
#ifdef KWIN_BUILD_TABBOX
<< "kwintabbox"
#endif
<< "kwinscreenedges";
#ifdef KWIN_BUILD_SCREENEDGES
<< "kwinscreenedges"
#endif
;
return args;
}
@ -2092,10 +2102,12 @@ Outline* Workspace::outline()
return m_outline;
}
#ifdef KWIN_BUILD_SCREENEDGES
ScreenEdge* Workspace::screenEdge()
{
return &m_screenEdge;
}
#endif
bool Workspace::hasTabBox() const
{

View File

@ -38,7 +38,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h"
#include "kdecoration.h"
#include "kdecorationfactory.h"
#ifdef KWIN_BUILD_SCREENEDGES
#include "screenedge.h"
#endif
#include "sm.h"
#include <X11/Xlib.h>
@ -216,7 +218,9 @@ public:
Position supportedTilingResizeMode(Client *c, Position currentMode);
Outline* outline();
#ifdef KWIN_BUILD_SCREENEDGES
ScreenEdge* screenEdge();
#endif
//-------------------------------------------------
// Desktop layout
@ -327,7 +331,9 @@ private:
QVector<TilingLayout *> tilingLayouts;
Outline* m_outline;
#ifdef KWIN_BUILD_SCREENEDGES
ScreenEdge m_screenEdge;
#endif
//-------------------------------------------------
// Unsorted