generic: get rid of some OpenGL/OpenGLES requirements

This commit is contained in:
Ivailo Monev 2016-09-01 04:09:09 +00:00
parent 2be09982f0
commit 78ee666dd2
213 changed files with 525 additions and 25293 deletions

View file

@ -5,6 +5,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(CheckFunctionExists) include(CheckFunctionExists)
include(GenerateExportHeader)
find_package(KDE4 4.18.0 REQUIRED) find_package(KDE4 4.18.0 REQUIRED)
include(KDE4Defaults) include(KDE4Defaults)
@ -30,6 +31,7 @@ set_package_properties(OpenGL PROPERTIES
DESCRIPTION "The OpenGL libraries" DESCRIPTION "The OpenGL libraries"
URL "http://www.opengl.org" URL "http://www.opengl.org"
TYPE OPTIONAL TYPE OPTIONAL
PURPOSE "3D screensavers, OpenGL info module"
) )
macro_optional_find_package(OpenGLES) macro_optional_find_package(OpenGLES)
@ -37,6 +39,7 @@ set_package_properties(OpenGLES PROPERTIES
DESCRIPTION "The OpenGLES libraries" DESCRIPTION "The OpenGLES libraries"
URL "http://www.khronos.org/opengles" URL "http://www.khronos.org/opengles"
TYPE OPTIONAL TYPE OPTIONAL
PURPOSE "OpenGL ES info module"
) )
macro_optional_find_package(UDev) macro_optional_find_package(UDev)
@ -84,9 +87,6 @@ if(Q_WS_X11)
if(NOT X11_Xrandr_FOUND) if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support.") message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support.")
endif() endif()
if(NOT OPENGL_FOUND AND NOT OPENGLES_FOUND)
message(FATAL_ERROR "Either OpenGL or OpenGL ES 2.0 are required for Compositing support in KWin.")
endif()
if(NOT X11_Xcursor_FOUND) if(NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin.") message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin.")
endif() endif()

View file

@ -69,7 +69,6 @@ check_include_files(malloc.h HAVE_MALLOC_H)
check_function_exists(statfs HAVE_STATFS) check_function_exists(statfs HAVE_STATFS)
macro_bool_to_01(FONTCONFIG_FOUND HAVE_FONTCONFIG) # kcontrol/{fonts,kfontinst} macro_bool_to_01(FONTCONFIG_FOUND HAVE_FONTCONFIG) # kcontrol/{fonts,kfontinst}
macro_bool_to_01(FREETYPE_FOUND HAVE_FREETYPE) # kcontrol/fonts macro_bool_to_01(FREETYPE_FOUND HAVE_FREETYPE) # kcontrol/fonts
macro_bool_to_01(OPENGL_FOUND HAVE_OPENGL) # kwin
macro_bool_to_01(X11_XShm_FOUND HAVE_XSHM) # kwin, ksplash macro_bool_to_01(X11_XShm_FOUND HAVE_XSHM) # kwin, ksplash
macro_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # khotkeys, kxkb, kdm macro_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # khotkeys, kxkb, kdm
macro_bool_to_01(X11_Xcomposite_FOUND HAVE_XCOMPOSITE) # kicker, kwin macro_bool_to_01(X11_Xcomposite_FOUND HAVE_XCOMPOSITE) # kicker, kwin

View file

@ -31,9 +31,6 @@
/* Define if your system has XRender support */ /* Define if your system has XRender support */
#cmakedefine HAVE_XRENDER 1 #cmakedefine HAVE_XRENDER 1
/* Define if you have OpenGL */
#cmakedefine HAVE_OPENGL 1
/* Define if you have the XSync extension */ /* Define if you have the XSync extension */
#cmakedefine HAVE_XSYNC 1 #cmakedefine HAVE_XSYNC 1

View file

@ -4,27 +4,17 @@ add_subdirectory( infosummary )
add_subdirectory( memory ) add_subdirectory( memory )
add_subdirectory( devinfo ) add_subdirectory( devinfo )
add_subdirectory( info ) add_subdirectory( info )
add_subdirectory( samba ) add_subdirectory( samba )
add_subdirectory( nics ) add_subdirectory( nics )
add_feature_info("OpenGL support" OPENGL_FOUND "View OpenGL details in kinfocenter." ) add_feature_info("OpenGL support" OPENGL_FOUND "View OpenGL details in kinfocenter." )
add_feature_info("OpenGL/ES support" OPENGLES_FOUND "View OpenGL ES2.0 details in kinfocenter." ) add_feature_info("OpenGL/ES support" OPENGLES_FOUND "View OpenGL ES2.0 details in kinfocenter." )
if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND NOT KWIN_BUILD_WITH_OPENGLES) if((OPENGL_FOUND AND OPENGL_GLU_FOUND) OR OPENGLES_FOUND)
set( KCM_ENABLE_OPENGL 1 )
endif(OPENGL_FOUND AND OPENGL_GLU_FOUND AND NOT KWIN_BUILD_WITH_OPENGLES)
if(OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES)
set( KCM_ENABLE_OPENGLES 1 )
endif(OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES)
if(KCM_ENABLE_OPENGL OR KCM_ENABLE_OPENGLES)
add_subdirectory( opengl ) add_subdirectory( opengl )
else(KCM_ENABLE_OPENGL OR KCM_ENABLE_OPENGLES) else()
MESSAGE(STATUS "OpenGL/ES2.0 information module has been disabled.") message(STATUS "OpenGL/ES2.0 information module has been disabled.")
endif(KCM_ENABLE_OPENGL OR KCM_ENABLE_OPENGLES) endif()
macro_optional_find_package(PCIUTILS) macro_optional_find_package(PCIUTILS)
set_package_properties(PCIUTILS PROPERTIES DESCRIPTION "PciUtils is a library for direct access to PCI slots" set_package_properties(PCIUTILS PROPERTIES DESCRIPTION "PciUtils is a library for direct access to PCI slots"

View file

@ -1,19 +1,14 @@
if(KCM_ENABLE_OPENGL) if(OPENGL_FOUND AND OPENGL_GLU_FOUND)
include_directories( ${OPENGL_INCLUDE_DIR} ${OPENGL_GLU_INCLUDE_DIR} ) include_directories( ${OPENGL_INCLUDE_DIR} ${OPENGL_GLU_INCLUDE_DIR} )
endif(KCM_ENABLE_OPENGL) endif()
if(KCM_ENABLE_OPENGLES) if(OPENGLES_FOUND)
include_directories( ${OPENGLES_INCLUDE_DIR} ) include_directories( ${OPENGLES_INCLUDE_DIR} )
endif(KCM_ENABLE_OPENGLES) endif()
########### next target ############### ########### next target ###############
set(KCM_OPENGL_PART_SRCS opengl.cpp ) kde4_add_plugin(kcm_opengl opengl.cpp)
set(KCM_OPENGL_PART_UIS opengl.ui )
qt4_wrap_ui(KCM_OPENGL_PART_UIS_H ${KCM_OPENGL_PART_UIS})
kde4_add_plugin(kcm_opengl ${KCM_OPENGL_PART_SRCS} ${KCM_OPENGL_PART_UIS_H})
target_link_libraries(kcm_opengl ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_X11_LIB}) target_link_libraries(kcm_opengl ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_X11_LIB})
@ -22,13 +17,13 @@ if (DL_LIBRARY)
target_link_libraries(kcm_opengl ${DL_LIBRARY}) target_link_libraries(kcm_opengl ${DL_LIBRARY})
endif(DL_LIBRARY) endif(DL_LIBRARY)
if(KCM_ENABLE_OPENGL) if(OPENGL_FOUND AND OPENGL_GLU_FOUND)
target_link_libraries(kcm_opengl ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) target_link_libraries(kcm_opengl ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
endif(KCM_ENABLE_OPENGL) endif()
if(KCM_ENABLE_OPENGLES) if(OPENGLES_FOUND)
target_link_libraries(kcm_opengl ${OPENGLES_LIBRARIES}) target_link_libraries(kcm_opengl ${OPENGLES_LIBRARIES})
endif(KCM_ENABLE_OPENGLES) endif()
configure_file(openglconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/openglconfig.h ) configure_file(openglconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/openglconfig.h )

View file

@ -3,12 +3,5 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libkscreensaver)
add_subdirectory( libkscreensaver ) add_subdirectory( libkscreensaver )
add_subdirectory( kblank_screensaver ) add_subdirectory( kblank_screensaver )
add_subdirectory( krandom_screensaver ) add_subdirectory( krandom_screensaver )
macro_optional_find_package(OpenGL)
macro_log_feature(OPENGL_FOUND "OpenGL" "API for developing portable, interactive 2D and 3D graphics applications"
"http://mesa3d.sourceforge.net"
FALSE
""
"Provides 3D screensavers.")
add_subdirectory( kdesavers ) add_subdirectory( kdesavers )
add_subdirectory( kpartsaver ) add_subdirectory( kpartsaver )

View file

@ -1,11 +1,15 @@
project(kstyle-oxygen) project(kstyle-oxygen)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/debug
${CMAKE_SOURCE_DIR}/libs/oxygen
${CMAKE_BINARY_DIR}/libs/oxygen
)
add_subdirectory( config ) add_subdirectory( config )
add_subdirectory( demo ) add_subdirectory( demo )
include_directories (animations debug transitions ${CMAKE_SOURCE_DIR}/libs/oxygen)
########### next target ############### ########### next target ###############
set(oxygen_PART_SRCS set(oxygen_PART_SRCS

View file

@ -6,38 +6,13 @@ OPTION(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) 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_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON)
OPTION(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON) OPTION(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON)
OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON) OPTION(KWIN_BUILD_COMPOSITE "Enable building of KWin with XRender Compositing support" ON)
OPTION(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
if( KWIN_BUILD_XRENDER_COMPOSITING )
set( KWIN_HAVE_XRENDER_COMPOSITING 1 )
endif()
if(OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(OPENGL_EGL_FOUND)
include_directories(${OPENGLES_EGL_INCLUDE_DIR})
set(KWIN_HAVE_EGL 1)
endif()
if(OPENGLES_FOUND)
include_directories(${OPENGLES_INCLUDE_DIR})
endif()
include_directories(${XCB_INCLUDE_DIR}) include_directories(${XCB_INCLUDE_DIR})
# for things that are also used by kwin libraries
configure_file(
libkwineffects/kwinconfig.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h
)
# for kwin internal things # for kwin internal things
configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h) configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h)
########### global ############### ########### global ###############
include_directories(BEFORE include_directories(BEFORE
@ -57,8 +32,6 @@ if(KWIN_BUILD_KCMS)
endif() endif()
add_subdirectory( clients ) add_subdirectory( clients )
add_subdirectory( data )
add_subdirectory( effects ) add_subdirectory( effects )
add_subdirectory( tabbox ) add_subdirectory( tabbox )
@ -101,10 +74,7 @@ set(kwin_SRCS
unmanaged.cpp unmanaged.cpp
scene.cpp scene.cpp
scene_xrender.cpp scene_xrender.cpp
scene_opengl.cpp
glxbackend.cpp
thumbnailitem.cpp thumbnailitem.cpp
lanczosfilter.cpp
deleted.cpp deleted.cpp
effects.cpp effects.cpp
compositingprefs.cpp compositingprefs.cpp
@ -140,10 +110,6 @@ if(KWIN_BUILD_KAPPMENU)
) )
endif() endif()
if(KWIN_HAVE_EGL)
set(kwin_SRCS ${kwin_SRCS} eglonxbackend.cpp)
endif()
kde4_add_kcfg_files(kwin_SRCS settings.kcfgc) kde4_add_kcfg_files(kwin_SRCS settings.kcfgc)
qt4_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface) qt4_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
@ -151,11 +117,11 @@ qt4_add_dbus_adaptor( kwin_SRCS org.kde.kwin.Compositing.xml composite.h KWin::C
qt4_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl) qt4_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl)
qt4_add_dbus_interface(kwin_SRCS qt4_add_dbus_interface(kwin_SRCS
${CMAKE_SOURCE_DIR}/ksmserver/org.kde.KSMServerInterface.xml ksmserver_interface) ${CMAKE_SOURCE_DIR}/ksmserver/org.kde.KSMServerInterface.xml ksmserver_interface
)
qt4_add_dbus_interface(kwin_SRCS qt4_add_dbus_interface(kwin_SRCS
${CMAKE_SOURCE_DIR}/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml screenlocker_interface) ${CMAKE_SOURCE_DIR}/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml screenlocker_interface
)
qt4_add_resources( kwin_SRCS resources.qrc )
########### target link libraries ############### ########### target link libraries ###############
@ -199,8 +165,6 @@ set(kwin_XCB_LIBS
${XCB_KEYSYMS_LIBRARIES} ${XCB_KEYSYMS_LIBRARIES}
) )
set(kwin_OPENGL_LIBS )
find_library(XF86VM_LIBRARY Xxf86vm) find_library(XF86VM_LIBRARY Xxf86vm)
if (XF86VM_LIBRARY) if (XF86VM_LIBRARY)
set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY}) set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY})
@ -208,48 +172,20 @@ else()
add_definitions(-DKWIN_NO_XF86VM) add_definitions(-DKWIN_NO_XF86VM)
endif() endif()
if(OPENGL_EGL_FOUND)
set(kwin_OPENGL_LIBS ${kwin_OPENGL_LIBS} ${OPENGLES_EGL_LIBRARY})
endif()
set(kwinLibs set(kwinLibs
${kwin_OWN_LIBS} ${kwin_OWN_LIBS}
${kwin_QT_LIBS} ${kwin_QT_LIBS}
${kwin_KDE_LIBS} ${kwin_KDE_LIBS}
${kwin_XLIB_LIBS} ${kwin_XLIB_LIBS}
${kwin_XCB_LIBS} ${kwin_XCB_LIBS}
${kwin_OPENGL_LIBS}
) )
add_executable(kwin ${kwin_SRCS}) add_executable(kwin ${kwin_SRCS})
target_link_libraries(kwin ${kwinLibs}) target_link_libraries(kwin ${kwinLibs})
if(OPENGL_FOUND)
if( KWIN_BUILD_OPENGL_1_COMPOSITING )
set_target_properties(kwin PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1)
endif()
add_subdirectory(opengltest)
target_link_libraries(kwin kwinglutils ${OPENGL_gl_LIBRARY})
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
target_link_libraries(kwin ${DL_LIBRARY})
endif()
elseif(OPENGLES_FOUND)
target_link_libraries(kwin ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES})
set_target_properties(kwin PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
endif()
install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS})
if(OPENGLES_FOUND)
add_executable( kwin_gles ${kwin_SRCS})
target_link_libraries(kwin_gles ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES})
set_target_properties(kwin_gles PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
install(TARGETS kwin_gles ${INSTALL_TARGETS_DEFAULT_ARGS} )
endif()
########### install files ############### ########### install files ###############
install(FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME kwin.kcfg) install(FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME kwin.kcfg)

View file

@ -1,4 +0,0 @@
#! /bin/sh
#This file outputs in a separate line each file with a .desktop syntax
#that needs to be translated but has a non .desktop extension
find -name \*.kwinrules -print

View file

@ -28,7 +28,7 @@ namespace KWin
class Client; class Client;
class Bridge : public KDecorationBridgeUnstable class Bridge : public KDecorationBridge
{ {
public: public:
explicit Bridge(Client* cl); explicit Bridge(Client* cl);

View file

@ -461,8 +461,7 @@ void Client::createDecoration(const QRect& oldgeom)
decoration->widget()->lower(); decoration->widget()->lower();
decoration->borders(border_left, border_right, border_top, border_bottom); decoration->borders(border_left, border_right, border_top, border_bottom);
padding_left = padding_right = padding_top = padding_bottom = 0; padding_left = padding_right = padding_top = padding_bottom = 0;
if (KDecorationUnstable *deco2 = dynamic_cast<KDecorationUnstable*>(decoration)) decoration->padding(padding_left, padding_right, padding_top, padding_bottom);
deco2->padding(padding_left, padding_right, padding_top, padding_bottom);
Xcb::moveWindow(decoration->widget()->winId(), -padding_left, -padding_top); Xcb::moveWindow(decoration->widget()->winId(), -padding_left, -padding_top);
move(calculateGravitation(false)); move(calculateGravitation(false));
plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); plainResize(sizeForClientSize(clientSize()), ForceGeometrySet);
@ -500,8 +499,7 @@ bool Client::checkBorderSizes(bool also_resize)
return false; return false;
int new_left = 0, new_right = 0, new_top = 0, new_bottom = 0; int new_left = 0, new_right = 0, new_top = 0, new_bottom = 0;
if (KDecorationUnstable *deco2 = dynamic_cast<KDecorationUnstable*>(decoration)) decoration->padding(new_left, new_right, new_top, new_bottom);
deco2->padding(new_left, new_right, new_top, new_bottom);
if (padding_left != new_left || padding_top != new_top) if (padding_left != new_left || padding_top != new_top)
Xcb::moveWindow(decoration->widget()->winId(), -new_left, -new_top); Xcb::moveWindow(decoration->widget()->winId(), -new_left, -new_top);
padding_left = new_left; padding_left = new_left;

View file

@ -40,7 +40,7 @@ namespace Aurorae
AuroraeFactory::AuroraeFactory() AuroraeFactory::AuroraeFactory()
: QObject() : QObject()
, KDecorationFactoryUnstable() , KDecorationFactory()
, m_theme(new AuroraeTheme(this)) , m_theme(new AuroraeTheme(this))
, m_engine(new QDeclarativeEngine(this)) , m_engine(new QDeclarativeEngine(this))
, m_component(new QDeclarativeComponent(m_engine, this)) , m_component(new QDeclarativeComponent(m_engine, this))
@ -186,7 +186,6 @@ bool AuroraeFactory::reset(unsigned long changed)
bool AuroraeFactory::supports(Ability ability) const bool AuroraeFactory::supports(Ability ability) const
{ {
switch (ability) { switch (ability) {
case AbilityAnnounceButtons:
case AbilityUsesAlphaChannel: case AbilityUsesAlphaChannel:
case AbilityAnnounceAlphaChannel: case AbilityAnnounceAlphaChannel:
case AbilityButtonMenu: case AbilityButtonMenu:
@ -238,7 +237,7 @@ AuroraeFactory *AuroraeFactory::s_instance = NULL;
* Client * Client
*******************************************************/ *******************************************************/
AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory) AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory)
: KDecorationUnstable(bridge, factory) : KDecoration(bridge, factory)
, m_view(NULL) , m_view(NULL)
, m_scene(new QGraphicsScene(this)) , m_scene(new QGraphicsScene(this))
, m_item(AuroraeFactory::instance()->createQmlDecoration(this)) , m_item(AuroraeFactory::instance()->createQmlDecoration(this))
@ -305,7 +304,7 @@ bool AuroraeClient::eventFilter(QObject *object, QEvent *event)
// TODO: remove in KDE5 // TODO: remove in KDE5
// see BUG: 304248 // see BUG: 304248
if (object != widget() || event->type() != QEvent::Wheel) { if (object != widget() || event->type() != QEvent::Wheel) {
return KDecorationUnstable::eventFilter(object, event); return KDecoration::eventFilter(object, event);
} }
QWheelEvent *wheel = static_cast<QWheelEvent*>(event); QWheelEvent *wheel = static_cast<QWheelEvent*>(event);
if (mousePosition(wheel->pos()) == PositionCenter) { if (mousePosition(wheel->pos()) == PositionCenter) {
@ -544,12 +543,12 @@ int AuroraeClient::doubleClickInterval() const
void AuroraeClient::closeWindow() void AuroraeClient::closeWindow()
{ {
QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), "doCloseWindow", Qt::QueuedConnection); QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doCloseWindow", Qt::QueuedConnection);
} }
void AuroraeClient::doCloseWindow() void AuroraeClient::doCloseWindow()
{ {
KDecorationUnstable::closeWindow(); KDecoration::closeWindow();
} }
void AuroraeClient::maximize(int button) void AuroraeClient::maximize(int button)
@ -557,7 +556,7 @@ void AuroraeClient::maximize(int button)
// a maximized window does not need to have a window decoration // a maximized window does not need to have a window decoration
// in that case we need to delay handling by one cycle // in that case we need to delay handling by one cycle
// BUG: 304870 // BUG: 304870
QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this),
"doMaximzie", "doMaximzie",
Qt::QueuedConnection, Qt::QueuedConnection,
Q_ARG(int, button)); Q_ARG(int, button));
@ -565,19 +564,19 @@ void AuroraeClient::maximize(int button)
void AuroraeClient::doMaximzie(int button) void AuroraeClient::doMaximzie(int button)
{ {
KDecorationUnstable::maximize(static_cast<Qt::MouseButton>(button)); KDecoration::maximize(static_cast<Qt::MouseButton>(button));
} }
void AuroraeClient::titlebarDblClickOperation() void AuroraeClient::titlebarDblClickOperation()
{ {
// the double click operation can result in a window being maximized // the double click operation can result in a window being maximized
// see maximize // see maximize
QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), "doTitlebarDblClickOperation", Qt::QueuedConnection); QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doTitlebarDblClickOperation", Qt::QueuedConnection);
} }
void AuroraeClient::doTitlebarDblClickOperation() void AuroraeClient::doTitlebarDblClickOperation()
{ {
KDecorationUnstable::titlebarDblClickOperation(); KDecoration::titlebarDblClickOperation();
} }
QVariant AuroraeClient::readConfig(const QString &key, const QVariant &defaultValue) QVariant AuroraeClient::readConfig(const QString &key, const QVariant &defaultValue)

View file

@ -37,7 +37,7 @@ namespace Aurorae
class AuroraeTheme; class AuroraeTheme;
class AuroraeClient; class AuroraeClient;
class AuroraeFactory : public QObject, public KDecorationFactoryUnstable class AuroraeFactory : public QObject, public KDecorationFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -82,7 +82,7 @@ private:
QString m_themeName; QString m_themeName;
}; };
class AuroraeClient : public KDecorationUnstable class AuroraeClient : public KDecoration
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)

View file

@ -1,11 +1,11 @@
########### add version number into compilation defines include_directories(
# FIXME: CPACK_PACKAGE_VERSION_* are empty ${CMAKE_SOURCE_DIR}/libs/oxygen
add_definitions ( -DAPP_VERSION=\\\"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\\\") ${CMAKE_BINARY_DIR}/libs/oxygen
)
add_subdirectory( config ) add_subdirectory( config )
add_subdirectory( demo ) add_subdirectory( demo )
include_directories(${CMAKE_SOURCE_DIR}/libs/oxygen)
########### next target ############### ########### next target ###############
set(kwin_oxygen_SRCS set(kwin_oxygen_SRCS
oxygenbutton.cpp oxygenbutton.cpp
@ -20,11 +20,9 @@ set(kwin_oxygen_SRCS
kde4_add_kcfg_files(kwin_oxygen_SRCS oxygenconfiguration.kcfgc) kde4_add_kcfg_files(kwin_oxygen_SRCS oxygenconfiguration.kcfgc)
kde4_add_plugin(kwin3_oxygen ${kwin_oxygen_SRCS}) kde4_add_plugin(kwin3_oxygen ${kwin_oxygen_SRCS})
target_link_libraries( target_link_libraries(kwin3_oxygen
kwin3_oxygen
${KDE4_KDEUI_LIBS} ${KDE4_KDEUI_LIBS}
${X11_X11_LIB} ${X11_X11_LIB}
${X11_Xrender_LIB}
kdecorations kdecorations
oxygenstyle oxygenstyle
) )
@ -32,5 +30,4 @@ target_link_libraries(
install(TARGETS kwin3_oxygen DESTINATION ${PLUGIN_INSTALL_DIR}) install(TARGETS kwin3_oxygen DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ############### ########### install files ###############
install( FILES oxygenclient.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin/ ) install(FILES oxygenclient.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin)

View file

@ -8,20 +8,14 @@ set(kwin_oxygen_config_PART_SRCS
oxygenexceptionlistwidget.cpp oxygenexceptionlistwidget.cpp
oxygenexceptionmodel.cpp oxygenexceptionmodel.cpp
../oxygenexceptionlist.cpp ../oxygenexceptionlist.cpp
oxygenconfigurationui.ui
oxygendetectwidget.ui
oxygenexceptiondialog.ui
oxygenexceptionlistwidget.ui
) )
kde4_add_kcfg_files(kwin_oxygen_config_PART_SRCS ../oxygenconfiguration.kcfgc ) kde4_add_kcfg_files(kwin_oxygen_config_PART_SRCS ../oxygenconfiguration.kcfgc )
kde4_add_plugin(kwin_oxygen_config ${kwin_oxygen_config_PART_SRCS}) kde4_add_plugin(kwin_oxygen_config ${kwin_oxygen_config_PART_SRCS})
target_link_libraries( target_link_libraries(kwin_oxygen_config
kwin_oxygen_config
${KDE4_KDEUI_LIBS} ${KDE4_KDEUI_LIBS}
${QT_QTGUI_LIBRARY}
${X11_X11_LIB} ${X11_X11_LIB}
kdecorations kdecorations
oxygenstyle oxygenstyle

View file

@ -38,6 +38,7 @@
#include <QtDBus/QDBusConnection> #include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusMessage> #include <QtDBus/QDBusMessage>
#include <kdemacros.h>
#include <KAboutData> #include <KAboutData>
#include <KAboutApplicationDialog> #include <KAboutApplicationDialog>
#include <KConfigGroup> #include <KConfigGroup>

View file

@ -16,7 +16,6 @@ add_executable(oxygen-shadow-demo ${oxygen_shadow_demo_SOURCES})
target_link_libraries(oxygen-shadow-demo target_link_libraries(oxygen-shadow-demo
${KDE4_KDEUI_LIBS} ${KDE4_KDEUI_LIBS}
${X11_X11_LIB} ${X11_X11_LIB}
${X11_Xrender_LIB}
${KDE4_KIO_LIBS} ${KDE4_KIO_LIBS}
oxygenstyle oxygenstyle
) )

View file

@ -55,7 +55,7 @@ namespace Oxygen
//___________________________________________ //___________________________________________
Client::Client(KDecorationBridge *b, Factory *f): Client::Client(KDecorationBridge *b, Factory *f):
KCommonDecorationUnstable(b, f), KCommonDecoration(b, f),
_factory( f ), _factory( f ),
_sizeGrip( 0 ), _sizeGrip( 0 ),
_initialized( false ), _initialized( false ),
@ -122,7 +122,7 @@ namespace Oxygen
//___________________________________________ //___________________________________________
void Client::reset( unsigned long changed ) void Client::reset( unsigned long changed )
{ {
KCommonDecorationUnstable::reset( changed ); KCommonDecoration::reset( changed );
// update window mask when compositing is changed // update window mask when compositing is changed
if( !_initialized ) return; if( !_initialized ) return;
@ -1132,7 +1132,7 @@ namespace Oxygen
void Client::activeChange( void ) void Client::activeChange( void )
{ {
KCommonDecorationUnstable::activeChange(); KCommonDecoration::activeChange();
_itemData.setDirty( true ); _itemData.setDirty( true );
// update size grip so that it gets the right color // update size grip so that it gets the right color
@ -1151,21 +1151,21 @@ namespace Oxygen
{ {
if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) ); if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) );
setAlphaEnabled(!isMaximized()); setAlphaEnabled(!isMaximized());
KCommonDecorationUnstable::maximizeChange(); KCommonDecoration::maximizeChange();
} }
//_________________________________________________________ //_________________________________________________________
void Client::shadeChange( void ) void Client::shadeChange( void )
{ {
if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) ); if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) );
KCommonDecorationUnstable::shadeChange(); KCommonDecoration::shadeChange();
} }
//_________________________________________________________ //_________________________________________________________
void Client::captionChange( void ) void Client::captionChange( void )
{ {
KCommonDecorationUnstable::captionChange(); KCommonDecoration::captionChange();
_itemData.setDirty( true ); _itemData.setDirty( true );
} }
@ -1275,7 +1275,7 @@ namespace Oxygen
default: break; default: break;
} }
return state || KCommonDecorationUnstable::eventFilter( object, event ); return state || KCommonDecoration::eventFilter( object, event );
} }
@ -1291,7 +1291,7 @@ namespace Oxygen
{ _pixmap = QPixmap( event->size() ); } { _pixmap = QPixmap( event->size() ); }
// base class implementation // base class implementation
KCommonDecorationUnstable::resizeEvent( event ); KCommonDecoration::resizeEvent( event );
} }
//_________________________________________________________ //_________________________________________________________
@ -1727,7 +1727,7 @@ namespace Oxygen
{ {
if( event->timerId() != _dragStartTimer.timerId() ) if( event->timerId() != _dragStartTimer.timerId() )
{ return KCommonDecorationUnstable::timerEvent( event ); } { return KCommonDecoration::timerEvent( event ); }
_dragStartTimer.stop(); _dragStartTimer.stop();

View file

@ -45,7 +45,7 @@ namespace Oxygen
{ {
class SizeGrip; class SizeGrip;
class Client : public KCommonDecorationUnstable class Client : public KCommonDecoration
{ {
Q_OBJECT Q_OBJECT
@ -172,7 +172,7 @@ namespace Oxygen
//! frame border //! frame border
inline int frameBorder( void ) const; inline int frameBorder( void ) const;
//!@name status change methods (overloaded from KCommonDecorationUnstable) //!@name status change methods (overloaded from KCommonDecoration)
//@{ //@{
//! triggered when window activity is changed //! triggered when window activity is changed

View file

@ -115,11 +115,6 @@ namespace Oxygen
{ {
switch( ability ) switch( ability )
{ {
// announce
case AbilityAnnounceButtons:
case AbilityAnnounceColors:
// buttons // buttons
case AbilityButtonMenu: case AbilityButtonMenu:
case AbilityButtonApplicationMenu: case AbilityButtonApplicationMenu:

View file

@ -54,7 +54,7 @@ namespace Oxygen
}; };
//! window decoration factory //! window decoration factory
class Factory: public QObject, public KDecorationFactoryUnstable class Factory: public QObject, public KDecorationFactory
{ {
Q_OBJECT Q_OBJECT

View file

@ -17,10 +17,12 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include "composite.h"
#include "compositingadaptor.h"
#include <config-X11.h> #include <config-X11.h>
#include <config-kwin.h>
#include "composite.h"
#include "compositingadaptor.h"
#include "utils.h" #include "utils.h"
#include <QTextStream> #include <QTextStream>
@ -32,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "overlaywindow.h" #include "overlaywindow.h"
#include "scene.h" #include "scene.h"
#include "scene_xrender.h" #include "scene_xrender.h"
#include "scene_opengl.h"
#include "shadow.h" #include "shadow.h"
#include "useractions.h" #include "useractions.h"
#include "compositingprefs.h" #include "compositingprefs.h"
@ -144,7 +145,6 @@ void Compositor::setup()
m_starting = true; m_starting = true;
if (!options->isCompositingInitialized()) { if (!options->isCompositingInitialized()) {
#ifndef KWIN_HAVE_OPENGLES
// options->reloadCompositingSettings(true) initializes the CompositingPrefs which calls an // options->reloadCompositingSettings(true) initializes the CompositingPrefs which calls an
// external program in turn // external program in turn
// run this in an external thread to make startup faster. // run this in an external thread to make startup faster.
@ -152,11 +152,6 @@ void Compositor::setup()
connect(compositingPrefsFuture, SIGNAL(finished()), this, SLOT(slotCompositingOptionsInitialized())); connect(compositingPrefsFuture, SIGNAL(finished()), this, SLOT(slotCompositingOptionsInitialized()));
connect(compositingPrefsFuture, SIGNAL(finished()), compositingPrefsFuture, SLOT(deleteLater())); connect(compositingPrefsFuture, SIGNAL(finished()), compositingPrefsFuture, SLOT(deleteLater()));
compositingPrefsFuture->setFuture(QtConcurrent::run(options, &Options::reloadCompositingSettings, true)); compositingPrefsFuture->setFuture(QtConcurrent::run(options, &Options::reloadCompositingSettings, true));
#else
// OpenGL ES does not call the external program, so no need to create a thread
options->reloadCompositingSettings(true);
slotCompositingOptionsInitialized();
#endif
} else { } else {
slotCompositingOptionsInitialized(); slotCompositingOptionsInitialized();
} }
@ -184,44 +179,7 @@ void Compositor::slotCompositingOptionsInitialized()
} }
switch(options->compositingMode()) { switch(options->compositingMode()) {
case OpenGLCompositing: { #ifdef KWIN_BUILD_COMPOSITE
kDebug(1212) << "Initializing OpenGL compositing";
// Some broken drivers crash on glXQuery() so to prevent constant KWin crashes:
KSharedConfigPtr unsafeConfigPtr = KGlobal::config();
KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing");
const QString openGLIsUnsafe = "OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "");
if (unsafeConfig.readEntry(openGLIsUnsafe, false))
kWarning(1212) << "KWin has detected that your OpenGL library is unsafe to use";
else {
unsafeConfig.writeEntry(openGLIsUnsafe, true);
unsafeConfig.sync();
#ifndef KWIN_HAVE_OPENGLES
if (!CompositingPrefs::hasGlx()) {
unsafeConfig.writeEntry(openGLIsUnsafe, false);
unsafeConfig.sync();
kDebug(1212) << "No glx extensions available";
break;
}
#endif
m_scene = SceneOpenGL::createScene();
connect(m_scene, SIGNAL(resetCompositing()), SLOT(restart()));
// TODO: Add 30 second delay to protect against screen freezes as well
unsafeConfig.writeEntry(openGLIsUnsafe, false);
unsafeConfig.sync();
if (m_scene && !m_scene->initFailed())
break; // -->
delete m_scene;
m_scene = NULL;
}
// Do not Fall back to XRender - it causes problems when selfcheck fails during startup, but works later on
break;
}
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
case XRenderCompositing: case XRenderCompositing:
kDebug(1212) << "Initializing XRender compositing"; kDebug(1212) << "Initializing XRender compositing";
m_scene = new SceneXrender(Workspace::self()); m_scene = new SceneXrender(Workspace::self());
@ -381,23 +339,6 @@ void Compositor::deleteUnusedSupportProperties()
} }
} }
// OpenGL self-check failed, fallback to XRender
void Compositor::fallbackToXRenderCompositing()
{
finish();
KConfigGroup config(KGlobal::config(), "Compositing");
config.writeEntry("Backend", "XRender");
config.writeEntry("GraphicsSystem", "native");
config.sync();
if (Extensions::nonNativePixmaps()) { // must restart to change the graphicssystem
restartKWin("automatic graphicssystem change for XRender backend");
return;
} else {
options->setCompositingMode(XRenderCompositing);
setup();
}
}
void Compositor::slotConfigChanged() void Compositor::slotConfigChanged()
{ {
if (!m_suspended) { if (!m_suspended) {
@ -586,15 +527,6 @@ void Compositor::performCompositing()
// Get the replies // Get the replies
foreach (Toplevel *win, damaged) { foreach (Toplevel *win, damaged) {
// Discard the cached lanczos texture
if (win->effectWindow()) {
const QVariant texture = win->effectWindow()->data(LanczosCacheRole);
if (texture.isValid()) {
delete static_cast<GLTexture *>(texture.value<void*>());
win->effectWindow()->setData(LanczosCacheRole, QVariant());
}
}
win->getDamageRegionReply(); win->getDamageRegionReply();
} }
@ -820,11 +752,6 @@ QString Compositor::compositingNotPossibleReason() const
return CompositingPrefs::compositingNotPossibleReason(); return CompositingPrefs::compositingNotPossibleReason();
} }
bool Compositor::isOpenGLBroken() const
{
return CompositingPrefs::openGlIsBroken();
}
QString Compositor::compositingType() const QString Compositor::compositingType() const
{ {
if (!hasScene()) { if (!hasScene()) {
@ -833,14 +760,6 @@ QString Compositor::compositingType() const
switch (m_scene->compositingType()) { switch (m_scene->compositingType()) {
case XRenderCompositing: case XRenderCompositing:
return "xrender"; return "xrender";
case OpenGL1Compositing:
return "gl1";
case OpenGL2Compositing:
#ifdef KWIN_HAVE_OPENGLES
return "gles";
#else
return "gl2";
#endif
case NoCompositing: case NoCompositing:
default: default:
return "none"; return "none";

View file

@ -66,17 +66,10 @@ class Compositor : public QObject {
* @brief The reason why compositing is not possible. Empty String if compositing is possible. * @brief The reason why compositing is not possible. Empty String if compositing is possible.
**/ **/
Q_PROPERTY(QString compositingNotPossibleReason READ compositingNotPossibleReason) Q_PROPERTY(QString compositingNotPossibleReason READ compositingNotPossibleReason)
/**
* @brief Whether OpenGL has failed badly in the past (crash) and is considered as broken.
**/
Q_PROPERTY(bool openGLIsBroken READ isOpenGLBroken)
/** /**
* The type of the currently used Scene: * The type of the currently used Scene:
* @li @c none No Compositing * @li @c none No Compositing
* @li @c xrender XRender * @li @c xrender XRender
* @li @c gl1 OpenGL 1
* @li @c gl2 OpenGL 2
* @li @c gles OpenGL ES 2
**/ **/
Q_PROPERTY(QString compositingType READ compositingType) Q_PROPERTY(QString compositingType READ compositingType)
public: public:
@ -149,7 +142,6 @@ public:
// D-Bus: getters for Properties, see documentation on the property // D-Bus: getters for Properties, see documentation on the property
bool isCompositingPossible() const; bool isCompositingPossible() const;
QString compositingNotPossibleReason() const; QString compositingNotPossibleReason() const;
bool isOpenGLBroken() const;
QString compositingType() const; QString compositingType() const;
public Q_SLOTS: public Q_SLOTS:
@ -179,8 +171,7 @@ public Q_SLOTS:
* *
* Note: it is possible that the Compositor cannot be resumed, that is there might be Clients * Note: it is possible that the Compositor cannot be resumed, that is there might be Clients
* blocking the usage of Compositing or the Scene might be broken. Use @link isActive to check * blocking the usage of Compositing or the Scene might be broken. Use @link isActive to check
* whether the Compositor has been resumed. Also check @link isCompositingPossible and * whether the Compositor has been resumed. Also check @link isCompositingPossible.
* @link isOpenGLBroken.
* *
* Note: The starting of the Compositor can require some time and is partially done threaded. * Note: The starting of the Compositor can require some time and is partially done threaded.
* After this method returns the setup may not have been completed. * After this method returns the setup may not have been completed.
@ -189,7 +180,6 @@ public Q_SLOTS:
* @see suspend * @see suspend
* @see isActive * @see isActive
* @see isCompositingPossible * @see isCompositingPossible
* @see isOpenGLBroken
**/ **/
Q_SCRIPTABLE inline void resume() { resume(ScriptSuspend); } Q_SCRIPTABLE inline void resume() { resume(ScriptSuspend); }
void resume(Compositor::SuspendReason reason); void resume(Compositor::SuspendReason reason);
@ -216,7 +206,6 @@ public Q_SLOTS:
* @see resume * @see resume
* @see isActive * @see isActive
* @see isCompositingPossible * @see isCompositingPossible
* @see isOpenGLBroken
**/ **/
// NOTICE this is atm. for script usage *ONLY* and needs to be extended like resume / suspend are // NOTICE this is atm. for script usage *ONLY* and needs to be extended like resume / suspend are
// if intended to be used from within KWin code! // if intended to be used from within KWin code!
@ -263,7 +252,6 @@ private Q_SLOTS:
* That is the Compositor will be stopped and started again. * That is the Compositor will be stopped and started again.
**/ **/
void restart(); void restart();
void fallbackToXRenderCompositing();
void performCompositing(); void performCompositing();
void delayedCheckUnredirect(); void delayedCheckUnredirect();
void slotConfigChanged(); void slotConfigChanged();

View file

@ -18,10 +18,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include "config-kwin.h"
#include "compositingprefs.h" #include "compositingprefs.h"
#include "xcbutils.h" #include "xcbutils.h"
#include "kwinglplatform.h"
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <kdebug.h> #include <kdebug.h>
@ -42,7 +43,6 @@ extern int screen_number; // main.cpp
extern bool is_multihead; extern bool is_multihead;
CompositingPrefs::CompositingPrefs() CompositingPrefs::CompositingPrefs()
: mEnableDirectRendering(true)
{ {
} }
@ -50,21 +50,8 @@ CompositingPrefs::~CompositingPrefs()
{ {
} }
bool CompositingPrefs::openGlIsBroken()
{
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
return KConfigGroup(KGlobal::config(), "Compositing").readEntry(unsafeKey, false);
}
bool CompositingPrefs::compositingPossible() bool CompositingPrefs::compositingPossible()
{ {
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
gl_workaround_group.readEntry(unsafeKey, false))
return false;
if (!Xcb::Extensions::self()->isCompositeAvailable()) { if (!Xcb::Extensions::self()->isCompositeAvailable()) {
kDebug(1212) << "No composite extension available"; kDebug(1212) << "No composite extension available";
return false; return false;
@ -73,93 +60,26 @@ bool CompositingPrefs::compositingPossible()
kDebug(1212) << "No damage extension available"; kDebug(1212) << "No damage extension available";
return false; return false;
} }
if (hasGlx()) #ifdef KWIN_BUILD_COMPOSITE
return true;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()) if (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable())
return true; return true;
#endif #endif
#ifdef KWIN_HAVE_OPENGLES kDebug(1212) << "No XRender/XFixes support";
return true;
#endif
kDebug(1212) << "No OpenGL or XRender/XFixes support";
return false; return false;
} }
QString CompositingPrefs::compositingNotPossibleReason() QString CompositingPrefs::compositingNotPossibleReason()
{ {
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
gl_workaround_group.readEntry(unsafeKey, false))
return i18n("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>"
"This was most likely due to a driver bug."
"<p>If you think that you have meanwhile upgraded to a stable driver,<br>"
"you can reset this protection but <b>be aware that this might result in an immediate crash!</b></p>"
"<p>Alternatively, you might want to use the XRender backend instead.</p>");
if (!Xcb::Extensions::self()->isCompositeAvailable() || !Xcb::Extensions::self()->isDamageAvailable()) { if (!Xcb::Extensions::self()->isCompositeAvailable() || !Xcb::Extensions::self()->isDamageAvailable()) {
return i18n("Required X extensions (XComposite and XDamage) are not available."); return i18n("Required X extensions (XComposite and XDamage) are not available.");
} }
#if !defined( KWIN_HAVE_XRENDER_COMPOSITING ) #if defined( KWIN_BUILD_COMPOSITE )
if (!hasGlx()) if (!Xcb::Extensions::self()->isRenderAvailable() || !Xcb::Extensions::self()->isFixesAvailable()) {
return i18n("GLX/OpenGL are not available and only OpenGL support is compiled."); return i18n("XRender/XFixes are not available.");
#else
if (!(hasGlx()
|| (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()))) {
return i18n("GLX/OpenGL and XRender/XFixes are not available.");
} }
#endif #endif
return QString(); return QString();
} }
static bool s_glxDetected = false;
static bool s_hasGlx = false;
bool CompositingPrefs::hasGlx()
{
if (s_glxDetected) {
return s_hasGlx;
}
#ifndef KWIN_HAVE_OPENGLES
int event_base, error_base;
s_hasGlx = glXQueryExtension(display(), &event_base, &error_base);
#endif
s_glxDetected = true;
return s_hasGlx;
}
void CompositingPrefs::detect()
{
if (!compositingPossible() || openGlIsBroken()) {
return;
}
#ifndef KWIN_HAVE_OPENGLES
// HACK: This is needed for AIGLX
const bool forceIndirect = qstrcmp(qgetenv("LIBGL_ALWAYS_INDIRECT"), "1") == 0;
const bool forceEgl = qstrcmp(qgetenv("KWIN_OPENGL_INTERFACE"), "egl") == 0;
if (!forceIndirect && !forceEgl && qstrcmp(qgetenv("KWIN_DIRECT_GL"), "1") != 0) {
// Start an external helper program that initializes GLX and returns
// 0 if we can use direct rendering, and 1 otherwise.
// The reason we have to use an external program is that after GLX
// has been initialized, it's too late to set the LIBGL_ALWAYS_INDIRECT
// environment variable.
// Direct rendering is preferred, since not all OpenGL extensions are
// available with indirect rendering.
const QString opengl_test = KStandardDirs::findExe("kwin_opengl_test");
if (QProcess::execute(opengl_test) != 0) {
mEnableDirectRendering = false;
setenv("LIBGL_ALWAYS_INDIRECT", "1", true);
} else {
mEnableDirectRendering = true;
}
} else {
mEnableDirectRendering = !forceIndirect;
}
#endif
}
} // namespace } // namespace

View file

@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include "kwinglutils.h"
#include "kwinglobals.h" #include "kwinglobals.h"
@ -39,25 +38,6 @@ public:
static bool compositingPossible(); static bool compositingPossible();
static QString compositingNotPossibleReason(); static QString compositingNotPossibleReason();
static bool openGlIsBroken();
/**
* Tests whether GLX is supported and returns @c true
* in case KWin is compiled with OpenGL support and GLX
* is available.
*
* If KWin is compiled with OpenGL ES or without OpenGL at
* all, @c false is returned.
* @returns @c true if GLX is available, @c false otherwise and if not build with OpenGL support.
**/
static bool hasGlx();
bool enableDirectRendering() const {
return mEnableDirectRendering;
}
void detect();
private:
bool mEnableDirectRendering;
}; };
} }

View file

@ -2,4 +2,5 @@
#cmakedefine KWIN_BUILD_SCREENEDGES 1 #cmakedefine KWIN_BUILD_SCREENEDGES 1
#cmakedefine KWIN_BUILD_KAPPMENU 1 #cmakedefine KWIN_BUILD_KAPPMENU 1
#cmakedefine KWIN_BUILD_OXYGEN 1 #cmakedefine KWIN_BUILD_OXYGEN 1
#cmakedefine KWIN_BUILD_COMPOSITE 1
#define KWIN_VERSION_STRING "${KDE_VERSION_STRING}" #define KWIN_VERSION_STRING "${KDE_VERSION_STRING}"

View file

@ -1,8 +0,0 @@
set(kwin_xml ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.KWin.xml)
########### install files ###############
install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} )
install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin )

Binary file not shown.

View file

@ -1,104 +0,0 @@
// ==============================================================
// Ok, *some* apps have really long and nasty window captions
// this looks clutterd, so we allow to crop them a bit and remove
// any information considered to be useless
// ==============================================================
function isBrowser(appName) {
if (appName.toLowerCase() == "konqueror")
return true;
if (appName.toLowerCase() == "rekonq")
return true;
if (appName.toLowerCase() == "qupzilla")
return true;
if (appName.toLowerCase() == "chromium")
return true;
if (appName.toLowerCase() == "firefox")
return true;
if (appName.toLowerCase() == "opera")
return true;
if (appName.toLowerCase() == "arora")
return true;
if (appName.toLowerCase() == "mozilla")
return true;
return false;
}
(function(title, wm_name, wm_class) {
var ret;
// == 1st off ======================================================================
// we assume the part beyond the last dash (if any) to be the
// uninteresting one (usually it's the apps name, if there's add info, that's
// more important to the user)
// --------------------------------------------------------------------------------
var lastPos = title.lastIndexOf(" "); // U+2013 "EN DASH"
if (lastPos > -1)
ret = title.slice(0, lastPos);
else {
lastPos = title.lastIndexOf(" - "); // ASCII Dash
if (lastPos > -1)
ret = title.slice(0, lastPos);
else {
lastPos = title.lastIndexOf(" — "); // U+2014 "EM DASH"
if (lastPos > -1)
ret = title.slice(0, lastPos);
else
ret = title;
}
}
// == 2nd =========================================================================
// Browsers set the caption to "<html><title/></html> - appname"
// Now the page titles can be ridiculously looooong, especially on news pages
// -------------------------------------------------------------------------------
if (isBrowser(wm_name)) {
var parts = ret.split(" - ");
ret = "";
if (parts.length > 2) { // select last two if 3 or more sects, prelast otherwise
for (i = Math.max(0,parts.length-2); i < parts.length - 1; ++i)
ret = ret + parts[i] + " - ";
ret = ret + parts[parts.length - 1];
} else {
ret = ret + parts[Math.max(0,parts.length-2)];
}
}
// 3rd ============================================================================
// if there're any details left, cut of stuff by ": ",
// we remove them as well
// --------------------------------------------------------------------------------
var lastPos = ret.lastIndexOf(": ");
if (lastPos > -1)
ret = title.slice(0, lastPos);
// 4th ============================================================================
// if this is a http url, please get rid of protocol, assuming the user knows or doesn't care
// --------------------------------------------------------------------------------
ret = ret.replace("http://", '');
// finally =========================================================================
// if the remaining string still contains the app name (which should have been removed),
// please shape away additional info like compile time, version numbers etc.
// we usitlize the caption string to preserve CapiTaliZation
// -----------------------------------------------------------------------------------
lastPos = ret.indexOf(RegExp("\\b" + wm_name + "\\b"));
if (lastPos > -1)
ret = ret.substr(lastPos, wm_name.length);
else {
lastPos = ret.indexOf(RegExp("\\b" + wm_class + "\\b"));
if (lastPos > -1)
ret = ret.substr(lastPos, wm_class.length);
}
if (ret.length == 0)
ret = title; // something _terribly_ went wrong -> fall back to the original string
// but in any case get replace the stupid [modified] hint by just an asterisk
ret = ret.replace("[modified]", "❖");
// in general, remove leading [and trailing] blanks and special chars
// ret = ret.replace(/^\W*/, ''); - this does not work - Umlauts and pot. other chars are considered "non Word"
ret = ret.replace(/^\s*/, '').replace(/\s*$/, '');
return ret;
})

View file

@ -146,11 +146,6 @@ bool DBusInterface::compositingPossible()
return Compositor::self()->isCompositingPossible(); return Compositor::self()->isCompositingPossible();
} }
bool DBusInterface::openGLIsBroken()
{
return Compositor::self()->isOpenGLBroken();
}
bool DBusInterface::compositingActive() bool DBusInterface::compositingActive()
{ {
return Compositor::self()->isActive(); return Compositor::self()->isActive();

View file

@ -96,10 +96,6 @@ public Q_SLOTS: // METHODS
* @deprecated * @deprecated
**/ **/
QString compositingType(); QString compositingType();
/**
* @deprecated
**/
bool openGLIsBroken();
/** /**
* @deprecated * @deprecated
**/ **/

View file

@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include "config-kwin.h"
#include "effects.h" #include "effects.h"
#include "effectsadaptor.h" #include "effectsadaptor.h"
@ -28,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cursor.h" #include "cursor.h"
#include "group.h" #include "group.h"
#include "scene_xrender.h" #include "scene_xrender.h"
#include "scene_opengl.h"
#include "unmanaged.h" #include "unmanaged.h"
#ifdef KWIN_BUILD_TABBOX #ifdef KWIN_BUILD_TABBOX
#include "tabbox.h" #include "tabbox.h"
@ -40,7 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "thumbnailitem.h" #include "thumbnailitem.h"
#include "virtualdesktops.h" #include "virtualdesktops.h"
#include "workspace.h" #include "workspace.h"
#include "kwinglutils.h"
#include <QFile> #include <QFile>
#include <QFutureWatcher> #include <QFutureWatcher>
@ -1271,7 +1271,7 @@ void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border, Effect *
unsigned long EffectsHandlerImpl::xrenderBufferPicture() unsigned long EffectsHandlerImpl::xrenderBufferPicture()
{ {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_BUILD_COMPOSITE
if (SceneXrender* s = dynamic_cast< SceneXrender* >(m_scene)) if (SceneXrender* s = dynamic_cast< SceneXrender* >(m_scene))
return s->bufferPicture(); return s->bufferPicture();
#endif #endif
@ -1280,13 +1280,7 @@ unsigned long EffectsHandlerImpl::xrenderBufferPicture()
QLibrary* EffectsHandlerImpl::findEffectLibrary(KService* service) QLibrary* EffectsHandlerImpl::findEffectLibrary(KService* service)
{ {
QString libname = service->library(); QLibrary* library = new QLibrary(service->library());
#ifdef KWIN_HAVE_OPENGLES
if (libname.startsWith(QLatin1String("kwin4_effect_"))) {
libname.replace("kwin4_effect_", "kwin4_effect_gles_");
}
#endif
QLibrary* library = new QLibrary(libname);
if (!library) { if (!library) {
kError(1212) << "couldn't open library for effect '" << kError(1212) << "couldn't open library for effect '" <<
service->name() << "'" << endl; service->name() << "'" << endl;
@ -1595,11 +1589,6 @@ EffectWindowImpl::EffectWindowImpl(Toplevel *toplevel)
EffectWindowImpl::~EffectWindowImpl() EffectWindowImpl::~EffectWindowImpl()
{ {
QVariant cachedTextureVariant = data(LanczosCacheRole);
if (cachedTextureVariant.isValid()) {
GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>());
delete cachedTexture;
}
} }
bool EffectWindowImpl::isPaintingEnabled() bool EffectWindowImpl::isPaintingEnabled()
@ -1817,7 +1806,6 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
, m_static(staticSize) , m_static(staticSize)
, m_point(position) , m_point(position)
, m_alignment(alignment) , m_alignment(alignment)
, m_shader(NULL)
{ {
if (m_style == EffectFrameStyled) { if (m_style == EffectFrameStyled) {
m_frame.setImagePath("widgets/background"); m_frame.setImagePath("widgets/background");
@ -1829,10 +1817,8 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
m_selection.setCacheAllRenderedFrames(true); m_selection.setCacheAllRenderedFrames(true);
m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders); m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);
if (effects->isOpenGLCompositing()) { if (effects->compositingType() == XRenderCompositing) {
m_sceneFrame = new SceneOpenGL::EffectFrame(this, static_cast<SceneOpenGL*>(Compositor::self()->scene())); #ifdef KWIN_BUILD_COMPOSITE
} else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
m_sceneFrame = new SceneXrender::EffectFrame(this); m_sceneFrame = new SceneXrender::EffectFrame(this);
#endif #endif
} else { } else {
@ -1941,13 +1927,12 @@ void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity
if (m_geometry.isEmpty()) { if (m_geometry.isEmpty()) {
return; // Nothing to display return; // Nothing to display
} }
m_shader = NULL;
effects->paintEffectFrame(this, region, opacity, frameOpacity); effects->paintEffectFrame(this, region, opacity, frameOpacity);
} }
void EffectFrameImpl::finalRender(QRegion region, double opacity, double frameOpacity) const void EffectFrameImpl::finalRender(QRegion region, double opacity, double frameOpacity) const
{ {
region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL region = infiniteRegion();
m_sceneFrame->render(region, opacity, frameOpacity); m_sceneFrame->render(region, opacity, frameOpacity);
} }

View file

@ -378,12 +378,6 @@ public:
return m_static; return m_static;
}; };
void finalRender(QRegion region, double opacity, double frameOpacity) const; void finalRender(QRegion region, double opacity, double frameOpacity) const;
virtual void setShader(GLShader* shader) {
m_shader = shader;
}
virtual GLShader* shader() const {
return m_shader;
}
virtual void setSelection(const QRect& selection); virtual void setSelection(const QRect& selection);
const QRect& selection() const { const QRect& selection() const {
return m_selectionGeometry; return m_selectionGeometry;
@ -422,7 +416,6 @@ private:
QRect m_selectionGeometry; QRect m_selectionGeometry;
Scene::EffectFrame* m_sceneFrame; Scene::EffectFrame* m_sceneFrame;
GLShader* m_shader;
}; };
class ScreenLockerWatcher : public QObject class ScreenLockerWatcher : public QObject

View file

@ -24,61 +24,27 @@ set(kwin_effect_XCB_LIBS
${XCB_XFIXES_LIBRARIES} ${XCB_XFIXES_LIBRARIES}
) )
if( KWIN_HAVE_XRENDER_COMPOSITING ) if(KWIN_BUILD_COMPOSITE )
set(kwin_effect_XCB_LIBS ${kwin_effect_XCB_LIBS} ${XCB_RENDER_LIBRARIES}) set(kwin_effect_XCB_LIBS ${kwin_effect_XCB_LIBS} ${XCB_RENDER_LIBRARIES})
endif() endif()
if(OPENGL_FOUND)
set(kwin_effect_OWN_LIBS ${kwin_effect_OWN_LIBS} kwinglutils)
elseif(OPENGLES_FOUND)
set(kwin_effect_OWN_LIBS ${kwin_effect_OWN_LIBS} kwinglesutils)
endif()
macro(KWIN4_ADD_EFFECT_BACKEND name) macro(KWIN4_ADD_EFFECT_BACKEND name)
kde4_add_plugin(${name} ${ARGN}) kde4_add_plugin(${name} ${ARGN})
target_link_libraries( ${name} ${kwin_effect_OWN_LIBS} ${kwin_effect_KDE_LIBS} ${kwin_effect_QT_LIBS} ${kwin_effect_XLIB_LIBS} ${kwin_effect_XCB_LIBS}) target_link_libraries(${name}
${kwin_effect_OWN_LIBS} ${kwin_effect_KDE_LIBS}
${kwin_effect_QT_LIBS} ${kwin_effect_XLIB_LIBS}
${kwin_effect_XCB_LIBS}
)
endmacro() endmacro()
# Adds effect plugin with given name. Sources are given after the name # Adds effect plugin with given name. Sources are given after the name
macro( KWIN4_ADD_EFFECT name ) macro( KWIN4_ADD_EFFECT name )
if(OPENGL_FOUND OR NOT(OPENGL_FOUND AND OPENGLES_FOUND))
# OpenGL or neither OpenGL nor OpenGL ES - default set
KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN}) KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN})
if(OPENGL_FOUND)
if( KWIN_BUILD_OPENGL_1_COMPOSITING )
set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1)
endif()
elseif(OPENGLES_FOUND)
set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
endif()
install( TARGETS kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR}) install( TARGETS kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR})
endif()
if(OPENGLES_FOUND)
KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_gles_${name} ${ARGN})
# OpenGL ES gets into a different library
set_target_properties(kwin4_effect_gles_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
install( TARGETS kwin4_effect_gles_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
endif()
endmacro() endmacro()
macro( KWIN4_ADD_EFFECT_CONFIG name ) macro( KWIN4_ADD_EFFECT_CONFIG name )
set( kwin4_effect_ui ) # Initially empty kde4_add_plugin(kcm_kwin4_effect_${name} ${ARGN})
set( kwin4_effect_src ) # Initially empty
foreach( file ${ARGN} )
if( file MATCHES \\.ui )
set( kwin4_effect_ui ${kwin4_effect_ui} ${file} )
else()
set( kwin4_effect_src ${kwin4_effect_src} ${file} )
endif()
endforeach()
kde4_add_plugin( kcm_kwin4_effect_${name} ${kwin4_effect_src} ${kwin4_effect_ui})
if(OPENGLES_FOUND)
set_target_properties(kcm_kwin4_effect_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
endif()
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})
install(TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR}) install(TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR})
endmacro() endmacro()
@ -88,9 +54,7 @@ install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
# Create initial variables # Create initial variables
set(kwin4_effect_builtins_sources) set(kwin4_effect_builtins_sources)
if( NOT KWIN_MOBILE_EFFECTS )
set(kwin4_effect_builtins_config_sources configs_builtins.cpp) set(kwin4_effect_builtins_config_sources configs_builtins.cpp)
endif()
set(kwin4_effect_include_directories) set(kwin4_effect_include_directories)
############################################################################### ###############################################################################
@ -104,7 +68,6 @@ include( slidingpopups/CMakeLists.txt )
include( taskbarthumbnail/CMakeLists.txt ) include( taskbarthumbnail/CMakeLists.txt )
# Common effects only relevant to desktop # Common effects only relevant to desktop
if( NOT KWIN_MOBILE_EFFECTS )
include( dashboard/CMakeLists.txt ) include( dashboard/CMakeLists.txt )
include( diminactive/CMakeLists.txt ) include( diminactive/CMakeLists.txt )
include( dimscreen/CMakeLists.txt ) include( dimscreen/CMakeLists.txt )
@ -119,29 +82,13 @@ if( NOT KWIN_MOBILE_EFFECTS )
include( windowgeometry/CMakeLists.txt ) include( windowgeometry/CMakeLists.txt )
include( zoom/CMakeLists.txt ) include( zoom/CMakeLists.txt )
include( logout/CMakeLists.txt ) include( logout/CMakeLists.txt )
endif()
# OpenGL-specific effects
include( blur/CMakeLists.txt )
# OpenGL-specific effects for desktop
if( NOT KWIN_MOBILE_EFFECTS )
include( glide/CMakeLists.txt )
include( invert/CMakeLists.txt )
include( lookingglass/CMakeLists.txt )
include( magnifier/CMakeLists.txt ) include( magnifier/CMakeLists.txt )
include( mouseclick/CMakeLists.txt )
include( mousemark/CMakeLists.txt ) include( mousemark/CMakeLists.txt )
include( sheet/CMakeLists.txt )
include( snaphelper/CMakeLists.txt ) include( snaphelper/CMakeLists.txt )
include( startupfeedback/CMakeLists.txt )
include( trackmouse/CMakeLists.txt ) include( trackmouse/CMakeLists.txt )
include( wobblywindows/CMakeLists.txt )
endif()
############################################################################### ###############################################################################
# Add the builtins plugin # Add the builtins plugin
KWIN4_ADD_EFFECT( builtins ${kwin4_effect_builtins_sources} ) KWIN4_ADD_EFFECT( builtins ${kwin4_effect_builtins_sources} )
if( NOT KWIN_MOBILE_EFFECTS )
KWIN4_ADD_EFFECT_CONFIG( builtins ${kwin4_effect_builtins_config_sources} ) KWIN4_ADD_EFFECT_CONFIG( builtins ${kwin4_effect_builtins_config_sources} )
endif()

View file

@ -1,30 +0,0 @@
#######################################
# Effect
# Source files
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
blur/blur.cpp
blur/blurshader.cpp )
kde4_add_kcfg_files(kwin4_effect_builtins_sources blur/blurconfig.kcfgc)
# .desktop files
install( FILES
blur/blur.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
#######################################
# Config
# Source files
set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
blur/blur_config.cpp
blur/blur_config.ui )
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources blur/blurconfig.kcfgc)
# .desktop files
install( FILES
blur/blur_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View file

@ -1,728 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
* Copyright © 2011 Philipp Knechtges <philipp-dev@knechtges.com>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "blur.h"
#include "blurshader.h"
// KConfigSkeleton
#include "blurconfig.h"
#include <X11/Xatom.h>
#include <QMatrix4x4>
#include <QLinkedList>
#include <KDebug>
namespace KWin
{
KWIN_EFFECT(blur, BlurEffect)
KWIN_EFFECT_SUPPORTED(blur, BlurEffect::supported())
KWIN_EFFECT_ENABLEDBYDEFAULT(blur, BlurEffect::enabledByDefault())
BlurEffect::BlurEffect()
{
shader = BlurShader::create();
// Offscreen texture that's used as the target for the horizontal blur pass
// and the source for the vertical pass.
tex = GLTexture(displayWidth(), displayHeight());
tex.setFilter(GL_LINEAR);
tex.setWrapMode(GL_CLAMP_TO_EDGE);
target = new GLRenderTarget(tex);
reconfigure(ReconfigureAll);
// ### Hackish way to announce support.
// Should be included in _NET_SUPPORTED instead.
if (shader && shader->isValid() && target->valid()) {
net_wm_blur_region = effects->announceSupportProperty("_KDE_NET_WM_BLUR_BEHIND_REGION", this);
} else {
net_wm_blur_region = 0;
}
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
connect(effects, SIGNAL(screenGeometryChanged(QSize)), this, SLOT(slotScreenGeometryChanged()));
// Fetch the blur regions for all windows
foreach (EffectWindow *window, effects->stackingOrder())
updateBlurRegion(window);
}
BlurEffect::~BlurEffect()
{
windows.clear();
delete shader;
delete target;
}
void BlurEffect::slotScreenGeometryChanged()
{
effects->reloadEffect(this);
}
void BlurEffect::reconfigure(ReconfigureFlags flags)
{
Q_UNUSED(flags)
BlurConfig::self()->readConfig();
int radius = qBound(2, BlurConfig::blurRadius(), 14);
if (shader)
shader->setRadius(radius);
m_shouldCache = BlurConfig::cacheTexture();
windows.clear();
if (!shader || !shader->isValid())
XDeleteProperty(display(), rootWindow(), net_wm_blur_region);
}
void BlurEffect::updateBlurRegion(EffectWindow *w) const
{
QRegion region;
const QByteArray value = w->readProperty(net_wm_blur_region, XA_CARDINAL, 32);
if (value.size() > 0 && !(value.size() % (4 * sizeof(unsigned long)))) {
const unsigned long *cardinals = reinterpret_cast<const unsigned long*>(value.constData());
for (unsigned int i = 0; i < value.size() / sizeof(unsigned long);) {
int x = cardinals[i++];
int y = cardinals[i++];
int w = cardinals[i++];
int h = cardinals[i++];
region += QRect(x, y, w, h);
}
}
if (region.isEmpty() && !value.isNull()) {
// Set the data to a dummy value.
// This is needed to be able to distinguish between the value not
// being set, and being set to an empty region.
w->setData(WindowBlurBehindRole, 1);
} else
w->setData(WindowBlurBehindRole, region);
}
void BlurEffect::slotWindowAdded(EffectWindow *w)
{
updateBlurRegion(w);
}
void BlurEffect::slotWindowDeleted(EffectWindow *w)
{
if (windows.contains(w)) {
windows.remove(w);
}
}
void BlurEffect::slotPropertyNotify(EffectWindow *w, long atom)
{
if (w && atom == net_wm_blur_region) {
updateBlurRegion(w);
CacheEntry it = windows.find(w);
if (it != windows.end()) {
const QRect screen(0, 0, displayWidth(), displayHeight());
it->damagedRegion = expand(blurRegion(w).translated(w->pos())) & screen;
}
}
}
bool BlurEffect::enabledByDefault()
{
GLPlatform *gl = GLPlatform::instance();
if (gl->isIntel() && gl->chipClass() < SandyBridge)
return false;
if (gl->driver() == Driver_Catalyst && effects->compositingType() == OpenGL1Compositing) {
// fglrx supports only ARB shaders and those tend to crash KWin (see Bug #270818 and #286795)
return false;
}
return true;
}
bool BlurEffect::supported()
{
bool supported = GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() && GLSLBlurShader::supported();
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
supported = GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() && ARBBlurShader::supported();
}
#endif
if (supported) {
int maxTexSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
if (displayWidth() > maxTexSize || displayHeight() > maxTexSize)
supported = false;
}
return supported;
}
QRect BlurEffect::expand(const QRect &rect) const
{
const int radius = shader->radius();
return rect.adjusted(-radius, -radius, radius, radius);
}
QRegion BlurEffect::expand(const QRegion &region) const
{
QRegion expanded;
foreach (const QRect & rect, region.rects()) {
expanded += expand(rect);
}
return expanded;
}
QRegion BlurEffect::blurRegion(const EffectWindow *w) const
{
QRegion region;
const QVariant value = w->data(WindowBlurBehindRole);
if (value.isValid()) {
const QRegion appRegion = qvariant_cast<QRegion>(value);
if (!appRegion.isEmpty()) {
if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) {
region = w->shape();
region -= w->decorationInnerRect();
}
region |= appRegion.translated(w->contentsRect().topLeft()) &
w->decorationInnerRect();
} else {
// An empty region means that the blur effect should be enabled
// for the whole window.
region = w->shape();
}
} else if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) {
// If the client hasn't specified a blur region, we'll only enable
// the effect behind the decoration.
region = w->shape();
region -= w->decorationInnerRect();
}
return region;
}
void BlurEffect::uploadRegion(QVector2D *&map, const QRegion &region)
{
foreach (const QRect &r, region.rects()) {
const QVector2D topLeft(r.x(), r.y());
const QVector2D topRight(r.x() + r.width(), r.y());
const QVector2D bottomLeft(r.x(), r.y() + r.height());
const QVector2D bottomRight(r.x() + r.width(), r.y() + r.height());
// First triangle
*(map++) = topRight;
*(map++) = topLeft;
*(map++) = bottomLeft;
// Second triangle
*(map++) = bottomLeft;
*(map++) = bottomRight;
*(map++) = topRight;
}
}
void BlurEffect::uploadGeometry(GLVertexBuffer *vbo, const QRegion &horizontal, const QRegion &vertical)
{
const int vertexCount = (horizontal.rectCount() + vertical.rectCount()) * 6;
QVector2D *map = (QVector2D *) vbo->map(vertexCount * sizeof(QVector2D));
uploadRegion(map, horizontal);
uploadRegion(map, vertical);
vbo->unmap();
const GLVertexAttrib layout[] = {
{ VA_Position, 2, GL_FLOAT, 0 },
{ VA_TexCoord, 2, GL_FLOAT, 0 }
};
vbo->setAttribLayout(layout, 2, sizeof(QVector2D));
}
void BlurEffect::prePaintScreen(ScreenPrePaintData &data, int time)
{
m_damagedArea = QRegion();
m_paintedArea = QRegion();
m_currentBlur = QRegion();
effects->prePaintScreen(data, time);
}
void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{
// this effect relies on prePaintWindow being called in the bottom to top order
effects->prePaintWindow(w, data, time);
if (!w->isPaintingEnabled()) {
return;
}
if (!shader || !shader->isValid()) {
return;
}
// to blur an area partially we have to shrink the opaque area of a window
QRegion newClip;
const QRegion oldClip = data.clip;
const int radius = shader->radius();
foreach (const QRect& rect, data.clip.rects()) {
newClip |= rect.adjusted(radius,radius,-radius,-radius);
}
data.clip = newClip;
const QRegion oldPaint = data.paint;
// we don't have to blur a region we don't see
m_currentBlur -= newClip;
// if we have to paint a non-opaque part of this window that intersects with the
// currently blurred region (which is not cached) we have to redraw the whole region
if ((data.paint-oldClip).intersects(m_currentBlur)) {
data.paint |= m_currentBlur;
}
// in case this window has regions to be blurred
const QRect screen(0, 0, displayWidth(), displayHeight());
const QRegion blurArea = blurRegion(w).translated(w->pos()) & screen;
const QRegion expandedBlur = expand(blurArea) & screen;
if (m_shouldCache) {
// we are caching the horizontally blurred background texture
// if a window underneath the blurred area is damaged we have to
// update the cached texture
QRegion damagedCache;
CacheEntry it = windows.find(w);
if (it != windows.end() && !it->dropCache &&
it->windowPos == w->pos() &&
it->blurredBackground.size() == expandedBlur.boundingRect().size()) {
damagedCache = (expand(expandedBlur & m_damagedArea) |
(it->damagedRegion & data.paint)) & expandedBlur;
} else {
damagedCache = expandedBlur;
}
if (!damagedCache.isEmpty()) {
// This is the area of the blurry window which really can change.
const QRegion damagedArea = damagedCache & blurArea;
// In order to be able to recalculate this area we have to make sure the
// background area is painted before.
data.paint |= expand(damagedArea);
if (it != windows.end()) {
// In case we already have a texture cache mark the dirty regions invalid.
it->damagedRegion &= expandedBlur;
it->damagedRegion |= damagedCache;
// The valid part of the cache can be considered as being opaque
// as long as we don't need to update a bordering part
data.clip |= blurArea - expand(it->damagedRegion);
it->dropCache = false;
}
// we keep track of the "damage propagation"
m_damagedArea |= damagedArea;
// we have to check again whether we do not damage a blurred area
// of a window we do not cache
if (expandedBlur.intersects(m_currentBlur)) {
data.paint |= m_currentBlur;
}
}
} else {
// we are not caching the window
// if this window or an window underneath the blurred area is painted again we have to
// blur everything
if (m_paintedArea.intersects(expandedBlur) || data.paint.intersects(blurArea)) {
data.paint |= expandedBlur;
// we keep track of the "damage propagation"
m_damagedArea |= expand(expandedBlur & m_damagedArea) & blurArea;
// we have to check again whether we do not damage a blurred area
// of a window we do not cache
if (expandedBlur.intersects(m_currentBlur)) {
data.paint |= m_currentBlur;
}
}
m_currentBlur |= expandedBlur;
}
// we don't consider damaged areas which are occluded and are not
// explicitly damaged by this window
m_damagedArea -= data.clip;
m_damagedArea |= oldPaint;
// in contrast to m_damagedArea does m_paintedArea keep track of all repainted areas
m_paintedArea -= data.clip;
m_paintedArea |= data.paint;
}
bool BlurEffect::shouldBlur(const EffectWindow *w, int mask, const WindowPaintData &data) const
{
if (!target->valid() || !shader || !shader->isValid())
return false;
if (effects->activeFullScreenEffect() && !w->data(WindowForceBlurRole).toBool())
return false;
if (w->isDesktop())
return false;
bool scaled = !qFuzzyCompare(data.xScale(), 1.0) && !qFuzzyCompare(data.yScale(), 1.0);
bool translated = data.xTranslation() || data.yTranslation();
if (scaled || ((translated || (mask & PAINT_WINDOW_TRANSFORMED)) && !w->data(WindowForceBlurRole).toBool()))
return false;
bool blurBehindDecos = effects->decorationsHaveAlpha() &&
effects->decorationSupportsBlurBehind();
if (!w->hasAlpha() && !(blurBehindDecos && w->hasDecoration()))
return false;
return true;
}
void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
{
const QRect screen(0, 0, displayWidth(), displayHeight());
if (shouldBlur(w, mask, data)) {
QRegion shape = region & blurRegion(w).translated(w->pos()) & screen;
const bool translated = data.xTranslation() || data.yTranslation();
// let's do the evil parts - someone wants to blur behind a transformed window
if (translated) {
shape = shape.translated(data.xTranslation(), data.yTranslation());
shape = shape & region;
}
if (!shape.isEmpty()) {
if (m_shouldCache && !translated) {
doCachedBlur(w, region, data.opacity());
} else {
doBlur(shape, screen, data.opacity());
}
}
}
// Draw the window over the blurred area
effects->drawWindow(w, mask, region, data);
}
void BlurEffect::paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity)
{
const QRect screen(0, 0, displayWidth(), displayHeight());
bool valid = target->valid() && shader && shader->isValid();
QRegion shape = frame->geometry().adjusted(-5, -5, 5, 5) & screen;
if (valid && !shape.isEmpty() && region.intersects(shape.boundingRect()) && frame->style() != EffectFrameNone) {
doBlur(shape, screen, opacity * frameOpacity);
}
effects->paintEffectFrame(frame, region, opacity, frameOpacity);
}
void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float opacity)
{
const QRegion expanded = expand(shape) & screen;
const QRect r = expanded.boundingRect();
// Upload geometry for the horizontal and vertical passes
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
uploadGeometry(vbo, expanded, shape);
vbo->bindArrays();
// Create a scratch texture and copy the area in the back buffer that we're
// going to blur into it
GLTexture scratch(r.width(), r.height());
scratch.setFilter(GL_LINEAR);
scratch.setWrapMode(GL_CLAMP_TO_EDGE);
scratch.bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r.x(), displayHeight() - r.y() - r.height(),
r.width(), r.height());
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
target->attachTexture(tex);
GLRenderTarget::pushRenderTarget(target);
shader->bind();
shader->setDirection(Qt::Horizontal);
shader->setPixelDistance(1.0 / r.width());
// Set up the texture matrix to transform from screen coordinates
// to texture coordinates.
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
glMatrixMode(GL_TEXTURE);
pushMatrix();
}
#endif
QMatrix4x4 textureMatrix;
textureMatrix.scale(1.0 / scratch.width(), -1.0 / scratch.height(), 1);
textureMatrix.translate(-r.x(), -scratch.height() - r.y(), 0);
loadMatrix(textureMatrix);
shader->setTextureMatrix(textureMatrix);
vbo->draw(GL_TRIANGLES, 0, expanded.rectCount() * 6);
GLRenderTarget::popRenderTarget();
scratch.unbind();
scratch.discard();
// Now draw the horizontally blurred area back to the backbuffer, while
// blurring it vertically and clipping it to the window shape.
tex.bind();
shader->setDirection(Qt::Vertical);
shader->setPixelDistance(1.0 / tex.height());
// Modulate the blurred texture with the window opacity if the window isn't opaque
if (opacity < 1.0) {
glEnable(GL_BLEND);
glBlendColor(0, 0, 0, opacity);
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
}
// Set the up the texture matrix to transform from screen coordinates
// to texture coordinates.
textureMatrix.setToIdentity();
textureMatrix.scale(1.0 / tex.width(), -1.0 / tex.height(), 1);
textureMatrix.translate(0, -tex.height(), 0);
loadMatrix(textureMatrix);
shader->setTextureMatrix(textureMatrix);
vbo->draw(GL_TRIANGLES, expanded.rectCount() * 6, shape.rectCount() * 6);
vbo->unbindArrays();
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
popMatrix();
glMatrixMode(GL_MODELVIEW);
}
#endif
if (opacity < 1.0) {
glDisable(GL_BLEND);
}
tex.unbind();
shader->unbind();
}
void BlurEffect::doCachedBlur(EffectWindow *w, const QRegion& region, const float opacity)
{
const QRect screen(0, 0, displayWidth(), displayHeight());
const QRegion blurredRegion = blurRegion(w).translated(w->pos()) & screen;
const QRegion expanded = expand(blurredRegion) & screen;
const QRect r = expanded.boundingRect();
// The background texture we get is only partially valid.
CacheEntry it = windows.find(w);
if (it == windows.end()) {
BlurWindowInfo bwi;
bwi.blurredBackground = GLTexture(r.width(),r.height());
bwi.damagedRegion = expanded;
bwi.dropCache = false;
bwi.windowPos = w->pos();
it = windows.insert(w, bwi);
} else if (it->blurredBackground.size() != r.size()) {
it->blurredBackground = GLTexture(r.width(),r.height());
it->dropCache = false;
it->windowPos = w->pos();
} else if (it->windowPos != w->pos()) {
it->dropCache = false;
it->windowPos = w->pos();
}
GLTexture targetTexture = it->blurredBackground;
targetTexture.setFilter(GL_LINEAR);
targetTexture.setWrapMode(GL_CLAMP_TO_EDGE);
shader->bind();
QMatrix4x4 textureMatrix;
QMatrix4x4 modelViewProjectionMatrix;
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
glMatrixMode(GL_MODELVIEW);
pushMatrix();
glLoadIdentity();
glMatrixMode(GL_TEXTURE);
pushMatrix();
glMatrixMode(GL_PROJECTION);
pushMatrix();
}
#endif
/**
* Which part of the background texture can be updated ?
*
* Well this is a rather difficult question. We kind of rely on the fact, that
* we need a bigger background region being painted before, more precisely if we want to
* blur region A we need the background region expand(A). This business logic is basically
* done in prePaintWindow:
* data.paint |= expand(damagedArea);
*
* Now "data.paint" gets clipped and becomes what we receive as the "region" variable
* in this function. In theory there is now only one function that does this clipping
* and this is paintSimpleScreen. The clipping has the effect that "damagedRegion"
* is no longer a subset of "region" and we cannot fully validate the cache within one
* rendering pass. If we would now update the "damageRegion & region" part of the cache
* we would wrongly update the part of the cache that is next to the "region" border and
* which lies within "damagedRegion", just because we cannot assume that the framebuffer
* outside of "region" is valid. Therefore the maximal damaged region of the cache that can
* be repainted is given by:
* validUpdate = damagedRegion - expand(damagedRegion - region);
*
* Now you may ask what is with the rest of "damagedRegion & region" that is not part
* of "validUpdate" but also might end up on the screen. Well under the assumption
* that only the occlusion culling can shrink "data.paint", we can control this by reducing
* the opaque area of every window by a margin of the blurring radius (c.f. prePaintWindow).
* This way we are sure that this area is overpainted by a higher opaque window.
*
* Apparently paintSimpleScreen is not the only function that can influence "region".
* In fact every effect's paintWindow that is called before Blur::paintWindow
* can do so (e.g. SlidingPopups). Hence we have to make the compromise that we update
* "damagedRegion & region" of the cache but only mark "validUpdate" as valid.
**/
const QRegion damagedRegion = it->damagedRegion;
const QRegion updateBackground = damagedRegion & region;
const QRegion validUpdate = damagedRegion - expand(damagedRegion - region);
const QRegion horizontal = validUpdate.isEmpty() ? QRegion() : (updateBackground & screen);
const QRegion vertical = blurredRegion & region;
const int horizontalOffset = 0;
const int horizontalCount = horizontal.rectCount() * 6;
const int verticalOffset = horizontalCount;
const int verticalCount = vertical.rectCount() * 6;
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
uploadGeometry(vbo, horizontal, vertical);
vbo->bindArrays();
if (!validUpdate.isEmpty()) {
const QRect updateRect = (expand(updateBackground) & expanded).boundingRect();
// First we have to copy the background from the frontbuffer
// into a scratch texture (in this case "tex").
tex.bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, updateRect.x(), displayHeight() - updateRect.y() - updateRect.height(),
updateRect.width(), updateRect.height());
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
target->attachTexture(targetTexture);
GLRenderTarget::pushRenderTarget(target);
shader->setDirection(Qt::Horizontal);
shader->setPixelDistance(1.0 / tex.width());
modelViewProjectionMatrix.ortho(0, r.width(), r.height(), 0 , 0, 65535);
modelViewProjectionMatrix.translate(-r.x(), -r.y(), 0);
loadMatrix(modelViewProjectionMatrix);
shader->setModelViewProjectionMatrix(modelViewProjectionMatrix);
// Set up the texture matrix to transform from screen coordinates
// to texture coordinates.
textureMatrix.scale(1.0 / tex.width(), -1.0 / tex.height(), 1);
textureMatrix.translate(-updateRect.x(), -updateRect.height() - updateRect.y(), 0);
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
glMatrixMode(GL_TEXTURE);
loadMatrix(textureMatrix);
glMatrixMode(GL_PROJECTION);
}
#endif
shader->setTextureMatrix(textureMatrix);
vbo->draw(GL_TRIANGLES, horizontalOffset, horizontalCount);
GLRenderTarget::popRenderTarget();
tex.unbind();
// mark the updated region as valid
it->damagedRegion -= validUpdate;
}
// Now draw the horizontally blurred area back to the backbuffer, while
// blurring it vertically and clipping it to the window shape.
targetTexture.bind();
shader->setDirection(Qt::Vertical);
shader->setPixelDistance(1.0 / targetTexture.height());
// Modulate the blurred texture with the window opacity if the window isn't opaque
if (opacity < 1.0) {
glEnable(GL_BLEND);
glBlendColor(0, 0, 0, opacity);
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
}
modelViewProjectionMatrix.setToIdentity();
modelViewProjectionMatrix.ortho(0, displayWidth(), displayHeight(), 0, 0, 65535);
loadMatrix(modelViewProjectionMatrix);
shader->setModelViewProjectionMatrix(modelViewProjectionMatrix);
// Set the up the texture matrix to transform from screen coordinates
// to texture coordinates.
textureMatrix.setToIdentity();
textureMatrix.scale(1.0 / targetTexture.width(), -1.0 / targetTexture.height(), 1);
textureMatrix.translate(-r.x(), -targetTexture.height() - r.y(), 0);
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
glMatrixMode(GL_TEXTURE);
loadMatrix(textureMatrix);
glMatrixMode(GL_PROJECTION);
}
#endif
shader->setTextureMatrix(textureMatrix);
vbo->draw(GL_TRIANGLES, verticalOffset, verticalCount);
vbo->unbindArrays();
#ifdef KWIN_HAVE_OPENGL_1
if (effects->compositingType() == OpenGL1Compositing) {
popMatrix();
glMatrixMode(GL_TEXTURE);
popMatrix();
glMatrixMode(GL_MODELVIEW);
popMatrix();
}
#endif
if (opacity < 1.0) {
glDisable(GL_BLEND);
}
targetTexture.unbind();
shader->unbind();
}
int BlurEffect::blurRadius() const
{
if (!shader) {
return 0;
}
return shader->radius();
}
} // namespace KWin

View file

@ -1,167 +0,0 @@
[Desktop Entry]
Name=Blur
Name[af]=Blur
Name[ar]=غشاوة
Name[ast]=Desenfocar
Name[be]=Blur
Name[bg]=Замъгляване
Name[bn]=
Name[bn_IN]=Blur ()
Name[bs]=Zamućenje
Name[ca]=Difuminat
Name[ca@valencia]=Difuminat
Name[cs]=Rozostření
Name[csb]=Rozmazóné
Name[da]=Slør
Name[de]=Verwischen
Name[el]=Θόλωμα
Name[en_GB]=Blur
Name[eo]=Malklarigi
Name[es]=Desenfocar
Name[et]=Hägu
Name[eu]=Lausotu
Name[fa]=محو
Name[fi]=Sumennus
Name[fr]=Flou
Name[fy]=Ferfagje
Name[ga]=Blur
Name[gl]=Desenfocar
Name[gu]=
Name[he]=טשטוש
Name[hi]=
Name[hne]=
Name[hr]=Mrlja
Name[hsb]=Młowojty
Name[hu]=Elmosódás
Name[ia]=Obscura (Blur)
Name[id]=Samar
Name[is]=Móða
Name[it]=Sfocatura
Name[ja]=
Name[kk]=Бұлдыр
Name[km]=
Name[kn]=ಿ ()
Name[ko]=
Name[ku]=Blur
Name[lt]=Suliejimas
Name[lv]=Aizmiglot
Name[mai]=
Name[mk]=Заматување
Name[ml]=ി
Name[mr]=
Name[nb]=Slør
Name[nds]=Verwischen
Name[ne]=
Name[nl]=Vervagen
Name[nn]=Uklar
Name[pa]=
Name[pl]=Rozmycie
Name[pt]=BlueFish
Name[pt_BR]=Borrar
Name[ro]=Estompare
Name[ru]=Размытие
Name[se]=Seagas
Name[si]=
Name[sk]=Rozmazať
Name[sl]=Zabriši
Name[sr]=Замућење
Name[sr@ijekavian]=Замућење
Name[sr@ijekavianlatin]=Zamućenje
Name[sr@latin]=Zamućenje
Name[sv]=Oskärpa
Name[ta]=
Name[te]=
Name[tg]=Шуста
Name[th]=
Name[tr]=Bulanıklaştırma
Name[ug]=گۇڭگا
Name[uk]=Розмивання
Name[vi]=Nhoè
Name[wa]=Flou
Name[x-test]=xxBlurxx
Name[zh_CN]=
Name[zh_TW]=
Icon=preferences-system-windows-effect-blur
Comment=Blurs the background behind semi-transparent windows
Comment[ar]=يغشّي الخلفية التي خلف النوافذ شبه الشفافة.
Comment[ast]=Desenfoca'l fondu d'una ventana semi-tresparente
Comment[bg]=Замъгляване на фона на полупрозрачни прозорци
Comment[bs]=Zamućuje pozadinu iza poluprovidnih prozora
Comment[ca]=Difumina el fons de darrere de les finestres semitransparents
Comment[ca@valencia]=Difumina el fons de darrere de les finestres semitransparents
Comment[cs]=Rozostří pozadí poloprůhledných oken
Comment[csb]=Rozmazëje spòdla półprzezérnych òknów
Comment[da]=Slører baggrunden bag halvgennemsigtige vinduer
Comment[de]=Verwischt den Hintergrund halbtransparenter Fenster.
Comment[el]=Θόλωμα του φόντου πίσω από ημιδιαφανή παράθυρα
Comment[en_GB]=Blurs the background behind semi-transparent windows
Comment[eo]=Malklarigas la fonon de duon-travideblaj fenestroj
Comment[es]=Desenfoca el fondo de una ventana semitransparente
Comment[et]=Poolläbipaistvate akende tausta hägustamine
Comment[eu]=Atzeko planoa lausotzen du leiho erdi-gardenen atzean
Comment[fi]=Sumentaa taustan puoliksi läpinäkyvien ikkunoiden alta
Comment[fy]=Ferfaget de eftergrûn fan healtrochsichtige finsters
Comment[ga]=Geamhaigh an cúlra taobh thiar d'fhuinneoga leath-thrédhearcacha
Comment[gl]=Desenfoca o fondo tras das xanelas semitransparentes
Comment[gu]= - િ
Comment[he]=טשטוש הרקע שמאחורי חלונות שקופים למחצה
Comment[hi]=- ि ि
Comment[hne]= ि ि
Comment[hr]=Zamrlja pozadinu iza poluprozirnih prozora
Comment[hsb]=Stwori młowojty pozadk za połpřewidnymi woknami.
Comment[hu]=Elmosódottá teszi a félig áttetsző ablakok hátterét
Comment[ia]=Il obscura le fundo detra fenestras semi-transparente
Comment[id]=Samarkan latar belakang di belakang jendela semi-transparan
Comment[is]=Móðar bakgrunn aftan við hálfgegnsæa glugga
Comment[kk]=Шала мөлдір терезелердің аясын бұлдырлатады
Comment[km]=
Comment[kn]=- ಿಿ ಿ ಿ
Comment[ko]=
Comment[lt]=Sulieja pusiau permatomų langų foną
Comment[lv]=Aizmiglo fonu aiz puscaurspīdīgiem logiem
Comment[mk]=Ја заматува подлогата зад полупроѕирни прозорци
Comment[ml]=ി ി ി.
Comment[mr]=-
Comment[nb]=Slører bakgrunnen til delvis gjennomsiktige vinduer
Comment[nds]=Verwischt den Achtergrund achter halfdörsichtig Finstern
Comment[nl]=Vervaagt de achtergrond van halftransparante vensters
Comment[nn]=Gjer bakgrunnen til halvgjennomsiktige vindauge uklar
Comment[pa]= (-) () ਿ
Comment[pl]=Rozmywa tło za półprzezroczystymi oknami
Comment[pt]=Borra o fundo por trás das janelas semi-transparentes
Comment[pt_BR]=Borra o plano de fundo por trás das janelas semi-transparentes
Comment[ro]=Estompează fundalul în spatele ferestrelor semitransparente
Comment[ru]=Показывать размытый фон под полупрозрачным окном
Comment[si]=
Comment[sk]=Rozmaže pozadie za polopriehľadnými oknami
Comment[sl]=Zabriše ozadje za na pol prozornimi okni
Comment[sr]=Замућује позадину иза полупровидних прозора
Comment[sr@ijekavian]=Замућује позадину иза полупровидних прозора
Comment[sr@ijekavianlatin]=Zamućuje pozadinu iza poluprovidnih prozora
Comment[sr@latin]=Zamućuje pozadinu iza poluprovidnih prozora
Comment[sv]=Gör bakgrunden bakom halvgenomskinliga fönster suddig
Comment[ta]=Blurs the background behind semi-transparent windows
Comment[th]=
Comment[tr]=Yarı şeffaf pencerelerin arka planını bulanıklaştırır
Comment[ug]=گۇڭگا يېرىم سۈزۈك كۆزنەك تەگلىكى
Comment[uk]=Розмивання тла напівпрозорих вікон
Comment[vi]=Làm nhoè nn phía sau các ca s trong sut
Comment[wa]=Rind flou l' fond pa drî les finiesses dmeyes transparintes
Comment[x-test]=xxBlurs the background behind semi-transparent windowsxx
Comment[zh_CN]=
Comment[zh_TW]=
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Fredrik Höglund
X-KDE-PluginInfo-Email=fredrik@kde.org
X-KDE-PluginInfo-Name=kwin4_effect_blur
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Category=Appearance
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-Library=kwin4_effect_builtins
X-KDE-Ordering=75
X-KWin-Requires-OpenGL=true
X-KWin-Requires-Shaders=true

View file

@ -1,111 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLUR_H
#define BLUR_H
#include <kwineffects.h>
#include <kwinglplatform.h>
#include <kwinglutils.h>
#include <QVector>
#include <QVector2D>
namespace KWin
{
class BlurShader;
class BlurEffect : public KWin::Effect
{
Q_OBJECT
Q_PROPERTY(int blurRadius READ blurRadius)
Q_PROPERTY(bool cacheTexture READ isCacheTexture)
public:
BlurEffect();
~BlurEffect();
static bool supported();
static bool enabledByDefault();
void reconfigure(ReconfigureFlags flags);
void prePaintScreen(ScreenPrePaintData &data, int time);
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
void drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data);
void paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity);
// for dynamic setting extraction
int blurRadius() const;
bool isCacheTexture() const {
return m_shouldCache;
}
virtual bool provides(Feature feature);
public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow *w);
void slotWindowDeleted(KWin::EffectWindow *w);
void slotPropertyNotify(KWin::EffectWindow *w, long atom);
void slotScreenGeometryChanged();
private:
QRect expand(const QRect &rect) const;
QRegion expand(const QRegion &region) const;
QRegion blurRegion(const EffectWindow *w) const;
bool shouldBlur(const EffectWindow *w, int mask, const WindowPaintData &data) const;
void updateBlurRegion(EffectWindow *w) const;
void doBlur(const QRegion &shape, const QRect &screen, const float opacity);
void doCachedBlur(EffectWindow *w, const QRegion& region, const float opacity);
void uploadRegion(QVector2D *&map, const QRegion &region);
void uploadGeometry(GLVertexBuffer *vbo, const QRegion &horizontal, const QRegion &vertical);
private:
BlurShader *shader;
GLRenderTarget *target;
GLTexture tex;
long net_wm_blur_region;
QRegion m_damagedArea; // keeps track of the area which has been damaged (from bottom to top)
QRegion m_paintedArea; // actually painted area which is greater than m_damagedArea
QRegion m_currentBlur; // keeps track of the currently blured area of non-caching windows(from bottom to top)
bool m_shouldCache;
struct BlurWindowInfo {
GLTexture blurredBackground; // keeps the horizontally blurred background
QRegion damagedRegion;
QPoint windowPos;
bool dropCache;
};
QHash< const EffectWindow*, BlurWindowInfo > windows;
typedef QHash<const EffectWindow*, BlurWindowInfo>::iterator CacheEntry;
};
inline
bool BlurEffect::provides(Effect::Feature feature)
{
if (feature == Blur) {
return true;
}
return KWin::Effect::provides(feature);
}
} // namespace KWin
#endif

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-Blur">
<entry name="BlurRadius" type="Int">
<default>12</default>
</entry>
<entry name="CacheTexture" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>

View file

@ -1,53 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "blur_config.h"
// KConfigSkeleton
#include "blurconfig.h"
#include <kwineffects.h>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
BlurEffectConfig::BlurEffectConfig(QWidget *parent, const QVariantList &args)
: KCModule(EffectFactory::componentData(), parent, args)
{
ui.setupUi(this);
addConfig(BlurConfig::self(), this);
load();
}
BlurEffectConfig::~BlurEffectConfig()
{
}
void BlurEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("blur");
}
} // namespace KWin
#include "moc_blur_config.cpp"

View file

@ -1,91 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_blur
X-KDE-PluginKeyword=blur
Name=Blur
Name[af]=Blur
Name[ar]=غشاوة
Name[ast]=Desenfocar
Name[be]=Blur
Name[bg]=Замъгляване
Name[bn]=
Name[bn_IN]=Blur ()
Name[bs]=Zamućenje
Name[ca]=Difuminat
Name[ca@valencia]=Difuminat
Name[cs]=Rozostření
Name[csb]=Rozmazóné
Name[da]=Slør
Name[de]=Verwischen
Name[el]=Θόλωμα
Name[en_GB]=Blur
Name[eo]=Malklarigi
Name[es]=Desenfocar
Name[et]=Hägu
Name[eu]=Lausotu
Name[fa]=محو
Name[fi]=Sumennus
Name[fr]=Flou
Name[fy]=Ferfagje
Name[ga]=Blur
Name[gl]=Desenfocar
Name[gu]=
Name[he]=טשטוש
Name[hi]=
Name[hne]=
Name[hr]=Mrlja
Name[hsb]=Młowojty
Name[hu]=Elmosódás
Name[ia]=Obscura (Blur)
Name[id]=Samar
Name[is]=Móða
Name[it]=Sfocatura
Name[ja]=
Name[kk]=Бұлдыр
Name[km]=
Name[kn]=ಿ ()
Name[ko]=
Name[ku]=Blur
Name[lt]=Suliejimas
Name[lv]=Aizmiglot
Name[mai]=
Name[mk]=Заматување
Name[ml]=ി
Name[mr]=
Name[nb]=Slør
Name[nds]=Verwischen
Name[ne]=
Name[nl]=Vervagen
Name[nn]=Uklar
Name[pa]=
Name[pl]=Rozmycie
Name[pt]=BlueFish
Name[pt_BR]=Borrar
Name[ro]=Estompare
Name[ru]=Размытие
Name[se]=Seagas
Name[si]=
Name[sk]=Rozmazať
Name[sl]=Zabriši
Name[sr]=Замућење
Name[sr@ijekavian]=Замућење
Name[sr@ijekavianlatin]=Zamućenje
Name[sr@latin]=Zamućenje
Name[sv]=Oskärpa
Name[ta]=
Name[te]=
Name[tg]=Шуста
Name[th]=
Name[tr]=Bulanıklaştırma
Name[ug]=گۇڭگا
Name[uk]=Розмивання
Name[vi]=Nhoè
Name[wa]=Flou
Name[x-test]=xxBlurxx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -1,46 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLUR_CONFIG_H
#define BLUR_CONFIG_H
#include <KCModule>
#include "ui_blur_config.h"
namespace KWin
{
class BlurEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit BlurEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList());
~BlurEffectConfig();
void save();
private:
::Ui::BlurEffectConfig ui;
};
} // namespace KWin
#endif

View file

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlurEffectConfig</class>
<widget class="QWidget" name="BlurEffectConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>396</width>
<height>103</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Strength of the effect:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Light</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="kcfg_BlurRadius">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>14</number>
</property>
<property name="singleStep">
<number>2</number>
</property>
<property name="pageStep">
<number>2</number>
</property>
<property name="value">
<number>12</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Strong</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_CacheTexture">
<property name="toolTip">
<string extracomment="Enables an internal texture cache which saves the background of the blurred area. This results in less repaints and in a slightly higher memory usage."/>
</property>
<property name="text">
<string>Save intermediate rendering results.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,5 +0,0 @@
File=blur.kcfg
ClassName=BlurConfig
NameSpace=KWin
Singleton=true
Mutators=true

View file

@ -1,506 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "blurshader.h"
#include <kwineffects.h>
#include <kwinglplatform.h>
#include <QByteArray>
#include <QMatrix4x4>
#include <QTextStream>
#include <QVector2D>
#include <KDebug>
#include <cmath>
using namespace KWin;
BlurShader::BlurShader()
: mRadius(0), mValid(false)
{
}
BlurShader::~BlurShader()
{
}
BlurShader *BlurShader::create()
{
if (GLSLBlurShader::supported())
return new GLSLBlurShader();
#ifdef KWIN_HAVE_OPENGL_1
return new ARBBlurShader();
#else
return NULL;
#endif
}
void BlurShader::setRadius(int radius)
{
const int r = qMax(radius, 2);
if (mRadius != r) {
mRadius = r;
reset();
init();
}
}
void BlurShader::setDirection(Qt::Orientation direction)
{
mDirection = direction;
}
float BlurShader::gaussian(float x, float sigma) const
{
return (1.0 / std::sqrt(2.0 * M_PI) * sigma)
* std::exp(-((x * x) / (2.0 * sigma * sigma)));
}
QList<KernelValue> BlurShader::gaussianKernel() const
{
int size = qMin(mRadius | 1, maxKernelSize());
if (!(size & 0x1))
size -= 1;
QList<KernelValue> kernel;
const int center = size / 2;
const qreal sigma = (size - 1) / 2.5;
kernel << KernelValue(0.0, gaussian(0.0, sigma));
float total = kernel[0].g;
for (int x = 1; x <= center; x++) {
const float fx = (x - 1) * 2 + 1.5;
const float g1 = gaussian(fx - 0.5, sigma);
const float g2 = gaussian(fx + 0.5, sigma);
// Offset taking the contribution of both pixels into account
const float offset = .5 - g1 / (g1 + g2);
kernel << KernelValue(fx + offset, g1 + g2);
kernel << KernelValue(-(fx + offset), g1 + g2);
total += (g1 + g2) * 2;
}
qSort(kernel);
// Normalize the kernel
for (int i = 0; i < kernel.count(); i++)
kernel[i].g /= total;
return kernel;
}
// ----------------------------------------------------------------------------
GLSLBlurShader::GLSLBlurShader()
: BlurShader(), shader(NULL)
{
}
GLSLBlurShader::~GLSLBlurShader()
{
reset();
}
void GLSLBlurShader::reset()
{
delete shader;
shader = NULL;
setIsValid(false);
}
bool GLSLBlurShader::supported()
{
if (!GLPlatform::instance()->supports(GLSL))
return false;
if (effects->compositingType() == OpenGL1Compositing)
return false;
(void) glGetError(); // Clear the error state
#ifdef KWIN_HAVE_OPENGL_1
// These are the minimum values the implementation is required to support
int value = 0;
glGetIntegerv(GL_MAX_VARYING_FLOATS, &value);
if (value < 32)
return false;
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &value);
if (value < 64)
return false;
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &value);
if (value < 512)
return false;
#endif
if (glGetError() != GL_NO_ERROR)
return false;
return true;
}
void GLSLBlurShader::setPixelDistance(float val)
{
if (!isValid())
return;
QVector2D pixelSize(0.0, 0.0);
if (direction() == Qt::Horizontal)
pixelSize.setX(val);
else
pixelSize.setY(val);
shader->setUniform(pixelSizeLocation, pixelSize);
}
void GLSLBlurShader::setTextureMatrix(const QMatrix4x4 &matrix)
{
if (!isValid())
return;
shader->setUniform(textureMatrixLocation, matrix);
}
void GLSLBlurShader::setModelViewProjectionMatrix(const QMatrix4x4 &matrix)
{
if (!isValid())
return;
shader->setUniform(mvpMatrixLocation, matrix);
}
void GLSLBlurShader::bind()
{
if (!isValid())
return;
ShaderManager::instance()->pushShader(shader);
}
void GLSLBlurShader::unbind()
{
ShaderManager::instance()->popShader();
}
int GLSLBlurShader::maxKernelSize() const
{
#ifdef KWIN_HAVE_OPENGLES
// GL_MAX_VARYING_FLOATS not available in GLES
// querying for GL_MAX_VARYING_VECTORS crashes on nouveau
// using the minimum value of 8
return 8 * 2;
#else
int value;
glGetIntegerv(GL_MAX_VARYING_FLOATS, &value);
// Maximum number of vec4 varyings * 2
// The code generator will pack two vec2's into each vec4.
return value / 2;
#endif
}
void GLSLBlurShader::init()
{
QList<KernelValue> kernel = gaussianKernel();
const int size = kernel.size();
const int center = size / 2;
QList<QVector4D> offsets;
for (int i = 0; i < kernel.size(); i += 2) {
QVector4D vec4(0, 0, 0, 0);
vec4.setX(kernel[i].x);
vec4.setY(kernel[i].x);
if (i < kernel.size() - 1) {
vec4.setZ(kernel[i + 1].x);
vec4.setW(kernel[i + 1].x);
}
offsets << vec4;
}
#ifdef KWIN_HAVE_OPENGLES
const bool glsl_140 = false;
#else
const bool glsl_140 = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
#endif
QByteArray vertexSource;
QByteArray fragmentSource;
const QByteArray attribute = glsl_140 ? "in" : "attribute";
const QByteArray varying_in = glsl_140 ? "noperspective in" : "varying";
const QByteArray varying_out = glsl_140 ? "noperspective out" : "varying";
const QByteArray texture2D = glsl_140 ? "texture" : "texture2D";
const QByteArray fragColor = glsl_140 ? "fragColor" : "gl_FragColor";
// Vertex shader
// ===================================================================
QTextStream stream(&vertexSource);
if (glsl_140)
stream << "#version 140\n\n";
stream << "uniform mat4 modelViewProjectionMatrix;\n";
stream << "uniform mat4 textureMatrix;\n";
stream << "uniform vec2 pixelSize;\n\n";
stream << attribute << " vec4 vertex;\n\n";
stream << varying_out << " vec4 samplePos[" << std::ceil(size / 2.0) << "];\n";
stream << "\n";
stream << "void main(void)\n";
stream << "{\n";
stream << " vec4 center = vec4(textureMatrix * vertex).stst;\n";
stream << " vec4 ps = pixelSize.stst;\n\n";
for (int i = 0; i < offsets.size(); i++) {
stream << " samplePos[" << i << "] = center + ps * vec4("
<< offsets[i].x() << ", " << offsets[i].y() << ", "
<< offsets[i].z() << ", " << offsets[i].w() << ");\n";
}
stream << "\n";
stream << " gl_Position = modelViewProjectionMatrix * vertex;\n";
stream << "}\n";
stream.flush();
// Fragment shader
// ===================================================================
QTextStream stream2(&fragmentSource);
if (glsl_140)
stream2 << "#version 140\n\n";
stream2 << "uniform sampler2D texUnit;\n";
stream2 << varying_in << " vec4 samplePos[" << std::ceil(size / 2.0) << "];\n\n";
for (int i = 0; i <= center; i++)
stream2 << "const float kernel" << i << " = " << kernel[i].g << ";\n";
stream2 << "\n";
if (glsl_140)
stream2 << "out vec4 fragColor;\n\n";
stream2 << "void main(void)\n";
stream2 << "{\n";
stream2 << " vec4 sum = " << texture2D << "(texUnit, samplePos[0].st) * kernel0;\n";
for (int i = 1, j = -center + 1; i < size; i++, j++)
stream2 << " sum = sum + " << texture2D << "(texUnit, samplePos[" << i / 2
<< ((i % 2) ? "].pq)" : "].st)") << " * kernel" << center - qAbs(j) << ";\n";
stream2 << " " << fragColor << " = sum;\n";
stream2 << "}\n";
stream2.flush();
shader = ShaderManager::instance()->loadShaderFromCode(vertexSource, fragmentSource);
if (shader->isValid()) {
pixelSizeLocation = shader->uniformLocation("pixelSize");
textureMatrixLocation = shader->uniformLocation("textureMatrix");
mvpMatrixLocation = shader->uniformLocation("modelViewProjectionMatrix");
QMatrix4x4 modelViewProjection;
modelViewProjection.ortho(0, displayWidth(), displayHeight(), 0, 0, 65535);
ShaderManager::instance()->pushShader(shader);
shader->setUniform(textureMatrixLocation, QMatrix4x4());
shader->setUniform(mvpMatrixLocation, modelViewProjection);
ShaderManager::instance()->popShader();
}
setIsValid(shader->isValid());
}
// ----------------------------------------------------------------------------
#ifdef KWIN_HAVE_OPENGL_1
ARBBlurShader::ARBBlurShader()
: BlurShader(), program(0)
{
}
ARBBlurShader::~ARBBlurShader()
{
reset();
}
void ARBBlurShader::reset()
{
if (program) {
glDeleteProgramsARB(1, &program);
program = 0;
}
setIsValid(false);
}
bool ARBBlurShader::supported()
{
if (!hasGLExtension("GL_ARB_fragment_program"))
return false;
(void) glGetError(); // Clear the error state
// These are the minimum values the implementation is required to support
int value = 0;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_PARAMETERS_ARB, &value);
if (value < 24)
return false;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB, &value);
if (value < 16)
return false;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB, &value);
if (value < 72)
return false;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, &value);
if (value < 24)
return false;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, &value);
if (value < 4)
return false;
if (glGetError() != GL_NO_ERROR)
return false;
return true;
}
void ARBBlurShader::setPixelDistance(float val)
{
float firstStep = val * 1.5;
float nextStep = val * 2.0;
if (direction() == Qt::Horizontal) {
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, firstStep, 0, 0, 0);
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, nextStep, 0, 0, 0);
} else {
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 0, firstStep, 0, 0);
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0, nextStep, 0, 0);
}
}
void ARBBlurShader::bind()
{
if (!isValid())
return;
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, program);
}
void ARBBlurShader::unbind()
{
int boundObject;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &boundObject);
if (boundObject == (int)program) {
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
glDisable(GL_FRAGMENT_PROGRAM_ARB);
}
}
int ARBBlurShader::maxKernelSize() const
{
int value;
int result;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_PARAMETERS_ARB, &value);
result = (value - 1) * 2; // We only need to store half the kernel, since it's symmetrical
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB, &value);
result = qMin(result, value / 3); // We need 3 instructions / sample
return result;
}
void ARBBlurShader::init()
{
QList<KernelValue> kernel = gaussianKernel();
const int size = kernel.size();
const int center = size / 2;
QByteArray text;
QTextStream stream(&text);
stream << "!!ARBfp1.0\n";
// The kernel values are hardcoded into the program
for (int i = 0; i <= center; i++)
stream << "PARAM kernel" << i << " = " << kernel[center + i].g << ";\n";
stream << "PARAM firstSample = program.local[0];\n"; // Distance from gl_TexCoord[0] to the next sample
stream << "PARAM nextSample = program.local[1];\n"; // Distance to the subsequent sample
// Temporary variables to hold coordinates and texture samples
for (int i = 0; i < size; i++)
stream << "TEMP temp" << i << ";\n";
// Compute the texture coordinates
stream << "ADD temp1, fragment.texcoord[0], firstSample;\n"; // temp1 = gl_TexCoord[0] + firstSample
stream << "SUB temp2, fragment.texcoord[0], firstSample;\n"; // temp2 = gl_TexCoord[0] - firstSample
for (int i = 1, j = 3; i < center; i++, j += 2) {
stream << "ADD temp" << j + 0 << ", temp" << j - 2 << ", nextSample;\n";
stream << "SUB temp" << j + 1 << ", temp" << j - 1 << ", nextSample;\n";
}
// Sample the texture coordinates
stream << "TEX temp0, fragment.texcoord[0], texture[0], 2D;\n";
for (int i = 1; i < size; i++)
stream << "TEX temp" << i << ", temp" << i << ", texture[0], 2D;\n";
// Multiply the samples with the kernel values and compute the sum
stream << "MUL temp0, temp0, kernel0;\n";
for (int i = 0, j = 1; i < center; i++) {
stream << "MAD temp0, temp" << j++ << ", kernel" << i + 1 << ", temp0;\n";
stream << "MAD temp0, temp" << j++ << ", kernel" << i + 1 << ", temp0;\n";
}
stream << "MOV result.color, temp0;\n"; // gl_FragColor = temp0
stream << "END\n";
stream.flush();
glGenProgramsARB(1, &program);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, program);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, text.length(), text.constData());
if (glGetError()) {
const char *error = (const char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB);
kError() << "Failed to compile fragment program:" << error;
setIsValid(false);
} else
setIsValid(true);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
}
#endif

View file

@ -1,152 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLURSHADER_H
#define BLURSHADER_H
#include <kwinglutils.h>
class QMatrix4x4;
namespace KWin
{
struct KernelValue
{
KernelValue() {}
KernelValue(float x, float g) : x(x), g(g) {}
bool operator < (const KernelValue &other) const { return x < other.x; }
float x;
float g;
};
class BlurShader
{
public:
BlurShader();
virtual ~BlurShader();
static BlurShader *create();
bool isValid() const {
return mValid;
}
// Sets the radius in pixels
void setRadius(int radius);
int radius() const {
return mRadius;
}
// Sets the blur direction
void setDirection(Qt::Orientation direction);
Qt::Orientation direction() const {
return mDirection;
}
// Sets the distance between two pixels
virtual void setPixelDistance(float val) = 0;
virtual void setTextureMatrix(const QMatrix4x4 &matrix) = 0;
virtual void setModelViewProjectionMatrix(const QMatrix4x4 &matrix) = 0;
virtual void bind() = 0;
virtual void unbind() = 0;
protected:
float gaussian(float x, float sigma) const;
QList<KernelValue> gaussianKernel() const;
void setIsValid(bool value) {
mValid = value;
}
virtual void init() = 0;
virtual void reset() = 0;
virtual int maxKernelSize() const = 0;
private:
int mRadius;
Qt::Orientation mDirection;
bool mValid;
};
// ----------------------------------------------------------------------------
class GLSLBlurShader : public BlurShader
{
public:
GLSLBlurShader();
~GLSLBlurShader();
void setPixelDistance(float val);
void bind();
void unbind();
void setTextureMatrix(const QMatrix4x4 &matrix);
void setModelViewProjectionMatrix(const QMatrix4x4 &matrix);
static bool supported();
protected:
void init();
void reset();
int maxKernelSize() const;
private:
GLShader *shader;
int mvpMatrixLocation;
int textureMatrixLocation;
int pixelSizeLocation;
};
// ----------------------------------------------------------------------------
#ifdef KWIN_HAVE_OPENGL_1
class ARBBlurShader : public BlurShader
{
public:
ARBBlurShader();
~ARBBlurShader();
void setPixelDistance(float val);
void bind();
void unbind();
void setTextureMatrix(const QMatrix4x4 &) {}
void setModelViewProjectionMatrix(const QMatrix4x4 &) {}
static bool supported();
protected:
void init();
void reset();
int maxKernelSize() const;
private:
GLuint program;
};
#endif
} // namespace KWin
#endif

View file

@ -20,8 +20,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include <kwinconfig.h>
#include "dashboard/dashboard_config.h" #include "dashboard/dashboard_config.h"
#include "diminactive/diminactive_config.h" #include "diminactive/diminactive_config.h"
#include "presentwindows/presentwindows_config.h" #include "presentwindows/presentwindows_config.h"
@ -31,15 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "windowgeometry/windowgeometry_config.h" #include "windowgeometry/windowgeometry_config.h"
#include "zoom/zoom_config.h" #include "zoom/zoom_config.h"
#include "blur/blur_config.h"
#include "glide/glide_config.h"
#include "invert/invert_config.h"
#include "lookingglass/lookingglass_config.h"
#include "magnifier/magnifier_config.h" #include "magnifier/magnifier_config.h"
#include "mouseclick/mouseclick_config.h"
#include "mousemark/mousemark_config.h" #include "mousemark/mousemark_config.h"
#include "trackmouse/trackmouse_config.h" #include "trackmouse/trackmouse_config.h"
#include "wobblywindows/wobblywindows_config.h"
#include <kwineffects.h> #include <kwineffects.h>
@ -58,15 +50,9 @@ KWIN_EFFECT_CONFIG_MULTIPLE(builtins,
KWIN_EFFECT_CONFIG_SINGLE(windowgeometry, WindowGeometryConfig) KWIN_EFFECT_CONFIG_SINGLE(windowgeometry, WindowGeometryConfig)
KWIN_EFFECT_CONFIG_SINGLE(zoom, ZoomEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(zoom, ZoomEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(blur, BlurEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(glide, GlideEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(invert, InvertEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(lookingglass, LookingGlassEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(mouseclick, MouseClickEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(magnifier, MagnifierEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(magnifier, MagnifierEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(mousemark, MouseMarkEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(mousemark, MouseMarkEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(trackmouse, TrackMouseEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(trackmouse, TrackMouseEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(wobblywindows, WobblyWindowsEffectConfig)
) )
} // namespace } // namespace

View file

@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include "dimscreen.h" #include "dimscreen.h"
#include <kwinglutils.h>
namespace KWin namespace KWin
{ {

View file

@ -1,30 +0,0 @@
#######################################
# Effect
# Source files
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
glide/glide.cpp
)
kde4_add_kcfg_files(kwin4_effect_builtins_sources glide/glideconfig.kcfgc)
# .desktop files
install( FILES
glide/glide.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
#######################################
# Config
# Source files
set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
glide/glide_config.cpp
glide/glide_config.ui )
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources glide/glideconfig.kcfgc)
# .desktop files
install( FILES
glide/glide_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View file

@ -1,251 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.com>
Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org>
Copyright (C) 2010 Alexandre Pereira <pereira.alex@gmail.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "glide.h"
// KConfigSkeleton
#include "glideconfig.h"
#include <QTimeLine>
// Effect is based on fade effect by Philip Falkner
namespace KWin
{
KWIN_EFFECT(glide, GlideEffect)
KWIN_EFFECT_SUPPORTED(glide, GlideEffect::supported())
static const int IsGlideWindow = 0x22A982D4;
static Atom slideAtom;
GlideEffect::GlideEffect()
{
slideAtom = XInternAtom( display(), "_KDE_SLIDE", False );
effects->registerPropertyType( slideAtom, true );
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
}
GlideEffect::~GlideEffect()
{
effects->registerPropertyType( slideAtom, false );
}
bool GlideEffect::supported()
{
return effects->isOpenGLCompositing();
}
void GlideEffect::reconfigure(ReconfigureFlags)
{
// Fetch config with KConfigXT
GlideConfig::self()->readConfig();
duration = animationTime<GlideConfig>(350);
effect = (EffectStyle) GlideConfig::glideEffect();
angle = GlideConfig::glideAngle();
}
void GlideEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{
if (!windows.isEmpty())
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
effects->prePaintScreen(data, time);
}
void GlideEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{
InfoHash::iterator info = windows.find(w);
if (info != windows.end()) {
data.setTransformed();
if (info->added)
info->timeLine->setCurrentTime(info->timeLine->currentTime() + time);
else if (info->closed) {
info->timeLine->setCurrentTime(info->timeLine->currentTime() - time);
if (info->deleted)
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE);
}
}
effects->prePaintWindow(w, data, time);
// if the window isn't to be painted, then let's make sure
// to track its progress
if (info != windows.end() && !w->isPaintingEnabled() && !effects->activeFullScreenEffect())
w->addRepaintFull();
}
void GlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
InfoHash::const_iterator info = windows.constFind(w);
if (info != windows.constEnd()) {
const double progress = info->timeLine->currentValue();
data.setRotationAxis(Qt::XAxis);
data.setRotationAngle(angle * (1 - progress));
data.multiplyOpacity(progress);
switch(effect) {
default:
case GlideInOut:
if (info->added)
glideIn(w, data);
else if (info->closed)
glideOut(w, data);
break;
case GlideOutIn:
if (info->added)
glideOut(w, data);
if (info->closed)
glideIn(w, data);
break;
case GlideIn: glideIn(w, data); break;
case GlideOut: glideOut(w, data); break;
}
}
effects->paintWindow(w, mask, region, data);
}
void GlideEffect::glideIn(EffectWindow* w, WindowPaintData& data)
{
InfoHash::const_iterator info = windows.constFind(w);
if (info == windows.constEnd())
return;
const double progress = info->timeLine->currentValue();
data *= progress;
data.translate(int(w->width() / 2 * (1 - progress)), int(w->height() / 2 * (1 - progress)));
}
void GlideEffect::glideOut(EffectWindow* w, WindowPaintData& data)
{
InfoHash::const_iterator info = windows.constFind(w);
if (info == windows.constEnd())
return;
const double progress = info->timeLine->currentValue();
data *= (2 - progress);
data.translate(- int(w->width() / 2 * (1 - progress)), - int(w->height() / 2 * (1 - progress)));
}
void GlideEffect::postPaintWindow(EffectWindow* w)
{
InfoHash::iterator info = windows.find(w);
if (info != windows.end()) {
if (info->added && info->timeLine->currentValue() == 1.0) {
windows.remove(w);
effects->addRepaintFull();
} else if (info->closed && info->timeLine->currentValue() == 0.0) {
info->closed = false;
if (info->deleted) {
windows.remove(w);
w->unrefWindow();
}
effects->addRepaintFull();
}
if (info->added || info->closed)
w->addRepaintFull();
}
effects->postPaintWindow(w);
}
void GlideEffect::slotWindowAdded(EffectWindow* w)
{
if (!isGlideWindow(w))
return;
w->setData(IsGlideWindow, true);
const void *addGrab = w->data(WindowAddedGrabRole).value<void*>();
if (addGrab && addGrab != this)
return;
w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
InfoHash::iterator it = windows.find(w);
WindowInfo *info = (it == windows.end()) ? &windows[w] : &it.value();
info->added = true;
info->closed = false;
info->deleted = false;
delete info->timeLine;
info->timeLine = new QTimeLine(duration);
info->timeLine->setCurveShape(QTimeLine::EaseOutCurve);
w->addRepaintFull();
}
void GlideEffect::slotWindowClosed(EffectWindow* w)
{
if (!isGlideWindow(w))
return;
const void *closeGrab = w->data(WindowClosedGrabRole).value<void*>();
if (closeGrab && closeGrab != this)
return;
w->refWindow();
w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
InfoHash::iterator it = windows.find(w);
WindowInfo *info = (it == windows.end()) ? &windows[w] : &it.value();
info->added = false;
info->closed = true;
info->deleted = true;
delete info->timeLine;
info->timeLine = new QTimeLine(duration);
info->timeLine->setCurveShape(QTimeLine::EaseInCurve);
info->timeLine->setCurrentTime(info->timeLine->duration());
w->addRepaintFull();
}
void GlideEffect::slotWindowDeleted(EffectWindow* w)
{
windows.remove(w);
}
bool GlideEffect::isGlideWindow(EffectWindow* w)
{
if (effects->activeFullScreenEffect())
return false;
if (w->data(IsGlideWindow).toBool())
return true;
if (!w->readProperty( slideAtom, slideAtom, 32 ).isNull())
return false;
if (w->hasDecoration())
return true;
if (!w->isManaged() || w->isMenu() || w->isNotification() || w->isDesktop() ||
w->isDock() || w->isSplash() || w->isToolbar() ||
w->windowClass() == "dashboard dashboard")
return false;
return true;
}
bool GlideEffect::isActive() const
{
return !windows.isEmpty();
}
GlideEffect::WindowInfo::WindowInfo()
: deleted(false)
, added(false)
, closed(false)
, timeLine(0)
{
}
GlideEffect::WindowInfo::~WindowInfo()
{
delete timeLine;
}
} // namespace

View file

@ -1,135 +0,0 @@
[Desktop Entry]
Name=Glide
Name[ar]=الطيران
Name[ast]=Glide
Name[bg]=Приплъзване
Name[bs]=Uletanje
Name[ca]=Lliscament
Name[ca@valencia]=Lliscament
Name[cs]=Klouzání
Name[da]=Svæv
Name[de]=Gleiten
Name[el]=Ολίσθηση
Name[en_GB]=Glide
Name[es]=Glide
Name[et]=Liuglemine
Name[eu]=Lerratu
Name[fi]=Ikkunaliuku
Name[fr]=Glisser
Name[ga]=Sleamhnaigh
Name[gl]=Deslizamento
Name[he]=גלישה
Name[hi]=
Name[hr]=Klizanje
Name[hu]=Siklás
Name[ia]=Glissa
Name[id]=Glide
Name[is]=Svífa
Name[it]=Plana
Name[ja]=
Name[kk]=Сырғанау
Name[km]=
Name[kn]=
Name[ko]=
Name[lt]=Sklendimas
Name[lv]=Slīdēt
Name[mr]=
Name[nb]=Skyv
Name[nds]=Glieden
Name[nl]=Schuiven
Name[nn]=Skliding
Name[pa]=
Name[pl]=Szybowanie
Name[pt]=Deslizar
Name[pt_BR]=Deslizar
Name[ro]=Scurgere
Name[ru]=Скольжение
Name[si]=
Name[sk]=Kĺzať
Name[sl]=Drsenje
Name[sr]=Улетање
Name[sr@ijekavian]=Улетање
Name[sr@ijekavianlatin]=Uletanje
Name[sr@latin]=Uletanje
Name[sv]=Glid
Name[th]=
Name[tr]=Kaydır
Name[ug]=سىيرىل
Name[uk]=Плин
Name[vi]=Trưt
Name[wa]=Ridaedje
Name[x-test]=xxGlidexx
Name[zh_CN]=
Name[zh_TW]=
Icon=preferences-system-windows-effect-sheet
Comment=Windows Glide Effect as they are open and closed
Comment[ar]=تأثير الطيران للنوافذ عند فتحها أو غلقها
Comment[ast]=Efeutos Glide cuando s'abren y zarren ventanes
Comment[bg]=Създава ефект на приплъзване при отваряне и затваряне на прозорците
Comment[bs]=Prozori ulijeću pri otvaranju i izlijeću pri zatvaranju
Comment[ca]=Provoca un efecte de lliscament quan s'obren i es tanquen
Comment[ca@valencia]=Provoca un efecte de lliscament quan s'obren i es tanquen
Comment[cs]=Efekt klouzání okna při jejich otevření a zavření
Comment[da]=Svæveeffekt til vinduer når de åbnes og lukkes
Comment[de]=Lässt Fenster beim Öffnen/Schließen gleiten.
Comment[el]=Εφέ ολίσθησης παραθύρων κατά το άνοιγμα και το κλείσιμο
Comment[en_GB]=Windows Glide Effect as they are open and closed
Comment[es]=Efectos Glide cuando se abren y cierran ventanas
Comment[et]=Akende liuglemise efekt nende avamisel ja sulgemisel
Comment[eu]=Leihoek lerratze-efektua egiten dute irekitzean eta ixtean
Comment[fi]=Ikkunoiden liukutehoste niitä avattaessa ja suljettaessa
Comment[ga]=Maisíocht Sleamhnaithe agus fuinneoga á n-oscailt agus á ndúnadh
Comment[gl]=Efecto de deslizamento das xanelas cando se pechan e abren
Comment[he]=אפקט גלישת חלונות בפתיחתם וסגירתם
Comment[hr]=Efekt kližućih prozora dok se otvaraju i zatvaraju
Comment[hu]=Az ablakok be- illetve kisiklanak megnyitáskor és bezáráskor
Comment[ia]=Effectos de glissar durante que illos es aperite e claudite
Comment[id]=Efek Glid Jendela ketika jendela dibuka dan ditutup
Comment[is]=Lætur glugga svífa þegar þeir eru opnaðir eða þeim er lokað
Comment[kk]=Терезелерді сырғанатып ашу-жабу эффекті
Comment[km]=
Comment[kn]=ಿಿ ಿ
Comment[ko]=
Comment[lt]=Langų sklendimo efektas juos atidarant ir uždarant
Comment[lv]=Liek logiem slīdēt, kad tos atver vai aizver
Comment[mr]=
Comment[nb]=Gjør at vinduer skyves når de åpnes og lukkes
Comment[nds]=Finstern bi't Op- oder Tomaken glieden laten
Comment[nl]=Laat vensters schuiven als ze worden geopend of gesloten
Comment[nn]=Windows-sklieffekt når dei vert opna og lukka
Comment[pa]=ਿ ,
Comment[pl]=Szybowanie okien przy ich zamykaniu lub otwieraniu
Comment[pt]=Fazer as janelas deslizar ao serem abertas/fechadas
Comment[pt_BR]=Efeito que faz as janelas deslizarem ao serem abertas/fechadas
Comment[ro]=Efect de scurgere a ferestrelor la deschiderea și închiderea acestora
Comment[ru]=Эффект скольжения при открытии и закрытии окон
Comment[si]=
Comment[sk]=Efekt kĺzania okien pri otvorení alebo zatvorení
Comment[sl]=Ko se okna odprejo zaprejo, zdrsnejo
Comment[sr]=Прозори улећу при отварању и излећу при затварању
Comment[sr@ijekavian]=Прозори улећу при отварању и излећу при затварању
Comment[sr@ijekavianlatin]=Prozori uleću pri otvaranju i izleću pri zatvaranju
Comment[sr@latin]=Prozori uleću pri otvaranju i izleću pri zatvaranju
Comment[sv]=Glideffekt för fönster när de öppnas och stängs
Comment[th]=
Comment[tr]=Açılırken ve kapatılırken pencere Kaydırma efekti
Comment[ug]=كۆزنەكنى ئېچىپ ياكى ياپقاندا سىيرىلىش ئۈنۈمىنى كۆرسىتىدۇ
Comment[uk]=Ефекти плину вікон під час відкриття та закриття
Comment[wa]=Efet d' ridaedje des fniesses cwand ele sont drovowes eyet cloyowes
Comment[x-test]=xxWindows Glide Effect as they are open and closedxx
Comment[zh_CN]=使
Comment[zh_TW]=
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Alexandre Pereira
X-KDE-PluginInfo-Email=pereira.alex@gmail.com
X-KDE-PluginInfo-Name=kwin4_effect_glide
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Category=Appearance
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-Library=kwin4_effect_builtins
X-KDE-Ordering=50
X-KWin-Requires-OpenGL=true

View file

@ -1,98 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.com>
Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org>
Copyright (C) 2010 Alexandre Pereira <pereira.alex@gmail.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_GLIDE_H
#define KWIN_GLIDE_H
#include <kwineffects.h>
class QTimeLine;
namespace KWin
{
class GlideEffect
: public Effect
{
Q_OBJECT
Q_PROPERTY(int duration READ configuredDuration)
Q_PROPERTY(int effect READ configuredEffect)
Q_PROPERTY(int angle READ configuredAngle)
public:
GlideEffect();
~GlideEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintWindow(EffectWindow* w);
virtual bool isActive() const;
static bool supported();
// for properties
int configuredDuration() const {
return duration;
}
int configuredEffect() const {
return effect;
}
int configuredAngle() const {
return angle;
}
public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow* c);
void slotWindowClosed(KWin::EffectWindow *c);
void slotWindowDeleted(KWin::EffectWindow *w);
private:
class WindowInfo;
typedef QMap< const EffectWindow*, WindowInfo > InfoHash;
void glideIn(EffectWindow* w, WindowPaintData& data);
void glideOut(EffectWindow* w, WindowPaintData& data);
bool isGlideWindow(EffectWindow* w);
InfoHash windows;
float duration;
int angle;
enum EffectStyle {
GlideIn = 0,
GlideInOut = 1,
GlideOutIn = 2,
GlideOut = 3
};
EffectStyle effect;
};
class GlideEffect::WindowInfo
{
public:
WindowInfo();
~WindowInfo();
bool deleted;
bool added;
bool closed;
QTimeLine *timeLine;
};
} // namespace
#endif

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-Glide">
<entry name="Duration" type="UInt">
<default>0</default>
</entry>
<entry name="GlideEffect" type="Int">
<default>0</default>
</entry>
<entry name="GlideAngle" type="Int">
<default>-90</default>
</entry>
</group>
</kcfg>

View file

@ -1,50 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
* Copyright (C) 2010 Alexandre Pereira <pereira.alex@gmail.com>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "glide_config.h"
// KConfigSkeleton
#include "glideconfig.h"
#include <kwineffects.h>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
GlideEffectConfig::GlideEffectConfig(QWidget *parent, const QVariantList &args)
: KCModule(EffectFactory::componentData(), parent, args)
{
ui.setupUi(this);
addConfig(GlideConfig::self(), this);
load();
}
GlideEffectConfig::~GlideEffectConfig()
{
}
void GlideEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("glide");
}
} // namespace KWin
#include "moc_glide_config.cpp"

View file

@ -1,70 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_glide
X-KDE-PluginKeyword=glide
Name=Glide
Name[ar]=الطيران
Name[ast]=Glide
Name[bg]=Приплъзване
Name[bs]=Uletanje
Name[ca]=Lliscament
Name[ca@valencia]=Lliscament
Name[cs]=Klouzání
Name[da]=Svæv
Name[de]=Gleiten
Name[el]=Ολίσθηση
Name[en_GB]=Glide
Name[es]=Glide
Name[et]=Liuglemine
Name[eu]=Lerratu
Name[fi]=Ikkunaliuku
Name[fr]=Glisser
Name[ga]=Sleamhnaigh
Name[gl]=Deslizamento
Name[he]=גלישה
Name[hi]=
Name[hr]=Klizanje
Name[hu]=Siklás
Name[ia]=Glissa
Name[id]=Glide
Name[is]=Svífa
Name[it]=Plana
Name[ja]=
Name[kk]=Сырғанау
Name[km]=
Name[kn]=
Name[ko]=
Name[lt]=Sklendimas
Name[lv]=Slīdēt
Name[mr]=
Name[nb]=Skyv
Name[nds]=Glieden
Name[nl]=Schuiven
Name[nn]=Skliding
Name[pa]=
Name[pl]=Szybowanie
Name[pt]=Deslizar
Name[pt_BR]=Deslizar
Name[ro]=Scurgere
Name[ru]=Скольжение
Name[si]=
Name[sk]=Kĺzať
Name[sl]=Drsenje
Name[sr]=Улетање
Name[sr@ijekavian]=Улетање
Name[sr@ijekavianlatin]=Uletanje
Name[sr@latin]=Uletanje
Name[sv]=Glid
Name[th]=
Name[tr]=Kaydır
Name[ug]=سىيرىل
Name[uk]=Плин
Name[vi]=Trưt
Name[wa]=Ridaedje
Name[x-test]=xxGlidexx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -1,47 +0,0 @@
/*
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
* Copyright (C) 2010 Alexandre Pereira <pereira.alex@gmail.com>
*
* 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 program; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef GLIDE_CONFIG_H
#define GLIDE_CONFIG_H
#include <KCModule>
#include "ui_glide_config.h"
namespace KWin
{
class GlideEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit GlideEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList());
~GlideEffectConfig();
void save();
private:
::Ui::GlideEffectConfig ui;
};
} // namespace KWin
#endif

View file

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GlideEffectConfig</class>
<widget class="QWidget" name="GlideEffectConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>306</width>
<height>130</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Glide Effect:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>In</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="kcfg_GlideEffect">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>3</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Out</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Glide Angle:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>-90</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="kcfg_GlideAngle">
<property name="minimum">
<number>-90</number>
</property>
<property name="maximum">
<number>90</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>45</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>90</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,5 +0,0 @@
File=glide.kcfg
ClassName=GlideConfig
NameSpace=KWin
Singleton=true
Mutators=true

View file

@ -1,33 +0,0 @@
#######################################
# Effect
# Source files
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
invert/invert.cpp
)
# .desktop files
install( FILES
invert/invert.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
# Data files
install( FILES
invert/data/1.10/invert.frag
DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.10 )
install( FILES
invert/data/1.40/invert.frag
DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.40 )
#######################################
# Config
# Source files
set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
invert/invert_config.cpp
)
# .desktop files
install( FILES
invert/invert_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View file

@ -1,22 +0,0 @@
uniform sampler2D sampler;
uniform vec4 modulation;
uniform float saturation;
varying vec2 varyingTexCoords;
void main()
{
vec4 tex = texture2D(sampler, varyingTexCoords);
if (saturation != 1.0) {
vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 );
desaturated = vec3( dot( desaturated, tex.rgb ));
tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation );
}
tex.rgb = vec3(1.0) - tex.rgb;
tex *= modulation;
tex.rgb *= tex.a;
gl_FragColor = tex;
}

View file

@ -1,25 +0,0 @@
#version 140
uniform sampler2D sampler;
uniform vec4 modulation;
uniform float saturation;
in vec2 varyingTexCoords;
out vec4 fragColor;
void main()
{
vec4 tex = texture(sampler, varyingTexCoords);
if (saturation != 1.0) {
vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 );
desaturated = vec3( dot( desaturated, tex.rgb ));
tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation );
}
tex.rgb = vec3(1.0) - tex.rgb;
tex *= modulation;
tex.rgb *= tex.a;
fragColor = tex;
}

View file

@ -1,186 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "invert.h"
#include <kwinglutils.h>
#include <kwinglplatform.h>
#include <kactioncollection.h>
#include <kaction.h>
#include <KGlobal>
#include <KLocalizedString>
#include <kdebug.h>
#include <KStandardDirs>
#include <QMatrix4x4>
namespace KWin
{
KWIN_EFFECT(invert, InvertEffect)
KWIN_EFFECT_SUPPORTED(invert, InvertEffect::supported())
InvertEffect::InvertEffect()
: m_inited(false),
m_valid(true),
m_shader(NULL),
m_allWindows(false)
{
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("Invert");
a->setText(i18n("Toggle Invert Effect"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleScreenInversion()));
KAction* b = (KAction*)actionCollection->addAction("InvertWindow");
b->setText(i18n("Toggle Invert Effect on Window"));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleWindow()));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(screenGeometryChanged(const QSize&)), this, SLOT(resetShader()));
}
InvertEffect::~InvertEffect()
{
delete m_shader;
}
bool InvertEffect::supported()
{
return effects->compositingType() == OpenGL2Compositing;
}
bool InvertEffect::loadData()
{
m_inited = true;
QString shadersDir = "kwin/shaders/1.10/";
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "invert.frag");
m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
if (!m_shader->isValid()) {
kError(1212) << "The shader failed to load!" << endl;
return false;
}
return true;
}
void InvertEffect::prePaintScreen(ScreenPrePaintData &data, int time)
{
effects->prePaintScreen(data, time);
}
void InvertEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time)
{
if (m_valid && (m_allWindows != m_windows.contains(w))) {
data.mask |= PAINT_WINDOW_TRANSFORMED;
}
effects->prePaintWindow(w, data, time);
}
void InvertEffect::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
// Load if we haven't already
if (m_valid && !m_inited)
m_valid = loadData();
bool useShader = m_valid && (m_allWindows != m_windows.contains(w));
if (useShader) {
ShaderManager *shaderManager = ShaderManager::instance();
GLShader *genericShader = shaderManager->pushShader(ShaderManager::GenericShader);
QMatrix4x4 screenTransformation = genericShader->getUniformMatrix4x4("screenTransformation");
shaderManager->popShader();
shaderManager->pushShader(m_shader);
m_shader->setUniform("screenTransformation", screenTransformation);
data.shader = m_shader;
}
effects->drawWindow(w, mask, region, data);
if (useShader) {
ShaderManager::instance()->popShader();
}
}
void InvertEffect::paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity)
{
if (m_valid && m_allWindows) {
frame->setShader(m_shader);
ShaderBinder binder(m_shader);
m_shader->setUniform("screenTransformation", QMatrix4x4());
m_shader->setUniform("windowTransformation", QMatrix4x4());
effects->paintEffectFrame(frame, region, opacity, frameOpacity);
} else {
effects->paintEffectFrame(frame, region, opacity, frameOpacity);
}
}
void InvertEffect::slotWindowClosed(EffectWindow* w)
{
m_windows.removeOne(w);
}
void InvertEffect::toggleScreenInversion()
{
m_allWindows = !m_allWindows;
effects->addRepaintFull();
}
void InvertEffect::toggleWindow()
{
if (!effects->activeWindow()) {
return;
}
if (!m_windows.contains(effects->activeWindow()))
m_windows.append(effects->activeWindow());
else
m_windows.removeOne(effects->activeWindow());
effects->activeWindow()->addRepaintFull();
}
bool InvertEffect::isActive() const
{
return m_valid && (m_allWindows || !m_windows.isEmpty());
}
bool InvertEffect::provides(Feature f)
{
return f == ScreenInversion;
}
void InvertEffect::resetShader()
{
ShaderManager::instance()->resetShader(m_shader, ShaderManager::GenericShader);
}
} // namespace
#include "moc_invert.cpp"

View file

@ -1,165 +0,0 @@
[Desktop Entry]
Name=Invert
Name[af]=Keer om
Name[ar]=اعكس
Name[ast]=Invertir
Name[be]=Інвертаваць
Name[be@latin]=Invercyja
Name[bg]=Обръщане на цвета
Name[bs]=Izvrtanje
Name[ca]=Inverteix
Name[ca@valencia]=Inverteix
Name[cs]=Invertovat
Name[csb]=Inwertëje
Name[da]=Invertér
Name[de]=Invertieren
Name[el]=Αντιστροφή
Name[en_GB]=Invert
Name[eo]=Inversigi
Name[es]=Invertir
Name[et]=Teistpidi
Name[eu]=Alderantzikatu
Name[fa]=وارونه
Name[fi]=Käänteiset värit
Name[fr]=Inverse
Name[fy]=Omdraaie
Name[ga]=Invert
Name[gl]=Inverter
Name[gu]=
Name[he]=היפוך צבעים
Name[hi]=
Name[hne]=
Name[hr]=Izokretanje
Name[hu]=Invertálás
Name[ia]=Inverte
Name[id]=Balik
Name[is]=Umhverfa
Name[it]=Inverti
Name[ja]=調
Name[kk]=Терістеу
Name[km]=
Name[kn]=ಿಿ ()
Name[ko]=
Name[ku]=Vajî
Name[lt]=Išvertimas
Name[lv]=Invertēt
Name[mai]=
Name[mk]=Инвертирање
Name[ml]= ിി
Name[mr]=
Name[nb]=Snu om
Name[nds]=Ümdreihen
Name[ne]=
Name[nl]=Omkeren
Name[nn]=Snu fargane
Name[oc]=Enversar
Name[pa]=
Name[pl]=Odwróć
Name[pt]=Inverter
Name[pt_BR]=Inverter
Name[ro]=Inversare
Name[ru]=Инверсия
Name[se]=Jorgalahte
Name[si]=
Name[sk]=Invertovať
Name[sl]=Obrni
Name[sr]=Извртање
Name[sr@ijekavian]=Извртање
Name[sr@ijekavianlatin]=Izvrtanje
Name[sr@latin]=Izvrtanje
Name[sv]=Invertera
Name[ta]=ி
Name[te]=
Name[tg]=Табдилдиҳӣ
Name[th]=
Name[tr]=Negatifleştir
Name[ug]=ئەكسى رەڭگە ئالماشتۇر
Name[uk]=Інверсія
Name[uz]=Teskari
Name[uz@cyrillic]=Тескари
Name[vi]=Đo ngưc
Name[wa]=Å rvier
Name[x-test]=xxInvertxx
Name[zh_CN]=
Name[zh_TW]=
Comment=Inverts the color of the desktop and windows
Comment[ar]=يعكس ألوان سطح المكتب و النوافذ
Comment[ast]=Invierte'l color del escritoriu y ventanes
Comment[be@latin]=Invertuje kolery stała j akon
Comment[bg]=Цветовете на работния плот и прозорците се обръщат
Comment[bs]=Izvrće boju površi i prozora
Comment[ca]=Inverteix el color de l'escriptori i les finestres
Comment[ca@valencia]=Inverteix el color de l'escriptori i les finestres
Comment[cs]=Invertuje barvy plochy a oken
Comment[da]=Inverterer farven på skrivebordet og vinduer
Comment[de]=Invertiert die Farben der Arbeitsfläche und Fenster.
Comment[el]=Αντιστροφή του χρώματος της επιφάνειας εργασίας και των παραθύρων
Comment[en_GB]=Inverts the colour of the desktop and windows
Comment[es]=Invierte el color del escritorio y ventanas
Comment[et]=Muudab töölaua ja akende värvi vastupidiseks
Comment[eu]=Mahaigainaren eta leihoen koloreak alderantzikatzen ditu
Comment[fi]=Kääntää työpöydän ja ikkunoiden värit
Comment[fy]=De kleur fan buroblêden en finster omdraaie
Comment[ga]=Inbhéartaigh dath na deisce agus dath na bhfuinneog
Comment[gl]=Inverte a cor do escritorio e das xanelas
Comment[gu]= િ
Comment[he]=היפוך צבעי שולחן העבודה והחלונות
Comment[hi]= ि
Comment[hne]= ि
Comment[hr]=Izokrene boje radne površine i prozora
Comment[hu]=Invertálja az asztal és az ablakok színét
Comment[ia]=Il inverte le colores del scriptorio e del fenestras
Comment[id]=Balik warna desktop dan jendela
Comment[is]=Umhverfir litum (í andstæða liti) á skjáborði og gluggum
Comment[kk]=Үстел мен терезелердің түстерін терістеу
Comment[km]=
Comment[kn]=ಿಿ ಿಿ ()
Comment[ko]=
Comment[lt]=Invertuoja darbastalio ir langų spalvas
Comment[lv]=Invertē darbvirsmas un logu krāsas
Comment[mk]=Ја инвертира бојата на раб. површина и на прозорците
Comment[ml]=ിിി ി (ി )
Comment[mr]=
Comment[nb]=Snur om (vender fortegn på) farger på skrivebordet og vinduene
Comment[nds]=Dreiht de Klören vun Schriefdisch un Finstern üm
Comment[nl]=Draait de kleuren van het bureaublad en de vensters om
Comment[nn]=Snu fargane på skrivebordet og vindauge
Comment[pa]= ਿ
Comment[pl]=Odwrócenie kolorów pulpitu i okien
Comment[pt]=Inverte a cor do ecrã e das janelas
Comment[pt_BR]=Inverte as cores das janelas e da área de trabalho
Comment[ro]=Inversează culoarea biroului și a ferestrelor
Comment[ru]=Инверсия цвета рабочего стола и окон
Comment[si]=
Comment[sk]=Invertuje farbu plochy a okien
Comment[sl]=Obrne barve namizja in oken
Comment[sr]=Изврће боју површи и прозора
Comment[sr@ijekavian]=Изврће боју површи и прозора
Comment[sr@ijekavianlatin]=Izvrće boju površi i prozora
Comment[sr@latin]=Izvrće boju površi i prozora
Comment[sv]=Invertera skrivbordets och fönstrens färg
Comment[ta]=Inverts the color of the desktop and windows
Comment[te]= ి ి ి ి.
Comment[th]=
Comment[tr]=Masaüstünün ve pencerelerin renklerini tersine çevir
Comment[ug]=ئۈستەلئۈستى ۋە كۆزنەكلەرنىڭ رەڭگىنى ئەكسى رەڭگە ئالماشتۇرىدۇ
Comment[uk]=Обернення кольорів стільниці і вікон
Comment[vi]=Đo ngưc màu màn hình làm vic và ca s
Comment[wa]=Met les coleurs do scribanne et des finiesses å rvier
Comment[x-test]=xxInverts the color of the desktop and windowsxx
Comment[zh_CN]=
Comment[zh_TW]=
Icon=preferences-system-windows-effect-invert
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Rivo Laks, Lucas Murray
X-KDE-PluginInfo-Email=rivolaks@hot.ee, lmurray@undefinedfire.com
X-KDE-PluginInfo-Name=kwin4_effect_invert
X-KDE-PluginInfo-Version=0.2.0
X-KDE-PluginInfo-Category=Accessibility
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-Library=kwin4_effect_builtins
X-KWin-Requires-OpenGL2=true

View file

@ -1,73 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_INVERT_H
#define KWIN_INVERT_H
#include <kwineffects.h>
namespace KWin
{
class GLShader;
/**
* Inverts desktop's colors
**/
class InvertEffect
: public Effect
{
Q_OBJECT
public:
InvertEffect();
~InvertEffect();
virtual void drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void prePaintScreen(ScreenPrePaintData &data, int time);
virtual void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time);
virtual void paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity);
virtual bool isActive() const;
virtual bool provides(Feature);
static bool supported();
public slots:
void toggleScreenInversion();
void toggleWindow();
void slotWindowClosed(KWin::EffectWindow *w);
private Q_SLOTS:
void resetShader();
protected:
bool loadData();
private:
bool m_inited;
bool m_valid;
GLShader* m_shader;
bool m_allWindows;
QList<EffectWindow*> m_windows;
};
} // namespace
#endif

View file

@ -1,96 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "invert_config.h"
#include <kwineffects.h>
#include <KLocalizedString>
#include <kdebug.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <QVBoxLayout>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
QVBoxLayout* layout = new QVBoxLayout(this);
// Shortcut config. The shortcut belongs to the component "kwin"!
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = static_cast<KAction*>(actionCollection->addAction("Invert"));
a->setText(i18n("Toggle Invert Effect"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I));
KAction* b = static_cast<KAction*>(actionCollection->addAction("InvertWindow"));
b->setText(i18n("Toggle Invert Effect on Window"));
b->setProperty("isConfigurationAction", true);
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
mShortcutEditor = new KShortcutsEditor(actionCollection, this,
KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed);
connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
layout->addWidget(mShortcutEditor);
load();
}
InvertEffectConfig::~InvertEffectConfig()
{
// Undo (only) unsaved changes to global key shortcuts
mShortcutEditor->undoChanges();
}
void InvertEffectConfig::load()
{
KCModule::load();
emit changed(false);
}
void InvertEffectConfig::save()
{
KCModule::save();
mShortcutEditor->save(); // undo() will restore to this state from now on
emit changed(false);
EffectsHandler::sendReloadMessage("invert");
}
void InvertEffectConfig::defaults()
{
mShortcutEditor->allDefault();
emit changed(true);
}
} // namespace
#include "moc_invert_config.cpp"

View file

@ -1,92 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_invert
X-KDE-PluginKeyword=invert
Name=Invert
Name[af]=Keer om
Name[ar]=اعكس
Name[ast]=Invertir
Name[be]=Інвертаваць
Name[be@latin]=Invercyja
Name[bg]=Обръщане на цвета
Name[bs]=Izvrtanje
Name[ca]=Inverteix
Name[ca@valencia]=Inverteix
Name[cs]=Invertovat
Name[csb]=Inwertëje
Name[da]=Invertér
Name[de]=Invertieren
Name[el]=Αντιστροφή
Name[en_GB]=Invert
Name[eo]=Inversigi
Name[es]=Invertir
Name[et]=Teistpidi
Name[eu]=Alderantzikatu
Name[fa]=وارونه
Name[fi]=Käänteiset värit
Name[fr]=Inverse
Name[fy]=Omdraaie
Name[ga]=Invert
Name[gl]=Inverter
Name[gu]=
Name[he]=היפוך צבעים
Name[hi]=
Name[hne]=
Name[hr]=Izokretanje
Name[hu]=Invertálás
Name[ia]=Inverte
Name[id]=Balik
Name[is]=Umhverfa
Name[it]=Inverti
Name[ja]=調
Name[kk]=Терістеу
Name[km]=
Name[kn]=ಿಿ ()
Name[ko]=
Name[ku]=Vajî
Name[lt]=Išvertimas
Name[lv]=Invertēt
Name[mai]=
Name[mk]=Инвертирање
Name[ml]= ിി
Name[mr]=
Name[nb]=Snu om
Name[nds]=Ümdreihen
Name[ne]=
Name[nl]=Omkeren
Name[nn]=Snu fargane
Name[oc]=Enversar
Name[pa]=
Name[pl]=Odwróć
Name[pt]=Inverter
Name[pt_BR]=Inverter
Name[ro]=Inversare
Name[ru]=Инверсия
Name[se]=Jorgalahte
Name[si]=
Name[sk]=Invertovať
Name[sl]=Obrni
Name[sr]=Извртање
Name[sr@ijekavian]=Извртање
Name[sr@ijekavianlatin]=Izvrtanje
Name[sr@latin]=Izvrtanje
Name[sv]=Invertera
Name[ta]=ி
Name[te]=
Name[tg]=Табдилдиҳӣ
Name[th]=
Name[tr]=Negatifleştir
Name[ug]=ئەكسى رەڭگە ئالماشتۇر
Name[uk]=Інверсія
Name[uz]=Teskari
Name[uz@cyrillic]=Тескари
Name[vi]=Đo ngưc
Name[wa]=Å rvier
Name[x-test]=xxInvertxx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -1,49 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_INVERT_CONFIG_H
#define KWIN_INVERT_CONFIG_H
#include <kcmodule.h>
class KShortcutsEditor;
namespace KWin
{
class InvertEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit InvertEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
~InvertEffectConfig();
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private:
KShortcutsEditor* mShortcutEditor;
};
} // namespace
#endif

View file

@ -91,5 +91,4 @@ X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-Library=kwin4_effect_builtins X-KDE-Library=kwin4_effect_builtins
X-KDE-Ordering=99 X-KDE-Ordering=99
X-KWin-Requires-OpenGL=false
X-KWin-Requires-Shaders=false X-KWin-Requires-Shaders=false

View file

@ -88,12 +88,3 @@ Comment[zh_TW]=KWin 效果
[PropertyDef::X-KDE-Ordering] [PropertyDef::X-KDE-Ordering]
Type=int Type=int
[PropertyDef::X-KWin-Requires-OpenGL]
Type=bool
[PropertyDef::X-KWin-Requires-OpenGL2]
Type=bool
[PropertyDef::X-KWin-Requires-Shaders]
Type=bool

View file

@ -11,17 +11,5 @@ kde4_add_kcfg_files(kwin4_effect_builtins_sources logout/logoutconfig.kcfgc)
# .desktop files # .desktop files
install( FILES install( FILES
logout/logout.desktop logout/logout.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) DESTINATION ${SERVICES_INSTALL_DIR}/kwin
# Data files
install( FILES
logout/data/1.10/vignetting.frag
logout/data/1.10/logout-blur.frag
DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.10
)
install( FILES
logout/data/1.40/vignetting.frag
logout/data/1.40/logout-blur.frag
DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.40
) )

View file

@ -1,9 +0,0 @@
uniform sampler2D sampler;
uniform float u_alphaProgress;
varying vec2 varyingTexCoords;
void main() {
gl_FragColor = texture2D(sampler, varyingTexCoords, 1.75);
gl_FragColor.a = u_alphaProgress;
}

View file

@ -1,8 +0,0 @@
uniform vec2 u_center;
uniform float u_radius;
uniform float u_progress;
void main() {
float d = smoothstep(0, u_radius, distance(gl_FragCoord.xy, u_center));
gl_FragColor = vec4(0.0, 0.0, 0.0, d * u_progress);
}

View file

@ -1,14 +0,0 @@
#version 140
uniform sampler2D sampler;
uniform float u_alphaProgress;
in vec2 varyingTexCoords;
out vec4 fragColor;
void main() {
vec4 texel = texture(sampler, varyingTexCoords, 1.75);
texel.a = u_alphaProgress;
fragColor = texel;
}

View file

@ -1,12 +0,0 @@
#version 140
uniform vec2 u_center;
uniform float u_radius;
uniform float u_progress;
out vec4 fragColor;
void main() {
float d = smoothstep(0, u_radius, distance(gl_FragCoord.xy, u_center));
fragColor = vec4(0.0, 0.0, 0.0, d * u_progress);
}

View file

@ -24,9 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton // KConfigSkeleton
#include "logoutconfig.h" #include "logoutconfig.h"
#include "kwinglutils.h"
#include "kwinglplatform.h"
#include <math.h> #include <math.h>
#include <kdebug.h> #include <kdebug.h>
#include <KGlobal> #include <KGlobal>
@ -40,6 +37,8 @@ namespace KWin
KWIN_EFFECT(logout, LogoutEffect) KWIN_EFFECT(logout, LogoutEffect)
#warning this effect is probably bogus
LogoutEffect::LogoutEffect() LogoutEffect::LogoutEffect()
: progress(0.0) : progress(0.0)
, displayEffect(false) , displayEffect(false)
@ -48,9 +47,6 @@ LogoutEffect::LogoutEffect()
, logoutWindowPassed(false) , logoutWindowPassed(false)
, canDoPersistent(false) , canDoPersistent(false)
, ignoredWindows() , ignoredWindows()
, m_vignettingShader(NULL)
, m_blurShader(NULL)
, m_shadersDir("kwin/shaders/1.10/")
{ {
// Persistent effect // Persistent effect
logoutAtom = XInternAtom(display(), "_KDE_LOGGING_OUT", False); logoutAtom = XInternAtom(display(), "_KDE_LOGGING_OUT", False);
@ -65,77 +61,25 @@ LogoutEffect::LogoutEffect()
XChangeProperty(display(), sel, hack, hack, 8, PropModeReplace, (unsigned char*)&hack, 1); XChangeProperty(display(), sel, hack, hack, 8, PropModeReplace, (unsigned char*)&hack, 1);
// the atom is not removed when effect is destroyed, this is temporary anyway // the atom is not removed when effect is destroyed, this is temporary anyway
blurTexture = NULL;
blurTarget = NULL;
reconfigure(ReconfigureAll); reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long))); connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
m_shadersDir = "kwin/shaders/1.40/";
} }
LogoutEffect::~LogoutEffect() LogoutEffect::~LogoutEffect()
{ {
delete blurTexture;
delete blurTarget;
delete m_vignettingShader;
delete m_blurShader;
} }
void LogoutEffect::reconfigure(ReconfigureFlags) void LogoutEffect::reconfigure(ReconfigureFlags)
{ {
LogoutConfig::self()->readConfig(); LogoutConfig::self()->readConfig();
frameDelay = 0; frameDelay = 0;
useBlur = LogoutConfig::useBlur();
delete blurTexture;
blurTexture = NULL;
delete blurTarget;
blurTarget = NULL;
blurSupported = false;
delete m_blurShader;
m_blurShader = NULL;
} }
void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{ {
if (!displayEffect && progress == 0.0) {
if (blurTexture) {
delete blurTexture;
blurTexture = NULL;
delete blurTarget;
blurTarget = NULL;
blurSupported = false;
}
} else if (!blurTexture) {
blurSupported = false;
delete blurTarget; // catch as we just tested the texture ;-P
if (effects->isOpenGLCompositing() && GLTexture::NPOTTextureSupported() && GLRenderTarget::blitSupported() && useBlur) {
// TODO: It seems that it is not possible to create a GLRenderTarget that has
// a different size than the display right now. Most likely a KWin core bug.
// Create texture and render target
blurTexture = new GLTexture(displayWidth(), displayHeight());
blurTexture->setFilter(GL_LINEAR_MIPMAP_LINEAR);
blurTexture->setWrapMode(GL_CLAMP_TO_EDGE);
blurTarget = new GLRenderTarget(*blurTexture);
if (blurTarget->valid())
blurSupported = true;
// As creating the render target takes time it can cause the first two frames of the
// blur animation to be jerky. For this reason we only start the animation after the
// third frame.
frameDelay = 2;
}
}
if (frameDelay) if (frameDelay)
--frameDelay; --frameDelay;
else { else {
@ -145,10 +89,6 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
progress = qMax(0.0, progress - time / animationTime(500.0)); progress = qMax(0.0, progress - time / animationTime(500.0));
} }
if (blurSupported && progress > 0.0) {
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
}
data.paint |= effects->clientArea(FullArea, 0, 0); data.paint |= effects->clientArea(FullArea, 0, 0);
effects->prePaintScreen(data, time); effects->prePaintScreen(data, time);
} }
@ -156,35 +96,6 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{ {
if (progress > 0.0) { if (progress > 0.0) {
if (effects->isOpenGLCompositing()) {
// In OpenGL mode we add vignetting and, if supported, a slight blur
if (blurSupported) {
// When using blur we render everything to an FBO and as such don't do the vignetting
// until after we render the FBO to the screen.
if (w == logoutWindow) {
// Window is rendered after the FBO
windowOpacity = data.opacity();
data.setOpacity(0.0); // Cheat, we need the opacity for later but don't want to blur it
} else {
if (logoutWindowPassed || ignoredWindows.contains(w)) {
// Window is rendered after the FBO
windows.append(w);
windowsOpacities[ w ] = data.opacity();
data.setOpacity(0.0);
} else // Window is added to the FBO
data.multiplySaturation((1.0 - progress * 0.2));
}
} else {
// If we are not blurring then we are not rendering to an FBO
if (w == logoutWindow)
// This is the logout window don't alter it but render our vignetting now
renderVignetting();
else if (!logoutWindowPassed && !ignoredWindows.contains(w))
// Window is in the background, desaturate
data.multiplySaturation((1.0 - progress * 0.2));
// All other windows are unaltered
}
}
if (effects->compositingType() == KWin::XRenderCompositing) { if (effects->compositingType() == KWin::XRenderCompositing) {
// Since we can't do vignetting in XRender just do a stronger desaturation and darken // Since we can't do vignetting in XRender just do a stronger desaturation and darken
if (w != logoutWindow && !logoutWindowPassed && !ignoredWindows.contains(w)) { if (w != logoutWindow && !logoutWindowPassed && !ignoredWindows.contains(w)) {
@ -204,47 +115,6 @@ void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
{ {
effects->paintScreen(mask, region, data); effects->paintScreen(mask, region, data);
if (effects->isOpenGLCompositing() && progress > 0.0) {
if (!blurSupported) {
if (!logoutWindowPassed)
// The logout window has been deleted but we still want to fade out the vignetting, thus
// render it on the top of everything if still animating. We don't check if logoutWindow
// is set as it may still be even if it wasn't rendered.
renderVignetting();
} else {
GLRenderTarget::pushRenderTarget(blurTarget);
blurTarget->blitFromFramebuffer();
GLRenderTarget::popRenderTarget();
//--------------------------
// Render the screen effect
renderBlurTexture();
// Vignetting (Radial gradient with transparent middle and black edges)
renderVignetting();
//--------------------------
// Render the logout window
if (logoutWindow) {
int winMask = logoutWindow->hasAlpha() ? PAINT_WINDOW_TRANSLUCENT : PAINT_WINDOW_OPAQUE;
WindowPaintData winData(logoutWindow);
winData.setOpacity(windowOpacity);
effects->drawWindow(logoutWindow, winMask, region, winData);
}
// Render all windows on top of logout window
foreach (EffectWindow * w, windows) {
int winMask = w->hasAlpha() ? PAINT_WINDOW_TRANSLUCENT : PAINT_WINDOW_OPAQUE;
WindowPaintData winData(w);
winData.setOpacity(windowsOpacities[ w ]);
effects->drawWindow(w, winMask, region, winData);
}
windows.clear();
windowsOpacities.clear();
}
}
} }
void LogoutEffect::postPaintScreen() void LogoutEffect::postPaintScreen()
@ -299,142 +169,6 @@ bool LogoutEffect::isLogoutDialog(EffectWindow* w)
return false; return false;
} }
void LogoutEffect::renderVignetting()
{
if (effects->compositingType() == OpenGL1Compositing) {
renderVignettingLegacy();
return;
}
if (!m_vignettingShader) {
m_vignettingShader = ShaderManager::instance()->loadFragmentShader(KWin::ShaderManager::ColorShader,
KGlobal::dirs()->findResource("data", m_shadersDir + "vignetting.frag"));
if (!m_vignettingShader->isValid()) {
kDebug(1212) << "Vignetting Shader failed to load";
return;
}
} else if (!m_vignettingShader->isValid()) {
// shader broken
return;
}
// need to get the projection matrix from the ortho shader for the vignetting shader
QMatrix4x4 projection = ShaderManager::instance()->pushShader(KWin::ShaderManager::SimpleShader)->getUniformMatrix4x4("projection");
ShaderManager::instance()->popShader();
ShaderBinder binder(m_vignettingShader);
m_vignettingShader->setUniform(KWin::GLShader::ProjectionMatrix, projection);
m_vignettingShader->setUniform("u_progress", (float)progress * 0.9f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_SCISSOR_TEST);
const QRect fullArea = effects->clientArea(FullArea, 0, 0);
for (int screen = 0; screen < effects->numScreens(); screen++) {
const QRect screenGeom = effects->clientArea(ScreenArea, screen, 0);
glScissor(screenGeom.x(), displayHeight() - screenGeom.y() - screenGeom.height(),
screenGeom.width(), screenGeom.height()); // GL coords are flipped
const float cenX = screenGeom.x() + screenGeom.width() / 2;
const float cenY = fullArea.height() - screenGeom.y() - screenGeom.height() / 2;
const float r = float((screenGeom.width() > screenGeom.height())
? screenGeom.width() : screenGeom.height()) * 0.8f; // Radius
m_vignettingShader->setUniform("u_center", QVector2D(cenX, cenY));
m_vignettingShader->setUniform("u_radius", r);
QVector<float> vertices;
vertices << screenGeom.x() << screenGeom.y();
vertices << screenGeom.x() << screenGeom.y() + screenGeom.height();
vertices << screenGeom.x() + screenGeom.width() << screenGeom.y();
vertices << screenGeom.x() + screenGeom.width() << screenGeom.y() + screenGeom.height();
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->setData(vertices.count()/2, 2, vertices.constData(), NULL);
vbo->render(GL_TRIANGLE_STRIP);
}
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
}
void LogoutEffect::renderVignettingLegacy()
{
#ifdef KWIN_HAVE_OPENGL_1
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT);
glEnable(GL_BLEND); // If not already (Such as when rendered straight to the screen)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (int screen = 0; screen < effects->numScreens(); screen++) {
QRect screenGeom = effects->clientArea(ScreenArea, screen, 0);
glScissor(screenGeom.x(), displayHeight() - screenGeom.y() - screenGeom.height(),
screenGeom.width(), screenGeom.height()); // GL coords are flipped
glEnable(GL_SCISSOR_TEST); // Geom must be set before enable
const float cenX = screenGeom.x() + screenGeom.width() / 2;
const float cenY = screenGeom.y() + screenGeom.height() / 2;
const float a = M_PI / 16.0f; // Angle of increment
const float r = float((screenGeom.width() > screenGeom.height())
? screenGeom.width() : screenGeom.height()) * 0.8f; // Radius
glBegin(GL_TRIANGLE_FAN);
glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
glVertex3f(cenX, cenY, 0.0f);
glColor4f(0.0f, 0.0f, 0.0f, progress * 0.9f);
for (float i = 0.0f; i <= M_PI * 2.01f; i += a)
glVertex3f(cenX + r * cos(i), cenY + r * sin(i), 0.0f);
glEnd();
glDisable(GL_SCISSOR_TEST);
}
glPopAttrib();
#endif
}
void LogoutEffect::renderBlurTexture()
{
if (effects->compositingType() == OpenGL1Compositing) {
renderBlurTextureLegacy();
return;
}
if (!m_blurShader) {
m_blurShader = ShaderManager::instance()->loadFragmentShader(KWin::ShaderManager::SimpleShader,
KGlobal::dirs()->findResource("data", m_shadersDir + "logout-blur.frag"));
if (!m_blurShader->isValid()) {
kDebug(1212) << "Logout blur shader failed to load";
}
} else if (!m_blurShader->isValid()) {
// shader is broken - no need to continue here
return;
}
// Unmodified base image
ShaderBinder binder(m_blurShader);
m_blurShader->setUniform(GLShader::Offset, QVector2D(0, 0));
m_blurShader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0));
m_blurShader->setUniform(GLShader::Saturation, 1.0);
m_blurShader->setUniform("u_alphaProgress", (float)progress * 0.4f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
blurTexture->bind();
blurTexture->render(infiniteRegion(), QRect(0, 0, displayWidth(), displayHeight()));
blurTexture->unbind();
glDisable(GL_BLEND);
checkGLError("Render blur texture");
}
void LogoutEffect::renderBlurTextureLegacy()
{
#ifdef KWIN_HAVE_OPENGL_1
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT);
// Unmodified base image
blurTexture->bind();
blurTexture->render(infiniteRegion(), QRect(0, 0, displayWidth(), displayHeight()));
// Blurred image
GLfloat bias[1];
glGetTexEnvfv(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, bias);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, 1.75);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1.0f, 1.0f, 1.0f, progress * 0.4);
blurTexture->render(infiniteRegion(), QRect(0, 0, displayWidth(), displayHeight()));
glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, bias[0]);
blurTexture->unbind();
glPopAttrib();
#endif
}
void LogoutEffect::slotPropertyNotify(EffectWindow* w, long a) void LogoutEffect::slotPropertyNotify(EffectWindow* w, long a)
{ {
if (w || a != logoutAtom) if (w || a != logoutAtom)

View file

@ -29,14 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin namespace KWin
{ {
class GLRenderTarget;
class GLTexture;
class LogoutEffect class LogoutEffect
: public Effect : public Effect
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool useBlur READ isUseBlur)
public: public:
LogoutEffect(); LogoutEffect();
~LogoutEffect(); ~LogoutEffect();
@ -47,10 +43,6 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual bool isActive() const; virtual bool isActive() const;
// for properties
bool isUseBlur() const {
return useBlur;
}
public Q_SLOTS: public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow* w); void slotWindowAdded(KWin::EffectWindow* w);
void slotWindowClosed(KWin::EffectWindow *w); void slotWindowClosed(KWin::EffectWindow *w);
@ -69,20 +61,10 @@ private:
bool canDoPersistent; bool canDoPersistent;
EffectWindowList ignoredWindows; EffectWindowList ignoredWindows;
void renderVignetting();
void renderVignettingLegacy();
void renderBlurTexture();
void renderBlurTextureLegacy();
int frameDelay; int frameDelay;
bool blurSupported, useBlur;
GLTexture* blurTexture;
GLRenderTarget* blurTarget;
double windowOpacity; double windowOpacity;
EffectWindowList windows; EffectWindowList windows;
QHash< EffectWindow*, double > windowsOpacities; QHash< EffectWindow*, double > windowsOpacities;
GLShader *m_vignettingShader;
GLShader *m_blurShader;
QString m_shadersDir;
}; };
} // namespace } // namespace

View file

@ -1,38 +0,0 @@
#######################################
# Effect
# Source files
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
lookingglass/lookingglass.cpp
)
kde4_add_kcfg_files(kwin4_effect_builtins_sources lookingglass/lookingglassconfig.kcfgc)
# .desktop files
install( FILES
lookingglass/lookingglass.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
# Data files
install( FILES
lookingglass/data/1.10/lookingglass.frag
DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.10 )
install( FILES
lookingglass/data/1.40/lookingglass.frag
DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.40 )
#######################################
# Config
# Source files
set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
lookingglass/lookingglass_config.cpp
lookingglass/lookingglass_config.ui
)
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources lookingglass/lookingglassconfig.kcfgc)
# .desktop files
install( FILES
lookingglass/lookingglass_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View file

@ -1,25 +0,0 @@
uniform sampler2D sampler;
uniform vec2 u_cursor;
uniform float u_zoom;
uniform float u_radius;
uniform vec2 u_textureSize;
varying vec2 varyingTexCoords;
#define PI 3.14159
void main()
{
vec2 d = u_cursor - varyingTexCoords;
float dist = sqrt(d.x*d.x + d.y*d.y);
vec2 texcoord = varyingTexCoords;
if (dist < u_radius) {
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
texcoord += d / dist * disp;
}
texcoord = texcoord/u_textureSize;
texcoord.t = 1.0 - texcoord.t;
gl_FragColor = texture2D(sampler, texcoord);
}

View file

@ -1,28 +0,0 @@
#version 140
uniform sampler2D sampler;
uniform vec2 u_cursor;
uniform float u_zoom;
uniform float u_radius;
uniform vec2 u_textureSize;
in vec2 varyingTexCoords;
out vec4 fragColor;
#define PI 3.14159
void main()
{
vec2 d = u_cursor - varyingTexCoords;
float dist = sqrt(d.x*d.x + d.y*d.y);
vec2 texcoord = varyingTexCoords;
if (dist < u_radius) {
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
texcoord += d / dist * disp;
}
texcoord = texcoord/u_textureSize;
texcoord.t = 1.0 - texcoord.t;
fragColor = texture(sampler, texcoord);
}

View file

@ -1,268 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "lookingglass.h"
// KConfigSkeleton
#include "lookingglassconfig.h"
#include <kwinglutils.h>
#include <kwinglplatform.h>
#include <kactioncollection.h>
#include <kaction.h>
#include <KLocalizedString>
#include <kdebug.h>
#include <KGlobal>
#include <KStandardDirs>
#include <QVector2D>
#include <kmessagebox.h>
namespace KWin
{
KWIN_EFFECT(lookingglass, LookingGlassEffect)
KWIN_EFFECT_SUPPORTED(lookingglass, LookingGlassEffect::supported())
LookingGlassEffect::LookingGlassEffect()
: zoom(1.0f)
, target_zoom(1.0f)
, polling(false)
, m_texture(NULL)
, m_fbo(NULL)
, m_vbo(NULL)
, m_shader(NULL)
, m_enabled(false)
, m_valid(false)
{
actionCollection = new KActionCollection(this);
actionCollection->setConfigGlobal(true);
actionCollection->setConfigGroup("LookingGlass");
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
reconfigure(ReconfigureAll);
}
LookingGlassEffect::~LookingGlassEffect()
{
delete m_texture;
delete m_fbo;
delete m_shader;
delete m_vbo;
}
bool LookingGlassEffect::supported()
{
return effects->compositingType() == OpenGL2Compositing;
}
void LookingGlassEffect::reconfigure(ReconfigureFlags)
{
LookingGlassConfig::self()->readConfig();
initialradius = LookingGlassConfig::radius();
radius = initialradius;
kDebug(1212) << QString("Radius from config: %1").arg(radius) << endl;
actionCollection->readSettings();
m_valid = loadData();
}
bool LookingGlassEffect::loadData()
{
// If NPOT textures are not supported, use nearest power-of-two sized
// texture. It wastes memory, but it's possible to support systems without
// NPOT textures that way
int texw = displayWidth();
int texh = displayHeight();
if (!GLTexture::NPOTTextureSupported()) {
kWarning(1212) << "NPOT textures not supported, wasting some memory" ;
texw = nearestPowerOfTwo(texw);
texh = nearestPowerOfTwo(texh);
}
// Create texture and render target
m_texture = new GLTexture(texw, texh);
m_texture->setFilter(GL_LINEAR_MIPMAP_LINEAR);
m_texture->setWrapMode(GL_CLAMP_TO_EDGE);
m_fbo = new GLRenderTarget(*m_texture);
if (!m_fbo->valid()) {
return false;
}
QString shadersDir = "kwin/shaders/1.10/";
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "lookingglass.frag");
m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, fragmentshader);
if (m_shader->isValid()) {
ShaderBinder binder(m_shader);
m_shader->setUniform("u_textureSize", QVector2D(displayWidth(), displayHeight()));
} else {
kError(1212) << "The shader failed to load!" << endl;
return false;
}
m_vbo = new GLVertexBuffer(GLVertexBuffer::Static);
QVector<float> verts;
QVector<float> texcoords;
texcoords << displayWidth() << 0.0;
verts << displayWidth() << 0.0;
texcoords << 0.0 << 0.0;
verts << 0.0 << 0.0;
texcoords << 0.0 << displayHeight();
verts << 0.0 << displayHeight();
texcoords << 0.0 << displayHeight();
verts << 0.0 << displayHeight();
texcoords << displayWidth() << displayHeight();
verts << displayWidth() << displayHeight();
texcoords << displayWidth() << 0.0;
verts << displayWidth() << 0.0;
m_vbo->setData(6, 2, verts.constData(), texcoords.constData());
return true;
}
void LookingGlassEffect::toggle()
{
if (target_zoom == 1.0f) {
target_zoom = 2.0f;
if (!polling) {
polling = true;
effects->startMousePolling();
}
m_enabled = true;
} else {
target_zoom = 1.0f;
if (polling) {
polling = false;
effects->stopMousePolling();
}
if (zoom == target_zoom) {
m_enabled = false;
}
}
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
}
void LookingGlassEffect::zoomIn()
{
target_zoom = qMin(7.0, target_zoom + 0.5);
m_enabled = true;
if (!polling) {
polling = true;
effects->startMousePolling();
}
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
}
void LookingGlassEffect::zoomOut()
{
target_zoom -= 0.5;
if (target_zoom < 1) {
target_zoom = 1;
if (polling) {
polling = false;
effects->stopMousePolling();
}
if (zoom == target_zoom) {
m_enabled = false;
}
}
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
}
void LookingGlassEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{
if (zoom != target_zoom) {
double diff = time / animationTime(500.0);
if (target_zoom > zoom)
zoom = qMin(zoom * qMax(1.0 + diff, 1.2), target_zoom);
else
zoom = qMax(zoom * qMin(1.0 - diff, 0.8), target_zoom);
kDebug(1212) << "zoom is now " << zoom;
radius = qBound((double)initialradius, initialradius * zoom, 3.5 * initialradius);
if (zoom <= 1.0f) {
m_enabled = false;
}
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
}
if (m_valid && m_enabled) {
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
// Start rendering to texture
GLRenderTarget::pushRenderTarget(m_fbo);
}
effects->prePaintScreen(data, time);
}
void LookingGlassEffect::slotMouseChanged(const QPoint& pos, const QPoint& old, Qt::MouseButtons,
Qt::MouseButtons, Qt::KeyboardModifiers, Qt::KeyboardModifiers)
{
if (pos != old && m_enabled) {
effects->addRepaint(pos.x() - radius, pos.y() - radius, 2 * radius, 2 * radius);
effects->addRepaint(old.x() - radius, old.y() - radius, 2 * radius, 2 * radius);
}
}
void LookingGlassEffect::postPaintScreen()
{
// Call the next effect.
effects->postPaintScreen();
if (m_valid && m_enabled) {
// Disable render texture
GLRenderTarget* target = GLRenderTarget::popRenderTarget();
assert(target == m_fbo);
Q_UNUSED(target);
m_texture->bind();
// Use the shader
ShaderBinder binder(m_shader);
m_shader->setUniform("u_zoom", (float)zoom);
m_shader->setUniform("u_radius", (float)radius);
m_shader->setUniform("u_cursor", QVector2D(cursorPos().x(), cursorPos().y()));
m_vbo->render(GL_TRIANGLES);
m_texture->unbind();
}
}
bool LookingGlassEffect::isActive() const
{
return m_valid && m_enabled;
}
} // namespace
#include "moc_lookingglass.cpp"

View file

@ -1,157 +0,0 @@
[Desktop Entry]
Name=Looking Glass
Name[af]=Vergrootglas
Name[ar]=عدسة عين السمكة
Name[ast]=Espeyu
Name[be@latin]=Looking Glass
Name[bg]=Лупа
Name[bs]=Lupa
Name[ca]=Aparença de vidre
Name[ca@valencia]=Aparença de vidre
Name[cs]=Lupa
Name[csb]=Lupa
Name[da]=Kikkert
Name[de]=Bildschirmlupe
Name[el]=Μεγεθυντικός φακός
Name[en_GB]=Looking Glass
Name[eo]=Looking Glass
Name[es]=Espejo
Name[et]=Suurendusklaas
Name[eu]=Pantaila-lupa
Name[fi]=Suurennuslasi
Name[fr]=Loupe
Name[fy]=Looking Glass
Name[ga]=Looking Glass
Name[gl]=Espello
Name[gu]=
Name[he]=משקף
Name[hi]=ि
Name[hne]=ि
Name[hr]=Povećalo
Name[hu]=Nagyító
Name[ia]=Looking Glass
Name[id]=Kaca Tembus Pandang
Name[is]=Spegilgler
Name[it]=Specchio
Name[ja]=
Name[kk]=Лупа
Name[km]=
Name[kn]=ಿ
Name[ko]=
Name[lt]=Didinamasis stiklas
Name[lv]=Skatāmais stikls
Name[mai]=ि
Name[mk]=Лупа
Name[ml]=ി.
Name[mr]=ि
Name[nb]=Looking Glass
Name[nds]=Kiekglas
Name[ne]=
Name[nl]=Vergrootglas
Name[nn]=Forstørringsglas
Name[pa]=
Name[pl]=Lupa
Name[pt]=Aparência de Vidro
Name[pt_BR]=Espelho
Name[ro]=Binoclu
Name[ru]=Линза
Name[se]=Stuoridanláse
Name[si]=
Name[sk]=Šošovka
Name[sl]=Povečevalno steklo
Name[sr]=Лупа
Name[sr@ijekavian]=Лупа
Name[sr@ijekavianlatin]=Lupa
Name[sr@latin]=Lupa
Name[sv]=Förstoringsglas
Name[ta]=Looking Glass
Name[te]=ి
Name[tg]=Увеличительное стекло
Name[th]=
Name[tr]=Büyüteç
Name[ug]=كۆزىتىش ئەينەك
Name[uk]=Збільшувальне скло
Name[vi]=Thu kính
Name[wa]=Berikes
Name[x-test]=xxLooking Glassxx
Name[zh_CN]=
Name[zh_TW]=
Comment=A screen magnifier that looks like a fisheye lens
Comment[ar]=مكبر الشاشة الذي يبدو مثل عدسة عين السمكة
Comment[ast]=Una llupa con efeutu de güeyu de pexe
Comment[bg]=Увеличаване на екрана като с лупа
Comment[bs]=Uveličavač ekrana nalik ribljem oku
Comment[ca]=Una lupa de pantalla que sembla un objectiu d'ull de peix
Comment[ca@valencia]=Una lupa de pantalla que pareix un objectiu d'ull de peix
Comment[cs]=Lupa, která vypadá jako rybí oko
Comment[da]=Skærmforstørrelsesglas som ligner en fiskeøje-linse
Comment[de]=Eine Lupe, die wie eine Fischaugen-Linse funktioniert.
Comment[el]=Ένας μεγεθυντικός φακός οθόνης με έντονη ευρυγώνια οπτική
Comment[en_GB]=A screen magnifier that looks like a fisheye lens
Comment[es]=Una lupa con efecto de ojo de pez
Comment[et]=Ekraani suurendusklaas
Comment[eu]=Arrain-begi objektibo baten itxura duen pantaila-lupa
Comment[fi]=Kalansilmälinssiltä näyttävä ruudunsuurennin
Comment[fy]=In skermfergrutglÊs dat der as in fiskeach útsjocht
Comment[ga]=Formhéadaitheoir scáileáin is cosúil le lionsa shúil an éisc
Comment[gl]=Unha lupa do escritorio que semella unha lente de ollo de peixe
Comment[gu]=િ
Comment[he]=מגדיל מסך הנראה כמו מצלמת עין הדג
Comment[hi]= - ि
Comment[hne]= ि
Comment[hr]=Povećalo zaslona koje izgleda poput leća ribljeg oka
Comment[hu]=Halszem-optikájú nagyító
Comment[ia]=Un aggranditor de schermo semblante lentes fisheye
Comment[id]=Sebuah pembesar layar yang mirip seperti lensa mata ikan
Comment[is]=Skjástækkunargler sem líkist fiskaugalinsu
Comment[kk]="Балық көзі" линзасы секілді экран ұлғайтқышы
Comment[km]=
Comment[kn]= (ಿ )
Comment[ko]=
Comment[lt]=Ekrano didintuvas, panašus į žuvies akį
Comment[lv]=Ekrāna palielinātājs, kas izskatās pēc lēcas
Comment[mk]=Екранска лупа што личи како рибина леќа
Comment[ml]=ി ി ി ( )
Comment[mr]= ि ि
Comment[nb]=En skjermlupe som ser ut som en fiskeøye-linse
Comment[nds]=En Schirm-Kiekglas, de as en Fischoog-Lins utsüht
Comment[nl]=Een schermvergrootglas dat er uitziet als een visseooglens
Comment[nn]=Skjermforstørring forma som ei fiskeaugelinse
Comment[pa]= , ਿ - ਿ
Comment[pl]=Powiększenie ekranu, które wygląda jak "rybie oko"
Comment[pt]=Uma lupa do ecrã que parece uma lente de olho-de-peixe
Comment[pt_BR]=Uma lupa da área de trabalho que parece uma lente de olho-de-peixe
Comment[ro]=O lupă de ecran ce arată ca lentilele ochiului de pește
Comment[ru]=Показ области экрана с эффектом линзы
Comment[si]=
Comment[sk]=Lupa obrazovky s efektom rybieho oka
Comment[sl]=Približevalnik zaslona, ki izgleda kot povečevalno steklo
Comment[sr]=Увеличавач екрана налик рибљем оку
Comment[sr@ijekavian]=Увеличавач екрана налик рибљем оку
Comment[sr@ijekavianlatin]=Uveličavač ekrana nalik ribljem oku
Comment[sr@latin]=Uveličavač ekrana nalik ribljem oku
Comment[sv]=Ett skärmförstoringsglas som ser ut som en fiskögonlins
Comment[ta]=A screen magnifier that looks like a fisheye lens
Comment[te]= ిి ి
Comment[th]=
Comment[tr]=Balık gözüne benzeyen bir ekran büyüteci
Comment[ug]=بېلىق كۆزىدەك ئېكران چوڭايتقۇچ
Comment[uk]=Екранна лупа, яка робить вигляд стільниці схожим на зображення, отримане з ефектом «рибячого ока»
Comment[wa]=On magnifieu del waitroûle ki rshonne a des linteyes
Comment[x-test]=xxA screen magnifier that looks like a fisheye lensxx
Comment[zh_CN]=
Comment[zh_TW]=
Icon=preferences-system-windows-effect-lookingglass
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Rivo Laks
X-KDE-PluginInfo-Email=rivolaks@hot.ee
X-KDE-PluginInfo-Name=kwin4_effect_lookingglass
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Category=Accessibility
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-Library=kwin4_effect_builtins
X-KWin-Requires-OpenGL2=true

View file

@ -1,86 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_LOOKINGGLASS_H
#define KWIN_LOOKINGGLASS_H
#include <kwineffects.h>
class KActionCollection;
namespace KWin
{
class GLRenderTarget;
class GLShader;
class GLTexture;
class GLVertexBuffer;
/**
* Enhanced magnifier
**/
class LookingGlassEffect : public Effect
{
Q_OBJECT
Q_PROPERTY(int initialRadius READ initialRadius)
public:
LookingGlassEffect();
virtual ~LookingGlassEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void postPaintScreen();
virtual bool isActive() const;
static bool supported();
// for properties
int initialRadius() const {
return initialradius;
}
public slots:
void toggle();
void zoomIn();
void zoomOut();
void slotMouseChanged(const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
private:
bool loadData();
double zoom;
double target_zoom;
bool polling; // Mouse polling
int radius;
int initialradius;
KActionCollection* actionCollection;
GLTexture *m_texture;
GLRenderTarget *m_fbo;
GLVertexBuffer *m_vbo;
GLShader *m_shader;
bool m_enabled;
bool m_valid;
};
} // namespace
#endif

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-LookingGlass">
<entry name="Radius" type="UInt">
<default>200</default>
</entry>
</group>
</kcfg>

View file

@ -1,106 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "lookingglass_config.h"
// KConfigSkeleton
#include "lookingglassconfig.h"
#include <kwineffects.h>
#include <KLocalizedString>
#include <kdebug.h>
#include <kconfiggroup.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <QWidget>
#include <QVBoxLayout>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
LookingGlassEffectConfigForm::LookingGlassEffectConfigForm(QWidget* parent) : QWidget(parent)
{
setupUi(this);
}
LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new LookingGlassEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
addConfig(LookingGlassConfig::self(), m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("LookingGlass");
m_actionCollection->setConfigGlobal(true);
KAction* a;
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
m_ui->editor->addCollection(m_actionCollection);
}
LookingGlassEffectConfig::~LookingGlassEffectConfig()
{
// Undo (only) unsaved changes to global key shortcuts
m_ui->editor->undoChanges();
}
void LookingGlassEffectConfig::save()
{
kDebug(1212) << "Saving config of LookingGlass" ;
KCModule::save();
m_ui->editor->save(); // undo() will restore to this state from now on
EffectsHandler::sendReloadMessage("lookingglass");
}
void LookingGlassEffectConfig::defaults()
{
m_ui->editor->allDefault();
KCModule::defaults();
}
} // namespace
#include "moc_lookingglass_config.cpp"

View file

@ -1,85 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_lookingglass
X-KDE-PluginKeyword=lookingglass
Name=Looking Glass
Name[af]=Vergrootglas
Name[ar]=عدسة عين السمكة
Name[ast]=Espeyu
Name[be@latin]=Looking Glass
Name[bg]=Лупа
Name[bs]=Lupa
Name[ca]=Aparença de vidre
Name[ca@valencia]=Aparença de vidre
Name[cs]=Lupa
Name[csb]=Lupa
Name[da]=Kikkert
Name[de]=Bildschirmlupe
Name[el]=Μεγεθυντικός φακός
Name[en_GB]=Looking Glass
Name[eo]=Looking Glass
Name[es]=Espejo
Name[et]=Suurendusklaas
Name[eu]=Pantaila-lupa
Name[fi]=Suurennuslasi
Name[fr]=Loupe
Name[fy]=Looking Glass
Name[ga]=Looking Glass
Name[gl]=Espello
Name[gu]=
Name[he]=משקף
Name[hi]=ि
Name[hne]=ि
Name[hr]=Povećalo
Name[hu]=Nagyító
Name[ia]=Looking Glass
Name[id]=Kaca Tembus Pandang
Name[is]=Spegilgler
Name[it]=Specchio
Name[ja]=
Name[kk]=Лупа
Name[km]=
Name[kn]=ಿ
Name[ko]=
Name[lt]=Didinamasis stiklas
Name[lv]=Skatāmais stikls
Name[mai]=ि
Name[mk]=Лупа
Name[ml]=ി.
Name[mr]=ि
Name[nb]=Looking Glass
Name[nds]=Kiekglas
Name[ne]=
Name[nl]=Vergrootglas
Name[nn]=Forstørringsglas
Name[pa]=
Name[pl]=Lupa
Name[pt]=Aparência de Vidro
Name[pt_BR]=Espelho
Name[ro]=Binoclu
Name[ru]=Линза
Name[se]=Stuoridanláse
Name[si]=
Name[sk]=Šošovka
Name[sl]=Povečevalno steklo
Name[sr]=Лупа
Name[sr@ijekavian]=Лупа
Name[sr@ijekavianlatin]=Lupa
Name[sr@latin]=Lupa
Name[sv]=Förstoringsglas
Name[ta]=Looking Glass
Name[te]=ి
Name[tg]=Увеличительное стекло
Name[th]=
Name[tr]=Büyüteç
Name[ug]=كۆزىتىش ئەينەك
Name[uk]=Збільшувальне скло
Name[vi]=Thu kính
Name[wa]=Berikes
Name[x-test]=xxLooking Glassxx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -1,57 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_LOOKINGGLASS_CONFIG_H
#define KWIN_LOOKINGGLASS_CONFIG_H
#include <kcmodule.h>
#include "ui_lookingglass_config.h"
class KActionCollection;
namespace KWin
{
class LookingGlassEffectConfigForm : public QWidget, public Ui::LookingGlassEffectConfigForm
{
Q_OBJECT
public:
explicit LookingGlassEffectConfigForm(QWidget* parent);
};
class LookingGlassEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit LookingGlassEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
virtual ~LookingGlassEffectConfig();
virtual void save();
virtual void defaults();
private:
LookingGlassEffectConfigForm* m_ui;
KActionCollection* m_actionCollection;
};
} // namespace
#endif

View file

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWin::LookingGlassEffectConfigForm</class>
<widget class="QWidget" name="KWin::LookingGlassEffectConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>185</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="KWin::GlobalShortcutsEditor" name="editor" native="true"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Radius:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Radius</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KIntSpinBox" name="kcfg_Radius">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KWin::GlobalShortcutsEditor</class>
<extends>QWidget</extends>
<header location="global">kwineffects.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,5 +0,0 @@
File=lookingglass.kcfg
ClassName=LookingGlassConfig
NameSpace=KWin
Singleton=true
Mutators=true

View file

@ -20,18 +20,17 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include "config-kwin.h"
#include "magnifier.h" #include "magnifier.h"
// KConfigSkeleton // KConfigSkeleton
#include "magnifierconfig.h" #include "magnifierconfig.h"
#include <kwinconfig.h>
#include <kaction.h> #include <kaction.h>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kstandardaction.h> #include <kstandardaction.h>
#include <kwinglutils.h> #ifdef KWIN_BUILD_COMPOSITE
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h> #include <kwinxrenderutils.h>
#include <xcb/render.h> #include <xcb/render.h>
#endif #endif
@ -48,9 +47,7 @@ MagnifierEffect::MagnifierEffect()
: zoom(1) : zoom(1)
, target_zoom(1) , target_zoom(1)
, polling(false) , polling(false)
, m_texture(0) #ifdef KWIN_BUILD_COMPOSITE
, m_fbo(0)
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
, m_pixmap(XCB_PIXMAP_NONE) , m_pixmap(XCB_PIXMAP_NONE)
#endif #endif
{ {
@ -69,8 +66,6 @@ MagnifierEffect::MagnifierEffect()
MagnifierEffect::~MagnifierEffect() MagnifierEffect::~MagnifierEffect()
{ {
delete m_fbo;
delete m_texture;
destroyPixmap(); destroyPixmap();
// Save the zoom value. // Save the zoom value.
KConfigGroup conf = EffectsHandler::effectConfig("Magnifier"); KConfigGroup conf = EffectsHandler::effectConfig("Magnifier");
@ -80,7 +75,7 @@ MagnifierEffect::~MagnifierEffect()
void MagnifierEffect::destroyPixmap() void MagnifierEffect::destroyPixmap()
{ {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_BUILD_COMPOSITE
if (effects->compositingType() != XRenderCompositing) { if (effects->compositingType() != XRenderCompositing) {
return; return;
} }
@ -94,8 +89,7 @@ void MagnifierEffect::destroyPixmap()
bool MagnifierEffect::supported() bool MagnifierEffect::supported()
{ {
return effects->compositingType() == XRenderCompositing || return effects->compositingType() == XRenderCompositing;
(effects->isOpenGLCompositing() && GLRenderTarget::blitSupported());
} }
void MagnifierEffect::reconfigure(ReconfigureFlags) void MagnifierEffect::reconfigure(ReconfigureFlags)
@ -120,11 +114,6 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, int time)
else { else {
zoom = qMax(zoom * qMin(1 - diff, 0.8), target_zoom); zoom = qMax(zoom * qMin(1 - diff, 0.8), target_zoom);
if (zoom == 1.0) { if (zoom == 1.0) {
// zoom ended - delete FBO and texture
delete m_fbo;
delete m_texture;
m_fbo = NULL;
m_texture = NULL;
destroyPixmap(); destroyPixmap();
} }
} }
@ -145,51 +134,8 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
QRect srcArea(cursor.x() - (double)area.width() / (zoom*2), QRect srcArea(cursor.x() - (double)area.width() / (zoom*2),
cursor.y() - (double)area.height() / (zoom*2), cursor.y() - (double)area.height() / (zoom*2),
(double)area.width() / zoom, (double)area.height() / zoom); (double)area.width() / zoom, (double)area.height() / zoom);
if (effects->isOpenGLCompositing()) {
m_fbo->blitFromFramebuffer(srcArea);
// paint magnifier
m_texture->bind();
m_texture->render(infiniteRegion(), area);
m_texture->unbind();
QVector<float> verts;
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
vbo->setColor(QColor(0, 0, 0));
// top frame
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
verts << area.left() - FRAME_WIDTH << area.top() - FRAME_WIDTH;
verts << area.left() - FRAME_WIDTH << area.top() - 1;
verts << area.left() - FRAME_WIDTH << area.top() - 1;
verts << area.right() + FRAME_WIDTH << area.top() - 1;
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
// left frame
verts << area.left() - 1 << area.top() - FRAME_WIDTH;
verts << area.left() - FRAME_WIDTH << area.top() - FRAME_WIDTH;
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
verts << area.left() - 1 << area.bottom() + FRAME_WIDTH;
verts << area.left() - 1 << area.top() - FRAME_WIDTH;
// right frame
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
verts << area.right() + 1 << area.top() - FRAME_WIDTH;
verts << area.right() + 1 << area.bottom() + FRAME_WIDTH;
verts << area.right() + 1 << area.bottom() + FRAME_WIDTH;
verts << area.right() + FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
// bottom frame
verts << area.right() + FRAME_WIDTH << area.bottom() + 1;
verts << area.left() - FRAME_WIDTH << area.bottom() + 1;
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
verts << area.right() + FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
verts << area.right() + FRAME_WIDTH << area.bottom() + 1;
vbo->setData(verts.size() / 2, 2, verts.constData(), NULL);
ShaderBinder binder(ShaderManager::ColorShader);
vbo->render(GL_TRIANGLES);
}
if (effects->compositingType() == XRenderCompositing) { if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_BUILD_COMPOSITE
if (m_pixmap == XCB_PIXMAP_NONE || m_pixmapSize != srcArea.size()) { if (m_pixmap == XCB_PIXMAP_NONE || m_pixmapSize != srcArea.size()) {
destroyPixmap(); destroyPixmap();
m_pixmap = xcb_generate_id(connection()); m_pixmap = xcb_generate_id(connection());
@ -255,11 +201,6 @@ void MagnifierEffect::zoomIn()
polling = true; polling = true;
effects->startMousePolling(); effects->startMousePolling();
} }
if (effects->isOpenGLCompositing() && !m_texture) {
m_texture = new GLTexture(magnifier_size.width(), magnifier_size.height());
m_texture->setYInverted(false);
m_fbo = new GLRenderTarget(*m_texture);
}
effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH)); effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH));
} }
@ -273,10 +214,6 @@ void MagnifierEffect::zoomOut()
effects->stopMousePolling(); effects->stopMousePolling();
} }
if (zoom == target_zoom) { if (zoom == target_zoom) {
delete m_fbo;
delete m_texture;
m_fbo = NULL;
m_texture = NULL;
destroyPixmap(); destroyPixmap();
} }
} }
@ -293,11 +230,6 @@ void MagnifierEffect::toggle()
polling = true; polling = true;
effects->startMousePolling(); effects->startMousePolling();
} }
if (effects->isOpenGLCompositing() && !m_texture) {
m_texture = new GLTexture(magnifier_size.width(), magnifier_size.height());
m_texture->setYInverted(false);
m_fbo = new GLRenderTarget(*m_texture);
}
} else { } else {
target_zoom = 1; target_zoom = 1;
if (polling) { if (polling) {

View file

@ -22,13 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_MAGNIFIER_H #ifndef KWIN_MAGNIFIER_H
#define KWIN_MAGNIFIER_H #define KWIN_MAGNIFIER_H
#include "config-kwin.h"
#include <kwineffects.h> #include <kwineffects.h>
namespace KWin namespace KWin
{ {
class GLRenderTarget;
class GLTexture;
class XRenderPicture; class XRenderPicture;
class MagnifierEffect class MagnifierEffect
@ -68,9 +68,7 @@ private:
double target_zoom; double target_zoom;
bool polling; // Mouse polling bool polling; // Mouse polling
QSize magnifier_size; QSize magnifier_size;
GLTexture *m_texture; #ifdef KWIN_BUILD_COMPOSITE
GLRenderTarget *m_fbo;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
xcb_pixmap_t m_pixmap; xcb_pixmap_t m_pixmap;
QSize m_pixmapSize; QSize m_pixmapSize;
QScopedPointer<XRenderPicture> m_picture; QScopedPointer<XRenderPicture> m_picture;

View file

@ -1,30 +0,0 @@
##########################
## mouse click effect
##########################
# Source files
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
mouseclick/mouseclick.cpp
)
kde4_add_kcfg_files(kwin4_effect_builtins_sources mouseclick/mouseclickconfig.kcfgc)
# .desktop files
install( FILES
mouseclick/mouseclick.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
##########################
## configurtion dialog
##########################
# Source files
set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
mouseclick/mouseclick_config.cpp
mouseclick/mouseclick_config.ui
)
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources mouseclick/mouseclickconfig.kcfgc)
install( FILES
mouseclick/mouseclick_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View file

@ -1,382 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2012 Filip Wieladek <wattos@gmail.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "mouseclick.h"
// KConfigSkeleton
#include "mouseclickconfig.h"
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h>
#include <xcb/xcb.h>
#include <xcb/render.h>
#endif
#include <KAction>
#include <KActionCollection>
#include <KConfigGroup>
#include <math.h>
namespace KWin
{
KWIN_EFFECT(mouseclick, MouseClickEffect)
MouseClickEffect::MouseClickEffect()
{
m_enabled = false;
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast<KAction*>(actionCollection->addAction("ToggleMouseClick"));
a->setText(i18n("Toggle Effect"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleEnabled()));
reconfigure(ReconfigureAll);
m_buttons[0] = new MouseButton(i18n("Left"), Qt::LeftButton);
m_buttons[1] = new MouseButton(i18n("Middle"), Qt::MiddleButton);
m_buttons[2] = new MouseButton(i18n("Right"), Qt::RightButton);
}
MouseClickEffect::~MouseClickEffect()
{
if (m_enabled)
effects->stopMousePolling();
foreach (const MouseEvent* click, m_clicks) {
delete click;
}
m_clicks.clear();
for (int i = 0; i < BUTTON_COUNT; ++i) {
delete m_buttons[i];
}
}
void MouseClickEffect::reconfigure(ReconfigureFlags)
{
MouseClickConfig::self()->readConfig();
m_colors[0] = MouseClickConfig::color1();
m_colors[1] = MouseClickConfig::color2();
m_colors[2] = MouseClickConfig::color3();
m_lineWidth = MouseClickConfig::lineWidth();
m_ringLife = MouseClickConfig::ringLife();
m_ringMaxSize = MouseClickConfig::ringSize();
m_ringCount = MouseClickConfig::ringCount();
m_showText = MouseClickConfig::showText();
m_font = MouseClickConfig::font();
}
void MouseClickEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{
foreach (MouseEvent* click, m_clicks) {
click->m_time += time;
}
for (int i = 0; i < BUTTON_COUNT; ++i) {
if (m_buttons[i]->m_isPressed) {
m_buttons[i]->m_time += time;
}
}
while (m_clicks.size() > 0) {
MouseEvent* first = m_clicks[0];
if (first->m_time <= m_ringLife) {
break;
}
m_clicks.pop_front();
delete first;
}
effects->prePaintScreen(data, time);
}
void MouseClickEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);
paintScreenSetup(mask, region, data);
foreach (const MouseEvent* click, m_clicks) {
for (int i = 0; i < m_ringCount; ++i) {
float alpha = computeAlpha(click, i);
float size = computeRadius(click, i);
if (size > 0 && alpha > 0) {
QColor color = m_colors[click->m_button];
color.setAlphaF(alpha);
drawCircle(color, click->m_pos.x(), click->m_pos.y(), size);
}
}
if (m_showText && click->m_frame) {
float frameAlpha = (click->m_time * 2.0f - m_ringLife) / m_ringLife;
frameAlpha = frameAlpha < 0 ? 1 : -(frameAlpha * frameAlpha) + 1;
click->m_frame->render(infiniteRegion(), frameAlpha, frameAlpha);
}
}
paintScreenFinish(mask, region, data);
}
void MouseClickEffect::postPaintScreen()
{
effects->postPaintScreen();
repaint();
}
float MouseClickEffect::computeRadius(const MouseEvent* click, int ring)
{
float ringDistance = m_ringLife / (m_ringCount * 3);
if (click->m_press) {
return ((click->m_time - ringDistance * ring) / m_ringLife) * m_ringMaxSize;
}
return ((m_ringLife - click->m_time - ringDistance * ring) / m_ringLife) * m_ringMaxSize;
}
float MouseClickEffect::computeAlpha(const MouseEvent* click, int ring)
{
float ringDistance = m_ringLife / (m_ringCount * 3);
return (m_ringLife - (float)click->m_time - ringDistance * (ring)) / m_ringLife;
}
void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&,
Qt::MouseButtons buttons, Qt::MouseButtons oldButtons,
Qt::KeyboardModifiers, Qt::KeyboardModifiers)
{
if (buttons == oldButtons)
return;
MouseEvent* m = NULL;
for (int i = 0; i < BUTTON_COUNT; ++i) {
MouseButton* b = m_buttons[i];
if (isPressed(b->m_button, buttons, oldButtons)) {
m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelDown), true);
} else if (isReleased(b->m_button, buttons, oldButtons) && (!b->m_isPressed || b->m_time > m_ringLife)) {
// we might miss a press, thus also check !b->m_isPressed, bug #314762
m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelUp), false);
}
b->setPressed(b->m_button & buttons);
}
if (m) {
m_clicks.append(m);
}
repaint();
}
EffectFrame* MouseClickEffect::createEffectFrame(const QPoint& pos, const QString& text) {
if (!m_showText) {
return NULL;
}
QPoint point(pos.x() + m_ringMaxSize, pos.y());
EffectFrame* frame = effects->effectFrame(EffectFrameStyled, false, point, Qt::AlignLeft);
frame->setFont(m_font);
frame->setText(text);
return frame;
}
void MouseClickEffect::repaint()
{
if (m_clicks.size() > 0) {
QRegion dirtyRegion;
const int radius = m_ringMaxSize + m_lineWidth;
foreach (MouseEvent* click, m_clicks) {
dirtyRegion |= QRect(click->m_pos.x() - radius, click->m_pos.y() - radius, 2*radius, 2*radius);
if (click->m_frame) {
// we grant the plasma style 32px padding for stuff like shadows...
dirtyRegion |= click->m_frame->geometry().adjusted(-32,-32,32,32);
}
}
effects->addRepaint(dirtyRegion);
}
}
bool MouseClickEffect::isReleased(Qt::MouseButtons button, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons)
{
return !(button & buttons) && (button & oldButtons);
}
bool MouseClickEffect::isPressed(Qt::MouseButtons button, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons)
{
return (button & buttons) && !(button & oldButtons);
}
void MouseClickEffect::toggleEnabled()
{
m_enabled = !m_enabled;
if (m_enabled) {
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
effects->startMousePolling();
} else {
disconnect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
effects->stopMousePolling();
}
if (m_clicks.size() > 0) {
foreach (const MouseEvent* click, m_clicks) {
delete click;
}
}
m_clicks.clear();
for (int i = 0; i < BUTTON_COUNT; ++i) {
m_buttons[i]->m_time = 0;
m_buttons[i]->m_isPressed = false;
}
}
bool MouseClickEffect::isActive() const
{
return m_enabled && (m_clicks.size() > 0);
}
void MouseClickEffect::drawCircle(const QColor& color, float cx, float cy, float r)
{
if (effects->isOpenGLCompositing())
drawCircleGl(color, cx, cy, r);
if (effects->compositingType() == XRenderCompositing)
drawCircleXr(color, cx, cy, r);
}
void MouseClickEffect::paintScreenSetup(int mask, QRegion region, ScreenPaintData& data)
{
if (effects->isOpenGLCompositing())
paintScreenSetupGl(mask, region, data);
}
void MouseClickEffect::paintScreenFinish(int mask, QRegion region, ScreenPaintData& data)
{
if (effects->isOpenGLCompositing())
paintScreenFinishGl(mask, region, data);
}
void MouseClickEffect::drawCircleGl(const QColor& color, float cx, float cy, float r)
{
static int num_segments = 80;
static float theta = 2 * 3.1415926 / float(num_segments);
static float c = cosf(theta); //precalculate the sine and cosine
static float s = sinf(theta);
float t;
float x = r;//we start at angle = 0
float y = 0;
GLVertexBuffer* vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
vbo->setUseColor(true);
vbo->setColor(color);
QVector<float> verts;
verts.reserve(num_segments * 2);
for (int ii = 0; ii < num_segments; ++ii) {
verts << x + cx << y + cy;//output vertex
//apply the rotation matrix
t = x;
x = c * x - s * y;
y = s * t + c * y;
}
vbo->setData(verts.size() / 2, 2, verts.data(), NULL);
vbo->render(GL_LINE_LOOP);
}
void MouseClickEffect::drawCircleXr(const QColor& color, float cx, float cy, float r)
{
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (r <= m_lineWidth)
return;
int num_segments = r+8;
float theta = 2.0 * 3.1415926 / num_segments;
float cos = cosf(theta); //precalculate the sine and cosine
float sin = sinf(theta);
float x[2] = {r, r-m_lineWidth};
float y[2] = {0, 0};
#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
QVector<xcb_render_pointfix_t> strip;
strip.reserve(2*num_segments+2);
xcb_render_pointfix_t point;
point.x = DOUBLE_TO_FIXED(x[1]+cx);
point.y = DOUBLE_TO_FIXED(y[1]+cy);
strip << point;
for (int i = 0; i < num_segments; ++i) {
//apply the rotation matrix
const float h[2] = {x[0], x[1]};
x[0] = cos * x[0] - sin * y[0];
x[1] = cos * x[1] - sin * y[1];
y[0] = sin * h[0] + cos * y[0];
y[1] = sin * h[1] + cos * y[1];
point.x = DOUBLE_TO_FIXED(x[0]+cx);
point.y = DOUBLE_TO_FIXED(y[0]+cy);
strip << point;
point.x = DOUBLE_TO_FIXED(x[1]+cx);
point.y = DOUBLE_TO_FIXED(y[1]+cy);
strip << point;
}
const float h = x[0];
x[0] = cos * x[0] - sin * y[0];
y[0] = sin * h + cos * y[0];
point.x = DOUBLE_TO_FIXED(x[0]+cx);
point.y = DOUBLE_TO_FIXED(y[0]+cy);
strip << point;
XRenderPicture fill = xRenderFill(color);
xcb_render_tri_strip(connection(), XCB_RENDER_PICT_OP_OVER,
fill, effects->xrenderBufferPicture(), 0,
0, 0, strip.count(), strip.constData());
#undef DOUBLE_TO_FIXED
#else
Q_UNUSED(color)
Q_UNUSED(cx)
Q_UNUSED(cy)
Q_UNUSED(r)
#endif
}
void MouseClickEffect::paintScreenSetupGl(int, QRegion, ScreenPaintData&)
{
if (ShaderManager::instance()->isValid()) {
ShaderManager::instance()->pushShader(ShaderManager::ColorShader);
}
glLineWidth(m_lineWidth);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void MouseClickEffect::paintScreenFinishGl(int, QRegion, ScreenPaintData&)
{
glDisable(GL_BLEND);
if (ShaderManager::instance()->isValid()) {
ShaderManager::instance()->popShader();
}
}
} // namespace
#include "moc_mouseclick.cpp"

View file

@ -1,100 +0,0 @@
[Desktop Entry]
Name=Mouse Click Animation
Name[bs]=Animacija klika mišem
Name[ca]=Animació de clic de ratolí
Name[ca@valencia]=Animació de clic de ratolí
Name[cs]=Animace kliknutí myši
Name[da]=Animation af museklik
Name[de]=Animation für Mausklicks
Name[el]=Εφέ κίνησης με κλικ του ποντικιού
Name[en_GB]=Mouse Click Animation
Name[es]=Animación del clic de ratón
Name[et]=Hiireklõpsu animeerimine
Name[eu]=Sagu-klikaren animazioa
Name[fi]=Hiiren napsautuksen animointi
Name[fr]=Animation du clic de la souris
Name[gl]=Animación ao premer o rato
Name[he]=הנפשה של לחיצה עם העכבר
Name[hu]=Egérkattintás animáció
Name[ia]=Animation de click de mus
Name[is]=Hreyfingar við músarsmell
Name[it]=Animazione del clic del mouse
Name[kk]=Тышқанды түрту анимациясы
Name[ko]=
Name[lt]=Spragtelėjimo pele animacija
Name[mr]= ि
Name[nb]=Animer ved museklikk
Name[nds]=Muusklick-Animeren
Name[nl]=Animatie van muisklik
Name[pa]= ਿ
Name[pl]=Animacja kliknięcia myszy
Name[pt]=Animação do Botão do Rato
Name[pt_BR]=Animação de clique do mouse
Name[ro]=Animație la clic de maus
Name[ru]=Анимация щелчка мыши
Name[sk]=Animácia kliknutia myšou
Name[sl]=Animacija klika z miško
Name[sr]=Анимација на клик мишем
Name[sr@ijekavian]=Анимација на клик мишем
Name[sr@ijekavianlatin]=Animacija na klik mišem
Name[sr@latin]=Animacija na klik mišem
Name[sv]=Animering av musklick
Name[tr]=Fare Tıklama Animasyonu
Name[uk]=Анімація за клацанням миші
Name[x-test]=xxMouse Click Animationxx
Name[zh_CN]=
Name[zh_TW]=
Icon=preferences-system-windows-effect-mouseclick
Comment=Creates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations.
Comment[bs]=Kreira animaciju kada se god protosne dugme miša. To je korisno zasnimanje ekrana/prezentacije.
Comment[ca]=Crea una animació quan es fa clic amb un botó del ratolí. Això és útil per enregistrar la pantalla o en presentacions.
Comment[ca@valencia]=Crea una animació quan es fa clic amb un botó del ratolí. Això és útil per enregistrar la pantalla o en presentacions.
Comment[cs]=Vytvoří animaci při každém kliknutí myši. Toto je užitečné pro nahrávání obrazovky nebo prezentace.
Comment[da]=Opretter en animation når der klikkes på en museknap. Dette er nyttigt til skærmoptagelser/præsentationer.
Comment[de]=Erzeugt bei jedem Mausklick eine Animation. Dies ist sinnvoll für Bildschirmaufnahmen oder Präsentationen.
Comment[el]=Σχηματίζει εφέ κίνησης όποτε γίνεται κλικ σε κουμπί του ποντικιού. Αυτό είναι χρήσιμο για βιντεοσκόπηση οθόνης / παρουσιάσεις.
Comment[en_GB]=Creates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations.
Comment[es]=Crea una animación cada vez que se pulsa un botón del ratón. Esto resulta útil para las grabaciones de pantalla y para las presentaciones.
Comment[et]=Animatsiooni loomine hiirenupu klõpsamise peale. See on kasulik näiteks ekraanisalvestuste või esitluste jaoks.
Comment[eu]=Animazio bat sortzen du saguaren botoi bat klikatzen den bakoitzean. Erabilgarria da pantailaren grabaziorako/aurkezpenetarako.
Comment[fi]=Luo animoinnin aina hiiren painiketta napsautettaessa. Tästä on hyötyä ruututallenteissa ja -esityksissä.
Comment[gl]=Crea unha animación cando se preme no botón do rato. Isto é útil nas presentacións e nas gravacións da pantalla.
Comment[hu]=Animációt hoz létre, amikor az egérgombbal kattintanak. Ez hasznos a képernyő felvételekor vagy bemutatónál.
Comment[ia]=Crea un animation quando un button de mus es pressate. Isto es util pro registrationes de schermo/presentationes
Comment[kk]=Тышқанның батырмасын түрткенде анимацияны жасайды.Экраннан демонстацияны түсіргнде/презентацияны жасағанда ыңғайлы.
Comment[ko]= . / .
Comment[lt]=Kuria animaciją kai pelės mygtukas paspaudžiamas. Tai naudojama ekrano įrašymams / pristatymams.
Comment[mr]= ि . .
Comment[nb]=Lager en animasjon hver gang en museknapp trykkes. Dette er nyttig for skjermopptak/presentasjoner.
Comment[nds]=Animeert dat Klicken mit de Muus. Is goot för Schirmopnahmen un Presentatschonen.
Comment[nl]=Maakt een animatie wanneer op een muisknop wordt geklikt. Dit is nuttig voor schermopnamen/presentaties.
Comment[pl]=Tworzy animację przy każdym kliknięciu myszy. Jest to użyteczne przy nagrywaniu ekranu/prezentacjach
Comment[pt]=Cria uma animação sempre que um botão do rato é carregado. Isto é útil para apresentações.
Comment[pt_BR]=Cria uma animação cada vez que o botão do mouse é clicado. Isto é útil para apresentações/gravações de tela.
Comment[ro]=Creează o animație la apăsarea unui buton de maus. Este utilă pentru prezentări și înregistrări de ecran.
Comment[ru]=Создает анимацию, отмечающую щелчки мышкой. Это удобно для записи скринкастов/презентаций.
Comment[sk]=Vytvorí animáciu vždy, keď sa klikne tlačidlom myši. Toto je užitočné pre prezentácie a záznamy obrazoviek.
Comment[sl]=Prikaže animacijo, ko kliknete z gumbom miške. To je uporabno za snemanje zaslona in predstavitve.
Comment[sr]=Анимација сваки пут када се притисне дугме миша. Корисно при снимањима екрана и излагањима.
Comment[sr@ijekavian]=Анимација сваки пут када се притисне дугме миша. Корисно при снимањима екрана и излагањима.
Comment[sr@ijekavianlatin]=Animacija svaki put kada se pritisne dugme miša. Korisno pri snimanjima ekrana i izlaganjima.
Comment[sr@latin]=Animacija svaki put kada se pritisne dugme miša. Korisno pri snimanjima ekrana i izlaganjima.
Comment[sv]=Skapar en animering så fort en musknapp klickas. Det är användbart för skärminspelningar och presentationer.
Comment[tr]=Bir fare tıklanıldığı yerde animasyon oluşturur. Bu ekran kaydı/sunumlarda kullanışlıdır.
Comment[uk]=Створення анімацій у відповідь на клацання кнопкою миші. Корисне для записів демонстрацій та презентацій.
Comment[x-test]=xxCreates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations.xx
Comment[zh_CN]=
Comment[zh_TW]=
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Filip Wieladek
X-KDE-PluginInfo-Email=Wattos@gmail.com
X-KDE-PluginInfo-Name=kwin4_effect_mouseclick
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Category=Accessibility
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-Library=kwin4_effect_builtins

View file

@ -1,183 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2012 Filip Wieladek <wattos@gmail.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_MOUSECLICK_H
#define KWIN_MOUSECLICK_H
#include <kwineffects.h>
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
#include <KLocalizedString>
namespace KWin
{
#define BUTTON_COUNT 3
class MouseEvent
{
public:
int m_button;
QPoint m_pos;
int m_time;
EffectFrame* m_frame;
bool m_press;
public:
MouseEvent(int button, QPoint point, int time, EffectFrame* frame, bool press)
: m_button(button),
m_pos(point),
m_time(time),
m_frame(frame),
m_press(press)
{};
~MouseEvent()
{
delete m_frame;
}
};
class MouseButton
{
public:
QString m_labelUp;
QString m_labelDown;
Qt::MouseButtons m_button;
bool m_isPressed;
int m_time;
public:
MouseButton(QString label, Qt::MouseButtons button)
: m_labelUp(label),
m_labelDown(label),
m_button(button),
m_isPressed(false),
m_time(0)
{
m_labelDown.append(i18n(""));
m_labelUp.append(i18n(""));
};
inline void setPressed(bool pressed)
{
if (m_isPressed != pressed) {
m_isPressed = pressed;
if (pressed)
m_time = 0;
}
}
};
class MouseClickEffect
: public Effect
{
Q_OBJECT
Q_PROPERTY(QColor color1 READ color1)
Q_PROPERTY(QColor color2 READ color2)
Q_PROPERTY(QColor color3 READ color3)
Q_PROPERTY(qreal lineWidth READ lineWidth)
Q_PROPERTY(int ringLife READ ringLife)
Q_PROPERTY(int ringSize READ ringSize)
Q_PROPERTY(int ringCount READ ringCount)
Q_PROPERTY(bool showText READ isShowText)
Q_PROPERTY(QFont font READ font)
Q_PROPERTY(bool enabled READ isEnabled)
public:
MouseClickEffect();
~MouseClickEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual void postPaintScreen();
virtual bool isActive() const;
// for properties
QColor color1() const {
return m_colors[0];
}
QColor color2() const {
return m_colors[1];
}
QColor color3() const {
return m_colors[2];
}
qreal lineWidth() const {
return m_lineWidth;
}
int ringLife() const {
return m_ringLife;
}
int ringSize() const {
return m_ringMaxSize;
}
int ringCount() const {
return m_ringCount;
}
bool isShowText() const {
return m_showText;
}
QFont font() const {
return m_font;
}
bool isEnabled() const {
return m_enabled;
}
private slots:
void toggleEnabled();
void slotMouseChanged(const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
private:
EffectFrame* createEffectFrame(const QPoint& pos, const QString& text);
inline void drawCircle(const QColor& color, float cx, float cy, float r);
inline void paintScreenSetup(int mask, QRegion region, ScreenPaintData& data);
inline void paintScreenFinish(int mask, QRegion region, ScreenPaintData& data);
inline bool isReleased(Qt::MouseButtons button, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons);
inline bool isPressed(Qt::MouseButtons button, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons);
inline float computeRadius(const MouseEvent* click, int ring);
inline float computeAlpha(const MouseEvent* click, int ring);
void repaint();
void drawCircleGl(const QColor& color, float cx, float cy, float r);
void drawCircleXr(const QColor& color, float cx, float cy, float r);
void paintScreenSetupGl(int mask, QRegion region, ScreenPaintData& data);
void paintScreenFinishGl(int mask, QRegion region, ScreenPaintData& data);
QColor m_colors[BUTTON_COUNT];
int m_ringCount;
float m_lineWidth;
float m_ringLife;
float m_ringMaxSize;
bool m_showText;
QFont m_font;
QList<MouseEvent*> m_clicks;
MouseButton* m_buttons[BUTTON_COUNT];
bool m_enabled;
};
} // namespace
#endif

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-MouseClick">
<entry name="Color1" type="Color">
<default code="true">QColor(Qt::red)</default>
</entry>
<entry name="Color2" type="Color">
<default code="true">QColor(Qt::green)</default>
</entry>
<entry name="Color3" type="Color">
<default code="true">QColor(Qt::blue)</default>
</entry>
<entry name="LineWidth" type="Double">
<default>1.0</default>
</entry>
<entry name="RingLife" type="UInt">
<default>300</default>
</entry>
<entry name="RingSize" type="UInt">
<default>20</default>
</entry>
<entry name="RingCount" type="UInt">
<default>2</default>
</entry>
<entry name="ShowText" type="Bool">
<default>true</default>
</entry>
<entry name="Font" type="Font"/>
</group>
</kcfg>

View file

@ -1,83 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2012 Filip Wieladek <wattos@gmail.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "mouseclick_config.h"
// KConfigSkeleton
#include "mouseclickconfig.h"
#include <kwineffects.h>
#include <KActionCollection>
#include <KAction>
#include <KShortcutsEditor>
#include <KLocale>
#include <QWidget>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
MouseClickEffectConfigForm::MouseClickEffectConfigForm(QWidget* parent) : QWidget(parent)
{
setupUi(this);
}
MouseClickEffectConfig::MouseClickEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new MouseClickEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = static_cast<KAction*>(m_actionCollection->addAction("ToggleMouseClick"));
a->setText(i18n("Toggle Effect"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
m_ui->editor->addCollection(m_actionCollection);
addConfig(MouseClickConfig::self(), m_ui);
load();
}
MouseClickEffectConfig::~MouseClickEffectConfig()
{
// Undo (only) unsaved changes to global key shortcuts
m_ui->editor->undoChanges();
}
void MouseClickEffectConfig::save()
{
KCModule::save();
m_ui->editor->save(); // undo() will restore to this state from now on
EffectsHandler::sendReloadMessage("mouseclick");
}
} // namespace
#include "moc_mouseclick_config.cpp"

View file

@ -1,53 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_mouseclick
X-KDE-PluginKeyword=mouseclick
Name=Mouse Click Animation
Name[bs]=Animacija klika mišem
Name[ca]=Animació de clic de ratolí
Name[ca@valencia]=Animació de clic de ratolí
Name[cs]=Animace kliknutí myši
Name[da]=Animation af museklik
Name[de]=Animation für Mausklicks
Name[el]=Εφέ κίνησης με κλικ του ποντικιού
Name[en_GB]=Mouse Click Animation
Name[es]=Animación del clic de ratón
Name[et]=Hiireklõpsu animeerimine
Name[eu]=Sagu-klikaren animazioa
Name[fi]=Hiiren napsautuksen animointi
Name[fr]=Animation du clic de la souris
Name[gl]=Animación ao premer o rato
Name[he]=הנפשה של לחיצה עם העכבר
Name[hu]=Egérkattintás animáció
Name[ia]=Animation de click de mus
Name[is]=Hreyfingar við músarsmell
Name[it]=Animazione del clic del mouse
Name[kk]=Тышқанды түрту анимациясы
Name[ko]=
Name[lt]=Spragtelėjimo pele animacija
Name[mr]= ि
Name[nb]=Animer ved museklikk
Name[nds]=Muusklick-Animeren
Name[nl]=Animatie van muisklik
Name[pa]= ਿ
Name[pl]=Animacja kliknięcia myszy
Name[pt]=Animação do Botão do Rato
Name[pt_BR]=Animação de clique do mouse
Name[ro]=Animație la clic de maus
Name[ru]=Анимация щелчка мыши
Name[sk]=Animácia kliknutia myšou
Name[sl]=Animacija klika z miško
Name[sr]=Анимација на клик мишем
Name[sr@ijekavian]=Анимација на клик мишем
Name[sr@ijekavianlatin]=Animacija na klik mišem
Name[sr@latin]=Animacija na klik mišem
Name[sv]=Animering av musklick
Name[tr]=Fare Tıklama Animasyonu
Name[uk]=Анімація за клацанням миші
Name[x-test]=xxMouse Click Animationxx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -1,56 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2012 Filip Wieladek <wattos@gmail.com>
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 program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_MOUSECLICK_CONFIG_H
#define KWIN_MOUSECLICK_CONFIG_H
#include <kcmodule.h>
#include "ui_mouseclick_config.h"
class KActionCollection;
namespace KWin
{
class MouseClickEffectConfigForm : public QWidget, public Ui::MouseClickEffectConfigForm
{
Q_OBJECT
public:
explicit MouseClickEffectConfigForm(QWidget* parent);
};
class MouseClickEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit MouseClickEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
virtual ~MouseClickEffectConfig();
virtual void save();
private:
MouseClickEffectConfigForm* m_ui;
KActionCollection* m_actionCollection;
};
} // namespace
#endif

View file

@ -1,294 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWin::MouseClickEffectConfigForm</class>
<widget class="QWidget" name="KWin::MouseClickEffectConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>378</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabs">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="basic_tab">
<attribute name="title">
<string>Basic Settings</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<item row="1" column="1">
<widget class="KColorCombo" name="kcfg_Color1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="button1_label">
<property name="text">
<string>Left Mouse Button Color:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Color1</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="button2_label">
<property name="text">
<string>Middle Mouse Button Color:</string>
</property>
<property name="buddy">
<cstring>kcfg_Color2</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KColorCombo" name="kcfg_Color2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="button3_label">
<property name="text">
<string>Right Mouse Button Color:</string>
</property>
<property name="buddy">
<cstring>kcfg_Color3</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KColorCombo" name="kcfg_Color3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="advanced_tab">
<attribute name="title">
<string>Advanced Settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="rings">
<property name="title">
<string>Rings</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="ring_line_width_label">
<property name="text">
<string>Line Width:</string>
</property>
<property name="buddy">
<cstring>kcfg_LineWidth</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KDoubleNumInput" name="kcfg_LineWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> pixel</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KIntSpinBox" name="kcfg_RingLife">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> msec</string>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>5000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="ring_duration_label">
<property name="text">
<string>Ring Duration:</string>
</property>
<property name="buddy">
<cstring>kcfg_RingLife</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="ring_radius_label">
<property name="text">
<string>Ring Radius:</string>
</property>
<property name="buddy">
<cstring>kcfg_RingSize</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KIntSpinBox" name="kcfg_RingSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> pixel</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ring_count_label">
<property name="text">
<string>Ring Count:</string>
</property>
<property name="buddy">
<cstring>kcfg_RingCount</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KIntNumInput" name="kcfg_RingCount">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="font">
<property name="title">
<string>Text</string>
</property>
<layout class="QFormLayout" name="formLayout_4">
<item row="3" column="0">
<widget class="QLabel" name="font_label">
<property name="text">
<string>Font:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KFontRequester" name="kcfg_Font"/>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="kcfg_ShowText">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="showtext_label">
<property name="text">
<string>Show Text:</string>
</property>
<property name="buddy">
<cstring>kcfg_ShowText</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="KWin::GlobalShortcutsEditor" name="editor" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KColorCombo</class>
<extends>QComboBox</extends>
<header>kcolorcombo.h</header>
</customwidget>
<customwidget>
<class>KDoubleNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KFontRequester</class>
<extends>QWidget</extends>
<header>kfontrequester.h</header>
</customwidget>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KWin::GlobalShortcutsEditor</class>
<extends>QWidget</extends>
<header location="global">kwineffects.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,5 +0,0 @@
File=mouseclick.kcfg
ClassName=MouseClickConfig
NameSpace=KWin
Singleton=true
Mutators=true

Some files were not shown because too many files have changed in this diff Show more