diff --git a/CMakeLists.txt b/CMakeLists.txt index fcdfa5a3..bce0e414 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") include(CheckIncludeFiles) include(CheckFunctionExists) +include(GenerateExportHeader) find_package(KDE4 4.18.0 REQUIRED) include(KDE4Defaults) @@ -30,6 +31,7 @@ set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries" URL "http://www.opengl.org" TYPE OPTIONAL + PURPOSE "3D screensavers, OpenGL info module" ) macro_optional_find_package(OpenGLES) @@ -37,6 +39,7 @@ set_package_properties(OpenGLES PROPERTIES DESCRIPTION "The OpenGLES libraries" URL "http://www.khronos.org/opengles" TYPE OPTIONAL + PURPOSE "OpenGL ES info module" ) macro_optional_find_package(UDev) @@ -84,9 +87,6 @@ if(Q_WS_X11) if(NOT X11_Xrandr_FOUND) message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support.") 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) message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin.") endif() diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 198bbe2d..87ac8ce4 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -69,7 +69,6 @@ check_include_files(malloc.h HAVE_MALLOC_H) check_function_exists(statfs HAVE_STATFS) 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(OPENGL_FOUND HAVE_OPENGL) # kwin 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_Xcomposite_FOUND HAVE_XCOMPOSITE) # kicker, kwin diff --git a/config-X11.h.cmake b/config-X11.h.cmake index b7975d5e..2f16eb5d 100644 --- a/config-X11.h.cmake +++ b/config-X11.h.cmake @@ -31,9 +31,6 @@ /* Define if your system has XRender support */ #cmakedefine HAVE_XRENDER 1 -/* Define if you have OpenGL */ -#cmakedefine HAVE_OPENGL 1 - /* Define if you have the XSync extension */ #cmakedefine HAVE_XSYNC 1 diff --git a/kinfocenter/Modules/CMakeLists.txt b/kinfocenter/Modules/CMakeLists.txt index 06527e3b..045ee067 100644 --- a/kinfocenter/Modules/CMakeLists.txt +++ b/kinfocenter/Modules/CMakeLists.txt @@ -4,27 +4,17 @@ add_subdirectory( infosummary ) add_subdirectory( memory ) add_subdirectory( devinfo ) add_subdirectory( info ) - add_subdirectory( samba ) add_subdirectory( nics ) 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." ) - if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND NOT KWIN_BUILD_WITH_OPENGLES) - 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 ) - else(KCM_ENABLE_OPENGL OR KCM_ENABLE_OPENGLES) - MESSAGE(STATUS "OpenGL/ES2.0 information module has been disabled.") - endif(KCM_ENABLE_OPENGL OR KCM_ENABLE_OPENGLES) - +if((OPENGL_FOUND AND OPENGL_GLU_FOUND) OR OPENGLES_FOUND) + add_subdirectory( opengl ) +else() + message(STATUS "OpenGL/ES2.0 information module has been disabled.") +endif() macro_optional_find_package(PCIUTILS) set_package_properties(PCIUTILS PROPERTIES DESCRIPTION "PciUtils is a library for direct access to PCI slots" diff --git a/kinfocenter/Modules/opengl/CMakeLists.txt b/kinfocenter/Modules/opengl/CMakeLists.txt index 95930b98..523b7eb4 100644 --- a/kinfocenter/Modules/opengl/CMakeLists.txt +++ b/kinfocenter/Modules/opengl/CMakeLists.txt @@ -1,19 +1,14 @@ -if(KCM_ENABLE_OPENGL) -include_directories( ${OPENGL_INCLUDE_DIR} ${OPENGL_GLU_INCLUDE_DIR} ) -endif(KCM_ENABLE_OPENGL) +if(OPENGL_FOUND AND OPENGL_GLU_FOUND) + include_directories( ${OPENGL_INCLUDE_DIR} ${OPENGL_GLU_INCLUDE_DIR} ) +endif() -if(KCM_ENABLE_OPENGLES) -include_directories( ${OPENGLES_INCLUDE_DIR} ) -endif(KCM_ENABLE_OPENGLES) +if(OPENGLES_FOUND) + include_directories( ${OPENGLES_INCLUDE_DIR} ) +endif() ########### next target ############### -set(KCM_OPENGL_PART_SRCS 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}) +kde4_add_plugin(kcm_opengl opengl.cpp) 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}) endif(DL_LIBRARY) -if(KCM_ENABLE_OPENGL) -target_link_libraries(kcm_opengl ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) -endif(KCM_ENABLE_OPENGL) +if(OPENGL_FOUND AND OPENGL_GLU_FOUND) + target_link_libraries(kcm_opengl ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) +endif() -if(KCM_ENABLE_OPENGLES) -target_link_libraries(kcm_opengl ${OPENGLES_LIBRARIES}) -endif(KCM_ENABLE_OPENGLES) +if(OPENGLES_FOUND) + target_link_libraries(kcm_opengl ${OPENGLES_LIBRARIES}) +endif() configure_file(openglconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/openglconfig.h ) diff --git a/kscreensaver/CMakeLists.txt b/kscreensaver/CMakeLists.txt index ce53f8b2..9e84efe2 100644 --- a/kscreensaver/CMakeLists.txt +++ b/kscreensaver/CMakeLists.txt @@ -3,12 +3,5 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libkscreensaver) add_subdirectory( libkscreensaver ) add_subdirectory( kblank_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( kpartsaver ) diff --git a/kstyles/oxygen/CMakeLists.txt b/kstyles/oxygen/CMakeLists.txt index 9e4be5ed..7d8ac698 100644 --- a/kstyles/oxygen/CMakeLists.txt +++ b/kstyles/oxygen/CMakeLists.txt @@ -1,11 +1,15 @@ 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( demo ) -include_directories (animations debug transitions ${CMAKE_SOURCE_DIR}/libs/oxygen) - ########### next target ############### set(oxygen_PART_SRCS diff --git a/kwin/CMakeLists.txt b/kwin/CMakeLists.txt index 7f88b21b..4afcb3d5 100644 --- a/kwin/CMakeLists.txt +++ b/kwin/CMakeLists.txt @@ -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_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_XRENDER_COMPOSITING "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() +OPTION(KWIN_BUILD_COMPOSITE "Enable building of KWin with XRender Compositing support" ON) 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 configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h) - ########### global ############### include_directories(BEFORE @@ -57,8 +32,6 @@ if(KWIN_BUILD_KCMS) endif() add_subdirectory( clients ) -add_subdirectory( data ) - add_subdirectory( effects ) add_subdirectory( tabbox ) @@ -101,10 +74,7 @@ set(kwin_SRCS unmanaged.cpp scene.cpp scene_xrender.cpp - scene_opengl.cpp - glxbackend.cpp thumbnailitem.cpp - lanczosfilter.cpp deleted.cpp effects.cpp compositingprefs.cpp @@ -140,22 +110,18 @@ if(KWIN_BUILD_KAPPMENU) ) endif() -if(KWIN_HAVE_EGL) - set(kwin_SRCS ${kwin_SRCS} eglonxbackend.cpp) -endif() - 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.Compositing.xml composite.h KWin::Compositor ) -qt4_add_dbus_adaptor( kwin_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl ) +qt4_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface) +qt4_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Compositing.xml composite.h KWin::Compositor) +qt4_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl) -qt4_add_dbus_interface( kwin_SRCS - ${CMAKE_SOURCE_DIR}/ksmserver/org.kde.KSMServerInterface.xml ksmserver_interface) -qt4_add_dbus_interface( kwin_SRCS - ${CMAKE_SOURCE_DIR}/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml screenlocker_interface) - -qt4_add_resources( kwin_SRCS resources.qrc ) +qt4_add_dbus_interface(kwin_SRCS + ${CMAKE_SOURCE_DIR}/ksmserver/org.kde.KSMServerInterface.xml ksmserver_interface +) +qt4_add_dbus_interface(kwin_SRCS + ${CMAKE_SOURCE_DIR}/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml screenlocker_interface +) ########### target link libraries ############### @@ -199,8 +165,6 @@ set(kwin_XCB_LIBS ${XCB_KEYSYMS_LIBRARIES} ) -set(kwin_OPENGL_LIBS ) - find_library(XF86VM_LIBRARY Xxf86vm) if (XF86VM_LIBRARY) set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY}) @@ -208,55 +172,27 @@ else() add_definitions(-DKWIN_NO_XF86VM) endif() -if(OPENGL_EGL_FOUND) - set(kwin_OPENGL_LIBS ${kwin_OPENGL_LIBS} ${OPENGLES_EGL_LIBRARY}) -endif() - set(kwinLibs ${kwin_OWN_LIBS} ${kwin_QT_LIBS} ${kwin_KDE_LIBS} ${kwin_XLIB_LIBS} ${kwin_XCB_LIBS} - ${kwin_OPENGL_LIBS} ) -add_executable( kwin ${kwin_SRCS}) +add_executable(kwin ${kwin_SRCS}) 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} ) - -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(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### -install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME kwin.kcfg ) -install( FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/kwin RENAME kwin.notifyrc) -install( FILES org.kde.KWin.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) +install(FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME kwin.kcfg) +install(FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/kwin RENAME kwin.notifyrc) +install(FILES org.kde.KWin.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) -kde4_install_icons( ${ICON_INSTALL_DIR} ) +kde4_install_icons(${ICON_INSTALL_DIR}) if(ENABLE_TESTING) add_subdirectory(tests) diff --git a/kwin/ExtraDesktop.sh b/kwin/ExtraDesktop.sh deleted file mode 100644 index 11a94295..00000000 --- a/kwin/ExtraDesktop.sh +++ /dev/null @@ -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 diff --git a/kwin/bridge.h b/kwin/bridge.h index 6312ea73..200ba68e 100644 --- a/kwin/bridge.h +++ b/kwin/bridge.h @@ -28,7 +28,7 @@ namespace KWin class Client; -class Bridge : public KDecorationBridgeUnstable +class Bridge : public KDecorationBridge { public: explicit Bridge(Client* cl); diff --git a/kwin/client.cpp b/kwin/client.cpp index 8315e01e..327f59a0 100644 --- a/kwin/client.cpp +++ b/kwin/client.cpp @@ -461,8 +461,7 @@ void Client::createDecoration(const QRect& oldgeom) decoration->widget()->lower(); decoration->borders(border_left, border_right, border_top, border_bottom); padding_left = padding_right = padding_top = padding_bottom = 0; - if (KDecorationUnstable *deco2 = dynamic_cast(decoration)) - deco2->padding(padding_left, padding_right, padding_top, padding_bottom); + decoration->padding(padding_left, padding_right, padding_top, padding_bottom); Xcb::moveWindow(decoration->widget()->winId(), -padding_left, -padding_top); move(calculateGravitation(false)); plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); @@ -500,8 +499,7 @@ bool Client::checkBorderSizes(bool also_resize) return false; int new_left = 0, new_right = 0, new_top = 0, new_bottom = 0; - if (KDecorationUnstable *deco2 = dynamic_cast(decoration)) - deco2->padding(new_left, new_right, new_top, new_bottom); + decoration->padding(new_left, new_right, new_top, new_bottom); if (padding_left != new_left || padding_top != new_top) Xcb::moveWindow(decoration->widget()->winId(), -new_left, -new_top); padding_left = new_left; diff --git a/kwin/clients/aurorae/src/aurorae.cpp b/kwin/clients/aurorae/src/aurorae.cpp index a80359c4..5fabd152 100644 --- a/kwin/clients/aurorae/src/aurorae.cpp +++ b/kwin/clients/aurorae/src/aurorae.cpp @@ -40,7 +40,7 @@ namespace Aurorae AuroraeFactory::AuroraeFactory() : QObject() - , KDecorationFactoryUnstable() + , KDecorationFactory() , m_theme(new AuroraeTheme(this)) , m_engine(new QDeclarativeEngine(this)) , m_component(new QDeclarativeComponent(m_engine, this)) @@ -186,7 +186,6 @@ bool AuroraeFactory::reset(unsigned long changed) bool AuroraeFactory::supports(Ability ability) const { switch (ability) { - case AbilityAnnounceButtons: case AbilityUsesAlphaChannel: case AbilityAnnounceAlphaChannel: case AbilityButtonMenu: @@ -238,7 +237,7 @@ AuroraeFactory *AuroraeFactory::s_instance = NULL; * Client *******************************************************/ AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory) - : KDecorationUnstable(bridge, factory) + : KDecoration(bridge, factory) , m_view(NULL) , m_scene(new QGraphicsScene(this)) , m_item(AuroraeFactory::instance()->createQmlDecoration(this)) @@ -305,7 +304,7 @@ bool AuroraeClient::eventFilter(QObject *object, QEvent *event) // TODO: remove in KDE5 // see BUG: 304248 if (object != widget() || event->type() != QEvent::Wheel) { - return KDecorationUnstable::eventFilter(object, event); + return KDecoration::eventFilter(object, event); } QWheelEvent *wheel = static_cast(event); if (mousePosition(wheel->pos()) == PositionCenter) { @@ -544,12 +543,12 @@ int AuroraeClient::doubleClickInterval() const void AuroraeClient::closeWindow() { - QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), "doCloseWindow", Qt::QueuedConnection); + QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doCloseWindow", Qt::QueuedConnection); } void AuroraeClient::doCloseWindow() { - KDecorationUnstable::closeWindow(); + KDecoration::closeWindow(); } 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 // in that case we need to delay handling by one cycle // BUG: 304870 - QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), + QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doMaximzie", Qt::QueuedConnection, Q_ARG(int, button)); @@ -565,19 +564,19 @@ void AuroraeClient::maximize(int button) void AuroraeClient::doMaximzie(int button) { - KDecorationUnstable::maximize(static_cast(button)); + KDecoration::maximize(static_cast(button)); } void AuroraeClient::titlebarDblClickOperation() { // the double click operation can result in a window being maximized // see maximize - QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), "doTitlebarDblClickOperation", Qt::QueuedConnection); + QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doTitlebarDblClickOperation", Qt::QueuedConnection); } void AuroraeClient::doTitlebarDblClickOperation() { - KDecorationUnstable::titlebarDblClickOperation(); + KDecoration::titlebarDblClickOperation(); } QVariant AuroraeClient::readConfig(const QString &key, const QVariant &defaultValue) diff --git a/kwin/clients/aurorae/src/aurorae.h b/kwin/clients/aurorae/src/aurorae.h index 2e32bb32..7608efec 100644 --- a/kwin/clients/aurorae/src/aurorae.h +++ b/kwin/clients/aurorae/src/aurorae.h @@ -37,7 +37,7 @@ namespace Aurorae class AuroraeTheme; class AuroraeClient; -class AuroraeFactory : public QObject, public KDecorationFactoryUnstable +class AuroraeFactory : public QObject, public KDecorationFactory { Q_OBJECT public: @@ -82,7 +82,7 @@ private: QString m_themeName; }; -class AuroraeClient : public KDecorationUnstable +class AuroraeClient : public KDecoration { Q_OBJECT Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) diff --git a/kwin/clients/oxygen/CMakeLists.txt b/kwin/clients/oxygen/CMakeLists.txt index 3c692d38..bf49873a 100644 --- a/kwin/clients/oxygen/CMakeLists.txt +++ b/kwin/clients/oxygen/CMakeLists.txt @@ -1,11 +1,11 @@ -########### add version number into compilation defines -# FIXME: CPACK_PACKAGE_VERSION_* are empty -add_definitions ( -DAPP_VERSION=\\\"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\\\") +include_directories( + ${CMAKE_SOURCE_DIR}/libs/oxygen + ${CMAKE_BINARY_DIR}/libs/oxygen +) + add_subdirectory( config ) add_subdirectory( demo ) -include_directories(${CMAKE_SOURCE_DIR}/libs/oxygen) - ########### next target ############### set(kwin_oxygen_SRCS oxygenbutton.cpp @@ -15,22 +15,19 @@ set(kwin_oxygen_SRCS oxygenexceptionlist.cpp oxygenfactory.cpp oxygensizegrip.cpp - ) +) -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}) -target_link_libraries( - kwin3_oxygen +target_link_libraries(kwin3_oxygen ${KDE4_KDEUI_LIBS} ${X11_X11_LIB} - ${X11_Xrender_LIB} kdecorations oxygenstyle - ) +) -install(TARGETS kwin3_oxygen DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS kwin3_oxygen DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### -install( FILES oxygenclient.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin/ ) - +install(FILES oxygenclient.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin) diff --git a/kwin/clients/oxygen/config/CMakeLists.txt b/kwin/clients/oxygen/config/CMakeLists.txt index 819c4bab..aa52c932 100644 --- a/kwin/clients/oxygen/config/CMakeLists.txt +++ b/kwin/clients/oxygen/config/CMakeLists.txt @@ -8,24 +8,18 @@ set(kwin_oxygen_config_PART_SRCS oxygenexceptionlistwidget.cpp oxygenexceptionmodel.cpp ../oxygenexceptionlist.cpp - oxygenconfigurationui.ui - oxygendetectwidget.ui - oxygenexceptiondialog.ui - oxygenexceptionlistwidget.ui ) kde4_add_kcfg_files(kwin_oxygen_config_PART_SRCS ../oxygenconfiguration.kcfgc ) kde4_add_plugin(kwin_oxygen_config ${kwin_oxygen_config_PART_SRCS}) -target_link_libraries( - kwin_oxygen_config +target_link_libraries(kwin_oxygen_config ${KDE4_KDEUI_LIBS} - ${QT_QTGUI_LIBRARY} ${X11_X11_LIB} kdecorations oxygenstyle oxygenstyleconfig - ) +) -install(TARGETS kwin_oxygen_config DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(TARGETS kwin_oxygen_config DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/kwin/clients/oxygen/config/oxygenconfig.cpp b/kwin/clients/oxygen/config/oxygenconfig.cpp index 1404ff4e..df1b76f9 100644 --- a/kwin/clients/oxygen/config/oxygenconfig.cpp +++ b/kwin/clients/oxygen/config/oxygenconfig.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include #include diff --git a/kwin/clients/oxygen/demo/CMakeLists.txt b/kwin/clients/oxygen/demo/CMakeLists.txt index 23af1740..efa6370d 100644 --- a/kwin/clients/oxygen/demo/CMakeLists.txt +++ b/kwin/clients/oxygen/demo/CMakeLists.txt @@ -16,7 +16,6 @@ add_executable(oxygen-shadow-demo ${oxygen_shadow_demo_SOURCES}) target_link_libraries(oxygen-shadow-demo ${KDE4_KDEUI_LIBS} ${X11_X11_LIB} - ${X11_Xrender_LIB} ${KDE4_KIO_LIBS} oxygenstyle ) diff --git a/kwin/clients/oxygen/oxygenclient.cpp b/kwin/clients/oxygen/oxygenclient.cpp index e99493c5..d77809b7 100644 --- a/kwin/clients/oxygen/oxygenclient.cpp +++ b/kwin/clients/oxygen/oxygenclient.cpp @@ -55,7 +55,7 @@ namespace Oxygen //___________________________________________ Client::Client(KDecorationBridge *b, Factory *f): - KCommonDecorationUnstable(b, f), + KCommonDecoration(b, f), _factory( f ), _sizeGrip( 0 ), _initialized( false ), @@ -122,7 +122,7 @@ namespace Oxygen //___________________________________________ void Client::reset( unsigned long changed ) { - KCommonDecorationUnstable::reset( changed ); + KCommonDecoration::reset( changed ); // update window mask when compositing is changed if( !_initialized ) return; @@ -1132,7 +1132,7 @@ namespace Oxygen void Client::activeChange( void ) { - KCommonDecorationUnstable::activeChange(); + KCommonDecoration::activeChange(); _itemData.setDirty( true ); // update size grip so that it gets the right color @@ -1151,21 +1151,21 @@ namespace Oxygen { if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) ); setAlphaEnabled(!isMaximized()); - KCommonDecorationUnstable::maximizeChange(); + KCommonDecoration::maximizeChange(); } //_________________________________________________________ void Client::shadeChange( void ) { if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) ); - KCommonDecorationUnstable::shadeChange(); + KCommonDecoration::shadeChange(); } //_________________________________________________________ void Client::captionChange( void ) { - KCommonDecorationUnstable::captionChange(); + KCommonDecoration::captionChange(); _itemData.setDirty( true ); } @@ -1275,7 +1275,7 @@ namespace Oxygen default: break; } - return state || KCommonDecorationUnstable::eventFilter( object, event ); + return state || KCommonDecoration::eventFilter( object, event ); } @@ -1291,7 +1291,7 @@ namespace Oxygen { _pixmap = QPixmap( event->size() ); } // base class implementation - KCommonDecorationUnstable::resizeEvent( event ); + KCommonDecoration::resizeEvent( event ); } //_________________________________________________________ @@ -1727,7 +1727,7 @@ namespace Oxygen { if( event->timerId() != _dragStartTimer.timerId() ) - { return KCommonDecorationUnstable::timerEvent( event ); } + { return KCommonDecoration::timerEvent( event ); } _dragStartTimer.stop(); diff --git a/kwin/clients/oxygen/oxygenclient.h b/kwin/clients/oxygen/oxygenclient.h index 50fff458..902bd154 100644 --- a/kwin/clients/oxygen/oxygenclient.h +++ b/kwin/clients/oxygen/oxygenclient.h @@ -45,7 +45,7 @@ namespace Oxygen { class SizeGrip; - class Client : public KCommonDecorationUnstable + class Client : public KCommonDecoration { Q_OBJECT @@ -172,7 +172,7 @@ namespace Oxygen //! frame border 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 diff --git a/kwin/clients/oxygen/oxygenfactory.cpp b/kwin/clients/oxygen/oxygenfactory.cpp index 9abd2269..e508d36a 100644 --- a/kwin/clients/oxygen/oxygenfactory.cpp +++ b/kwin/clients/oxygen/oxygenfactory.cpp @@ -115,11 +115,6 @@ namespace Oxygen { switch( ability ) { - - // announce - case AbilityAnnounceButtons: - case AbilityAnnounceColors: - // buttons case AbilityButtonMenu: case AbilityButtonApplicationMenu: diff --git a/kwin/clients/oxygen/oxygenfactory.h b/kwin/clients/oxygen/oxygenfactory.h index bc1d4187..f71ddd9f 100644 --- a/kwin/clients/oxygen/oxygenfactory.h +++ b/kwin/clients/oxygen/oxygenfactory.h @@ -54,7 +54,7 @@ namespace Oxygen }; //! window decoration factory - class Factory: public QObject, public KDecorationFactoryUnstable + class Factory: public QObject, public KDecorationFactory { Q_OBJECT diff --git a/kwin/composite.cpp b/kwin/composite.cpp index 470477c7..dab24ff8 100644 --- a/kwin/composite.cpp +++ b/kwin/composite.cpp @@ -17,10 +17,12 @@ 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 . *********************************************************************/ -#include "composite.h" -#include "compositingadaptor.h" #include +#include + +#include "composite.h" +#include "compositingadaptor.h" #include "utils.h" #include @@ -32,7 +34,6 @@ along with this program. If not, see . #include "overlaywindow.h" #include "scene.h" #include "scene_xrender.h" -#include "scene_opengl.h" #include "shadow.h" #include "useractions.h" #include "compositingprefs.h" @@ -144,7 +145,6 @@ void Compositor::setup() m_starting = true; if (!options->isCompositingInitialized()) { -#ifndef KWIN_HAVE_OPENGLES // options->reloadCompositingSettings(true) initializes the CompositingPrefs which calls an // external program in turn // run this in an external thread to make startup faster. @@ -152,14 +152,9 @@ void Compositor::setup() connect(compositingPrefsFuture, SIGNAL(finished()), this, SLOT(slotCompositingOptionsInitialized())); connect(compositingPrefsFuture, SIGNAL(finished()), compositingPrefsFuture, SLOT(deleteLater())); 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 { slotCompositingOptionsInitialized(); - } + } } extern int screen_number; // main.cpp @@ -184,44 +179,7 @@ void Compositor::slotCompositingOptionsInitialized() } switch(options->compositingMode()) { - case OpenGLCompositing: { - 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 +#ifdef KWIN_BUILD_COMPOSITE case XRenderCompositing: kDebug(1212) << "Initializing XRender compositing"; 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() { if (!m_suspended) { @@ -586,15 +527,6 @@ void Compositor::performCompositing() // Get the replies 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(texture.value()); - win->effectWindow()->setData(LanczosCacheRole, QVariant()); - } - } - win->getDamageRegionReply(); } @@ -820,11 +752,6 @@ QString Compositor::compositingNotPossibleReason() const return CompositingPrefs::compositingNotPossibleReason(); } -bool Compositor::isOpenGLBroken() const -{ - return CompositingPrefs::openGlIsBroken(); -} - QString Compositor::compositingType() const { if (!hasScene()) { @@ -833,14 +760,6 @@ QString Compositor::compositingType() const switch (m_scene->compositingType()) { case XRenderCompositing: return "xrender"; - case OpenGL1Compositing: - return "gl1"; - case OpenGL2Compositing: -#ifdef KWIN_HAVE_OPENGLES - return "gles"; -#else - return "gl2"; -#endif case NoCompositing: default: return "none"; diff --git a/kwin/composite.h b/kwin/composite.h index b01afcf3..7f5e8f17 100644 --- a/kwin/composite.h +++ b/kwin/composite.h @@ -66,17 +66,10 @@ class Compositor : public QObject { * @brief The reason why compositing is not possible. Empty String if compositing is possible. **/ 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: * @li @c none No Compositing * @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) public: @@ -149,7 +142,6 @@ public: // D-Bus: getters for Properties, see documentation on the property bool isCompositingPossible() const; QString compositingNotPossibleReason() const; - bool isOpenGLBroken() const; QString compositingType() const; 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 * 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 - * @link isOpenGLBroken. + * whether the Compositor has been resumed. Also check @link isCompositingPossible. * * 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. @@ -189,7 +180,6 @@ public Q_SLOTS: * @see suspend * @see isActive * @see isCompositingPossible - * @see isOpenGLBroken **/ Q_SCRIPTABLE inline void resume() { resume(ScriptSuspend); } void resume(Compositor::SuspendReason reason); @@ -216,7 +206,6 @@ public Q_SLOTS: * @see resume * @see isActive * @see isCompositingPossible - * @see isOpenGLBroken **/ // 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! @@ -263,7 +252,6 @@ private Q_SLOTS: * That is the Compositor will be stopped and started again. **/ void restart(); - void fallbackToXRenderCompositing(); void performCompositing(); void delayedCheckUnredirect(); void slotConfigChanged(); diff --git a/kwin/compositingprefs.cpp b/kwin/compositingprefs.cpp index d6813922..946f0860 100644 --- a/kwin/compositingprefs.cpp +++ b/kwin/compositingprefs.cpp @@ -18,10 +18,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ +#include "config-kwin.h" + #include "compositingprefs.h" #include "xcbutils.h" -#include "kwinglplatform.h" #include #include @@ -42,7 +43,6 @@ extern int screen_number; // main.cpp extern bool is_multihead; 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() { - // 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()) { kDebug(1212) << "No composite extension available"; return false; @@ -73,93 +60,26 @@ bool CompositingPrefs::compositingPossible() kDebug(1212) << "No damage extension available"; return false; } - if (hasGlx()) - return true; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()) return true; #endif -#ifdef KWIN_HAVE_OPENGLES - return true; -#endif - kDebug(1212) << "No OpenGL or XRender/XFixes support"; + kDebug(1212) << "No XRender/XFixes support"; return false; } 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("OpenGL compositing (the default) has crashed KWin in the past.
" - "This was most likely due to a driver bug." - "

If you think that you have meanwhile upgraded to a stable driver,
" - "you can reset this protection but be aware that this might result in an immediate crash!

" - "

Alternatively, you might want to use the XRender backend instead.

"); - if (!Xcb::Extensions::self()->isCompositeAvailable() || !Xcb::Extensions::self()->isDamageAvailable()) { return i18n("Required X extensions (XComposite and XDamage) are not available."); } -#if !defined( KWIN_HAVE_XRENDER_COMPOSITING ) - if (!hasGlx()) - return i18n("GLX/OpenGL are not available and only OpenGL support is compiled."); -#else - if (!(hasGlx() - || (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()))) { - return i18n("GLX/OpenGL and XRender/XFixes are not available."); +#if defined( KWIN_BUILD_COMPOSITE ) + if (!Xcb::Extensions::self()->isRenderAvailable() || !Xcb::Extensions::self()->isFixesAvailable()) { + return i18n("XRender/XFixes are not available."); } #endif 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 diff --git a/kwin/compositingprefs.h b/kwin/compositingprefs.h index 8e8e1cb0..d65c801e 100644 --- a/kwin/compositingprefs.h +++ b/kwin/compositingprefs.h @@ -24,7 +24,6 @@ along with this program. If not, see . #include #include -#include "kwinglutils.h" #include "kwinglobals.h" @@ -39,25 +38,6 @@ public: static bool compositingPossible(); 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; }; } diff --git a/kwin/config-kwin.h.cmake b/kwin/config-kwin.h.cmake index 315055b7..69485572 100644 --- a/kwin/config-kwin.h.cmake +++ b/kwin/config-kwin.h.cmake @@ -2,4 +2,5 @@ #cmakedefine KWIN_BUILD_SCREENEDGES 1 #cmakedefine KWIN_BUILD_KAPPMENU 1 #cmakedefine KWIN_BUILD_OXYGEN 1 +#cmakedefine KWIN_BUILD_COMPOSITE 1 #define KWIN_VERSION_STRING "${KDE_VERSION_STRING}" diff --git a/kwin/data/CMakeLists.txt b/kwin/data/CMakeLists.txt deleted file mode 100644 index 3a397c07..00000000 --- a/kwin/data/CMakeLists.txt +++ /dev/null @@ -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 ) - diff --git a/kwin/data/pop.wav b/kwin/data/pop.wav deleted file mode 100644 index adf5c6c2..00000000 Binary files a/kwin/data/pop.wav and /dev/null differ diff --git a/kwin/data/stripTitle.js b/kwin/data/stripTitle.js deleted file mode 100644 index 24448929..00000000 --- a/kwin/data/stripTitle.js +++ /dev/null @@ -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> - 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; -}) \ No newline at end of file diff --git a/kwin/dbusinterface.cpp b/kwin/dbusinterface.cpp index 794801be..4a4e36b9 100644 --- a/kwin/dbusinterface.cpp +++ b/kwin/dbusinterface.cpp @@ -146,11 +146,6 @@ bool DBusInterface::compositingPossible() return Compositor::self()->isCompositingPossible(); } -bool DBusInterface::openGLIsBroken() -{ - return Compositor::self()->isOpenGLBroken(); -} - bool DBusInterface::compositingActive() { return Compositor::self()->isActive(); diff --git a/kwin/dbusinterface.h b/kwin/dbusinterface.h index 6c56158a..432321e6 100644 --- a/kwin/dbusinterface.h +++ b/kwin/dbusinterface.h @@ -96,10 +96,6 @@ public Q_SLOTS: // METHODS * @deprecated **/ QString compositingType(); - /** - * @deprecated - **/ - bool openGLIsBroken(); /** * @deprecated **/ diff --git a/kwin/effects.cpp b/kwin/effects.cpp index 5701e32a..c34e3697 100644 --- a/kwin/effects.cpp +++ b/kwin/effects.cpp @@ -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/>. *********************************************************************/ +#include "config-kwin.h" + #include "effects.h" #include "effectsadaptor.h" @@ -28,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "cursor.h" #include "group.h" #include "scene_xrender.h" -#include "scene_opengl.h" #include "unmanaged.h" #ifdef KWIN_BUILD_TABBOX #include "tabbox.h" @@ -40,7 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "thumbnailitem.h" #include "virtualdesktops.h" #include "workspace.h" -#include "kwinglutils.h" #include <QFile> #include <QFutureWatcher> @@ -1271,7 +1271,7 @@ void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border, Effect * unsigned long EffectsHandlerImpl::xrenderBufferPicture() { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (SceneXrender* s = dynamic_cast< SceneXrender* >(m_scene)) return s->bufferPicture(); #endif @@ -1280,13 +1280,7 @@ unsigned long EffectsHandlerImpl::xrenderBufferPicture() QLibrary* EffectsHandlerImpl::findEffectLibrary(KService* service) { - QString libname = 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); + QLibrary* library = new QLibrary(service->library()); if (!library) { kError(1212) << "couldn't open library for effect '" << service->name() << "'" << endl; @@ -1595,11 +1589,6 @@ EffectWindowImpl::EffectWindowImpl(Toplevel *toplevel) EffectWindowImpl::~EffectWindowImpl() { - QVariant cachedTextureVariant = data(LanczosCacheRole); - if (cachedTextureVariant.isValid()) { - GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); - delete cachedTexture; - } } bool EffectWindowImpl::isPaintingEnabled() @@ -1817,7 +1806,6 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint , m_static(staticSize) , m_point(position) , m_alignment(alignment) - , m_shader(NULL) { if (m_style == EffectFrameStyled) { m_frame.setImagePath("widgets/background"); @@ -1829,10 +1817,8 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint m_selection.setCacheAllRenderedFrames(true); m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders); - if (effects->isOpenGLCompositing()) { - m_sceneFrame = new SceneOpenGL::EffectFrame(this, static_cast<SceneOpenGL*>(Compositor::self()->scene())); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING + if (effects->compositingType() == XRenderCompositing) { +#ifdef KWIN_BUILD_COMPOSITE m_sceneFrame = new SceneXrender::EffectFrame(this); #endif } else { @@ -1941,13 +1927,12 @@ void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity if (m_geometry.isEmpty()) { return; // Nothing to display } - m_shader = NULL; effects->paintEffectFrame(this, region, opacity, frameOpacity); } 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); } diff --git a/kwin/effects.h b/kwin/effects.h index 56a663ce..e34749f1 100644 --- a/kwin/effects.h +++ b/kwin/effects.h @@ -378,12 +378,6 @@ public: return m_static; }; 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); const QRect& selection() const { return m_selectionGeometry; @@ -422,7 +416,6 @@ private: QRect m_selectionGeometry; Scene::EffectFrame* m_sceneFrame; - GLShader* m_shader; }; class ScreenLockerWatcher : public QObject diff --git a/kwin/effects/CMakeLists.txt b/kwin/effects/CMakeLists.txt index d2b6877d..4eb067bf 100644 --- a/kwin/effects/CMakeLists.txt +++ b/kwin/effects/CMakeLists.txt @@ -24,74 +24,38 @@ set(kwin_effect_XCB_LIBS ${XCB_XFIXES_LIBRARIES} ) -if( KWIN_HAVE_XRENDER_COMPOSITING ) +if(KWIN_BUILD_COMPOSITE ) set(kwin_effect_XCB_LIBS ${kwin_effect_XCB_LIBS} ${XCB_RENDER_LIBRARIES}) 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 ) - 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}) +macro(KWIN4_ADD_EFFECT_BACKEND name) + 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} + ) endmacro() # Adds effect plugin with given name. Sources are given after the 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}) - 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} ) - 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() + KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN}) + install( TARGETS kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR}) endmacro() macro( KWIN4_ADD_EFFECT_CONFIG name ) - set( kwin4_effect_ui ) # Initially empty - 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} ) - install( TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR} ) + kde4_add_plugin(kcm_kwin4_effect_${name} ${ARGN}) + target_link_libraries(kcm_kwin4_effect_${name} kwineffects ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS}) + install(TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR}) endmacro() # Install the KWin/Effect service type -install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) +install(FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) # Create initial variables -set( kwin4_effect_builtins_sources ) -if( NOT KWIN_MOBILE_EFFECTS ) - set( kwin4_effect_builtins_config_sources configs_builtins.cpp ) -endif() -set( kwin4_effect_include_directories ) +set(kwin4_effect_builtins_sources) +set(kwin4_effect_builtins_config_sources configs_builtins.cpp) +set(kwin4_effect_include_directories) ############################################################################### # Built-in effects go here @@ -104,44 +68,27 @@ include( slidingpopups/CMakeLists.txt ) include( taskbarthumbnail/CMakeLists.txt ) # Common effects only relevant to desktop -if( NOT KWIN_MOBILE_EFFECTS ) - include( dashboard/CMakeLists.txt ) - include( diminactive/CMakeLists.txt ) - include( dimscreen/CMakeLists.txt ) - include( highlightwindow/CMakeLists.txt ) - include( minimizeanimation/CMakeLists.txt ) - include( resize/CMakeLists.txt ) - include( showfps/CMakeLists.txt ) - include( showpaint/CMakeLists.txt ) - include( slide/CMakeLists.txt ) - include( slideback/CMakeLists.txt ) - include( thumbnailaside/CMakeLists.txt ) - include( windowgeometry/CMakeLists.txt ) - include( zoom/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( mouseclick/CMakeLists.txt ) - include( mousemark/CMakeLists.txt ) - include( sheet/CMakeLists.txt ) - include( snaphelper/CMakeLists.txt ) - include( startupfeedback/CMakeLists.txt ) - include( trackmouse/CMakeLists.txt ) - include( wobblywindows/CMakeLists.txt ) -endif() +include( dashboard/CMakeLists.txt ) +include( diminactive/CMakeLists.txt ) +include( dimscreen/CMakeLists.txt ) +include( highlightwindow/CMakeLists.txt ) +include( minimizeanimation/CMakeLists.txt ) +include( resize/CMakeLists.txt ) +include( showfps/CMakeLists.txt ) +include( showpaint/CMakeLists.txt ) +include( slide/CMakeLists.txt ) +include( slideback/CMakeLists.txt ) +include( thumbnailaside/CMakeLists.txt ) +include( windowgeometry/CMakeLists.txt ) +include( zoom/CMakeLists.txt ) +include( logout/CMakeLists.txt ) +include( magnifier/CMakeLists.txt ) +include( mousemark/CMakeLists.txt ) +include( snaphelper/CMakeLists.txt ) +include( trackmouse/CMakeLists.txt ) ############################################################################### # Add the builtins plugin KWIN4_ADD_EFFECT( builtins ${kwin4_effect_builtins_sources} ) -if( NOT KWIN_MOBILE_EFFECTS ) - KWIN4_ADD_EFFECT_CONFIG( builtins ${kwin4_effect_builtins_config_sources} ) -endif() +KWIN4_ADD_EFFECT_CONFIG( builtins ${kwin4_effect_builtins_config_sources} ) diff --git a/kwin/effects/blur/CMakeLists.txt b/kwin/effects/blur/CMakeLists.txt deleted file mode 100644 index c0ddcf07..00000000 --- a/kwin/effects/blur/CMakeLists.txt +++ /dev/null @@ -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 ) - diff --git a/kwin/effects/blur/blur.cpp b/kwin/effects/blur/blur.cpp deleted file mode 100644 index 98549307..00000000 --- a/kwin/effects/blur/blur.cpp +++ /dev/null @@ -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 ®ion) 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 ®ion) -{ - 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 - diff --git a/kwin/effects/blur/blur.desktop b/kwin/effects/blur/blur.desktop deleted file mode 100644 index 6cd35338..00000000 --- a/kwin/effects/blur/blur.desktop +++ /dev/null @@ -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è nền phía sau các cửa sổ trong suốt -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 diff --git a/kwin/effects/blur/blur.h b/kwin/effects/blur/blur.h deleted file mode 100644 index d12c6920..00000000 --- a/kwin/effects/blur/blur.h +++ /dev/null @@ -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 ®ion) 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 ®ion); - 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 - diff --git a/kwin/effects/blur/blur.kcfg b/kwin/effects/blur/blur.kcfg deleted file mode 100644 index 282b1755..00000000 --- a/kwin/effects/blur/blur.kcfg +++ /dev/null @@ -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> diff --git a/kwin/effects/blur/blur_config.cpp b/kwin/effects/blur/blur_config.cpp deleted file mode 100644 index d53c8cc9..00000000 --- a/kwin/effects/blur/blur_config.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/blur/blur_config.desktop b/kwin/effects/blur/blur_config.desktop deleted file mode 100644 index 6961d8d9..00000000 --- a/kwin/effects/blur/blur_config.desktop +++ /dev/null @@ -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]=模糊 - diff --git a/kwin/effects/blur/blur_config.h b/kwin/effects/blur/blur_config.h deleted file mode 100644 index bc33efc9..00000000 --- a/kwin/effects/blur/blur_config.h +++ /dev/null @@ -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 - diff --git a/kwin/effects/blur/blur_config.ui b/kwin/effects/blur/blur_config.ui deleted file mode 100644 index 933d0d0a..00000000 --- a/kwin/effects/blur/blur_config.ui +++ /dev/null @@ -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> diff --git a/kwin/effects/blur/blurconfig.kcfgc b/kwin/effects/blur/blurconfig.kcfgc deleted file mode 100644 index 4fb3fe58..00000000 --- a/kwin/effects/blur/blurconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=blur.kcfg -ClassName=BlurConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/kwin/effects/blur/blurshader.cpp b/kwin/effects/blur/blurshader.cpp deleted file mode 100644 index 4d8d442a..00000000 --- a/kwin/effects/blur/blurshader.cpp +++ /dev/null @@ -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 - diff --git a/kwin/effects/blur/blurshader.h b/kwin/effects/blur/blurshader.h deleted file mode 100644 index 54bde620..00000000 --- a/kwin/effects/blur/blurshader.h +++ /dev/null @@ -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 - diff --git a/kwin/effects/configs_builtins.cpp b/kwin/effects/configs_builtins.cpp index 24de62b3..c60d5a19 100644 --- a/kwin/effects/configs_builtins.cpp +++ b/kwin/effects/configs_builtins.cpp @@ -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/>. *********************************************************************/ -#include <kwinconfig.h> - #include "dashboard/dashboard_config.h" #include "diminactive/diminactive_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 "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 "mouseclick/mouseclick_config.h" #include "mousemark/mousemark_config.h" #include "trackmouse/trackmouse_config.h" -#include "wobblywindows/wobblywindows_config.h" #include <kwineffects.h> @@ -58,15 +50,9 @@ KWIN_EFFECT_CONFIG_MULTIPLE(builtins, KWIN_EFFECT_CONFIG_SINGLE(windowgeometry, WindowGeometryConfig) 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(mousemark, MouseMarkEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(trackmouse, TrackMouseEffectConfig) - KWIN_EFFECT_CONFIG_SINGLE(wobblywindows, WobblyWindowsEffectConfig) ) } // namespace diff --git a/kwin/effects/dimscreen/dimscreen.cpp b/kwin/effects/dimscreen/dimscreen.cpp index 14c8da79..1de5a970 100644 --- a/kwin/effects/dimscreen/dimscreen.cpp +++ b/kwin/effects/dimscreen/dimscreen.cpp @@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. *********************************************************************/ #include "dimscreen.h" -#include <kwinglutils.h> - namespace KWin { diff --git a/kwin/effects/glide/CMakeLists.txt b/kwin/effects/glide/CMakeLists.txt deleted file mode 100644 index ff893dce..00000000 --- a/kwin/effects/glide/CMakeLists.txt +++ /dev/null @@ -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 ) - diff --git a/kwin/effects/glide/glide.cpp b/kwin/effects/glide/glide.cpp deleted file mode 100644 index 5dda5301..00000000 --- a/kwin/effects/glide/glide.cpp +++ /dev/null @@ -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 diff --git a/kwin/effects/glide/glide.desktop b/kwin/effects/glide/glide.desktop deleted file mode 100644 index a6f771b2..00000000 --- a/kwin/effects/glide/glide.desktop +++ /dev/null @@ -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 diff --git a/kwin/effects/glide/glide.h b/kwin/effects/glide/glide.h deleted file mode 100644 index 352abb35..00000000 --- a/kwin/effects/glide/glide.h +++ /dev/null @@ -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 diff --git a/kwin/effects/glide/glide.kcfg b/kwin/effects/glide/glide.kcfg deleted file mode 100644 index a3fd1124..00000000 --- a/kwin/effects/glide/glide.kcfg +++ /dev/null @@ -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> diff --git a/kwin/effects/glide/glide_config.cpp b/kwin/effects/glide/glide_config.cpp deleted file mode 100644 index 9b5c294f..00000000 --- a/kwin/effects/glide/glide_config.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/glide/glide_config.desktop b/kwin/effects/glide/glide_config.desktop deleted file mode 100644 index 3d472cae..00000000 --- a/kwin/effects/glide/glide_config.desktop +++ /dev/null @@ -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]=滑動 diff --git a/kwin/effects/glide/glide_config.h b/kwin/effects/glide/glide_config.h deleted file mode 100644 index e76e63a6..00000000 --- a/kwin/effects/glide/glide_config.h +++ /dev/null @@ -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 - diff --git a/kwin/effects/glide/glide_config.ui b/kwin/effects/glide/glide_config.ui deleted file mode 100644 index 202eda8c..00000000 --- a/kwin/effects/glide/glide_config.ui +++ /dev/null @@ -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> diff --git a/kwin/effects/glide/glideconfig.kcfgc b/kwin/effects/glide/glideconfig.kcfgc deleted file mode 100644 index 3266f2c5..00000000 --- a/kwin/effects/glide/glideconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=glide.kcfg -ClassName=GlideConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/kwin/effects/invert/CMakeLists.txt b/kwin/effects/invert/CMakeLists.txt deleted file mode 100644 index a7d94434..00000000 --- a/kwin/effects/invert/CMakeLists.txt +++ /dev/null @@ -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 ) diff --git a/kwin/effects/invert/data/1.10/invert.frag b/kwin/effects/invert/data/1.10/invert.frag deleted file mode 100644 index 9fe602b6..00000000 --- a/kwin/effects/invert/data/1.10/invert.frag +++ /dev/null @@ -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; -} diff --git a/kwin/effects/invert/data/1.40/invert.frag b/kwin/effects/invert/data/1.40/invert.frag deleted file mode 100644 index 6dee1e60..00000000 --- a/kwin/effects/invert/data/1.40/invert.frag +++ /dev/null @@ -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; -} diff --git a/kwin/effects/invert/invert.cpp b/kwin/effects/invert/invert.cpp deleted file mode 100644 index dc0bb776..00000000 --- a/kwin/effects/invert/invert.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/invert/invert.desktop b/kwin/effects/invert/invert.desktop deleted file mode 100644 index 55b008ae..00000000 --- a/kwin/effects/invert/invert.desktop +++ /dev/null @@ -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 việc và cửa 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 diff --git a/kwin/effects/invert/invert.h b/kwin/effects/invert/invert.h deleted file mode 100644 index ef6cd914..00000000 --- a/kwin/effects/invert/invert.h +++ /dev/null @@ -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 diff --git a/kwin/effects/invert/invert_config.cpp b/kwin/effects/invert/invert_config.cpp deleted file mode 100644 index 7074dadf..00000000 --- a/kwin/effects/invert/invert_config.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/invert/invert_config.desktop b/kwin/effects/invert/invert_config.desktop deleted file mode 100644 index b01a2977..00000000 --- a/kwin/effects/invert/invert_config.desktop +++ /dev/null @@ -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]=反轉 - diff --git a/kwin/effects/invert/invert_config.h b/kwin/effects/invert/invert_config.h deleted file mode 100644 index 0d14c479..00000000 --- a/kwin/effects/invert/invert_config.h +++ /dev/null @@ -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 diff --git a/kwin/effects/kscreen/kscreen.desktop b/kwin/effects/kscreen/kscreen.desktop index e878b062..0d5306d5 100644 --- a/kwin/effects/kscreen/kscreen.desktop +++ b/kwin/effects/kscreen/kscreen.desktop @@ -91,5 +91,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=99 -X-KWin-Requires-OpenGL=false X-KWin-Requires-Shaders=false diff --git a/kwin/effects/kwineffect.desktop b/kwin/effects/kwineffect.desktop index 811a3ec5..0434825b 100644 --- a/kwin/effects/kwineffect.desktop +++ b/kwin/effects/kwineffect.desktop @@ -88,12 +88,3 @@ Comment[zh_TW]=KWin 效果 [PropertyDef::X-KDE-Ordering] Type=int - -[PropertyDef::X-KWin-Requires-OpenGL] -Type=bool - -[PropertyDef::X-KWin-Requires-OpenGL2] -Type=bool - -[PropertyDef::X-KWin-Requires-Shaders] -Type=bool diff --git a/kwin/effects/logout/CMakeLists.txt b/kwin/effects/logout/CMakeLists.txt index aa37fd7b..635fdba8 100644 --- a/kwin/effects/logout/CMakeLists.txt +++ b/kwin/effects/logout/CMakeLists.txt @@ -4,24 +4,12 @@ # Source files set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} logout/logout.cpp - ) +) kde4_add_kcfg_files(kwin4_effect_builtins_sources logout/logoutconfig.kcfgc) # .desktop files install( FILES logout/logout.desktop - 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 + DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) diff --git a/kwin/effects/logout/data/1.10/logout-blur.frag b/kwin/effects/logout/data/1.10/logout-blur.frag deleted file mode 100644 index 0d7cf70a..00000000 --- a/kwin/effects/logout/data/1.10/logout-blur.frag +++ /dev/null @@ -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; -} diff --git a/kwin/effects/logout/data/1.10/vignetting.frag b/kwin/effects/logout/data/1.10/vignetting.frag deleted file mode 100644 index 5d034a84..00000000 --- a/kwin/effects/logout/data/1.10/vignetting.frag +++ /dev/null @@ -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); -} diff --git a/kwin/effects/logout/data/1.40/logout-blur.frag b/kwin/effects/logout/data/1.40/logout-blur.frag deleted file mode 100644 index 3c6f3622..00000000 --- a/kwin/effects/logout/data/1.40/logout-blur.frag +++ /dev/null @@ -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; -} diff --git a/kwin/effects/logout/data/1.40/vignetting.frag b/kwin/effects/logout/data/1.40/vignetting.frag deleted file mode 100644 index af25ae33..00000000 --- a/kwin/effects/logout/data/1.40/vignetting.frag +++ /dev/null @@ -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); -} diff --git a/kwin/effects/logout/logout.cpp b/kwin/effects/logout/logout.cpp index 126dccbd..6db78767 100644 --- a/kwin/effects/logout/logout.cpp +++ b/kwin/effects/logout/logout.cpp @@ -24,9 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // KConfigSkeleton #include "logoutconfig.h" -#include "kwinglutils.h" -#include "kwinglplatform.h" - #include <math.h> #include <kdebug.h> #include <KGlobal> @@ -40,6 +37,8 @@ namespace KWin KWIN_EFFECT(logout, LogoutEffect) +#warning this effect is probably bogus + LogoutEffect::LogoutEffect() : progress(0.0) , displayEffect(false) @@ -48,9 +47,6 @@ LogoutEffect::LogoutEffect() , logoutWindowPassed(false) , canDoPersistent(false) , ignoredWindows() - , m_vignettingShader(NULL) - , m_blurShader(NULL) - , m_shadersDir("kwin/shaders/1.10/") { // Persistent effect logoutAtom = XInternAtom(display(), "_KDE_LOGGING_OUT", False); @@ -65,77 +61,25 @@ LogoutEffect::LogoutEffect() XChangeProperty(display(), sel, hack, hack, 8, PropModeReplace, (unsigned char*)&hack, 1); // the atom is not removed when effect is destroyed, this is temporary anyway - blurTexture = NULL; - blurTarget = NULL; 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*))); 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() { - delete blurTexture; - delete blurTarget; - delete m_vignettingShader; - delete m_blurShader; } void LogoutEffect::reconfigure(ReconfigureFlags) { LogoutConfig::self()->readConfig(); 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) { - 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) --frameDelay; else { @@ -145,10 +89,6 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) 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); 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) { 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) { // Since we can't do vignetting in XRender just do a stronger desaturation and darken 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) { 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() @@ -299,142 +169,6 @@ bool LogoutEffect::isLogoutDialog(EffectWindow* w) 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) { if (w || a != logoutAtom) diff --git a/kwin/effects/logout/logout.h b/kwin/effects/logout/logout.h index dee53bc9..744d4c45 100644 --- a/kwin/effects/logout/logout.h +++ b/kwin/effects/logout/logout.h @@ -29,14 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. namespace KWin { -class GLRenderTarget; -class GLTexture; - class LogoutEffect : public Effect { Q_OBJECT - Q_PROPERTY(bool useBlur READ isUseBlur) public: LogoutEffect(); ~LogoutEffect(); @@ -47,10 +43,6 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual bool isActive() const; - // for properties - bool isUseBlur() const { - return useBlur; - } public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow* w); void slotWindowClosed(KWin::EffectWindow *w); @@ -69,20 +61,10 @@ private: bool canDoPersistent; EffectWindowList ignoredWindows; - void renderVignetting(); - void renderVignettingLegacy(); - void renderBlurTexture(); - void renderBlurTextureLegacy(); int frameDelay; - bool blurSupported, useBlur; - GLTexture* blurTexture; - GLRenderTarget* blurTarget; double windowOpacity; EffectWindowList windows; QHash< EffectWindow*, double > windowsOpacities; - GLShader *m_vignettingShader; - GLShader *m_blurShader; - QString m_shadersDir; }; } // namespace diff --git a/kwin/effects/lookingglass/CMakeLists.txt b/kwin/effects/lookingglass/CMakeLists.txt deleted file mode 100644 index 26d72dde..00000000 --- a/kwin/effects/lookingglass/CMakeLists.txt +++ /dev/null @@ -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 ) diff --git a/kwin/effects/lookingglass/data/1.10/lookingglass.frag b/kwin/effects/lookingglass/data/1.10/lookingglass.frag deleted file mode 100644 index 48edfb93..00000000 --- a/kwin/effects/lookingglass/data/1.10/lookingglass.frag +++ /dev/null @@ -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); -} - diff --git a/kwin/effects/lookingglass/data/1.40/lookingglass.frag b/kwin/effects/lookingglass/data/1.40/lookingglass.frag deleted file mode 100644 index 239afc26..00000000 --- a/kwin/effects/lookingglass/data/1.40/lookingglass.frag +++ /dev/null @@ -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); -} - diff --git a/kwin/effects/lookingglass/lookingglass.cpp b/kwin/effects/lookingglass/lookingglass.cpp deleted file mode 100644 index 040cd182..00000000 --- a/kwin/effects/lookingglass/lookingglass.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/lookingglass/lookingglass.desktop b/kwin/effects/lookingglass/lookingglass.desktop deleted file mode 100644 index 6780ca4a..00000000 --- a/kwin/effects/lookingglass/lookingglass.desktop +++ /dev/null @@ -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]=Thấu 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 diff --git a/kwin/effects/lookingglass/lookingglass.h b/kwin/effects/lookingglass/lookingglass.h deleted file mode 100644 index 8ce9f132..00000000 --- a/kwin/effects/lookingglass/lookingglass.h +++ /dev/null @@ -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 diff --git a/kwin/effects/lookingglass/lookingglass.kcfg b/kwin/effects/lookingglass/lookingglass.kcfg deleted file mode 100644 index d3c4d71d..00000000 --- a/kwin/effects/lookingglass/lookingglass.kcfg +++ /dev/null @@ -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> diff --git a/kwin/effects/lookingglass/lookingglass_config.cpp b/kwin/effects/lookingglass/lookingglass_config.cpp deleted file mode 100644 index c7e402e4..00000000 --- a/kwin/effects/lookingglass/lookingglass_config.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/lookingglass/lookingglass_config.desktop b/kwin/effects/lookingglass/lookingglass_config.desktop deleted file mode 100644 index 69f4a027..00000000 --- a/kwin/effects/lookingglass/lookingglass_config.desktop +++ /dev/null @@ -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]=Thấu kính -Name[wa]=Berikes -Name[x-test]=xxLooking Glassxx -Name[zh_CN]=窥镜 -Name[zh_TW]=鏡射 diff --git a/kwin/effects/lookingglass/lookingglass_config.h b/kwin/effects/lookingglass/lookingglass_config.h deleted file mode 100644 index ef81612b..00000000 --- a/kwin/effects/lookingglass/lookingglass_config.h +++ /dev/null @@ -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 diff --git a/kwin/effects/lookingglass/lookingglass_config.ui b/kwin/effects/lookingglass/lookingglass_config.ui deleted file mode 100644 index d4b9b19e..00000000 --- a/kwin/effects/lookingglass/lookingglass_config.ui +++ /dev/null @@ -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>&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> diff --git a/kwin/effects/lookingglass/lookingglassconfig.kcfgc b/kwin/effects/lookingglass/lookingglassconfig.kcfgc deleted file mode 100644 index 6b35b53f..00000000 --- a/kwin/effects/lookingglass/lookingglassconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=lookingglass.kcfg -ClassName=LookingGlassConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/kwin/effects/magnifier/magnifier.cpp b/kwin/effects/magnifier/magnifier.cpp index a7fe0d71..a748bf68 100644 --- a/kwin/effects/magnifier/magnifier.cpp +++ b/kwin/effects/magnifier/magnifier.cpp @@ -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/>. *********************************************************************/ +#include "config-kwin.h" + #include "magnifier.h" // KConfigSkeleton #include "magnifierconfig.h" -#include <kwinconfig.h> - #include <kaction.h> #include <kactioncollection.h> #include <kstandardaction.h> -#include <kwinglutils.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <kwinxrenderutils.h> #include <xcb/render.h> #endif @@ -48,9 +47,7 @@ MagnifierEffect::MagnifierEffect() : zoom(1) , target_zoom(1) , polling(false) - , m_texture(0) - , m_fbo(0) -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE , m_pixmap(XCB_PIXMAP_NONE) #endif { @@ -69,8 +66,6 @@ MagnifierEffect::MagnifierEffect() MagnifierEffect::~MagnifierEffect() { - delete m_fbo; - delete m_texture; destroyPixmap(); // Save the zoom value. KConfigGroup conf = EffectsHandler::effectConfig("Magnifier"); @@ -80,7 +75,7 @@ MagnifierEffect::~MagnifierEffect() void MagnifierEffect::destroyPixmap() { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() != XRenderCompositing) { return; } @@ -94,8 +89,7 @@ void MagnifierEffect::destroyPixmap() bool MagnifierEffect::supported() { - return effects->compositingType() == XRenderCompositing || - (effects->isOpenGLCompositing() && GLRenderTarget::blitSupported()); + return effects->compositingType() == XRenderCompositing; } void MagnifierEffect::reconfigure(ReconfigureFlags) @@ -120,11 +114,6 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, int time) else { zoom = qMax(zoom * qMin(1 - diff, 0.8), target_zoom); if (zoom == 1.0) { - // zoom ended - delete FBO and texture - delete m_fbo; - delete m_texture; - m_fbo = NULL; - m_texture = NULL; destroyPixmap(); } } @@ -145,51 +134,8 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat QRect srcArea(cursor.x() - (double)area.width() / (zoom*2), cursor.y() - (double)area.height() / (zoom*2), (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) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (m_pixmap == XCB_PIXMAP_NONE || m_pixmapSize != srcArea.size()) { destroyPixmap(); m_pixmap = xcb_generate_id(connection()); @@ -255,11 +201,6 @@ void MagnifierEffect::zoomIn() polling = true; 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)); } @@ -273,10 +214,6 @@ void MagnifierEffect::zoomOut() effects->stopMousePolling(); } if (zoom == target_zoom) { - delete m_fbo; - delete m_texture; - m_fbo = NULL; - m_texture = NULL; destroyPixmap(); } } @@ -293,11 +230,6 @@ void MagnifierEffect::toggle() polling = true; 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 { target_zoom = 1; if (polling) { diff --git a/kwin/effects/magnifier/magnifier.h b/kwin/effects/magnifier/magnifier.h index 6b6ca0f4..823af313 100644 --- a/kwin/effects/magnifier/magnifier.h +++ b/kwin/effects/magnifier/magnifier.h @@ -22,13 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef KWIN_MAGNIFIER_H #define KWIN_MAGNIFIER_H +#include "config-kwin.h" + #include <kwineffects.h> namespace KWin { -class GLRenderTarget; -class GLTexture; class XRenderPicture; class MagnifierEffect @@ -68,9 +68,7 @@ private: double target_zoom; bool polling; // Mouse polling QSize magnifier_size; - GLTexture *m_texture; - GLRenderTarget *m_fbo; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE xcb_pixmap_t m_pixmap; QSize m_pixmapSize; QScopedPointer<XRenderPicture> m_picture; diff --git a/kwin/effects/mouseclick/CMakeLists.txt b/kwin/effects/mouseclick/CMakeLists.txt deleted file mode 100644 index 2c59bc6e..00000000 --- a/kwin/effects/mouseclick/CMakeLists.txt +++ /dev/null @@ -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 ) diff --git a/kwin/effects/mouseclick/mouseclick.cpp b/kwin/effects/mouseclick/mouseclick.cpp deleted file mode 100644 index c85dabb5..00000000 --- a/kwin/effects/mouseclick/mouseclick.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/mouseclick/mouseclick.desktop b/kwin/effects/mouseclick/mouseclick.desktop deleted file mode 100644 index 5d8fcaa8..00000000 --- a/kwin/effects/mouseclick/mouseclick.desktop +++ /dev/null @@ -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 diff --git a/kwin/effects/mouseclick/mouseclick.h b/kwin/effects/mouseclick/mouseclick.h deleted file mode 100644 index 2d0bb0dd..00000000 --- a/kwin/effects/mouseclick/mouseclick.h +++ /dev/null @@ -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 diff --git a/kwin/effects/mouseclick/mouseclick.kcfg b/kwin/effects/mouseclick/mouseclick.kcfg deleted file mode 100644 index b34f0724..00000000 --- a/kwin/effects/mouseclick/mouseclick.kcfg +++ /dev/null @@ -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> diff --git a/kwin/effects/mouseclick/mouseclick_config.cpp b/kwin/effects/mouseclick/mouseclick_config.cpp deleted file mode 100644 index 587a3c20..00000000 --- a/kwin/effects/mouseclick/mouseclick_config.cpp +++ /dev/null @@ -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" diff --git a/kwin/effects/mouseclick/mouseclick_config.desktop b/kwin/effects/mouseclick/mouseclick_config.desktop deleted file mode 100644 index 0581d296..00000000 --- a/kwin/effects/mouseclick/mouseclick_config.desktop +++ /dev/null @@ -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]=滑鼠點擊動畫 diff --git a/kwin/effects/mouseclick/mouseclick_config.h b/kwin/effects/mouseclick/mouseclick_config.h deleted file mode 100644 index 028662c6..00000000 --- a/kwin/effects/mouseclick/mouseclick_config.h +++ /dev/null @@ -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 diff --git a/kwin/effects/mouseclick/mouseclick_config.ui b/kwin/effects/mouseclick/mouseclick_config.ui deleted file mode 100644 index 7e55ca1c..00000000 --- a/kwin/effects/mouseclick/mouseclick_config.ui +++ /dev/null @@ -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> diff --git a/kwin/effects/mouseclick/mouseclickconfig.kcfgc b/kwin/effects/mouseclick/mouseclickconfig.kcfgc deleted file mode 100644 index cdfae157..00000000 --- a/kwin/effects/mouseclick/mouseclickconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=mouseclick.kcfg -ClassName=MouseClickConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/kwin/effects/mousemark/mousemark.cpp b/kwin/effects/mousemark/mousemark.cpp index 27c0b8f3..38e8c499 100644 --- a/kwin/effects/mousemark/mousemark.cpp +++ b/kwin/effects/mousemark/mousemark.cpp @@ -19,14 +19,13 @@ 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 "config-kwin.h" + #include "mousemark.h" // KConfigSkeleton #include "mousemarkconfig.h" -#include <kwinconfig.h> -#include <kwinglutils.h> - #include <kaction.h> #include <kactioncollection.h> #include <KLocalizedString> @@ -35,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <kdebug.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <xcb/render.h> #endif @@ -80,7 +79,7 @@ void MouseMarkEffect::reconfigure(ReconfigureFlags) color.setAlphaF(1.0); } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE void MouseMarkEffect::addRect(const QPoint &p1, const QPoint &p2, xcb_rectangle_t *r, xcb_render_color_t *c) { r->x = qMin(p1.x(), p2.x()) - width_2; @@ -112,41 +111,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat effects->paintScreen(mask, region, data); // paint normal screen if (marks.isEmpty() && drawing.isEmpty()) return; - if ( effects->isOpenGLCompositing()) { -#ifndef KWIN_HAVE_OPENGLES - glEnable(GL_LINE_SMOOTH); -#endif - glLineWidth(width); - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setUseColor(true); - vbo->setColor(color); - ShaderBinder binder(ShaderManager::ColorShader); - QVector<float> verts; - foreach (const Mark & mark, marks) { - verts.clear(); - verts.reserve(mark.size() * 2); - foreach (const QPoint & p, mark) { - verts << p.x() << p.y(); - } - vbo->setData(verts.size() / 2, 2, verts.data(), NULL); - vbo->render(GL_LINE_STRIP); - } - if (!drawing.isEmpty()) { - verts.clear(); - verts.reserve(drawing.size() * 2); - foreach (const QPoint & p, drawing) { - verts << p.x() << p.y(); - } - vbo->setData(verts.size() / 2, 2, verts.data(), NULL); - vbo->render(GL_LINE_STRIP); - } - glLineWidth(1.0); - #ifndef KWIN_HAVE_OPENGLES - glDisable(GL_LINE_SMOOTH); - #endif - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if ( effects->compositingType() == XRenderCompositing) { xcb_render_color_t c = preMultiply(color); for (int i = 0; i < marks.count(); ++i) { diff --git a/kwin/effects/mousemark/mousemark.h b/kwin/effects/mousemark/mousemark.h index 45e9f8dd..36568de2 100644 --- a/kwin/effects/mousemark/mousemark.h +++ b/kwin/effects/mousemark/mousemark.h @@ -21,8 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef KWIN_MOUSEMARK_H #define KWIN_MOUSEMARK_H +#include "config-kwin.h" + #include <kwineffects.h> -#include <kwinglutils.h> #include <kwinxrenderutils.h> struct xcb_render_color_t; @@ -60,7 +61,7 @@ private slots: private: typedef QVector< QPoint > Mark; static Mark createArrow(QPoint arrow_start, QPoint arrow_end); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE void addRect(const QPoint &p1, const QPoint &p2, xcb_rectangle_t *r, xcb_render_color_t *c); #endif QVector< Mark > marks; diff --git a/kwin/effects/presentwindows/presentwindows.cpp b/kwin/effects/presentwindows/presentwindows.cpp index 86937574..172dcdb0 100755 --- a/kwin/effects/presentwindows/presentwindows.cpp +++ b/kwin/effects/presentwindows/presentwindows.cpp @@ -32,8 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <kglobalsettings.h> #include <kdeclarative.h> -#include <kwinglutils.h> - #include <QtGui/qevent.h> #include <netwm_def.h> @@ -323,7 +321,6 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region return; } - mask |= PAINT_WINDOW_LANCZOS; // Apply opacity and brightness data.multiplyOpacity(winData->opacity); data.multiplyBrightness(interpolate(0.40, 1.0, winData->highlight)); @@ -357,9 +354,6 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region tScale = area.height() / effSize.height(); const qreal scale = interpolate(1.0, tScale, winData->highlight); if (scale > 1.0) { - if (scale < tScale) // don't use lanczos during transition - mask &= ~PAINT_WINDOW_LANCZOS; - const float df = (tScale-1.0f)*0.5f; int tx = qRound(rect.width()*df); int ty = qRound(rect.height()*df); @@ -378,9 +372,6 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region } } - if (m_motionManager.areWindowsMoving()) { - mask &= ~PAINT_WINDOW_LANCZOS; - } if (m_dragInProgress && m_dragWindow == w) { data += (cursorPos() - m_dragStart); } @@ -391,20 +382,12 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region QPoint point(rect.x() + rect.width() * 0.95, rect.y() + rect.height() * 0.95); winData->iconFrame->setPosition(point); - if (effects->compositingType() == KWin::OpenGL2Compositing && data.shader) { - const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75; - data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } winData->iconFrame->render(region, 0.9 * data.opacity() * m_decalOpacity, 0.75); } if (m_showCaptions) { QPoint point(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); winData->textFrame->setPosition(point); - if (effects->compositingType() == KWin::OpenGL2Compositing && data.shader) { - const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75; - data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } winData->textFrame->render(region, 0.9 * data.opacity() * m_decalOpacity, 0.75); } } else diff --git a/kwin/effects/resize/resize.cpp b/kwin/effects/resize/resize.cpp index a24e1241..3487758f 100644 --- a/kwin/effects/resize/resize.cpp +++ b/kwin/effects/resize/resize.cpp @@ -18,12 +18,13 @@ 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 "config-kwin.h" + #include "resize.h" // KConfigSkeleton #include "resizeconfig.h" -#include <kwinglutils.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include "kwinxrenderutils.h" #endif @@ -82,31 +83,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window float alpha = 0.8f; QColor color = KColorScheme(QPalette::Normal, KColorScheme::Selection).background().color(); - if (effects->isOpenGLCompositing()) { - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setUseColor(true); - ShaderBinder binder(ShaderManager::ColorShader); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - color.setAlphaF(alpha); - vbo->setColor(color); - QVector<float> verts; - verts.reserve(paintRegion.rects().count() * 12); - foreach (const QRect & r, paintRegion.rects()) { - verts << r.x() + r.width() << r.y(); - verts << r.x() << r.y(); - verts << r.x() << r.y() + r.height(); - verts << r.x() << r.y() + r.height(); - verts << r.x() + r.width() << r.y() + r.height(); - verts << r.x() + r.width() << r.y(); - } - vbo->setData(verts.count() / 2, 2, verts.data(), NULL); - vbo->render(GL_TRIANGLES); - glDisable(GL_BLEND); - } - -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() == XRenderCompositing) { QVector<xcb_rectangle_t> rects; foreach (const QRect & r, paintRegion.rects()) { diff --git a/kwin/effects/screenedge/screenedgeeffect.cpp b/kwin/effects/screenedge/screenedgeeffect.cpp index 29d23654..4b362444 100644 --- a/kwin/effects/screenedge/screenedgeeffect.cpp +++ b/kwin/effects/screenedge/screenedgeeffect.cpp @@ -17,10 +17,10 @@ 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 "config-kwin.h" + #include "screenedgeeffect.h" // KWin -#include <kwinglutils.h> -#include <kwingltexture.h> #include <kwinxrenderutils.h> // KDE #include <Plasma/Svg> @@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <QPainter> #include <QVector4D> // xcb -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <xcb/render.h> #endif @@ -88,27 +88,8 @@ void ScreenEdgeEffect::paintScreen(int mask, QRegion region, ScreenPaintData &da if (opacity == 0.0) { continue; } - if (effects->isOpenGLCompositing()) { - GLTexture *texture = (*it)->texture.data(); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - texture->bind(); - if (effects->compositingType() == OpenGL2Compositing) { - ShaderBinder binder(ShaderManager::SimpleShader); - const QVector4D constant(opacity, opacity, opacity, opacity); - binder.shader()->setUniform(GLShader::ModulationConstant, constant); - texture->render(infiniteRegion(), (*it)->geometry); - } else if (effects->compositingType() == OpenGL1Compositing) { -#ifdef KWIN_HAVE_OPENGL_1 - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glColor4f(1.0, 1.0, 1.0, opacity); - texture->render(infiniteRegion(), (*it)->geometry); -#endif - } - texture->unbind(); - glDisable(GL_BLEND); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING + if (effects->compositingType() == XRenderCompositing) { +#ifdef KWIN_BUILD_COMPOSITE const QRect &rect = (*it)->geometry; const QSize &size = (*it)->pictureSize; int x = rect.x(); @@ -149,10 +130,8 @@ void ScreenEdgeEffect::edgeApproaching(ElectricBorder border, qreal factor, cons (*it)->geometry = geometry; effects->addRepaint((*it)->geometry); if (border == ElectricLeft || border == ElectricRight || border == ElectricTop || border == ElectricBottom) { - if (effects->isOpenGLCompositing()) { - (*it)->texture.reset(createEdgeGlow<GLTexture>(border, geometry.size())); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING + if (effects->compositingType() == XRenderCompositing) { +#ifdef KWIN_BUILD_COMPOSITE (*it)->picture.reset(createEdgeGlow<XRenderPicture>(border, geometry.size())); #endif } @@ -181,21 +160,8 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR glow->geometry = geometry; // render the glow image - if (effects->isOpenGLCompositing()) { - if (border == ElectricTopLeft || border == ElectricTopRight || border == ElectricBottomRight || border == ElectricBottomLeft) { - glow->texture.reset(createCornerGlow<GLTexture>(border)); - } else { - glow->texture.reset(createEdgeGlow<GLTexture>(border, geometry.size())); - } - if (!glow->texture.isNull()) { - glow->texture->setWrapMode(GL_CLAMP_TO_EDGE); - } - if (glow->texture.isNull()) { - delete glow; - return NULL; - } - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING + if (effects->compositingType() == XRenderCompositing) { +#ifdef KWIN_BUILD_COMPOSITE if (border == ElectricTopLeft || border == ElectricTopRight || border == ElectricBottomRight || border == ElectricBottomLeft) { glow->pictureSize = cornerGlowSize(border); glow->picture.reset(createCornerGlow<XRenderPicture>(border)); diff --git a/kwin/effects/screenedge/screenedgeeffect.h b/kwin/effects/screenedge/screenedgeeffect.h index 20e5ce1d..2d97bf04 100644 --- a/kwin/effects/screenedge/screenedgeeffect.h +++ b/kwin/effects/screenedge/screenedgeeffect.h @@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. *********************************************************************/ #ifndef KWIN_SCREEN_EDGE_EFFECT_H #define KWIN_SCREEN_EDGE_EFFECT_H + +#include "config-kwin.h" + #include <kwineffects.h> class QTimer; @@ -28,7 +31,6 @@ namespace Plasma { namespace KWin { class Glow; -class GLTexture; class ScreenEdgeEffect : public Effect { @@ -57,8 +59,7 @@ private: class Glow { public: - QScopedPointer<GLTexture> texture; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE QScopedPointer<XRenderPicture> picture; QSize pictureSize; #endif diff --git a/kwin/effects/sheet/CMakeLists.txt b/kwin/effects/sheet/CMakeLists.txt deleted file mode 100644 index a0008b10..00000000 --- a/kwin/effects/sheet/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -####################################### -# Effect - -# Source files -set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} - sheet/sheet.cpp - ) -kde4_add_kcfg_files(kwin4_effect_builtins_sources sheet/sheetconfig.kcfgc) - -# .desktop files -install( FILES - sheet/sheet.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) - diff --git a/kwin/effects/sheet/sheet.cpp b/kwin/effects/sheet/sheet.cpp deleted file mode 100644 index a3353a71..00000000 --- a/kwin/effects/sheet/sheet.cpp +++ /dev/null @@ -1,208 +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> - -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 "sheet.h" -#include "sheetconfig.h" - -#include <QTimeLine> -#include <QtGui/qgraphicstransform.h> -#include <QVector3D> - -// Effect is based on fade effect by Philip Falkner - -namespace KWin -{ - -KWIN_EFFECT(sheet, SheetEffect) -KWIN_EFFECT_SUPPORTED(sheet, SheetEffect::supported()) - -static const int IsSheetWindow = 0x22A982D5; - -SheetEffect::SheetEffect() -{ - 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*))); -} - -bool SheetEffect::supported() -{ - return effects->isOpenGLCompositing(); -} - -void SheetEffect::reconfigure(ReconfigureFlags) -{ - SheetConfig::self()->readConfig(); - duration = animationTime(SheetConfig::animationTime() != 0 ? SheetConfig::animationTime() : 500); -} - -void SheetEffect::prePaintScreen(ScreenPrePaintData& data, int time) -{ - if (!windows.isEmpty()) { - data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; - screenTime = time; - } - effects->prePaintScreen(data, time); -} - -void SheetEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) -{ - InfoMap::iterator info = windows.find(w); - if (info != windows.end()) { - data.setTransformed(); - if (info->added) - info->timeLine->setCurrentTime(info->timeLine->currentTime() + screenTime); - else if (info->closed) { - info->timeLine->setCurrentTime(info->timeLine->currentTime() - screenTime); - 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 SheetEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - InfoMap::const_iterator info = windows.constFind(w); - if (info != windows.constEnd()) { - const double progress = info->timeLine->currentValue(); - QGraphicsRotation rot; - data.setRotationAxis(Qt::XAxis); - data.setRotationAngle(60.0 * (1.0 - progress)); - data *= QVector3D(1.0, progress, progress); - data.translate(0.0, - (w->y() - info->parentY) * (1.0 - progress)); - } - effects->paintWindow(w, mask, region, data); -} - -void SheetEffect::postPaintWindow(EffectWindow* w) -{ - InfoMap::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 SheetEffect::slotWindowAdded(EffectWindow* w) -{ - if (!isSheetWindow(w)) - return; - w->setData(IsSheetWindow, true); - - InfoMap::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); - const EffectWindowList stack = effects->stackingOrder(); - // find parent - foreach (EffectWindow * window, stack) { - if (window->findModal() == w) { - info->parentY = window->y(); - break; - } - } - w->addRepaintFull(); -} - -void SheetEffect::slotWindowClosed(EffectWindow* w) -{ - if (!isSheetWindow(w)) - return; - - w->refWindow(); - - InfoMap::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->setCurrentTime(duration); - - bool found = false; - // find parent - const EffectWindowList stack = effects->stackingOrder(); - foreach (EffectWindow * window, stack) { - if (window->findModal() == w) { - info->parentY = window->y(); - found = true; - break; - } - } - if (!found) - info->parentY = 0; - w->addRepaintFull(); -} - -void SheetEffect::slotWindowDeleted(EffectWindow* w) -{ - windows.remove(w); -} - -bool SheetEffect::isSheetWindow(EffectWindow* w) -{ - return (w->isModal() || w->data(IsSheetWindow).toBool()); -} - -bool SheetEffect::isActive() const -{ - return !windows.isEmpty(); -} - -SheetEffect::WindowInfo::WindowInfo() - : deleted(false) - , added(false) - , closed(false) - , timeLine(0) - , parentY(0) -{ -} - -SheetEffect::WindowInfo::~WindowInfo() -{ - delete timeLine; -} - -} // namespace diff --git a/kwin/effects/sheet/sheet.desktop b/kwin/effects/sheet/sheet.desktop deleted file mode 100644 index 271cea22..00000000 --- a/kwin/effects/sheet/sheet.desktop +++ /dev/null @@ -1,144 +0,0 @@ -[Desktop Entry] -Name=Sheet -Name[ar]=ورقة -Name[ast]=Fueya -Name[bg]=Листове -Name[bs]=List -Name[ca]=Full -Name[ca@valencia]=Full -Name[cs]=List -Name[csb]=Sztél -Name[da]=Ark -Name[de]=Schweben -Name[el]=Φύλλο -Name[en_GB]=Sheet -Name[eo]=Solio -Name[es]=Hoja -Name[et]=Ärakerimine -Name[eu]=Orria -Name[fa]=برگه -Name[fi]=Arkki -Name[fy]=Blêd -Name[ga]=Bileog -Name[gl]=Folla -Name[gu]=શીટ -Name[he]=גיליון -Name[hi]=शीट -Name[hr]=Stilski predložak -Name[hu]=Halványuló ablakok -Name[ia]=Folio -Name[id]=Lembar -Name[is]=Blað -Name[kk]=Жапырақтай -Name[km]=សន្លឹក​ -Name[kn]=ಹಾಳೆ -Name[ko]=시트 -Name[lt]=Lapas -Name[lv]=Loksne -Name[mai]=शीट -Name[mk]=Лист -Name[ml]=ഷീറ്റ് -Name[mr]=शीट -Name[nb]=Ark -Name[nds]=Blööd -Name[nl]=Blad -Name[nn]=Brett vindauge -Name[pa]=ਸ਼ੀਟ -Name[pl]=Arkusz -Name[pt]=Folha -Name[pt_BR]=Folha -Name[ro]=Foaie -Name[ru]=Лист -Name[si]=පත්‍රය -Name[sk]=List -Name[sl]=List -Name[sr]=Лист -Name[sr@ijekavian]=Лист -Name[sr@ijekavianlatin]=List -Name[sr@latin]=List -Name[sv]=Blad -Name[tg]=Stylesheets -Name[th]=คลี่เข้า/คลี่ออก -Name[tr]=Biçimler -Name[ug]=ۋاراق -Name[uk]=Аркуш -Name[wa]=Foye -Name[x-test]=xxSheetxx -Name[zh_CN]=飘落 -Name[zh_TW]=飄落 -Icon=preferences-system-windows-effect-sheet -Comment=Make modal dialogs smoothly fly in and out when they are shown or hidden -Comment[ar]=اجعل حوارات الشكلية تطير للداخل والخارج عند إظهاراها وإخفائها -Comment[ast]=Fai que los diálogos apaezan suavemente o s'esvanezan al amosalos o anubrilos -Comment[bg]=Откъсване като листове показване и скриване на прозорците -Comment[bs]=Modalni dijalozi glatko ulijeću i izlijeću pri pojavljivanju i sakrivanju -Comment[ca]=Fa que els diàlegs modals entrin o surtin volant quan es mostren o s'oculten -Comment[ca@valencia]=Fa que els diàlegs modals entrin o isquen volant quan es mostren o s'oculten -Comment[cs]=Nechat modální dialogy plynule zmizet/objevit se, pokud jsou zobrazeny resp. skryty -Comment[da]=Få modaldialoger til glat at flyve ind og ud når de vises eller skjules -Comment[de]=Lässt modale Dialogfenster langsam herein- bzw. herausschweben. -Comment[el]=Ομαλή εμφάνιση, απόκρυψη με κίνηση των βοηθητικών παραθύρων -Comment[en_GB]=Make modal dialogues smoothly fly in and out when they are shown or hidden -Comment[eo]=Dialogaj Fenestroj glate maldissolvi/fordissolvi kiam ili videbliĝas aŭ kaŝiĝas -Comment[es]=Hace que los diálogos aparezcan suavemente o se desvanezcan al mostrarlos u ocultarlas -Comment[et]=Paneb modaalsed dialoogid sujuvalt peale või ära kerima, kui need nähtavale tuuakse või peidetakse -Comment[eu]=Elkarrizketa-koadro modalak leunki agerrarazten eta desagerrarazten ditu erakustean edo ezkutatzean -Comment[fi]=Lennättää kyselyikkunat pehmeästi sisään ja ulos niitä näytettäessä ja piilotettaessa -Comment[fy]=Lit fintsters útstrutsen ferfage of opkomme as se te sjen binne of ferburgen wurde -Comment[ga]=Leis seo, eitlíonn dialóga módúla isteach agus amach agus iad á dtaispeáint nó á bhfolú -Comment[gl]=Fai entrar e saír voando ás xanelas modais cando se mostran ou acochan -Comment[he]=תיבות דו־שיח למיניהם יעופו פנימה והחוצה בצורה חלקה בהצגתם ובהסתרתם -Comment[hr]=Modalni dialozi glatko dolijeću i odlijeću kad ih se prikaže ili sakrije -Comment[hu]=Az ablakok folyamatosan áttűnő módon lesznek elrejtve és megjelenítve -Comment[ia]=Face que le dialogos modal pote volar dulcemente intra e foras quando illes es monstrate o celate -Comment[id]=Buat dialog modal terbang ke dalam dan keluar dengan halus ketika ditampilkan atau disembunyikan -Comment[is]=Lætur glugga þynnast mjúklega inn eða út, þegar þeir eru endurheimtir eða faldir -Comment[kk]=Көрсеткенде/жасырғанда диалогтар ұшып келеді/кетеді -Comment[km]=បង្កើត​ប្រអប់​គំរូ​ដោយ​ឲ្យ​ហោះចេញ និង​ចូល​យ៉ាង​រលូន នៅពេល​ពួកវា​ត្រូវ​បានបង្ហាញ ឬ​លាក់ -Comment[kn]=ವಿಧಾನ ಸಂವಾದವನ್ನು ತೆರೆದಾಗ ಅಥವಾ ಅಡಗಿಸಿದಾಗ ಅವುಗಳು ಸುಗಮವಾಗಿ ಹೋಗುವಂತೆ ಮಾಡುತ್ತದೆ -Comment[ko]=모달 대화 상자를 보이거나 숨길 때 부드럽게 날아다니도록 합니다 -Comment[lt]=Dialogai pamažu išnyksta/atsiranda jei juos prašoma parodyti arba jie slepiami -Comment[lv]=Liek modāliem logiem vienmērīgi atlidot un aizlidot, tos parādot un noslēpjot -Comment[ml]=മോഡല്‍ ജാലകങ്ങള്‍ ഒളിപ്പിയ്ക്കുമ്പോഴോ കാണിയ്ക്കുമ്പോഴോ മിനുസമായി പറന്നിറങ്ങുന്നതും പോകുന്നതും പോലെ തോന്നിയ്ക്കുക -Comment[mr]=संवाद दर्शविताना किंवा लपविताना त्यांना आत व बाहेर उडवा -Comment[nb]=Gjør at modale dialoger flyr inn og ut når de vises eller skjules -Comment[nds]=Modaaldialogen bi't Wiesen oder Versteken week rin- oder rutflegen laten -Comment[nl]=Laat modale dialogen vloeiend in/uitvliegen als ze worden getoond of verborgen -Comment[nn]=Brett undervindauge inn og ut av skjermen -Comment[pa]=ਮਾਡਲ ਡਾਈਲਾਗ ਨੂੰ ਕੂਲੇ ਢੰਗ ਨਾਲ ਇਨ ਤੇ ਆਉਟ ਕਰੋ, ਜਦੋਂ ਉਹਨਾਂ ਨੂੰ ਵੇਖਾਉਣਾ ਜਾਂ ਓਹਲੇ ਕਰਨਾ ਹੋਵੇ -Comment[pl]=Gładkie przylatywanie i odlatywanie okien dialogowych przy ich pokazywaniu lub ukrywaniu -Comment[pt]=Fazer com que as janelas voem suavemente quando aparecem ou ficam escondidas -Comment[pt_BR]=Faz as janelas voarem suavemente quando são exibidas ou ocultadas -Comment[ro]=Face dialogurile modale să zboare lin cînd sînt afișate sau ascunse -Comment[ru]=Модальные окна будут плавно вылетать во время их появления и скрытия -Comment[si]=පෙන්වන හා සඟවන විට ආකෘති සංවාද ඇතුළට හා පිටතට පියාසර කරවන්න -Comment[sk]=Modálne dialógy sa plynule objavia/zmiznú pri ich zobrazení alebo skrytí -Comment[sl]=Pogovorna okna, ki so vedno na vrhu glavnega okna, priletijo in odletijo kot list papirja -Comment[sr]=Модални дијалози глатко улећу и излећу при појављивању и сакривању -Comment[sr@ijekavian]=Модални дијалози глатко улијећу и излећу при појављивању и сакривању -Comment[sr@ijekavianlatin]=Modalni dijalozi glatko ulijeću i izleću pri pojavljivanju i sakrivanju -Comment[sr@latin]=Modalni dijalozi glatko uleću i izleću pri pojavljivanju i sakrivanju -Comment[sv]=Gör att dialogrutor mjukt flyger in eller ut när de visas eller döljs -Comment[th]=ทำให้หน้าต่างกล่องโต้ตอบแบบมอดัลคลี่เข้า/คลี่ออกอย่างนุ่มนวลเมื่อมันถูกแสดงหรือถูกซ่อน -Comment[tr]=Pencereler gösterilirken ve gizlenirken pürüzsüz bir şekilde hareket ettir -Comment[ug]=سۆزلەشكۈنى كۆرسەتكەن ياكى يوشۇرغاندا ئۇچۇپ كىرىپ ۋە ئۇچۇپ چىققان ھالەتتە كۆرسەت -Comment[uk]=Плавне влітання або відлітання вікон під час їх появи або приховування -Comment[vi]=Làm các hộp thoại con bay vào và ra khi chúng được hiện lên hay ẩn đi -Comment[wa]=Fé on doûs fondou volant d' intrêye et d' rexhowe po les modås purneas cwand on les mostere ou k' on les catche -Comment[x-test]=xxMake modal dialogs smoothly fly in and out when they are shown or hiddenxx -Comment[zh_CN]=显示或隐藏对话框时,以飘起飘落的形式呈现 -Comment[zh_TW]=顯示或隱藏對話框時以飄下來、飄上去的方式呈現 - -Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=kwin4_effect_sheet -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=60 -X-KWin-Requires-OpenGL=true diff --git a/kwin/effects/sheet/sheet.h b/kwin/effects/sheet/sheet.h deleted file mode 100644 index 79fbf557..00000000 --- a/kwin/effects/sheet/sheet.h +++ /dev/null @@ -1,79 +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> - -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_SHEET_H -#define KWIN_SHEET_H - -#include <kwineffects.h> - -class QTimeLine; - -namespace KWin -{ - -class SheetEffect - : public Effect -{ - Q_OBJECT - Q_PROPERTY(int duration READ configuredDuration) -public: - SheetEffect(); - 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; - } -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 > InfoMap; - bool isSheetWindow(EffectWindow* w); - InfoMap windows; - float duration; - int screenTime; -}; - -class SheetEffect::WindowInfo -{ -public: - WindowInfo(); - ~WindowInfo(); - bool deleted; - bool added; - bool closed; - QTimeLine *timeLine; - int parentY; -}; - -} // namespace - -#endif diff --git a/kwin/effects/sheet/sheet.kcfg b/kwin/effects/sheet/sheet.kcfg deleted file mode 100644 index 17c4bba6..00000000 --- a/kwin/effects/sheet/sheet.kcfg +++ /dev/null @@ -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-Sheet"> - <entry name="AnimationTime" type="Int"> - <default>0</default> - </entry> - </group> -</kcfg> diff --git a/kwin/effects/sheet/sheetconfig.kcfgc b/kwin/effects/sheet/sheetconfig.kcfgc deleted file mode 100644 index 239872e0..00000000 --- a/kwin/effects/sheet/sheetconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=sheet.kcfg -ClassName=SheetConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/kwin/effects/showfps/showfps.cpp b/kwin/effects/showfps/showfps.cpp index a4588fe6..dedd91f1 100644 --- a/kwin/effects/showfps/showfps.cpp +++ b/kwin/effects/showfps/showfps.cpp @@ -18,15 +18,14 @@ 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 "config-kwin.h" + #include "showfps.h" // KConfigSkeleton #include "showfpsconfig.h" -#include <kwinconfig.h> - -#include <kwinglutils.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <kwinxrenderutils.h> #include <xcb/render.h> #endif @@ -158,11 +157,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) ++fps; // count all frames in the last second if (fps > MAX_TIME) fps = MAX_TIME; // keep it the same height - if (effects->isOpenGLCompositing()) { - paintGL(fps); - glFinish(); // make sure all rendering is done - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() == XRenderCompositing) { paintXrender(fps); XSync(display(), False); // make sure all rendering is done @@ -171,83 +166,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) m_noBenchmark->render(infiniteRegion(), 1.0, alpha); } -void ShowFpsEffect::paintGL(int fps) -{ - int x = this->x; - int y = this->y; - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // TODO painting first the background white and then the contents - // means that the contents also blend with the background, I guess - ShaderBinder binder(ShaderManager::ColorShader); - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - QColor color(255, 255, 255); - color.setAlphaF(alpha); - vbo->setColor(color); - QVector<float> verts; - verts.reserve(12); - verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y; - verts << x << y; - verts << x << y + MAX_TIME; - verts << x << y + MAX_TIME; - verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y + MAX_TIME; - verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y; - vbo->setData(6, 2, verts.constData(), NULL); - vbo->render(GL_TRIANGLES); - y += MAX_TIME; // paint up from the bottom - color.setRed(0); - color.setGreen(0); - vbo->setColor(color); - verts.clear(); - verts << x + FPS_WIDTH << y - fps; - verts << x << y - fps; - verts << x << y; - verts << x << y; - verts << x + FPS_WIDTH << y; - verts << x + FPS_WIDTH << y - fps; - vbo->setData(6, 2, verts.constData(), NULL); - vbo->render(GL_TRIANGLES); - - - color.setBlue(0); - vbo->setColor(color); - QVector<float> vertices; - for (int i = 10; - i < MAX_TIME; - i += 10) { - vertices << x << y - i; - vertices << x + FPS_WIDTH << y - i; - } - vbo->setData(vertices.size() / 2, 2, vertices.constData(), NULL); - vbo->render(GL_LINES); - x += FPS_WIDTH; - - // Paint FPS graph - paintFPSGraph(x, y); - x += NUM_PAINTS; - - // Paint amount of rendered pixels graph - paintDrawSizeGraph(x, y); - - // Paint FPS numerical value - if (fpsTextRect.isValid()) { - fpsText.reset(new GLTexture(fpsTextImage(fps))); - fpsText->bind(); - ShaderBinder binder(ShaderManager::SimpleShader); - if (effects->compositingType() == OpenGL2Compositing) { - binder.shader()->setUniform("offset", QVector2D(0, 0)); - } - fpsText->render(QRegion(fpsTextRect), fpsTextRect); - fpsText->unbind(); - effects->addRepaint(fpsTextRect); - } - - // Paint paint sizes - glDisable(GL_BLEND); -} - -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE /* Differences between OpenGL and XRender: - differently specified rectangles (X: width/height, O: x2,y2) @@ -353,52 +272,7 @@ void ShowFpsEffect::paintDrawSizeGraph(int x, int y) void ShowFpsEffect::paintGraph(int x, int y, QList<int> values, QList<int> lines, bool colorize) { - if (effects->isOpenGLCompositing()) { - QColor color(0, 0, 0); - color.setAlphaF(alpha); - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setColor(color); - QVector<float> verts; - // First draw the lines - foreach (int h, lines) { - verts << x << y - h; - verts << x + values.count() << y - h; - } - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); - vbo->render(GL_LINES); - // Then the graph values - int lastValue = 0; - verts.clear(); - for (int i = 0; i < values.count(); i++) { - int value = values[ i ]; - if (colorize && value != lastValue) { - if (!verts.isEmpty()) { - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); - vbo->render(GL_LINES); - } - verts.clear(); - if (value <= 10) { - color = QColor(0, 255, 0); - } else if (value <= 20) { - color = QColor(255, 255, 0); - } else if (value <= 50) { - color = QColor(255, 0, 0); - } else { - color = QColor(0, 0, 0); - } - vbo->setColor(color); - } - verts << x + values.count() - i << y; - verts << x + values.count() - i << y - value; - lastValue = value; - } - if (!verts.isEmpty()) { - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); - vbo->render(GL_LINES); - } - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() == XRenderCompositing) { xcb_pixmap_t pixmap = xcb_generate_id(connection()); xcb_create_pixmap(connection(), 32, pixmap, rootWindow(), values.count(), MAX_TIME); diff --git a/kwin/effects/showfps/showfps.h b/kwin/effects/showfps/showfps.h index 2b1a0869..0c6d7167 100644 --- a/kwin/effects/showfps/showfps.h +++ b/kwin/effects/showfps/showfps.h @@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. namespace KWin { -class GLTexture; class ShowFpsEffect : public Effect @@ -73,8 +72,7 @@ public: return textColor; } private: - void paintGL(int fps); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE void paintXrender(int fps); #endif void paintFPSGraph(int x, int y); @@ -93,7 +91,6 @@ private: int x; int y; QRect fps_rect; - QScopedPointer<GLTexture> fpsText; int textPosition; QFont textFont; QColor textColor; diff --git a/kwin/effects/showpaint/showpaint.cpp b/kwin/effects/showpaint/showpaint.cpp index 9de4649d..91727dab 100644 --- a/kwin/effects/showpaint/showpaint.cpp +++ b/kwin/effects/showpaint/showpaint.cpp @@ -21,10 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "showpaint.h" -#include <kwinconfig.h> +#include <config-kwin.h> -#include <kwinglutils.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <xcb/render.h> #endif @@ -54,11 +53,22 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat { painted = QRegion(); effects->paintScreen(mask, region, data); - if (effects->isOpenGLCompositing()) - paintGL(); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) - paintXrender(); +#ifdef KWIN_BUILD_COMPOSITE + if (effects->compositingType() == XRenderCompositing) { + xcb_render_color_t col; + float alpha = 0.2; + const QColor& color = colors[ color_index ]; + col.alpha = int(alpha * 0xffff); + col.red = int(alpha * 0xffff * color.red() / 255); + col.green = int(alpha * 0xffff * color.green() / 255); + col.blue = int(alpha * 0xffff * color.blue() / 255); + QVector<xcb_rectangle_t> rects; + foreach (const QRect & r, painted.rects()) { + xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())}; + rects << rect; + } + xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_OVER, effects->xrenderBufferPicture(), col, rects.count(), rects.constData()); + } #endif if (++color_index == sizeof(colors) / sizeof(colors[ 0 ])) color_index = 0; @@ -70,49 +80,4 @@ void ShowPaintEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win effects->paintWindow(w, mask, region, data); } -void ShowPaintEffect::paintGL() -{ - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setUseColor(true); - ShaderBinder binder(ShaderManager::ColorShader); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - QColor color = colors[ color_index ]; - color.setAlphaF(0.2); - vbo->setColor(color); - QVector<float> verts; - verts.reserve(painted.rects().count() * 12); - foreach (const QRect & r, painted.rects()) { - verts << r.x() + r.width() << r.y(); - verts << r.x() << r.y(); - verts << r.x() << r.y() + r.height(); - verts << r.x() << r.y() + r.height(); - verts << r.x() + r.width() << r.y() + r.height(); - verts << r.x() + r.width() << r.y(); - } - vbo->setData(verts.count() / 2, 2, verts.data(), NULL); - vbo->render(GL_TRIANGLES); - glDisable(GL_BLEND); -} - -void ShowPaintEffect::paintXrender() -{ -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - xcb_render_color_t col; - float alpha = 0.2; - const QColor& color = colors[ color_index ]; - col.alpha = int(alpha * 0xffff); - col.red = int(alpha * 0xffff * color.red() / 255); - col.green = int(alpha * 0xffff * color.green() / 255); - col.blue = int(alpha * 0xffff * color.blue() / 255); - QVector<xcb_rectangle_t> rects; - foreach (const QRect & r, painted.rects()) { - xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())}; - rects << rect; - } - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_OVER, effects->xrenderBufferPicture(), col, rects.count(), rects.constData()); -#endif -} - } // namespace diff --git a/kwin/effects/showpaint/showpaint.h b/kwin/effects/showpaint/showpaint.h index 83c48390..24aca705 100644 --- a/kwin/effects/showpaint/showpaint.h +++ b/kwin/effects/showpaint/showpaint.h @@ -35,8 +35,6 @@ public: virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); private: - void paintGL(); - void paintXrender(); QRegion painted; // what's painted in one pass int color_index; }; diff --git a/kwin/effects/snaphelper/snaphelper.cpp b/kwin/effects/snaphelper/snaphelper.cpp index 86dd4b6d..9a68c444 100644 --- a/kwin/effects/snaphelper/snaphelper.cpp +++ b/kwin/effects/snaphelper/snaphelper.cpp @@ -20,8 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "snaphelper.h" -#include <kwinglutils.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <kwinxrenderutils.h> #include <xcb/render.h> #endif @@ -69,55 +68,8 @@ void SnapHelperEffect::postPaintScreen() effects->postPaintScreen(); if (m_timeline.currentValue() != 0.0) { // Display the guide - if (effects->isOpenGLCompositing()) { - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setUseColor(true); - ShaderBinder binder(ShaderManager::ColorShader); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - QColor color; - color.setRedF(0.5); - color.setGreenF(0.5); - color.setBlueF(0.5); - color.setAlphaF(m_timeline.currentValue() * 0.5); - vbo->setColor(color); - glLineWidth(4.0); - QVector<float> verts; - verts.reserve(effects->numScreens() * 24); - for (int i = 0; i < effects->numScreens(); ++i) { - const QRect& rect = effects->clientArea(ScreenArea, i, 0); - int midX = rect.x() + rect.width() / 2; - int midY = rect.y() + rect.height() / 2 ; - int halfWidth = m_window->width() / 2; - int halfHeight = m_window->height() / 2; - - // Center lines - verts << rect.x() + rect.width() / 2 << rect.y(); - verts << rect.x() + rect.width() / 2 << rect.y() + rect.height(); - verts << rect.x() << rect.y() + rect.height() / 2; - verts << rect.x() + rect.width() << rect.y() + rect.height() / 2; - - // Window outline - // The +/- 2 is to prevent line overlap - verts << midX - halfWidth + 2 << midY - halfHeight; - verts << midX + halfWidth + 2 << midY - halfHeight; - verts << midX + halfWidth << midY - halfHeight + 2; - verts << midX + halfWidth << midY + halfHeight + 2; - verts << midX + halfWidth - 2 << midY + halfHeight; - verts << midX - halfWidth - 2 << midY + halfHeight; - verts << midX - halfWidth << midY + halfHeight - 2; - verts << midX - halfWidth << midY - halfHeight - 2; - } - vbo->setData(verts.count() / 2, 2, verts.data(), NULL); - vbo->render(GL_LINES); - - glDisable(GL_BLEND); - glLineWidth(1.0); - } if ( effects->compositingType() == XRenderCompositing ) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE for (int i = 0; i < effects->numScreens(); ++i) { const QRect& rect = effects->clientArea( ScreenArea, i, 0 ); int midX = rect.x() + rect.width() / 2; diff --git a/kwin/effects/startupfeedback/CMakeLists.txt b/kwin/effects/startupfeedback/CMakeLists.txt deleted file mode 100644 index 5bf2b7b0..00000000 --- a/kwin/effects/startupfeedback/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -####################################### -# Effect - -# Source files -set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} - startupfeedback/startupfeedback.cpp - ) - -# .desktop files -install( FILES - startupfeedback/startupfeedback.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) - -# Data files -install( FILES - startupfeedback/data/blinking-startup-fragment.glsl - DESTINATION ${DATA_INSTALL_DIR}/kwin ) - -####################################### -# Config diff --git a/kwin/effects/startupfeedback/data/blinking-startup-fragment.glsl b/kwin/effects/startupfeedback/data/blinking-startup-fragment.glsl deleted file mode 100644 index 72200c0c..00000000 --- a/kwin/effects/startupfeedback/data/blinking-startup-fragment.glsl +++ /dev/null @@ -1,13 +0,0 @@ -uniform sampler2D sampler; -uniform vec4 u_color; - -varying vec2 varyingTexCoords; - -void main() -{ - vec4 tex = texture2D(sampler, varyingTexCoords); - if (tex.a != 1.0) { - tex = u_color; - } - gl_FragColor = tex; -} diff --git a/kwin/effects/startupfeedback/startupfeedback.cpp b/kwin/effects/startupfeedback/startupfeedback.cpp deleted file mode 100644 index 4f0347d4..00000000 --- a/kwin/effects/startupfeedback/startupfeedback.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2010 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ -#include "startupfeedback.h" -// Qt -#include <QSize> -#include <QtGui/QPainter> -// KDE -#include <KConfigGroup> -#include <KDebug> -#include <KGlobal> -#include <KIconLoader> -#include <KStandardDirs> -#include <KStartupInfo> -#include <KSelectionOwner> -// KWin -#include <kwinglutils.h> -// X11 -#include <X11/Xcursor/Xcursor.h> - -// based on StartupId in KRunner by Lubos Lunak -// Copyright (C) 2001 Lubos Lunak <l.lunak@kde.org> - -namespace KWin -{ - -KWIN_EFFECT(startupfeedback, StartupFeedbackEffect) -KWIN_EFFECT_SUPPORTED(startupfeedback, StartupFeedbackEffect::supported()) - -// number of key frames for bouncing animation -static const int BOUNCE_FRAMES = 20; -// duration between two key frames in msec -static const int BOUNCE_FRAME_DURATION = 30; -// duration of one bounce animation -static const int BOUNCE_DURATION = BOUNCE_FRAME_DURATION * BOUNCE_FRAMES; -// number of key frames for blinking animation -static const int BLINKING_FRAMES = 5; -// duration between two key frames in msec -static const int BLINKING_FRAME_DURATION = 100; -// duration of one blinking animation -static const int BLINKING_DURATION = BLINKING_FRAME_DURATION * BLINKING_FRAMES; -//const int color_to_pixmap[] = { 0, 1, 2, 3, 2, 1 }; -static const int FRAME_TO_BOUNCE_YOFFSET[] = { - -5, -1, 2, 5, 8, 10, 12, 13, 15, 15, 15, 15, 14, 12, 10, 8, 5, 2, -1, -5 -}; -static const QSize BOUNCE_SIZES[] = { - QSize(16, 16), QSize(14, 18), QSize(12, 20), QSize(18, 14), QSize(20, 12) -}; -static const int FRAME_TO_BOUNCE_TEXTURE[] = { - 0, 0, 0, 1, 2, 2, 1, 0, 3, 4, 4, 3, 0, 1, 2, 2, 1, 0, 0, 0 -}; -static const int FRAME_TO_BLINKING_COLOR[] = { - 0, 1, 2, 3, 2, 1 -}; -static const QColor BLINKING_COLORS[] = { - Qt::black, Qt::darkGray, Qt::lightGray, Qt::white, Qt::white -}; - -StartupFeedbackEffect::StartupFeedbackEffect() - : m_bounceSizesRatio(1.0) - , m_startupInfo(new KStartupInfo(KStartupInfo::CleanOnCantDetect, this)) - , m_selection(new KSelectionOwner("_KDE_STARTUP_FEEDBACK", -1, this)) - , m_active(false) - , m_frame(0) - , m_progress(0) - , m_texture(0) - , m_type(BouncingFeedback) - , m_blinkingShader(0) -{ - for (int i = 0; i < 5; ++i) { - m_bouncingTextures[i] = 0; - } - m_selection->claim(true); - connect(m_startupInfo, SIGNAL(gotNewStartup(KStartupInfoId,KStartupInfoData)), SLOT(gotNewStartup(KStartupInfoId,KStartupInfoData))); - connect(m_startupInfo, SIGNAL(gotRemoveStartup(KStartupInfoId,KStartupInfoData)), SLOT(gotRemoveStartup(KStartupInfoId,KStartupInfoData))); - connect(m_startupInfo, SIGNAL(gotStartupChange(KStartupInfoId,KStartupInfoData)), SLOT(gotStartupChange(KStartupInfoId,KStartupInfoData))); - 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); -} - -StartupFeedbackEffect::~StartupFeedbackEffect() -{ - if (m_active) { - effects->stopMousePolling(); - } - for (int i = 0; i < 5; ++i) { - delete m_bouncingTextures[i]; - } - delete m_texture; - delete m_blinkingShader; -} - -bool StartupFeedbackEffect::supported() -{ - return effects->isOpenGLCompositing(); -} - -void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags) -{ - Q_UNUSED(flags) - KConfig conf("klaunchrc", KConfig::NoGlobals); - KConfigGroup c = conf.group("FeedbackStyle"); - const bool busyCursor = c.readEntry("BusyCursor", true); - - c = conf.group("BusyCursorSettings"); - m_startupInfo->setTimeout(c.readEntry("Timeout", 30)); - const bool busyBlinking = c.readEntry("Blinking", false); - const bool busyBouncing = c.readEntry("Bouncing", true); - if (!busyCursor) - m_type = NoFeedback; - else if (busyBouncing) - m_type = BouncingFeedback; - else if (busyBlinking) { - m_type = BlinkingFeedback; - if (effects->compositingType() == OpenGL2Compositing) { - delete m_blinkingShader; - m_blinkingShader = 0; - const QString shader = KGlobal::dirs()->findResource("data", "kwin/blinking-startup-fragment.glsl"); - m_blinkingShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, shader); - if (m_blinkingShader->isValid()) { - kDebug(1212) << "Blinking Shader is valid"; - } else { - kDebug(1212) << "Blinking Shader is not valid"; - } - } - } else - m_type = PassiveFeedback; - if (m_active) { - stop(); - start(m_startups[ m_currentStartup ]); - } -} - -void StartupFeedbackEffect::prePaintScreen(ScreenPrePaintData& data, int time) -{ - if (m_active) { - // need the unclipped version - switch(m_type) { - case BouncingFeedback: - m_progress = (m_progress + time) % BOUNCE_DURATION; - m_frame = qRound((qreal)m_progress / (qreal)BOUNCE_FRAME_DURATION) % BOUNCE_FRAMES; - m_currentGeometry = feedbackRect(); // bounce alters geometry with m_frame - data.paint.unite(m_currentGeometry); - break; - case BlinkingFeedback: - m_progress = (m_progress + time) % BLINKING_DURATION; - m_frame = qRound((qreal)m_progress / (qreal)BLINKING_FRAME_DURATION) % BLINKING_FRAMES; - break; - default: - break; // nothing - } - } - effects->prePaintScreen(data, time); -} - -void StartupFeedbackEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) -{ - effects->paintScreen(mask, region, data); - if (m_active) { - GLTexture* texture; - switch(m_type) { - case BouncingFeedback: - texture = m_bouncingTextures[ FRAME_TO_BOUNCE_TEXTURE[ m_frame ]]; - break; - case BlinkingFeedback: // fall through - case PassiveFeedback: - texture = m_texture; - break; - default: - return; // safety - } - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - texture->bind(); - bool useShader = false; - if (m_type == BlinkingFeedback) { - const QColor& blinkingColor = BLINKING_COLORS[ FRAME_TO_BLINKING_COLOR[ m_frame ]]; - if (m_blinkingShader && m_blinkingShader->isValid()) { - useShader = true; - ShaderManager::instance()->pushShader(m_blinkingShader); - m_blinkingShader->setUniform("u_color", blinkingColor); - } else { -#ifdef KWIN_HAVE_OPENGL_1 - // texture transformation - float color[4] = { static_cast<float>(blinkingColor.redF()), static_cast<float>(blinkingColor.greenF()), - static_cast<float>(blinkingColor.blueF()), 1.0f }; - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glColor4fv(color); - glActiveTexture(GL_TEXTURE1); - texture->bind(); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_CONSTANT); - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color); - glActiveTexture(GL_TEXTURE0); - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, color); -#endif - } - } else if (effects->compositingType() == OpenGL2Compositing) { - useShader = true; - ShaderManager::instance()->pushShader(ShaderManager::SimpleShader); - } - texture->render(m_currentGeometry, m_currentGeometry); - if (useShader) { - ShaderManager::instance()->popShader(); - } - if (m_type == BlinkingFeedback && !useShader) { -#ifdef KWIN_HAVE_OPENGL_1 - // resture states - glActiveTexture(GL_TEXTURE1); - texture->unbind(); - glActiveTexture(GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glColor4f(0.0f, 0.0f, 0.0f, 0.0f); -#endif - } - texture->unbind(); - glDisable(GL_BLEND); - } -} - -void StartupFeedbackEffect::postPaintScreen() -{ - if (m_active) { - m_dirtyRect = m_currentGeometry; // ensure the now dirty region is cleaned on the next pass - if (m_type == BlinkingFeedback || m_type == BouncingFeedback) - effects->addRepaint(m_dirtyRect); // we also have to trigger a repaint - } - effects->postPaintScreen(); -} - -void StartupFeedbackEffect::slotMouseChanged(const QPoint& pos, const QPoint& oldpos, Qt::MouseButtons buttons, - Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers) -{ - Q_UNUSED(pos) - Q_UNUSED(oldpos) - Q_UNUSED(buttons) - Q_UNUSED(oldbuttons) - Q_UNUSED(modifiers) - Q_UNUSED(oldmodifiers) - if (m_active) { - m_dirtyRect |= m_currentGeometry; - m_currentGeometry = feedbackRect(); - m_dirtyRect |= m_currentGeometry; - effects->addRepaint(m_dirtyRect); - } -} - -void StartupFeedbackEffect::gotNewStartup(const KStartupInfoId& id, const KStartupInfoData& data) -{ - const QString& icon = data.findIcon(); - m_currentStartup = id; - m_startups[ id ] = icon; - start(icon); -} - -void StartupFeedbackEffect::gotRemoveStartup(const KStartupInfoId& id, const KStartupInfoData& data) -{ - Q_UNUSED( data ) - m_startups.remove(id); - if (m_startups.count() == 0) { - m_currentStartup = KStartupInfoId(); // null - stop(); - return; - } - m_currentStartup = m_startups.begin().key(); - start(m_startups[ m_currentStartup ]); -} - -void StartupFeedbackEffect::gotStartupChange(const KStartupInfoId& id, const KStartupInfoData& data) -{ - if (m_currentStartup == id) { - const QString& icon = data.findIcon(); - if (!icon.isEmpty() && icon != m_startups[ m_currentStartup ]) { - m_startups[ id ] = icon; - start(icon); - } - } -} - -void StartupFeedbackEffect::start(const QString& icon) -{ - if (m_type == NoFeedback) - return; - if (!m_active) - effects->startMousePolling(); - m_active = true; - // get ratio for bouncing cursor so we don't need to manually calculate the sizes for each icon size - if (m_type == BouncingFeedback) - m_bounceSizesRatio = IconSize(KIconLoader::Small) / 16.0; - QPixmap iconPixmap = KIconLoader::global()->loadIcon(icon, KIconLoader::Small, 0, - KIconLoader::DefaultState, QStringList(), 0, true); // return null pixmap if not found - if (iconPixmap.isNull()) - iconPixmap = SmallIcon("system-run"); - prepareTextures(iconPixmap); - m_dirtyRect = m_currentGeometry = feedbackRect(); - effects->addRepaint(m_dirtyRect); -} - -void StartupFeedbackEffect::stop() -{ - if (m_active) - effects->stopMousePolling(); - m_active = false; - switch(m_type) { - case BouncingFeedback: - for (int i = 0; i < 5; ++i) { - delete m_bouncingTextures[i]; - m_bouncingTextures[i] = 0; - } - break; - case BlinkingFeedback: - case PassiveFeedback: - delete m_texture; - m_texture = 0; - break; - case NoFeedback: - return; // don't want the full repaint - default: - break; // impossible - } - effects->addRepaintFull(); -} - -void StartupFeedbackEffect::prepareTextures(const QPixmap& pix) -{ - switch(m_type) { - case BouncingFeedback: - for (int i = 0; i < 5; ++i) { - delete m_bouncingTextures[i]; - m_bouncingTextures[i] = new GLTexture(scalePixmap(pix, BOUNCE_SIZES[i])); - } - break; - case BlinkingFeedback: - case PassiveFeedback: - m_texture = new GLTexture(pix); - break; - default: - // for safety - m_active = false; - break; - } -} - -QImage StartupFeedbackEffect::scalePixmap(const QPixmap& pm, const QSize& size) const -{ - const QSize& adjustedSize = size * m_bounceSizesRatio; - QImage scaled = pm.toImage().scaled(adjustedSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - if (scaled.format() != QImage::Format_ARGB32_Premultiplied && scaled.format() != QImage::Format_ARGB32) - scaled = scaled.convertToFormat(QImage::Format_ARGB32); - - QImage result(20 * m_bounceSizesRatio, 20 * m_bounceSizesRatio, QImage::Format_ARGB32); - QPainter p(&result); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(result.rect(), Qt::transparent); - p.drawImage((20 * m_bounceSizesRatio - adjustedSize.width()) / 2, (20*m_bounceSizesRatio - adjustedSize.height()) / 2, scaled, 0, 0, adjustedSize.width(), adjustedSize.height() * m_bounceSizesRatio); - return result; -} - -QRect StartupFeedbackEffect::feedbackRect() const -{ - int cursorSize = 0; - cursorSize = XcursorGetDefaultSize(QX11Info::display()); - int xDiff; - if (cursorSize <= 16) - xDiff = 8 + 7; - else if (cursorSize <= 32) - xDiff = 16 + 7; - else if (cursorSize <= 48) - xDiff = 24 + 7; - else - xDiff = 32 + 7; - int yDiff = xDiff; - GLTexture* texture = 0; - int yOffset = 0; - switch(m_type) { - case BouncingFeedback: - texture = m_bouncingTextures[ FRAME_TO_BOUNCE_TEXTURE[ m_frame ]]; - yOffset = FRAME_TO_BOUNCE_YOFFSET[ m_frame ] * m_bounceSizesRatio; - break; - case BlinkingFeedback: // fall through - case PassiveFeedback: - texture = m_texture; - break; - default: - // nothing - break; - } - const QPoint cursorPos = effects->cursorPos() + QPoint(xDiff, yDiff + yOffset); - QRect rect; - if( texture ) - rect = QRect(cursorPos, texture->size()); - return rect; -} - -bool StartupFeedbackEffect::isActive() const -{ - return m_active; -} - -} // namespace diff --git a/kwin/effects/startupfeedback/startupfeedback.desktop b/kwin/effects/startupfeedback/startupfeedback.desktop deleted file mode 100644 index 0f033390..00000000 --- a/kwin/effects/startupfeedback/startupfeedback.desktop +++ /dev/null @@ -1,121 +0,0 @@ -[Desktop Entry] -Name=Startup Feedback -Name[ast]=Notificación d'aniciu -Name[bg]=Видимо стартиране -Name[bs]=Odziv pri pokretanju -Name[ca]=Reacció en iniciar -Name[ca@valencia]=Reacció en iniciar -Name[cs]=Odezva při spouštění -Name[da]=Opstartsfeedback -Name[de]=Programmstartanzeige -Name[el]=Ειδοποίηση εκκίνησης -Name[en_GB]=Startup Feedback -Name[es]=Notificación de inicio -Name[et]=Käivitamise tagasiside -Name[eu]=Abioko oharra -Name[fi]=Käynnistyspalaute -Name[ga]=Aiseolas Tosaithe -Name[gl]=Notificación de lanzamento -Name[he]=משוב להפעלה -Name[hi]=शुरुआती फ़ीडबैक -Name[hr]=Povratna informacija pri pokretanju -Name[hu]=Alkalmazásindítási effektus -Name[ia]=Retorno ab lanceamento -Name[is]=Upplýsingar um ræsingu -Name[kk]=Жегу барысы -Name[km]=មតិ​យោបល់​ពេល​ចាប់ផ្ដើម -Name[ko]=실행 피드백 -Name[lt]=Paleidimo atsakas -Name[lv]=Startēšanās atbilde -Name[mr]=सुरुवात प्रतिसाद -Name[nb]=Oppstartsmelding -Name[nds]=Startmellen -Name[nl]=Terugkoppeling van opstarten -Name[pa]=ਸ਼ੁਰੂਆਤੀ ਫੀਡਬੈਕ -Name[pl]=Odczucia przy starcie -Name[pt]=Reacção ao Arranque -Name[pt_BR]=Críticas e sugestões da inicialização -Name[ro]=Indicator de pornire -Name[ru]=Отклик запуска приложений -Name[sk]=Odozva pri spustení -Name[sl]=Odziv zagona -Name[sr]=Одзив при покретању -Name[sr@ijekavian]=Одзив при покретању -Name[sr@ijekavianlatin]=Odziv pri pokretanju -Name[sr@latin]=Odziv pri pokretanju -Name[sv]=Gensvar vid programstart -Name[th]=ตอบสนองการเริ่มโปรแกรม -Name[tr]=Açılış Geribildirimi -Name[ug]=قوزغىلىش قايتما ئىنكاسى -Name[uk]=Повідомлення під час запуску -Name[wa]=Ritoû d' enondaedje -Name[x-test]=xxStartup Feedbackxx -Name[zh_CN]=启动反馈 -Name[zh_TW]=程式啟動回饋 -Comment=Helper effect for startup feedback -Comment[ast]=Efeutu de notificación d'aniciu -Comment[bg]=Ефект при стартиране на приложение -Comment[bs]=Pomoćni efekat za odziv pri pokretanju -Comment[ca]=Efecte auxiliar de reacció en iniciar -Comment[ca@valencia]=Efecte auxiliar de reacció en iniciar -Comment[cs]=Pomocný efekt pro Odezvu při spouštění -Comment[da]=Hjælpeeffekt til opstartsfeedback -Comment[de]=Hilfseffekt für Programmstartanzeige. -Comment[el]=Εφέ ειδοποίησης εκκίνησης -Comment[en_GB]=Helper effect for startup feedback -Comment[es]=Efecto auxiliar de notificación de inicio -Comment[et]=Käivitamise tagasiside abiefekt -Comment[eu]=Abioko oharraren laguntza-efektua -Comment[fi]=Avustustehoste käynnistyspalautteelle -Comment[gl]=Efecto auxiliar para notificar o lanzamento de programas -Comment[he]=אפקט המשמש כמשוב להפעלה -Comment[hr]=Pomoćni efekt za povratnu informaciju pri pokretanju -Comment[hu]=Segédeffektus alkalmazásindításhoz -Comment[ia]=Effecto de adjutante pro retorno ab lanceamento -Comment[is]=Hjálpar til við birtingu pplýsinga um ræsingu -Comment[kk]=Жегу барысын көрсететін эффекті -Comment[km]=កម្មវិធី​ជំនួយ​មាន​ប្រសិទ្ធភាព​នៅពេល​លចាប់ផ្ដើម​មតិត្រឡប់ -Comment[ko]=실행 피드백 효과 -Comment[lt]=Paleidimo atsako pagalbininko efektas -Comment[lv]=Palīgefekts startēšanās atbildei -Comment[mr]=सुरुवात प्रतिसादा करिता मदत परिणाम -Comment[nb]=Hjelpereffekt for oppstartsvisning -Comment[nds]=Hölpsche Startmellen -Comment[nl]=Effect van hulp bij terugkoppeling van opstarten -Comment[pa]=ਸ਼ੁਰੂਆਤੀ ਫੀਡਬੈਕ ਉੱਤੇ ਸਹਾਇਕ ਪਰਭਾਵ -Comment[pl]=Efekt pomocniczy dla odczuć przy starcie -Comment[pt]=Efeito auxiliar de reacção ao arranque -Comment[pt_BR]=Assistente de efeito sugestões e críticas da inicialização -Comment[ro]=Efect ajutător pentru indicarea lansării -Comment[ru]=Вспомогательный эффект для отклика запуска приложений -Comment[sk]=Pomocný efekt pre odozvu pri spustení -Comment[sl]=Pomožni učinek za odziv zagona -Comment[sr]=Помоћни ефекат за одзив при покретању -Comment[sr@ijekavian]=Помоћни ефекат за одзив при покретању -Comment[sr@ijekavianlatin]=Pomoćni efekat za odziv pri pokretanju -Comment[sr@latin]=Pomoćni efekat za odziv pri pokretanju -Comment[sv]=Hjälpeffekt för gensvar vid programstart -Comment[th]=ลูกเล่นที่จะแสดงเพื่อรอการเริ่มการทำงานของโปรแกรม -Comment[tr]=Açılış geribildirimi için yardımcı etkisi -Comment[ug]=قوزغىلىش قايتما ئىنكاسىنىڭ ياردەمچى ئۈنۈمى -Comment[uk]=Допоміжний ефект перегляду повідомлень, що надсилаються програмою під час запуску -Comment[vi]=Hiệu ứng trợ giúp cho phản hồi lúc chạy chương trình -Comment[wa]=Efet aidant pol ritoû d' enondaedje -Comment[x-test]=xxHelper effect for startup feedbackxx -Comment[zh_CN]=启动反馈的帮助效果 -Comment[zh_TW]=啟動回饋效果 -Icon=preferences-system-windows-effect-startupfeedback - -Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=kwin4_effect_startupfeedback -X-KDE-PluginInfo-Category=Candy -X-KDE-PluginInfo-Version=0.0.1 -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=90 -X-KWin-Requires-OpenGL=true diff --git a/kwin/effects/startupfeedback/startupfeedback.h b/kwin/effects/startupfeedback/startupfeedback.h deleted file mode 100644 index 878f7853..00000000 --- a/kwin/effects/startupfeedback/startupfeedback.h +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2010 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_STARTUPFEEDBACK_H -#define KWIN_STARTUPFEEDBACK_H -#include <QObject> -#include <kwineffects.h> -#include <KStartupInfo> - -class KSelectionOwner; -namespace KWin -{ -class GLTexture; - -class StartupFeedbackEffect - : public Effect -{ - Q_OBJECT -public: - StartupFeedbackEffect(); - virtual ~StartupFeedbackEffect(); - - virtual void reconfigure(ReconfigureFlags flags); - virtual void prePaintScreen(ScreenPrePaintData& data, int time); - virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data); - virtual void postPaintScreen(); - virtual bool isActive() const; - - static bool supported(); - -private Q_SLOTS: - void gotNewStartup(const KStartupInfoId& id, const KStartupInfoData& data); - void gotRemoveStartup(const KStartupInfoId& id, const KStartupInfoData& data); - void gotStartupChange(const KStartupInfoId& id, const KStartupInfoData& data); - void slotMouseChanged(const QPoint& pos, const QPoint& oldpos, Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers); - -private: - enum FeedbackType { - NoFeedback, - BouncingFeedback, - BlinkingFeedback, - PassiveFeedback - }; - void start(const QString& icon); - void stop(); - QImage scalePixmap(const QPixmap& pm, const QSize& size) const; - void prepareTextures(const QPixmap& pix); - QRect feedbackRect() const; - - qreal m_bounceSizesRatio; - KStartupInfo* m_startupInfo; - KSelectionOwner* m_selection; - KStartupInfoId m_currentStartup; - QMap< KStartupInfoId, QString > m_startups; // QString == pixmap - bool m_active; - int m_frame; - int m_progress; - GLTexture* m_bouncingTextures[5]; - GLTexture* m_texture; // for passive and blinking - FeedbackType m_type; - QRect m_currentGeometry, m_dirtyRect; - GLShader *m_blinkingShader; -}; -} // namespace - -#endif diff --git a/kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp b/kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp index 7319a936..e85b2ffa 100644 --- a/kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -23,8 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <kdebug.h> -#include <kwinglutils.h> - // This effect shows a preview inside a window that has a special property set // on it that says which window and where to render. It is used by the taskbar // to show window previews in tooltips. @@ -69,7 +67,6 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi mask |= PAINT_WINDOW_OPAQUE; else mask |= PAINT_WINDOW_TRANSLUCENT; - mask |= PAINT_WINDOW_LANCZOS; foreach (const Data & thumb, thumbnails.values(w)) { EffectWindow* thumbw = effects->findWindow(thumb.window); if (thumbw == NULL) @@ -80,11 +77,6 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi thumbRect.translate(w->pos() + QPoint(data.xTranslation(), data.yTranslation())); thumbRect.setSize(QSize(thumbRect.width() * data.xScale(), thumbRect.height() * data.yScale())); // QSize has no vector multiplicator... :-( - if (effects->isOpenGLCompositing()) { - if (data.shader) { - thumbData.shader = data.shader; - } - } // if ( effects->compositingType() == KWin::OpenGLCompositing ) setPositionTransformations(thumbData, r, thumbw, thumbRect, Qt::KeepAspectRatio); effects->drawWindow(thumbw, mask, r, thumbData); } diff --git a/kwin/effects/thumbnailaside/thumbnailaside.cpp b/kwin/effects/thumbnailaside/thumbnailaside.cpp index 99612cad..85f66e27 100644 --- a/kwin/effects/thumbnailaside/thumbnailaside.cpp +++ b/kwin/effects/thumbnailaside/thumbnailaside.cpp @@ -66,7 +66,7 @@ void ThumbnailAsideEffect::paintScreen(int mask, QRegion region, ScreenPaintData data.multiplyOpacity(opacity); QRect region; setPositionTransformations(data, region, d.window, d.rect, Qt::KeepAspectRatio); - effects->drawWindow(d.window, PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS, + effects->drawWindow(d.window, PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED, region, data); } } diff --git a/kwin/effects/trackmouse/trackmouse.cpp b/kwin/effects/trackmouse/trackmouse.cpp index c7403373..f3de2dee 100644 --- a/kwin/effects/trackmouse/trackmouse.cpp +++ b/kwin/effects/trackmouse/trackmouse.cpp @@ -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/>. *********************************************************************/ +#include <config-kwin.h> + #include "trackmouse.h" // KConfigSkeleton @@ -27,13 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <QtCore/qdatetime.h> #include <QMatrix4x4> -#include <kwinconfig.h> -#include <kwinglutils.h> #include <kwinxrenderutils.h> #include <kglobal.h> #include <kstandarddirs.h> - #include <kaction.h> #include <kactioncollection.h> #include <KLocalizedString> @@ -51,14 +50,11 @@ TrackMouseEffect::TrackMouseEffect() : m_active(false) , m_angle(0) { - m_texture[0] = m_texture[1] = 0; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE m_picture[0] = m_picture[1] = 0; if ( effects->compositingType() == XRenderCompositing) m_angleBase = 1.57079632679489661923; // Pi/2 #endif - if ( effects->isOpenGLCompositing()) - m_angleBase = 90.0; m_mousePolling = false; KActionCollection *actionCollection = new KActionCollection(this); m_action = static_cast< KAction* >(actionCollection->addAction("TrackMouse")); @@ -76,8 +72,7 @@ TrackMouseEffect::~TrackMouseEffect() if (m_mousePolling) effects->stopMousePolling(); for (int i = 0; i < 2; ++i) { - delete m_texture[i]; m_texture[i] = 0; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE delete m_picture[i]; m_picture[i] = 0; #endif } @@ -124,41 +119,7 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da if (!m_active) return; - if ( effects->isOpenGLCompositing() && m_texture[0] && m_texture[1]) { - ShaderBinder binder(ShaderManager::GenericShader); - GLShader *shader(binder.shader()); - QMatrix4x4 modelview; - if (shader) { - modelview = shader->getUniformMatrix4x4("modelview"); - } - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - QMatrix4x4 matrix(modelview); - const QPointF p = m_lastRect[0].topLeft() + QPoint(m_lastRect[0].width()/2.0, m_lastRect[0].height()/2.0); - const float x = p.x()*data.xScale() + data.xTranslation(); - const float y = p.y()*data.yScale() + data.yTranslation(); - for (int i = 0; i < 2; ++i) { - matrix.translate(x, y, 0.0); - matrix.rotate(i ? -2*m_angle : m_angle, 0, 0, 1.0); - matrix.translate(-x, -y, 0.0); - if (shader) { - shader->setUniform(GLShader::ModelViewMatrix, matrix); - shader->setUniform(GLShader::Saturation, 1.0); - shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); - } else - pushMatrix(matrix); - m_texture[i]->bind(); - m_texture[i]->render(region, m_lastRect[i]); - m_texture[i]->unbind(); - if (!shader) - popMatrix(); - } - glDisable(GL_BLEND); - if (shader) { - shader->setUniform(GLShader::ModelViewMatrix, modelview); - } - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if ( effects->compositingType() == XRenderCompositing && m_picture[0] && m_picture[1]) { float sine = sin(m_angle); const float cosine = cos(m_angle); @@ -197,18 +158,15 @@ void TrackMouseEffect::postPaintScreen() bool TrackMouseEffect::init() { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (!(m_texture[0] || m_picture[0])) { +#ifdef KWIN_BUILD_COMPOSITE + if (!m_picture[0]) { loadTexture(); - if (!(m_texture[0] || m_picture[0])) + if (!m_picture[0]) return false; } #else - if (!m_texture[0]) { - loadTexture(); - if (!m_texture[0]) - return false; - } + loadTexture(); + return false; #endif m_lastRect[0].moveCenter(cursorPos()); m_lastRect[1].moveCenter(cursorPos()); @@ -255,12 +213,7 @@ void TrackMouseEffect::loadTexture() return; for (int i = 0; i < 2; ++i) { - if ( effects->isOpenGLCompositing()) { - QImage img(f[i]); - m_texture[i] = new GLTexture(img); - m_lastRect[i].setSize(img.size()); - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if ( effects->compositingType() == XRenderCompositing) { QPixmap pixmap(f[i]); m_picture[i] = new XRenderPicture(pixmap); diff --git a/kwin/effects/trackmouse/trackmouse.h b/kwin/effects/trackmouse/trackmouse.h index cb767adc..d669fd50 100644 --- a/kwin/effects/trackmouse/trackmouse.h +++ b/kwin/effects/trackmouse/trackmouse.h @@ -28,7 +28,6 @@ class KAction; namespace KWin { -class GLTexture; class TrackMouseEffect : public Effect @@ -64,8 +63,7 @@ private: bool m_active, m_mousePolling; float m_angle; float m_angleBase; - GLTexture* m_texture[2]; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE QSize m_size[2]; XRenderPicture *m_picture[2]; #endif diff --git a/kwin/effects/windowgeometry/windowgeometry.cpp b/kwin/effects/windowgeometry/windowgeometry.cpp index 5e848b2f..922edf36 100644 --- a/kwin/effects/windowgeometry/windowgeometry.cpp +++ b/kwin/effects/windowgeometry/windowgeometry.cpp @@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "windowgeometryconfig.h" #include <QStringBuilder> -#include <kwinconfig.h> #include <kconfiggroup.h> #include <kwindowsystem.h> #include <KActionCollection> diff --git a/kwin/effects/wobblywindows/CMakeLists.txt b/kwin/effects/wobblywindows/CMakeLists.txt deleted file mode 100644 index a736bdab..00000000 --- a/kwin/effects/wobblywindows/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -####################################### -# Effect - -# Source files -set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} - wobblywindows/wobblywindows.cpp - ) - -kde4_add_kcfg_files(kwin4_effect_builtins_sources wobblywindows/wobblywindowsconfig.kcfgc) - -# .desktop files -install( FILES - wobblywindows/wobblywindows.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) - -####################################### -# Config - -# Source files -set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources} - wobblywindows/wobblywindows_config.cpp - wobblywindows/wobblywindows_config.ui - ) - -kde4_add_kcfg_files(kwin4_effect_builtins_config_sources wobblywindows/wobblywindowsconfig.kcfgc) - -# .desktop files -install( FILES - wobblywindows/wobblywindows_config.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) diff --git a/kwin/effects/wobblywindows/wobblywindows.cpp b/kwin/effects/wobblywindows/wobblywindows.cpp deleted file mode 100644 index ad1842cd..00000000 --- a/kwin/effects/wobblywindows/wobblywindows.cpp +++ /dev/null @@ -1,1213 +0,0 @@ -/***************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com> - -You can Freely distribute this program under the GNU General Public -License. See the file "COPYING" for the exact licensing terms. -******************************************************************/ - - -#include "wobblywindows.h" -#include "wobblywindowsconfig.h" - -#include <kdebug.h> -#include <math.h> - -#define USE_ASSERT -#ifdef USE_ASSERT -#define ASSERT1 assert -#else -#define ASSERT1 -#endif - -//#define COMPUTE_STATS - -// if you enable it and run kwin in a terminal from the session it manages, -// be sure to redirect the output of kwin in a file or -// you'll propably get deadlocks. -//#define VERBOSE_MODE - -#if defined COMPUTE_STATS && !defined VERBOSE_MODE -# ifdef __GNUC__ -# warning "You enable COMPUTE_STATS without VERBOSE_MODE, computed stats will not be printed." -# endif -#endif - -namespace KWin -{ - -struct ParameterSet { - qreal stiffness; - qreal drag; - qreal move_factor; - - qreal xTesselation; - qreal yTesselation; - - qreal minVelocity; - qreal maxVelocity; - qreal stopVelocity; - qreal minAcceleration; - qreal maxAcceleration; - qreal stopAcceleration; - - bool moveEffectEnabled; - bool openEffectEnabled; - bool closeEffectEnabled; -}; - -static const ParameterSet set_0 = { - 0.15, - 0.80, - 0.10, - 20.0, - 20.0, - 0.0, - 1000.0, - 0.5, - 0.0, - 1000.0, - 0.5, - true, - false, - false -}; - -static const ParameterSet set_1 = { - 0.10, - 0.85, - 0.10, - 20.0, - 20.0, - 0.0, - 1000.0, - 0.5, - 0.0, - 1000.0, - 0.5, - true, - false, - false -}; - -static const ParameterSet set_2 = { - 0.06, - 0.90, - 0.10, - 20.0, - 20.0, - 0.0, - 1000.0, - 0.5, - 0.0, - 1000.0, - 0.5, - true, - false, - false -}; - -static const ParameterSet set_3 = { - 0.03, - 0.92, - 0.20, - 20.0, - 20.0, - 0.0, - 1000.0, - 0.5, - 0.0, - 1000.0, - 0.5, - true, - false, - false -}; - -static const ParameterSet set_4 = { - 0.01, - 0.97, - 0.25, - 20.0, - 20.0, - 0.0, - 1000.0, - 0.5, - 0.0, - 1000.0, - 0.5, - true, - false, - false -}; - -static const ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 }; - -KWIN_EFFECT(wobblywindows, WobblyWindowsEffect) -KWIN_EFFECT_SUPPORTED(wobblywindows, WobblyWindowsEffect::supported()) - -WobblyWindowsEffect::WobblyWindowsEffect() -{ - 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(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*))); - connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect))); - connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*))); - connect(effects, SIGNAL(windowMaximizedStateChanged(KWin::EffectWindow*,bool,bool)), this, SLOT(slotWindowMaximizeStateChanged(KWin::EffectWindow*,bool,bool))); -} - -WobblyWindowsEffect::~WobblyWindowsEffect() -{ - if (!windows.empty()) { - // we should be empty at this point... - // emit a warning and clean the list. - kDebug(1212) << "Windows list not empty. Left items : " << windows.count(); - QHash< const EffectWindow*, WindowWobblyInfos >::iterator i; - for (i = windows.begin(); i != windows.end(); ++i) { - freeWobblyInfo(i.value()); - } - } -} - -void WobblyWindowsEffect::reconfigure(ReconfigureFlags) -{ - WobblyWindowsConfig::self()->readConfig(); - - QString settingsMode = WobblyWindowsConfig::settings(); - if (settingsMode != "Custom") { - unsigned int wobblynessLevel = WobblyWindowsConfig::wobblynessLevel(); - if (wobblynessLevel > 4) { - kDebug(1212) << "Wrong value for \"WobblynessLevel\" : " << wobblynessLevel; - wobblynessLevel = 4; - } - setParameterSet(pset[wobblynessLevel]); - - if (WobblyWindowsConfig::advancedMode()) { - m_stiffness = WobblyWindowsConfig::stiffness() / 100.0; - m_drag = WobblyWindowsConfig::drag() / 100.0; - m_move_factor = WobblyWindowsConfig::moveFactor() / 100.0; - } - } else { // Custom method, read all values from config file. - m_stiffness = WobblyWindowsConfig::stiffness() / 100.0; - m_drag = WobblyWindowsConfig::drag() / 100.0; - m_move_factor = WobblyWindowsConfig::moveFactor() / 100.0; - - m_xTesselation = WobblyWindowsConfig::xTesselation(); - m_yTesselation = WobblyWindowsConfig::yTesselation(); - - m_minVelocity = WobblyWindowsConfig::minVelocity(); - m_maxVelocity = WobblyWindowsConfig::maxVelocity(); - m_stopVelocity = WobblyWindowsConfig::stopVelocity(); - m_minAcceleration = WobblyWindowsConfig::minAcceleration(); - m_maxAcceleration = WobblyWindowsConfig::maxAcceleration(); - m_stopAcceleration = WobblyWindowsConfig::stopAcceleration(); - - m_moveEffectEnabled = WobblyWindowsConfig::moveEffect(); - m_openEffectEnabled = WobblyWindowsConfig::openEffect(); - // disable close effect by default for now as it doesn't do what I want. - m_closeEffectEnabled = WobblyWindowsConfig::closeEffect(); - } - - m_moveWobble = WobblyWindowsConfig::moveWobble(); - m_resizeWobble = WobblyWindowsConfig::resizeWobble(); - -#if defined VERBOSE_MODE - kDebug(1212) << "Parameters :\n" << - "move : " << m_moveEffectEnabled << ", open : " << m_openEffectEnabled << ", close : " << m_closeEffectEnabled << "\n" - "grid(" << m_stiffness << ", " << m_drag << ", " << m_move_factor << ")\n" << - "velocity(" << m_minVelocity << ", " << m_maxVelocity << ", " << m_stopVelocity << ")\n" << - "acceleration(" << m_minAcceleration << ", " << m_maxAcceleration << ", " << m_stopAcceleration << ")\n" << - "tesselation(" << m_xTesselation << ", " << m_yTesselation << ")"; -#endif -} - -bool WobblyWindowsEffect::supported() -{ - return effects->isOpenGLCompositing(); -} - -void WobblyWindowsEffect::setParameterSet(const ParameterSet& pset) -{ - m_stiffness = pset.stiffness; - m_drag = pset.drag; - m_move_factor = pset.move_factor; - - m_xTesselation = pset.xTesselation; - m_yTesselation = pset.yTesselation; - - m_minVelocity = pset.minVelocity; - m_maxVelocity = pset.maxVelocity; - m_stopVelocity = pset.stopVelocity; - m_minAcceleration = pset.minAcceleration; - m_maxAcceleration = pset.maxAcceleration; - m_stopAcceleration = pset.stopAcceleration; - - m_moveEffectEnabled = pset.moveEffectEnabled; - m_openEffectEnabled = pset.openEffectEnabled; - m_closeEffectEnabled = pset.closeEffectEnabled; -} - -void WobblyWindowsEffect::setVelocityThreshold(qreal m_minVelocity) -{ - this->m_minVelocity = m_minVelocity; -} - -void WobblyWindowsEffect::setMoveFactor(qreal factor) -{ - m_move_factor = factor; -} - -void WobblyWindowsEffect::setStiffness(qreal stiffness) -{ - m_stiffness = stiffness; -} - -void WobblyWindowsEffect::setDrag(qreal drag) -{ - m_drag = drag; -} - -void WobblyWindowsEffect::prePaintScreen(ScreenPrePaintData& data, int time) -{ - // We need to mark the screen windows as transformed. Otherwise the whole - // screen won't be repainted, resulting in artefacts. - // Could we just set a subset of the screen to be repainted ? - if (windows.count() != 0) { - m_updateRegion = QRegion(); - } - - effects->prePaintScreen(data, time); -} -const qreal maxTime = 10.0; -void WobblyWindowsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) -{ - if (windows.contains(w)) { - data.setTransformed(); - data.quads = data.quads.makeRegularGrid(m_xTesselation, m_yTesselation); - bool stop = false; - qreal updateTime = time; - - while (!stop && (updateTime > maxTime)) { -#if defined VERBOSE_MODE - kDebug(1212) << "loop time " << updateTime << " / " << time; -#endif - stop = !updateWindowWobblyDatas(w, maxTime); - updateTime -= maxTime; - } - if (!stop && updateTime > 0) { - updateWindowWobblyDatas(w, updateTime); - } - } - - effects->prePaintWindow(w, data, time); -} - -void WobblyWindowsEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - if (windows.contains(w)) { - WindowWobblyInfos& wwi = windows[w]; - int tx = w->geometry().x(); - int ty = w->geometry().y(); - double left = 0.0; - double top = 0.0; - double right = w->width(); - double bottom = w->height(); - for (int i = 0; i < data.quads.count(); ++i) { - for (int j = 0; j < 4; ++j) { - WindowVertex& v = data.quads[i][j]; - Pair oldPos = {tx + v.x(), ty + v.y()}; - Pair newPos = computeBezierPoint(wwi, oldPos); - v.move(newPos.x - tx, newPos.y - ty); - } - left = qMin(left, data.quads[i].left()); - top = qMin(top, data.quads[i].top()); - right = qMax(right, data.quads[i].right()); - bottom = qMax(bottom, data.quads[i].bottom()); - } - m_updateRegion = m_updateRegion.united(QRect(w->x() + left, w->y() + top, - right - left + 2, bottom - top + 2)); - } - - // Call the next effect. - effects->paintWindow(w, mask, region, data); -} - -void WobblyWindowsEffect::postPaintScreen() -{ - if (!windows.isEmpty()) { - effects->addRepaint(m_updateRegion); - } - - // Call the next effect. - effects->postPaintScreen(); -} - -void WobblyWindowsEffect::slotWindowStartUserMovedResized(EffectWindow *w) -{ - if (!m_moveEffectEnabled || w->isSpecialWindow()) - return; - - if ((w->isUserMove() && m_moveWobble) || (w->isUserResize() && m_resizeWobble)) { - startMovedResized(w); - } -} - -void WobblyWindowsEffect::slotWindowStepUserMovedResized(EffectWindow *w, const QRect &geometry) -{ - Q_UNUSED(geometry) - if (windows.contains(w)) { - WindowWobblyInfos& wwi = windows[w]; - QRect rect = w->geometry(); - if (rect.y() != wwi.resize_original_rect.y()) wwi.can_wobble_top = true; - if (rect.x() != wwi.resize_original_rect.x()) wwi.can_wobble_left = true; - if (rect.right() != wwi.resize_original_rect.right()) wwi.can_wobble_right = true; - if (rect.bottom() != wwi.resize_original_rect.bottom()) wwi.can_wobble_bottom = true; - } -} - -void WobblyWindowsEffect::slotWindowFinishUserMovedResized(EffectWindow *w) -{ - if (windows.contains(w)) { - WindowWobblyInfos& wwi = windows[w]; - wwi.status = Free; - QRect rect = w->geometry(); - if (rect.y() != wwi.resize_original_rect.y()) wwi.can_wobble_top = true; - if (rect.x() != wwi.resize_original_rect.x()) wwi.can_wobble_left = true; - if (rect.right() != wwi.resize_original_rect.right()) wwi.can_wobble_right = true; - if (rect.bottom() != wwi.resize_original_rect.bottom()) wwi.can_wobble_bottom = true; - } -} - -void WobblyWindowsEffect::slotWindowMaximizeStateChanged(EffectWindow *w, bool horizontal, bool vertical) -{ - Q_UNUSED(horizontal) - Q_UNUSED(vertical) - if (w->isUserMove() || !m_moveEffectEnabled || w->isSpecialWindow()) - return; - - if (m_moveWobble && m_resizeWobble) { - stepMovedResized(w); - } - - if (windows.contains(w)) { - WindowWobblyInfos& wwi = windows[w]; - QRect rect = w->geometry(); - if (rect.y() != wwi.resize_original_rect.y()) wwi.can_wobble_top = true; - if (rect.x() != wwi.resize_original_rect.x()) wwi.can_wobble_left = true; - if (rect.right() != wwi.resize_original_rect.right()) wwi.can_wobble_right = true; - if (rect.bottom() != wwi.resize_original_rect.bottom()) wwi.can_wobble_bottom = true; - } -} - -void WobblyWindowsEffect::startMovedResized(EffectWindow* w) -{ - if (!windows.contains(w)) { - WindowWobblyInfos new_wwi; - initWobblyInfo(new_wwi, w->geometry()); - windows[w] = new_wwi; - } - - WindowWobblyInfos& wwi = windows[w]; - wwi.status = Moving; - const QRectF& rect = w->geometry(); - - qreal x_increment = rect.width() / (wwi.width - 1.0); - qreal y_increment = rect.height() / (wwi.height - 1.0); - - Pair picked = {static_cast<qreal>(cursorPos().x()), static_cast<qreal>(cursorPos().y())}; - int indx = (picked.x - rect.x()) / x_increment + 0.5; - int indy = (picked.y - rect.y()) / y_increment + 0.5; - int pickedPointIndex = indy * wwi.width + indx; - if (pickedPointIndex < 0) { - kDebug(1212) << "Picked index == " << pickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")"; - pickedPointIndex = 0; - } else if (static_cast<unsigned int>(pickedPointIndex) > wwi.count - 1) { - kDebug(1212) << "Picked index == " << pickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")"; - pickedPointIndex = wwi.count - 1; - } -#if defined VERBOSE_MODE - kDebug(1212) << "Original Picked point -- x : " << picked.x << " - y : " << picked.y; -#endif - wwi.constraint[pickedPointIndex] = true; - - if (w->isUserResize()) { - // on a resize, do not allow any edges to wobble until it has been moved from - // its original location - wwi.can_wobble_top = wwi.can_wobble_left = wwi.can_wobble_right = wwi.can_wobble_bottom = false; - wwi.resize_original_rect = w->geometry(); - } else { - wwi.can_wobble_top = wwi.can_wobble_left = wwi.can_wobble_right = wwi.can_wobble_bottom = true; - } -} - -void WobblyWindowsEffect::stepMovedResized(EffectWindow* w) -{ - QRect new_geometry = w->geometry(); - if (!windows.contains(w)) { - WindowWobblyInfos new_wwi; - initWobblyInfo(new_wwi, new_geometry); - windows[w] = new_wwi; - } - - WindowWobblyInfos& wwi = windows[w]; - wwi.status = Free; - - QRect maximized_area = effects->clientArea(MaximizeArea, w); - bool throb_direction_out = (new_geometry.top() == maximized_area.top() && new_geometry.bottom() == maximized_area.bottom()) || - (new_geometry.left() == maximized_area.left() && new_geometry.right() == maximized_area.right()); - qreal magnitude = throb_direction_out ? 10 : -30; // a small throb out when maximized, a larger throb inwards when restored - for (unsigned int j = 0; j < wwi.height; ++j) { - for (unsigned int i = 0; i < wwi.width; ++i) { - Pair v = { magnitude*(i / qreal(wwi.width - 1) - 0.5), magnitude*(j / qreal(wwi.height - 1) - 0.5) }; - wwi.velocity[j*wwi.width+i] = v; - } - } - - // constrain the middle of the window, so that any asymetry wont cause it to drift off-center - for (unsigned int j = 1; j < wwi.height - 1; ++j) { - for (unsigned int i = 1; i < wwi.width - 1; ++i) { - wwi.constraint[j*wwi.width+i] = true; - } - } -} - -void WobblyWindowsEffect::slotWindowAdded(EffectWindow* w) -{ - if (m_openEffectEnabled && w->data(WindowAddedGrabRole).value<void*>() != this) { - if (windows.contains(w)) { - // could this happen ?? - WindowWobblyInfos& wwi = windows[w]; - wobblyOpenInit(wwi); - } else { - WindowWobblyInfos new_wwi; - initWobblyInfo(new_wwi, w->geometry()); - wobblyOpenInit(new_wwi); - windows[w] = new_wwi; - } - } -} - -void WobblyWindowsEffect::slotWindowClosed(EffectWindow* w) -{ - if (windows.contains(w)) { - WindowWobblyInfos& wwi = windows[w]; - if (m_closeEffectEnabled) { - wobblyCloseInit(wwi, w); - w->refWindow(); - } else { - freeWobblyInfo(wwi); - windows.remove(w); - if (windows.isEmpty()) - effects->addRepaintFull(); - } - } else if (m_closeEffectEnabled && w->data(WindowAddedGrabRole).value<void*>() != this) { - WindowWobblyInfos new_wwi; - initWobblyInfo(new_wwi, w->geometry()); - wobblyCloseInit(new_wwi, w); - windows[w] = new_wwi; - w->refWindow(); - } -} - -void WobblyWindowsEffect::wobblyOpenInit(WindowWobblyInfos& wwi) const -{ - Pair middle = { (wwi.origin[0].x + wwi.origin[15].x) / 2, (wwi.origin[0].y + wwi.origin[15].y) / 2 }; - - for (unsigned int j = 0; j < 4; ++j) { - for (unsigned int i = 0; i < 4; ++i) { - unsigned int idx = j * 4 + i; - wwi.constraint[idx] = false; - wwi.position[idx].x = (wwi.position[idx].x + 3 * middle.x) / 4; - wwi.position[idx].y = (wwi.position[idx].y + 3 * middle.y) / 4; - } - } - wwi.status = Openning; - wwi.can_wobble_top = wwi.can_wobble_left = wwi.can_wobble_right = wwi.can_wobble_bottom = true; -} - -void WobblyWindowsEffect::wobblyCloseInit(WindowWobblyInfos& wwi, EffectWindow* w) const -{ - const QRectF& rect = w->geometry(); - QPointF center = rect.center(); - int x1 = (rect.x() + 3 * center.x()) / 4; - int x2 = (rect.x() + rect.width() + 3 * center.x()) / 4; - int y1 = (rect.y() + 3 * center.y()) / 4; - int y2 = (rect.y() + rect.height() + 3 * center.y()) / 4; - wwi.closeRect.setCoords(x1, y1, x2, y2); - - // for closing, not yet used... - for (unsigned int j = 0; j < 4; ++j) { - for (unsigned int i = 0; i < 4; ++i) { - unsigned int idx = j * 4 + i; - wwi.constraint[idx] = false; - } - } - wwi.status = Closing; -} - -void WobblyWindowsEffect::initWobblyInfo(WindowWobblyInfos& wwi, QRect geometry) const -{ - wwi.count = 4 * 4; - wwi.width = 4; - wwi.height = 4; - - wwi.bezierWidth = m_xTesselation; - wwi.bezierHeight = m_yTesselation; - wwi.bezierCount = m_xTesselation * m_yTesselation; - - wwi.origin = new Pair[wwi.count]; - wwi.position = new Pair[wwi.count]; - wwi.velocity = new Pair[wwi.count]; - wwi.acceleration = new Pair[wwi.count]; - wwi.buffer = new Pair[wwi.count]; - wwi.constraint = new bool[wwi.count]; - - wwi.bezierSurface = new Pair[wwi.bezierCount]; - - wwi.status = Moving; - - qreal x = geometry.x(), y = geometry.y(); - qreal width = geometry.width(), height = geometry.height(); - - Pair initValue = {x, y}; - static const Pair nullPair = {0.0, 0.0}; - - qreal x_increment = width / (wwi.width - 1.0); - qreal y_increment = height / (wwi.height - 1.0); - - for (unsigned int j = 0; j < 4; ++j) { - for (unsigned int i = 0; i < 4; ++i) { - unsigned int idx = j * 4 + i; - wwi.origin[idx] = initValue; - wwi.position[idx] = initValue; - wwi.velocity[idx] = nullPair; - wwi.constraint[idx] = false; - if (i != 4 - 2) { // x grid count - 2, i.e. not the last point - initValue.x += x_increment; - } else { - initValue.x = width + x; - } - initValue.x = initValue.x; - } - initValue.x = x; - initValue.x = initValue.x; - if (j != 4 - 2) { // y grid count - 2, i.e. not the last point - initValue.y += y_increment; - } else { - initValue.y = height + y; - } - initValue.y = initValue.y; - } -} - -void WobblyWindowsEffect::freeWobblyInfo(WindowWobblyInfos& wwi) const -{ - delete[] wwi.origin; - delete[] wwi.position; - delete[] wwi.velocity; - delete[] wwi.acceleration; - delete[] wwi.buffer; - delete[] wwi.constraint; - - delete[] wwi.bezierSurface; -} - -WobblyWindowsEffect::Pair WobblyWindowsEffect::computeBezierPoint(const WindowWobblyInfos& wwi, Pair point) const -{ - // compute the input value - Pair topleft = wwi.origin[0]; - Pair bottomright = wwi.origin[wwi.count-1]; - -// ASSERT1(point.x >= topleft.x); -// ASSERT1(point.y >= topleft.y); -// ASSERT1(point.x <= bottomright.x); -// ASSERT1(point.y <= bottomright.y); - - qreal tx = (point.x - topleft.x) / (bottomright.x - topleft.x); - qreal ty = (point.y - topleft.y) / (bottomright.y - topleft.y); - -// ASSERT1(tx >= 0); -// ASSERT1(tx <= 1); -// ASSERT1(ty >= 0); -// ASSERT1(ty <= 1); - - // compute polynomial coeff - - qreal px[4]; - px[0] = (1 - tx) * (1 - tx) * (1 - tx); - px[1] = 3 * (1 - tx) * (1 - tx) * tx; - px[2] = 3 * (1 - tx) * tx * tx; - px[3] = tx * tx * tx; - - qreal py[4]; - py[0] = (1 - ty) * (1 - ty) * (1 - ty); - py[1] = 3 * (1 - ty) * (1 - ty) * ty; - py[2] = 3 * (1 - ty) * ty * ty; - py[3] = ty * ty * ty; - - Pair res = {0.0, 0.0}; - - for (unsigned int j = 0; j < 4; ++j) { - for (unsigned int i = 0; i < 4; ++i) { - // this assume the grid is 4*4 - res.x += px[i] * py[j] * wwi.position[i + j * wwi.width].x; - res.y += px[i] * py[j] * wwi.position[i + j * wwi.width].y; - } - } - - return res; -} - -namespace -{ - -static inline void fixVectorBounds(WobblyWindowsEffect::Pair& vec, qreal min, qreal max) -{ - if (fabs(vec.x) < min) { - vec.x = 0.0; - } else if (fabs(vec.x) > max) { - if (vec.x > 0.0) { - vec.x = max; - } else { - vec.x = -max; - } - } - - if (fabs(vec.y) < min) { - vec.y = 0.0; - } else if (fabs(vec.y) > max) { - if (vec.y > 0.0) { - vec.y = max; - } else { - vec.y = -max; - } - } -} - -static inline void computeVectorBounds(WobblyWindowsEffect::Pair& vec, WobblyWindowsEffect::Pair& bound) -{ - if (fabs(vec.x) < bound.x) { - bound.x = fabs(vec.x); - } else if (fabs(vec.x) > bound.y) { - bound.y = fabs(vec.x); - } - if (fabs(vec.y) < bound.x) { - bound.x = fabs(vec.y); - } else if (fabs(vec.y) > bound.y) { - bound.y = fabs(vec.y); - } -} - -} // close the anonymous namespace - -bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time) -{ - QRectF rect = w->geometry(); - WindowWobblyInfos& wwi = windows[w]; - - if (wwi.status == Closing) { - rect = wwi.closeRect; - } - - qreal x_length = rect.width() / (wwi.width - 1.0); - qreal y_length = rect.height() / (wwi.height - 1.0); - -#if defined VERBOSE_MODE - kDebug(1212) << "time " << time; - kDebug(1212) << "increment x " << x_length << " // y" << y_length; -#endif - - Pair origine = {rect.x(), rect.y()}; - - for (unsigned int j = 0; j < wwi.height; ++j) { - for (unsigned int i = 0; i < wwi.width; ++i) { - wwi.origin[wwi.width*j + i] = origine; - if (i != wwi.width - 2) { - origine.x += x_length; - } else { - origine.x = rect.width() + rect.x(); - } - } - origine.x = rect.x(); - if (j != wwi.height - 2) { - origine.y += y_length; - } else { - origine.y = rect.height() + rect.y(); - } - } - - Pair neibourgs[4]; - Pair acceleration; - - qreal acc_sum = 0.0; - qreal vel_sum = 0.0; - - // compute acceleration, velocity and position for each point - - // for corners - - // top-left - - if (wwi.constraint[0]) { - Pair window_pos = wwi.origin[0]; - Pair current_pos = wwi.position[0]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[0] = accel; - } else { - Pair& pos = wwi.position[0]; - neibourgs[0] = wwi.position[1]; - neibourgs[1] = wwi.position[wwi.width]; - - acceleration.x = ((neibourgs[0].x - pos.x) - x_length) * m_stiffness + (neibourgs[1].x - pos.x) * m_stiffness; - acceleration.y = ((neibourgs[1].y - pos.y) - y_length) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness; - - acceleration.x /= 2; - acceleration.y /= 2; - - wwi.acceleration[0] = acceleration; - } - - // top-right - - if (wwi.constraint[wwi.width-1]) { - Pair window_pos = wwi.origin[wwi.width-1]; - Pair current_pos = wwi.position[wwi.width-1]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[wwi.width-1] = accel; - } else { - Pair& pos = wwi.position[wwi.width-1]; - neibourgs[0] = wwi.position[wwi.width-2]; - neibourgs[1] = wwi.position[2*wwi.width-1]; - - acceleration.x = (x_length - (pos.x - neibourgs[0].x)) * m_stiffness + (neibourgs[1].x - pos.x) * m_stiffness; - acceleration.y = ((neibourgs[1].y - pos.y) - y_length) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness; - - acceleration.x /= 2; - acceleration.y /= 2; - - wwi.acceleration[wwi.width-1] = acceleration; - } - - // bottom-left - - if (wwi.constraint[wwi.width*(wwi.height-1)]) { - Pair window_pos = wwi.origin[wwi.width*(wwi.height-1)]; - Pair current_pos = wwi.position[wwi.width*(wwi.height-1)]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[wwi.width*(wwi.height-1)] = accel; - } else { - Pair& pos = wwi.position[wwi.width*(wwi.height-1)]; - neibourgs[0] = wwi.position[wwi.width*(wwi.height-1)+1]; - neibourgs[1] = wwi.position[wwi.width*(wwi.height-2)]; - - acceleration.x = ((neibourgs[0].x - pos.x) - x_length) * m_stiffness + (neibourgs[1].x - pos.x) * m_stiffness; - acceleration.y = (y_length - (pos.y - neibourgs[1].y)) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness; - - acceleration.x /= 2; - acceleration.y /= 2; - - wwi.acceleration[wwi.width*(wwi.height-1)] = acceleration; - } - - // bottom-right - - if (wwi.constraint[wwi.count-1]) { - Pair window_pos = wwi.origin[wwi.count-1]; - Pair current_pos = wwi.position[wwi.count-1]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[wwi.count-1] = accel; - } else { - Pair& pos = wwi.position[wwi.count-1]; - neibourgs[0] = wwi.position[wwi.count-2]; - neibourgs[1] = wwi.position[wwi.width*(wwi.height-1)-1]; - - acceleration.x = (x_length - (pos.x - neibourgs[0].x)) * m_stiffness + (neibourgs[1].x - pos.x) * m_stiffness; - acceleration.y = (y_length - (pos.y - neibourgs[1].y)) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness; - - acceleration.x /= 2; - acceleration.y /= 2; - - wwi.acceleration[wwi.count-1] = acceleration; - } - - - // for borders - - // top border - for (unsigned int i = 1; i < wwi.width - 1; ++i) { - if (wwi.constraint[i]) { - Pair window_pos = wwi.origin[i]; - Pair current_pos = wwi.position[i]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[i] = accel; - } else { - Pair& pos = wwi.position[i]; - neibourgs[0] = wwi.position[i-1]; - neibourgs[1] = wwi.position[i+1]; - neibourgs[2] = wwi.position[i+wwi.width]; - - acceleration.x = (x_length - (pos.x - neibourgs[0].x)) * m_stiffness + ((neibourgs[1].x - pos.x) - x_length) * m_stiffness + (neibourgs[2].x - pos.x) * m_stiffness; - acceleration.y = ((neibourgs[2].y - pos.y) - y_length) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness + (neibourgs[1].y - pos.y) * m_stiffness; - - acceleration.x /= 3; - acceleration.y /= 3; - - wwi.acceleration[i] = acceleration; - } - } - - // bottom border - for (unsigned int i = wwi.width * (wwi.height - 1) + 1; i < wwi.count - 1; ++i) { - if (wwi.constraint[i]) { - Pair window_pos = wwi.origin[i]; - Pair current_pos = wwi.position[i]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[i] = accel; - } else { - Pair& pos = wwi.position[i]; - neibourgs[0] = wwi.position[i-1]; - neibourgs[1] = wwi.position[i+1]; - neibourgs[2] = wwi.position[i-wwi.width]; - - acceleration.x = (x_length - (pos.x - neibourgs[0].x)) * m_stiffness + ((neibourgs[1].x - pos.x) - x_length) * m_stiffness + (neibourgs[2].x - pos.x) * m_stiffness; - acceleration.y = (y_length - (pos.y - neibourgs[2].y)) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness + (neibourgs[1].y - pos.y) * m_stiffness; - - acceleration.x /= 3; - acceleration.y /= 3; - - wwi.acceleration[i] = acceleration; - } - } - - // left border - for (unsigned int i = wwi.width; i < wwi.width*(wwi.height - 1); i += wwi.width) { - if (wwi.constraint[i]) { - Pair window_pos = wwi.origin[i]; - Pair current_pos = wwi.position[i]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[i] = accel; - } else { - Pair& pos = wwi.position[i]; - neibourgs[0] = wwi.position[i+1]; - neibourgs[1] = wwi.position[i-wwi.width]; - neibourgs[2] = wwi.position[i+wwi.width]; - - acceleration.x = ((neibourgs[0].x - pos.x) - x_length) * m_stiffness + (neibourgs[1].x - pos.x) * m_stiffness + (neibourgs[2].x - pos.x) * m_stiffness; - acceleration.y = (y_length - (pos.y - neibourgs[1].y)) * m_stiffness + ((neibourgs[2].y - pos.y) - y_length) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness; - - acceleration.x /= 3; - acceleration.y /= 3; - - wwi.acceleration[i] = acceleration; - } - } - - // right border - for (unsigned int i = 2 * wwi.width - 1; i < wwi.count - 1; i += wwi.width) { - if (wwi.constraint[i]) { - Pair window_pos = wwi.origin[i]; - Pair current_pos = wwi.position[i]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[i] = accel; - } else { - Pair& pos = wwi.position[i]; - neibourgs[0] = wwi.position[i-1]; - neibourgs[1] = wwi.position[i-wwi.width]; - neibourgs[2] = wwi.position[i+wwi.width]; - - acceleration.x = (x_length - (pos.x - neibourgs[0].x)) * m_stiffness + (neibourgs[1].x - pos.x) * m_stiffness + (neibourgs[2].x - pos.x) * m_stiffness; - acceleration.y = (y_length - (pos.y - neibourgs[1].y)) * m_stiffness + ((neibourgs[2].y - pos.y) - y_length) * m_stiffness + (neibourgs[0].y - pos.y) * m_stiffness; - - acceleration.x /= 3; - acceleration.y /= 3; - - wwi.acceleration[i] = acceleration; - } - } - - // for the inner points - for (unsigned int j = 1; j < wwi.height - 1; ++j) { - for (unsigned int i = 1; i < wwi.width - 1; ++i) { - unsigned int index = i + j * wwi.width; - - if (wwi.constraint[index]) { - Pair window_pos = wwi.origin[index]; - Pair current_pos = wwi.position[index]; - Pair move = {window_pos.x - current_pos.x, window_pos.y - current_pos.y}; - Pair accel = {move.x*m_stiffness, move.y*m_stiffness}; - wwi.acceleration[index] = accel; - } else { - Pair& pos = wwi.position[index]; - neibourgs[0] = wwi.position[index-1]; - neibourgs[1] = wwi.position[index+1]; - neibourgs[2] = wwi.position[index-wwi.width]; - neibourgs[3] = wwi.position[index+wwi.width]; - - acceleration.x = ((neibourgs[0].x - pos.x) - x_length) * m_stiffness + - (x_length - (pos.x - neibourgs[1].x)) * m_stiffness + - (neibourgs[2].x - pos.x) * m_stiffness + - (neibourgs[3].x - pos.x) * m_stiffness; - acceleration.y = (y_length - (pos.y - neibourgs[2].y)) * m_stiffness + - ((neibourgs[3].y - pos.y) - y_length) * m_stiffness + - (neibourgs[0].y - pos.y) * m_stiffness + - (neibourgs[1].y - pos.y) * m_stiffness; - - acceleration.x /= 4; - acceleration.y /= 4; - - wwi.acceleration[index] = acceleration; - } - } - } - - heightRingLinearMean(&wwi.acceleration, wwi); - -#if defined COMPUTE_STATS - Pair accBound = {m_maxAcceleration, m_minAcceleration}; - Pair velBound = {m_maxVelocity, m_minVelocity}; -#endif - - // compute the new velocity of each vertex. - for (unsigned int i = 0; i < wwi.count; ++i) { - Pair acc = wwi.acceleration[i]; - fixVectorBounds(acc, m_minAcceleration, m_maxAcceleration); - -#if defined COMPUTE_STATS - computeVectorBounds(acc, accBound); -#endif - - Pair& vel = wwi.velocity[i]; - vel.x = acc.x * time + vel.x * m_drag; - vel.y = acc.y * time + vel.y * m_drag; - - acc_sum += fabs(acc.x) + fabs(acc.y); - } - - heightRingLinearMean(&wwi.velocity, wwi); - - // compute the new pos of each vertex. - for (unsigned int i = 0; i < wwi.count; ++i) { - Pair& pos = wwi.position[i]; - Pair& vel = wwi.velocity[i]; - - fixVectorBounds(vel, m_minVelocity, m_maxVelocity); -#if defined COMPUTE_STATS - computeVectorBounds(vel, velBound); -#endif - - pos.x += vel.x * time * m_move_factor; - pos.y += vel.y * time * m_move_factor; - - vel_sum += fabs(vel.x) + fabs(vel.y); - -#if defined VERBOSE_MODE - if (wwi.constraint[i]) { - kDebug(1212) << "Constraint point ** vel : " << vel.x << "," << vel.y << " ** move : " << vel.x*time << "," << vel.y*time; - } -#endif - } - - if (!wwi.can_wobble_top) { - for (unsigned int i = 0; i < wwi.width; ++i) - for (unsigned j = 0; j < wwi.width - 1; ++j) - wwi.position[i+wwi.width*j].y = wwi.origin[i+wwi.width*j].y; - } - if (!wwi.can_wobble_bottom) { - for (unsigned int i = wwi.width * (wwi.height - 1); i < wwi.count; ++i) - for (unsigned j = 0; j < wwi.width - 1; ++j) - wwi.position[i-wwi.width*j].y = wwi.origin[i-wwi.width*j].y; - } - if (!wwi.can_wobble_left) { - for (unsigned int i = 0; i < wwi.count; i += wwi.width) - for (unsigned j = 0; j < wwi.width - 1; ++j) - wwi.position[i+j].x = wwi.origin[i+j].x; - } - if (!wwi.can_wobble_right) { - for (unsigned int i = wwi.width - 1; i < wwi.count; i += wwi.width) - for (unsigned j = 0; j < wwi.width - 1; ++j) - wwi.position[i-j].x = wwi.origin[i-j].x; - } - -#if defined VERBOSE_MODE -# if defined COMPUTE_STATS - kDebug(1212) << "Acceleration bounds (" << accBound.x << ", " << accBound.y << ")"; - kDebug(1212) << "Velocity bounds (" << velBound.x << ", " << velBound.y << ")"; -# endif - kDebug(1212) << "sum_acc : " << acc_sum << " *** sum_vel :" << vel_sum; -#endif - - if (wwi.status != Moving && acc_sum < m_stopAcceleration && vel_sum < m_stopVelocity) { - if (wwi.status == Closing) { - w->unrefWindow(); - } - freeWobblyInfo(wwi); - windows.remove(w); - if (windows.isEmpty()) - effects->addRepaintFull(); - return false; - } - - return true; -} - -void WobblyWindowsEffect::heightRingLinearMean(Pair** data_pointer, WindowWobblyInfos& wwi) -{ - Pair* data = *data_pointer; - Pair neibourgs[8]; - - // for corners - - // top-left - { - Pair& res = wwi.buffer[0]; - Pair vit = data[0]; - neibourgs[0] = data[1]; - neibourgs[1] = data[wwi.width]; - neibourgs[2] = data[wwi.width+1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0 * vit.x) / 6.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0 * vit.y) / 6.0; - } - - - // top-right - { - Pair& res = wwi.buffer[wwi.width-1]; - Pair vit = data[wwi.width-1]; - neibourgs[0] = data[wwi.width-2]; - neibourgs[1] = data[2*wwi.width-1]; - neibourgs[2] = data[2*wwi.width-2]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0 * vit.x) / 6.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0 * vit.y) / 6.0; - } - - - // bottom-left - { - Pair& res = wwi.buffer[wwi.width*(wwi.height-1)]; - Pair vit = data[wwi.width*(wwi.height-1)]; - neibourgs[0] = data[wwi.width*(wwi.height-1)+1]; - neibourgs[1] = data[wwi.width*(wwi.height-2)]; - neibourgs[2] = data[wwi.width*(wwi.height-2)+1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0 * vit.x) / 6.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0 * vit.y) / 6.0; - } - - - // bottom-right - { - Pair& res = wwi.buffer[wwi.count-1]; - Pair vit = data[wwi.count-1]; - neibourgs[0] = data[wwi.count-2]; - neibourgs[1] = data[wwi.width*(wwi.height-1)-1]; - neibourgs[2] = data[wwi.width*(wwi.height-1)-2]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0 * vit.x) / 6.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0 * vit.y) / 6.0; - } - - - // for borders - - // top border - for (unsigned int i = 1; i < wwi.width - 1; ++i) { - Pair& res = wwi.buffer[i]; - Pair vit = data[i]; - neibourgs[0] = data[i-1]; - neibourgs[1] = data[i+1]; - neibourgs[2] = data[i+wwi.width]; - neibourgs[3] = data[i+wwi.width-1]; - neibourgs[4] = data[i+wwi.width+1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + neibourgs[4].x + 5.0 * vit.x) / 10.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + neibourgs[4].y + 5.0 * vit.y) / 10.0; - } - - // bottom border - for (unsigned int i = wwi.width * (wwi.height - 1) + 1; i < wwi.count - 1; ++i) { - Pair& res = wwi.buffer[i]; - Pair vit = data[i]; - neibourgs[0] = data[i-1]; - neibourgs[1] = data[i+1]; - neibourgs[2] = data[i-wwi.width]; - neibourgs[3] = data[i-wwi.width-1]; - neibourgs[4] = data[i-wwi.width+1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + neibourgs[4].x + 5.0 * vit.x) / 10.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + neibourgs[4].y + 5.0 * vit.y) / 10.0; - } - - // left border - for (unsigned int i = wwi.width; i < wwi.width*(wwi.height - 1); i += wwi.width) { - Pair& res = wwi.buffer[i]; - Pair vit = data[i]; - neibourgs[0] = data[i+1]; - neibourgs[1] = data[i-wwi.width]; - neibourgs[2] = data[i+wwi.width]; - neibourgs[3] = data[i-wwi.width+1]; - neibourgs[4] = data[i+wwi.width+1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + neibourgs[4].x + 5.0 * vit.x) / 10.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + neibourgs[4].y + 5.0 * vit.y) / 10.0; - } - - // right border - for (unsigned int i = 2 * wwi.width - 1; i < wwi.count - 1; i += wwi.width) { - Pair& res = wwi.buffer[i]; - Pair vit = data[i]; - neibourgs[0] = data[i-1]; - neibourgs[1] = data[i-wwi.width]; - neibourgs[2] = data[i+wwi.width]; - neibourgs[3] = data[i-wwi.width-1]; - neibourgs[4] = data[i+wwi.width-1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + neibourgs[4].x + 5.0 * vit.x) / 10.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + neibourgs[4].y + 5.0 * vit.y) / 10.0; - } - - // for the inner points - for (unsigned int j = 1; j < wwi.height - 1; ++j) { - for (unsigned int i = 1; i < wwi.width - 1; ++i) { - unsigned int index = i + j * wwi.width; - - Pair& res = wwi.buffer[index]; - Pair& vit = data[index]; - neibourgs[0] = data[index-1]; - neibourgs[1] = data[index+1]; - neibourgs[2] = data[index-wwi.width]; - neibourgs[3] = data[index+wwi.width]; - neibourgs[4] = data[index-wwi.width-1]; - neibourgs[5] = data[index-wwi.width+1]; - neibourgs[6] = data[index+wwi.width-1]; - neibourgs[7] = data[index+wwi.width+1]; - - res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + neibourgs[4].x + neibourgs[5].x + neibourgs[6].x + neibourgs[7].x + 8.0 * vit.x) / 16.0; - res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + neibourgs[4].y + neibourgs[5].y + neibourgs[6].y + neibourgs[7].y + 8.0 * vit.y) / 16.0; - } - } - - Pair* tmp = data; - *data_pointer = wwi.buffer; - wwi.buffer = tmp; -} - -bool WobblyWindowsEffect::isActive() const -{ - return !windows.isEmpty(); -} - -} // namespace KWin - diff --git a/kwin/effects/wobblywindows/wobblywindows.desktop b/kwin/effects/wobblywindows/wobblywindows.desktop deleted file mode 100644 index d47fd897..00000000 --- a/kwin/effects/wobblywindows/wobblywindows.desktop +++ /dev/null @@ -1,158 +0,0 @@ -[Desktop Entry] -Name=Wobbly Windows -Name[af]=Wobbly Windows -Name[ar]=نوافذ متذبذبة -Name[ast]=Ventanes xelatinoses -Name[be@latin]=Skryŭleńnie akon -Name[bg]=Желирани прозорци -Name[bs]=Lelujavi prozori -Name[ca]=Finestres sacsejades -Name[ca@valencia]=Finestres sacsejades -Name[cs]=Chvějící se okna -Name[csb]=Òkna Wobbly -Name[da]=Blævrende vinduer -Name[de]=Wabernde Fenster -Name[el]=Ταλαντευόμενα παράθυρα -Name[en_GB]=Wobbly Windows -Name[eo]=Tremaj fenestroj -Name[es]=Ventanas gelatinosas -Name[et]=Võbisevad aknad -Name[eu]=Leiho dardartiak -Name[fi]=Heiluvat ikkunat -Name[fr]=Fenêtres en gélatine -Name[fy]=Wobbly Windows -Name[ga]=Fuinneoga Creathacha -Name[gl]=Xanelas a tremer -Name[gu]=વોબલી વિન્ડોઝ -Name[he]=חלונות מתנדנדים -Name[hi]=हिलता-डुलता विंडो -Name[hne]=कांपत विंडो -Name[hr]=Klimavi prozori -Name[hu]=Tekergő ablakok -Name[ia]=Fenestras Tremulante -Name[id]=Jendela Rapuh -Name[is]=Linir gluggar -Name[it]=Finestre tremolanti -Name[ja]=揺れるウィンドウ -Name[kk]=Майысқақ терезелер -Name[km]=បង្អួច​រំញ័រ -Name[kn]=ಅಲ್ಲಾಡುವ ಕಿಟಕಿಗಳು -Name[ko]=흔들리는 창 -Name[ku]=Paceyên Dihejin -Name[lt]=Svirduliuojantys langai -Name[lv]=Ļodzīgie logi -Name[mai]=वोबली विंडो -Name[ml]=ചാഞ്ചാടുന്ന ജാലകങ്ങള്‍ -Name[mr]=थरथरणाऱ्या चौकटी -Name[nb]=Vaklende vinduer -Name[nds]=Wabbelig Finstern -Name[nl]=Wiebelende vensters -Name[nn]=Vaklande vindauge -Name[pa]=ਕੰਬਦੀਆਂ ਵਿੰਡੋਜ਼ -Name[pl]=Chwiejne okna -Name[pt]=Janelas Trémulas -Name[pt_BR]=Janelas instáveis -Name[ro]=Ferestre tremurătoare -Name[ru]=Дрожащие окна -Name[si]=කවුළු සොලවන්න -Name[sk]=Zvlnené okná -Name[sl]=Majava okna -Name[sr]=Лелујави прозори -Name[sr@ijekavian]=Лелујави прозори -Name[sr@ijekavianlatin]=Lelujavi prozori -Name[sr@latin]=Lelujavi prozori -Name[sv]=Ostadiga fönster -Name[ta]=அசைவுடைய சாளரம் -Name[te]=వూబ్లీ విండోస్ -Name[tg]=Тирезаҳои Wobbly -Name[th]=หน้าต่างพริ้วไหว -Name[tr]=Sallanan Pencereler -Name[ug]=تەۋرەنگەن كۆزنەكلەر -Name[uk]=Желейні вікна -Name[wa]=Molès fniesses -Name[x-test]=xxWobbly Windowsxx -Name[zh_CN]=摆动窗口 -Name[zh_TW]=變形視窗 -Comment=Deform windows while they are moving -Comment[ar]=شوه شكل النوافذ عند تحركها -Comment[ast]=Fai que les ventanes se deformen al moveles -Comment[be@latin]=Skryŭlaje vokny padčas pierasoŭvańnia. -Comment[bg]=Прозорците изглеждат като желирани при местене -Comment[bs]=Prozori se deformišu pri premještanju -Comment[ca]=Deforma les finestres quan es mouen -Comment[ca@valencia]=Deforma les finestres quan es mouen -Comment[cs]=Deformace oken při jejich přesouvání -Comment[csb]=Defòrmùjë òkna przë jich rëszaniu -Comment[da]=Deformér vinduer mens de flyttes -Comment[de]=Lässt Fenster beim Verschieben wackeln. -Comment[el]=Παραμόρφωση παραθύρων κατά τη μετακίνησή τους -Comment[en_GB]=Deform windows while they are moving -Comment[eo]=Eksplodigi la fenestrojn dum ili fermiĝas -Comment[es]=Hace que las ventanas se deformen al moverlas -Comment[et]=Akende moonutamine liigutamisel -Comment[eu]=Leihoak deformatzen ditu mugitzen ari direnean -Comment[fi]=Vääristä ikkunoita niiden liikkuessa -Comment[fy]=Ferfoarmt finsters as se sluten wurde -Comment[ga]=Díchum fuinneoga agus iad á mbogadh -Comment[gl]=Deforma as xanelas cando se moven -Comment[gu]=જ્યારે વિન્ડો બંધ થાય છે ત્યારે તેમનો આકાર બદલે છે -Comment[he]=גורם לחלונות להתנדנד בזמן שהם מוזזים -Comment[hi]=जब खिसकाए जा रहे हों तो विंडो का आकार बिगाड़ें -Comment[hne]=विंडो ल तोड़मोड़ देव जब ओ हर खिसकथे -Comment[hr]=Deformiranje prozora dok ih se pomiče -Comment[hu]=Mozgatás közben deformálódnak az ablakok -Comment[ia]=Deforma fenestras durante que illes es movente -Comment[id]=Deformasi jendela ketika jendela berpindah -Comment[is]=Afmyndar glugga við hreyfingu -Comment[kk]=Терезелер жылжығанда майысқақ болады -Comment[km]=បង្អួច​ទ្រង់ទ្រាយ​បង្អួច​ខណៈពេល​កំពុង​ផ្លាស់ទី​ពួកវា​ -Comment[kn]=ಕಿಟಕಿಗಳನ್ನು ಸರಿಸುವಾಗ ಅವುಗಳನ್ನು ವಿಕೃತಿಗೊಳಿಸು -Comment[ko]=창이 움직일 때 흔듭니다 -Comment[lt]=Deformuoja langus kai šie juda -Comment[lv]=Deformē logus, kad tos pārvieto -Comment[mk]=Ги деформира прозорците додека ги преместувате -Comment[ml]=അനങ്ങുംബോള്‍ ജാലകങ്ങളുടെ ആക്രതി മാറുന്നു -Comment[mr]=हलवितेवेळी चौकट थरथर करा -Comment[nb]=Deformer vinduer mens de flyttes -Comment[nds]=Finstern bi't Verschuven weihen laten -Comment[nl]=Vervormt vensters wanneer ze verplaatst worden -Comment[nn]=Endra form på vindauga når dei vert flytte -Comment[pa]=ਜਦੋਂ ਵਿੰਡੋ ਹਿਲਾਈਆਂ ਜਾਣ ਤਾਂ ਅੱਡ ਅੱਡ ਕਰੋ -Comment[pl]=Deformowanie okien przy ich przemieszczaniu -Comment[pt]=Deformar as janelas enquanto mudam de posição -Comment[pt_BR]=Deforma as janelas enquanto elas são movimentadas -Comment[ro]=Deformează ferestrele în timpul deplasării -Comment[ru]=Дрожание окна при его перемещении -Comment[si]=කවුළු ගෙනයෑමේදී විරූපී කරන්න -Comment[sk]=Deformuje okná pri ich presúvaní -Comment[sl]=Ko okna premikate, se popačijo -Comment[sr]=Прозори се деформишу при премештању -Comment[sr@ijekavian]=Прозори се деформишу при премијештању -Comment[sr@ijekavianlatin]=Prozori se deformišu pri premiještanju -Comment[sr@latin]=Prozori se deformišu pri premeštanju -Comment[sv]=Förvräng fönster medan de flyttas -Comment[ta]=நகர்கையில் சாளரங்களை கலைத்திடு -Comment[th]=บิดรูปทรงหน้าต่างขณะที่หน้าต่างถูกย้ายตำแหน่ง -Comment[tr]=Pencereler taşınırken şekillerini boz -Comment[ug]=كۆزنەك يۆتكەلگەندە ئۆزگىرىش ئۈنۈمىنى كۆرسىتىدۇ -Comment[uk]=Деформація вікон під час їхнього пересування -Comment[vi]=Làm biến dạng cửa sổ khi chúng di chuyển -Comment[wa]=Disfoûrmer les fniesses cwand ele sont bodjeyes -Comment[x-test]=xxDeform windows while they are movingxx -Comment[zh_CN]=当窗口被移动时,使其呈现变形效果 -Comment[zh_TW]=移動視窗時讓視窗「變形」 -Icon=preferences-system-windows-effect-wobblywindows - -Type=Service -ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Cédric Borgese -X-KDE-PluginInfo-Email=cedric.borgese@gmail.com -X-KDE-PluginInfo-Name=kwin4_effect_wobblywindows -X-KDE-PluginInfo-Version=0.0.1 -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=45 -X-KWin-Requires-OpenGL=true diff --git a/kwin/effects/wobblywindows/wobblywindows.h b/kwin/effects/wobblywindows/wobblywindows.h deleted file mode 100644 index 69d1f879..00000000 --- a/kwin/effects/wobblywindows/wobblywindows.h +++ /dev/null @@ -1,211 +0,0 @@ -/***************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com> - -You can Freely distribute this program under the GNU General Public -License. See the file "COPYING" for the exact licensing terms. -******************************************************************/ - -#ifndef KWIN_WOBBLYWINDOWS_H -#define KWIN_WOBBLYWINDOWS_H - -// Include with base class for effects. -#include <kwineffects.h> - -namespace KWin -{ - -struct ParameterSet; - -/** - * Effect which wobble windows - **/ -class WobblyWindowsEffect : public Effect -{ - Q_OBJECT - Q_PROPERTY(qreal stiffness READ stiffness) - Q_PROPERTY(qreal drag READ drag) - Q_PROPERTY(qreal moveFactor READ moveFactor) - Q_PROPERTY(qreal xTesselation READ xTesselation) - Q_PROPERTY(qreal yTesselation READ yTesselation) - Q_PROPERTY(qreal minVelocity READ minVelocity) - Q_PROPERTY(qreal maxVelocity READ maxVelocity) - Q_PROPERTY(qreal stopVelocity READ stopVelocity) - Q_PROPERTY(qreal minAcceleration READ minAcceleration) - Q_PROPERTY(qreal maxAcceleration READ maxAcceleration) - Q_PROPERTY(qreal stopAcceleration READ stopAcceleration) - Q_PROPERTY(bool moveEffectEnabled READ isMoveEffectEnabled) - Q_PROPERTY(bool openEffectEnabled READ isOpenEffectEnabled) - Q_PROPERTY(bool closeEffectEnabled READ isCloseEffectEnabled) - Q_PROPERTY(bool moveWobble READ isMoveWobble) - Q_PROPERTY(bool resizeWobble READ isResizeWobble) -public: - - WobblyWindowsEffect(); - virtual ~WobblyWindowsEffect(); - - 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 postPaintScreen(); - virtual bool isActive() const; - - // Wobbly model parameters - void setStiffness(qreal stiffness); - void setDrag(qreal drag); - void setVelocityThreshold(qreal velocityThreshold); - void setMoveFactor(qreal factor); - - struct Pair { - qreal x; - qreal y; - }; - - enum WindowStatus { - Free, - Moving, - Openning, - Closing - }; - - static bool supported(); - - // for properties - qreal stiffness() const { - return m_stiffness; - } - qreal drag() const { - return m_drag; - } - qreal moveFactor() const { - return m_move_factor; - } - qreal xTesselation() const { - return m_xTesselation; - } - qreal yTesselation() const { - return m_yTesselation; - } - qreal minVelocity() const { - return m_minVelocity; - } - qreal maxVelocity() const { - return m_maxVelocity; - } - qreal stopVelocity() const { - return m_stopVelocity; - } - qreal minAcceleration() const { - return m_minAcceleration; - } - qreal maxAcceleration() const { - return m_maxAcceleration; - } - qreal stopAcceleration() const { - return m_stopAcceleration; - } - bool isMoveEffectEnabled() const { - return m_moveEffectEnabled; - } - bool isOpenEffectEnabled() const { - return m_openEffectEnabled; - } - bool isCloseEffectEnabled() const { - return m_closeEffectEnabled; - } - bool isMoveWobble() const { - return m_moveWobble; - } - bool isResizeWobble() const { - return m_resizeWobble; - } -public Q_SLOTS: - void slotWindowAdded(KWin::EffectWindow *w); - void slotWindowClosed(KWin::EffectWindow *w); - void slotWindowStartUserMovedResized(KWin::EffectWindow *w); - void slotWindowStepUserMovedResized(KWin::EffectWindow *w, const QRect &geometry); - void slotWindowFinishUserMovedResized(KWin::EffectWindow *w); - void slotWindowMaximizeStateChanged(KWin::EffectWindow *w, bool horizontal, bool vertical); - -private: - - void startMovedResized(EffectWindow* w); - void stepMovedResized(EffectWindow* w); - bool updateWindowWobblyDatas(EffectWindow* w, qreal time); - - struct WindowWobblyInfos { - Pair* origin; - Pair* position; - Pair* velocity; - Pair* acceleration; - Pair* buffer; - - // if true, the physics system moves this point based only on it "normal" destination - // given by the window position, ignoring neighbour points. - bool* constraint; - - unsigned int width; - unsigned int height; - unsigned int count; - - Pair* bezierSurface; - unsigned int bezierWidth; - unsigned int bezierHeight; - unsigned int bezierCount; - - WindowStatus status; - - // for closing - QRectF closeRect; - - // for resizing. Only sides that have moved will wobble - bool can_wobble_top, can_wobble_left, can_wobble_right, can_wobble_bottom; - QRect resize_original_rect; - }; - - QHash< const EffectWindow*, WindowWobblyInfos > windows; - - QRegion m_updateRegion; - - qreal m_stiffness; - qreal m_drag; - qreal m_move_factor; - - // the default tesselation for windows - // use qreal instead of int as I really often need - // these values as real to do divisions. - qreal m_xTesselation; - qreal m_yTesselation; - - qreal m_minVelocity; - qreal m_maxVelocity; - qreal m_stopVelocity; - qreal m_minAcceleration; - qreal m_maxAcceleration; - qreal m_stopAcceleration; - - bool m_moveEffectEnabled; - bool m_openEffectEnabled; - bool m_closeEffectEnabled; - - bool m_moveWobble; // Expands m_moveEffectEnabled - bool m_resizeWobble; - - void initWobblyInfo(WindowWobblyInfos& wwi, QRect geometry) const; - void freeWobblyInfo(WindowWobblyInfos& wwi) const; - void wobblyOpenInit(WindowWobblyInfos& wwi) const; - void wobblyCloseInit(WindowWobblyInfos& wwi, EffectWindow* w) const; - - WobblyWindowsEffect::Pair computeBezierPoint(const WindowWobblyInfos& wwi, Pair point) const; - - static void heightRingLinearMean(Pair** data_pointer, WindowWobblyInfos& wwi); - - void setParameterSet(const ParameterSet& pset); -}; - -} // namespace KWin - -#endif // WOBBLYWINDOWS_H diff --git a/kwin/effects/wobblywindows/wobblywindows.kcfg b/kwin/effects/wobblywindows/wobblywindows.kcfg deleted file mode 100644 index c843af9b..00000000 --- a/kwin/effects/wobblywindows/wobblywindows.kcfg +++ /dev/null @@ -1,66 +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-Wobbly"> - <entry name="WobblynessLevel" type="UInt"> - <default>0</default> - </entry> - <entry name="Settings" type="String"> - <default>Auto</default> - </entry> - <entry name="MoveWobble" type="Bool"> - <default>true</default> - </entry> - <entry name="ResizeWobble" type="Bool"> - <default>true</default> - </entry> - <entry name="AdvancedMode" type="Bool"> - <default>false</default> - </entry> - <entry name="Stiffness" type="Double"> - <default>15</default> - </entry> - <entry name="Drag" type="Double"> - <default>80</default> - </entry> - <entry name="MoveFactor" type="Double"> - <default code="true">10</default> - </entry> - <entry name="XTesselation" type="Double"> - <default>20</default> - </entry> - <entry name="YTesselation" type="Double"> - <default>20</default> - </entry> - <entry name="MinVelocity" type="Double"> - <default>0.0</default> - </entry> - <entry name="MaxVelocity" type="Double"> - <default>1000.0</default> - </entry> - <entry name="StopVelocity" type="Double"> - <default>0.5</default> - </entry> - <entry name="MinAcceleration" type="Double"> - <default>0.0</default> - </entry> - <entry name="MaxAcceleration" type="Double"> - <default>1000.0</default> - </entry> - <entry name="StopAcceleration" type="Double"> - <default>5.0</default> - </entry> - <entry name="MoveEffect" type="Bool"> - <default>true</default> - </entry> - <entry name="OpenEffect" type="Bool"> - <default>false</default> - </entry> - <entry name="CloseEffect" type="Bool"> - <default>false</default> - </entry> - </group> -</kcfg> diff --git a/kwin/effects/wobblywindows/wobblywindows_config.cpp b/kwin/effects/wobblywindows/wobblywindows_config.cpp deleted file mode 100644 index 781e3da5..00000000 --- a/kwin/effects/wobblywindows/wobblywindows_config.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com> - 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 "wobblywindows_config.h" -// KConfigSkeleton -#include "wobblywindowsconfig.h" - -#include <kwineffects.h> - -#include <KLocalizedString> -#include <kdebug.h> -#include <kaction.h> -#include <kconfiggroup.h> - -namespace KWin -{ - -KWIN_EFFECT_CONFIG_FACTORY - -//----------------------------------------------------------------------------- -// WARNING: This is (kinda) copied from wobblywindows.cpp - -struct ParameterSet { - int stiffness; - int drag; - int move_factor; -}; - -ParameterSet set_0 = { - 15, - 80, - 10 -}; - -ParameterSet set_1 = { - 10, - 85, - 10 -}; - -ParameterSet set_2 = { - 6, - 90, - 10 -}; - -ParameterSet set_3 = { - 3, - 92, - 20 -}; - -ParameterSet set_4 = { - 1, - 97, - 25 -}; - -ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 }; - -//----------------------------------------------------------------------------- - -WobblyWindowsEffectConfig::WobblyWindowsEffectConfig(QWidget* parent, const QVariantList& args) : - KCModule(EffectFactory::componentData(), parent, args) -{ - m_ui.setupUi(this); - - addConfig(WobblyWindowsConfig::self(), this); - connect(m_ui.kcfg_WobblynessLevel, SIGNAL(valueChanged(int)), this, SLOT(wobblinessChanged())); - - load(); -} - -WobblyWindowsEffectConfig::~WobblyWindowsEffectConfig() -{ -} - -void WobblyWindowsEffectConfig::save() -{ - KCModule::save(); - - EffectsHandler::sendReloadMessage("wobblywindows"); -} - -void WobblyWindowsEffectConfig::wobblinessChanged() -{ - ParameterSet preset = pset[m_ui.kcfg_WobblynessLevel->value()]; - - m_ui.kcfg_Stiffness->setValue(preset.stiffness); - m_ui.kcfg_Drag->setValue(preset.drag); - m_ui.kcfg_MoveFactor->setValue(preset.move_factor); -} - -} // namespace - -#include "moc_wobblywindows_config.cpp" diff --git a/kwin/effects/wobblywindows/wobblywindows_config.desktop b/kwin/effects/wobblywindows/wobblywindows_config.desktop deleted file mode 100644 index 698663d8..00000000 --- a/kwin/effects/wobblywindows/wobblywindows_config.desktop +++ /dev/null @@ -1,83 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kcm_kwin4_effect_builtins -X-KDE-ParentComponents=kwin4_effect_wobblywindows -X-KDE-PluginKeyword=wobblywindows - -Name=Wobbly Windows -Name[af]=Wobbly Windows -Name[ar]=نوافذ متذبذبة -Name[ast]=Ventanes xelatinoses -Name[be@latin]=Skryŭleńnie akon -Name[bg]=Желирани прозорци -Name[bs]=Lelujavi prozori -Name[ca]=Finestres sacsejades -Name[ca@valencia]=Finestres sacsejades -Name[cs]=Chvějící se okna -Name[csb]=Òkna Wobbly -Name[da]=Blævrende vinduer -Name[de]=Wabernde Fenster -Name[el]=Ταλαντευόμενα παράθυρα -Name[en_GB]=Wobbly Windows -Name[eo]=Tremaj fenestroj -Name[es]=Ventanas gelatinosas -Name[et]=Võbisevad aknad -Name[eu]=Leiho dardartiak -Name[fi]=Heiluvat ikkunat -Name[fr]=Fenêtres en gélatine -Name[fy]=Wobbly Windows -Name[ga]=Fuinneoga Creathacha -Name[gl]=Xanelas a tremer -Name[gu]=વોબલી વિન્ડોઝ -Name[he]=חלונות מתנדנדים -Name[hi]=हिलता-डुलता विंडो -Name[hne]=कांपत विंडो -Name[hr]=Klimavi prozori -Name[hu]=Tekergő ablakok -Name[ia]=Fenestras Tremulante -Name[id]=Jendela Rapuh -Name[is]=Linir gluggar -Name[it]=Finestre tremolanti -Name[ja]=揺れるウィンドウ -Name[kk]=Майысқақ терезелер -Name[km]=បង្អួច​រំញ័រ -Name[kn]=ಅಲ್ಲಾಡುವ ಕಿಟಕಿಗಳು -Name[ko]=흔들리는 창 -Name[ku]=Paceyên Dihejin -Name[lt]=Svirduliuojantys langai -Name[lv]=Ļodzīgie logi -Name[mai]=वोबली विंडो -Name[ml]=ചാഞ്ചാടുന്ന ജാലകങ്ങള്‍ -Name[mr]=थरथरणाऱ्या चौकटी -Name[nb]=Vaklende vinduer -Name[nds]=Wabbelig Finstern -Name[nl]=Wiebelende vensters -Name[nn]=Vaklande vindauge -Name[pa]=ਕੰਬਦੀਆਂ ਵਿੰਡੋਜ਼ -Name[pl]=Chwiejne okna -Name[pt]=Janelas Trémulas -Name[pt_BR]=Janelas instáveis -Name[ro]=Ferestre tremurătoare -Name[ru]=Дрожащие окна -Name[si]=කවුළු සොලවන්න -Name[sk]=Zvlnené okná -Name[sl]=Majava okna -Name[sr]=Лелујави прозори -Name[sr@ijekavian]=Лелујави прозори -Name[sr@ijekavianlatin]=Lelujavi prozori -Name[sr@latin]=Lelujavi prozori -Name[sv]=Ostadiga fönster -Name[ta]=அசைவுடைய சாளரம் -Name[te]=వూబ్లీ విండోస్ -Name[tg]=Тирезаҳои Wobbly -Name[th]=หน้าต่างพริ้วไหว -Name[tr]=Sallanan Pencereler -Name[ug]=تەۋرەنگەن كۆزنەكلەر -Name[uk]=Желейні вікна -Name[wa]=Molès fniesses -Name[x-test]=xxWobbly Windowsxx -Name[zh_CN]=摆动窗口 -Name[zh_TW]=變形視窗 - diff --git a/kwin/effects/wobblywindows/wobblywindows_config.h b/kwin/effects/wobblywindows/wobblywindows_config.h deleted file mode 100644 index 6531c775..00000000 --- a/kwin/effects/wobblywindows/wobblywindows_config.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com> - 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_WOBBLYWINDOWS_CONFIG_H -#define KWIN_WOBBLYWINDOWS_CONFIG_H - -#include <kcmodule.h> - -#include "ui_wobblywindows_config.h" -#include "wobblywindows.h" - - -namespace KWin -{ - -class WobblyWindowsEffectConfig : public KCModule -{ - Q_OBJECT -public: - explicit WobblyWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); - ~WobblyWindowsEffectConfig(); - -public slots: - virtual void save(); - -private slots: - void wobblinessChanged(); - -private: - ::Ui::WobblyWindowsEffectConfigForm m_ui; -}; - -} // namespace - -#endif diff --git a/kwin/effects/wobblywindows/wobblywindows_config.ui b/kwin/effects/wobblywindows/wobblywindows_config.ui deleted file mode 100644 index 0498a641..00000000 --- a/kwin/effects/wobblywindows/wobblywindows_config.ui +++ /dev/null @@ -1,380 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>WobblyWindowsEffectConfigForm</class> - <widget class="QWidget" name="WobblyWindowsEffectConfigForm"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>399</width> - <height>229</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="6" column="0" colspan="2"> - <widget class="QGroupBox" name="advancedGroup"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="title"> - <string>Advanced</string> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>&Stiffness:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>kcfg_Stiffness</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSlider" name="kcfg_Stiffness"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>50</number> - </property> - <property name="value"> - <number>15</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="KIntSpinBox" name="stiffnessSpin"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>50</number> - </property> - <property name="value"> - <number>15</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Dra&g:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>kcfg_Drag</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>&Move factor:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>kcfg_MoveFactor</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSlider" name="kcfg_Drag"> - <property name="minimum"> - <number>50</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>85</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="KIntSpinBox" name="dragSpin"> - <property name="minimum"> - <number>50</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>85</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSlider" name="kcfg_MoveFactor"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>25</number> - </property> - <property name="value"> - <number>10</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="KIntSpinBox" name="moveFactorSpin"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>25</number> - </property> - <property name="value"> - <number>10</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="kcfg_MoveWobble"> - <property name="text"> - <string>Wo&bble when moving</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="kcfg_ResizeWobble"> - <property name="text"> - <string>Wobble when &resizing</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="kcfg_AdvancedMode"> - <property name="text"> - <string>Enable &advanced mode</string> - </property> - </widget> - </item> - <item row="1" column="0" rowspan="5"> - <widget class="QGroupBox" name="basicGroup"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="title"> - <string>&Wobbliness</string> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Less</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSlider" name="kcfg_WobblynessLevel"> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="maximum"> - <number>4</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>More</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>KIntSpinBox</class> - <extends>QSpinBox</extends> - <header>knuminput.h</header> - </customwidget> - </customwidgets> - <tabstops> - <tabstop>kcfg_WobblynessLevel</tabstop> - <tabstop>kcfg_MoveWobble</tabstop> - <tabstop>kcfg_ResizeWobble</tabstop> - <tabstop>kcfg_AdvancedMode</tabstop> - <tabstop>kcfg_Stiffness</tabstop> - <tabstop>stiffnessSpin</tabstop> - <tabstop>kcfg_Drag</tabstop> - <tabstop>dragSpin</tabstop> - <tabstop>kcfg_MoveFactor</tabstop> - <tabstop>moveFactorSpin</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>kcfg_Stiffness</sender> - <signal>valueChanged(int)</signal> - <receiver>stiffnessSpin</receiver> - <slot>setValue(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>304</x> - <y>149</y> - </hint> - <hint type="destinationlabel"> - <x>364</x> - <y>150</y> - </hint> - </hints> - </connection> - <connection> - <sender>stiffnessSpin</sender> - <signal>valueChanged(int)</signal> - <receiver>kcfg_Stiffness</receiver> - <slot>setValue(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>364</x> - <y>150</y> - </hint> - <hint type="destinationlabel"> - <x>304</x> - <y>149</y> - </hint> - </hints> - </connection> - <connection> - <sender>kcfg_Drag</sender> - <signal>valueChanged(int)</signal> - <receiver>dragSpin</receiver> - <slot>setValue(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>304</x> - <y>177</y> - </hint> - <hint type="destinationlabel"> - <x>378</x> - <y>180</y> - </hint> - </hints> - </connection> - <connection> - <sender>dragSpin</sender> - <signal>valueChanged(int)</signal> - <receiver>kcfg_Drag</receiver> - <slot>setValue(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>378</x> - <y>180</y> - </hint> - <hint type="destinationlabel"> - <x>304</x> - <y>177</y> - </hint> - </hints> - </connection> - <connection> - <sender>kcfg_MoveFactor</sender> - <signal>valueChanged(int)</signal> - <receiver>moveFactorSpin</receiver> - <slot>setValue(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>304</x> - <y>205</y> - </hint> - <hint type="destinationlabel"> - <x>378</x> - <y>208</y> - </hint> - </hints> - </connection> - <connection> - <sender>moveFactorSpin</sender> - <signal>valueChanged(int)</signal> - <receiver>kcfg_MoveFactor</receiver> - <slot>setValue(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>378</x> - <y>208</y> - </hint> - <hint type="destinationlabel"> - <x>304</x> - <y>205</y> - </hint> - </hints> - </connection> - <connection> - <sender>kcfg_AdvancedMode</sender> - <signal>toggled(bool)</signal> - <receiver>advancedGroup</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>249</x> - <y>80</y> - </hint> - <hint type="destinationlabel"> - <x>220</x> - <y>131</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/kwin/effects/wobblywindows/wobblywindowsconfig.kcfgc b/kwin/effects/wobblywindows/wobblywindowsconfig.kcfgc deleted file mode 100644 index b6781370..00000000 --- a/kwin/effects/wobblywindows/wobblywindowsconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=wobblywindows.kcfg -ClassName=WobblyWindowsConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/kwin/effects/zoom/zoom.cpp b/kwin/effects/zoom/zoom.cpp index 30a81e4b..ad2c1d87 100644 --- a/kwin/effects/zoom/zoom.cpp +++ b/kwin/effects/zoom/zoom.cpp @@ -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/>. *********************************************************************/ +#include "config-kwin.h" + #include "zoom.h" // KConfigSkeleton #include "zoomconfig.h" @@ -34,8 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <KLocalizedString> #include <KDebug> -#include <kwinglutils.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <kwinxrenderutils.h> #include <xcb/render.h> #endif @@ -129,10 +130,9 @@ ZoomEffect::~ZoomEffect() void ZoomEffect::showCursor() { if (isMouseHidden) { - // show the previously hidden mouse-pointer again and free the loaded texture/picture. + // show the previously hidden mouse-pointer again and free the loaded picture. xcb_xfixes_show_cursor(connection(), rootWindow()); - texture.reset(); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE xrenderPicture.reset(); #endif isMouseHidden = false; @@ -144,13 +144,11 @@ void ZoomEffect::hideCursor() if (mouseTracking == MouseTrackingProportional && mousePointer == MousePointerKeep) return; // don't replace the actual cursor by a static image for no reason. if (!isMouseHidden) { - // try to load the cursor-theme into a OpenGL texture and if successful then hide the mouse-pointer + // try to load the cursor-theme and if successful then hide the mouse-pointer recreateTexture(); bool shouldHide = false; - if (effects->isOpenGLCompositing()) { - shouldHide = !texture.isNull(); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING + if (effects->compositingType() == XRenderCompositing) { +#ifdef KWIN_BUILD_COMPOSITE shouldHide = !xrenderPicture.isNull(); #endif } @@ -179,14 +177,12 @@ void ZoomEffect::recreateTexture() if (!ximg) // default is better then nothing, so keep it as backup ximg = XcursorLibraryLoadImage("left_ptr", "default", iconSize); if (ximg) { - // turn the XcursorImage into a QImage that will be used to create the GLTexture/XRenderPicture. + // turn the XcursorImage into a QImage that will be used to create the XRenderPicture. imageWidth = ximg->width; imageHeight = ximg->height; cursorHotSpot = QPoint(ximg->xhot, ximg->yhot); QImage img((uchar*)ximg->pixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied); - if (effects->isOpenGLCompositing()) - texture.reset(new GLTexture(img)); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() == XRenderCompositing) xrenderPicture.reset(new XRenderPicture(QPixmap::fromImage(img))); #endif @@ -237,9 +233,7 @@ void ZoomEffect::reconfigure(ReconfigureFlags) void ZoomEffect::prePaintScreen(ScreenPrePaintData& data, int time) { - bool altered = false; if (zoom != target_zoom) { - altered = true; const float zoomDist = qAbs(target_zoom - source_zoom); if (target_zoom > zoom) zoom = qMin(zoom + ((zoomDist * time) / animationTime(150*zoomFactor)), target_zoom); @@ -249,9 +243,6 @@ void ZoomEffect::prePaintScreen(ScreenPrePaintData& data, int time) if (zoom == 1.0) { showCursor(); - // reset the generic shader to avoid artifacts in plenty other effects - if (altered && effects->isOpenGLCompositing()) - ShaderBinder binder(ShaderManager::GenericShader, true); } else { hideCursor(); data.mask |= PAINT_SCREEN_TRANSFORMED; @@ -335,15 +326,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) const QPoint p = effects->cursorPos() - cursorHotSpot; QRect rect(p.x() * zoom + data.xTranslation(), p.y() * zoom + data.yTranslation(), w, h); - if (texture) { - texture->bind(); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - texture->render(region, rect); - texture->unbind(); - glDisable(GL_BLEND); - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (xrenderPicture) { #define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) static xcb_render_transform_t xrenderIdentity = { diff --git a/kwin/effects/zoom/zoom.h b/kwin/effects/zoom/zoom.h index e407b166..33999050 100644 --- a/kwin/effects/zoom/zoom.h +++ b/kwin/effects/zoom/zoom.h @@ -22,14 +22,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef KWIN_ZOOM_H #define KWIN_ZOOM_H +#include "config-kwin.h" + #include <kwineffects.h> -#include <QtCore/qdatetime.h> +#include <QDateTime> #include <QTimeLine> namespace KWin { -class GLTexture; class XRenderPicture; class ZoomEffect @@ -117,8 +118,7 @@ private: QPoint prevPoint; QTime lastMouseEvent; QTime lastFocusEvent; - QScopedPointer<GLTexture> texture; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE QScopedPointer<XRenderPicture> xrenderPicture; #endif int imageWidth; diff --git a/kwin/eglonxbackend.cpp b/kwin/eglonxbackend.cpp deleted file mode 100644 index 7674f729..00000000 --- a/kwin/eglonxbackend.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010, 2012 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ -#include "eglonxbackend.h" -// kwin -#include "options.h" -#include "overlaywindow.h" -#include "xcbutils.h" -// kwin libs -#include <kwinglplatform.h> -// KDE -#include <KDebug> -// system -#include <unistd.h> - -namespace KWin -{ - -EglOnXBackend::EglOnXBackend() - : OpenGLBackend() - , ctx(EGL_NO_CONTEXT) - , surfaceHasSubPost(0) - , m_bufferAge(0) -{ - init(); - // Egl is always direct rendering - setIsDirectRendering(true); -} - -EglOnXBackend::~EglOnXBackend() -{ - cleanupGL(); - checkGLError("Cleanup"); - eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(dpy, ctx); - eglDestroySurface(dpy, surface); - eglTerminate(dpy); - eglReleaseThread(); - if (overlayWindow()->window()) { - overlayWindow()->destroy(); - } -} - -static bool gs_tripleBufferUndetected = true; -static bool gs_tripleBufferNeedsDetection = false; - -void EglOnXBackend::init() -{ - if (!initRenderingContext()) { - setFailed("Could not initialize rendering context"); - return; - } - - initEGL(); - if (!hasGLExtension("EGL_KHR_image") && - (!hasGLExtension("EGL_KHR_image_base") || - !hasGLExtension("EGL_KHR_image_pixmap"))) { - setFailed("Required support for binding pixmaps to EGLImages not found, disabling compositing"); - return; - } - GLPlatform *glPlatform = GLPlatform::instance(); - glPlatform->detect(EglPlatformInterface); - if (GLPlatform::instance()->driver() == Driver_Intel) - options->setUnredirectFullscreen(false); // bug #252817 - options->setGlPreferBufferSwap(options->glPreferBufferSwap()); // resolve autosetting - if (options->glPreferBufferSwap() == Options::AutoSwapStrategy) - options->setGlPreferBufferSwap('e'); // for unknown drivers - should not happen - glPlatform->printResults(); - initGL(EglPlatformInterface); - if (!hasGLExtension("GL_OES_EGL_image")) { - setFailed("Required extension GL_OES_EGL_image not found, disabling compositing"); - return; - } - - // check for EGL_NV_post_sub_buffer and whether it can be used on the surface - if (eglPostSubBufferNV) { - if (eglQuerySurface(dpy, surface, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceHasSubPost) == EGL_FALSE) { - EGLint error = eglGetError(); - if (error != EGL_SUCCESS && error != EGL_BAD_ATTRIBUTE) { - setFailed("query surface failed"); - return; - } else { - surfaceHasSubPost = EGL_FALSE; - } - } - } - - setSupportsBufferAge(false); - - if (hasGLExtension("EGL_EXT_buffer_age")) { - const QByteArray useBufferAge = qgetenv("KWIN_USE_BUFFER_AGE"); - - if (useBufferAge != "0") - setSupportsBufferAge(true); - } - - setSyncsToVBlank(false); - setBlocksForRetrace(false); - gs_tripleBufferNeedsDetection = false; - m_swapProfiler.init(); - if (surfaceHasSubPost) { - kDebug(1212) << "EGL implementation and surface support eglPostSubBufferNV, let's use it"; - - if (options->glPreferBufferSwap() != Options::NoSwapEncourage) { - // check if swap interval 1 is supported - EGLint val; - eglGetConfigAttrib(dpy, config, EGL_MAX_SWAP_INTERVAL, &val); - if (val >= 1) { - if (eglSwapInterval(dpy, 1)) { - kDebug(1212) << "Enabled v-sync"; - setSyncsToVBlank(true); - const QByteArray tripleBuffer = qgetenv("KWIN_TRIPLE_BUFFER"); - if (!tripleBuffer.isEmpty()) { - setBlocksForRetrace(qstrcmp(tripleBuffer, "0") == 0); - gs_tripleBufferUndetected = false; - } - gs_tripleBufferNeedsDetection = gs_tripleBufferUndetected; - } - } else { - kWarning(1212) << "Cannot enable v-sync as max. swap interval is" << val; - } - } else { - // disable v-sync - eglSwapInterval(dpy, 0); - } - } else { - /* In the GLX backend, we fall back to using glCopyPixels if we have no extension providing support for partial screen updates. - * However, that does not work in EGL - glCopyPixels with glDrawBuffer(GL_FRONT); does nothing. - * Hence we need EGL to preserve the backbuffer for us, so that we can draw the partial updates on it and call - * eglSwapBuffers() for each frame. eglSwapBuffers() then does the copy (no page flip possible in this mode), - * which means it is slow and not synced to the v-blank. */ - kWarning(1212) << "eglPostSubBufferNV not supported, have to enable buffer preservation - which breaks v-sync and performance"; - eglSurfaceAttrib(dpy, surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - } -} - -bool EglOnXBackend::initRenderingContext() -{ - dpy = eglGetDisplay(display()); - if (dpy == EGL_NO_DISPLAY) - return false; - - EGLint major, minor; - if (eglInitialize(dpy, &major, &minor) == EGL_FALSE) - return false; - -#ifdef KWIN_HAVE_OPENGLES - eglBindAPI(EGL_OPENGL_ES_API); -#else - if (eglBindAPI(EGL_OPENGL_API) == EGL_FALSE) { - kError(1212) << "bind OpenGL API failed"; - return false; - } -#endif - - initBufferConfigs(); - - if (!overlayWindow()->create()) { - kError(1212) << "Could not get overlay window"; - return false; - } else { - overlayWindow()->setup(None); - } - - surface = eglCreateWindowSurface(dpy, config, overlayWindow()->window(), 0); - -#ifdef KWIN_HAVE_OPENGLES - const EGLint context_attribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - - ctx = eglCreateContext(dpy, config, EGL_NO_CONTEXT, context_attribs); -#else - const EGLint context_attribs_31_core[] = { - EGL_CONTEXT_MAJOR_VERSION_KHR, 3, - EGL_CONTEXT_MINOR_VERSION_KHR, 1, - EGL_NONE - }; - - const EGLint context_attribs_legacy[] = { - EGL_NONE - }; - - const QByteArray eglExtensions = eglQueryString(dpy, EGL_EXTENSIONS); - const QList<QByteArray> extensions = eglExtensions.split(' '); - - // Try to create a 3.1 core context - if (options->glCoreProfile() && extensions.contains("EGL_KHR_create_context")) - ctx = eglCreateContext(dpy, config, EGL_NO_CONTEXT, context_attribs_31_core); - - if (ctx == EGL_NO_CONTEXT) - ctx = eglCreateContext(dpy, config, EGL_NO_CONTEXT, context_attribs_legacy); -#endif - - if (ctx == EGL_NO_CONTEXT) { - kError(1212) << "Create Context failed"; - return false; - } - - if (eglMakeCurrent(dpy, surface, surface, ctx) == EGL_FALSE) { - kError(1212) << "Make Context Current failed"; - return false; - } - - kDebug(1212) << "EGL version: " << major << "." << minor; - - EGLint error = eglGetError(); - if (error != EGL_SUCCESS) { - kWarning(1212) << "Error occurred while creating context " << error; - return false; - } - - return true; -} - -bool EglOnXBackend::initBufferConfigs() -{ - const EGLint config_attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_SWAP_BEHAVIOR_PRESERVED_BIT, - EGL_RED_SIZE, 1, - EGL_GREEN_SIZE, 1, - EGL_BLUE_SIZE, 1, - EGL_ALPHA_SIZE, 0, -#ifdef KWIN_HAVE_OPENGLES - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -#else - EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, -#endif - EGL_CONFIG_CAVEAT, EGL_NONE, - EGL_NONE, - }; - - EGLint count; - EGLConfig configs[1024]; - if (eglChooseConfig(dpy, config_attribs, configs, 1024, &count) == EGL_FALSE) { - kError(1212) << "choose config failed"; - return false; - } - - Xcb::WindowAttributes attribs(rootWindow()); - if (!attribs) { - kError(1212) << "Failed to get window attributes of root window"; - return false; - } - - config = configs[0]; - for (int i = 0; i < count; i++) { - EGLint val; - if (eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &val) == EGL_FALSE) { - kError(1212) << "egl get config attrib failed"; - } - if (uint32_t(val) == attribs->visual) { - config = configs[i]; - break; - } - } - return true; -} - -void EglOnXBackend::present() -{ - if (lastDamage().isEmpty()) - return; - - const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); - const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion); - - if (fullRepaint || !surfaceHasSubPost) { - if (gs_tripleBufferNeedsDetection) { - eglWaitGL(); - m_swapProfiler.begin(); - } - // the entire screen changed, or we cannot do partial updates (which implies we enabled surface preservation) - eglSwapBuffers(dpy, surface); - if (gs_tripleBufferNeedsDetection) { - eglWaitGL(); - if (char result = m_swapProfiler.end()) { - gs_tripleBufferUndetected = gs_tripleBufferNeedsDetection = false; - if (result == 'd' && GLPlatform::instance()->driver() == Driver_NVidia) { - // TODO this is a workaround, we should get __GL_YIELD set before libGL checks it - if (qstrcmp(qgetenv("__GL_YIELD"), "USLEEP")) { - options->setGlPreferBufferSwap(0); - eglSwapInterval(dpy, 0); - kWarning(1212) << "\nIt seems you are using the nvidia driver without triple buffering\n" - "You must export __GL_YIELD=\"USLEEP\" to prevent large CPU overhead on synced swaps\n" - "Preferably, enable the TripleBuffer Option in the xorg.conf Device\n" - "For this reason, the tearing prevention has been disabled.\n" - "See https://bugs.kde.org/show_bug.cgi?id=322060\n"; - } - } - setBlocksForRetrace(result == 'd'); - } - } - if (supportsBufferAge()) { - eglQuerySurface(dpy, surface, EGL_BUFFER_AGE_EXT, &m_bufferAge); - } - } else { - // a part of the screen changed, and we can use eglPostSubBufferNV to copy the updated area - foreach (const QRect & r, lastDamage().rects()) { - eglPostSubBufferNV(dpy, surface, r.left(), displayHeight() - r.bottom() - 1, r.width(), r.height()); - } - } - - setLastDamage(QRegion()); - if (!supportsBufferAge()) { - eglWaitGL(); - xcb_flush(connection()); - } -} - -void EglOnXBackend::screenGeometryChanged(const QSize &size) -{ - Q_UNUSED(size) - - // TODO: base implementation in OpenGLBackend - - // The back buffer contents are now undefined - m_bufferAge = 0; -} - -SceneOpenGL::TexturePrivate *EglOnXBackend::createBackendTexture(SceneOpenGL::Texture *texture) -{ - return new EglTexture(texture, this); -} - -QRegion EglOnXBackend::prepareRenderingFrame() -{ - QRegion repaint; - - if (gs_tripleBufferNeedsDetection) { - // the composite timer floors the repaint frequency. This can pollute our triple buffering - // detection because the glXSwapBuffers call for the new frame has to wait until the pending - // one scanned out. - // So we compensate for that by waiting an extra milisecond to give the driver the chance to - // fllush the buffer queue - usleep(1000); - } - - present(); - - if (supportsBufferAge()) - repaint = accumulatedDamageHistory(m_bufferAge); - - startRenderTimer(); - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - - return repaint; -} - -void EglOnXBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) -{ - if (damagedRegion.isEmpty()) { - setLastDamage(QRegion()); - - // If the damaged region of a window is fully occluded, the only - // rendering done, if any, will have been to repair a reused back - // buffer, making it identical to the front buffer. - // - // In this case we won't post the back buffer. Instead we'll just - // set the buffer age to 1, so the repaired regions won't be - // rendered again in the next frame. - if (!renderedRegion.isEmpty()) - glFlush(); - - m_bufferAge = 1; - return; - } - - setLastDamage(renderedRegion); - - if (!blocksForRetrace()) { - // This also sets lastDamage to empty which prevents the frame from - // being posted again when prepareRenderingFrame() is called. - present(); - } else { - // Make sure that the GPU begins processing the command stream - // now and not the next time prepareRenderingFrame() is called. - glFlush(); - } - - if (overlayWindow()->window()) // show the window only after the first pass, - overlayWindow()->show(); // since that pass may take long - - // Save the damaged region to history - if (supportsBufferAge()) - addToDamageHistory(damagedRegion); -} - -/************************************************ - * EglTexture - ************************************************/ - -EglTexture::EglTexture(KWin::SceneOpenGL::Texture *texture, KWin::EglOnXBackend *backend) - : SceneOpenGL::TexturePrivate() - , q(texture) - , m_backend(backend) - , m_image(EGL_NO_IMAGE_KHR) -{ - m_target = GL_TEXTURE_2D; -} - -EglTexture::~EglTexture() -{ - if (m_image != EGL_NO_IMAGE_KHR) { - eglDestroyImageKHR(m_backend->dpy, m_image); - } -} - -OpenGLBackend *EglTexture::backend() -{ - return m_backend; -} - -void EglTexture::findTarget() -{ - if (m_target != GL_TEXTURE_2D) { - m_target = GL_TEXTURE_2D; - } -} - -bool EglTexture::loadTexture(const Pixmap &pix, const QSize &size, int depth) -{ - Q_UNUSED(depth) - if (pix == None) - return false; - - glGenTextures(1, &m_texture); - q->setWrapMode(GL_CLAMP_TO_EDGE); - q->setFilter(GL_LINEAR); - q->bind(); - const EGLint attribs[] = { - EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, - EGL_NONE - }; - m_image = eglCreateImageKHR(m_backend->dpy, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)pix, attribs); - - if (EGL_NO_IMAGE_KHR == m_image) { - kDebug(1212) << "failed to create egl image"; - q->unbind(); - q->discard(); - return false; - } - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)m_image); - q->unbind(); - checkGLError("load texture"); - q->setYInverted(true); - m_size = size; - updateMatrix(); - return true; -} - -void KWin::EglTexture::onDamage() -{ - if (options->isGlStrictBinding()) { - // This is just implemented to be consistent with - // the example in mesa/demos/src/egl/opengles1/texture_from_pixmap.c - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) m_image); - } - GLTexturePrivate::onDamage(); -} - -} // namespace diff --git a/kwin/eglonxbackend.h b/kwin/eglonxbackend.h deleted file mode 100644 index c2ca2ff6..00000000 --- a/kwin/eglonxbackend.h +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ -#ifndef KWIN_EGL_ON_X_BACKEND_H -#define KWIN_EGL_ON_X_BACKEND_H -#include "scene_opengl.h" - -namespace KWin -{ - -/** - * @brief OpenGL Backend using Egl windowing system over an X overlay window. - **/ -class EglOnXBackend : public OpenGLBackend -{ -public: - EglOnXBackend(); - virtual ~EglOnXBackend(); - virtual void screenGeometryChanged(const QSize &size); - virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture); - virtual QRegion prepareRenderingFrame(); - virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion); - -protected: - virtual void present(); - -private: - void init(); - bool initBufferConfigs(); - bool initRenderingContext(); - EGLDisplay dpy; - EGLConfig config; - EGLSurface surface; - EGLContext ctx; - int surfaceHasSubPost; - int m_bufferAge; - friend class EglTexture; -}; - -/** - * @brief Texture using an EGLImageKHR. - **/ -class EglTexture : public SceneOpenGL::TexturePrivate -{ -public: - virtual ~EglTexture(); - virtual void onDamage(); - virtual void findTarget(); - virtual bool loadTexture(const Pixmap& pix, const QSize& size, int depth); - virtual OpenGLBackend *backend(); - -private: - friend class EglOnXBackend; - EglTexture(SceneOpenGL::Texture *texture, EglOnXBackend *backend); - SceneOpenGL::Texture *q; - EglOnXBackend *m_backend; - EGLImageKHR m_image; -}; - -} // namespace - -#endif // KWIN_EGL_ON_X_BACKEND_H diff --git a/kwin/events.cpp b/kwin/events.cpp index 8bb7bc70..ae8f8de3 100644 --- a/kwin/events.cpp +++ b/kwin/events.cpp @@ -1053,10 +1053,8 @@ bool Client::buttonPressEvent(xcb_window_t w, int button, int state, int x, int return processDecorationButtonPress(button, state, x, y, x_root, y_root, true); } if (w == decorationId()) { - if (dynamic_cast<KDecorationUnstable*>(decoration)) - // New API processes core events FIRST and only passes unused ones to the decoration - return processDecorationButtonPress(button, state, x, y, x_root, y_root, true); - return false; + // New API processes core events FIRST and only passes unused ones to the decoration + return processDecorationButtonPress(button, state, x, y, x_root, y_root, true); } if (w == frameId()) processDecorationButtonPress(button, state, x, y, x_root, y_root); diff --git a/kwin/glxbackend.cpp b/kwin/glxbackend.cpp deleted file mode 100644 index 49bc4395..00000000 --- a/kwin/glxbackend.cpp +++ /dev/null @@ -1,719 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org> -Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org> - -Based on glcompmgr code by Felix Bellaby. -Using code from Compiz and Beryl. - -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/>. -*********************************************************************/ - -// TODO: cmake magic -#ifndef KWIN_HAVE_OPENGLES -// own -#include "glxbackend.h" -// kwin -#include "options.h" -#include "utils.h" -#include "overlaywindow.h" -// kwin libs -#include <kwinglplatform.h> -// KDE -#include <KDebug> -#include <KXErrorHandler> -// system -#include <unistd.h> - -namespace KWin -{ -GlxBackend::GlxBackend() - : OpenGLBackend() - , window(None) - , fbconfig(NULL) - , glxWindow(None) - , ctx(0) - , m_bufferAge(0) - , haveSwapInterval(false) -{ - init(); -} - -GlxBackend::~GlxBackend() -{ - // TODO: cleanup in error case - // do cleanup after initBuffer() - cleanupGL(); - checkGLError("Cleanup"); - glXMakeCurrent(display(), None, NULL); - - if (ctx) - glXDestroyContext(display(), ctx); - - if (glxWindow) - glXDestroyWindow(display(), glxWindow); - - if (window) - XDestroyWindow(display(), window); - - overlayWindow()->destroy(); -} - -static bool gs_tripleBufferUndetected = true; -static bool gs_tripleBufferNeedsDetection = false; - -void GlxBackend::init() -{ - initGLX(); - // require at least GLX 1.3 - if (!hasGLXVersion(1, 3)) { - setFailed("Requires at least GLX 1.3"); - return; - } - if (!initDrawableConfigs()) { - setFailed("Could not initialize the drawable configs"); - return; - } - if (!initBuffer()) { - setFailed("Could not initialize the buffer"); - return; - } - if (!initRenderingContext()) { - setFailed("Could not initialize rendering context"); - return; - } - // Initialize OpenGL - GLPlatform *glPlatform = GLPlatform::instance(); - glPlatform->detect(GlxPlatformInterface); - if (GLPlatform::instance()->driver() == Driver_Intel) - options->setUnredirectFullscreen(false); // bug #252817 - options->setGlPreferBufferSwap(options->glPreferBufferSwap()); // resolve autosetting - if (options->glPreferBufferSwap() == Options::AutoSwapStrategy) - options->setGlPreferBufferSwap('e'); // for unknown drivers - should not happen - glPlatform->printResults(); - initGL(GlxPlatformInterface); - - // Check whether certain features are supported - haveSwapInterval = glXSwapIntervalMESA || glXSwapIntervalEXT || glXSwapIntervalSGI; - - setSupportsBufferAge(false); - - if (hasGLExtension("GLX_EXT_buffer_age")) { - const QByteArray useBufferAge = qgetenv("KWIN_USE_BUFFER_AGE"); - - if (useBufferAge != "0") - setSupportsBufferAge(true); - } - - setSyncsToVBlank(false); - setBlocksForRetrace(false); - haveWaitSync = false; - gs_tripleBufferNeedsDetection = false; - m_swapProfiler.init(); - const bool wantSync = options->glPreferBufferSwap() != Options::NoSwapEncourage; - if (wantSync && glXIsDirect(display(), ctx)) { - if (haveSwapInterval) { // glXSwapInterval is preferred being more reliable - setSwapInterval(1); - setSyncsToVBlank(true); - const QByteArray tripleBuffer = qgetenv("KWIN_TRIPLE_BUFFER"); - if (!tripleBuffer.isEmpty()) { - setBlocksForRetrace(qstrcmp(tripleBuffer, "0") == 0); - gs_tripleBufferUndetected = false; - } - gs_tripleBufferNeedsDetection = gs_tripleBufferUndetected; - } else if (glXGetVideoSync) { - unsigned int sync; - if (glXGetVideoSync(&sync) == 0 && glXWaitVideoSync(1, 0, &sync) == 0) { - setSyncsToVBlank(true); - setBlocksForRetrace(true); - haveWaitSync = true; - } else - qWarning() << "NO VSYNC! glXSwapInterval is not supported, glXWaitVideoSync is supported but broken"; - } else - qWarning() << "NO VSYNC! neither glSwapInterval nor glXWaitVideoSync are supported"; - } else { - // disable v-sync (if possible) - setSwapInterval(0); - } - if (glPlatform->isVirtualBox()) { - // VirtualBox does not support glxQueryDrawable - // this should actually be in kwinglutils_funcs, but QueryDrawable seems not to be provided by an extension - // and the GLPlatform has not been initialized at the moment when initGLX() is called. - glXQueryDrawable = NULL; - } - - setIsDirectRendering(bool(glXIsDirect(display(), ctx))); - - kDebug(1212) << "Direct rendering:" << isDirectRendering() << endl; -} - -bool GlxBackend::initRenderingContext() -{ - bool direct = options->isGlDirect(); - - // Use glXCreateContextAttribsARB() when it's available - if (glXCreateContextAttribsARB) { - const int attribs_31_core_robustness[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX_CONTEXT_MINOR_VERSION_ARB, 1, - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB, - GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB, - 0 - }; - - const int attribs_31_core[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX_CONTEXT_MINOR_VERSION_ARB, 1, - 0 - }; - - const int attribs_legacy_robustness[] = { - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB, - GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB, - 0 - }; - - const int attribs_legacy[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 1, - GLX_CONTEXT_MINOR_VERSION_ARB, 2, - 0 - }; - - const bool have_robustness = hasGLExtension("GLX_ARB_create_context_robustness"); - - // Try to create a 3.1 context first - if (options->glCoreProfile()) { - if (have_robustness) - ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs_31_core_robustness); - - if (!ctx) - ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs_31_core); - } - - if (!ctx && have_robustness) - ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs_legacy_robustness); - - if (!ctx) - ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs_legacy); - } - - if (!ctx) - ctx = glXCreateNewContext(display(), fbconfig, GLX_RGBA_TYPE, NULL, direct); - - if (!ctx) { - kDebug(1212) << "Failed to create an OpenGL context."; - return false; - } - - if (!glXMakeCurrent(display(), glxWindow, ctx)) { - kDebug(1212) << "Failed to make the OpenGL context current."; - glXDestroyContext(display(), ctx); - ctx = 0; - return false; - } - - return true; -} - -bool GlxBackend::initBuffer() -{ - if (!initFbConfig()) - return false; - - if (overlayWindow()->create()) { - // Try to create double-buffered window in the overlay - XVisualInfo* visual = glXGetVisualFromFBConfig(display(), fbconfig); - if (!visual) { - kError(1212) << "Failed to get visual from fbconfig"; - return false; - } - XSetWindowAttributes attrs; - attrs.colormap = XCreateColormap(display(), rootWindow(), visual->visual, AllocNone); - window = XCreateWindow(display(), overlayWindow()->window(), 0, 0, displayWidth(), displayHeight(), - 0, visual->depth, InputOutput, visual->visual, CWColormap, &attrs); - glxWindow = glXCreateWindow(display(), fbconfig, window, NULL); - overlayWindow()->setup(window); - XFree(visual); - } else { - kError(1212) << "Failed to create overlay window"; - return false; - } - - int vis_buffer; - glXGetFBConfigAttrib(display(), fbconfig, GLX_VISUAL_ID, &vis_buffer); - XVisualInfo* visinfo_buffer = glXGetVisualFromFBConfig(display(), fbconfig); - kDebug(1212) << "Buffer visual (depth " << visinfo_buffer->depth << "): 0x" << QString::number(vis_buffer, 16); - XFree(visinfo_buffer); - - return true; -} - -bool GlxBackend::initFbConfig() -{ - const int attribs[] = { - GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_ALPHA_SIZE, 0, - GLX_DEPTH_SIZE, 0, - GLX_STENCIL_SIZE, 0, - GLX_CONFIG_CAVEAT, GLX_NONE, - GLX_DOUBLEBUFFER, true, - 0 - }; - - // Try to find a double buffered configuration - int count = 0; - GLXFBConfig *configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs, &count); - - if (count > 0) { - fbconfig = configs[0]; - XFree(configs); - } - - if (fbconfig == NULL) { - kError(1212) << "Failed to find a usable framebuffer configuration"; - return false; - } - - return true; -} - -bool GlxBackend::initDrawableConfigs() -{ - const int attribs[] = { - GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT | GLX_PIXMAP_BIT, - GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, - GLX_X_RENDERABLE, True, - GLX_CONFIG_CAVEAT, int(GLX_DONT_CARE), // The ARGB32 visual is marked non-conformant in Catalyst - GLX_RED_SIZE, 5, - GLX_GREEN_SIZE, 5, - GLX_BLUE_SIZE, 5, - GLX_ALPHA_SIZE, 0, - GLX_STENCIL_SIZE, 0, - GLX_DEPTH_SIZE, 0, - 0 - }; - - int count = 0; - GLXFBConfig *configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs, &count); - - if (count < 1) { - kError(1212) << "Could not find any usable framebuffer configurations."; - return false; - } - - for (int i = 0; i <= 32; i++) { - fbcdrawableinfo[i].fbconfig = NULL; - fbcdrawableinfo[i].bind_texture_format = 0; - fbcdrawableinfo[i].texture_targets = 0; - fbcdrawableinfo[i].y_inverted = 0; - fbcdrawableinfo[i].mipmap = 0; - } - - // Find the first usable framebuffer configuration for each depth. - // Single-buffered ones will appear first in the list. - const int depths[] = { 15, 16, 24, 30, 32 }; - for (unsigned int i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) { - const int depth = depths[i]; - - for (int j = 0; j < count; j++) { - int alpha_size, buffer_size; - glXGetFBConfigAttrib(display(), configs[j], GLX_ALPHA_SIZE, &alpha_size); - glXGetFBConfigAttrib(display(), configs[j], GLX_BUFFER_SIZE, &buffer_size); - - if (buffer_size != depth && (buffer_size - alpha_size) != depth) - continue; - - if (depth == 32 && alpha_size != 8) - continue; - - XVisualInfo *vi = glXGetVisualFromFBConfig(display(), configs[j]); - if (vi == NULL) - continue; - - int visual_depth = vi->depth; - XFree(vi); - - if (visual_depth != depth) - continue; - - int bind_rgb, bind_rgba; - glXGetFBConfigAttrib(display(), configs[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &bind_rgba); - glXGetFBConfigAttrib(display(), configs[j], GLX_BIND_TO_TEXTURE_RGB_EXT, &bind_rgb); - - // Skip this config if it cannot be bound to a texture - if (!bind_rgb && !bind_rgba) - continue; - - int texture_format; - if (depth == 32) - texture_format = bind_rgba ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT; - else - texture_format = bind_rgb ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT; - - int y_inverted, texture_targets; - glXGetFBConfigAttrib(display(), configs[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &texture_targets); - glXGetFBConfigAttrib(display(), configs[j], GLX_Y_INVERTED_EXT, &y_inverted); - - fbcdrawableinfo[depth].fbconfig = configs[j]; - fbcdrawableinfo[depth].bind_texture_format = texture_format; - fbcdrawableinfo[depth].texture_targets = texture_targets; - fbcdrawableinfo[depth].y_inverted = y_inverted; - fbcdrawableinfo[depth].mipmap = 0; - break; - } - } - - if (count) - XFree(configs); - - if (fbcdrawableinfo[DefaultDepth(display(), DefaultScreen(display()))].fbconfig == NULL) { - kError(1212) << "Could not find a framebuffer configuration for the default depth."; - return false; - } - - if (fbcdrawableinfo[32].fbconfig == NULL) { - kError(1212) << "Could not find a framebuffer configuration for depth 32."; - return false; - } - - for (int i = 0; i <= 32; i++) { - if (fbcdrawableinfo[i].fbconfig == NULL) - continue; - - int vis_drawable = 0; - glXGetFBConfigAttrib(display(), fbcdrawableinfo[i].fbconfig, GLX_VISUAL_ID, &vis_drawable); - - kDebug(1212) << "Drawable visual (depth " << i << "): 0x" << QString::number(vis_drawable, 16); - } - - return true; -} - -void GlxBackend::setSwapInterval(int interval) -{ - if (glXSwapIntervalEXT) - glXSwapIntervalEXT(display(), glxWindow, interval); - else if (glXSwapIntervalMESA) - glXSwapIntervalMESA(interval); - else if (glXSwapIntervalSGI) - glXSwapIntervalSGI(interval); -} - -void GlxBackend::waitSync() -{ - // NOTE that vsync has no effect with indirect rendering - if (haveWaitSync) { - uint sync; -#if 0 - // TODO: why precisely is this important? - // the sync counter /can/ perform multiple steps during glXGetVideoSync & glXWaitVideoSync - // but this only leads to waiting for two frames??!? - glXGetVideoSync(&sync); - glXWaitVideoSync(2, (sync + 1) % 2, &sync); -#else - glXWaitVideoSync(1, 0, &sync); -#endif - } -} - -void GlxBackend::present() -{ - if (lastDamage().isEmpty()) - return; - - const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); - const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion); - - if (fullRepaint) { - if (haveSwapInterval) { - if (gs_tripleBufferNeedsDetection) { - glXWaitGL(); - m_swapProfiler.begin(); - } - glXSwapBuffers(display(), glxWindow); - if (gs_tripleBufferNeedsDetection) { - glXWaitGL(); - if (char result = m_swapProfiler.end()) { - gs_tripleBufferUndetected = gs_tripleBufferNeedsDetection = false; - if (result == 'd' && GLPlatform::instance()->driver() == Driver_NVidia) { - // TODO this is a workaround, we should get __GL_YIELD set before libGL checks it - if (qstrcmp(qgetenv("__GL_YIELD"), "USLEEP")) { - options->setGlPreferBufferSwap(0); - setSwapInterval(0); - kWarning(1212) << "\nIt seems you are using the nvidia driver without triple buffering\n" - "You must export __GL_YIELD=\"USLEEP\" to prevent large CPU overhead on synced swaps\n" - "Preferably, enable the TripleBuffer Option in the xorg.conf Device\n" - "For this reason, the tearing prevention has been disabled.\n" - "See https://bugs.kde.org/show_bug.cgi?id=322060\n"; - } - } - setBlocksForRetrace(result == 'd'); - } - } - } else { - waitSync(); - glXSwapBuffers(display(), glxWindow); - } - if (supportsBufferAge()) { - glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge); - } - } else if (glXCopySubBuffer) { - foreach (const QRect & r, lastDamage().rects()) { - // convert to OpenGL coordinates - int y = displayHeight() - r.y() - r.height(); - glXCopySubBuffer(display(), glxWindow, r.x(), y, r.width(), r.height()); - } - } else { // Copy Pixels (horribly slow on Mesa) - glDrawBuffer(GL_FRONT); - SceneOpenGL::copyPixels(lastDamage()); - glDrawBuffer(GL_BACK); - } - - setLastDamage(QRegion()); - if (!supportsBufferAge()) { - glXWaitGL(); - XFlush(display()); - } -} - -void GlxBackend::screenGeometryChanged(const QSize &size) -{ - glXMakeCurrent(display(), None, NULL); - - XMoveResizeWindow(display(), window, 0, 0, size.width(), size.height()); - overlayWindow()->setup(window); - XSync(display(), false); - - glXMakeCurrent(display(), glxWindow, ctx); - glViewport(0, 0, size.width(), size.height()); - - // The back buffer contents are now undefined - m_bufferAge = 0; -} - -SceneOpenGL::TexturePrivate *GlxBackend::createBackendTexture(SceneOpenGL::Texture *texture) -{ - return new GlxTexture(texture, this); -} - -QRegion GlxBackend::prepareRenderingFrame() -{ - QRegion repaint; - - if (gs_tripleBufferNeedsDetection) { - // the composite timer floors the repaint frequency. This can pollute our triple buffering - // detection because the glXSwapBuffers call for the new frame has to wait until the pending - // one scanned out. - // So we compensate for that by waiting an extra milisecond to give the driver the chance to - // fllush the buffer queue - usleep(1000); - } - - present(); - - if (supportsBufferAge()) - repaint = accumulatedDamageHistory(m_bufferAge); - - startRenderTimer(); - glXWaitX(); - - return repaint; -} - -void GlxBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) -{ - if (damagedRegion.isEmpty()) { - setLastDamage(QRegion()); - - // If the damaged region of a window is fully occluded, the only - // rendering done, if any, will have been to repair a reused back - // buffer, making it identical to the front buffer. - // - // In this case we won't post the back buffer. Instead we'll just - // set the buffer age to 1, so the repaired regions won't be - // rendered again in the next frame. - if (!renderedRegion.isEmpty()) - glFlush(); - - m_bufferAge = 1; - return; - } - - setLastDamage(renderedRegion); - - if (!blocksForRetrace()) { - // This also sets lastDamage to empty which prevents the frame from - // being posted again when prepareRenderingFrame() is called. - present(); - } else { - // Make sure that the GPU begins processing the command stream - // now and not the next time prepareRenderingFrame() is called. - glFlush(); - } - - if (overlayWindow()->window()) // show the window only after the first pass, - overlayWindow()->show(); // since that pass may take long - - // Save the damaged region to history - if (supportsBufferAge()) - addToDamageHistory(damagedRegion); -} - - -/******************************************************** - * GlxTexture - *******************************************************/ -GlxTexture::GlxTexture(SceneOpenGL::Texture *texture, GlxBackend *backend) - : SceneOpenGL::TexturePrivate() - , q(texture) - , m_backend(backend) - , m_glxpixmap(None) -{ -} - -GlxTexture::~GlxTexture() -{ - if (m_glxpixmap != None) { - if (!options->isGlStrictBinding()) { - glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT); - } - glXDestroyPixmap(display(), m_glxpixmap); - m_glxpixmap = None; - } -} - -void GlxTexture::onDamage() -{ - if (options->isGlStrictBinding() && m_glxpixmap) { - glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT); - glXBindTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT, NULL); - } - GLTexturePrivate::onDamage(); -} - -void GlxTexture::findTarget() -{ - unsigned int new_target = 0; - if (glXQueryDrawable && m_glxpixmap != None) - glXQueryDrawable(display(), m_glxpixmap, GLX_TEXTURE_TARGET_EXT, &new_target); - // HACK: this used to be a hack for Xgl. - // without this hack the NVIDIA blob aborts when trying to bind a texture from - // a pixmap icon - if (new_target == 0) { - if (GLTexture::NPOTTextureSupported() || - (isPowerOfTwo(m_size.width()) && isPowerOfTwo(m_size.height()))) { - new_target = GLX_TEXTURE_2D_EXT; - } else { - new_target = GLX_TEXTURE_RECTANGLE_EXT; - } - } - switch(new_target) { - case GLX_TEXTURE_2D_EXT: - m_target = GL_TEXTURE_2D; - m_scale.setWidth(1.0f / m_size.width()); - m_scale.setHeight(1.0f / m_size.height()); - break; - case GLX_TEXTURE_RECTANGLE_EXT: - m_target = GL_TEXTURE_RECTANGLE_ARB; - m_scale.setWidth(1.0f); - m_scale.setHeight(1.0f); - break; - default: - abort(); - } -} - -bool GlxTexture::loadTexture(const Pixmap& pix, const QSize& size, int depth) -{ -#ifdef CHECK_GL_ERROR - checkGLError("TextureLoad1"); -#endif - if (pix == None || size.isEmpty() || depth < 1) - return false; - if (m_backend->fbcdrawableinfo[ depth ].fbconfig == NULL) { - kDebug(1212) << "No framebuffer configuration for depth " << depth - << "; not binding pixmap" << endl; - return false; - } - - m_size = size; - // new texture, or texture contents changed; mipmaps now invalid - q->setDirty(); - -#ifdef CHECK_GL_ERROR - checkGLError("TextureLoad2"); -#endif - // tfp mode, simply bind the pixmap to texture - glGenTextures(1, &m_texture); - // The GLX pixmap references the contents of the original pixmap, so it doesn't - // need to be recreated when the contents change. - // The texture may or may not use the same storage depending on the EXT_tfp - // implementation. When options->glStrictBinding is true, the texture uses - // a different storage and needs to be updated with a call to - // glXBindTexImageEXT() when the contents of the pixmap has changed. - int attrs[] = { - GLX_TEXTURE_FORMAT_EXT, m_backend->fbcdrawableinfo[ depth ].bind_texture_format, - GLX_MIPMAP_TEXTURE_EXT, m_backend->fbcdrawableinfo[ depth ].mipmap > 0, - None, None, None - }; - // Specifying the texture target explicitly is reported to cause a performance - // regression with R300G (see bug #256654). - if (GLPlatform::instance()->driver() != Driver_R300G) { - if ((m_backend->fbcdrawableinfo[ depth ].texture_targets & GLX_TEXTURE_2D_BIT_EXT) && - (GLTexture::NPOTTextureSupported() || - (isPowerOfTwo(size.width()) && isPowerOfTwo(size.height())))) { - attrs[ 4 ] = GLX_TEXTURE_TARGET_EXT; - attrs[ 5 ] = GLX_TEXTURE_2D_EXT; - } else if (m_backend->fbcdrawableinfo[ depth ].texture_targets & GLX_TEXTURE_RECTANGLE_BIT_EXT) { - attrs[ 4 ] = GLX_TEXTURE_TARGET_EXT; - attrs[ 5 ] = GLX_TEXTURE_RECTANGLE_EXT; - } - } - m_glxpixmap = glXCreatePixmap(display(), m_backend->fbcdrawableinfo[ depth ].fbconfig, pix, attrs); -#ifdef CHECK_GL_ERROR - checkGLError("TextureLoadTFP1"); -#endif - findTarget(); - m_yInverted = m_backend->fbcdrawableinfo[ depth ].y_inverted ? true : false; - m_canUseMipmaps = m_backend->fbcdrawableinfo[ depth ].mipmap > 0; - q->setFilter(m_backend->fbcdrawableinfo[ depth ].mipmap > 0 ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST); - glBindTexture(m_target, m_texture); -#ifdef CHECK_GL_ERROR - checkGLError("TextureLoadTFP2"); -#endif - glXBindTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT, NULL); -#ifdef CHECK_GL_ERROR - checkGLError("TextureLoad0"); -#endif - - updateMatrix(); - - unbind(); - return true; -} - -OpenGLBackend *GlxTexture::backend() -{ - return m_backend; -} - -} // namespace -#endif diff --git a/kwin/glxbackend.h b/kwin/glxbackend.h deleted file mode 100644 index 98538c30..00000000 --- a/kwin/glxbackend.h +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ -#ifndef KWIN_GLX_BACKEND_H -#define KWIN_GLX_BACKEND_H -#include "scene_opengl.h" - -namespace KWin -{ - -class FBConfigInfo -{ -public: - GLXFBConfig fbconfig; - int bind_texture_format; - int texture_targets; - int y_inverted; - int mipmap; -}; - -/** - * @brief OpenGL Backend using GLX over an X overlay window. - **/ -class GlxBackend : public OpenGLBackend -{ -public: - GlxBackend(); - virtual ~GlxBackend(); - virtual void screenGeometryChanged(const QSize &size); - virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture); - virtual QRegion prepareRenderingFrame(); - virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion); - -protected: - virtual void present(); - -private: - void init(); - bool initBuffer(); - bool initDrawableConfigs(); - void waitSync(); - bool initRenderingContext(); - bool initFbConfig(); - void setSwapInterval(int interval); - - Window window; - FBConfigInfo fbcdrawableinfo[ 32 + 1 ]; - GLXFBConfig fbconfig; - GLXWindow glxWindow; - GLXContext ctx; - int m_bufferAge; - bool haveSwapInterval, haveWaitSync; - friend class GlxTexture; -}; - -/** - * @brief Texture using an GLXPixmap. - **/ -class GlxTexture : public SceneOpenGL::TexturePrivate -{ -public: - virtual ~GlxTexture(); - virtual void onDamage(); - virtual void findTarget(); - virtual bool loadTexture(const Pixmap& pix, const QSize& size, int depth); - virtual OpenGLBackend *backend(); - -private: - friend class GlxBackend; - GlxTexture(SceneOpenGL::Texture *texture, GlxBackend *backend); - SceneOpenGL::Texture *q; - GlxBackend *m_backend; - GLXPixmap m_glxpixmap; // the glx pixmap the texture is bound to -}; - -} // namespace -#endif // KWIN_GLX_BACKEND_H diff --git a/kwin/kcmkwin/kwincompositing/kwincompositing.desktop b/kwin/kcmkwin/kwincompositing/kwincompositing.desktop index 718b9f05..2dd0fe06 100644 --- a/kwin/kcmkwin/kwincompositing/kwincompositing.desktop +++ b/kwin/kcmkwin/kwincompositing/kwincompositing.desktop @@ -179,42 +179,42 @@ Comment[x-test]=xxConfigure desktop effectsxx Comment[zh_CN]=配置桌面效果 Comment[zh_TW]=設定桌面效果 -X-KDE-Keywords=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect -X-KDE-Keywords[bs]=kwin,prozor,menadžer,slaganje,efekti,3D efekti,2D efekti,OpenGL,XRender,Postavke videa,grafički efekti,desktop efekti,animacije ,razne animacije ,upravljanje efektima prozora,window switching effect,desktop switching effect,animacije ,brzina animacije,desktop animacije ,drajveri,podešavanje drajvera,vizualizacije,pružanje,invert efekti,Efekt igranja sa prozorima (looking glass effect),efekt povećala,snap helper effect,igranje sa strelicom miše efekti ,efekti povećavanja,efekti magljenja,efekti kontrolne ploče,efekti eksplozije,efekt izbljeđivanja,izbljeđivanje desktopa,efekti raspadanja,efekt klizanja, efekt naglašavanja prozora,login efekt,logout efekt,magični efek, teffect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect -X-KDE-Keywords[ca]=kwin,finestra,gestor,composició,efecte,efectes 3D,efectes 2D,OpenGL,XRender,arranjament de vídeo,efectes gràfics,efectes d'escriptori,animacions,animacions diverses,efectes de gestió de finestra,efecte de canvi de finestra,efecte de canvi d'escriptori,animacions,velocitat d'animació,animacions d'escriptori,controladors,configuració de controladors,renderització,render,efecte d'inversió,efecte d'aparença de vidre,efecte de lupa,efecte ajudant de desplaçament,efecte de seguiment de ratolí,efecte de zoom,efecte de difuminat,efecte de tauler,efecte d'explosió,efecte d'esvaïment,efecte d'esvaïment d'escriptori,efecte de trencament,efecte de lliscament,efecte de ressaltat de finestra,efecte de connexió,efecte de desconnexió,efecte de làmpada màgica,efecte d'animació de minimització,efecte de marca de ratolí,efecte d'apropament,efecte de captura de pantalla,efecte de full,efecte de diapositiva,efecte de missatges emergents lliscants,efecte de miniatures de barra de tasques,efecte de miniatures laterals,translucidesa,efecte de translucidesa,transparència,efecte de geometria de finestra,efecte de finestres sacsejades,efecte de confirmació d'engegada,efecte de diàleg principal,efecte d'enfosquiment d'inactiu,efecte d'enfosquiment de pantalla, efecte de diapositiva prèvia,decoració,efecte per mostrar FPS,efecte de mostra de pintat,efecte de quadre de commutació,efecte de canvi de coberta,efecte de cub d'escriptori,efecte d'animació de cub d'escriptori,efecte de graella d'escriptori,efecte de canvi en roda,efecte de contorn,efecte de presentació de finestres,efecte de redimensió de finestra -X-KDE-Keywords[ca@valencia]=kwin,finestra,gestor,composició,efecte,efectes 3D,efectes 2D,OpenGL,XRender,arranjament de vídeo,efectes gràfics,efectes d'escriptori,animacions,animacions diverses,efectes de gestió de finestra,efecte de canvi de finestra,efecte de canvi d'escriptori,animacions,velocitat d'animació,animacions d'escriptori,controladors,configuració de controladors,renderització,render,efecte d'inversió,efecte d'aparença de vidre,efecte de lupa,efecte ajudant de desplaçament,efecte de seguiment de ratolí,efecte de zoom,efecte de difuminat,efecte de tauler,efecte d'explosió,efecte d'esvaïment,efecte d'esvaïment d'escriptori,efecte de trencament,efecte de lliscament,efecte de ressaltat de finestra,efecte de connexió,efecte de desconnexió,efecte de làmpada màgica,efecte d'animació de minimització,efecte de marca de ratolí,efecte d'apropament,efecte de captura de pantalla,efecte de full,efecte de diapositiva,efecte de missatges emergents lliscants,efecte de miniatures de barra de tasques,efecte de miniatures laterals,translucidesa,efecte de translucidesa,transparència,efecte de geometria de finestra,efecte de finestres sacsejades,efecte de confirmació d'engegada,efecte de diàleg principal,efecte d'enfosquiment d'inactiu,efecte d'enfosquiment de pantalla, efecte de diapositiva prèvia,decoració,efecte per mostrar FPS,efecte de mostra de pintat,efecte de quadre de commutació,efecte de canvi de coberta,efecte de cub d'escriptori,efecte d'animació de cub d'escriptori,efecte de graella d'escriptori,efecte de canvi en roda,efecte de contorn,efecte de presentació de finestres,efecte de redimensió de finestra -X-KDE-Keywords[da]=kwin,vindue,vindueshåndtering,compositing,effekter,3D-effekter,2D-effekter,OpenGL,XRender,grafiske effekter,skrivebordseffekter,animationer,diverse animationer,vindueshåndteringseffekter,effekt til skift af vinduer,effekt til skrivebordsskift,animationshastighed,skrivebordsanimationer,drivere,driverindstillinger,rendering,render,invertereffect,kikkerteffekt,forstørrelsesglaseffekt,hægtehjælpereffekt,følg musen-effekt,zoomeffect,sløreffekt,instrumentbræt,eksplosionseffekt,fade-effect,svæve-effect,fremhæv vindue-effekt,login-effekt,log ud-effekt,magisk lampe-effekt,minimer-effekt,musemærke-effekt,skalerind-effekt,skærmbillede-effekt,glide-effekt,glidende pop-op-effekt,opgavelinjeminiaturer-effekt,gennemsigtighed,transparens,ugennemsigtighed,vinduesgeometri-effekt,wobbly,blævrende vinduer,eye candy,øjeguf,vis FPS-effekt,cube,terning,gitter -X-KDE-Keywords[de]=KWin,Fenster,Verwaltung,Compositing,Effekt,2D-Effekte,3D-Effekte,OpenGL,XRender,Videoeinstellungen,Gradische Effekte,Desktopeffekte,Arbeitsflächeneffekte,Animation,Fensterverwaltungs-Effekte,Fensterwechsel-Effekte,Decktopwechsel,Arbeitsflächenwechsel,Animationsgeschwindigkeit,Deskto-Animation,Arbeitsflächen-Animation,Treiber,Treibereinstellung,Rendering,Rendern,Invertierungseffekt,Bildschirmlupeneffekt,Vergrößerungseffekt,Einrasteffekt,Maus folgen,Zooneffekt,Dashboard.Effekt,Explosionseffekt,Überblendungseffekt,Gleiteneffekt,Fensterhervorhebungs-Effekt,Anmeldungseffekt,Abmeldungseffekt,Animierter Minimierungseffekt,Mausmarkierungseffekt,Skalierungseffekt,Bildschirmeffekt,Blatteffekt,Folieneffekt,Vorschaueffekt der Kontrollleiste,Vorschaueffekt,Durchsichtigkeit,Durchsichtigkeitseffekt,Fenstergeometrieffekt,Effekt Wabernde Fenster,Programmstartanzeigeneffekt,Inaktiveffekt,Bildschirmabdunkelungseffekt,FPS-Effekt,Zeichnungsbereicheffekt,Kasten mit Minibilderneffekt,3D-Fenstergalerieeffekt,Desktopgittereffekt,3D-Fensterstapelumschalteffekt,Umrisseffekt,Fensteranzeigeeffekt,Fenstergrößenänderungseffekt -X-KDE-Keywords[el]=kwin,παράθυρο,διαχειριστής,σύνθεσης,εφέ,3D εφέ,2D εφέ,OpenGL,XRender,ρυθμίσεις βίντεο,γραφικά εφέ,εφέ επιφάνειας εργασίας,κινούμενες εικόνες,διάφορες κινούμενες εικόνες,εφέ διαχείρισης παραθύρου,εφέ εναλλαγής παραθύρου,εφέ εναλλαγής επιφάνειας εργασίας,κινούμενες εικόνες,ταχύτητα κινούμενων εικόνων,κινούμενες εικόνες επιφάνειας εργασίας,οδηγοί,ρυθμίσεις οδηγών,αποτύπωση,αποτύπωση,αναστροφή εφέ,εφέ μεγεθυντικού φακού,εφέ μεγέθυνσης,εφέ χειριστή snap,εφέ ίχνους ποντικιού,εφέ ζουμ,εφέ θόλωσης,εφέ πίνακα,εφέ έκρηξης,εφέ εξασθένισης,εφέ εξασθένισης επιφάνειας εργασίας,εφέ κατεδάφισης,εφέ ολίσθησης,εφέ τονισμού παραθύρου,εφέ εισόδου,εφέ εξόδου,εφέ μαγικής λάμπας,εφέ ελαχιστοποίησης κινούμενων εικόνων,εφέ σημείωσης με ποντίκι,εφέ κλιμάκωσης,εφέ στιγμιότυπου,εφέ φύλλου,εφέ κύλισης,εφέ κυλιόμενων αναδυόμενων,εφέ εικόνων επισκόπησης γραμμής εργασιών,εφέ παράπλευρων εικόνων επισκόπησης,διαύγεια,εφέ διαύγειας,διαφάνεια,εφέ γεωμετρίας παραθύρου,εφέ ταλαντευόμενων παραθύρων,εφέ ανάδρασης έναρξης,εφέ προγόνου διαλόγου,εφέ θαμπού αδρανούς,εφέ θολής οθόνης,εφέ πίσω κύλισης,eye candy,candy,εφέ εμφάνισης FPS,εφέ εμφάνισης σχεδιασμάτων,εφέ εναλλαγής πλαισίου,εφέ καλυμμένης εναλλαγής,εφέ κύβου επιφάνειας εργασίας,εφέ κινούμενων εικόνων κύβου επιφάνειας εργασίας,εφέ καννάβου επιφάνειας εργασίας,εφέ εναλλαγής στοίβας,εφέ περιγράμματος,εφέ παρουσίας παραθύρου,εφέ αλλαγής μεγέθους παραθύρου -X-KDE-Keywords[en_GB]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect -X-KDE-Keywords[es]=kwin,ventana,gestor,composición,efecto,efectos 3D,efectos 2D,OpenGL,XRender,preferencias de vídeo,efectos gráficos,efectos del escritorio,animaciones,animaciones diversas,efectos de la gestión de ventanas,efecto de cambio de ventana,efecto de cambio de escritorio,velocidad de animación,animaciones del escritorio,controladores,preferencias del controlador,renderización,renderizar,efecto de inversión,efecto de espejo,efecto de lupa,efecto auxiliar de instantánea,efecto de seguimiento del ratón,efecto de ampliación,efecto borroso,efecto del tablero de mandos,efecto de explosión,efecto de desvanecimiento,efecto de desvanecimiento del escritorio,efecto de romper en pedazos,efecto de planeo,efecto de resaltar ventanas,efecto de inicio de sesión,efecto de final de sesión,efecto de lámpara mágica,efecto de animación al minimizar,efecto de marcas del ratón,efecto de escalado,efecto de captura de pantalla,efecto de hoja,efecto de deslizamiento,efecto de ventanas emergentes deslizantes,efecto de miniaturas de la barra de tareas,efecto de miniaturas laterales,transparencia,efecto de transparencia,efecto de geometría de las ventanas,efecto de ventanas gelatinosas,efecto de notificación de inicio,efecto de padre de la ventana,efecto de oscurecer inactiva,efecto de oscurecer la pantalla,efecto atrás,efectos atractivos,efecto de mostrar FPS,efecto de mostrar pintura,efecto de selección de ventana en caja,efecto de selección de ventana en modo carátula,efecto de cubo del escritorio,efecto de animación del cubo del escritorio,efecto de rejilla del escritorio,efecto de selección de ventana en modo cascada,efecto de contorno,efecto de presentación de ventanas,efecto de cambiar tamaño de las ventanas -X-KDE-Keywords[et]=kwin,aken,hakdur,komposiit,efekt,3D efektid,ruumilised efektid,2D efektid,OpenGL,XRender,videoseadistused,graafikaefektid,töölauaefektid,animatsioonid,eri animatsioonid,aknahaldusefektid,akna lülitamise efekt,töölaua lülitamise efekt,animatsioonid,animatsiooni kiirus,töölauaanimatsioonid,draiverid,draiveri seadistused,renderdamine,renderdus,inverteerimisefekt,pikksilmaefekt,suurendusklaasiefekt,tõmbe abistaja efekt,hiire jälgimise efekt,suurendusefekt,häguefekt,vidinavaate efekt,plahvatuseefekt,hääbumisefekt,töölaua kadumise efekt,lagunemise efekt,liuglemisefekt,akna esiletõstmise efekt,sisselogimisefekt,väljalogimisefekt,maagilise laterna efekt,minimeerimisanimatsiooni efekt,hiirega tähistamise efekt,skaleerimisefekt,ekraanipildi efekt,leheefekt,slaidiefekt,liuglevate hüpikakende efekt,tegumiriba pisipiltide efekt,kõrvalasuvate pisipiltide efekt,läbipaistvus,läbipaistvuseefekt,akende geomeetria efekt,vonklevate akende efekt,käivitamise tagasiside efekt,dialoogi eellase efekt,tuhmi mitteaktiivse efekt,tuhmi ekraani efekt,tagasiliugumise efekt,silmarõõm,FPS-i näitamise efekt,joonistamise näitamise efekt,kastina lülitamise efekt,vaiplülitamise efekt,töölauakuubiku efekt, töölauakuubiku animatsiooni efekt,töölauavõrgustiku efekt,pööramisega lülitamise efekt,kontuuriefekt,aktiivsete akende efekt, akende suuruse muutmise efekt -X-KDE-Keywords[eu]=kwin,leiho,kudeatzaile,konposizio,efektu,3D efektu,2D efektu,OpenGL,XRender,bideo-ezarpen,efektu grafiko,mahaigaineko efektu,animazio,hainbat animazio,leikoak kudeatzeko efektu,leihoz aldatzeko efektu,mahaigainez aldatzeko efektu,animazio-abiadura,mahaigaineko animazio,kontrolatzaile,kontrolatzaileen ezarpen,errendatze,errendatu,alderantzikatze-efektu,pantaila-lupa efektu,lupa-efektu,kokatze-laguntzailearen efektu,jarraitu saguari efektu,handitu efektu,lausotu efektu,aginte-panela efektu,leherketa efektu,iraungitze-efektu,iraungi mahaigaina efektu,hautsi efektu,lerratu efektu,nabarmendu leihoa efektu,saio-hasiera efektu,saio-amaiera efektu,lanpara magikoa efektu,ikonotzeko animazioa efektu,sagu-marka efektu,eskalatu efektu,pantaila-argazkia efektu,orria efektu,irristatu efektu,leiho gainerakorrak irristatzeko efektu,ataza-barraren koadro txikiak efektu,koadro txikiak alboan efektu,zehargarritasun, zehargarritasun efektu,gardentasun,leihoen geometria efektu,leiho dardartien efektu,abioko oharra efektu,elkarrizketa-koadroaren gurasoa efektu,ilundu inaktiboak efektu,ilundu pantaila efektu,irristatu atzera efektu,bistarako gozagarri,gozagarri,erakutsi FPS efektu,erakutsi pintatua efektu,kaxa aldaketa efektu,3Dko leiho-galeria efektu,mahaigain kuboa efektua, mahaigain kuboaren animazioa efektu,mahaigain-sareta efektu,leiho pila efektu,ingerada efektu,aurkeztu leihoak efektu,tamaina aldatu efektu -X-KDE-Keywords[fi]=kwin,ikkuna,ohjelma,ikkunointi,ikkunointiohjelma,ikkunanhallinta,koostaminen,tehoste,3D-tehosteet,2D-tehosteet,3U-tehosteet,2U-tehosteet,OpenGL,XRender,videoasetukset,kuva-asetukset,graafiset tehosteet,työpöytätehosteet,animaatiot,animoinnit,useita animaatioita,eri animaatiot,ikkunanhallintatehosteet,ikkunan vaihtotehoste,työpöydän vaihtotehoste,animaatiot,animoinnit,animointinopeus,työpöytäanimaatiot,ajurit,ajuriasetukset,piirtojärjestelmä,renderöijä,renderoija,piirtäminen,renderöinti,renderointi,käänteisten värien tehoste,suurennuslasitehoste,pikaopastajatehoste,hiiren jäljitystehoste,zoomaustehoste,sumennustehoste,kojelautatehoste,räjähdystehoste,häivtytystehoste,työpöydän häivytystehoste,hajoamistehoste,ikkunaliukutehoste,ikkunan korostustehoste,sisäänkirjautumistehosteuloskirjautumistehoste,taikalampputehoste,pienennysanimaatiotehoste,hiiren jäljet -tehoste,skaalaustehoste,kuvankaappaustehoste,arkkitehoste,liu’utustehoste,liukuvat ponnahdusikkunat -tehoste,tehtäväpalkin esikatselukuvat -tehoste,esikatselukuva vieressä -tehoste,läpikuultavuus,läpinäkyvyys,läpikuultavuustehoste,läpinäkyvyystehoste,ikkunan mitat -tehoste,heiluvat ikkunat -tehoste,käynnistymisen ilmaisemisen tehoste,isäikkunatehoste,passiivisen himmennystehoste,näytön himmennystehoste,taakse liu’utus -tehoste,silmäkarkki,karkki,FPS-näyttötehoste,näytä FPS -tehoste,piirtämisen näyttämistehoste,laatikkovaihtajatehoste,levykansivaihtajatehoste,työpöytäkuutiotehoste,työpöytäkuutioanimaatiotehoste,työpöydän ruudukko -tehoste,kääntövaihtajatehoste,ääriviivatehoste,ikkunoiden esittämistehoste,ikkunan koon muuttamistehoste,window,manager,compositing,effect,3D effects,2D effects,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect -X-KDE-Keywords[fr]=kwin, fenêtre, gestionnaire, composition, effet, effets 3D, effets 2D, OpenGL, XRender, paramètres vidéo, effets graphiques, effets de bureau, animations, animations variés, effets de gestion des fenêtres, effets de changement de fenêtre, effets de changement de bureau, animations, vitesse des animations, animation du bureau, pilotes, paramètres du pilote, rendu, rendre, effet d'inversion, effet de verre, effet de loupe, effet d'aide au positionnement, effet de repérage de la souris, effet de zoom,effet de flou, effet du tableau de bord, effet d'explosion, effet de fondu, effet de fondu du bureau, effet d'effondrement, effet de glissement, effet de mise en valeur de la fenêtre, effet de connexion, effet de déconnexion, effet de lampe magique, effet de minimisation de l'application, effet de marque de la souris, effet de gradation, effet de capture d'écran, effet de feuille, effet de glisse, effet d'annotations glissantes, effet d'aperçu de la barre de tâche, effet d'aperçu sur le coté,translucidité, effet de translucidité, transparence, effet de géométrie de la fenêtre, effet de fenêtre en gélatine, effet du témoin de démarrage, effet de dialogue parent, effet d'obscurcissement de fenêtre inactive, effet d'obscurcissement du bureau, effet de glissement en arrière, confort visuel, beauté, effet d'affichage du FPS, effet d'affichage des zones peintes, effet de défilement dans une boîte, effet de défilement circulaire, effet de bureaux en cube, effet d'animation de cube de bureaux, effet de bureaux en grille, effet d'empilement en perspective, effet d'esquisse, effet de présentation des fenêtres, effet de redimensionnement des fenêtres -X-KDE-Keywords[gl]=kwin,xanela,xestor,composición,efecto,efectos 3D,efectos 2D,OpenGl,XRender, configuración da imaxe,efectos gráficos, efectos do escritorio, animacións, efectos da xestión das xanelas,troco de xanela,animación,velocidade,controlador, render -X-KDE-Keywords[hu]=kwin,ablak,kezelő,kompozitálás,hatás,3D hatás,2D hatás,OpenGL,XRender,videobeállítások,grafikai hatások,asztali hatások,animációk,különféle animációk,ablakkezelő hatások,ablakváltó hatások,asztalváltó hatások,animációk,animáció sebesség,asztali animációk,meghajtók,meghajtó beállítások,leképezés,renderelés,fordított hatás,tükörhatás,nagyító hatás,elkapás segítő hatás,egérkövetés hatás,nagyítás hatás,elmosás hatás,áttekintő hatás,robbanás hatás,elhalványulás hatás,asztal elhalványulása hatás,széteső hatás,csúszás hatás,ablak kiemelése hatás,belépés hatás,kilépés hatás,varázslámpa hatás,minimalizálás animáció hatás,egérjelölés hatás,méretezés hatás,képernyőkép hatás,munkalap hatás,dia hatás,csúszó felugrók hatás,feladatsáv bélyegképek hatás,bélyegképek félre hatás,áttetszőség,áttetszőség hatás,átlátszóság,ablak geometria hatás,ingó ablak hatás,indulási visszajelzés hatás,párbeszédablak szülő hatás,dim inaktív hatás,dim kijelző hatás,dia vissza hatás,látványelem,édesség,FPS megjelenítése hatás,festék megjelenése hatás,dobozváltás hatás,eltakarás váltás hatás,asztal kocka hatás,asztal kockaanimáció hatás,asztal rács hatás,tükrözésváltás hatás,körvonal hatás,jelenlegi ablakok hatás,ablak átméretezése hatás -X-KDE-Keywords[ia]=kwin,fenestra,gerente,componente,effecto,effectos 3D,effectos 2D,OpenGL,XRender,preferentias de video,effectos graphic,effectos de scriptorio,animationes,varie animationes,effectos de gestion de genestra,effecto de commutation de fenestra, effecto de commutation de scriptorio,animationes,velocitate de animation,animationes de scriptorio,drivers, preferentias de driver,rendering,render,effecto de inverter,effecto speculo,effecto aggrandor,effecto de adjuta de photo (snap),effecto de tracia de mus,effecto zoom,effecto indistincte,effecto tabuliero,effecto explosion,effecto discolorate,effect de scriptorio discolorate,effecto de collapsar,effecto glissante, effecto de fenestra evidentiare,effecto de authenticar se,effecto de clauder session ,effecto lampada magic,minimisa effecto de animation,effecto de marca de mus,effecto de scalar,effecto de captura schermo,effecto folio,effecto diapositiva, effecto de popups glissante,effecto de miniatura de barra de carga,effecto de miniatura a parte,translucentia, effecto translucentia,transparentia, effecto de geometria de fenestra, effecto de fenestra tremulante,effecto de retro action, effecto de geniytor de dialogo, effecto inactive obscur, effecto de schermo obscur,effecto de retro glissar,eye candy,candy,monstra effecto FPS,monstra effecto pictura, effecto commuta cassa,effecto de commuta coperturat,effecto cubo de scriptorio,animation de cubo de scriptorio,effecto grillia de scriptorio,effecto flip switch,effecto contorno,effecto de fenestra actual,effect de fenestra redimensionante -X-KDE-Keywords[it]=kwin,finestra,gestore,composizione,effetto,effetti 3D,effetti 2D,OpenGL,XRender,impostazioni video,effetti grefici,effetti desktop,animazioni,animazioni varie, effetti del gestore delle finestre,effetto dello scambiafinestre, effetto dello scambiatore di desktop,animazioni,velocità animazioni,animazioni desktop,driver,impostazioni driver,disegno,rendering,effetto invertito,effetto vetro,effetto lente,effetto snap helper,effetto evidenzia mouse,effetto ingrandimento, effetto sfocatura,effetto quadro degli strumenti,effetto esplosione,effetto dissolvenza,effetto dissolvenza desktop,effetto caduta,effetto planatura,effetto evidenziazione finestra,effetto schermata di accesso, effetto disconnessione,effetto lampada magica,effetto animazione di minimizzazione,effetto tracciatura mouse, effetto scalatura,effetto istantanea,effetto foglio,effetto diapositiva,effetto scivolamento,effetto icone nella barra delle applicazioni,effetto miniatura su un lato,translucenza,effetto translucenza, trasparenza,effetto geometria finestra,effetto finestre tremolanti,effetto segnale di avvio,effetto finestra padre,effetto oscura finestra inattiva,effetto oscura schermo,effetto scivola all'indietro,gradevole,effetto gradevole,effetto mostra FPS,effetto ridisegno,effetto scambio cubi,effetto scambio copertina,effetto cubi del desktop,effetto animazione cubi del desktop,effetto griglia desktop,effetto scambiatore con inversione,effetto riquadro,effetto finestra presente,effetto ridimensionamento finestra -X-KDE-Keywords[kk]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect -X-KDE-Keywords[km]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect -X-KDE-Keywords[ko]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,창,관리자,컴포지팅,효과,3D 효과,2D 효과,비디오 설정,그래픽 효과,데스크톱 효과,애니메이션,창 관리자,창 관리자 효과,데스크톱 전환,데스크톱 전환 효과,드라이버,드라이버 설정,렌더링,렌더링 설정,애니메이션 속도,투명 유리 효과,확대 축소 효과,흐림 효과,대시보드 효과,폭발 효과,페이드 효과,로그인 효과,창 강조 효과,글라이드 효과,로그아웃 효과,램프 효과,시트 효과,최소화 효과,최대화 효과,팝업 효과 -X-KDE-Keywords[nb]=kwin,vindusbehandler,sammensetting,effekt,3D-effekter,2D-effekter,OpenGL,XRender,videoinnstillinger,grafiske effekter,skrivebordseffekter,animasjoner,diverse animasjoner,vindusbytteeffekter,effekter ved skrivebordsbytte,animasjoner,animasjonsfart,skrivebordsanimasjoner,drivere,driverinnstillinger,opptegning,opptegner,inverteringseffekt,speileffekt,lupeeffekt,gripehjelpereffekt,musesporeffekt,forstørreeffekt,sløreffekt,kontrollpulteffekt,eksplosjonseffekt,uttoningseffekt,skrivebordtoningseffekt,henfallseffekt,glidereffekt,framhev vindu-effekt,innlogingseffekt,utloggingsefffekt,magisk lampe-effekt, animasjonseffekt ved vindusminimering,musmerkeeffekt,innskaleringseffekt,skjermdumpeffekt,ark-effekt,lysbildeeffekt,glidende oppspretteffekt,effekt for minibilder på oppgavelinja,effekt for minibilder på siden,gjennomskinnelighetseffekt,gjennomsiktighet,vindusgeometri-effekt,skjelvende vinduer-effekt,effekt for oppstartsmelding,effekt for foreldredialog,effekt for mørk inaktiv,effekt for mørk skjerm,gli tilbake-effekt,øyesnop,snop,vis FPS-effekt,vis malingseffekt,boksbytteeffekt,lokkbytteeffekt,skrivebordsterning-effekt,effekt for animert skrivebordsterning,effekt for skrivebordsruter,effekt for flipp-bytte,omriss-effekt,effekt for vinduer tilstede,effekt for vinduer som endrer størrelse -X-KDE-Keywords[nds]=KWin,Finster,Pleger,Tosamensetten,Effekt,3D,2D,OpenGL,XRender,Videoinstellen,graafsche Effekten,Schriefdisch,Animeren,wesseln,Finsterwesseln,Schriefdischwesseln,Gauigkeit,Drievers,Dorstellen,ümdreihen,Kiekglas,Luup,andocken,Muusspoor,Grötter maken,Ansichtgrött,verwischen,Exploschoon,Utblennen,Uteneenbreken,glieden,markeren,anmellen,afmellen,magisch lamp,minimeren,Muusmark,Schirmfoto,Programmbalken,Vöransichten,Dörschienen,Finstergeometrie,Wabbeligkeit,Start,Torüchmelen,Böverfinster,Dialoog,afdüüstern,Ogenzucker,FPS,Kist,Schriefdischwörpel,Gadder,Dörgahn,Ümdreihen,Ümreet,Grött ännern -X-KDE-Keywords[nl]=kwin,venster,beheerder,compositing,effect,3D effecten,2D effecten,OpenGL,XRender,video-instellingen,grafische effecten,bureaubladeffecten,animaties,verrschillende animaties,vensterbeheereffecten,vensteromschakeleffect, bureaublad-omschakeleffect,animaties,animatiesnelheid,bureaubladanimaties,stuurprogramma's,stuurprogramma-instellingen,rendering,render,inversieeffect,vergrootglaseffect,vergrotingseffect,snaphelpereffect,trackmuiseffect,zoomeffect,vervagingseffect,dashboardeffect,explosie-effect,uitvaageffect,uitvaagbureaubladeffect,uiteenvaleffect,glijeffect,vebsteraccentueringseffect,aanmeldeffect,afmeldeffect,magische lampeffect,animatie-effect minimaliseren,muismarkeringseffect,inschaaleffect,schermafdrukeffect,bladeneffect,diaeffect,glijdende pop-upseffect,taakbalkminiatuureffect,miniatuur-opzijeffect,doorzichtigheid,doorzichtigheidseffect,transparantie,vensterafmetingeneffect,wiebelende vensterseffect,opstartterugkoppeleffect,dialoogoudereffect,dim bij inactiviteitseffect,dim het schermeffect,schuif terugeffect,oogstrelend,snoepgoed,FPS toneneffect,verf toneneffect,vak omschakeleffect,deksel schakelaareffect,bureaublad kubuseffect,bureaublad kubus animatie-effect,bureaubladrastereffect,omschakeleffect,omrandingeffect,huidig venstereffect, wijzig grootte van venstereffect -X-KDE-Keywords[pl]=kwin,okno,menadżer,kompozycje,efekt,efekty 3D,efekty 2D,OpenGL,XRender, ustawienia wideo,efekty graficzne,efekty pulpitu,animacje,różne animacje,efekty zarządzania oknami,efekty przełączania okien,efekty przełączania pulpitów,animacje, szybkość animacji,animacje pulpitu,sterowniki,ustawienia sterowników,renderowania, efekt odwrócenia,szkło powiększające,efekt powiększenia,efekt pomocnika przyciągania, efekt śledzenia myszy,efekt przybliżenia,efekt rozmycia,efekt tablicy,efekt eksplozji,efekt zanikania,efekt zanikania pulpitu,efekt rozpadania,efekt slajdu,efekt podświetlania okna, efekt logowania,efekt wylogowywania,efekt magicznej lampy,efekt animacji minimalizacji, efekt znacznika myszy,efekt skalowania,efekt zrzutu ekranu,efekt arkusza,efekt slajdu,efekt wysuwających się elementów wyskakujących,efekt prześwitywania,przezroczystość,efekt geometrii okna,efekt chwiejnych okien,efekt odczuć przy starcie,efekt okna rodzica,efekt przyciemniania nieaktywnych,efekt przyciemniania ekranu,efekt przesuwania do tył,efekt pokazania ilości klatek na sekundę -X-KDE-Keywords[pt]=kwin,janela,gestor,composição,efeito,efeitos 3D,efeitos 2D,OpenGL,XRender,configuração do vídeo,efeitos gráficos,efeitos do ecrã,animações,animações diversas,efeitos de gestão das janelas,efeito de mudança de janelas,efeito de mudança de ecrãs,animações,velocidade da animação,animações do ecrã,controladores,configuração dos controladores,desenho,efeito de inversão,efeito de lupa,efeito de lente,efeito de ajuda no ajuste, efeito de seguimento do rato,efeito de ampliação,efeito de borrão,efeito de quadro,efeito de explosão,efeito de desvanecimento,efeito de desvanecimento do ecrã,efeito de destruição,efeito de deslizamento,efeito de realce da janela,efeito na autenticação,efeito do encerramento,efeito de lâmpada mágica,efeito de animação na minimização,efeito de marcação com rato,efeito de escala,efeito de captura do ecrã,efeito de folha,efeito de mensagens deslizantes,efeito de miniaturas na barra de tarefas,efeito de miniaturas laterais,efeito de janelas a tremer,efeito do arranque inicial,efeito da janela-mãe,efeito de escurecimento de janelas inactivas,efeito de deslize para trás,efeitos visuais,beleza,efeito de apresentação das IPS,efeito de pintura,efeito de mudança em caixa,efeito de mudança de capas, efeito de animação do cubo do ecrã,efeito de grelha do ecrã,efeito de mudança por viragem,efeito de destaque,efeito de apresentação das janelas,efeito de dimensionamento das janelas -X-KDE-Keywords[pt_BR]=kwin,janela,gerenciador,composição,efeito,efeitos 3D,efeitos 2D,OpenGL, XRender,configuração do vídeo,efeitos gráficos,efeitos da área de trabalho,animações,diversas animações,efeitos do gerenciamento das janelas,efeito de mudança da janela,efeito de mudança de área de trabalho,animações,velocidade da animação,animações da área de trabalho,controladores,drivers,configuração do driver,desenho,efeito de inversão,efeito de lupa,efeito de lente,efeito de ajuste,efeito de seguimento do mouse,efeito de ampliação,efeito de borrão,efeito de quadro,efeito de explosão,efeito de desvanecimento,efeito de desvanecimento da área de trabalho,efeito de queda,efeito de deslizamento,efeito de realce da janela,efeito de autenticação,efeito de encerramento da sessão,efeito de lâmpada mágica,efeito de animação da minimização,efeito de marcação do mouse,efeito de ampliação,efeito de captura de tela,efeito de folha,efeito de deslizamento,efeito de janelas deslizantes,efeito de miniaturas das tarefas,efeito de miniatura ao lado,translucidez,efeito de translucidez,transparência,efeito de geometria da janela,efeito de janelas ondulantes,efeito de reação à inicialização,efeito da janela-mãe,efeito de escurecimento da janela inativa,efeito de escurecimento da tela,efeito de deslizamento para trás,efeitos visuais,visuais,efeito para mostrar FPS,efeito de pintura,efeito de mudança em caixa,efeito de mudança em capas,efeito de cubo da área de trabalho,efeito de animação do cubo da área de trabalho,efeito da grade da área de trabalho,efeito de virada de página,efeito de realce,efeito de apresentação das janelas,efeito de dimensionamento das janelas -X-KDE-Keywords[ru]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,окно,диспетчер,графический,эффект,3D эффект,2D эффект,параметры видео,графические эффекты,эффекты рабочего стола,анимация,эффекты управления окнами,эффект переключения окна,эффект переключения рабочих столов,анимация,скорость анимации,анимация рабочего стола,драйверы,параметры драйверов,рендеринг,визуализация,цветопередача,режим инверсии,эффект зеркала,эффект лупы,эффект разметки экрана,эффект движения мыши на экране, эффект масштабирования,эффект размытия,приборная доска,эффект взрыва,эффект затухания,эффект затухания рабочего стола,эффект распада,эффект скольжения,подсветка окна,вход в систему,выход из системы,эффект волшебной лампы,анимация сворачивания,рисование мышью,анимация появления,снимок экрана,вкладки,эффект скольжения,анимация всплывающих окон,миниатюра окна у панели задач,миниатюра окна на краю экрана,полупрозрачность,прозрачность,геометрия окна,дрожащие окна, отклик запуска приложения,затемнение основного окна,затемнение неактивных окон,затемнение экрана,эффект выскальзывания,украшения,красивые,график производительности,подсвечивать отрисовку,переключение с миниатюрами,карусель,куб с рабочими столами,анимация куба с рабочими столами,все рабочие столы,перелистывание,контур,окна в кнопке,все окна,изменение размера окна -X-KDE-Keywords[sk]=kwin, okno, manažér, kompozícia, efekt, 3D efekty, 2D efekty, OpenGL, XRender,nastavenia obrazu, grafické efekty, desktop efekty, animácie, rôzneanimácie, efekty správa okien, okno prepínanie efektov, stolnýspínacie efekt, animácie, animácie rýchlosť, stolný animácie, ovládače,nastavenie ovládača, renderovanie, poskytnúť, invertný skutočnosti zrkadlá účinok,lupa efekt, snap pomocník efekt, trať myš efekt, zoom efekt, rozmazaniuúčinok, prístrojová doska efekt, výbuch efekt, fade efekt, fade stolný efekt,rozpadnúť účinok, zostupovej efekt, zvýraznenie okno efekt, efekt prihlásenie, odhlásenieúčinok, čarovnú lampu účinok, minimálny efekt animácie, myši značky efekt, mierkav skutočnosti, screenshot efekt, list efekt, snímka efekt, posuvné vyskakovacie okná účinok,miniatúry na hlavnom paneli efekt, náhľad stranou efekt, priesvitnosť, translucencieúčinok, transparentnosť, okno geometrie efekt, vratkú okná efekt, uvedenie do prevádzkyspätná väzba, dialóg rodič efekt, matný efekt neaktívny, stlmiť obrazovku efekt,posunutím zadnej efekt, pastva pre oči, cukrík zobraziť FPS efekt, zobrazovať farby efekt, boxprepínač efekt, kryt prepínače účinok, desktop, desktop cube efekt kocky animácieúčinok, Desktop Grid efekt, flip switch efekt, obrys účinok, súčasné oknáúčinok, zmena veľkosti okna efekt -X-KDE-Keywords[sl]=kwin,upravljalnik oken,skladanje,učinek,učinki 3d,učinki 2d,opengl,xrender,grafične nastavitve,grafični učinki,namizni učinki,animacije,upravljanje z okni,preklapljanje oken,preklapljanje namizij,hitrost animacij,namizne animacije,gonilniki,izrisovanje,obrni,povečevalno steklo,pripenjalni pomagalnik,sledenje miški,približanje,zabriši,nadzorna plošča,eksplozija,pojemanje,pojemanje namizja,razpad,drsenje,poudari okno,učinek prijave,učinek odjave,čarobna svetilka,animacija skrčenja,risanje,animirano pojavljanje,zaslonska slika,list,drsenje,drseča pojavna okna,sličice za opravilno vrstico,sličica ob strani,prosojnost,prozornost,geometrija okna,majava okna,odziv zagona,nadrejeno pogovorno okno,potemni nedejavno,potemni zaslon,zdrs v ozadje,vidni bonbončki,pokaži sličice na sekundo,izrisovanje,preklapljanje - škatla,preklapljanje - ovitki,kocka z namizji,animacija kocka z namizji,mreža namizij,preklapljanje - sklad,oris,predstavi okna,spreminjanje velikosti okna -X-KDE-Keywords[sr]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,К‑вин,прозор,менаџер,слагање,ефекат,3Д ефекти,2Д ефекти,опенГЛ,Икс‑рендер,видео поставке,графички ефекти,ефекти површи,анимације,разне анимације,ефекти управљања прозорима,ефекти мењања прозора,ефекти мењања површи,анимације,брзина анимације,анимације површи,драјвери,поставке драјвера,рендеровање,исцртавање,ефекат извртања,ефекат лупе,ефекат уклапања,ефекат праћења миша,ефекат увеличања,ефекат замућења,инструмент-табла,ефекат експлозије,ефекат утапања,ефеката утапања површи,ефекат распадања,ефекат распарчавања,ефекат клизања,ефекат истицања прозора,ефекат пријављивања,ефекат одјављивања,ефекат магичне лампе,ефекат минимизовања,ефекат трагова миша,ефекат скалирања,ефекат снимка екрана,ефекат листа,ефекат клизања,ефекат клизајућих искакача,ефекат ефекат сличица на траци задатака,ефекат прозирности,прозирност,провидност,ефекат геометрије прозора,ефекат лелујајућих прозора,ефекат одзива покретања,ефекат родитељског дијалог,ефекат потамњења неактивног,ефекат потамњења екрана,шминка,ефекат приказивања,ефекат кутијастог пребацивања,ефекат коцке површи,ефекат анимације коцке површи,ефекат мреже површи,ефекат превртања,ефекат представљања прозора,ефекат промене величине прозора -X-KDE-Keywords[sr@ijekavian]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,К‑вин,прозор,менаџер,слагање,ефекат,3Д ефекти,2Д ефекти,опенГЛ,Икс‑рендер,видео поставке,графички ефекти,ефекти површи,анимације,разне анимације,ефекти управљања прозорима,ефекти мењања прозора,ефекти мењања површи,анимације,брзина анимације,анимације површи,драјвери,поставке драјвера,рендеровање,исцртавање,ефекат извртања,ефекат лупе,ефекат уклапања,ефекат праћења миша,ефекат увеличања,ефекат замућења,инструмент-табла,ефекат експлозије,ефекат утапања,ефеката утапања површи,ефекат распадања,ефекат распарчавања,ефекат клизања,ефекат истицања прозора,ефекат пријављивања,ефекат одјављивања,ефекат магичне лампе,ефекат минимизовања,ефекат трагова миша,ефекат скалирања,ефекат снимка екрана,ефекат листа,ефекат клизања,ефекат клизајућих искакача,ефекат ефекат сличица на траци задатака,ефекат прозирности,прозирност,провидност,ефекат геометрије прозора,ефекат лелујајућих прозора,ефекат одзива покретања,ефекат родитељског дијалог,ефекат потамњења неактивног,ефекат потамњења екрана,шминка,ефекат приказивања,ефекат кутијастог пребацивања,ефекат коцке површи,ефекат анимације коцке површи,ефекат мреже површи,ефекат превртања,ефекат представљања прозора,ефекат промене величине прозора -X-KDE-Keywords[sr@ijekavianlatin]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,KWin,prozor,menadžer,slaganje,efekat,3D efekti,2D efekti,OpenGL,XRender,video postavke,grafički efekti,efekti površi,animacije,razne animacije,efekti upravljanja prozorima,efekti menjanja prozora,efekti menjanja površi,animacije,brzina animacije,animacije površi,drajveri,postavke drajvera,renderovanje,iscrtavanje,efekat izvrtanja,efekat lupe,efekat uklapanja,efekat praćenja miša,efekat uveličanja,efekat zamućenja,instrument-tabla,efekat eksplozije,efekat utapanja,efekata utapanja površi,efekat raspadanja,efekat rasparčavanja,efekat klizanja,efekat isticanja prozora,efekat prijavljivanja,efekat odjavljivanja,efekat magične lampe,efekat minimizovanja,efekat tragova miša,efekat skaliranja,efekat snimka ekrana,efekat lista,efekat klizanja,efekat klizajućih iskakača,efekat efekat sličica na traci zadataka,efekat prozirnosti,prozirnost,providnost,efekat geometrije prozora,efekat lelujajućih prozora,efekat odziva pokretanja,efekat roditeljskog dijalog,efekat potamnjenja neaktivnog,efekat potamnjenja ekrana,šminka,efekat prikazivanja,efekat kutijastog prebacivanja,efekat kocke površi,efekat animacije kocke površi,efekat mreže površi,efekat prevrtanja,efekat predstavljanja prozora,efekat promene veličine prozora -X-KDE-Keywords[sr@latin]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,KWin,prozor,menadžer,slaganje,efekat,3D efekti,2D efekti,OpenGL,XRender,video postavke,grafički efekti,efekti površi,animacije,razne animacije,efekti upravljanja prozorima,efekti menjanja prozora,efekti menjanja površi,animacije,brzina animacije,animacije površi,drajveri,postavke drajvera,renderovanje,iscrtavanje,efekat izvrtanja,efekat lupe,efekat uklapanja,efekat praćenja miša,efekat uveličanja,efekat zamućenja,instrument-tabla,efekat eksplozije,efekat utapanja,efekata utapanja površi,efekat raspadanja,efekat rasparčavanja,efekat klizanja,efekat isticanja prozora,efekat prijavljivanja,efekat odjavljivanja,efekat magične lampe,efekat minimizovanja,efekat tragova miša,efekat skaliranja,efekat snimka ekrana,efekat lista,efekat klizanja,efekat klizajućih iskakača,efekat efekat sličica na traci zadataka,efekat prozirnosti,prozirnost,providnost,efekat geometrije prozora,efekat lelujajućih prozora,efekat odziva pokretanja,efekat roditeljskog dijalog,efekat potamnjenja neaktivnog,efekat potamnjenja ekrana,šminka,efekat prikazivanja,efekat kutijastog prebacivanja,efekat kocke površi,efekat animacije kocke površi,efekat mreže površi,efekat prevrtanja,efekat predstavljanja prozora,efekat promene veličine prozora -X-KDE-Keywords[sv]=kwin,fönster,hanterare,sammansättning,effekt,3D-effekter,OpenGL,Xrender,videoinställningar,grafiska effekter,skrivbordseffekter,animeringar,diverse animeringar,fönsterhanteringseffekter,fönsterbyteseffekt,skrivbordsbyteseffekt,animeringshastighet,skrivbordsanimeringar,drivrutiner,drivrutininställningar,återgivning,återge,inverteringseffekt,förstoringsglaseffekt,förstoringseffekt,låshjälpeffekt,musföljningseffekt,zoomeffekt,suddighetseffekt,instrumentpaneleffekt,explosionseffekt,borttoningseffekt,skrivbordsborttoningseffekt,sönderfallseffekt,glidningseffekt,fönstermarkeringseffekt,inloggningseffekt,utloggningseffekt,magisk lampeffekt,minimeringsanimeringseffekt,musmarkeringseffekt,inskalningseffekt,skärmbildseffekt,arkeffekt,glideffekt,glidande ruteffekt,miniatyrbilder i aktivitetsfältet,miniatyrbild vid sidan om,genomskinlighet,genomskinlighetseffekt,fönstergeometrieffekt,ostadiga fönster,startgensvarseffekt,dialogrutors ägare,dämpa inaktiva,dämpa skärmen,glid tillbaka,ögongodis,visa ramar/s,visa uppritning,byte med ruta,omslagsbyte,skrivbordskub,animeringseffekt för skrivbordskub,skrivbordsrutnät,blädderbyteseffekt,kontureffekt,befintliga fönster,ändra fönsterstorlek -X-KDE-Keywords[tr]=kwin,pencere,yönetici,compositing,efekt,3D efekti,2D efekti,OpenGL,XRender,video ayarları,grafiksel efektler,masaüstü efektleri,canlandırmalar,çeşitli canlandırmalar,pencere yönetimi efektleri,pencere değiştirme efekti,masaüstü değiştirme efekti,canlandırmalar,canlandırma hızı,masaüstü canlandırmaları,sürücüler,sürücü ayarları,hazırlama,render,invert efekti,camdan bakma efekti,büyüteç efekti,kopma yardımcısı efekti,fareyi izle efekti,büyütme efekti,bulanıklaştırma efekti,kontrol paneli efekti,patlama efekti,kaybolma efekti,masaüstü kaybolması efekti,fall apart efekti,glide efekti,pencere vurgulama efekti,giriş efekti,çıkış efekti,sihirli lamba efekti,küçültmecanlandırması efekti,fare işaretleme efekti,ölçekleme efekti,ekran görüntüsü alma efekti,sheet efekti,slayt efekti,sliding popups efekti,görev çubuğu küçük resimleri efekti,yan küçük resim efekti,şeffaflık,şeffaflık efekti,şeffaflık,pencere yerleşimi efekti,sallanan pencereler efekti,başlatma geri bildirimi efekti,üst pencere efekti,ekran kapatılma efekti,ekran kapatma efekti,slide back efekti,güzellik,şeker,FPS göster efekti,show paint efekti,kutu seçici efekti,kapak seçici efekti,masaüstü küpü efekti,masaüstü küpü canlandırma efekti,masaüstü ızgarası efekti,flip switch efekti,dış çerçeve efekti,şimdiki pencereler efekti,pencere yeniden boyutlandırma efekti -X-KDE-Keywords[uk]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,вікно,керування вікнами,менеджер вікон,композитне відтворення,ефект,просторовий,плоский,параметри відео,графічні ефекти,анімації,анімація,перемикання вікон,швидкість анімації,драйвери,параметри драйверів,показ,відтворення,інвертування,інверсія,збільшувальне скло,збільшення,прилипання,шлейф за вказівником,шлейф,масштабування,масштаб,зміна розмірів,розмивання,панель приладів,панель,вибух,ефекти вибуху,згасання,поява,ковзання,підсвічування,підсвічування вікон,вихід,магічна лампа,чарівна лампа,джин,аркуші,стос,знімок екрана,мініатюри панелі задач,мініатюри,прозорість,ефект прозорості,желе,желейні вікна,супровід запуску,стрибунець,притлумлення,сірість,прикраси,показ частоти,малювання,обкладинки,стрибання,контур,поточні вікна,зміна розмірів -X-KDE-Keywords[x-test]=xxkwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effectxx -X-KDE-Keywords[zh_CN]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,窗口,管理,混成,特效,效果,2维特效,3维特效,视频设置,图形特效,桌面特效,动画,各种效果,窗口管理效果,窗口切换效果,桌面动画,驱动,驱动设置,渲染,反转效果,窥镜效果,放大镜效果,控屏助手效果,跟踪鼠标效果,缩放效果,模糊效果,部件板效果,爆炸效果,淡入淡出效果,淡出桌面效果,破碎效果,滑行效果,突出显示窗口效果,登录效果,注销效果,魔灯效果,最小化动画效果,鼠标标记效果,拉近效果,屏幕截图效果,飘落效果,滑动气泡通知效果,任务栏缩略图效果,缩略图置边效果,半透明,透明,半透明效果,窗口形状效果,摆动窗口效果,启动反馈效果,暗淡父级对话框效果,暗淡未激活窗口效果,进入管理员模式时暗淡屏幕效果,滑出效果,视觉效果,显示 FPS 效果,显示绘制区域效果,盒状切换效果,封面切换效果,桌面立方效果,桌面立方动画效果,桌面窗格效果,翻转切换效果,概要效果,展现窗口效果,缩放窗口效果,鼠标点击动画效果,最大化效果 -X-KDE-Keywords[zh_TW]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords[bs]=kwin,prozor,menadžer,slaganje,efekti,3D efekti,2D efekti,XRender,Postavke videa,grafički efekti,desktop efekti,animacije ,razne animacije ,upravljanje efektima prozora,window switching effect,desktop switching effect,animacije ,brzina animacije,desktop animacije ,drajveri,podešavanje drajvera,vizualizacije,pružanje,invert efekti,Efekt igranja sa prozorima (looking glass effect),efekt povećala,snap helper effect,igranje sa strelicom miše efekti ,efekti povećavanja,efekti magljenja,efekti kontrolne ploče,efekti eksplozije,efekt izbljeđivanja,izbljeđivanje desktopa,efekti raspadanja,efekt klizanja, efekt naglašavanja prozora,login efekt,logout efekt,magični efek, teffect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords[ca]=kwin,finestra,gestor,composició,efecte,efectes 3D,efectes 2D,XRender,arranjament de vídeo,efectes gràfics,efectes d'escriptori,animacions,animacions diverses,efectes de gestió de finestra,efecte de canvi de finestra,efecte de canvi d'escriptori,animacions,velocitat d'animació,animacions d'escriptori,controladors,configuració de controladors,renderització,render,efecte d'inversió,efecte d'aparença de vidre,efecte de lupa,efecte ajudant de desplaçament,efecte de seguiment de ratolí,efecte de zoom,efecte de difuminat,efecte de tauler,efecte d'explosió,efecte d'esvaïment,efecte d'esvaïment d'escriptori,efecte de trencament,efecte de lliscament,efecte de ressaltat de finestra,efecte de connexió,efecte de desconnexió,efecte de làmpada màgica,efecte d'animació de minimització,efecte de marca de ratolí,efecte d'apropament,efecte de captura de pantalla,efecte de full,efecte de diapositiva,efecte de missatges emergents lliscants,efecte de miniatures de barra de tasques,efecte de miniatures laterals,translucidesa,efecte de translucidesa,transparència,efecte de geometria de finestra,efecte de finestres sacsejades,efecte de confirmació d'engegada,efecte de diàleg principal,efecte d'enfosquiment d'inactiu,efecte d'enfosquiment de pantalla, efecte de diapositiva prèvia,decoració,efecte per mostrar FPS,efecte de mostra de pintat,efecte de quadre de commutació,efecte de canvi de coberta,efecte de cub d'escriptori,efecte d'animació de cub d'escriptori,efecte de graella d'escriptori,efecte de canvi en roda,efecte de contorn,efecte de presentació de finestres,efecte de redimensió de finestra +X-KDE-Keywords[ca@valencia]=kwin,finestra,gestor,composició,efecte,efectes 3D,efectes 2D,XRender,arranjament de vídeo,efectes gràfics,efectes d'escriptori,animacions,animacions diverses,efectes de gestió de finestra,efecte de canvi de finestra,efecte de canvi d'escriptori,animacions,velocitat d'animació,animacions d'escriptori,controladors,configuració de controladors,renderització,render,efecte d'inversió,efecte d'aparença de vidre,efecte de lupa,efecte ajudant de desplaçament,efecte de seguiment de ratolí,efecte de zoom,efecte de difuminat,efecte de tauler,efecte d'explosió,efecte d'esvaïment,efecte d'esvaïment d'escriptori,efecte de trencament,efecte de lliscament,efecte de ressaltat de finestra,efecte de connexió,efecte de desconnexió,efecte de làmpada màgica,efecte d'animació de minimització,efecte de marca de ratolí,efecte d'apropament,efecte de captura de pantalla,efecte de full,efecte de diapositiva,efecte de missatges emergents lliscants,efecte de miniatures de barra de tasques,efecte de miniatures laterals,translucidesa,efecte de translucidesa,transparència,efecte de geometria de finestra,efecte de finestres sacsejades,efecte de confirmació d'engegada,efecte de diàleg principal,efecte d'enfosquiment d'inactiu,efecte d'enfosquiment de pantalla, efecte de diapositiva prèvia,decoració,efecte per mostrar FPS,efecte de mostra de pintat,efecte de quadre de commutació,efecte de canvi de coberta,efecte de cub d'escriptori,efecte d'animació de cub d'escriptori,efecte de graella d'escriptori,efecte de canvi en roda,efecte de contorn,efecte de presentació de finestres,efecte de redimensió de finestra +X-KDE-Keywords[da]=kwin,vindue,vindueshåndtering,compositing,effekter,3D-effekter,2D-effekter,XRender,grafiske effekter,skrivebordseffekter,animationer,diverse animationer,vindueshåndteringseffekter,effekt til skift af vinduer,effekt til skrivebordsskift,animationshastighed,skrivebordsanimationer,drivere,driverindstillinger,rendering,render,invertereffect,kikkerteffekt,forstørrelsesglaseffekt,hægtehjælpereffekt,følg musen-effekt,zoomeffect,sløreffekt,instrumentbræt,eksplosionseffekt,fade-effect,svæve-effect,fremhæv vindue-effekt,login-effekt,log ud-effekt,magisk lampe-effekt,minimer-effekt,musemærke-effekt,skalerind-effekt,skærmbillede-effekt,glide-effekt,glidende pop-op-effekt,opgavelinjeminiaturer-effekt,gennemsigtighed,transparens,ugennemsigtighed,vinduesgeometri-effekt,wobbly,blævrende vinduer,eye candy,øjeguf,vis FPS-effekt,cube,terning,gitter +X-KDE-Keywords[de]=KWin,Fenster,Verwaltung,Compositing,Effekt,2D-Effekte,3D-Effekte,XRender,Videoeinstellungen,Gradische Effekte,Desktopeffekte,Arbeitsflächeneffekte,Animation,Fensterverwaltungs-Effekte,Fensterwechsel-Effekte,Decktopwechsel,Arbeitsflächenwechsel,Animationsgeschwindigkeit,Deskto-Animation,Arbeitsflächen-Animation,Treiber,Treibereinstellung,Rendering,Rendern,Invertierungseffekt,Bildschirmlupeneffekt,Vergrößerungseffekt,Einrasteffekt,Maus folgen,Zooneffekt,Dashboard.Effekt,Explosionseffekt,Überblendungseffekt,Gleiteneffekt,Fensterhervorhebungs-Effekt,Anmeldungseffekt,Abmeldungseffekt,Animierter Minimierungseffekt,Mausmarkierungseffekt,Skalierungseffekt,Bildschirmeffekt,Blatteffekt,Folieneffekt,Vorschaueffekt der Kontrollleiste,Vorschaueffekt,Durchsichtigkeit,Durchsichtigkeitseffekt,Fenstergeometrieffekt,Effekt Wabernde Fenster,Programmstartanzeigeneffekt,Inaktiveffekt,Bildschirmabdunkelungseffekt,FPS-Effekt,Zeichnungsbereicheffekt,Kasten mit Minibilderneffekt,3D-Fenstergalerieeffekt,Desktopgittereffekt,3D-Fensterstapelumschalteffekt,Umrisseffekt,Fensteranzeigeeffekt,Fenstergrößenänderungseffekt +X-KDE-Keywords[el]=kwin,παράθυρο,διαχειριστής,σύνθεσης,εφέ,3D εφέ,2D εφέ,XRender,ρυθμίσεις βίντεο,γραφικά εφέ,εφέ επιφάνειας εργασίας,κινούμενες εικόνες,διάφορες κινούμενες εικόνες,εφέ διαχείρισης παραθύρου,εφέ εναλλαγής παραθύρου,εφέ εναλλαγής επιφάνειας εργασίας,κινούμενες εικόνες,ταχύτητα κινούμενων εικόνων,κινούμενες εικόνες επιφάνειας εργασίας,οδηγοί,ρυθμίσεις οδηγών,αποτύπωση,αποτύπωση,αναστροφή εφέ,εφέ μεγεθυντικού φακού,εφέ μεγέθυνσης,εφέ χειριστή snap,εφέ ίχνους ποντικιού,εφέ ζουμ,εφέ θόλωσης,εφέ πίνακα,εφέ έκρηξης,εφέ εξασθένισης,εφέ εξασθένισης επιφάνειας εργασίας,εφέ κατεδάφισης,εφέ ολίσθησης,εφέ τονισμού παραθύρου,εφέ εισόδου,εφέ εξόδου,εφέ μαγικής λάμπας,εφέ ελαχιστοποίησης κινούμενων εικόνων,εφέ σημείωσης με ποντίκι,εφέ κλιμάκωσης,εφέ στιγμιότυπου,εφέ φύλλου,εφέ κύλισης,εφέ κυλιόμενων αναδυόμενων,εφέ εικόνων επισκόπησης γραμμής εργασιών,εφέ παράπλευρων εικόνων επισκόπησης,διαύγεια,εφέ διαύγειας,διαφάνεια,εφέ γεωμετρίας παραθύρου,εφέ ταλαντευόμενων παραθύρων,εφέ ανάδρασης έναρξης,εφέ προγόνου διαλόγου,εφέ θαμπού αδρανούς,εφέ θολής οθόνης,εφέ πίσω κύλισης,eye candy,candy,εφέ εμφάνισης FPS,εφέ εμφάνισης σχεδιασμάτων,εφέ εναλλαγής πλαισίου,εφέ καλυμμένης εναλλαγής,εφέ κύβου επιφάνειας εργασίας,εφέ κινούμενων εικόνων κύβου επιφάνειας εργασίας,εφέ καννάβου επιφάνειας εργασίας,εφέ εναλλαγής στοίβας,εφέ περιγράμματος,εφέ παρουσίας παραθύρου,εφέ αλλαγής μεγέθους παραθύρου +X-KDE-Keywords[en_GB]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords[es]=kwin,ventana,gestor,composición,efecto,efectos 3D,efectos 2D,XRender,preferencias de vídeo,efectos gráficos,efectos del escritorio,animaciones,animaciones diversas,efectos de la gestión de ventanas,efecto de cambio de ventana,efecto de cambio de escritorio,velocidad de animación,animaciones del escritorio,controladores,preferencias del controlador,renderización,renderizar,efecto de inversión,efecto de espejo,efecto de lupa,efecto auxiliar de instantánea,efecto de seguimiento del ratón,efecto de ampliación,efecto borroso,efecto del tablero de mandos,efecto de explosión,efecto de desvanecimiento,efecto de desvanecimiento del escritorio,efecto de romper en pedazos,efecto de planeo,efecto de resaltar ventanas,efecto de inicio de sesión,efecto de final de sesión,efecto de lámpara mágica,efecto de animación al minimizar,efecto de marcas del ratón,efecto de escalado,efecto de captura de pantalla,efecto de hoja,efecto de deslizamiento,efecto de ventanas emergentes deslizantes,efecto de miniaturas de la barra de tareas,efecto de miniaturas laterales,transparencia,efecto de transparencia,efecto de geometría de las ventanas,efecto de ventanas gelatinosas,efecto de notificación de inicio,efecto de padre de la ventana,efecto de oscurecer inactiva,efecto de oscurecer la pantalla,efecto atrás,efectos atractivos,efecto de mostrar FPS,efecto de mostrar pintura,efecto de selección de ventana en caja,efecto de selección de ventana en modo carátula,efecto de cubo del escritorio,efecto de animación del cubo del escritorio,efecto de rejilla del escritorio,efecto de selección de ventana en modo cascada,efecto de contorno,efecto de presentación de ventanas,efecto de cambiar tamaño de las ventanas +X-KDE-Keywords[et]=kwin,aken,hakdur,komposiit,efekt,3D efektid,ruumilised efektid,2D efektid,XRender,videoseadistused,graafikaefektid,töölauaefektid,animatsioonid,eri animatsioonid,aknahaldusefektid,akna lülitamise efekt,töölaua lülitamise efekt,animatsioonid,animatsiooni kiirus,töölauaanimatsioonid,draiverid,draiveri seadistused,renderdamine,renderdus,inverteerimisefekt,pikksilmaefekt,suurendusklaasiefekt,tõmbe abistaja efekt,hiire jälgimise efekt,suurendusefekt,häguefekt,vidinavaate efekt,plahvatuseefekt,hääbumisefekt,töölaua kadumise efekt,lagunemise efekt,liuglemisefekt,akna esiletõstmise efekt,sisselogimisefekt,väljalogimisefekt,maagilise laterna efekt,minimeerimisanimatsiooni efekt,hiirega tähistamise efekt,skaleerimisefekt,ekraanipildi efekt,leheefekt,slaidiefekt,liuglevate hüpikakende efekt,tegumiriba pisipiltide efekt,kõrvalasuvate pisipiltide efekt,läbipaistvus,läbipaistvuseefekt,akende geomeetria efekt,vonklevate akende efekt,käivitamise tagasiside efekt,dialoogi eellase efekt,tuhmi mitteaktiivse efekt,tuhmi ekraani efekt,tagasiliugumise efekt,silmarõõm,FPS-i näitamise efekt,joonistamise näitamise efekt,kastina lülitamise efekt,vaiplülitamise efekt,töölauakuubiku efekt, töölauakuubiku animatsiooni efekt,töölauavõrgustiku efekt,pööramisega lülitamise efekt,kontuuriefekt,aktiivsete akende efekt, akende suuruse muutmise efekt +X-KDE-Keywords[eu]=kwin,leiho,kudeatzaile,konposizio,efektu,3D efektu,2D efektu,XRender,bideo-ezarpen,efektu grafiko,mahaigaineko efektu,animazio,hainbat animazio,leikoak kudeatzeko efektu,leihoz aldatzeko efektu,mahaigainez aldatzeko efektu,animazio-abiadura,mahaigaineko animazio,kontrolatzaile,kontrolatzaileen ezarpen,errendatze,errendatu,alderantzikatze-efektu,pantaila-lupa efektu,lupa-efektu,kokatze-laguntzailearen efektu,jarraitu saguari efektu,handitu efektu,lausotu efektu,aginte-panela efektu,leherketa efektu,iraungitze-efektu,iraungi mahaigaina efektu,hautsi efektu,lerratu efektu,nabarmendu leihoa efektu,saio-hasiera efektu,saio-amaiera efektu,lanpara magikoa efektu,ikonotzeko animazioa efektu,sagu-marka efektu,eskalatu efektu,pantaila-argazkia efektu,orria efektu,irristatu efektu,leiho gainerakorrak irristatzeko efektu,ataza-barraren koadro txikiak efektu,koadro txikiak alboan efektu,zehargarritasun, zehargarritasun efektu,gardentasun,leihoen geometria efektu,leiho dardartien efektu,abioko oharra efektu,elkarrizketa-koadroaren gurasoa efektu,ilundu inaktiboak efektu,ilundu pantaila efektu,irristatu atzera efektu,bistarako gozagarri,gozagarri,erakutsi FPS efektu,erakutsi pintatua efektu,kaxa aldaketa efektu,3Dko leiho-galeria efektu,mahaigain kuboa efektua, mahaigain kuboaren animazioa efektu,mahaigain-sareta efektu,leiho pila efektu,ingerada efektu,aurkeztu leihoak efektu,tamaina aldatu efektu +X-KDE-Keywords[fi]=kwin,ikkuna,ohjelma,ikkunointi,ikkunointiohjelma,ikkunanhallinta,koostaminen,tehoste,3D-tehosteet,2D-tehosteet,3U-tehosteet,2U-tehosteet,XRender,videoasetukset,kuva-asetukset,graafiset tehosteet,työpöytätehosteet,animaatiot,animoinnit,useita animaatioita,eri animaatiot,ikkunanhallintatehosteet,ikkunan vaihtotehoste,työpöydän vaihtotehoste,animaatiot,animoinnit,animointinopeus,työpöytäanimaatiot,ajurit,ajuriasetukset,piirtojärjestelmä,renderöijä,renderoija,piirtäminen,renderöinti,renderointi,käänteisten värien tehoste,suurennuslasitehoste,pikaopastajatehoste,hiiren jäljitystehoste,zoomaustehoste,sumennustehoste,kojelautatehoste,räjähdystehoste,häivtytystehoste,työpöydän häivytystehoste,hajoamistehoste,ikkunaliukutehoste,ikkunan korostustehoste,sisäänkirjautumistehosteuloskirjautumistehoste,taikalampputehoste,pienennysanimaatiotehoste,hiiren jäljet -tehoste,skaalaustehoste,kuvankaappaustehoste,arkkitehoste,liu’utustehoste,liukuvat ponnahdusikkunat -tehoste,tehtäväpalkin esikatselukuvat -tehoste,esikatselukuva vieressä -tehoste,läpikuultavuus,läpinäkyvyys,läpikuultavuustehoste,läpinäkyvyystehoste,ikkunan mitat -tehoste,heiluvat ikkunat -tehoste,käynnistymisen ilmaisemisen tehoste,isäikkunatehoste,passiivisen himmennystehoste,näytön himmennystehoste,taakse liu’utus -tehoste,silmäkarkki,karkki,FPS-näyttötehoste,näytä FPS -tehoste,piirtämisen näyttämistehoste,laatikkovaihtajatehoste,levykansivaihtajatehoste,työpöytäkuutiotehoste,työpöytäkuutioanimaatiotehoste,työpöydän ruudukko -tehoste,kääntövaihtajatehoste,ääriviivatehoste,ikkunoiden esittämistehoste,ikkunan koon muuttamistehoste,window,manager,compositing,effect,3D effects,2D effects,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords[fr]=kwin, fenêtre, gestionnaire, composition, effet, effets 3D, effets 2D, XRender, paramètres vidéo, effets graphiques, effets de bureau, animations, animations variés, effets de gestion des fenêtres, effets de changement de fenêtre, effets de changement de bureau, animations, vitesse des animations, animation du bureau, pilotes, paramètres du pilote, rendu, rendre, effet d'inversion, effet de verre, effet de loupe, effet d'aide au positionnement, effet de repérage de la souris, effet de zoom,effet de flou, effet du tableau de bord, effet d'explosion, effet de fondu, effet de fondu du bureau, effet d'effondrement, effet de glissement, effet de mise en valeur de la fenêtre, effet de connexion, effet de déconnexion, effet de lampe magique, effet de minimisation de l'application, effet de marque de la souris, effet de gradation, effet de capture d'écran, effet de feuille, effet de glisse, effet d'annotations glissantes, effet d'aperçu de la barre de tâche, effet d'aperçu sur le coté,translucidité, effet de translucidité, transparence, effet de géométrie de la fenêtre, effet de fenêtre en gélatine, effet du témoin de démarrage, effet de dialogue parent, effet d'obscurcissement de fenêtre inactive, effet d'obscurcissement du bureau, effet de glissement en arrière, confort visuel, beauté, effet d'affichage du FPS, effet d'affichage des zones peintes, effet de défilement dans une boîte, effet de défilement circulaire, effet de bureaux en cube, effet d'animation de cube de bureaux, effet de bureaux en grille, effet d'empilement en perspective, effet d'esquisse, effet de présentation des fenêtres, effet de redimensionnement des fenêtres +X-KDE-Keywords[gl]=kwin,xanela,xestor,composición,efecto,efectos 3D,efectos 2D,XRender, configuración da imaxe,efectos gráficos, efectos do escritorio, animacións, efectos da xestión das xanelas,troco de xanela,animación,velocidade,controlador, render +X-KDE-Keywords[hu]=kwin,ablak,kezelő,kompozitálás,hatás,3D hatás,2D hatás,XRender,videobeállítások,grafikai hatások,asztali hatások,animációk,különféle animációk,ablakkezelő hatások,ablakváltó hatások,asztalváltó hatások,animációk,animáció sebesség,asztali animációk,meghajtók,meghajtó beállítások,leképezés,renderelés,fordított hatás,tükörhatás,nagyító hatás,elkapás segítő hatás,egérkövetés hatás,nagyítás hatás,elmosás hatás,áttekintő hatás,robbanás hatás,elhalványulás hatás,asztal elhalványulása hatás,széteső hatás,csúszás hatás,ablak kiemelése hatás,belépés hatás,kilépés hatás,varázslámpa hatás,minimalizálás animáció hatás,egérjelölés hatás,méretezés hatás,képernyőkép hatás,munkalap hatás,dia hatás,csúszó felugrók hatás,feladatsáv bélyegképek hatás,bélyegképek félre hatás,áttetszőség,áttetszőség hatás,átlátszóság,ablak geometria hatás,ingó ablak hatás,indulási visszajelzés hatás,párbeszédablak szülő hatás,dim inaktív hatás,dim kijelző hatás,dia vissza hatás,látványelem,édesség,FPS megjelenítése hatás,festék megjelenése hatás,dobozváltás hatás,eltakarás váltás hatás,asztal kocka hatás,asztal kockaanimáció hatás,asztal rács hatás,tükrözésváltás hatás,körvonal hatás,jelenlegi ablakok hatás,ablak átméretezése hatás +X-KDE-Keywords[ia]=kwin,fenestra,gerente,componente,effecto,effectos 3D,effectos 2D,XRender,preferentias de video,effectos graphic,effectos de scriptorio,animationes,varie animationes,effectos de gestion de genestra,effecto de commutation de fenestra, effecto de commutation de scriptorio,animationes,velocitate de animation,animationes de scriptorio,drivers, preferentias de driver,rendering,render,effecto de inverter,effecto speculo,effecto aggrandor,effecto de adjuta de photo (snap),effecto de tracia de mus,effecto zoom,effecto indistincte,effecto tabuliero,effecto explosion,effecto discolorate,effect de scriptorio discolorate,effecto de collapsar,effecto glissante, effecto de fenestra evidentiare,effecto de authenticar se,effecto de clauder session ,effecto lampada magic,minimisa effecto de animation,effecto de marca de mus,effecto de scalar,effecto de captura schermo,effecto folio,effecto diapositiva, effecto de popups glissante,effecto de miniatura de barra de carga,effecto de miniatura a parte,translucentia, effecto translucentia,transparentia, effecto de geometria de fenestra, effecto de fenestra tremulante,effecto de retro action, effecto de geniytor de dialogo, effecto inactive obscur, effecto de schermo obscur,effecto de retro glissar,eye candy,candy,monstra effecto FPS,monstra effecto pictura, effecto commuta cassa,effecto de commuta coperturat,effecto cubo de scriptorio,animation de cubo de scriptorio,effecto grillia de scriptorio,effecto flip switch,effecto contorno,effecto de fenestra actual,effect de fenestra redimensionante +X-KDE-Keywords[it]=kwin,finestra,gestore,composizione,effetto,effetti 3D,effetti 2D,XRender,impostazioni video,effetti grefici,effetti desktop,animazioni,animazioni varie, effetti del gestore delle finestre,effetto dello scambiafinestre, effetto dello scambiatore di desktop,animazioni,velocità animazioni,animazioni desktop,driver,impostazioni driver,disegno,rendering,effetto invertito,effetto vetro,effetto lente,effetto snap helper,effetto evidenzia mouse,effetto ingrandimento, effetto sfocatura,effetto quadro degli strumenti,effetto esplosione,effetto dissolvenza,effetto dissolvenza desktop,effetto caduta,effetto planatura,effetto evidenziazione finestra,effetto schermata di accesso, effetto disconnessione,effetto lampada magica,effetto animazione di minimizzazione,effetto tracciatura mouse, effetto scalatura,effetto istantanea,effetto foglio,effetto diapositiva,effetto scivolamento,effetto icone nella barra delle applicazioni,effetto miniatura su un lato,translucenza,effetto translucenza, trasparenza,effetto geometria finestra,effetto finestre tremolanti,effetto segnale di avvio,effetto finestra padre,effetto oscura finestra inattiva,effetto oscura schermo,effetto scivola all'indietro,gradevole,effetto gradevole,effetto mostra FPS,effetto ridisegno,effetto scambio cubi,effetto scambio copertina,effetto cubi del desktop,effetto animazione cubi del desktop,effetto griglia desktop,effetto scambiatore con inversione,effetto riquadro,effetto finestra presente,effetto ridimensionamento finestra +X-KDE-Keywords[kk]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords[km]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect +X-KDE-Keywords[ko]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,창,관리자,컴포지팅,효과,3D 효과,2D 효과,비디오 설정,그래픽 효과,데스크톱 효과,애니메이션,창 관리자,창 관리자 효과,데스크톱 전환,데스크톱 전환 효과,드라이버,드라이버 설정,렌더링,렌더링 설정,애니메이션 속도,투명 유리 효과,확대 축소 효과,흐림 효과,대시보드 효과,폭발 효과,페이드 효과,로그인 효과,창 강조 효과,글라이드 효과,로그아웃 효과,램프 효과,시트 효과,최소화 효과,최대화 효과,팝업 효과 +X-KDE-Keywords[nb]=kwin,vindusbehandler,sammensetting,effekt,3D-effekter,2D-effekter,XRender,videoinnstillinger,grafiske effekter,skrivebordseffekter,animasjoner,diverse animasjoner,vindusbytteeffekter,effekter ved skrivebordsbytte,animasjoner,animasjonsfart,skrivebordsanimasjoner,drivere,driverinnstillinger,opptegning,opptegner,inverteringseffekt,speileffekt,lupeeffekt,gripehjelpereffekt,musesporeffekt,forstørreeffekt,sløreffekt,kontrollpulteffekt,eksplosjonseffekt,uttoningseffekt,skrivebordtoningseffekt,henfallseffekt,glidereffekt,framhev vindu-effekt,innlogingseffekt,utloggingsefffekt,magisk lampe-effekt, animasjonseffekt ved vindusminimering,musmerkeeffekt,innskaleringseffekt,skjermdumpeffekt,ark-effekt,lysbildeeffekt,glidende oppspretteffekt,effekt for minibilder på oppgavelinja,effekt for minibilder på siden,gjennomskinnelighetseffekt,gjennomsiktighet,vindusgeometri-effekt,skjelvende vinduer-effekt,effekt for oppstartsmelding,effekt for foreldredialog,effekt for mørk inaktiv,effekt for mørk skjerm,gli tilbake-effekt,øyesnop,snop,vis FPS-effekt,vis malingseffekt,boksbytteeffekt,lokkbytteeffekt,skrivebordsterning-effekt,effekt for animert skrivebordsterning,effekt for skrivebordsruter,effekt for flipp-bytte,omriss-effekt,effekt for vinduer tilstede,effekt for vinduer som endrer størrelse +X-KDE-Keywords[nds]=KWin,Finster,Pleger,Tosamensetten,Effekt,3D,2D,XRender,Videoinstellen,graafsche Effekten,Schriefdisch,Animeren,wesseln,Finsterwesseln,Schriefdischwesseln,Gauigkeit,Drievers,Dorstellen,ümdreihen,Kiekglas,Luup,andocken,Muusspoor,Grötter maken,Ansichtgrött,verwischen,Exploschoon,Utblennen,Uteneenbreken,glieden,markeren,anmellen,afmellen,magisch lamp,minimeren,Muusmark,Schirmfoto,Programmbalken,Vöransichten,Dörschienen,Finstergeometrie,Wabbeligkeit,Start,Torüchmelen,Böverfinster,Dialoog,afdüüstern,Ogenzucker,FPS,Kist,Schriefdischwörpel,Gadder,Dörgahn,Ümdreihen,Ümreet,Grött ännern +X-KDE-Keywords[nl]=kwin,venster,beheerder,compositing,effect,3D effecten,2D effecten,XRender,video-instellingen,grafische effecten,bureaubladeffecten,animaties,verrschillende animaties,vensterbeheereffecten,vensteromschakeleffect, bureaublad-omschakeleffect,animaties,animatiesnelheid,bureaubladanimaties,stuurprogramma's,stuurprogramma-instellingen,rendering,render,inversieeffect,vergrootglaseffect,vergrotingseffect,snaphelpereffect,trackmuiseffect,zoomeffect,vervagingseffect,dashboardeffect,explosie-effect,uitvaageffect,uitvaagbureaubladeffect,uiteenvaleffect,glijeffect,vebsteraccentueringseffect,aanmeldeffect,afmeldeffect,magische lampeffect,animatie-effect minimaliseren,muismarkeringseffect,inschaaleffect,schermafdrukeffect,bladeneffect,diaeffect,glijdende pop-upseffect,taakbalkminiatuureffect,miniatuur-opzijeffect,doorzichtigheid,doorzichtigheidseffect,transparantie,vensterafmetingeneffect,wiebelende vensterseffect,opstartterugkoppeleffect,dialoogoudereffect,dim bij inactiviteitseffect,dim het schermeffect,schuif terugeffect,oogstrelend,snoepgoed,FPS toneneffect,verf toneneffect,vak omschakeleffect,deksel schakelaareffect,bureaublad kubuseffect,bureaublad kubus animatie-effect,bureaubladrastereffect,omschakeleffect,omrandingeffect,huidig venstereffect, wijzig grootte van venstereffect +X-KDE-Keywords[pl]=kwin,okno,menadżer,kompozycje,efekt,efekty 3D,efekty 2D,XRender, ustawienia wideo,efekty graficzne,efekty pulpitu,animacje,różne animacje,efekty zarządzania oknami,efekty przełączania okien,efekty przełączania pulpitów,animacje, szybkość animacji,animacje pulpitu,sterowniki,ustawienia sterowników,renderowania, efekt odwrócenia,szkło powiększające,efekt powiększenia,efekt pomocnika przyciągania, efekt śledzenia myszy,efekt przybliżenia,efekt rozmycia,efekt tablicy,efekt eksplozji,efekt zanikania,efekt zanikania pulpitu,efekt rozpadania,efekt slajdu,efekt podświetlania okna, efekt logowania,efekt wylogowywania,efekt magicznej lampy,efekt animacji minimalizacji, efekt znacznika myszy,efekt skalowania,efekt zrzutu ekranu,efekt arkusza,efekt slajdu,efekt wysuwających się elementów wyskakujących,efekt prześwitywania,przezroczystość,efekt geometrii okna,efekt chwiejnych okien,efekt odczuć przy starcie,efekt okna rodzica,efekt przyciemniania nieaktywnych,efekt przyciemniania ekranu,efekt przesuwania do tył,efekt pokazania ilości klatek na sekundę +X-KDE-Keywords[pt]=kwin,janela,gestor,composição,efeito,efeitos 3D,efeitos 2D,XRender,configuração do vídeo,efeitos gráficos,efeitos do ecrã,animações,animações diversas,efeitos de gestão das janelas,efeito de mudança de janelas,efeito de mudança de ecrãs,animações,velocidade da animação,animações do ecrã,controladores,configuração dos controladores,desenho,efeito de inversão,efeito de lupa,efeito de lente,efeito de ajuda no ajuste, efeito de seguimento do rato,efeito de ampliação,efeito de borrão,efeito de quadro,efeito de explosão,efeito de desvanecimento,efeito de desvanecimento do ecrã,efeito de destruição,efeito de deslizamento,efeito de realce da janela,efeito na autenticação,efeito do encerramento,efeito de lâmpada mágica,efeito de animação na minimização,efeito de marcação com rato,efeito de escala,efeito de captura do ecrã,efeito de folha,efeito de mensagens deslizantes,efeito de miniaturas na barra de tarefas,efeito de miniaturas laterais,efeito de janelas a tremer,efeito do arranque inicial,efeito da janela-mãe,efeito de escurecimento de janelas inactivas,efeito de deslize para trás,efeitos visuais,beleza,efeito de apresentação das IPS,efeito de pintura,efeito de mudança em caixa,efeito de mudança de capas, efeito de animação do cubo do ecrã,efeito de grelha do ecrã,efeito de mudança por viragem,efeito de destaque,efeito de apresentação das janelas,efeito de dimensionamento das janelas +X-KDE-Keywords[pt_BR]=kwin,janela,gerenciador,composição,efeito,efeitos 3D,efeitos 2D, XRender,configuração do vídeo,efeitos gráficos,efeitos da área de trabalho,animações,diversas animações,efeitos do gerenciamento das janelas,efeito de mudança da janela,efeito de mudança de área de trabalho,animações,velocidade da animação,animações da área de trabalho,controladores,drivers,configuração do driver,desenho,efeito de inversão,efeito de lupa,efeito de lente,efeito de ajuste,efeito de seguimento do mouse,efeito de ampliação,efeito de borrão,efeito de quadro,efeito de explosão,efeito de desvanecimento,efeito de desvanecimento da área de trabalho,efeito de queda,efeito de deslizamento,efeito de realce da janela,efeito de autenticação,efeito de encerramento da sessão,efeito de lâmpada mágica,efeito de animação da minimização,efeito de marcação do mouse,efeito de ampliação,efeito de captura de tela,efeito de folha,efeito de deslizamento,efeito de janelas deslizantes,efeito de miniaturas das tarefas,efeito de miniatura ao lado,translucidez,efeito de translucidez,transparência,efeito de geometria da janela,efeito de janelas ondulantes,efeito de reação à inicialização,efeito da janela-mãe,efeito de escurecimento da janela inativa,efeito de escurecimento da tela,efeito de deslizamento para trás,efeitos visuais,visuais,efeito para mostrar FPS,efeito de pintura,efeito de mudança em caixa,efeito de mudança em capas,efeito de cubo da área de trabalho,efeito de animação do cubo da área de trabalho,efeito da grade da área de trabalho,efeito de virada de página,efeito de realce,efeito de apresentação das janelas,efeito de dimensionamento das janelas +X-KDE-Keywords[ru]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,окно,диспетчер,графический,эффект,3D эффект,2D эффект,параметры видео,графические эффекты,эффекты рабочего стола,анимация,эффекты управления окнами,эффект переключения окна,эффект переключения рабочих столов,анимация,скорость анимации,анимация рабочего стола,драйверы,параметры драйверов,рендеринг,визуализация,цветопередача,режим инверсии,эффект зеркала,эффект лупы,эффект разметки экрана,эффект движения мыши на экране, эффект масштабирования,эффект размытия,приборная доска,эффект взрыва,эффект затухания,эффект затухания рабочего стола,эффект распада,эффект скольжения,подсветка окна,вход в систему,выход из системы,эффект волшебной лампы,анимация сворачивания,рисование мышью,анимация появления,снимок экрана,вкладки,эффект скольжения,анимация всплывающих окон,миниатюра окна у панели задач,миниатюра окна на краю экрана,полупрозрачность,прозрачность,геометрия окна,дрожащие окна, отклик запуска приложения,затемнение основного окна,затемнение неактивных окон,затемнение экрана,эффект выскальзывания,украшения,красивые,график производительности,подсвечивать отрисовку,переключение с миниатюрами,карусель,куб с рабочими столами,анимация куба с рабочими столами,все рабочие столы,перелистывание,контур,окна в кнопке,все окна,изменение размера окна +X-KDE-Keywords[sk]=kwin, okno, manažér, kompozícia, efekt, 3D efekty, 2D efekty, XRender,nastavenia obrazu, grafické efekty, desktop efekty, animácie, rôzneanimácie, efekty správa okien, okno prepínanie efektov, stolnýspínacie efekt, animácie, animácie rýchlosť, stolný animácie, ovládače,nastavenie ovládača, renderovanie, poskytnúť, invertný skutočnosti zrkadlá účinok,lupa efekt, snap pomocník efekt, trať myš efekt, zoom efekt, rozmazaniuúčinok, prístrojová doska efekt, výbuch efekt, fade efekt, fade stolný efekt,rozpadnúť účinok, zostupovej efekt, zvýraznenie okno efekt, efekt prihlásenie, odhlásenieúčinok, čarovnú lampu účinok, minimálny efekt animácie, myši značky efekt, mierkav skutočnosti, screenshot efekt, list efekt, snímka efekt, posuvné vyskakovacie okná účinok,miniatúry na hlavnom paneli efekt, náhľad stranou efekt, priesvitnosť, translucencieúčinok, transparentnosť, okno geometrie efekt, vratkú okná efekt, uvedenie do prevádzkyspätná väzba, dialóg rodič efekt, matný efekt neaktívny, stlmiť obrazovku efekt,posunutím zadnej efekt, pastva pre oči, cukrík zobraziť FPS efekt, zobrazovať farby efekt, boxprepínač efekt, kryt prepínače účinok, desktop, desktop cube efekt kocky animácieúčinok, Desktop Grid efekt, flip switch efekt, obrys účinok, súčasné oknáúčinok, zmena veľkosti okna efekt +X-KDE-Keywords[sl]=kwin,upravljalnik oken,skladanje,učinek,učinki 3d,učinki 2d,xrender,grafične nastavitve,grafični učinki,namizni učinki,animacije,upravljanje z okni,preklapljanje oken,preklapljanje namizij,hitrost animacij,namizne animacije,gonilniki,izrisovanje,obrni,povečevalno steklo,pripenjalni pomagalnik,sledenje miški,približanje,zabriši,nadzorna plošča,eksplozija,pojemanje,pojemanje namizja,razpad,drsenje,poudari okno,učinek prijave,učinek odjave,čarobna svetilka,animacija skrčenja,risanje,animirano pojavljanje,zaslonska slika,list,drsenje,drseča pojavna okna,sličice za opravilno vrstico,sličica ob strani,prosojnost,prozornost,geometrija okna,majava okna,odziv zagona,nadrejeno pogovorno okno,potemni nedejavno,potemni zaslon,zdrs v ozadje,vidni bonbončki,pokaži sličice na sekundo,izrisovanje,preklapljanje - škatla,preklapljanje - ovitki,kocka z namizji,animacija kocka z namizji,mreža namizij,preklapljanje - sklad,oris,predstavi okna,spreminjanje velikosti okna +X-KDE-Keywords[sr]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,К‑вин,прозор,менаџер,слагање,ефекат,3Д ефекти,2Д ефекти,опенГЛ,Икс‑рендер,видео поставке,графички ефекти,ефекти површи,анимације,разне анимације,ефекти управљања прозорима,ефекти мењања прозора,ефекти мењања површи,анимације,брзина анимације,анимације површи,драјвери,поставке драјвера,рендеровање,исцртавање,ефекат извртања,ефекат лупе,ефекат уклапања,ефекат праћења миша,ефекат увеличања,ефекат замућења,инструмент-табла,ефекат експлозије,ефекат утапања,ефеката утапања површи,ефекат распадања,ефекат распарчавања,ефекат клизања,ефекат истицања прозора,ефекат пријављивања,ефекат одјављивања,ефекат магичне лампе,ефекат минимизовања,ефекат трагова миша,ефекат скалирања,ефекат снимка екрана,ефекат листа,ефекат клизања,ефекат клизајућих искакача,ефекат ефекат сличица на траци задатака,ефекат прозирности,прозирност,провидност,ефекат геометрије прозора,ефекат лелујајућих прозора,ефекат одзива покретања,ефекат родитељског дијалог,ефекат потамњења неактивног,ефекат потамњења екрана,шминка,ефекат приказивања,ефекат кутијастог пребацивања,ефекат коцке површи,ефекат анимације коцке површи,ефекат мреже површи,ефекат превртања,ефекат представљања прозора,ефекат промене величине прозора +X-KDE-Keywords[sr@ijekavian]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,К‑вин,прозор,менаџер,слагање,ефекат,3Д ефекти,2Д ефекти,опенГЛ,Икс‑рендер,видео поставке,графички ефекти,ефекти површи,анимације,разне анимације,ефекти управљања прозорима,ефекти мењања прозора,ефекти мењања површи,анимације,брзина анимације,анимације површи,драјвери,поставке драјвера,рендеровање,исцртавање,ефекат извртања,ефекат лупе,ефекат уклапања,ефекат праћења миша,ефекат увеличања,ефекат замућења,инструмент-табла,ефекат експлозије,ефекат утапања,ефеката утапања површи,ефекат распадања,ефекат распарчавања,ефекат клизања,ефекат истицања прозора,ефекат пријављивања,ефекат одјављивања,ефекат магичне лампе,ефекат минимизовања,ефекат трагова миша,ефекат скалирања,ефекат снимка екрана,ефекат листа,ефекат клизања,ефекат клизајућих искакача,ефекат ефекат сличица на траци задатака,ефекат прозирности,прозирност,провидност,ефекат геометрије прозора,ефекат лелујајућих прозора,ефекат одзива покретања,ефекат родитељског дијалог,ефекат потамњења неактивног,ефекат потамњења екрана,шминка,ефекат приказивања,ефекат кутијастог пребацивања,ефекат коцке површи,ефекат анимације коцке површи,ефекат мреже површи,ефекат превртања,ефекат представљања прозора,ефекат промене величине прозора +X-KDE-Keywords[sr@ijekavianlatin]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,KWin,prozor,menadžer,slaganje,efekat,3D efekti,2D efekti,XRender,video postavke,grafički efekti,efekti površi,animacije,razne animacije,efekti upravljanja prozorima,efekti menjanja prozora,efekti menjanja površi,animacije,brzina animacije,animacije površi,drajveri,postavke drajvera,renderovanje,iscrtavanje,efekat izvrtanja,efekat lupe,efekat uklapanja,efekat praćenja miša,efekat uveličanja,efekat zamućenja,instrument-tabla,efekat eksplozije,efekat utapanja,efekata utapanja površi,efekat raspadanja,efekat rasparčavanja,efekat klizanja,efekat isticanja prozora,efekat prijavljivanja,efekat odjavljivanja,efekat magične lampe,efekat minimizovanja,efekat tragova miša,efekat skaliranja,efekat snimka ekrana,efekat lista,efekat klizanja,efekat klizajućih iskakača,efekat efekat sličica na traci zadataka,efekat prozirnosti,prozirnost,providnost,efekat geometrije prozora,efekat lelujajućih prozora,efekat odziva pokretanja,efekat roditeljskog dijalog,efekat potamnjenja neaktivnog,efekat potamnjenja ekrana,šminka,efekat prikazivanja,efekat kutijastog prebacivanja,efekat kocke površi,efekat animacije kocke površi,efekat mreže površi,efekat prevrtanja,efekat predstavljanja prozora,efekat promene veličine prozora +X-KDE-Keywords[sr@latin]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,KWin,prozor,menadžer,slaganje,efekat,3D efekti,2D efekti,XRender,video postavke,grafički efekti,efekti površi,animacije,razne animacije,efekti upravljanja prozorima,efekti menjanja prozora,efekti menjanja površi,animacije,brzina animacije,animacije površi,drajveri,postavke drajvera,renderovanje,iscrtavanje,efekat izvrtanja,efekat lupe,efekat uklapanja,efekat praćenja miša,efekat uveličanja,efekat zamućenja,instrument-tabla,efekat eksplozije,efekat utapanja,efekata utapanja površi,efekat raspadanja,efekat rasparčavanja,efekat klizanja,efekat isticanja prozora,efekat prijavljivanja,efekat odjavljivanja,efekat magične lampe,efekat minimizovanja,efekat tragova miša,efekat skaliranja,efekat snimka ekrana,efekat lista,efekat klizanja,efekat klizajućih iskakača,efekat efekat sličica na traci zadataka,efekat prozirnosti,prozirnost,providnost,efekat geometrije prozora,efekat lelujajućih prozora,efekat odziva pokretanja,efekat roditeljskog dijalog,efekat potamnjenja neaktivnog,efekat potamnjenja ekrana,šminka,efekat prikazivanja,efekat kutijastog prebacivanja,efekat kocke površi,efekat animacije kocke površi,efekat mreže površi,efekat prevrtanja,efekat predstavljanja prozora,efekat promene veličine prozora +X-KDE-Keywords[sv]=kwin,fönster,hanterare,sammansättning,effekt,3D-effekter,Xrender,videoinställningar,grafiska effekter,skrivbordseffekter,animeringar,diverse animeringar,fönsterhanteringseffekter,fönsterbyteseffekt,skrivbordsbyteseffekt,animeringshastighet,skrivbordsanimeringar,drivrutiner,drivrutininställningar,återgivning,återge,inverteringseffekt,förstoringsglaseffekt,förstoringseffekt,låshjälpeffekt,musföljningseffekt,zoomeffekt,suddighetseffekt,instrumentpaneleffekt,explosionseffekt,borttoningseffekt,skrivbordsborttoningseffekt,sönderfallseffekt,glidningseffekt,fönstermarkeringseffekt,inloggningseffekt,utloggningseffekt,magisk lampeffekt,minimeringsanimeringseffekt,musmarkeringseffekt,inskalningseffekt,skärmbildseffekt,arkeffekt,glideffekt,glidande ruteffekt,miniatyrbilder i aktivitetsfältet,miniatyrbild vid sidan om,genomskinlighet,genomskinlighetseffekt,fönstergeometrieffekt,ostadiga fönster,startgensvarseffekt,dialogrutors ägare,dämpa inaktiva,dämpa skärmen,glid tillbaka,ögongodis,visa ramar/s,visa uppritning,byte med ruta,omslagsbyte,skrivbordskub,animeringseffekt för skrivbordskub,skrivbordsrutnät,blädderbyteseffekt,kontureffekt,befintliga fönster,ändra fönsterstorlek +X-KDE-Keywords[tr]=kwin,pencere,yönetici,compositing,efekt,3D efekti,2D efekti,XRender,video ayarları,grafiksel efektler,masaüstü efektleri,canlandırmalar,çeşitli canlandırmalar,pencere yönetimi efektleri,pencere değiştirme efekti,masaüstü değiştirme efekti,canlandırmalar,canlandırma hızı,masaüstü canlandırmaları,sürücüler,sürücü ayarları,hazırlama,render,invert efekti,camdan bakma efekti,büyüteç efekti,kopma yardımcısı efekti,fareyi izle efekti,büyütme efekti,bulanıklaştırma efekti,kontrol paneli efekti,patlama efekti,kaybolma efekti,masaüstü kaybolması efekti,fall apart efekti,glide efekti,pencere vurgulama efekti,giriş efekti,çıkış efekti,sihirli lamba efekti,küçültmecanlandırması efekti,fare işaretleme efekti,ölçekleme efekti,ekran görüntüsü alma efekti,sheet efekti,slayt efekti,sliding popups efekti,görev çubuğu küçük resimleri efekti,yan küçük resim efekti,şeffaflık,şeffaflık efekti,şeffaflık,pencere yerleşimi efekti,sallanan pencereler efekti,başlatma geri bildirimi efekti,üst pencere efekti,ekran kapatılma efekti,ekran kapatma efekti,slide back efekti,güzellik,şeker,FPS göster efekti,show paint efekti,kutu seçici efekti,kapak seçici efekti,masaüstü küpü efekti,masaüstü küpü canlandırma efekti,masaüstü ızgarası efekti,flip switch efekti,dış çerçeve efekti,şimdiki pencereler efekti,pencere yeniden boyutlandırma efekti +X-KDE-Keywords[uk]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,вікно,керування вікнами,менеджер вікон,композитне відтворення,ефект,просторовий,плоский,параметри відео,графічні ефекти,анімації,анімація,перемикання вікон,швидкість анімації,драйвери,параметри драйверів,показ,відтворення,інвертування,інверсія,збільшувальне скло,збільшення,прилипання,шлейф за вказівником,шлейф,масштабування,масштаб,зміна розмірів,розмивання,панель приладів,панель,вибух,ефекти вибуху,згасання,поява,ковзання,підсвічування,підсвічування вікон,вихід,магічна лампа,чарівна лампа,джин,аркуші,стос,знімок екрана,мініатюри панелі задач,мініатюри,прозорість,ефект прозорості,желе,желейні вікна,супровід запуску,стрибунець,притлумлення,сірість,прикраси,показ частоти,малювання,обкладинки,стрибання,контур,поточні вікна,зміна розмірів +X-KDE-Keywords[x-test]=xxkwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effectxx +X-KDE-Keywords[zh_CN]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,窗口,管理,混成,特效,效果,2维特效,3维特效,视频设置,图形特效,桌面特效,动画,各种效果,窗口管理效果,窗口切换效果,桌面动画,驱动,驱动设置,渲染,反转效果,窥镜效果,放大镜效果,控屏助手效果,跟踪鼠标效果,缩放效果,模糊效果,部件板效果,爆炸效果,淡入淡出效果,淡出桌面效果,破碎效果,滑行效果,突出显示窗口效果,登录效果,注销效果,魔灯效果,最小化动画效果,鼠标标记效果,拉近效果,屏幕截图效果,飘落效果,滑动气泡通知效果,任务栏缩略图效果,缩略图置边效果,半透明,透明,半透明效果,窗口形状效果,摆动窗口效果,启动反馈效果,暗淡父级对话框效果,暗淡未激活窗口效果,进入管理员模式时暗淡屏幕效果,滑出效果,视觉效果,显示 FPS 效果,显示绘制区域效果,盒状切换效果,封面切换效果,桌面立方效果,桌面立方动画效果,桌面窗格效果,翻转切换效果,概要效果,展现窗口效果,缩放窗口效果,鼠标点击动画效果,最大化效果 +X-KDE-Keywords[zh_TW]=kwin,window,manager,compositing,effect,3D effects,2D effects,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect diff --git a/kwin/kcmkwin/kwincompositing/main.cpp b/kwin/kcmkwin/kwincompositing/main.cpp index 66785f5e..c98da1c2 100644 --- a/kwin/kcmkwin/kwincompositing/main.cpp +++ b/kwin/kcmkwin/kwincompositing/main.cpp @@ -18,6 +18,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/>. *********************************************************************/ +#include "config-kwin.h" + #include "main.h" #include "dbus.h" @@ -93,7 +95,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList layout()->activate(); ui.tabWidget->setCurrentIndex(0); ui.statusTitleWidget->hide(); - ui.rearmGlSupport->hide(); ui.messageBox->setMessageType(KMessageWidget::Warning); ui.messageBox->addAction(m_dontShowAgain); foreach (QWidget *w, m_dontShowAgain->associatedWidgets()) @@ -123,33 +124,15 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList } else ui.messageBox->setVisible(false); - // For future use - (void) I18N_NOOP("Use GLSL shaders"); - -#define OPENGL31_INDEX 0 -#define OPENGL20_INDEX 1 -#define OPENGL12_INDEX 2 -#define XRENDER_INDEX 3 - -#ifndef KWIN_HAVE_XRENDER_COMPOSITING - ui.compositingType->removeItem(XRENDER_INDEX); +#ifndef KWIN_BUILD_COMPOSITE + ui.compositingType->removeItem(0); #define XRENDER_INDEX -1 +#else +#define XRENDER_INDEX 0 #endif - ui.glSwapStrategy->addItem(i18n("None"), "n"); - ui.glSwapStrategy->setItemData(0, i18n("The painting is not synchronized with the screen."), Qt::ToolTipRole); - ui.glSwapStrategy->addItem(i18n("Automatic"), "a"); - ui.glSwapStrategy->setItemData(1, i18n("Tries to re-use older buffers and if that is not possible,\npicks a strategy matching your hardware."), Qt::ToolTipRole); - ui.glSwapStrategy->addItem(i18n("Only when Cheap"), "e"); - ui.glSwapStrategy->setItemData(2, i18n("When major regions of the screen are updated,\nthe entire screen will be repainted.\nCan cause tearing with small updates."), Qt::ToolTipRole); - ui.glSwapStrategy->addItem(i18n("Full scene repaints"), "p"); - ui.glSwapStrategy->setItemData(3, i18n("The complete screen is repainted for every frame.\nCan be slow with large blurred areas."), Qt::ToolTipRole); - ui.glSwapStrategy->addItem(i18n("Re-use screen content"), "c"); - ui.glSwapStrategy->setItemData(4, i18n("WARNING:\nThis strategy is usually slow with Open Source drivers.\nUndamaged pixels will be copied from GL_FRONT to GL_BACK"), Qt::ToolTipRole); - connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); - connect(ui.rearmGlSupportButton, SIGNAL(clicked()), this, SLOT(rearmGlSupport())); connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.useCompositing, SIGNAL(clicked(bool)), this, SLOT(suggestGraphicsSystem())); connect(ui.effectWinManagement, SIGNAL(toggled(bool)), this, SLOT(changed())); @@ -168,12 +151,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList connect(ui.graphicsSystem, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed())); connect(ui.unredirectFullscreen , SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(ui.glScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.xrScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); - connect(ui.glSwapStrategy, SIGNAL(currentIndexChanged(int)), this, SLOT(glSwapStrategyChanged(int))); - connect(ui.glSwapStrategy, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); - connect(ui.glColorCorrection, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(m_showDetailedErrors, SIGNAL(triggered(bool)), SLOT(showDetailedEffectLoadingInformation())); connect(m_dontShowAgain, SIGNAL(triggered(bool)), SLOT(blockFutureWarnings())); @@ -335,25 +314,6 @@ void KWinCompositingConfig::loadGeneralTab() ui.desktopSwitchingCombo->setCurrentIndex(1); } -void KWinCompositingConfig::glSwapStrategyChanged(int idx) -{ - ui.glSwapStrategy->setToolTip(ui.glSwapStrategy->itemData(idx, Qt::ToolTipRole).toString()); -} - -void KWinCompositingConfig::rearmGlSupport() -{ - // rearm config - KConfigGroup gl_workaround_config = KConfigGroup(mKWinConfig, "Compositing"); - gl_workaround_config.writeEntry("OpenGLIsUnsafe", false); - gl_workaround_config.sync(); - - // save last changes - save(); - - // Initialize the user interface with the config loaded from kwinrc. - load(); -} - void KWinCompositingConfig::suggestGraphicsSystem() { if (!ui.useCompositing->isChecked() || ui.compositingType->currentIndex() == XRENDER_INDEX) @@ -362,14 +322,9 @@ void KWinCompositingConfig::suggestGraphicsSystem() void KWinCompositingConfig::alignGuiToCompositingType(int compositingType) { - ui.glScaleFilter->setVisible(compositingType != XRENDER_INDEX); ui.xrScaleFilter->setVisible(compositingType == XRENDER_INDEX); - ui.scaleMethodLabel->setBuddy(compositingType == XRENDER_INDEX ? ui.xrScaleFilter : ui.glScaleFilter); - - ui.glGroup->setEnabled(compositingType != XRENDER_INDEX); - - ui.glColorCorrection->setEnabled(compositingType == OPENGL20_INDEX || - compositingType == OPENGL31_INDEX); + if (compositingType == XRENDER_INDEX) + ui.scaleMethodLabel->setBuddy(ui.xrScaleFilter); } void KWinCompositingConfig::toggleEffectShortcutChanged(const QKeySequence &seq) @@ -397,17 +352,8 @@ void KWinCompositingConfig::loadEffectsTab() void KWinCompositingConfig::loadAdvancedTab() { KConfigGroup config(mKWinConfig, "Compositing"); - QString backend = config.readEntry("Backend", "OpenGL"); - if (backend == "OpenGL") { - int index = OPENGL20_INDEX; - - if (config.readEntry<bool>("GLLegacy", false)) - index = OPENGL12_INDEX; - else if (config.readEntry<bool>("GLCore", false)) - index = OPENGL31_INDEX; - - ui.compositingType->setCurrentIndex(index); - } else if (backend == "XRender") { + QString backend = config.readEntry("Backend", "XRender"); + if (backend == "XRender") { ui.compositingType->setCurrentIndex(XRENDER_INDEX); } @@ -431,13 +377,6 @@ void KWinCompositingConfig::loadAdvancedTab() ui.unredirectFullscreen->setChecked(config.readEntry("UnredirectFullscreen", false)); ui.xrScaleFilter->setCurrentIndex((int)config.readEntry("XRenderSmoothScale", false)); - ui.glScaleFilter->setCurrentIndex(config.readEntry("GLTextureFilter", 2)); - - int swapStrategy = ui.glSwapStrategy->findData(config.readEntry("GLPreferBufferSwap", "a")); - if (swapStrategy < 0) - swapStrategy = ui.glSwapStrategy->findData("n"); - ui.glSwapStrategy->setCurrentIndex(swapStrategy); - ui.glColorCorrection->setChecked(config.readEntry("GLColorCorrection", false)); alignGuiToCompositingType(ui.compositingType->currentIndex()); } @@ -447,7 +386,6 @@ void KWinCompositingConfig::updateStatusUI(bool compositingIsPossible) if (compositingIsPossible) { ui.compositingOptionsContainer->show(); ui.statusTitleWidget->hide(); - ui.rearmGlSupport->hide(); } else { OrgKdeKWinInterface kwin("org.kde.KWin", "/KWin", QDBusConnection::sessionBus()); @@ -459,7 +397,6 @@ void KWinCompositingConfig::updateStatusUI(bool compositingIsPossible) ui.statusTitleWidget->setText(text); ui.statusTitleWidget->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft); ui.statusTitleWidget->show(); - ui.rearmGlSupport->setVisible(kwin.isValid() ? kwin.openGLIsBroken() : true); } } @@ -532,44 +469,15 @@ bool KWinCompositingConfig::saveAdvancedTab() QString graphicsSystem = (ui.graphicsSystem->currentIndex() == 0) ? "native" : "raster"; QString backend; - bool glLegacy; - bool glCore; switch (ui.compositingType->currentIndex()) { - case OPENGL12_INDEX: - backend = "OpenGL"; - glLegacy = true; - glCore = false; - break; - - case OPENGL20_INDEX: - backend = "OpenGL"; - glLegacy = false; - glCore = false; - break; - - case OPENGL31_INDEX: - backend = "OpenGL"; - glLegacy = false; - glCore = true; - break; - case XRENDER_INDEX: backend = "XRender"; - glLegacy = false; - glCore = false; break; } - if (config.readEntry("Backend", "OpenGL") != backend || - config.readEntry<bool>("GLLegacy", false) != glLegacy || - config.readEntry<bool>("GLCore", false) != glCore || - ((config.readEntry("GLPreferBufferSwap", "a") == "n") xor (ui.glSwapStrategy->itemData(ui.glSwapStrategy->currentIndex()) == "n"))) { - m_showConfirmDialog = true; - advancedChanged = true; - } else if (config.readEntry("HiddenPreviews", 5) != hps[ ui.windowThumbnails->currentIndex()] - || (int)config.readEntry("XRenderSmoothScale", false) != ui.xrScaleFilter->currentIndex() - || config.readEntry("GLTextureFilter", 2) != ui.glScaleFilter->currentIndex()) { + if (config.readEntry("HiddenPreviews", 5) != hps[ ui.windowThumbnails->currentIndex()] + || (int)config.readEntry("XRenderSmoothScale", false) != ui.xrScaleFilter->currentIndex()) { advancedChanged = true; } else if (originalGraphicsSystem != graphicsSystem) { advancedChanged = true; @@ -577,41 +485,17 @@ bool KWinCompositingConfig::saveAdvancedTab() config.writeEntry("Backend", backend); - if (backend == "OpenGL") { - config.writeEntry("GLLegacy", glLegacy); - config.writeEntry("GLCore", glCore); - } - config.writeEntry("GraphicsSystem", graphicsSystem); config.writeEntry("HiddenPreviews", hps[ ui.windowThumbnails->currentIndex()]); config.writeEntry("UnredirectFullscreen", ui.unredirectFullscreen->isChecked()); config.writeEntry("XRenderSmoothScale", ui.xrScaleFilter->currentIndex() == 1); - config.writeEntry("GLTextureFilter", ui.glScaleFilter->currentIndex()); - - config.writeEntry("GLPreferBufferSwap", ui.glSwapStrategy->itemData(ui.glSwapStrategy->currentIndex()).toString()); - config.writeEntry("GLColorCorrection", ui.glColorCorrection->isChecked()); return advancedChanged; } void KWinCompositingConfig::save() { - OrgKdeKWinInterface kwin("org.kde.KWin", "/KWin", QDBusConnection::sessionBus()); - if (ui.compositingType->currentIndex() != XRENDER_INDEX && - kwin.openGLIsBroken() && !ui.rearmGlSupport->isVisible()) - { - KConfigGroup config(mKWinConfig, "Compositing"); - QString oldBackend = config.readEntry("Backend", "OpenGL"); - config.writeEntry("Backend", "OpenGL"); - config.sync(); - updateStatusUI(false); - config.writeEntry("Backend", oldBackend); - config.sync(); - ui.tabWidget->setCurrentIndex(0); - return; - } - // Save current config. We'll use this for restoring in case something goes wrong. KConfigGroup config(mKWinConfig, "Compositing"); mPreviousConfig = config.entryMap(); @@ -710,10 +594,6 @@ void KWinCompositingConfig::showDetailedEffectLoadingInformation() "%1 effect failed to load due to unknown reason."); const KLocalizedString requiresShaders = ki18nc("Effect with given name could not be activated as it requires hardware shaders", "%1 effect requires hardware support."); - const KLocalizedString requiresOpenGL = ki18nc("Effect with given name could not be activated as it requires OpenGL", - "%1 effect requires OpenGL."); - const KLocalizedString requiresOpenGL2 = ki18nc("Effect with given name could not be activated as it requires OpenGL 2", - "%1 effect requires OpenGL 2."); KDialog *dialog = new KDialog(this); dialog->setWindowTitle(i18nc("Window title", "List of effects which could not be loaded")); dialog->setButtons(KDialog::Ok); @@ -740,36 +620,7 @@ void KWinCompositingConfig::showDetailedEffectLoadingInformation() services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == '" + effect + '\''); if (!services.isEmpty()) { KService::Ptr service = services.first(); - if (compositingType == "xrender") { - // XRender compositing - QVariant openGL = service->property("X-KWin-Requires-OpenGL"); - QVariant openGL2 = service->property("X-KWin-Requires-OpenGL2"); - if ((openGL.isValid() && openGL.toBool()) || - (openGL2.isValid() && openGL2.toBool())) { - // effect requires OpenGL - message = requiresOpenGL.subs(service->name()).toString(); - } else { - // effect does not require OpenGL, unknown reason - message = unknownReason.subs(service->name()).toString(); - } - } else if (compositingType == "gl1") { - // OpenGL 1 compositing - QVariant openGL2 = service->property("X-KWin-Requires-OpenGL2"); - QVariant shaders = service->property("X-KWin-Requires-Shaders"); - if (openGL2.isValid() && openGL2.toBool()) { - // effect requires OpenGL 2 - message = requiresOpenGL2.subs(service->name()).toString(); - } else if (shaders.isValid() && shaders.toBool()) { - // effect requires hardware shaders - message = requiresShaders.subs(service->name()).toString(); - } else { - // unknown reason - message = unknownReason.subs(service->name()).toString(); - } - } else { - // OpenGL 2 compositing - unknown reason - message = unknownReason.subs(service->name()).toString(); - } + message = unknownReason.subs(service->name()).toString(); } else { message = unknownReason.subs(effect).toString(); } @@ -853,13 +704,10 @@ void KWinCompositingConfig::defaults() ui.effectSelector->defaults(); - ui.compositingType->setCurrentIndex(OPENGL20_INDEX); + ui.compositingType->setCurrentIndex(XRENDER_INDEX); ui.windowThumbnails->setCurrentIndex(1); ui.unredirectFullscreen->setChecked(false); ui.xrScaleFilter->setCurrentIndex(0); - ui.glScaleFilter->setCurrentIndex(2); - ui.glSwapStrategy->setCurrentIndex(ui.glSwapStrategy->findData("a")); - ui.glColorCorrection->setChecked(false); } QString KWinCompositingConfig::quickHelp() const diff --git a/kwin/kcmkwin/kwincompositing/main.h b/kwin/kcmkwin/kwincompositing/main.h index 68dd8d0a..5d21047a 100644 --- a/kwin/kcmkwin/kwincompositing/main.h +++ b/kwin/kcmkwin/kwincompositing/main.h @@ -78,8 +78,6 @@ public slots: private slots: void confirmReInit() { showConfirmDialog(true); } - void glSwapStrategyChanged(int idx); - void rearmGlSupport(); void suggestGraphicsSystem(); void alignGuiToCompositingType(int compositingType); void toggleEffectShortcutChanged(const QKeySequence &seq); diff --git a/kwin/kcmkwin/kwincompositing/main.ui b/kwin/kcmkwin/kwincompositing/main.ui index 068bfbd8..3692e764 100644 --- a/kwin/kcmkwin/kwincompositing/main.ui +++ b/kwin/kcmkwin/kwincompositing/main.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>583</width> - <height>550</height> + <height>389</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_4"> @@ -77,71 +77,6 @@ </item> </layout> </item> - <item> - <widget class="QWidget" name="rearmGlSupport" native="true"> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="1" colspan="2"> - <widget class="QLabel" name="label_9"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Pressing this button can crash the desktop.</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="0" rowspan="3"> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>125</width> - <height>71</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" colspan="2"> - <widget class="QCheckBox" name="rearmSafetyCheck"> - <property name="text"> - <string>I have saved my data.</string> - </property> - </widget> - </item> - <item row="0" column="3" rowspan="3"> - <spacer name="horizontalSpacer_15"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>125</width> - <height>71</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="1" colspan="2"> - <widget class="QPushButton" name="rearmGlSupportButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Re-enable OpenGL detection</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="spacing"> @@ -470,7 +405,7 @@ <attribute name="title"> <string>Advanced</string> </attribute> - <layout class="QGridLayout" name="gridLayout_6" rowstretch="1,0,2,0,0,0,10"> + <layout class="QGridLayout" name="gridLayout_6" rowstretch="1,0,0,0,0,0"> <item row="0" column="2"> <spacer name="verticalSpacer_2"> <property name="orientation"> @@ -487,7 +422,7 @@ </property> </spacer> </item> - <item row="0" column="4" rowspan="7"> + <item row="0" column="4" rowspan="6"> <spacer name="horizontalSpacer_11"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -513,71 +448,7 @@ </property> </spacer> </item> - <item row="5" column="1" colspan="3"> - <widget class="QGroupBox" name="glGroup"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>OpenGL Options</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="3" column="0"> - <widget class="QCheckBox" name="glColorCorrection"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string><p>Activates color correction if possible, using the Kolor-Manager. Requires OpenGL 2 Shaders to be enabled and Kolor-Manager to be installed. May fail silently.</p><p><strong>Experimental</strong>.</p></string> - </property> - <property name="text"> - <string>Enable color correction (experimental)</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,5"> - <item> - <widget class="QLabel" name="glSwapStrategyLabel"> - <property name="text"> - <string>Tearing Prevention (VSync)</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>glSwapStrategy</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="glSwapStrategy"/> - </item> - </layout> - </item> - <item row="0" column="1"> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item row="6" column="2"> + <item row="5" column="2"> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -702,44 +573,6 @@ p, li { white-space: pre-wrap; } </item> </widget> </item> - <item> - <widget class="QComboBox" name="glScaleFilter"> - <property name="toolTip"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Crisp:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">GL_NEAREST</span> - (very) fast on all GPUs but looks bricky</p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Smooth:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">GL_LINEAR</span> - fast on most GPUs but a little blurry</p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Accurate:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Lanczos filter, requires glsl shader support.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Might be slow on weaker GPUs and even cause various troubles with broken drivers (from overbrightening to segfaults).</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Fall back to &quot;Smooth&quot; if you have problems.</p></body></html></string> - </property> - <property name="currentIndex"> - <number>1</number> - </property> - <item> - <property name="text"> - <string>Crisp</string> - </property> - </item> - <item> - <property name="text"> - <string>Smooth</string> - </property> - </item> - <item> - <property name="text"> - <string>Accurate</string> - </property> - </item> - </widget> - </item> </layout> </item> <item row="2" column="0" colspan="2"> @@ -752,7 +585,7 @@ p, li { white-space: pre-wrap; } </layout> </widget> </item> - <item row="0" column="0" rowspan="7"> + <item row="0" column="0" rowspan="6"> <spacer name="horizontalSpacer_10"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -807,26 +640,16 @@ p, li { white-space: pre-wrap; } <verstretch>0</verstretch> </sizepolicy> </property> - <item> - <property name="text"> - <string>OpenGL 3.1</string> - </property> - </item> - <item> - <property name="text"> - <string>OpenGL 2.0</string> - </property> - </item> - <item> - <property name="text"> - <string>OpenGL 1.2</string> - </property> - </item> <item> <property name="text"> <string>XRender</string> </property> </item> + <item> + <property name="text"> + <string>None</string> + </property> + </item> </widget> </item> <item row="1" column="0"> @@ -845,10 +668,10 @@ p, li { white-space: pre-wrap; } <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">It is <span style=" font-weight:600;">strongly recommended</span> to use the <span style=" font-weight:600;">native</span> system when using the <span style=" font-weight:600;">XRender</span> backend.</p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">On the other hand, many decorations perform better with the <span style=" font-weight:600;">raster</span> system on the <span style=" font-weight:600;">default and generally preferred OpenGL</span> backend (though some don't - also the impact here can be anything between &quot;slight&quot; and &quot;incredible&quot; depending on the GPU and driver)</p></body></html></string> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Segoe'; font-size:8pt;">It is </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">strongly recommended</span><span style=" font-family:'Segoe'; font-size:8pt;"> to use the </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">native</span><span style=" font-family:'Segoe'; font-size:8pt;"> system when using the </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">XRender</span><span style=" font-family:'Segoe'; font-size:8pt;"> backend.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Segoe'; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Segoe'; font-size:8pt;">On the other hand, many decorations perform better with the </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">raster</span><span style=" font-family:'Segoe'; font-size:8pt;"> system (though some don't - also the impact here can be anything between &quot;slight&quot; and &quot;incredible&quot; depending on the GPU and driver)</span></p></body></html></string> </property> <item> <property name="text"> @@ -878,8 +701,6 @@ p, li { white-space: pre-wrap; } </spacer> </item> </layout> - <zorder>groupBox_3</zorder> - <zorder>glGroup</zorder> </widget> </widget> </item> @@ -916,8 +737,6 @@ p, li { white-space: pre-wrap; } </customwidgets> <tabstops> <tabstop>tabWidget</tabstop> - <tabstop>rearmSafetyCheck</tabstop> - <tabstop>rearmGlSupportButton</tabstop> <tabstop>useCompositing</tabstop> <tabstop>effectWinManagement</tabstop> <tabstop>effectAnimations</tabstop> @@ -928,28 +747,8 @@ p, li { white-space: pre-wrap; } <tabstop>graphicsSystem</tabstop> <tabstop>windowThumbnails</tabstop> <tabstop>xrScaleFilter</tabstop> - <tabstop>glScaleFilter</tabstop> <tabstop>unredirectFullscreen</tabstop> - <tabstop>glSwapStrategy</tabstop> - <tabstop>glColorCorrection</tabstop> </tabstops> <resources/> - <connections> - <connection> - <sender>rearmSafetyCheck</sender> - <signal>toggled(bool)</signal> - <receiver>rearmGlSupportButton</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>312</x> - <y>119</y> - </hint> - <hint type="destinationlabel"> - <x>345</x> - <y>146</y> - </hint> - </hints> - </connection> - </connections> + <connections/> </ui> diff --git a/kwin/kcmkwin/kwindecoration/preview.cpp b/kwin/kcmkwin/kwindecoration/preview.cpp index 767df783..ffdb8b53 100644 --- a/kwin/kcmkwin/kwindecoration/preview.cpp +++ b/kwin/kcmkwin/kwindecoration/preview.cpp @@ -118,13 +118,11 @@ void KDecorationPreview::render(QPainter *painter, KDecoration *decoration, cons int padLeft, padRight, padTop, padBottom; padLeft = padRight = padTop = padBottom = 0; bool useMask = true; - if (KDecorationUnstable *unstable = qobject_cast<KDecorationUnstable *>(decoration)) { - unstable->padding(padLeft, padRight, padTop, padBottom); - size.setWidth(size.width() + padLeft + padRight); - size.setHeight(size.height() + padTop + padBottom); - if (padLeft || padRight || padTop || padBottom) { - useMask = false; - } + decoration->padding(padLeft, padRight, padTop, padBottom); + size.setWidth(size.width() + padLeft + padRight); + size.setHeight(size.height() + padTop + padBottom); + if (padLeft || padRight || padTop || padBottom) { + useMask = false; } decoration->resize(size); diff --git a/kwin/kcmkwin/kwindecoration/preview.h b/kwin/kcmkwin/kwindecoration/preview.h index eeb3e1cd..2e2017b6 100644 --- a/kwin/kcmkwin/kwindecoration/preview.h +++ b/kwin/kcmkwin/kwindecoration/preview.h @@ -60,7 +60,7 @@ private: }; class KDecorationPreviewBridge - : public KDecorationBridgeUnstable + : public KDecorationBridge { public: KDecorationPreviewBridge(KDecorationPreview* preview, bool active); diff --git a/kwin/kwin.kcfg b/kwin/kwin.kcfg index 0b17c66f..1f2cae44 100644 --- a/kwin/kwin.kcfg +++ b/kwin/kwin.kcfg @@ -230,25 +230,11 @@ <default>6144</default> </entry> <entry name="Backend" type="String"> - <default>OpenGL</default> + <default>XRender</default> </entry> <entry name="Enabled" type="Bool"> <default>true</default> </entry> - <entry name="GLTextureFilter" type="Int"> - <default>2</default> - <min>-1</min> - <max>2</max> - </entry> - <entry name="GLStrictBinding" type="Bool"> - <default>true</default> - </entry> - <entry name="GLLegacy" type="Bool"> - <default>false</default> - </entry> - <entry name="GLColorCorrection" type="Bool"> - <default>false</default> - </entry> <entry name="XRenderSmoothScale" type="Bool"> <default>false</default> </entry> diff --git a/kwin/lanczosfilter.cpp b/kwin/lanczosfilter.cpp deleted file mode 100644 index c5fae4a9..00000000 --- a/kwin/lanczosfilter.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010 by Fredrik Höglund <fredrik@kde.org> -Copyright (C) 2010 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#include "lanczosfilter.h" -#include "client.h" -#include "deleted.h" -#include "effects.h" -#include "unmanaged.h" -#include "options.h" -#include "workspace.h" - -#include <kwinglutils.h> -#include <kwinglplatform.h> - -#include <kwineffects.h> -#include <KGlobalSettings> - -#include <qmath.h> -#include <cmath> - -namespace KWin -{ - -LanczosFilter::LanczosFilter(QObject* parent) - : QObject(parent) - , m_offscreenTex(0) - , m_offscreenTarget(0) - , m_inited(false) - , m_shader(0) - , m_uTexUnit(0) - , m_uOffsets(0) - , m_uKernel(0) -{ -} - -LanczosFilter::~LanczosFilter() -{ - delete m_offscreenTarget; - delete m_offscreenTex; -} - -void LanczosFilter::init() -{ - if (m_inited) - return; - m_inited = true; - const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0); - if (force) { - kWarning(1212) << "Lanczos Filter forced on by environment variable"; - } - - if (!force && options->glSmoothScale() != 2) - return; // disabled by config - if (!GLRenderTarget::supported()) - return; - - GLPlatform *gl = GLPlatform::instance(); - if (!force) { - // The lanczos filter is reported to be broken with the Intel driver prior SandyBridge - if (gl->driver() == Driver_Intel && gl->chipClass() < SandyBridge) - return; - // Broken on Intel chips with Mesa 9.1 - BUG 313613 - if (gl->driver() == Driver_Intel && gl->mesaVersion() >= kVersionNumber(9, 1) && gl->mesaVersion() < kVersionNumber(9, 2)) - return; - // also radeon before R600 has trouble - if (gl->isRadeon() && gl->chipClass() < R600) - return; - } - m_shader.reset(ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, - gl->glslVersion() >= kVersionNumber(1, 40) ? - ":/resources/shaders/1.40/lanczos-fragment.glsl" : - ":/resources/shaders/1.10/lanczos-fragment.glsl")); - if (m_shader->isValid()) { - ShaderBinder binder(m_shader.data()); - m_uTexUnit = m_shader->uniformLocation("texUnit"); - m_uKernel = m_shader->uniformLocation("kernel"); - m_uOffsets = m_shader->uniformLocation("offsets"); - } else { - kDebug(1212) << "Shader is not valid"; - m_shader.reset(); - } -} - - -void LanczosFilter::updateOffscreenSurfaces() -{ - int w = displayWidth(); - int h = displayHeight(); - if (!GLTexture::NPOTTextureSupported()) { - w = nearestPowerOfTwo(w); - h = nearestPowerOfTwo(h); - } - if (!m_offscreenTex || m_offscreenTex->width() != w || m_offscreenTex->height() != h) { - if (m_offscreenTex) { - delete m_offscreenTex; - delete m_offscreenTarget; - } - m_offscreenTex = new GLTexture(w, h); - m_offscreenTex->setFilter(GL_LINEAR); - m_offscreenTex->setWrapMode(GL_CLAMP_TO_EDGE); - m_offscreenTarget = new GLRenderTarget(*m_offscreenTex); - } -} - -static float sinc(float x) -{ - return std::sin(x * M_PI) / (x * M_PI); -} - -static float lanczos(float x, float a) -{ - if (qFuzzyCompare(x + 1.0, 1.0)) - return 1.0; - - if (qAbs(x) >= a) - return 0.0; - - return sinc(x) * sinc(x / a); -} - -void LanczosFilter::createKernel(float delta, int *size) -{ - const float a = 2.0; - - // The two outermost samples always fall at points where the lanczos - // function returns 0, so we'll skip them. - const int sampleCount = qBound(3, qCeil(delta * a) * 2 + 1 - 2, 29); - const int center = sampleCount / 2; - const int kernelSize = center + 1; - const float factor = 1.0 / delta; - - QVector<float> values(kernelSize); - float sum = 0; - - for (int i = 0; i < kernelSize; i++) { - const float val = lanczos(i * factor, a); - sum += i > 0 ? val * 2 : val; - values[i] = val; - } - - memset(m_kernel, 0, 16 * sizeof(QVector4D)); - - // Normalize the kernel - for (int i = 0; i < kernelSize; i++) { - const float val = values[i] / sum; - m_kernel[i] = QVector4D(val, val, val, val); - } - - *size = kernelSize; -} - -void LanczosFilter::createOffsets(int count, float width, Qt::Orientation direction) -{ - memset(m_offsets, 0, 16 * sizeof(QVector2D)); - for (int i = 0; i < count; i++) { - m_offsets[i] = (direction == Qt::Horizontal) ? - QVector2D(i / width, 0) : QVector2D(0, i / width); - } -} - -void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data) -{ - if ((data.xScale() < 0.9 || data.yScale() < 0.9) && - KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) { - if (!m_inited) - init(); - const QRect screenRect = Workspace::self()->clientArea(ScreenArea, w->screen(), w->desktop()); - // window geometry may not be bigger than screen geometry to fit into the FBO - QRect winGeo(w->expandedGeometry()); - if (m_shader && winGeo.width() <= screenRect.width() && winGeo.height() <= screenRect.height()) { - winGeo.translate(-w->geometry().topLeft()); - double left = winGeo.left(); - double top = winGeo.top(); - double width = winGeo.right() - left; - double height = winGeo.bottom() - top; - - int tx = data.xTranslation() + w->x() + left * data.xScale(); - int ty = data.yTranslation() + w->y() + top * data.yScale(); - int tw = width * data.xScale(); - int th = height * data.yScale(); - const QRect textureRect(tx, ty, tw, th); - const bool hardwareClipping = !(QRegion(textureRect)-region).isEmpty(); - - int sw = width; - int sh = height; - - GLTexture *cachedTexture = static_cast< GLTexture*>(w->data(LanczosCacheRole).value<void*>()); - if (cachedTexture) { - if (cachedTexture->width() == tw && cachedTexture->height() == th) { - cachedTexture->bind(); - if (hardwareClipping) { - glEnable(GL_SCISSOR_TEST); - } - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - const qreal rgb = data.brightness() * data.opacity(); - const qreal a = data.opacity(); - - ShaderBinder binder(ShaderManager::SimpleShader); - GLShader *shader = binder.shader(); - shader->setUniform(GLShader::Offset, QVector2D(0, 0)); - shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); - shader->setUniform(GLShader::Saturation, data.saturation()); - - cachedTexture->render(region, textureRect, hardwareClipping); - - glDisable(GL_BLEND); - if (hardwareClipping) { - glDisable(GL_SCISSOR_TEST); - } - cachedTexture->unbind(); - m_timer.start(5000, this); - return; - } else { - // offscreen texture not matching - delete - delete cachedTexture; - cachedTexture = 0; - w->setData(LanczosCacheRole, QVariant()); - } - } - - WindowPaintData thumbData = data; - thumbData.setXScale(1.0); - thumbData.setYScale(1.0); - thumbData.setXTranslation(-w->x() - left); - thumbData.setYTranslation(-w->y() - top); - thumbData.setBrightness(1.0); - thumbData.setOpacity(1.0); - thumbData.setSaturation(1.0); - - // Bind the offscreen FBO and draw the window on it unscaled - updateOffscreenSurfaces(); - GLRenderTarget::pushRenderTarget(m_offscreenTarget); - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - w->sceneWindow()->performPaint(mask, infiniteRegion(), thumbData); - - // Create a scratch texture and copy the rendered window into it - GLTexture tex(sw, sh); - tex.setFilter(GL_LINEAR); - tex.setWrapMode(GL_CLAMP_TO_EDGE); - tex.bind(); - - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, m_offscreenTex->height() - sh, sw, sh); - - // Set up the shader for horizontal scaling - float dx = sw / float(tw); - int kernelSize; - createKernel(dx, &kernelSize); - createOffsets(kernelSize, sw, Qt::Horizontal); - - ShaderManager::instance()->pushShader(m_shader.data()); - setUniforms(); - - // Draw the window back into the FBO, this time scaled horizontally - glClear(GL_COLOR_BUFFER_BIT); - QVector<float> verts; - QVector<float> texCoords; - verts.reserve(12); - texCoords.reserve(12); - - texCoords << 1.0 << 0.0; verts << tw << 0.0; // Top right - texCoords << 0.0 << 0.0; verts << 0.0 << 0.0; // Top left - texCoords << 0.0 << 1.0; verts << 0.0 << sh; // Bottom left - texCoords << 0.0 << 1.0; verts << 0.0 << sh; // Bottom left - texCoords << 1.0 << 1.0; verts << tw << sh; // Bottom right - texCoords << 1.0 << 0.0; verts << tw << 0.0; // Top right - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setData(6, 2, verts.constData(), texCoords.constData()); - vbo->render(GL_TRIANGLES); - - // At this point we don't need the scratch texture anymore - tex.unbind(); - tex.discard(); - - // create scratch texture for second rendering pass - GLTexture tex2(tw, sh); - tex2.setFilter(GL_LINEAR); - tex2.setWrapMode(GL_CLAMP_TO_EDGE); - tex2.bind(); - - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, m_offscreenTex->height() - sh, tw, sh); - - // Set up the shader for vertical scaling - float dy = sh / float(th); - createKernel(dy, &kernelSize); - createOffsets(kernelSize, m_offscreenTex->height(), Qt::Vertical); - setUniforms(); - - // Now draw the horizontally scaled window in the FBO at the right - // coordinates on the screen, while scaling it vertically and blending it. - glClear(GL_COLOR_BUFFER_BIT); - - verts.clear(); - - verts << tw << 0.0; // Top right - verts << 0.0 << 0.0; // Top left - verts << 0.0 << th; // Bottom left - verts << 0.0 << th; // Bottom left - verts << tw << th; // Bottom right - verts << tw << 0.0; // Top right - vbo->setData(6, 2, verts.constData(), texCoords.constData()); - vbo->render(GL_TRIANGLES); - - tex2.unbind(); - tex2.discard(); - ShaderManager::instance()->popShader(); - - // create cache texture - GLTexture *cache = new GLTexture(tw, th); - - cache->setFilter(GL_LINEAR); - cache->setWrapMode(GL_CLAMP_TO_EDGE); - cache->bind(); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, m_offscreenTex->height() - th, tw, th); - GLRenderTarget::popRenderTarget(); - - if (hardwareClipping) { - glEnable(GL_SCISSOR_TEST); - } - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - const qreal rgb = data.brightness() * data.opacity(); - const qreal a = data.opacity(); - - ShaderBinder binder(ShaderManager::SimpleShader); - GLShader *shader = binder.shader(); - shader->setUniform(GLShader::Offset, QVector2D(0, 0)); - shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); - shader->setUniform(GLShader::Saturation, data.saturation()); - - cache->render(region, textureRect, hardwareClipping); - - glDisable(GL_BLEND); - - if (hardwareClipping) { - glDisable(GL_SCISSOR_TEST); - } - - cache->unbind(); - w->setData(LanczosCacheRole, QVariant::fromValue(static_cast<void*>(cache))); - - // Delete the offscreen surface after 5 seconds - m_timer.start(5000, this); - return; - } - } // if ( effects->compositingType() == KWin::OpenGLCompositing ) - w->sceneWindow()->performPaint(mask, region, data); -} // End of function - -void LanczosFilter::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == m_timer.timerId()) { - m_timer.stop(); - - delete m_offscreenTarget; - delete m_offscreenTex; - m_offscreenTarget = 0; - m_offscreenTex = 0; - foreach (Client *c, Workspace::self()->clientList()) { - discardCacheTexture(c->effectWindow()); - } - foreach (Client *c, Workspace::self()->desktopList()) { - discardCacheTexture(c->effectWindow()); - } - foreach (Unmanaged *u, Workspace::self()->unmanagedList()) { - discardCacheTexture(u->effectWindow()); - } - foreach (Deleted *d, Workspace::self()->deletedList()) { - discardCacheTexture(d->effectWindow()); - } - } -} - -void LanczosFilter::discardCacheTexture(EffectWindow *w) -{ - QVariant cachedTextureVariant = w->data(LanczosCacheRole); - if (cachedTextureVariant.isValid()) { - delete static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); - w->setData(LanczosCacheRole, QVariant()); - } -} - -void LanczosFilter::setUniforms() -{ - glUniform1i(m_uTexUnit, 0); - glUniform2fv(m_uOffsets, 16, (const GLfloat*)m_offsets); - glUniform4fv(m_uKernel, 16, (const GLfloat*)m_kernel); -} - -} // namespace - diff --git a/kwin/lanczosfilter.h b/kwin/lanczosfilter.h deleted file mode 100644 index 12a844ee..00000000 --- a/kwin/lanczosfilter.h +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010 by Fredrik Höglund <fredrik@kde.org> -Copyright (C) 2010 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_LANCZOSFILTER_P_H -#define KWIN_LANCZOSFILTER_P_H - -#include <QObject> -#include <QBasicTimer> -#include <QVector> -#include <QVector2D> -#include <QVector4D> - -#include <kwinconfig.h> - -namespace KWin -{ - -class EffectWindow; -class EffectWindowImpl; -class WindowPaintData; -class GLTexture; -class GLRenderTarget; -class GLShader; - -class LanczosFilter - : public QObject -{ - Q_OBJECT - -public: - explicit LanczosFilter(QObject* parent = 0); - ~LanczosFilter(); - void performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data); - -protected: - virtual void timerEvent(QTimerEvent*); -private: - void init(); - void updateOffscreenSurfaces(); - void setUniforms(); - void discardCacheTexture(EffectWindow *w); - - void createKernel(float delta, int *kernelSize); - void createOffsets(int count, float width, Qt::Orientation direction); - GLTexture *m_offscreenTex; - GLRenderTarget *m_offscreenTarget; - QBasicTimer m_timer; - bool m_inited; - QScopedPointer<GLShader> m_shader; - int m_uTexUnit; - int m_uOffsets; - int m_uKernel; - QVector2D m_offsets[16]; - QVector4D m_kernel[16]; -}; - -} // namespace - -#endif // KWIN_LANCZOSFILTER_P_H diff --git a/kwin/libkdecorations/kcommondecoration.cpp b/kwin/libkdecorations/kcommondecoration.cpp index a89cf6d2..3bad31d8 100644 --- a/kwin/libkdecorations/kcommondecoration.cpp +++ b/kwin/libkdecorations/kcommondecoration.cpp @@ -1118,14 +1118,6 @@ void KCommonDecorationButton::mouseReleaseEvent(QMouseEvent* e) // *** wrap everything from KDecoration *** // -bool KCommonDecoration::drawbound(const QRect&, bool) -{ - return false; -} -bool KCommonDecoration::windowDocked(Position) -{ - return false; -} const KDecorationOptions* KCommonDecoration::options() { return KDecoration::options(); @@ -1357,94 +1349,5 @@ KDecoration* KCommonDecoration::decoration() return wrapper; } - -KCommonDecorationUnstable::KCommonDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory) - : KCommonDecoration(bridge, factory) -{ - Q_ASSERT(dynamic_cast<const KDecorationUnstable*>(decoration())); -} - -KCommonDecorationUnstable::~KCommonDecorationUnstable() -{ -} - -// All copied from kdecoration.cpp -bool KCommonDecorationUnstable::compositingActive() const -{ - return static_cast<const KDecorationUnstable*>(decoration())->compositingActive(); -} - -// Window tabbing - -int KCommonDecorationUnstable::tabCount() const -{ - return static_cast<const KDecorationUnstable*>(decoration())->tabCount(); -} - -QString KCommonDecorationUnstable::caption(int idx) const -{ - return static_cast<const KDecorationUnstable*>(decoration())->caption(idx); -} - -QIcon KCommonDecorationUnstable::icon(int idx) const -{ - return static_cast<const KDecorationUnstable*>(decoration())->icon(idx); -} - -long KCommonDecorationUnstable::tabId(int idx) const -{ - return static_cast<const KDecorationUnstable*>(decoration())->tabId(idx); -} - -long KCommonDecorationUnstable::currentTabId() const -{ - return static_cast<const KDecorationUnstable*>(decoration())->currentTabId(); -} - -void KCommonDecorationUnstable::setCurrentTab(long id) -{ - static_cast<KDecorationUnstable*>(decoration())->setCurrentTab(id); -} - -void KCommonDecorationUnstable::tab_A_before_B(long A, long B) -{ - static_cast<KDecorationUnstable*>(decoration())->tab_A_before_B(A, B); -} - -void KCommonDecorationUnstable::tab_A_behind_B(long A, long B) -{ - static_cast<KDecorationUnstable*>(decoration())->tab_A_behind_B(A, B); -} - -void KCommonDecorationUnstable::untab(long id, const QRect& newGeom) -{ - static_cast<KDecorationUnstable*>(decoration())->untab(id, newGeom); -} - -void KCommonDecorationUnstable::closeTab(long id) -{ - static_cast<KDecorationUnstable*>(decoration())->closeTab(id); -} - -void KCommonDecorationUnstable::closeTabGroup() -{ - static_cast<KDecorationUnstable*>(decoration())->closeTabGroup(); -} - -void KCommonDecorationUnstable::showWindowMenu(const QPoint &pos, long id) -{ - static_cast<KDecorationUnstable*>(decoration())->showWindowMenu(pos, id); -} - -KDecoration::WindowOperation KCommonDecorationUnstable::buttonToWindowOperation(Qt::MouseButtons button) -{ - return static_cast<KDecorationUnstable*>(decoration())->buttonToWindowOperation(button); -} - -bool KCommonDecorationUnstable::eventFilter(QObject* o, QEvent* e) -{ - return KCommonDecoration::eventFilter(o, e); -} - // kate: space-indent on; indent-width 4; mixedindent off; indent-mode cstyle; diff --git a/kwin/libkdecorations/kcommondecoration.h b/kwin/libkdecorations/kcommondecoration.h index fb0807a9..8d5a3968 100644 --- a/kwin/libkdecorations/kcommondecoration.h +++ b/kwin/libkdecorations/kcommondecoration.h @@ -247,7 +247,6 @@ public: */ QRect transparentRect() const; -public: /** * Handles widget and layout creation, call the base implementation when subclassing this member. */ @@ -286,10 +285,6 @@ public: virtual void mouseDoubleClickEvent(QMouseEvent *e); virtual void wheelEvent(QWheelEvent *e); - // *** wrap everything from KDecoration *** // - // reimplementing from KDecoration (wrapped) - virtual bool drawbound(const QRect& geom, bool clear); - virtual bool windowDocked(Position side); // wrap everything KDecoration provides static const KDecorationOptions* options(); bool isActive() const; @@ -355,6 +350,35 @@ public: // access the KDecoration wrapper const KDecoration* decoration() const; KDecoration* decoration(); + // and some convenience methods, all copied from kdecoration.cpp + inline bool compositingActive() const + { return decoration()->compositingActive(); }; + inline int tabCount() const + { return decoration()->tabCount(); }; + inline QString caption(int idx) const + { return decoration()->caption(idx); }; + inline QIcon icon(int idx) const + { return decoration()->icon(idx); }; + inline long tabId(int idx) const + { return decoration()->tabId(idx); }; + inline long currentTabId() const + { return decoration()->currentTabId(); }; + inline void setCurrentTab(long id) + { decoration()->setCurrentTab(id); }; + inline void tab_A_before_B(long A, long B) + { decoration()->tab_A_before_B(A, B); }; + inline void tab_A_behind_B(long A, long B) + { decoration()->tab_A_behind_B(A, B); }; + inline void untab(long id, const QRect& newGeom) + { decoration()->untab(id, newGeom); }; + inline void closeTab(long id) + { decoration()->closeTab(id); }; + inline void closeTabGroup() + { decoration()->closeTabGroup(); }; + inline void showWindowMenu(const QPoint &pos, long id) + { decoration()->showWindowMenu(pos, id); }; + inline WindowOperation buttonToWindowOperation(Qt::MouseButtons button) + { return decoration()->buttonToWindowOperation(button); }; protected: virtual void timerEvent(QTimerEvent *event); @@ -416,34 +440,6 @@ private: KCommonDecorationPrivate *d; }; -class KWIN_EXPORT KCommonDecorationUnstable - : public KCommonDecoration -{ - Q_OBJECT -public: - KCommonDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory); - virtual ~KCommonDecorationUnstable(); - bool compositingActive() const; - - // Window tabbing - using KCommonDecoration::caption; - QString caption(int idx) const; - void closeTab(long id); - void closeTabGroup(); - long currentTabId() const; - QIcon icon(int idx = 0) const; - void setCurrentTab(long id); - void showWindowMenu(const QPoint &, long id); - void tab_A_before_B(long A, long B); - void tab_A_behind_B(long A, long B); - int tabCount() const; - long tabId(int idx) const; - void untab(long id, const QRect& newGeom); - - WindowOperation buttonToWindowOperation(Qt::MouseButtons button); - virtual bool eventFilter(QObject* o, QEvent* e); -}; - /** * Title bar buttons of KCommonDecoration need to inherit this class. */ diff --git a/kwin/libkdecorations/kcommondecoration_p.cpp b/kwin/libkdecorations/kcommondecoration_p.cpp index e51f3a67..0860b715 100644 --- a/kwin/libkdecorations/kcommondecoration_p.cpp +++ b/kwin/libkdecorations/kcommondecoration_p.cpp @@ -32,7 +32,7 @@ #include "moc_kcommondecoration_p.cpp" KCommonDecorationWrapper::KCommonDecorationWrapper(KCommonDecoration* deco, KDecorationBridge* bridge, KDecorationFactory* factory) - : KDecorationUnstable(bridge, factory) + : KDecoration(bridge, factory) , decoration(deco) { } @@ -98,16 +98,6 @@ void KCommonDecorationWrapper::shadeChange() return decoration->shadeChange(); } -bool KCommonDecorationWrapper::drawbound(const QRect& geom, bool clear) -{ - return decoration->drawbound(geom, clear); -} - -bool KCommonDecorationWrapper::windowDocked(Position side) -{ - return decoration->windowDocked(side); -} - void KCommonDecorationWrapper::reset(unsigned long changed) { return decoration->reset(changed); diff --git a/kwin/libkdecorations/kcommondecoration_p.h b/kwin/libkdecorations/kcommondecoration_p.h index df4d4b39..63ea7253 100644 --- a/kwin/libkdecorations/kcommondecoration_p.h +++ b/kwin/libkdecorations/kcommondecoration_p.h @@ -32,13 +32,12 @@ // class KCommonDecoration; -class KCommonDecorationUnstable; class KDecorationBridge; class KDecorationFactory; // wrapper all functionality that needs reimplementing in KDecoration and forward it to KCommonDecoration class KCommonDecorationWrapper - : public KDecorationUnstable + : public KDecoration { Q_OBJECT public: @@ -55,8 +54,6 @@ public: virtual void maximizeChange(); virtual void desktopChange(); virtual void shadeChange(); - virtual bool drawbound(const QRect& geom, bool clear); - virtual bool windowDocked(Position side); virtual void reset(unsigned long changed); virtual void padding(int &left, int &right, int &top, int &bottom) const; diff --git a/kwin/libkdecorations/kdecoration.cpp b/kwin/libkdecorations/kdecoration.cpp index bd01f5b5..9b524832 100644 --- a/kwin/libkdecorations/kdecoration.cpp +++ b/kwin/libkdecorations/kdecoration.cpp @@ -350,16 +350,6 @@ void KDecoration::emitKeepBelowChanged(bool below) keepBelowChanged(below); } -bool KDecoration::drawbound(const QRect&, bool) -{ - return false; -} - -bool KDecoration::windowDocked(Position) -{ - return false; -} - void KDecoration::reset(unsigned long) { } @@ -411,10 +401,7 @@ KDecoration::Position KDecoration::mousePosition(const QPoint& p) const QRect KDecoration::transparentRect() const { - if (KDecorationBridgeUnstable *bridge2 = dynamic_cast<KDecorationBridgeUnstable*>(bridge_)) - return bridge2->transparentRect(); - else - return QRect(); + return bridge_->transparentRect(); } void KDecoration::setAlphaEnabled(bool enabled) @@ -431,92 +418,83 @@ bool KDecoration::isAlphaEnabled() const return d->alphaEnabled; } -KDecorationUnstable::KDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory) - : KDecoration(bridge, factory) +bool KDecoration::compositingActive() const { + return bridge_->compositingActive(); } -KDecorationUnstable::~KDecorationUnstable() -{ -} - -bool KDecorationUnstable::compositingActive() const -{ - return static_cast< KDecorationBridgeUnstable* >(bridge_)->compositingActive(); -} - -void KDecorationUnstable::padding(int &left, int &right, int &top, int &bottom) const +void KDecoration::padding(int &left, int &right, int &top, int &bottom) const { left = right = top = bottom = 0; } //BEGIN Window tabbing -int KDecorationUnstable::tabCount() const +int KDecoration::tabCount() const { - return static_cast< KDecorationBridgeUnstable* >(bridge_)->tabCount(); + return bridge_->tabCount(); } -long KDecorationUnstable::tabId(int idx) const +long KDecoration::tabId(int idx) const { - return static_cast< KDecorationBridgeUnstable* >(bridge_)->tabId(idx); + return bridge_->tabId(idx); } -QString KDecorationUnstable::caption(int idx) const +QString KDecoration::caption(int idx) const { - return static_cast< KDecorationBridgeUnstable* >(bridge_)->caption(idx); + return bridge_->caption(idx); } -QIcon KDecorationUnstable::icon(int idx) const +QIcon KDecoration::icon(int idx) const { - return static_cast< KDecorationBridgeUnstable* >(bridge_)->icon(idx); + return bridge_->icon(idx); } -long KDecorationUnstable::currentTabId() const +long KDecoration::currentTabId() const { - return static_cast< KDecorationBridgeUnstable* >(bridge_)->currentTabId(); + return bridge_->currentTabId(); } -void KDecorationUnstable::setCurrentTab(long id) +void KDecoration::setCurrentTab(long id) { - static_cast< KDecorationBridgeUnstable* >(bridge_)->setCurrentTab(id); + bridge_->setCurrentTab(id); } -void KDecorationUnstable::tab_A_before_B(long A, long B) +void KDecoration::tab_A_before_B(long A, long B) { - static_cast< KDecorationBridgeUnstable* >(bridge_)->tab_A_before_B(A, B); + bridge_->tab_A_before_B(A, B); } -void KDecorationUnstable::tab_A_behind_B(long A, long B) +void KDecoration::tab_A_behind_B(long A, long B) { - static_cast< KDecorationBridgeUnstable* >(bridge_)->tab_A_behind_B(A, B); + bridge_->tab_A_behind_B(A, B); } -void KDecorationUnstable::untab(long id, const QRect& newGeom) +void KDecoration::untab(long id, const QRect& newGeom) { - static_cast< KDecorationBridgeUnstable* >(bridge_)->untab(id, newGeom); + bridge_->untab(id, newGeom); } -void KDecorationUnstable::closeTab(long id) +void KDecoration::closeTab(long id) { - static_cast< KDecorationBridgeUnstable* >(bridge_)->closeTab(id); + bridge_->closeTab(id); } -void KDecorationUnstable::closeTabGroup() +void KDecoration::closeTabGroup() { - static_cast< KDecorationBridgeUnstable* >(bridge_)->closeTabGroup(); + bridge_->closeTabGroup(); } -void KDecorationUnstable::showWindowMenu(const QPoint &pos, long id) +void KDecoration::showWindowMenu(const QPoint &pos, long id) { - static_cast< KDecorationBridgeUnstable* >(bridge_)->showWindowMenu(pos, id); + bridge_->showWindowMenu(pos, id); } //END tabbing -KDecoration::WindowOperation KDecorationUnstable::buttonToWindowOperation(Qt::MouseButtons button) +KDecoration::WindowOperation KDecoration::buttonToWindowOperation(Qt::MouseButtons button) { - return static_cast< KDecorationBridgeUnstable* >(bridge_)->buttonToWindowOperation(button); + return bridge_->buttonToWindowOperation(button); } QRegion KDecoration::region(KDecorationDefines::Region) diff --git a/kwin/libkdecorations/kdecoration.h b/kwin/libkdecorations/kdecoration.h index 60054b7c..19390f2b 100644 --- a/kwin/libkdecorations/kdecoration.h +++ b/kwin/libkdecorations/kdecoration.h @@ -192,41 +192,38 @@ public: * @see KDecorationFactory::supports() */ enum Ability { - // announce - AbilityAnnounceButtons = 0, ///< decoration supports AbilityButton* values (always use) - AbilityAnnounceColors = 1, ///< decoration supports AbilityColor* values (always use), @deprecated @todo remove KDE5 // buttons - AbilityButtonMenu = 1000, ///< decoration supports the window menu button - AbilityButtonOnAllDesktops = 1001, ///< decoration supports the on all desktops button - AbilityButtonSpacer = 1002, ///< decoration supports inserting spacers between buttons - AbilityButtonHelp = 1003, ///< decoration supports what's this help button - AbilityButtonMinimize = 1004, ///< decoration supports a minimize button - AbilityButtonMaximize = 1005, ///< decoration supports a maximize button - AbilityButtonClose = 1006, ///< decoration supports a close button - AbilityButtonAboveOthers = 1007, ///< decoration supports an above button - AbilityButtonBelowOthers = 1008, ///< decoration supports a below button - AbilityButtonShade = 1009, ///< decoration supports a shade button - AbilityButtonResize = 1010, ///< decoration supports a resize button - AbilityButtonApplicationMenu = 1011, ///< decoration supports the application menu button + AbilityButtonMenu = 0, ///< decoration supports the window menu button + AbilityButtonOnAllDesktops = 1, ///< decoration supports the on all desktops button + AbilityButtonSpacer = 2, ///< decoration supports inserting spacers between buttons + AbilityButtonHelp = 3, ///< decoration supports what's this help button + AbilityButtonMinimize = 4, ///< decoration supports a minimize button + AbilityButtonMaximize = 5, ///< decoration supports a maximize button + AbilityButtonClose = 6, ///< decoration supports a close button + AbilityButtonAboveOthers = 7, ///< decoration supports an above button + AbilityButtonBelowOthers = 8, ///< decoration supports a below button + AbilityButtonShade = 9, ///< decoration supports a shade button + AbilityButtonResize = 10, ///< decoration supports a resize button + AbilityButtonApplicationMenu = 11, ///< decoration supports the application menu button // compositing - AbilityProvidesShadow = 3000, ///< The decoration draws its own shadows. + AbilityProvidesShadow = 12, ///< The decoration draws its own shadows. /// @since 4.3 - AbilityUsesAlphaChannel = 3001, ///< The decoration isn't clipped to the mask when compositing is enabled. + AbilityUsesAlphaChannel = 13, ///< The decoration isn't clipped to the mask when compositing is enabled. /// The mask is still used to define the input region and the blurred /// region, when the blur plugin is enabled. /// @since 4.3 - AbilityExtendIntoClientArea = 3002, ///< The decoration respects transparentRect() + AbilityExtendIntoClientArea = 14, ///< The decoration respects transparentRect() /// @since 4.4 - AbilityUsesBlurBehind = 3003, ///< The decoration wants the background to be blurred, when the blur plugin is enabled. + AbilityUsesBlurBehind = 15, ///< The decoration wants the background to be blurred, when the blur plugin is enabled. /// @since 4.6 - AbilityAnnounceAlphaChannel = 4004, ///< The decoration can tell whether it currently uses an alpha channel or not. Requires AbilityUsesAlphaChannel. + AbilityAnnounceAlphaChannel = 16, ///< The decoration can tell whether it currently uses an alpha channel or not. Requires AbilityUsesAlphaChannel. /// @since 4.10 // Tabbing - AbilityTabbing = 4000, ///< The decoration supports tabbing + AbilityTabbing = 17, ///< The decoration supports tabbing }; /** - * Regions that can be returned by KDecorationUnstable::region(). + * Regions that can be returned by KDecoration::region(). */ enum Region { /** @@ -735,6 +732,88 @@ public: */ virtual QSize minimumSize() const = 0; + /** + * This function can return additional padding values that are added outside the + * borders of the window, and can be used by the decoration if it wants to paint + * outside the frame. + * + * The typical use case is for drawing a drop shadow or glowing effect around the window. + * + * The area outside the frame cannot receive input, and when compositing is disabled, + * painting is clipped to the mask, or the window frame if no mask is defined. + */ + virtual void padding(int &left, int &right, int &top, int &bottom) const; + /** + * Returns @a true if compositing--and therefore ARGB--is enabled. + */ + bool compositingActive() const; + + // Window tabbing + + /** + * Returns whether or not this client group contains the active client. + */ + bool isInActiveTabGroup(); + /** + * Return the amount of tabs in this group + */ + int tabCount() const; + + /** + * Return the icon for the tab at index \p idx (\p idx must be smaller than tabCount()) + */ + QIcon icon(int idx) const; + + /** + * Return the caption for the tab at index \p idx (\p idx must be smaller than tabCount()) + */ + QString caption(int idx) const; + + /** + * Return the unique id for the tab at index \p idx (\p idx must be smaller than tabCount()) + */ + long tabId(int idx) const; + /** + * Returns the id of the currently active client in this group. + */ + long currentTabId() const; + /** + * Activate tab for the window with the id \p id. + */ + void setCurrentTab(long id); + + /** + * Entab windw with id \p A beFORE the window with the id \p B. + */ + virtual void tab_A_before_B(long A, long B); + /** + * Entab windw with id \p A beHIND the window with the id \p B. + */ + virtual void tab_A_behind_B(long A, long B); + /** + * Remove the window with the id \p id from its tabgroup and place it at \p newGeom + */ + virtual void untab(long id, const QRect& newGeom); + + /** + * Close the client with the id \p id. + */ + void closeTab(long id); + /** + * Close all windows in this group. + */ + void closeTabGroup(); + /** + * Display the right-click client menu belonging to the client at index \p index at the + * global coordinates specified by \p pos. + */ + void showWindowMenu(const QPoint& pos, long id); + /** + * Determine which action the user has mapped \p button to. Useful for determining whether + * a button press was for window tab dragging or for displaying the client menu. + */ + WindowOperation buttonToWindowOperation(Qt::MouseButtons button); + public Q_SLOTS: /** * This function is called whenever the window either becomes or stops being active. @@ -806,23 +885,6 @@ Q_SIGNALS: void alphaEnabledChanged(bool enabled); public: - /** - * This method is not any more invoked from KWin core since version 4.8. - * There is no need to implement it. - * - * @param geom The geometry at this the bound should be drawn - * @param clear @a true if the bound should be cleared (when doing the usual XOR - * painting this argument can be simply ignored) - * - * @see geometry() - * @deprecated - */ - virtual bool drawbound(const QRect& geom, bool clear); - /** - * @internal Reserved. - */ - // TODO position will need also values for top+left+bottom etc. docking ? - virtual bool windowDocked(Position side); /** * This function is called to reset the decoration on settings changes. * It is usually invoked by calling KDecorationFactory::resetDecorations(). @@ -993,112 +1055,11 @@ private: QWidget* w_; KDecorationFactory* factory_; friend class KDecorationOptions; // for options_ - friend class KDecorationUnstable; // for bridge_ static KDecorationOptions* options_; KDecorationPrivate* d; }; -/** - * @warning THIS CLASS IS UNSTABLE! - */ -class KWIN_EXPORT KDecorationUnstable - : public KDecoration -{ - Q_OBJECT - -public: - KDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory); - virtual ~KDecorationUnstable(); - /** - * This function can return additional padding values that are added outside the - * borders of the window, and can be used by the decoration if it wants to paint - * outside the frame. - * - * The typical use case is for drawing a drop shadow or glowing effect around the window. - * - * The area outside the frame cannot receive input, and when compositing is disabled, - * painting is clipped to the mask, or the window frame if no mask is defined. - */ - virtual void padding(int &left, int &right, int &top, int &bottom) const; - /** - * Returns @a true if compositing--and therefore ARGB--is enabled. - */ - bool compositingActive() const; - - // Window tabbing - - /** - * Returns whether or not this client group contains the active client. - */ - bool isInActiveTabGroup(); - /** - * Return the amount of tabs in this group - */ - int tabCount() const; - - /** - * Return the icon for the tab at index \p idx (\p idx must be smaller than tabCount()) - */ - QIcon icon(int idx) const; - - /** - * Return the caption for the tab at index \p idx (\p idx must be smaller than tabCount()) - */ - QString caption(int idx) const; - - /** - * Return the unique id for the tab at index \p idx (\p idx must be smaller than tabCount()) - */ - long tabId(int idx) const; - /** - * Returns the id of the currently active client in this group. - */ - long currentTabId() const; - /** - * Activate tab for the window with the id \p id. - */ - void setCurrentTab(long id); - - /** - * Entab windw with id \p A beFORE the window with the id \p B. - */ - virtual void tab_A_before_B(long A, long B); - /** - * Entab windw with id \p A beHIND the window with the id \p B. - */ - virtual void tab_A_behind_B(long A, long B); - /** - * Remove the window with the id \p id from its tabgroup and place it at \p newGeom - */ - virtual void untab(long id, const QRect& newGeom); - - /** - * Close the client with the id \p id. - */ - void closeTab(long id); - /** - * Close all windows in this group. - */ - void closeTabGroup(); - /** - * Display the right-click client menu belonging to the client at index \p index at the - * global coordinates specified by \p pos. - */ - void showWindowMenu(const QPoint& pos, long id); - /** - * unshadow virtuals - */ - using KDecoration::caption; - using KDecoration::icon; - using KDecoration::showWindowMenu; - /** - * Determine which action the user has mapped \p button to. Useful for determining whether - * a button press was for window tab dragging or for displaying the client menu. - */ - WindowOperation buttonToWindowOperation(Qt::MouseButtons button); -}; - inline KDecorationDefines::MaximizeMode operator^(KDecorationDefines::MaximizeMode m1, KDecorationDefines::MaximizeMode m2) { diff --git a/kwin/libkdecorations/kdecorationbridge.h b/kwin/libkdecorations/kdecorationbridge.h index 5096333e..a1e572ba 100644 --- a/kwin/libkdecorations/kdecorationbridge.h +++ b/kwin/libkdecorations/kdecorationbridge.h @@ -84,25 +84,17 @@ public: virtual QWidget* initialParentWidget() const = 0; virtual Qt::WFlags initialWFlags() const = 0; virtual void grabXServer(bool grab) = 0; -}; -class KDecorationBridgeUnstable - : public KDecorationBridge -{ -public: virtual bool compositingActive() const = 0; virtual QRect transparentRect() const = 0; // Window tabbing - using KDecorationBridge::caption; virtual QString caption(int idx) const = 0; virtual void closeTab(long id) = 0; virtual void closeTabGroup() = 0; virtual long currentTabId() const = 0; - using KDecorationBridge::icon; virtual QIcon icon(int idx) const = 0; virtual void setCurrentTab(long id) = 0; - using KDecorationBridge::showWindowMenu; virtual void showWindowMenu(const QPoint& pos, long id) = 0; virtual void tab_A_before_B(long A, long B) = 0; virtual void tab_A_behind_B(long A, long B) = 0; diff --git a/kwin/libkdecorations/kdecorationfactory.h b/kwin/libkdecorations/kdecorationfactory.h index ab836195..f8bc45d5 100644 --- a/kwin/libkdecorations/kdecorationfactory.h +++ b/kwin/libkdecorations/kdecorationfactory.h @@ -77,9 +77,9 @@ public: /** * Returns the KDecorationOptions object, which is used to access - * configuration settings for the decoration. + * configuration settings for the decoration. Only for convenience. */ - const KDecorationOptions* options(); // convenience + inline const KDecorationOptions* options() { return KDecoration::options(); }; /** * Returns true if the given decoration object still exists. This is necessary * e.g. when calling KDecoration::showWindowMenu(), which may cause the decoration @@ -129,20 +129,6 @@ private: KDecorationFactoryPrivate* d; }; -/** - * @warning THIS CLASS IS UNSTABLE! - * Keep all decoration class names in sync. E.g. KDecorationFactory2 and KDecoration2. - */ -class KWIN_EXPORT KDecorationFactoryUnstable - : public KDecorationFactory -{ -}; - -inline const KDecorationOptions* KDecorationFactory::options() -{ - return KDecoration::options(); -} - /** @} */ #endif diff --git a/kwin/libkwineffects/CMakeLists.txt b/kwin/libkwineffects/CMakeLists.txt index d07048a8..883c8827 100644 --- a/kwin/libkwineffects/CMakeLists.txt +++ b/kwin/libkwineffects/CMakeLists.txt @@ -7,7 +7,7 @@ set(kwin_EFFECTSLIB_SRCS anidata.cpp kwinanimationeffect.cpp kwinxrenderutils.cpp - ) +) set(kwineffects_QT_LIBS ${QT_QTGUI_LIBRARY} @@ -42,60 +42,9 @@ set_target_properties(kwineffects PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVE install(TARGETS kwineffects EXPORT kdeworkspaceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) -# kwingl(es)utils library -set(kwin_GLUTILSLIB_SRCS - kwinglutils.cpp - kwingltexture.cpp - kwinglutils_funcs.cpp - kwinglplatform.cpp - kwinglcolorcorrection.cpp - ) - -macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude ) - include_directories(${glinclude}) - if(OPENGL_EGL_FOUND) - include_directories(${OPENGLES_EGL_INCLUDE_DIR}) - endif() - add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS}) - target_link_libraries(${name} PRIVATE ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${kwineffects_XLIB_LIBS} ${kwineffects_XCB_LIBS} kwineffects) - if(OPENGL_EGL_FOUND) - target_link_libraries(${name} PRIVATE ${OPENGLES_EGL_LIBRARY}) - endif() - set_target_properties(${name} PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) - target_link_libraries(${name} PRIVATE ${ARGN}) - target_link_libraries(${name} PUBLIC ${ARGN}) - - install(TARGETS ${name} EXPORT kdeworkspaceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) -endmacro() - -if(OPENGLES_FOUND) - KWIN4_ADD_GLUTILS_BACKEND(kwinglesutils ${OPENGLES_INCLUDE_DIR} ${OPENGLES_LIBRARIES}) - set_target_properties(kwinglesutils PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGLES) -endif() -if(OPENGL_FOUND) - KWIN4_ADD_GLUTILS_BACKEND(kwinglutils ${OPENGL_INCLUDE_DIR} ${OPENGL_gl_LIBRARY}) - - if( KWIN_BUILD_OPENGL_1_COMPOSITING ) - set_target_properties(kwinglutils PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1) - endif() - - target_link_libraries(kwinglutils PRIVATE ${OPENGL_gl_LIBRARY}) - target_link_libraries(kwinglutils PUBLIC ${OPENGL_gl_LIBRARY}) - # -ldl used by OpenGL code - find_library(DL_LIBRARY dl) - if (DL_LIBRARY) - target_link_libraries(kwinglutils PRIVATE ${DL_LIBRARY}) - endif() -endif() - install( FILES kwinglobals.h kwineffects.h kwinanimationeffect.h - kwinglplatform.h - kwinglutils.h - kwinglutils_funcs.h - kwingltexture.h kwinxrenderutils.h - ${CMAKE_CURRENT_BINARY_DIR}/kwinconfig.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) diff --git a/kwin/libkwineffects/kwinconfig.h.cmake b/kwin/libkwineffects/kwinconfig.h.cmake deleted file mode 100644 index 3e34723a..00000000 --- a/kwin/libkwineffects/kwinconfig.h.cmake +++ /dev/null @@ -1,25 +0,0 @@ -/* - - This file includes config #define's for KWin's libraries - that are installed. Installed files and files using them - should be using these instead of their own. - -*/ - -#ifndef KWINCONFIG_H -#define KWINCONFIG_H - -/* - - These should be primarily used to detect what kind of compositing - support is available. - -*/ - -/* KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available */ -#cmakedefine KWIN_HAVE_XRENDER_COMPOSITING - -#cmakedefine KWIN_HAVE_EGL - - -#endif diff --git a/kwin/libkwineffects/kwineffects.cpp b/kwin/libkwineffects/kwineffects.cpp index cde1941a..c0fb35a5 100644 --- a/kwin/libkwineffects/kwineffects.cpp +++ b/kwin/libkwineffects/kwineffects.cpp @@ -19,11 +19,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/>. *********************************************************************/ -#include "kwineffects.h" - -#include "kwinxrenderutils.h" #include "config-kwin.h" +#include "kwineffects.h" +#include "kwinxrenderutils.h" + #include <QtDBus/QtDBus> #include <QVariant> #include <QList> @@ -42,7 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <assert.h> -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include <X11/extensions/Xrender.h> #include <X11/extensions/Xfixes.h> #include <xcb/xfixes.h> @@ -237,7 +237,6 @@ public: WindowPaintData::WindowPaintData(EffectWindow* w) : PaintData() - , shader(NULL) , d(new WindowPaintDataPrivate()) { quads = w->buildQuads(); @@ -252,7 +251,6 @@ WindowPaintData::WindowPaintData(EffectWindow* w) WindowPaintData::WindowPaintData(const WindowPaintData &other) : PaintData() , quads(other.quads) - , shader(other.shader) , d(new WindowPaintDataPrivate()) { setXScale(other.xScale()); @@ -638,11 +636,6 @@ CompositingType EffectsHandler::compositingType() const return compositing_type; } -bool EffectsHandler::isOpenGLCompositing() const -{ - return compositing_type & OpenGLCompositing; -} - void EffectsHandler::sendReloadMessage(const QString& effectname) { QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "reconfigureEffect"); @@ -1350,12 +1343,7 @@ struct PaintClipper::Iterator::Data { PaintClipper::Iterator::Iterator() : data(new Data) { - if (clip() && effects->isOpenGLCompositing()) { - data->rects = paintArea().rects(); - data->index = -1; - next(); // move to the first one - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (clip() && effects->compositingType() == XRenderCompositing) { XFixesRegion region(paintArea()); xcb_xfixes_set_picture_clip_region(connection(), effects->xrenderBufferPicture(), region, 0, 0); @@ -1365,7 +1353,7 @@ PaintClipper::Iterator::Iterator() PaintClipper::Iterator::~Iterator() { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (clip() && effects->compositingType() == XRenderCompositing) xcb_xfixes_set_picture_clip_region(connection(), effects->xrenderBufferPicture(), XCB_XFIXES_REGION_NONE, 0, 0); #endif @@ -1376,9 +1364,7 @@ bool PaintClipper::Iterator::isDone() { if (!clip()) return data->index == 1; // run once - if (effects->isOpenGLCompositing()) - return data->index >= data->rects.count(); // run once per each area -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() == XRenderCompositing) return data->index == 1; // run once #endif @@ -1394,9 +1380,7 @@ QRect PaintClipper::Iterator::boundingRect() const { if (!clip()) return infiniteRegion(); - if (effects->isOpenGLCompositing()) - return data->rects[ data->index ]; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE if (effects->compositingType() == XRenderCompositing) return paintArea().boundingRect(); #endif diff --git a/kwin/libkwineffects/kwineffects.h b/kwin/libkwineffects/kwineffects.h index 1f22de7f..e66b25af 100644 --- a/kwin/libkwineffects/kwineffects.h +++ b/kwin/libkwineffects/kwineffects.h @@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef KWINEFFECTS_H #define KWINEFFECTS_H -#include <kwinconfig.h> #include <kwinglobals.h> #include <QPair> @@ -64,7 +63,6 @@ class EffectFrame; class EffectFramePrivate; class Effect; class WindowQuad; -class GLShader; class XRenderPicture; class WindowQuadList; class WindowPrePaintData; @@ -205,7 +203,6 @@ enum DataRole { WindowUnminimizedGrabRole, WindowForceBlurRole, ///< For fullscreen effects to enforce blurring of windows, WindowBlurBehindRole, ///< For single windows to blur behind - LanczosCacheRole }; /** @@ -316,16 +313,10 @@ public: * Clear whole background as the very first step, without optimizing it **/ PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6, - // PAINT_DECORATION_ONLY = 1 << 7 has been deprecated - /** - * Window will be painted with a lanczos filter. - **/ - PAINT_WINDOW_LANCZOS = 1 << 8 - // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed }; enum Feature { - Nothing = 0, Resize, GeometryTip, Outline, ScreenInversion, Blur + Nothing = 0, Resize, GeometryTip, Outline, Blur }; /** @@ -407,8 +398,8 @@ public: /** * This method is called directly before painting an @ref EffectFrame. - * You can implement this method if you need to bind a shader or perform - * other operations before the frame is rendered. + * You can implement this method if you need to perform other operations + * before the frame is rendered. * @param frame The EffectFrame which will be rendered * @param region Region to restrict painting to * @param opacity Opacity of text/icon @@ -814,12 +805,6 @@ public: Q_SCRIPTABLE virtual void addRepaint(int x, int y, int w, int h) = 0; CompositingType compositingType() const; - /** - * @brief Whether the Compositor is OpenGL based (either GL 1 or 2). - * - * @return bool @c true in case of OpenGL based Compositor, @c false otherwise - **/ - bool isOpenGLCompositing() const; virtual unsigned long xrenderBufferPicture() = 0; virtual void reconfigure() = 0; @@ -2118,10 +2103,6 @@ public: */ qreal crossFadeProgress() const; WindowQuadList quads; - /** - * Shader to be used for rendering, if any. - */ - GLShader* shader; private: WindowPaintDataPrivate * const d; }; @@ -2574,15 +2555,6 @@ public: **/ virtual void setSelection(const QRect& selection) = 0; - /** - * @param shader The GLShader for rendering. - **/ - virtual void setShader(GLShader* shader) = 0; - /** - * @returns The GLShader used for rendering or null if none. - **/ - virtual GLShader* shader() const = 0; - /** * @returns The style of this EffectFrame. **/ diff --git a/kwin/libkwineffects/kwinglcolorcorrection.cpp b/kwin/libkwineffects/kwinglcolorcorrection.cpp deleted file mode 100644 index 23f2e695..00000000 --- a/kwin/libkwineffects/kwinglcolorcorrection.cpp +++ /dev/null @@ -1,690 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Casian Andrei <skeletk13@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 "kwinglcolorcorrection.h" -#include "kwinglcolorcorrection_p.h" - -#include "kwinglplatform.h" -#include "kwinglutils.h" - -#include <KDebug> - -#include <QByteArrayMatcher> -#include <QDBusConnection> -#include <QDBusError> -#include <QDBusPendingCall> -#include <QtDBus/qdbuspendingcall.h> -#include <QPair> -#include <QVector3D> - -namespace KWin { - -/* - * Color lookup table - * - * The 3D lookup texture has 64 points in each dimension, using 16 bit integers. - * That means each active region will use 1.5MiB of texture memory. - */ -static const int LUT_GRID_POINTS = 64; -static const size_t CLUT_ELEMENT_SIZE = sizeof(quint16); -static const uint CLUT_ELEMENT_COUNT = LUT_GRID_POINTS * LUT_GRID_POINTS * LUT_GRID_POINTS * 3; - -inline static void buildDummyClut(Clut &c) -{ - c.resize(CLUT_ELEMENT_COUNT); - quint16 *p = c.data(); - - for (int ib = 0; ib < LUT_GRID_POINTS; ++ ib) { - quint16 b = (quint16) ((float) ib / (LUT_GRID_POINTS - 1) * 65535.0 + 0.5); - for (int ig = 0; ig < LUT_GRID_POINTS; ++ ig) { - quint16 g = (quint16) ((float) ig / (LUT_GRID_POINTS - 1) * 65535.0 + 0.5); - for (int ir = 0; ir < LUT_GRID_POINTS; ++ ir) { - quint16 r = (quint16) ((float) ir / (LUT_GRID_POINTS - 1) * 65535.0 + 0.5); - - *(p ++) = r; - *(p ++) = g; - *(p ++) = b; - } - } - } -} - - -/* - * Color Server Interface - */ - -ColorServerInterface::ColorServerInterface(const QString &service, - const QString &path, - const QDBusConnection &connection, - QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) - , m_versionInfoWatcher(0) - , m_outputClutsWatcher(0) - , m_regionClutsWatcher(0) - , m_versionInfoUpdated(false) - , m_outputClutsUpdated(false) - , m_regionClutsUpdated(false) - , m_versionInfo(0) - , m_signaledFail(false) -{ - qDBusRegisterMetaType< Clut >(); - qDBusRegisterMetaType< ClutList >(); - qDBusRegisterMetaType< RegionalClut >(); - qDBusRegisterMetaType< RegionalClutMap >(); - - connect(this, SIGNAL(outputClutsChanged()), this, SLOT(update())); - connect(this, SIGNAL(regionClutsChanged()), this, SLOT(update())); -} - -ColorServerInterface::~ColorServerInterface() -{ -} - -uint ColorServerInterface::versionInfo() const -{ - if (!m_versionInfoUpdated) - kWarning(1212) << "Version info not updated"; - return m_versionInfo; -} - -const ClutList& ColorServerInterface::outputCluts() const -{ - return m_outputCluts; -} - -const RegionalClutMap& ColorServerInterface::regionCluts() const -{ - return m_regionCluts; -} - -void ColorServerInterface::update() -{ - m_versionInfoUpdated = false; - m_outputClutsUpdated = false; - m_regionClutsUpdated = false; - delete m_versionInfoWatcher; - delete m_outputClutsWatcher; - delete m_regionClutsWatcher; - m_versionInfoWatcher = new QDBusPendingCallWatcher(getVersionInfo(), this); - m_outputClutsWatcher = new QDBusPendingCallWatcher(getOutputCluts(), this); - m_regionClutsWatcher = new QDBusPendingCallWatcher(getRegionCluts(), this); - connect(m_versionInfoWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(callFinishedSlot(QDBusPendingCallWatcher*))); - connect(m_outputClutsWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(callFinishedSlot(QDBusPendingCallWatcher*))); - connect(m_regionClutsWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(callFinishedSlot(QDBusPendingCallWatcher*))); - - m_signaledFail = false; -} - -QDBusPendingReply< uint > ColorServerInterface::getVersionInfo() -{ - return QDBusPendingReply< uint >(asyncCall("getVersionInfo")); -} - -QDBusPendingReply< ClutList > ColorServerInterface::getOutputCluts() -{ - return QDBusPendingReply< ClutList >(asyncCall("getOutputCluts")); -} - -QDBusPendingReply< RegionalClutMap > ColorServerInterface::getRegionCluts() -{ - return QDBusPendingReply< RegionalClutMap >(asyncCall("getRegionCluts")); -} - -void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher) -{ - if (watcher == m_versionInfoWatcher) { - kDebug(1212) << "Version info call finished"; - QDBusPendingReply< uint > reply = *watcher; - if (reply.isError()) { - kWarning(1212) << reply.error(); - if (!m_signaledFail) - emit updateFailed(); - m_signaledFail = true; - return; - } else { - m_versionInfo = reply.value(); - m_versionInfoUpdated = true; - } - } - - if (watcher == m_outputClutsWatcher) { - kDebug(1212) << "Output cluts call finished"; - QDBusPendingReply< ClutList > reply = *watcher; - if (reply.isError()) { - kWarning(1212) << reply.error(); - if (!m_signaledFail) - emit updateFailed(); - m_signaledFail = true; - return; - } else { - m_outputCluts = reply.value(); - m_outputClutsUpdated = true; - } - } - - if (watcher == m_regionClutsWatcher) { - kDebug(1212) << "Region cluts call finished"; - QDBusPendingReply< RegionalClutMap > reply = *watcher; - if (reply.isError()) { - kWarning(1212) << reply.error(); - if (!m_signaledFail) - emit updateFailed(); - m_signaledFail = true; - return; - } else { - m_regionCluts = reply.value(); - m_regionClutsUpdated = true; - } - } - - if (m_versionInfoUpdated && - m_outputClutsUpdated && - m_regionClutsUpdated) { - kDebug(1212) << "Update succeeded"; - emit updateSucceeded(); - } -} - - -/* - * To be injected in the fragment shader sources - */ -static const char s_ccVars[] = - "uniform sampler3D u_ccLookupTexture;\n"; -static const char s_ccAlteration[] = - "gl_FragColor.rgb = texture3D(u_ccLookupTexture, gl_FragColor.rgb / gl_FragColor.a).rgb * gl_FragColor.a;\n"; -static const char s_ccAlteration_140[] = - "fragColor.rgb = texture(u_ccLookupTexture, fragColor.rgb / fragColor.a).rgb * fragColor.a;\n"; - - -/* - * Color Correction - */ - -ColorCorrection::ColorCorrection(QObject *parent) - : QObject(parent) - , d_ptr(new ColorCorrectionPrivate(this)) -{ - connect(this, SIGNAL(errorOccured()), this, SIGNAL(changed())); -} - -ColorCorrection::~ColorCorrection() -{ - setEnabled(false); -} - -ColorCorrectionPrivate::ColorCorrectionPrivate(ColorCorrection *parent) - : QObject(parent) - , m_enabled(false) - , m_hasError(false) - , m_duringEnablingPhase(false) - , m_ccTextureUnit(-1) - , m_dummyCCTexture(0) - , m_lastOutput(-1) - , q_ptr(parent) -{ - // We need a dummy color lookup table (sRGB profile to sRGB profile) - buildDummyClut(m_dummyClut); - - // Establish a D-Bus communication interface with KolorServer - m_csi = new ColorServerInterface( - "org.kde.kded", - "/modules/kolorserver", - QDBusConnection::sessionBus(), - this); - - m_outputCluts = &m_csi->outputCluts(); - - connect(m_csi, SIGNAL(updateSucceeded()), this, SLOT(colorServerUpdateSucceededSlot())); - connect(m_csi, SIGNAL(updateFailed()), this, SLOT(colorServerUpdateFailedSlot())); -} - -ColorCorrectionPrivate::~ColorCorrectionPrivate() -{ - -} - -bool ColorCorrection::isEnabled() const -{ - Q_D(const ColorCorrection); - return d->m_enabled; -} - -bool ColorCorrection::setEnabled(bool enabled) -{ - Q_D(ColorCorrection); - - if (enabled == d->m_enabled) - return true; - - if (enabled && d->m_hasError) { - kError(1212) << "cannot enable color correction because of a previous error"; - return false; - } - -#ifdef KWIN_HAVE_OPENGLES - const GLPlatform *gl = GLPlatform::instance(); - if (enabled && gl->isGLES() && glTexImage3D == 0) { - kError(1212) << "color correction is not supported on OpenGL ES without OES_texture_3D"; - d->m_hasError = true; - return false; - } -#endif // KWIN_HAVE_OPENGLES - - if (enabled) { - // Update all profiles and regions - d->m_csi->update(); - kDebug(1212) << "color correction will be enabled after contacting KolorManager"; - d->m_duringEnablingPhase = true; - // d->m_enabled will be set to true in colorServerUpdateSucceededSlot() - } else { - d->deleteCCTextures(); - d->m_enabled = false; - GLShader::sColorCorrect = false; - kDebug(1212) << "color correction has been disabled"; - - // Reload all shaders - ShaderManager::cleanup(); - ShaderManager::instance(); - } - - return true; -} - -void ColorCorrection::setupForOutput(int screen) -{ - Q_D(ColorCorrection); - - if (!d->m_enabled || d->m_hasError) - return; - - GLShader *shader = ShaderManager::instance()->getBoundShader(); - if (!shader) { - kError(1212) << "no bound shader for color correction setup"; - d->m_hasError = true; - emit errorOccured(); - return; - } - - if (d->m_ccTextureUnit < 0) { - GLint maxUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxUnits); - d->m_ccTextureUnit = maxUnits - 1; - } - - if (!shader->setUniform(GLShader::ColorCorrectionLookupTextureUnit, d->m_ccTextureUnit)) { - kError(1212) << "unable to set uniform for the color correction lookup texture"; - d->m_hasError = true; - emit errorOccured(); - return; - } - - if (!d->setupCCTextures()) { - kError(1212) << "unable to setup color correction textures"; - d->m_hasError = true; - emit errorOccured(); - return; - } - - GLint activeTexture; - glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture); - glActiveTexture(GL_TEXTURE0 + d->m_ccTextureUnit); - - if (d->m_outputCCTextures.isEmpty() || screen < 0 || screen >= d->m_outputCCTextures.count()) { - // Configure with a dummy texture in case something is wrong - Q_ASSERT(d->m_dummyCCTexture != 0); - glBindTexture(GL_TEXTURE_3D, d->m_dummyCCTexture); - } else { - // Everything looks ok, configure with the proper color correction texture - glBindTexture(GL_TEXTURE_3D, d->m_outputCCTextures[screen]); - } - - glActiveTexture(activeTexture); - - d->m_lastOutput = screen; -} - -void ColorCorrection::reset() -{ - setupForOutput(-1); -} - -QByteArray ColorCorrection::prepareFragmentShader(const QByteArray &sourceCode) -{ - bool sourceIsValid = true; - - /* - * Detect comments to ignore them later - */ - QList< QPair< int, int > > comments; - int beginIndex, endIndex = 0; - int i1, i2; - - enum {ctNone, ctBegin, ctEnd} commentType; - QByteArrayMatcher commentBegin1("/*"), commentBegin2("//"); - QByteArrayMatcher commentEnd1("*/"), commentEnd2("\n"); - - do { - // Determine the next comment begin index - i1 = commentBegin1.indexIn(sourceCode, endIndex); - i2 = commentBegin2.indexIn(sourceCode, endIndex); - if (i1 == -1 && i2 == -1) commentType = ctNone; - else if (i1 == -1) commentType = ctEnd; - else if (i2 == -1) commentType = ctBegin; - else if (i1 < i2) commentType = ctBegin; - else commentType = ctEnd; - if (commentType == ctNone) - break; - - // Determine the comment's end index - if (commentType == ctBegin) { - beginIndex = i1; - endIndex = commentEnd1.indexIn(sourceCode, beginIndex + 2); - } - if (commentType == ctEnd) { - beginIndex = i2; - endIndex = commentEnd2.indexIn(sourceCode, beginIndex + 2); - } - - if (endIndex != -1) { - if (commentType == ctBegin) - endIndex ++; // adjust for "*/" to be removed - if (commentType == ctEnd) - endIndex --; // adjust for "\n" to be kept - comments.append(QPair< int, int >(beginIndex, endIndex)); - } else { - if (commentType == ctBegin) - sourceIsValid = false; - if (commentType == ctEnd) - comments.append(QPair< int, int >(beginIndex, sourceCode.length())); - break; - } - } while (sourceIsValid); - if (!sourceIsValid) - return sourceCode; - - // Create a version of the source code with the comments stripped out - QByteArray cfSource(sourceCode); // comment-free source code - for (int i = comments.size() - 1; i >= 0; -- i) { - beginIndex = comments[i].first; - endIndex = comments[i].second; - cfSource.replace(beginIndex, endIndex - beginIndex + 1, " "); - } - - /* - * Browse through the code while counting braces - * Search for "void main() { ... }: - */ - QByteArrayMatcher braceOpen("{"); - QByteArrayMatcher braceClose("}"); - QByteArrayMatcher voidKeyword("void"); - int levelOfScope = 0; - enum {brNone, brOpen, brClose} braceType; - - int mainFuncBegin = -1; // where "void main" begins - int mainFuncEnd = -1; // at the closing brace of "void main" - bool insideMainFunc = false; - int i = 0; - - do { - // Determine where the next brace is - i1 = braceOpen.indexIn(cfSource, i); - i2 = braceClose.indexIn(cfSource, i); - if (i1 == -1 && i2 == -1) braceType = brNone; - else if (i1 == -1) braceType = brClose; - else if (i2 == -1) braceType = brOpen; - else if (i1 < i2) braceType = brOpen; - else braceType = brClose; - if (braceType == brNone) { - if (levelOfScope > 0) - sourceIsValid = false; - break; - } - - // Handle opening brance (see if is from void main()) - if (braceType == brOpen) { - if (levelOfScope == 0) { - // Need to search between i and i1 (the last '}' and the current '{' - QByteArray section = cfSource.mid(i, i1 - i); - int i_void = -1; - while ((i_void = section.indexOf("void", i_void + 1)) != -1) { - // Extract the subsection that begins with "void" - QByteArray subSection = section.mid(i_void).simplified(); - subSection.replace('(', " ( "); - subSection.replace(')', " ) "); - QList<QByteArray> tokens = subSection.split(' '); - for (int i_token = tokens.size() - 1; i_token >= 0; -- i_token) - if (tokens[i_token].trimmed().isEmpty()) - tokens.removeAt(i_token); - if (tokens.size() == 4 && - tokens[0] == "void" && - tokens[1] == "main" && - tokens[2] == "(" && - tokens[3] == ")") { - if (mainFuncBegin != -1) { - sourceIsValid = false; - break; - } - mainFuncBegin = i + i_void; - insideMainFunc = true; - } - } - } - - levelOfScope ++; - i = i1 + 1; - } - - // Handle closing brace (see if it is from void main()) - if (braceType == brClose) { - levelOfScope --; - if (levelOfScope < 0) { - sourceIsValid = false; - break; - } - - if (levelOfScope == 0 && insideMainFunc) { - mainFuncEnd = i2; - insideMainFunc = false; - } - - i = i2 + 1; - } - } while (sourceIsValid); - sourceIsValid = sourceIsValid && mainFuncBegin != -1 && mainFuncEnd != -1; - if (!sourceIsValid) - return sourceCode; - - QByteArray mainFunc = cfSource.mid(mainFuncBegin, mainFuncEnd - mainFuncBegin + 1); - - /* - * Insert color correction variables at the beginning and - * the color correction code at the end of the main function. - * Need to handle return "jumps" inside the main function. - */ - if (GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40)) - mainFunc.insert(mainFunc.size() - 1, s_ccAlteration_140); - else - mainFunc.insert(mainFunc.size() - 1, s_ccAlteration); - mainFunc.insert(0, s_ccVars); - - // Search for return statements inside the main function - QByteArrayMatcher returnMatcher("return"); - i = -1; - while ((i = returnMatcher.indexIn(mainFunc, i)) != -1) { - i1 = mainFunc.indexOf(';', i); - mainFunc.insert(i1 + 1, '}'); - mainFunc.insert(i, '{'); - mainFunc.insert(i + 1, s_ccAlteration); - mainFuncEnd += strlen(s_ccAlteration) + 2; - - i = i1 + strlen(s_ccAlteration) + 2; - } - - // Replace the main function - cfSource.replace(mainFuncBegin, mainFuncEnd - mainFuncBegin + 1, mainFunc); - - return cfSource; -} - -bool ColorCorrectionPrivate::setupCCTextures() -{ - if (!m_enabled || m_hasError) { - kWarning(1212) << "Color correction not enabled or an error occurred, refusing to set up textures"; - return false; - } - - // Dummy texture first - if (!m_dummyCCTexture) { - glGenTextures(1, &m_dummyCCTexture); - if (!setupCCTexture(m_dummyCCTexture, m_dummyClut)) { - kError(1212) << "unable to setup dummy color correction texture"; - m_dummyCCTexture = 0; - return false; - } - } - - bool success = true; - - // Setup actual color correction textures - if (m_outputCCTextures.isEmpty() && !m_outputCluts->isEmpty()) { - kDebug(1212) << "setting up output color correction textures"; - - const int outputCount = m_outputCluts->size(); - m_outputCCTextures.resize(outputCount); - glGenTextures(outputCount, m_outputCCTextures.data()); - - for (int i = 0; i < outputCount; ++i) - if (!setupCCTexture(m_outputCCTextures[i], m_outputCluts->at(i))) { - kError(1212) << "unable to set up color correction texture for output" << i; - success = false; - } - } - - return success; -} - -bool ColorCorrectionPrivate::deleteCCTextures() -{ - // Clear any previous GL errors - checkGLError("deleteCCTextures-clearErrors"); - - // Delete dummy texture - if (m_dummyCCTexture) { - glDeleteTextures(1, &m_dummyCCTexture); - m_dummyCCTexture = 0; - } - - // Delete actual color correction extures - if (!m_outputCCTextures.isEmpty()) { - glDeleteTextures(m_outputCCTextures.size(), m_outputCCTextures.data()); - m_outputCCTextures.clear(); - } - - return !checkGLError("deleteCCTextures"); -} - -bool ColorCorrectionPrivate::setupCCTexture(GLuint texture, const Clut& clut) -{ - if ((uint) clut.size() != CLUT_ELEMENT_COUNT) { - kError(1212) << "cannot setup CC texture: invalid color lookup table"; - return false; - } - - // Clear any previous GL errors - checkGLError("setupCCTexture-clearErrors"); - - glBindTexture(GL_TEXTURE_3D, texture); - - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - -#ifndef KWIN_HAVE_OPENGLES - glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16, - LUT_GRID_POINTS, LUT_GRID_POINTS, LUT_GRID_POINTS, - 0, GL_RGB, GL_UNSIGNED_SHORT, clut.data()); -#else - const int textureDataSize = clut.size(); - QVector<quint8> textureData(textureDataSize); - quint8 *pTextureData = textureData.data(); - const quint16 *pClutData = clut.data(); - for (int i = 0; i < textureDataSize; ++i) - *(pTextureData++) = *(pClutData++) >> 8; - - glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, - LUT_GRID_POINTS, LUT_GRID_POINTS, LUT_GRID_POINTS, - 0, GL_RGB, GL_UNSIGNED_BYTE, textureData.data()); -#endif // KWIN_HAVE_OPENGLES - - return !checkGLError("setupCCTexture"); -} - -void ColorCorrectionPrivate::colorServerUpdateSucceededSlot() -{ - Q_Q(ColorCorrection); - - kDebug(1212) << "Update of color profiles succeeded"; - - // Force the color correction textures to be recreated - deleteCCTextures(); - - // If this is reached after enabling color correction using ColorCorrection::setEnabled(true) - if (m_duringEnablingPhase) { - m_duringEnablingPhase = false; - m_enabled = true; - GLShader::sColorCorrect = true; - kDebug(1212) << "Color correction has been enabled"; - - // Reload all shaders - ShaderManager::cleanup(); - if (!ShaderManager::instance()->isValid()) { - kError(1212) << "Shader reinitialization failed, possible compile problems with the shaders " - "altered for color-correction"; - m_hasError = true; - kDebug(1212) << "Color correction has been disabled due to shader issues"; - m_enabled = false; - GLShader::sColorCorrect = false; - ShaderManager::cleanup(); - ShaderManager::instance(); - } - } - - emit q->changed(); -} - -void ColorCorrectionPrivate::colorServerUpdateFailedSlot() -{ - Q_Q(ColorCorrection); - - m_duringEnablingPhase = false; - - kError(1212) << "Update of color profiles failed"; - m_hasError = true; - emit q->errorOccured(); -} - -} // KWin namespace diff --git a/kwin/libkwineffects/kwinglcolorcorrection.h b/kwin/libkwineffects/kwinglcolorcorrection.h deleted file mode 100644 index 801d4fb2..00000000 --- a/kwin/libkwineffects/kwinglcolorcorrection.h +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Casian Andrei <skeletk13@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_COLOR_CORRECTION_H -#define KWIN_COLOR_CORRECTION_H - -#include "kwinglobals.h" - -#include <QObject> - -namespace KWin { - -class ColorCorrectionPrivate; - -/** - * Implements a color correction mechanism. The settings are obtained - * asynchronously via D-Bus from kolor-server, which is part of kolor-manager. - * - * If it fails to get the settings, nothing should happen (no correction), even - * if it is set to enabled. - * - * Supports per-output and per-region correction (window region). - * - * \warning This class is not designed to be used by effects, however - * it may happen to be useful their case somehow. - */ -class KWIN_EXPORT ColorCorrection : public QObject -{ - Q_OBJECT - -public: - explicit ColorCorrection(QObject *parent = 0); - virtual ~ColorCorrection(); - - /** - * Prepares color correction for the output number \param screen. - * Sets up the appropriate color lookup texture for the output. - */ - void setupForOutput(int screen); - - /** - * Unsets color correction by using a dummy color lookup texture. This - * does not disable anything, the CC mechanisms remain in place. Instead, it - * indicates to draw normally. - */ - void reset(); - - /** - * Modifies \param sourceCode, making it suitable for performing - * color correction. This is done by inserting a 3d texture lookup operation - * just before the output fragment color is returned. - */ - static QByteArray prepareFragmentShader(const QByteArray &sourceCode); - - /** - * @return whether color correction is enabled - */ - bool isEnabled() const; - -public slots: - /** - * Enables or disables color correction. Compositing should be restarted - * for changes to take effect. - * - * @return true when successful - */ - bool setEnabled(bool enabled); - -signals: - /** - * Emitted when some changes happened to the color correction settings, and - * a full repaint of the scene should be done to make the new settings visible. - */ - void changed(); - - /** - * Emitted when something failed because of an error (probably a GL error) - * The description of the error should be found in the logs. - */ - void errorOccured(); - -private: - ColorCorrectionPrivate * const d_ptr; - Q_DECLARE_PRIVATE(ColorCorrection) -}; - -} // KWin namespace - -#endif // KWIN_COLOR_CORRECTION_H diff --git a/kwin/libkwineffects/kwinglcolorcorrection_p.h b/kwin/libkwineffects/kwinglcolorcorrection_p.h deleted file mode 100644 index 7e77bb25..00000000 --- a/kwin/libkwineffects/kwinglcolorcorrection_p.h +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Casian Andrei <skeletk13@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_COLOR_CORRECTION_P_H_ -#define KWIN_COLOR_CORRECTION_P_H_ - -#include "kwinglcolorcorrection.h" -#include "kwinglutils_funcs.h" - -#include <QDBusAbstractInterface> -#include <QDBusMetaType> -#include <QDBusPendingReply> -#include <QRect> -#include <QVector> - -class QDBusPendingCallWatcher; - -/* - * Clut - * All this should be the same as in the color server code, in kolor-manager - */ -typedef QVector<quint16> Clut; -typedef QList<Clut> ClutList; -typedef struct { QRect r; Clut c; } RegionalClut; -typedef QMultiMap<uint, RegionalClut> RegionalClutMap; - -Q_DECLARE_METATYPE(Clut) -Q_DECLARE_METATYPE(ClutList) -Q_DECLARE_METATYPE(RegionalClut) -Q_DECLARE_METATYPE(RegionalClutMap) - -// Marshall the RegionalClut data into a D-Bus argument -inline QDBusArgument &operator<<(QDBusArgument &argument, const RegionalClut &rc) -{ - argument.beginStructure(); - argument << rc.r << rc.c; - argument.endStructure(); - return argument; -} - -// Retrieve the RegionalClut data from the D-Bus argument -inline const QDBusArgument &operator>>(const QDBusArgument &argument, RegionalClut &rc) -{ - argument.beginStructure(); - argument >> rc.r >> rc.c; - argument.endStructure(); - return argument; -} - - -namespace KWin { - -class ColorServerInterface; - - -/* - * Color Correction Private Data - */ -class ColorCorrectionPrivate : public QObject -{ - Q_OBJECT - -public: - explicit ColorCorrectionPrivate(ColorCorrection* parent); - virtual ~ColorCorrectionPrivate(); - - bool setupCCTextures(); - bool deleteCCTextures(); - static bool setupCCTexture(GLuint texture, const Clut &clut); - -public slots: - void colorServerUpdateSucceededSlot(); - void colorServerUpdateFailedSlot(); - -public: - bool m_enabled; - bool m_hasError; - bool m_duringEnablingPhase; - int m_ccTextureUnit; - - ColorServerInterface *m_csi; - const ClutList *m_outputCluts; - QVector<GLuint> m_outputCCTextures; - Clut m_dummyClut; - GLuint m_dummyCCTexture; - - int m_lastOutput; - -private: - ColorCorrection *q_ptr; - Q_DECLARE_PUBLIC(ColorCorrection) -}; - - -/* - * Color Server DBus interface - */ -class ColorServerInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: - static inline const char *staticInterfaceName() - { return "org.kde.KolorServer"; } - -public: - ColorServerInterface(const QString &service, - const QString &path, - const QDBusConnection &connection, - QObject *parent = 0); - virtual ~ColorServerInterface(); - - uint versionInfo() const; - const ClutList& outputCluts() const; - const RegionalClutMap& regionCluts() const; - -public slots: - void update(); - -signals: - void updateSucceeded(); - void updateFailed(); - void outputClutsChanged(); - void regionClutsChanged(); - -private: - QDBusPendingReply< uint > getVersionInfo(); - QDBusPendingReply< ClutList > getOutputCluts(); - QDBusPendingReply< RegionalClutMap > getRegionCluts(); - -private slots: - void callFinishedSlot(QDBusPendingCallWatcher *watcher); - -private: - QDBusPendingCallWatcher *m_versionInfoWatcher; - QDBusPendingCallWatcher *m_outputClutsWatcher; - QDBusPendingCallWatcher *m_regionClutsWatcher; - bool m_versionInfoUpdated; - bool m_outputClutsUpdated; - bool m_regionClutsUpdated; - uint m_versionInfo; - ClutList m_outputCluts; - RegionalClutMap m_regionCluts; - - bool m_signaledFail; -}; - -} // KWin namespace - -#endif // KWIN_COLOR_CORRECTION_P_H_ diff --git a/kwin/libkwineffects/kwinglobals.h b/kwin/libkwineffects/kwinglobals.h index 6c7f6766..cb73ce2f 100644 --- a/kwin/libkwineffects/kwinglobals.h +++ b/kwin/libkwineffects/kwinglobals.h @@ -30,8 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <fixx11h.h> #include <xcb/xcb.h> -#include <kwinconfig.h> - #define KWIN_EXPORT KDE_EXPORT namespace KWin @@ -40,23 +38,7 @@ namespace KWin enum CompositingType { NoCompositing = 0, - /** - * Used as a flag whether OpenGL based compositing is used. - * The flag is or-ed to the enum values of the specific OpenGL types. - * The actual Compositors use the @c OpenGL1Compositing or @c OpenGL2Compositing - * flags. If you need to know whether OpenGL is used, either and the flag or - * use EffectsHandler::isOpenGLCompositing(). - **/ - OpenGLCompositing = 1, XRenderCompositing = 1<<1, - OpenGL1Compositing = 1<<2 | OpenGLCompositing, - OpenGL2Compositing = 1<<3 | OpenGLCompositing -}; - -enum OpenGLPlatformInterface { - NoOpenGLPlatformInterface = 0, - GlxPlatformInterface, - EglPlatformInterface }; enum clientAreaOption { diff --git a/kwin/libkwineffects/kwinglplatform.cpp b/kwin/libkwineffects/kwinglplatform.cpp deleted file mode 100644 index c8e5ba1e..00000000 --- a/kwin/libkwineffects/kwinglplatform.cpp +++ /dev/null @@ -1,1074 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#include "kwinglplatform.h" -#include "kwinglutils.h" - -#include <kwinglobals.h> - -#include <QRegExp> -#include <QStringList> -#include <QDebug> - -#include <sys/utsname.h> - -#include <iostream> -#include <iomanip> -#include <ios> - -namespace KWin -{ - -GLPlatform *GLPlatform::s_platform = 0; - -static qint64 parseVersionString(const QByteArray &version) -{ - // Skip any leading non digit - int start = 0; - while (start < version.length() && !QChar(version[start]).isDigit()) - start++; - - // Strip any non digit, non '.' characters from the end - int end = start; - while (end < version.length() && (version[end] == '.' || QChar(version[end]).isDigit())) - end++; - - const QByteArray result = version.mid(start, end-start); - const QList<QByteArray> tokens = result.split('.'); - const qint64 major = tokens.at(0).toInt(); - const qint64 minor = tokens.count() > 1 ? tokens.at(1).toInt() : 0; - const qint64 patch = tokens.count() > 2 ? tokens.at(2).toInt() : 0; - - return kVersionNumber(major, minor, patch); -} - -static qint64 getXServerVersion() -{ - qint64 major, minor, patch; - - Display *dpy = display(); - if (strstr(ServerVendor(dpy), "X.Org")) { - const int release = VendorRelease(dpy); - major = (release / 10000000); - minor = (release / 100000) % 100; - patch = (release / 1000) % 100; - } else { - major = 0; - minor = 0; - patch = 0; - } - - return kVersionNumber(major, minor, patch); -} - -static qint64 getKernelVersion() -{ - struct utsname name; - uname(&name); - - if (QByteArray(name.sysname) == "Linux") - return parseVersionString(name.release); - - return 0; -} - -// Extracts the portion of a string that matches a regular expression -static QString extract(const QString &string, const QString &match, int offset = 0) -{ - QString result; - QRegExp rx(match); - int pos = rx.indexIn(string, offset); - if (pos != -1) - result = string.mid(pos, rx.matchedLength()); - return result; -} - -static ChipClass detectRadeonClass(const QString &chipset) -{ - if (chipset.isEmpty()) - return UnknownRadeon; - - if (chipset.contains("R100") || - chipset.contains("RV100") || - chipset.contains("RS100")) - return R100; - - if (chipset.contains("RV200") || - chipset.contains("RS200") || - chipset.contains("R200") || - chipset.contains("RV250") || - chipset.contains("RS300") || - chipset.contains("RV280")) - return R200; - - if (chipset.contains("R300") || - chipset.contains("R350") || - chipset.contains("R360") || - chipset.contains("RV350") || - chipset.contains("RV370") || - chipset.contains("RV380")) - return R300; - - if (chipset.contains("R420") || - chipset.contains("R423") || - chipset.contains("R430") || - chipset.contains("R480") || - chipset.contains("R481") || - chipset.contains("RV410") || - chipset.contains("RS400") || - chipset.contains("RC410") || - chipset.contains("RS480") || - chipset.contains("RS482") || - chipset.contains("RS600") || - chipset.contains("RS690") || - chipset.contains("RS740")) - return R400; - - if (chipset.contains("RV515") || - chipset.contains("R520") || - chipset.contains("RV530") || - chipset.contains("R580") || - chipset.contains("RV560") || - chipset.contains("RV570")) - return R500; - - if (chipset.contains("R600") || - chipset.contains("RV610") || - chipset.contains("RV630") || - chipset.contains("RV670") || - chipset.contains("RV620") || - chipset.contains("RV635") || - chipset.contains("RS780") || - chipset.contains("RS880")) - return R600; - - if (chipset.contains("R700") || - chipset.contains("RV770") || - chipset.contains("RV730") || - chipset.contains("RV710") || - chipset.contains("RV740")) - return R700; - - if (chipset.contains("EVERGREEN") || // Not an actual chipset, but returned by R600G in 7.9 - chipset.contains("CEDAR") || - chipset.contains("REDWOOD") || - chipset.contains("JUNIPER") || - chipset.contains("CYPRESS") || - chipset.contains("HEMLOCK") || - chipset.contains("PALM")) - return Evergreen; - - if (chipset.contains("SUMO") || - chipset.contains("SUMO2") || - chipset.contains("BARTS") || - chipset.contains("TURKS") || - chipset.contains("CAICOS") || - chipset.contains("CAYMAN")) - return NorthernIslands; - - QString name = extract(chipset, "HD [0-9]{4}"); // HD followed by a space and 4 digits - if (!name.isEmpty()) { - const int id = name.right(4).toInt(); - if (id == 6250 || id == 6310) // Palm - return Evergreen; - - if (id >= 6000 && id < 7000) - return NorthernIslands; // HD 6xxx - - if (id >= 5000 && id < 6000) - return Evergreen; // HD 5xxx - - if (id >= 4000 && id < 5000) - return R700; // HD 4xxx - - if (id >= 2000 && id < 4000) // HD 2xxx/3xxx - return R600; - - return UnknownRadeon; - } - - name = extract(chipset, "X[0-9]{3,4}"); // X followed by 3-4 digits - if (!name.isEmpty()) { - const int id = name.mid(1, -1).toInt(); - - // X1xxx - if (id >= 1300) - return R500; - - // X7xx, X8xx, X12xx, 2100 - if ((id >= 700 && id < 1000) || id >= 1200) - return R400; - - // X200, X3xx, X5xx, X6xx, X10xx, X11xx - if ((id >= 300 && id < 700) || (id >= 1000 && id < 1200)) - return R300; - - return UnknownRadeon; - } - - name = extract(chipset, "\\b[0-9]{4}\\b"); // A group of 4 digits - if (!name.isEmpty()) { - const int id = name.toInt(); - - // 7xxx - if (id >= 7000 && id < 8000) - return R100; - - // 8xxx, 9xxx - if (id >= 8000 && id < 9500) - return R200; - - // 9xxx - if (id >= 9500) - return R300; - - if (id == 2100) - return R400; - } - - return UnknownRadeon; -} - -static ChipClass detectNVidiaClass(const QString &chipset) -{ - QString name = extract(chipset, "\\bNV[0-9,A-F]{2}\\b"); // NV followed by two hexadecimal digits - if (!name.isEmpty()) { - const int id = chipset.mid(2, -1).toInt(0, 16); // Strip the 'NV' from the id - - switch(id & 0xf0) { - case 0x00: - case 0x10: - return NV10; - - case 0x20: - return NV20; - - case 0x30: - return NV30; - - case 0x40: - case 0x60: - return NV40; - - case 0x50: - case 0x80: - case 0x90: - case 0xA0: - return G80; - - default: - return UnknownNVidia; - } - } - - if (chipset.contains("GeForce2") || chipset.contains("GeForce 256")) - return NV10; - - if (chipset.contains("GeForce3")) - return NV20; - - if (chipset.contains("GeForce4")) { - if (chipset.contains("MX 420") || - chipset.contains("MX 440") || // including MX 440SE - chipset.contains("MX 460") || - chipset.contains("MX 4000") || - chipset.contains("PCX 4300")) - return NV10; - - return NV20; - } - - // GeForce 5,6,7,8,9 - name = extract(chipset, "GeForce (FX |PCX |Go )?\\d{4}(M|\\b)").trimmed(); - if (!name.isEmpty()) { - if (!name[name.length() - 1].isDigit()) - name.chop(1); - - const int id = name.right(4).toInt(); - if (id < 6000) - return NV30; - - if (id >= 6000 && id < 8000) - return NV40; - - if (id >= 8000) - return G80; - - return UnknownNVidia; - } - - // GeForce 100/200/300/400/500 - name = extract(chipset, "GeForce (G |GT |GTX |GTS )?\\d{3}(M|\\b)").trimmed(); - if (!name.isEmpty()) { - if (!name[name.length() - 1].isDigit()) - name.chop(1); - - const int id = name.right(3).toInt(); - if (id >= 100 && id < 600) { - if (id >= 400) - return GF100; - - return G80; - } - return UnknownNVidia; - } - - return UnknownNVidia; -} - -static ChipClass detectIntelClass(const QByteArray &chipset) -{ - // see mesa repository: src/mesa/drivers/dri/intel/intel_context.c - // GL 1.3, DX8? SM ? - if (chipset.contains("845G") || - chipset.contains("830M") || - chipset.contains("852GM/855GM") || - chipset.contains("865G")) - return I8XX; - - // GL 1.4, DX 9.0, SM 2.0 - if (chipset.contains("915G") || - chipset.contains("E7221G") || - chipset.contains("915GM") || - chipset.contains("945G") || // DX 9.0c - chipset.contains("945GM") || - chipset.contains("945GME") || - chipset.contains("Q33") || // GL1.5 - chipset.contains("Q35") || - chipset.contains("G33") || - chipset.contains("965Q") || // GMA 3000, but apparently considered gen 4 by the driver - chipset.contains("946GZ") || // GMA 3000, but apparently considered gen 4 by the driver - chipset.contains("IGD")) - return I915; - - // GL 2.0, DX 9.0c, SM 3.0 - if (chipset.contains("965G") || - chipset.contains("G45/G43") || // SM 4.0 - chipset.contains("965GM") || // GL 2.1 - chipset.contains("965GME/GLE") || - chipset.contains("GM45") || - chipset.contains("Q45/Q43") || - chipset.contains("G41") || - chipset.contains("B43") || - chipset.contains("Ironlake")) - return I965; - - // GL 3.1, CL 1.1, DX 10.1 - if (chipset.contains("Sandybridge")) { - return SandyBridge; - } - - // GL4.0, CL1.1, DX11, SM 5.0 - if (chipset.contains("Ivybridge")) { - return IvyBridge; - } - - // GL4.0, CL1.2, DX11.1, SM 5.0 - if (chipset.contains("Haswell")) { - return Haswell; - } - - return UnknownIntel; -} - -QString GLPlatform::versionToString(qint64 version) -{ - int major = (version >> 32); - int minor = (version >> 16) & 0xffff; - int patch = version & 0xffff; - - QString string = QString::number(major) + QChar('.') + QString::number(minor); - if (patch != 0) - string += QChar('.') + QString::number(patch); - - return string; -} - -QString GLPlatform::driverToString(Driver driver) -{ - switch(driver) { - case Driver_R100: - return "Radeon"; - case Driver_R200: - return "R200"; - case Driver_R300C: - return "R300C"; - case Driver_R300G: - return "R300G"; - case Driver_R600C: - return "R600C"; - case Driver_R600G: - return "R600G"; - case Driver_Nouveau: - return "Nouveau"; - case Driver_Intel: - return "Intel"; - case Driver_NVidia: - return "NVIDIA"; - case Driver_Catalyst: - return "Catalyst"; - case Driver_Swrast: - return "Software rasterizer"; - case Driver_Softpipe: - return "softpipe"; - case Driver_Llvmpipe: - return "LLVMpipe"; - case Driver_VirtualBox: - return "VirtualBox (Chromium)"; - case Driver_VMware: - return "VMware (SVGA3D)"; - - default: - return "Unknown"; - } -} - -QString GLPlatform::chipClassToString(ChipClass chipClass) -{ - switch(chipClass) { - case R100: - return "R100"; - case R200: - return "R200"; - case R300: - return "R300"; - case R400: - return "R400"; - case R500: - return "R500"; - case R600: - return "R600"; - case R700: - return "R700"; - case Evergreen: - return "EVERGREEN"; - case NorthernIslands: - return "NI"; - - case NV10: - return "NV10"; - case NV20: - return "NV20"; - case NV30: - return "NV30"; - case NV40: - return "NV40/G70"; - case G80: - return "G80/G90"; - case GF100: - return "GF100"; - - case I8XX: - return "i830/i835"; - case I915: - return "i915/i945"; - case I965: - return "i965"; - case SandyBridge: - return "SandyBridge"; - case IvyBridge: - return "IvyBridge"; - case Haswell: - return "Haswell"; - - default: - return "Unknown"; - } -} - - - -// ------- - - - -GLPlatform::GLPlatform() - : m_driver(Driver_Unknown), - m_chipClass(UnknownChipClass), - m_recommendedCompositor(XRenderCompositing), - m_mesaVersion(0), - m_galliumVersion(0), - m_looseBinding(false), - m_directRendering(false), - m_supportsGLSL(false), - m_limitedGLSL(false), - m_textureNPOT(false), - m_limitedNPOT(false), - m_virtualMachine(false) -{ -} - -GLPlatform::~GLPlatform() -{ -} - -void GLPlatform::detect(OpenGLPlatformInterface platformInterface) -{ - m_vendor = (const char*)glGetString(GL_VENDOR); - m_renderer = (const char*)glGetString(GL_RENDERER); - m_version = (const char*)glGetString(GL_VERSION); - - // Parse the OpenGL version - const QList<QByteArray> versionTokens = m_version.split(' '); - if (versionTokens.count() > 0) { - const QByteArray version = QByteArray(m_version); - m_glVersion = parseVersionString(version); - } - -#ifndef KWIN_HAVE_OPENGLES - if (m_glVersion >= kVersionNumber(3, 0)) { - PFNGLGETSTRINGIPROC glGetStringi; - -#ifdef KWIN_HAVE_EGL - if (platformInterface == EglPlatformInterface) - glGetStringi = (PFNGLGETSTRINGIPROC) eglGetProcAddress("glGetStringi"); - else -#endif - glGetStringi = (PFNGLGETSTRINGIPROC) glXGetProcAddress((const GLubyte *) "glGetStringi"); - - int count; - glGetIntegerv(GL_NUM_EXTENSIONS, &count); - - for (int i = 0; i < count; i++) { - const char *name = (const char *) glGetStringi(GL_EXTENSIONS, i); - m_extensions.insert(name); - } - } else -#endif - { - const QByteArray extensions = (const char *) glGetString(GL_EXTENSIONS); - m_extensions = QSet<QByteArray>::fromList(extensions.split(' ')); - } - - // Parse the Mesa version - const int mesaIndex = versionTokens.indexOf("Mesa"); - if (mesaIndex != -1) { - const QByteArray version = versionTokens.at(mesaIndex + 1); - m_mesaVersion = parseVersionString(version); - } - - if (platformInterface == EglPlatformInterface) { - m_directRendering = true; -#ifdef KWIN_HAVE_OPENGLES - m_supportsGLSL = true; - m_textureNPOT = true; -#else - m_supportsGLSL = m_extensions.contains("GL_ARB_shader_objects") && - m_extensions.contains("GL_ARB_fragment_shader") && - m_extensions.contains("GL_ARB_vertex_shader"); - - m_textureNPOT = m_extensions.contains("GL_ARB_texture_non_power_of_two"); -#endif - } else if (platformInterface == GlxPlatformInterface) { -#ifndef KWIN_HAVE_OPENGLES - GLXContext ctx = glXGetCurrentContext(); - m_directRendering = glXIsDirect(display(), ctx); - - m_supportsGLSL = m_directRendering && - m_extensions.contains("GL_ARB_shader_objects") && - m_extensions.contains("GL_ARB_fragment_shader") && - m_extensions.contains("GL_ARB_vertex_shader"); - - m_textureNPOT = m_extensions.contains("GL_ARB_texture_non_power_of_two"); -#endif - } - - m_serverVersion = getXServerVersion(); - m_kernelVersion = getKernelVersion(); - - m_glslVersion = 0; - m_glsl_version = QByteArray(); - - if (m_supportsGLSL) { - // Parse the GLSL version - m_glsl_version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); - m_glslVersion = parseVersionString(m_glsl_version); - } - - m_chipset = "Unknown"; - m_preferBufferSubData = false; - - - // Mesa classic drivers - // ==================================================== - - // Radeon - if (m_renderer.startsWith("Mesa DRI R")) { - // Sample renderer string: Mesa DRI R600 (RV740 94B3) 20090101 x86/MMX/SSE2 TCL DRI2 - const QList<QByteArray> tokens = m_renderer.split(' '); - const QByteArray chipClass = tokens.at(2); - m_chipset = tokens.at(3).mid(1, -1); // Strip the leading '(' - - if (chipClass == "R100") - // Vendor: Tungsten Graphics, Inc. - m_driver = Driver_R100; - - else if (chipClass == "R200") - // Vendor: Tungsten Graphics, Inc. - m_driver = Driver_R200; - - else if (chipClass == "R300") - // Vendor: DRI R300 Project - m_driver = Driver_R300C; - - else if (chipClass == "R600") - // Vendor: Advanced Micro Devices, Inc. - m_driver = Driver_R600C; - - m_chipClass = detectRadeonClass(m_chipset); - } - - // Intel - else if (m_renderer.contains("Intel")) { - // Vendor: Tungsten Graphics, Inc. - // Sample renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100328 2010Q1 - - QByteArray chipset; - if (m_renderer.startsWith("Intel(R) Integrated Graphics Device")) - chipset = "IGD"; - else - chipset = m_renderer; - - m_driver = Driver_Intel; - m_chipClass = detectIntelClass(chipset); - } - - // Gallium drivers - // ==================================================== - else if (m_renderer.contains("Gallium")) { - // Sample renderer string: Gallium 0.4 on AMD RV740 - const QList<QByteArray> tokens = m_renderer.split(' '); - m_galliumVersion = parseVersionString(tokens.at(1)); - m_chipset = (tokens.at(3) == "AMD" || tokens.at(3) == "ATI") ? - tokens.at(4) : tokens.at(3); - - // R300G - if (m_vendor == "X.Org R300 Project") { - m_chipClass = detectRadeonClass(m_chipset); - m_driver = Driver_R300G; - } - - // R600G - else if (m_vendor == "X.Org" && - (m_renderer.contains("R6") || - m_renderer.contains("R7") || - m_renderer.contains("RV6") || - m_renderer.contains("RV7") || - m_renderer.contains("RS780") || - m_renderer.contains("RS880") || - m_renderer.contains("CEDAR") || - m_renderer.contains("REDWOOD") || - m_renderer.contains("JUNIPER") || - m_renderer.contains("CYPRESS") || - m_renderer.contains("HEMLOCK") || - m_renderer.contains("PALM") || - m_renderer.contains("EVERGREEN") || - m_renderer.contains("SUMO") || - m_renderer.contains("SUMO2") || - m_renderer.contains("BARTS") || - m_renderer.contains("TURKS") || - m_renderer.contains("CAICOS") || - m_renderer.contains("CAYMAN"))) { - m_chipClass = detectRadeonClass(m_chipset); - m_driver = Driver_R600G; - } - - // Nouveau - else if (m_vendor == "nouveau") { - m_chipClass = detectNVidiaClass(m_chipset); - m_driver = Driver_Nouveau; - } - - // softpipe - else if (m_vendor == "VMware, Inc." && m_chipset == "softpipe" ) { - m_driver = Driver_Softpipe; - } - - // llvmpipe - else if (m_vendor == "VMware, Inc." && m_chipset == "llvmpipe") { - m_driver = Driver_Llvmpipe; - } - - // SVGA3D - else if (m_vendor == "VMware, Inc." && m_chipset.contains("SVGA3D")) { - m_driver = Driver_VMware; - } - } - - - // Properietary drivers - // ==================================================== - else if (m_vendor == "ATI Technologies Inc.") { - m_chipClass = detectRadeonClass(m_renderer); - m_driver = Driver_Catalyst; - - if (versionTokens.count() > 1 && versionTokens.at(2)[0] == '(') - m_driverVersion = parseVersionString(versionTokens.at(1)); - else if (versionTokens.count() > 0) - m_driverVersion = parseVersionString(versionTokens.at(0)); - else - m_driverVersion = 0; - } - - else if (m_vendor == "NVIDIA Corporation") { - m_chipClass = detectNVidiaClass(m_renderer); - m_driver = Driver_NVidia; - - int index = versionTokens.indexOf("NVIDIA"); - if (versionTokens.count() > index) - m_driverVersion = parseVersionString(versionTokens.at(index + 1)); - else - m_driverVersion = 0; - } - - else if (m_renderer == "Software Rasterizer") { - m_driver = Driver_Swrast; - } - - // Virtual Hardware - // ==================================================== - else if (m_vendor == "Humper" && m_renderer == "Chromium") { - // Virtual Box - m_driver = Driver_VirtualBox; - - const int index = versionTokens.indexOf("Chromium"); - if (versionTokens.count() > index) - m_driverVersion = parseVersionString(versionTokens.at(index + 1)); - else - m_driverVersion = 0; - } - - - // Driver/GPU specific features - // ==================================================== - if (isRadeon()) { - // R200 technically has a programmable pipeline, but since it's SM 1.4, - // it's too limited to to be of any practical value to us. - if (m_chipClass < R300) - m_supportsGLSL = false; - - m_limitedGLSL = false; - m_limitedNPOT = false; - - if (m_chipClass < R600) { - if (driver() == Driver_Catalyst) - m_textureNPOT = m_limitedNPOT = false; // Software fallback - else if (driver() == Driver_R300G) - m_limitedNPOT = m_textureNPOT; - - m_limitedGLSL = m_supportsGLSL; - } - - if (m_chipClass < R300) { - // fallback to XRender for R100 and R200 - m_recommendedCompositor = XRenderCompositing; - } else if (m_chipClass < R600) { - // OpenGL 1 due to NPOT limitations not supported by KWin's shaders - m_recommendedCompositor = OpenGL1Compositing; - } else { - m_recommendedCompositor = OpenGL2Compositing; - } - - if (driver() == Driver_R600G || - (driver() == Driver_R600C && m_renderer.contains("DRI2"))) { - m_looseBinding = true; - } - } - - if (isNvidia()) { - if (m_driver == Driver_NVidia && m_chipClass < NV40) - m_supportsGLSL = false; // High likelihood of software emulation - - if (m_driver == Driver_NVidia) { - m_looseBinding = true; - m_preferBufferSubData = true; - } - - if (m_chipClass < NV20) { - m_recommendedCompositor = XRenderCompositing; - } else if (m_chipClass < NV40) { - m_recommendedCompositor = OpenGL1Compositing; - } else { - m_recommendedCompositor = OpenGL2Compositing; - } - - m_limitedNPOT = m_textureNPOT && m_chipClass < NV40; - m_limitedGLSL = m_supportsGLSL && m_chipClass < G80; - } - - if (isIntel()) { - if (m_chipClass < I915) - m_supportsGLSL = false; - - m_limitedGLSL = m_supportsGLSL && m_chipClass < I965; - // see https://bugs.freedesktop.org/show_bug.cgi?id=80349#c1 - m_looseBinding = false; - - if (m_chipClass < I965) { - m_recommendedCompositor = OpenGL1Compositing; - } else { - m_recommendedCompositor = OpenGL2Compositing; - } - } - - if (isMesaDriver() && platformInterface == EglPlatformInterface) { - // According to the reference implementation in - // mesa/demos/src/egl/opengles1/texture_from_pixmap - // the mesa egl implementation does not require a strict binding (so far). - m_looseBinding = true; - } - - if (isSoftwareEmulation()) { - // we recommend XRender - m_recommendedCompositor = XRenderCompositing; - if (m_driver < Driver_Llvmpipe) { - // Software emulation does not provide GLSL - m_limitedGLSL = m_supportsGLSL = false; - } else { - // llvmpipe does support GLSL - m_limitedGLSL = false; - m_supportsGLSL = true; - } - } - - if (m_chipClass == UnknownChipClass && m_driver == Driver_Unknown) { - // we don't know the hardware. Let's be optimistic and assume OpenGL compatible hardware - m_recommendedCompositor = OpenGL2Compositing; - m_supportsGLSL = true; - } - - if (isVirtualBox()) { - m_virtualMachine = true; - } - - if (isVMware()) { - m_virtualMachine = true; - } -} - -static void print(const QString &label, const QString &setting) -{ - std::cout << std::setw(40) << std::left - << qPrintable(label) << qPrintable(setting) << std::endl; -} - -void GLPlatform::printResults() const -{ - print("OpenGL vendor string:", m_vendor); - print("OpenGL renderer string:", m_renderer); - print("OpenGL version string:", m_version); - - if (m_supportsGLSL) - print("OpenGL shading language version string:", m_glsl_version); - - print("Driver:", driverToString(m_driver)); - if (!isMesaDriver()) - print("Driver version:", versionToString(m_driverVersion)); - - print("GPU class:", chipClassToString(m_chipClass)); - - print("OpenGL version:", versionToString(m_glVersion)); - - if (m_supportsGLSL) - print("GLSL version:", versionToString(m_glslVersion)); - - if (isMesaDriver()) - print("Mesa version:", versionToString(mesaVersion())); - //if (galliumVersion() > 0) - // print("Gallium version:", versionToString(m_galliumVersion)); - if (serverVersion() > 0) - print("X server version:", versionToString(m_serverVersion)); - if (kernelVersion() > 0) - print("Linux kernel version:", versionToString(m_kernelVersion)); - - print("Direct rendering:", m_directRendering ? "yes" : "no"); - print("Requires strict binding:", !m_looseBinding ? "yes" : "no"); - print("GLSL shaders:", m_supportsGLSL ? (m_limitedGLSL ? "limited" : "yes") : "no"); - print("Texture NPOT support:", m_textureNPOT ? (m_limitedNPOT ? "limited" : "yes") : "no"); - print("Virtual Machine:", m_virtualMachine ? "yes" : "no"); -} - -bool GLPlatform::supports(GLFeature feature) const -{ - switch(feature) { - case LooseBinding: - return m_looseBinding; - - case GLSL: - return m_supportsGLSL; - - case LimitedGLSL: - return m_limitedGLSL; - - case TextureNPOT: - return m_textureNPOT; - - case LimitedNPOT: - return m_limitedNPOT; - - default: - return false; - } -} - -qint64 GLPlatform::glVersion() const -{ - return m_glVersion; -} - -qint64 GLPlatform::glslVersion() const -{ - return m_glslVersion; -} - -qint64 GLPlatform::mesaVersion() const -{ - return m_mesaVersion; -} - -qint64 GLPlatform::galliumVersion() const -{ - return m_galliumVersion; -} - -qint64 GLPlatform::serverVersion() const -{ - return m_serverVersion; -} - -qint64 GLPlatform::kernelVersion() const -{ - return m_kernelVersion; -} - -qint64 GLPlatform::driverVersion() const -{ - if (isMesaDriver()) - return mesaVersion(); - - return m_driverVersion; -} - -Driver GLPlatform::driver() const -{ - return m_driver; -} - -ChipClass GLPlatform::chipClass() const -{ - return m_chipClass; -} - -bool GLPlatform::isMesaDriver() const -{ - return mesaVersion() > 0; -} - -bool GLPlatform::isGalliumDriver() const -{ - return galliumVersion() > 0; -} - -bool GLPlatform::isRadeon() const -{ - return m_chipClass >= R100 && m_chipClass <= UnknownRadeon; -} - -bool GLPlatform::isNvidia() const -{ - return m_chipClass >= NV10 && m_chipClass <= UnknownNVidia; -} - -bool GLPlatform::isIntel() const -{ - return m_chipClass >= I8XX && m_chipClass <= UnknownIntel; -} - -bool GLPlatform::isVirtualBox() const -{ - return m_driver == Driver_VirtualBox; -} - -bool GLPlatform::isVMware() const -{ - return m_driver == Driver_VMware; -} - -bool GLPlatform::isSoftwareEmulation() const -{ - return m_driver == Driver_Softpipe || m_driver == Driver_Swrast || m_driver == Driver_Llvmpipe; -} - -const QByteArray &GLPlatform::glRendererString() const -{ - return m_renderer; -} - -const QByteArray &GLPlatform::glVendorString() const -{ - return m_vendor; -} - -const QByteArray &GLPlatform::glVersionString() const -{ - return m_version; -} - -const QByteArray &GLPlatform::glShadingLanguageVersionString() const -{ - return m_glsl_version; -} - -bool GLPlatform::isDirectRendering() const -{ - return m_directRendering; -} - -bool GLPlatform::isLooseBinding() const -{ - return m_looseBinding; -} - -bool GLPlatform::isVirtualMachine() const -{ - return m_virtualMachine; -} - -CompositingType GLPlatform::recommendedCompositor() const -{ - return m_recommendedCompositor; -} - -bool GLPlatform::preferBufferSubData() const -{ - return m_preferBufferSubData; -} - -bool GLPlatform::isGLES() const -{ -#ifdef KWIN_HAVE_OPENGLES - return true; -#else - return false; -#endif -} - -} // namespace KWin - diff --git a/kwin/libkwineffects/kwinglplatform.h b/kwin/libkwineffects/kwinglplatform.h deleted file mode 100644 index 36a0e15e..00000000 --- a/kwin/libkwineffects/kwinglplatform.h +++ /dev/null @@ -1,385 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_GLPLATFORM_H -#define KWIN_GLPLATFORM_H - -#include <kwinglobals.h> -#include <kwinglutils_funcs.h> - -#include <QByteArray> -#include <QSet> - -namespace KWin -{ - -inline qint64 kVersionNumber(qint64 major, qint64 minor, qint64 patch = 0) -{ - return ((major & 0xffff) << 32) | ((minor & 0xffff) << 16) | (patch & 0xffff); -} - -enum GLFeature { - /** - * Set when a texture bound to a pixmap uses the same storage as the pixmap, - * and thus doesn't need to be rebound when the contents of the pixmap - * has changed. - */ - LooseBinding, - - /** - * Set if the driver supports the following extensions: - * - GL_ARB_shader_objects - * - GL_ARB_fragment_shader - * - GL_ARB_vertex_shader - * - GL_ARB_shading_language_100 - */ - GLSL, - - /** - * If set, assume the following: - * - No flow control or branches - * - No loops, unless the loops have a fixed iteration count and can be unrolled - * - No functions, unless they can be inlined - * - No indirect indexing of arrays - * - No support for gl_ClipVertex or gl_FrontFacing - * - No texture fetches in vertex shaders - * - Max 32 texture fetches in fragment shaders - * - Max 4 texture indirections - */ - LimitedGLSL, - - /** - * Set when the driver supports GL_ARB_texture_non_power_of_two. - */ - TextureNPOT, - - /** - * If set, the driver supports GL_ARB_texture_non_power_of_two with the - * GL_ARB_texture_rectangle limitations. - * - * This means no support for mipmap filters, and that only the following - * wrap modes are supported: - * - GL_CLAMP - * - GL_CLAMP_TO_EDGE - * - GL_CLAMP_TO_BORDER - */ - LimitedNPOT -}; - -enum Driver { - Driver_R100, // Technically "Radeon" - Driver_R200, - Driver_R300C, - Driver_R300G, - Driver_R600C, - Driver_R600G, - Driver_Nouveau, - Driver_Intel, - Driver_NVidia, - Driver_Catalyst, - Driver_Swrast, - Driver_Softpipe, - Driver_Llvmpipe, - Driver_VirtualBox, - Driver_VMware, - Driver_Unknown -}; - -enum ChipClass { - // Radeon - R100 = 0, // GL1.3 DX7 2000 - R200, // GL1.4 DX8.1 SM 1.4 2001 - R300, // GL2.0 DX9 SM 2.0 2002 - R400, // GL2.0 DX9b SM 2.0b 2004 - R500, // GL2.0 DX9c SM 3.0 2005 - R600, // GL3.3 DX10 SM 4.0 2006 - R700, // GL3.3 DX10.1 SM 4.1 2008 - Evergreen, // GL4.0 CL1.0 DX11 SM 5.0 2009 - NorthernIslands, // GL4.0 CL1.1 DX11 SM 5.0 2010 - UnknownRadeon = 999, - - // NVIDIA - NV10 = 1000, // GL1.2 DX7 1999 - NV20, // GL1.3 DX8 SM 1.1 2001 - NV30, // GL1.5 DX9a SM 2.0 2003 - NV40, // GL2.1 DX9c SM 3.0 2004 - G80, // GL3.3 DX10 SM 4.0 2006 - GF100, // GL4.1 CL1.1 DX11 SM 5.0 2010 - UnknownNVidia = 1999, - - // Intel - I8XX = 2000, // GL1.3 DX7 2001 - I915, // GL1.4/1.5 DX9/DX9c SM 2.0 2004 - I965, // GL2.0/2.1 DX9/DX10 SM 3.0/4.0 2006 - SandyBridge, // GL3.1 CL1.1 DX10.1 SM 4.0 2010 - IvyBridge, // GL4.0 CL1.1 DX11 SM 5.0 2012 - Haswell, // GL4.0 CL1.2 DX11.1 SM 5.0 2013 - UnknownIntel = 2999, - - UnknownChipClass = 99999 -}; - - -class KWIN_EXPORT GLPlatform -{ -public: - ~GLPlatform(); - - /** - * Runs the detection code using the current OpenGL context. - */ - void detect(OpenGLPlatformInterface platformInterface); - - /** - * Prints the results of the detection code. - */ - void printResults() const; - - /** - * Returns a pointer to the GLPlatform instance. - */ - static GLPlatform *instance(); - - /** - * Returns true if the driver support the given feature, and false otherwise. - */ - bool supports(GLFeature feature) const; - - /** - * Returns the OpenGL version. - */ - qint64 glVersion() const; - - /** - * Returns the GLSL version if the driver supports GLSL, and 0 otherwise. - */ - qint64 glslVersion() const; - - /** - * Returns the Mesa version if the driver is a Mesa driver, and 0 otherwise. - */ - qint64 mesaVersion() const; - - /** - * Returns the Gallium version if the driver is a Gallium driver, and 0 otherwise. - */ - qint64 galliumVersion() const; - - /** - * Returns the X server version. - * - * Note that the version number changed from 7.2 to 1.3 in the first release - * following the doupling of the X server from the katamari. - * - * For non X.org servers, this method returns 0. - */ - qint64 serverVersion() const; - - /** - * Returns the Linux kernel version. - * - * If the kernel is not a Linux kernel, this method returns 0. - */ - qint64 kernelVersion() const; - - /** - * Returns the driver version. - * - * For Mesa drivers, this is the same as the Mesa version number. - */ - qint64 driverVersion() const; - - /** - * Returns the driver. - */ - Driver driver() const; - - /** - * Returns the chip class. - */ - ChipClass chipClass() const; - - /** - * Returns true if the driver is a Mesa driver, and false otherwise. - */ - bool isMesaDriver() const; - - /** - * Returns true if the driver is a Gallium driver, and false otherwise. - */ - bool isGalliumDriver() const; - - /** - * Returns true if the GPU is a Radeon GPU, and false otherwise. - */ - bool isRadeon() const; - - /** - * Returns true if the GPU is an NVIDIA GPU, and false otherwise. - */ - bool isNvidia() const; - - /** - * Returns true if the GPU is an Intel GPU, and false otherwise. - */ - bool isIntel() const; - - /** - * @returns @c true if the "GPU" is a VirtualBox GPU, and @c false otherwise. - * @since 4.10 - **/ - bool isVirtualBox() const; - - /** - * @returns @c true if the "GPU" is a VMWare GPU, and @c false otherwise. - * @since 4.10 - **/ - bool isVMware() const; - - /** - * @returns @c true if OpenGL is emulated in software. - * @since 4.7 - **/ - bool isSoftwareEmulation() const; - - /** - * @returns @c true if the driver is known to be from a virtual machine. - * @since 4.10 - **/ - bool isVirtualMachine() const; - - /** - * @returns the GL_VERSION string as provided by the driver. - * @since 4.9 - **/ - const QByteArray &glVersionString() const; - /** - * @returns the GL_RENDERER string as provided by the driver. - * @since 4.9 - **/ - const QByteArray &glRendererString() const; - /** - * @returns the GL_VENDOR string as provided by the driver. - * @since 4.9 - **/ - const QByteArray &glVendorString() const; - /** - * @returns the GL_SHADING_LANGUAGE_VERSION string as provided by the driver. - * If the driver does not support the OpenGL Shading Language a null bytearray is returned. - * @since 4.9 - **/ - const QByteArray &glShadingLanguageVersionString() const; - /** - * @returns Whether a direct rendering OpenGL context is used. - * @since 4.9 - **/ - bool isDirectRendering() const; - /** - * @returns Whether the driver supports loose texture binding. - * @since 4.9 - **/ - bool isLooseBinding() const; - /** - * @returns Whether OpenGL ES is used - */ - bool isGLES() const; - - /** - * @returns The CompositingType recommended by the driver. - * @since 4.10 - **/ - CompositingType recommendedCompositor() const; - - /** - * Returns true if glMapBufferRange() is likely to perform worse than glBufferSubData() - * when updating an unused range of a buffer object, and false otherwise. - * - * @since 4.11 - */ - bool preferBufferSubData() const; - - /** - * @returns a human readable form of the @p version. - * @since 4.9 - * @see glVersion - * @see glslVersion - * @see driverVersion - * @see mesaVersion - * @see galliumVersion - * @see kernelVersion - * @see serverVersion - **/ - static QString versionToString(qint64 version); - /** - * @returns a human readable form for the @p driver. - * @since 4.9 - * @see driver - **/ - static QString driverToString(Driver driver); - /** - * @returns a human readable form for the @p chipClass. - * @since 4.9 - * @see chipClass - **/ - static QString chipClassToString(ChipClass chipClass); - -private: - GLPlatform(); - -private: - QByteArray m_renderer; - QByteArray m_vendor; - QByteArray m_version; - QByteArray m_glsl_version; - QByteArray m_chipset; - QSet<QByteArray> m_extensions; - Driver m_driver; - ChipClass m_chipClass; - CompositingType m_recommendedCompositor; - qint64 m_glVersion; - qint64 m_glslVersion; - qint64 m_mesaVersion; - qint64 m_driverVersion; - qint64 m_galliumVersion; - qint64 m_serverVersion; - qint64 m_kernelVersion; - bool m_looseBinding: 1; - bool m_directRendering: 1; - bool m_supportsGLSL: 1; - bool m_limitedGLSL: 1; - bool m_textureNPOT: 1; - bool m_limitedNPOT: 1; - bool m_virtualMachine: 1; - bool m_preferBufferSubData: 1; - static GLPlatform *s_platform; -}; - -inline GLPlatform *GLPlatform::instance() -{ - if (!s_platform) - s_platform = new GLPlatform; - - return s_platform; -} - -} // namespace KWin - -#endif // KWIN_GLPLATFORM_H - diff --git a/kwin/libkwineffects/kwingltexture.cpp b/kwin/libkwineffects/kwingltexture.cpp deleted file mode 100644 index 7423ed4a..00000000 --- a/kwin/libkwineffects/kwingltexture.cpp +++ /dev/null @@ -1,628 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee> -Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@kde.org> -Copyright (C) 2012 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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#include "kwinconfig.h" // KWIN_HAVE_OPENGL - -#include "kwinglplatform.h" -#include "kwineffects.h" -#include "kwinglutils_funcs.h" -#include "kwinglutils.h" - -#include "kwingltexture_p.h" - -#include <QPixmap> -#include <QImage> -#include <QVector2D> -#include <QVector3D> -#include <QVector4D> -#include <QMatrix4x4> - -namespace KWin -{ - -//**************************************** -// GLTexture -//**************************************** - -bool GLTexturePrivate::sNPOTTextureSupported = false; -bool GLTexturePrivate::sFramebufferObjectSupported = false; -bool GLTexturePrivate::sSaturationSupported = false; -GLenum GLTexturePrivate::sTextureFormat = GL_RGBA; // custom dummy, GL_BGRA is not present on GLES -uint GLTexturePrivate::s_textureObjectCounter = 0; -uint GLTexturePrivate::s_fbo = 0; - - -GLTexture::GLTexture() - : d_ptr(new GLTexturePrivate()) -{ -} - -GLTexture::GLTexture(GLTexturePrivate& dd) - : d_ptr(&dd) -{ -} - -GLTexture::GLTexture(const GLTexture& tex) - : d_ptr(tex.d_ptr) -{ -} - -GLTexture::GLTexture(const QImage& image, GLenum target) - : d_ptr(new GLTexturePrivate()) -{ - load(image, target); -} - -GLTexture::GLTexture(const QPixmap& pixmap, GLenum target) - : d_ptr(new GLTexturePrivate()) -{ - load(pixmap, target); -} - -GLTexture::GLTexture(const QString& fileName) - : d_ptr(new GLTexturePrivate()) -{ - load(fileName); -} - -GLTexture::GLTexture(int width, int height) - : d_ptr(new GLTexturePrivate()) -{ - Q_D(GLTexture); - if (NPOTTextureSupported() || (isPowerOfTwo(width) && isPowerOfTwo(height))) { - d->m_target = GL_TEXTURE_2D; - d->m_scale.setWidth(1.0 / width); - d->m_scale.setHeight(1.0 / height); - d->m_size = QSize(width, height); - d->m_canUseMipmaps = true; - - d->updateMatrix(); - - glGenTextures(1, &d->m_texture); - bind(); -#ifdef KWIN_HAVE_OPENGLES - glTexImage2D(d->m_target, 0, GLTexturePrivate::sTextureFormat, width, height, - 0, GLTexturePrivate::sTextureFormat, GL_UNSIGNED_BYTE, 0); -#else - glTexImage2D(d->m_target, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); -#endif - unbind(); - } -} - -GLTexture::~GLTexture() -{ -} - -GLTexture& GLTexture::operator = (const GLTexture& tex) -{ - d_ptr = tex.d_ptr; - return *this; -} - -GLTexturePrivate::GLTexturePrivate() -{ - m_texture = 0; - m_target = 0; - m_filter = GL_NEAREST; - m_wrapMode = GL_REPEAT; - m_yInverted = false; - m_canUseMipmaps = false; - m_markedDirty = false; - m_unnormalizeActive = 0; - m_normalizeActive = 0; - m_vbo = 0; - m_filterChanged = true; - m_wrapModeChanged = false; - ++s_textureObjectCounter; -} - -GLTexturePrivate::~GLTexturePrivate() -{ - if (m_vbo != 0) { - delete m_vbo; - } - if (m_texture != 0) { - glDeleteTextures(1, &m_texture); - } - // Delete the FBO if this is the last Texture - if (--s_textureObjectCounter == 0 && s_fbo) { - glDeleteFramebuffers(1, &s_fbo); - s_fbo = 0; - } -} - -void GLTexturePrivate::initStatic() -{ -#ifdef KWIN_HAVE_OPENGLES - sNPOTTextureSupported = true; - sFramebufferObjectSupported = true; - sSaturationSupported = true; - if (hasGLExtension("GL_EXT_texture_format_BGRA8888")) - sTextureFormat = GL_BGRA_EXT; - else - sTextureFormat = GL_RGBA; -#else - sNPOTTextureSupported = hasGLExtension("GL_ARB_texture_non_power_of_two"); - sFramebufferObjectSupported = hasGLExtension("GL_EXT_framebuffer_object"); - sSaturationSupported = ((hasGLExtension("GL_ARB_texture_env_crossbar") - && hasGLExtension("GL_ARB_texture_env_dot3")) || hasGLVersion(1, 4)) - && (glTextureUnitsCount >= 4) && glActiveTexture != NULL; - sTextureFormat = GL_BGRA; -#endif -} - -bool GLTexture::isNull() const -{ - Q_D(const GLTexture); - return None == d->m_texture; -} - -QSize GLTexture::size() const -{ - Q_D(const GLTexture); - return d->m_size; -} - -bool GLTexture::load(const QImage& image, GLenum target) -{ - // decrease the reference counter for the old texture - d_ptr = new GLTexturePrivate(); - - Q_D(GLTexture); - if (image.isNull()) - return false; - QImage img = image; - d->m_target = target; -#ifndef KWIN_HAVE_OPENGLES - if (d->m_target != GL_TEXTURE_RECTANGLE_ARB) { -#endif - if (!NPOTTextureSupported() - && (!isPowerOfTwo(image.width()) || !isPowerOfTwo(image.height()))) { - // non-rectangular target requires POT texture - img = img.scaled(nearestPowerOfTwo(image.width()), - nearestPowerOfTwo(image.height())); - } - d->m_scale.setWidth(1.0 / img.width()); - d->m_scale.setHeight(1.0 / img.height()); - d->m_canUseMipmaps = true; -#ifndef KWIN_HAVE_OPENGLES - } else { - d->m_scale.setWidth(1.0); - d->m_scale.setHeight(1.0); - d->m_canUseMipmaps = false; - } -#endif - d->m_size = img.size(); - d->m_yInverted = true; - - d->updateMatrix(); - - img = d->convertToGLFormat(img); - - if (isNull()) { - glGenTextures(1, &d->m_texture); - } - bind(); -#ifdef KWIN_HAVE_OPENGLES - glTexImage2D(d->m_target, 0, GLTexturePrivate::sTextureFormat, img.width(), img.height(), - 0, GLTexturePrivate::sTextureFormat, GL_UNSIGNED_BYTE, img.bits()); -#else - glTexImage2D(d->m_target, 0, GL_RGBA8, img.width(), img.height(), 0, - GL_BGRA, GL_UNSIGNED_BYTE, img.bits()); -#endif - unbind(); - setFilter(GL_LINEAR); - return true; -} - -void GLTexture::update(const QImage &image, const QPoint &offset, const QRect &src) -{ - if (image.isNull() || isNull()) - return; - - Q_D(GLTexture); -#ifdef KWIN_HAVE_OPENGLES - static bool s_supportsUnpack = hasGLExtension("GL_EXT_unpack_subimage"); -#else - static bool s_supportsUnpack = true; -#endif - - int width = image.width(); - int height = image.height(); - QImage tmpImage; - if (!src.isNull()) { - if (s_supportsUnpack) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width()); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, src.x()); - glPixelStorei(GL_UNPACK_SKIP_ROWS, src.y()); - } else { - tmpImage = image.copy(src); - } - width = src.width(); - height = src.height(); - } - const QImage &img = d->convertToGLFormat(tmpImage.isNull() ? image : tmpImage); - - bind(); - glTexSubImage2D(d->m_target, 0, offset.x(), offset.y(), width, height, - GLTexturePrivate::sTextureFormat, GL_UNSIGNED_BYTE, img.bits()); - checkGLError("update texture"); - unbind(); - setDirty(); - if (!src.isNull() && s_supportsUnpack) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - } -} - -bool GLTexture::load(const QPixmap& pixmap, GLenum target) -{ - if (pixmap.isNull()) - return false; - return load(pixmap.toImage(), target); -} - -bool GLTexture::load(const QString& fileName) -{ - if (fileName.isEmpty()) - return false; - return load(QImage(fileName)); -} - -void GLTexture::discard() -{ - d_ptr = new GLTexturePrivate(); -} - -void GLTexturePrivate::bind() -{ -#ifdef KWIN_HAVE_OPENGL_1 - if (!ShaderManager::instance()->isValid()) - glEnable(m_target); -#endif - glBindTexture(m_target, m_texture); -} - -void GLTexture::bind() -{ - Q_D(GLTexture); - d->bind(); - if (d->m_markedDirty) { - d->onDamage(); - } - if (d->m_filterChanged) { - if (d->m_filter == GL_LINEAR_MIPMAP_LINEAR) { - // trilinear filtering requested, but is it possible? - if (d->sNPOTTextureSupported - && d->sFramebufferObjectSupported - && d->m_canUseMipmaps) { - glTexParameteri(d->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(d->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glGenerateMipmap(d->m_target); - } else { - // can't use trilinear, so use bilinear - d->m_filter = GL_LINEAR; - glTexParameteri(d->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(d->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - } else if (d->m_filter == GL_LINEAR) { - glTexParameteri(d->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(d->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } else { - // if neither trilinear nor bilinear, default to fast filtering - d->m_filter = GL_NEAREST; - glTexParameteri(d->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(d->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - d->m_filterChanged = false; - } - if (d->m_wrapModeChanged) { - glTexParameteri(d->m_target, GL_TEXTURE_WRAP_S, d->m_wrapMode); - glTexParameteri(d->m_target, GL_TEXTURE_WRAP_T, d->m_wrapMode); - d->m_wrapModeChanged = false; - } -} - -void GLTexturePrivate::unbind() -{ - glBindTexture(m_target, 0); -#ifdef KWIN_HAVE_OPENGL_1 - if (!ShaderManager::instance()->isValid()) - glDisable(m_target); -#endif -} - -void GLTexture::unbind() -{ - Q_D(GLTexture); - d->unbind(); -} - -void GLTexture::render(QRegion region, const QRect& rect, bool hardwareClipping) -{ - Q_D(GLTexture); - if (rect.size() != d->m_cachedSize) { - d->m_cachedSize = rect.size(); - QRect r(rect); - r.moveTo(0, 0); - if (!d->m_vbo) { - d->m_vbo = new GLVertexBuffer(KWin::GLVertexBuffer::Static); - } - const float verts[ 4 * 2 ] = { - // NOTICE: r.x/y could be replaced by "0", but that would make it unreadable... - static_cast<float>(r.x()), static_cast<float>(r.y()), - static_cast<float>(r.x()), static_cast<float>(r.y() + rect.height()), - static_cast<float>(r.x() + rect.width()), static_cast<float>(r.y()), - static_cast<float>(r.x() + rect.width()), static_cast<float>(r.y() + rect.height()) - }; -#ifdef KWIN_HAVE_OPENGLES - const float texWidth = 1.0f; - const float texHeight = 1.0f; -#else - const float texWidth = (target() == GL_TEXTURE_RECTANGLE_ARB) ? width() : 1.0f; - const float texHeight = (target() == GL_TEXTURE_RECTANGLE_ARB) ? height() : 1.0f; -#endif - const float texcoords[ 4 * 2 ] = { - 0.0f, d->m_yInverted ? 0.0f : texHeight, // y needs to be swapped (normalized coords) - 0.0f, d->m_yInverted ? texHeight : 0.0f, - texWidth, d->m_yInverted ? 0.0f : texHeight, - texWidth, d->m_yInverted ? texHeight : 0.0f - }; - d->m_vbo->setData(4, 2, verts, texcoords); - } - QMatrix4x4 translation; - translation.translate(rect.x(), rect.y()); - if (ShaderManager::instance()->isShaderBound()) { - GLShader *shader = ShaderManager::instance()->getBoundShader(); - shader->setUniform(GLShader::Offset, QVector2D(rect.x(), rect.y())); - shader->setUniform(GLShader::WindowTransformation, translation); - } else { - pushMatrix(translation); - } - d->m_vbo->render(region, GL_TRIANGLE_STRIP, hardwareClipping); - if (ShaderManager::instance()->isShaderBound()) { - GLShader *shader = ShaderManager::instance()->getBoundShader(); - shader->setUniform(GLShader::WindowTransformation, QMatrix4x4()); - } else { - popMatrix(); - } -} - -GLuint GLTexture::texture() const -{ - Q_D(const GLTexture); - return d->m_texture; -} - -GLenum GLTexture::target() const -{ - Q_D(const GLTexture); - return d->m_target; -} - -GLenum GLTexture::filter() const -{ - Q_D(const GLTexture); - return d->m_filter; -} - -void GLTexture::clear() -{ - Q_D(GLTexture); - if (!GLTexturePrivate::s_fbo && GLRenderTarget::supported() && - GLPlatform::instance()->driver() != Driver_Catalyst) // fail. -> bug #323065 - glGenFramebuffers(1, &GLTexturePrivate::s_fbo); - - if (GLTexturePrivate::s_fbo) { - // Clear the texture - glBindFramebuffer(GL_FRAMEBUFFER, GLTexturePrivate::s_fbo); - glClearColor(0, 0, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, d->m_texture, 0); - glClear(GL_COLOR_BUFFER_BIT); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } else { - if (const int size = width()*height()) { - uint32_t *buffer = new uint32_t[size]; - memset(buffer, 0, size*sizeof(uint32_t)); - bind(); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width(), height(), - GLTexturePrivate::sTextureFormat, GL_UNSIGNED_BYTE, buffer); - unbind(); - delete[] buffer; - } - } -} - -bool GLTexture::isDirty() const -{ - Q_D(const GLTexture); - return d->m_markedDirty; -} - -void GLTexture::setFilter(GLenum filter) -{ - Q_D(GLTexture); - if (filter != d->m_filter) { - d->m_filter = filter; - d->m_filterChanged = true; - } -} - -void GLTexture::setWrapMode(GLenum mode) -{ - Q_D(GLTexture); - if (mode != d->m_wrapMode) { - d->m_wrapMode = mode; - d->m_wrapModeChanged=true; - } -} - -void GLTexturePrivate::onDamage() -{ - if (m_filter == GL_LINEAR_MIPMAP_LINEAR && !m_filterChanged) { - glGenerateMipmap(m_target); - } -} - -void GLTexture::setDirty() -{ - Q_D(GLTexture); - d->m_markedDirty = true; -} - -QImage GLTexturePrivate::convertToGLFormat(const QImage& img) const -{ - // Copied from Qt's QGLWidget::convertToGLFormat() - QImage res; - - if (sTextureFormat != GL_RGBA) { - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - res = QImage(img.size(), QImage::Format_ARGB32); - QImage imgARGB32 = img.convertToFormat(QImage::Format_ARGB32_Premultiplied); - - const int width = img.width(); - const int height = img.height(); - const uint32_t *p = (const uint32_t*) imgARGB32.scanLine(0); - uint32_t *q = (uint32_t*) res.scanLine(0); - - // swizzle - for (int i = 0; i < height; ++i) { - const uint32_t *end = p + width; - while (p < end) { - *q = ((*p << 24) & 0xff000000) - | ((*p >> 24) & 0x000000ff) - | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00); - p++; - q++; - } - } - } else if (img.format() != QImage::Format_ARGB32_Premultiplied) { - res = img.convertToFormat(QImage::Format_ARGB32_Premultiplied); - } else { - return img; - } - } else { -#ifdef KWIN_HAVE_OPENGLES - res = QImage(img.size(), QImage::Format_ARGB32); - QImage imgARGB32 = img.convertToFormat(QImage::Format_ARGB32_Premultiplied); - - const int width = img.width(); - const int height = img.height(); - const uint32_t *p = (const uint32_t*) imgARGB32.scanLine(0); - uint32_t *q = (uint32_t*) res.scanLine(0); - - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - for (int i = 0; i < height; ++i) { - const uint32_t *end = p + width; - while (p < end) { - *q = (*p << 8) | ((*p >> 24) & 0xFF); - p++; - q++; - } - } - } else { - // GL_BGRA -> GL_RGBA - for (int i = 0; i < height; ++i) { - const uint32_t *end = p + width; - while (p < end) { - *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | (*p & 0xff00ff00); - p++; - q++; - } - } - } -#endif - } - return res; -} - -void GLTexturePrivate::updateMatrix() -{ - m_matrix[NormalizedCoordinates].setToIdentity(); - m_matrix[UnnormalizedCoordinates].setToIdentity(); - -#ifndef KWIN_HAVE_OPENGLES - if (m_target == GL_TEXTURE_RECTANGLE_ARB) - m_matrix[NormalizedCoordinates].scale(m_size.width(), m_size.height()); - else -#endif - m_matrix[UnnormalizedCoordinates].scale(1.0 / m_size.width(), 1.0 / m_size.height()); - - if (!m_yInverted) { - m_matrix[NormalizedCoordinates].translate(0.0, 1.0); - m_matrix[NormalizedCoordinates].scale(1.0, -1.0); - - m_matrix[UnnormalizedCoordinates].translate(0.0, m_size.height()); - m_matrix[UnnormalizedCoordinates].scale(1.0, -1.0); - } -} - -bool GLTexture::isYInverted() const -{ - Q_D(const GLTexture); - return d->m_yInverted; -} - -void GLTexture::setYInverted(bool inverted) -{ - Q_D(GLTexture); - d->m_yInverted = inverted; - d->updateMatrix(); -} - -int GLTexture::width() const -{ - Q_D(const GLTexture); - return d->m_size.width(); -} - -int GLTexture::height() const -{ - Q_D(const GLTexture); - return d->m_size.height(); -} - -QMatrix4x4 GLTexture::matrix(TextureCoordinateType type) const -{ - Q_D(const GLTexture); - return d->m_matrix[type]; -} - -bool GLTexture::NPOTTextureSupported() -{ - return GLTexturePrivate::sNPOTTextureSupported; -} - -bool GLTexture::framebufferObjectSupported() -{ - return GLTexturePrivate::sFramebufferObjectSupported; -} - -bool GLTexture::saturationSupported() -{ - return GLTexturePrivate::sSaturationSupported; -} - -} // namespace KWin diff --git a/kwin/libkwineffects/kwingltexture.h b/kwin/libkwineffects/kwingltexture.h deleted file mode 100644 index 8271a7a1..00000000 --- a/kwin/libkwineffects/kwingltexture.h +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee> -Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_GLTEXTURE_H -#define KWIN_GLTEXTURE_H - -#include "kwinglobals.h" - -#include <QSize> -#include <QRegion> -#include <QSharedPointer> -#include <QtCore/qsharedpointer.h> -#include <QtGui/QMatrix4x4> - -class QImage; -class QPixmap; - -/** @addtogroup kwineffects */ -/** @{ */ - -namespace KWin -{ - -class GLVertexBuffer; -class GLTexturePrivate; - -enum TextureCoordinateType { - NormalizedCoordinates = 0, - UnnormalizedCoordinates -}; - -class KWIN_EXPORT GLTexture -{ -public: - GLTexture(); - GLTexture(const GLTexture& tex); - explicit GLTexture(const QImage& image, GLenum target = GL_TEXTURE_2D); - explicit GLTexture(const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D); - explicit GLTexture(const QString& fileName); - GLTexture(int width, int height); - virtual ~GLTexture(); - - GLTexture & operator = (const GLTexture& tex); - - bool isNull() const; - QSize size() const; - int width() const; - int height() const; - /** - * @since 4.7 - **/ - bool isYInverted() const; - /** - * @since 4.8 - **/ - void setYInverted(bool inverted); - - /** - * Returns a matrix that transforms texture coordinates of the given type, - * taking the texture target and the y-inversion flag into account. - * - * @since 4.11 - */ - QMatrix4x4 matrix(TextureCoordinateType type) const; - - virtual bool load(const QImage& image, GLenum target = GL_TEXTURE_2D); - virtual bool load(const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D); - virtual bool load(const QString& fileName); - void update(const QImage& image, const QPoint &offset = QPoint(0, 0), const QRect &src = QRect()); - virtual void discard(); - void bind(); - void unbind(); - void render(QRegion region, const QRect& rect, bool hardwareClipping = false); - - GLuint texture() const; - GLenum target() const; - GLenum filter() const; - /** @short - * Make the texture fully transparent - * Warning: this clobbers the current framebuffer binding except on fglrx - */ - void clear(); - bool isDirty() const; - void setFilter(GLenum filter); - void setWrapMode(GLenum mode); - void setDirty(); - - static bool NPOTTextureSupported(); - static bool framebufferObjectSupported(); - static bool saturationSupported(); - -protected: - QExplicitlySharedDataPointer<GLTexturePrivate> d_ptr; - GLTexture(GLTexturePrivate& dd); - -private: - Q_DECLARE_PRIVATE(GLTexture) -}; - -} // namespace - -/** @} */ - -#endif diff --git a/kwin/libkwineffects/kwingltexture_p.h b/kwin/libkwineffects/kwingltexture_p.h deleted file mode 100644 index 0b57d974..00000000 --- a/kwin/libkwineffects/kwingltexture_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee> -Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@kde.org> -Copyright (C) 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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_GLTEXTURE_P_H -#define KWIN_GLTEXTURE_P_H - -#include "kwinconfig.h" // KWIN_HAVE_OPENGL -#include "kwinglobals.h" - -#include <QSize> -#include <QSharedData> -#include <QImage> - -namespace KWin -{ -// forward declarations -class GLVertexBuffer; - -class KWIN_EXPORT GLTexturePrivate - : public QSharedData -{ -public: - GLTexturePrivate(); - virtual ~GLTexturePrivate(); - - virtual void bind(); - virtual void unbind(); - virtual void onDamage(); - - QImage convertToGLFormat(const QImage& img) const; - - void updateMatrix(); - - GLuint m_texture; - GLenum m_target; - GLenum m_filter; - GLenum m_wrapMode; - QSize m_size; - QSizeF m_scale; // to un-normalize GL_TEXTURE_2D - QMatrix4x4 m_matrix[2]; - bool m_yInverted; // texture is y-inverted - bool m_canUseMipmaps; - bool m_markedDirty; - bool m_filterChanged; - bool m_wrapModeChanged; - - int m_unnormalizeActive; // 0 - no, otherwise refcount - int m_normalizeActive; // 0 - no, otherwise refcount - GLVertexBuffer* m_vbo; - QSize m_cachedSize; - - static void initStatic(); - - static bool sNPOTTextureSupported; - static bool sFramebufferObjectSupported; - static bool sSaturationSupported; - static GLenum sTextureFormat; - static uint s_fbo; - static uint s_textureObjectCounter; -private: - Q_DISABLE_COPY(GLTexturePrivate) -}; - -} // namespace - -#endif diff --git a/kwin/libkwineffects/kwinglutils.cpp b/kwin/libkwineffects/kwinglutils.cpp deleted file mode 100644 index d8b07975..00000000 --- a/kwin/libkwineffects/kwinglutils.cpp +++ /dev/null @@ -1,2023 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee> -Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#include "kwinglutils.h" - -// need to call GLTexturePrivate::initStatic() -#include "kwingltexture_p.h" - -#include "kwinglcolorcorrection.h" -#include "kwinglobals.h" -#include "kwineffects.h" -#include "kwinglplatform.h" - -#include "kdebug.h" -#include <kstandarddirs.h> -#include <KConfig> -#include <KConfigGroup> - -#include <QPixmap> -#include <QImage> -#include <QHash> -#include <QFile> -#include <QVector2D> -#include <QVector3D> -#include <QVector4D> -#include <QMatrix4x4> -#include <QVarLengthArray> - -#include <math.h> - -#define DEBUG_GLRENDERTARGET 0 - -#define MAKE_GL_VERSION(major, minor, release) ( ((major) << 16) | ((minor) << 8) | (release) ) - -namespace KWin -{ -// Variables -// GL version, use MAKE_GL_VERSION() macro for comparing with a specific version -static int glVersion; -// GLX version, use MAKE_GL_VERSION() macro for comparing with a specific version -static int glXVersion; -// EGL version, use MAKE_GL_VERSION() macro for comparing with a specific version -static int eglVersion; -// List of all supported GL, EGL and GLX extensions -static QStringList glExtensions; -static QStringList glxExtensions; -static QStringList eglExtension; - -int glTextureUnitsCount; - - -// Functions -void initGLX() -{ -#ifndef KWIN_HAVE_OPENGLES - // Get GLX version - int major, minor; - glXQueryVersion(display(), &major, &minor); - glXVersion = MAKE_GL_VERSION(major, minor, 0); - // Get list of supported GLX extensions - glxExtensions = QString((const char*)glXQueryExtensionsString( - display(), DefaultScreen(display()))).split(' '); - - glxResolveFunctions(); -#endif -} - -void initEGL() -{ -#ifdef KWIN_HAVE_EGL - EGLDisplay dpy = eglGetCurrentDisplay(); - int major, minor; - eglInitialize(dpy, &major, &minor); - eglVersion = MAKE_GL_VERSION(major, minor, 0); - eglExtension = QString((const char*)eglQueryString(dpy, EGL_EXTENSIONS)).split(' '); - - eglResolveFunctions(); -#endif -} - -void initGL(OpenGLPlatformInterface platformInterface) -{ - // Get OpenGL version - QString glversionstring = QString((const char*)glGetString(GL_VERSION)); - QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(' ')).split('.'); - while (glversioninfo.count() < 3) - glversioninfo << "0"; - -#ifndef KWIN_HAVE_OPENGLES - glVersion = MAKE_GL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(), glversioninfo[2].toInt()); - - // Get list of supported OpenGL extensions - if (hasGLVersion(3, 0)) { - PFNGLGETSTRINGIPROC glGetStringi; - -#ifdef KWIN_HAVE_EGL - if (platformInterface == EglPlatformInterface) - glGetStringi = (PFNGLGETSTRINGIPROC) eglGetProcAddress("glGetStringi"); - else -#endif - glGetStringi = (PFNGLGETSTRINGIPROC) glXGetProcAddress((const GLubyte *) "glGetStringi"); - - int count; - glGetIntegerv(GL_NUM_EXTENSIONS, &count); - - for (int i = 0; i < count; i++) { - const char *name = (const char *) glGetStringi(GL_EXTENSIONS, i); - glExtensions << QString(name); - } - } else -#endif - glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)).split(' '); - - // handle OpenGL extensions functions - glResolveFunctions(platformInterface); - - GLTexturePrivate::initStatic(); - GLRenderTarget::initStatic(); - GLVertexBuffer::initStatic(); -} - -void cleanupGL() -{ - ShaderManager::cleanup(); - GLVertexBuffer::cleanup(); -} - -bool hasGLVersion(int major, int minor, int release) -{ - return glVersion >= MAKE_GL_VERSION(major, minor, release); -} - -bool hasGLXVersion(int major, int minor, int release) -{ - return glXVersion >= MAKE_GL_VERSION(major, minor, release); -} - -bool hasEGLVersion(int major, int minor, int release) -{ - return eglVersion >= MAKE_GL_VERSION(major, minor, release); -} - -bool hasGLExtension(const QString& extension) -{ - return glExtensions.contains(extension) || glxExtensions.contains(extension) || eglExtension.contains(extension); -} - -static QString formatGLError(GLenum err) -{ - switch(err) { - case GL_NO_ERROR: return "GL_NO_ERROR"; - case GL_INVALID_ENUM: return "GL_INVALID_ENUM"; - case GL_INVALID_VALUE: return "GL_INVALID_VALUE"; - case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; -#ifndef KWIN_HAVE_OPENGLES - case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW"; - case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; -#endif - case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; - default: return QString("0x") + QString::number(err, 16); - } -} - -bool checkGLError(const char* txt) -{ - GLenum err = glGetError(); - bool hasError = false; - while (err != GL_NO_ERROR) { - kWarning(1212) << "GL error (" << txt << "): " << formatGLError(err); - hasError = true; - err = glGetError(); - } - return hasError; -} - -int nearestPowerOfTwo(int x) -{ - // This method had been copied from Qt's nearest_gl_texture_size() - int n = 0, last = 0; - for (int s = 0; s < 32; ++s) { - if (((x >> s) & 1) == 1) { - ++n; - last = s; - } - } - if (n > 1) - return 1 << (last + 1); - return 1 << last; -} - -void pushMatrix() -{ -#ifdef KWIN_HAVE_OPENGL_1 - if (ShaderManager::instance()->isValid()) { - return; - } - glPushMatrix(); -#endif -} - -void pushMatrix(const QMatrix4x4 &matrix) -{ -#ifndef KWIN_HAVE_OPENGL_1 - Q_UNUSED(matrix) -#else - if (ShaderManager::instance()->isValid()) { - return; - } - glPushMatrix(); - multiplyMatrix(matrix); -#endif -} - -void multiplyMatrix(const QMatrix4x4 &matrix) -{ -#ifndef KWIN_HAVE_OPENGL_1 - Q_UNUSED(matrix) -#else - if (ShaderManager::instance()->isValid()) { - return; - } - GLfloat m[16]; - const qreal *data = matrix.constData(); - for (int i = 0; i < 4; ++i) { - for (int j = 0; j < 4; ++j) { - m[i*4+j] = data[i*4+j]; - } - } - glMultMatrixf(m); -#endif -} - -void loadMatrix(const QMatrix4x4 &matrix) -{ -#ifndef KWIN_HAVE_OPENGL_1 - Q_UNUSED(matrix) -#else - if (ShaderManager::instance()->isValid()) { - return; - } - GLfloat m[16]; - const qreal *data = matrix.constData(); - for (int i = 0; i < 4; ++i) { - for (int j = 0; j < 4; ++j) { - m[i*4+j] = data[i*4+j]; - } - } - glLoadMatrixf(m); -#endif -} - -void popMatrix() -{ -#ifdef KWIN_HAVE_OPENGL_1 - if (ShaderManager::instance()->isValid()) { - return; - } - glPopMatrix(); -#endif -} - - -//**************************************** -// GLShader -//**************************************** - -bool GLShader::sColorCorrect = false; - -GLShader::GLShader(unsigned int flags) - : mValid(false) - , mLocationsResolved(false) - , mExplicitLinking(flags & ExplicitLinking) -{ - mProgram = glCreateProgram(); -} - -GLShader::GLShader(const QString& vertexfile, const QString& fragmentfile, unsigned int flags) - : mValid(false) - , mLocationsResolved(false) - , mExplicitLinking(flags & ExplicitLinking) -{ - mProgram = glCreateProgram(); - loadFromFiles(vertexfile, fragmentfile); -} - -GLShader::~GLShader() -{ - if (mProgram) { - glDeleteProgram(mProgram); - } -} - -bool GLShader::loadFromFiles(const QString &vertexFile, const QString &fragmentFile) -{ - QFile vf(vertexFile); - if (!vf.open(QIODevice::ReadOnly)) { - kError(1212) << "Couldn't open" << vertexFile << "for reading!" << endl; - return false; - } - const QByteArray vertexSource = vf.readAll(); - - QFile ff(fragmentFile); - if (!ff.open(QIODevice::ReadOnly)) { - kError(1212) << "Couldn't open" << fragmentFile << "for reading!" << endl; - return false; - } - const QByteArray fragmentSource = ff.readAll(); - - return load(vertexSource, fragmentSource); -} - -bool GLShader::link() -{ - // Be optimistic - mValid = true; - - glLinkProgram(mProgram); - - // Get the program info log - int maxLength, length; - glGetProgramiv(mProgram, GL_INFO_LOG_LENGTH, &maxLength); - - QByteArray log(maxLength, 0); - glGetProgramInfoLog(mProgram, maxLength, &length, log.data()); - - // Make sure the program linked successfully - int status; - glGetProgramiv(mProgram, GL_LINK_STATUS, &status); - - if (status == 0) { - kError(1212) << "Failed to link shader:" << endl << log << endl; - mValid = false; - } else if (length > 0) { - kDebug(1212) << "Shader link log:" << log; - } - - return mValid; -} - -const QByteArray GLShader::prepareSource(GLenum shaderType, const QByteArray &source) const -{ - // Prepare the source code - QByteArray ba; -#ifdef KWIN_HAVE_OPENGLES - if (GLPlatform::instance()->glslVersion() < kVersionNumber(3, 0)) { - ba.append("precision highp float;\n"); - } -#endif - if (ShaderManager::instance()->isShaderDebug()) { - ba.append("#define KWIN_SHADER_DEBUG 1\n"); - } - ba.append(source); -#ifdef KWIN_HAVE_OPENGLES - if (GLPlatform::instance()->glslVersion() >= kVersionNumber(3, 0)) { - ba.replace("#version 140", "#version 300 es\n\nprecision highp float;\n"); - } -#endif - - // Inject color correction code for fragment shaders, if possible - if (shaderType == GL_FRAGMENT_SHADER && sColorCorrect) - ba = ColorCorrection::prepareFragmentShader(ba); - - return ba; -} - -bool GLShader::compile(GLuint program, GLenum shaderType, const QByteArray &source) const -{ - GLuint shader = glCreateShader(shaderType); - - QByteArray preparedSource = prepareSource(shaderType, source); - const char* src = preparedSource.constData(); - glShaderSource(shader, 1, &src, NULL); - - // Compile the shader - glCompileShader(shader); - - // Get the shader info log - int maxLength, length; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength); - - QByteArray log(maxLength, 0); - glGetShaderInfoLog(shader, maxLength, &length, log.data()); - - // Check the status - int status; - glGetShaderiv(shader, GL_COMPILE_STATUS, &status); - - if (status == 0) { - const char *typeName = (shaderType == GL_VERTEX_SHADER ? "vertex" : "fragment"); - kError(1212) << "Failed to compile" << typeName << "shader:" << endl << log << endl; - } else if (length > 0) - kDebug(1212) << "Shader compile log:" << log; - - if (status != 0) - glAttachShader(program, shader); - - glDeleteShader(shader); - return status != 0; -} - -bool GLShader::load(const QByteArray &vertexSource, const QByteArray &fragmentSource) -{ -#ifndef KWIN_HAVE_OPENGLES - // Make sure shaders are actually supported - if (!GLPlatform::instance()->supports(GLSL) || GLPlatform::instance()->supports(LimitedNPOT)) { - kError(1212) << "Shaders are not supported"; - return false; - } -#endif - - mValid = false; - - // Compile the vertex shader - if (!vertexSource.isEmpty()) { - bool success = compile(mProgram, GL_VERTEX_SHADER, vertexSource); - - if (!success) - return false; - } - - // Compile the fragment shader - if (!fragmentSource.isEmpty()) { - bool success = compile(mProgram, GL_FRAGMENT_SHADER, fragmentSource); - - if (!success) - return false; - } - - if (mExplicitLinking) - return true; - - // link() sets mValid - return link(); -} - -void GLShader::bindAttributeLocation(const char *name, int index) -{ - glBindAttribLocation(mProgram, index, name); -} - -void GLShader::bindFragDataLocation(const char *name, int index) -{ -#ifndef KWIN_HAVE_OPENGLES - if (glBindFragDataLocation) - glBindFragDataLocation(mProgram, index, name); -#else - Q_UNUSED(name) - Q_UNUSED(index) -#endif -} - -void GLShader::bind() -{ - glUseProgram(mProgram); -} - -void GLShader::unbind() -{ - glUseProgram(0); -} - -void GLShader::resolveLocations() -{ - if (mLocationsResolved) - return; - - mMatrixLocation[TextureMatrix] = uniformLocation("textureMatrix"); - mMatrixLocation[ProjectionMatrix] = uniformLocation("projection"); - mMatrixLocation[ModelViewMatrix] = uniformLocation("modelview"); - mMatrixLocation[WindowTransformation] = uniformLocation("windowTransformation"); - mMatrixLocation[ScreenTransformation] = uniformLocation("screenTransformation"); - - mVec2Location[Offset] = uniformLocation("offset"); - - mVec4Location[ModulationConstant] = uniformLocation("modulation"); - - mFloatLocation[Saturation] = uniformLocation("saturation"); - - mIntLocation[ColorCorrectionLookupTextureUnit] = uniformLocation("u_ccLookupTexture"); - - mColorLocation[Color] = uniformLocation("geometryColor"); - - mLocationsResolved = true; -} - -int GLShader::uniformLocation(const char *name) -{ - const int location = glGetUniformLocation(mProgram, name); - return location; -} - -bool GLShader::setUniform(GLShader::MatrixUniform uniform, const QMatrix4x4 &matrix) -{ - resolveLocations(); - return setUniform(mMatrixLocation[uniform], matrix); -} - -bool GLShader::setUniform(GLShader::Vec2Uniform uniform, const QVector2D &value) -{ - resolveLocations(); - return setUniform(mVec2Location[uniform], value); -} - -bool GLShader::setUniform(GLShader::Vec4Uniform uniform, const QVector4D &value) -{ - resolveLocations(); - return setUniform(mVec4Location[uniform], value); -} - -bool GLShader::setUniform(GLShader::FloatUniform uniform, float value) -{ - resolveLocations(); - return setUniform(mFloatLocation[uniform], value); -} - -bool GLShader::setUniform(GLShader::IntUniform uniform, int value) -{ - resolveLocations(); - return setUniform(mIntLocation[uniform], value); -} - -bool GLShader::setUniform(GLShader::ColorUniform uniform, const QVector4D &value) -{ - resolveLocations(); - return setUniform(mColorLocation[uniform], value); -} - -bool GLShader::setUniform(GLShader::ColorUniform uniform, const QColor &value) -{ - resolveLocations(); - return setUniform(mColorLocation[uniform], value); -} - -bool GLShader::setUniform(const char *name, float value) -{ - const int location = uniformLocation(name); - return setUniform(location, value); -} - -bool GLShader::setUniform(const char *name, int value) -{ - const int location = uniformLocation(name); - return setUniform(location, value); -} - -bool GLShader::setUniform(const char *name, const QVector2D& value) -{ - const int location = uniformLocation(name); - return setUniform(location, value); -} - -bool GLShader::setUniform(const char *name, const QVector3D& value) -{ - const int location = uniformLocation(name); - return setUniform(location, value); -} - -bool GLShader::setUniform(const char *name, const QVector4D& value) -{ - const int location = uniformLocation(name); - return setUniform(location, value); -} - -bool GLShader::setUniform(const char *name, const QMatrix4x4& value) -{ - const int location = uniformLocation(name); - return setUniform(location, value); -} - -bool GLShader::setUniform(const char *name, const QColor& color) -{ - const int location = uniformLocation(name); - return setUniform(location, color); -} - -bool GLShader::setUniform(int location, float value) -{ - if (location >= 0) { - glUniform1f(location, value); - } - return (location >= 0); -} - -bool GLShader::setUniform(int location, int value) -{ - if (location >= 0) { - glUniform1i(location, value); - } - return (location >= 0); -} - -bool GLShader::setUniform(int location, const QVector2D &value) -{ - if (location >= 0) { - glUniform2fv(location, 1, (const GLfloat*)&value); - } - return (location >= 0); -} - -bool GLShader::setUniform(int location, const QVector3D &value) -{ - if (location >= 0) { - glUniform3fv(location, 1, (const GLfloat*)&value); - } - return (location >= 0); -} - -bool GLShader::setUniform(int location, const QVector4D &value) -{ - if (location >= 0) { - glUniform4fv(location, 1, (const GLfloat*)&value); - } - return (location >= 0); -} - -bool GLShader::setUniform(int location, const QMatrix4x4 &value) -{ - if (location >= 0) { - GLfloat m[16]; - const qreal *data = value.constData(); - // i is column, j is row for m - for (int i = 0; i < 16; ++i) { - m[i] = data[i]; - } - glUniformMatrix4fv(location, 1, GL_FALSE, m); - } - return (location >= 0); -} - -bool GLShader::setUniform(int location, const QColor &color) -{ - if (location >= 0) { - glUniform4f(location, color.redF(), color.greenF(), color.blueF(), color.alphaF()); - } - return (location >= 0); -} - -int GLShader::attributeLocation(const char* name) -{ - int location = glGetAttribLocation(mProgram, name); - return location; -} - -bool GLShader::setAttribute(const char* name, float value) -{ - int location = attributeLocation(name); - if (location >= 0) { - glVertexAttrib1f(location, value); - } - return (location >= 0); -} - -QMatrix4x4 GLShader::getUniformMatrix4x4(const char* name) -{ - int location = uniformLocation(name); - if (location >= 0) { - GLfloat m[16]; - glGetnUniformfv(mProgram, location, sizeof(m), m); - QMatrix4x4 matrix(m[0], m[4], m[8], m[12], - m[1], m[5], m[9], m[13], - m[2], m[6], m[10], m[14], - m[3], m[7], m[11], m[15]); - matrix.optimize(); - return matrix; - } else { - return QMatrix4x4(); - } -} - -//**************************************** -// ShaderManager -//**************************************** -ShaderManager *ShaderManager::s_shaderManager = NULL; - -ShaderManager *ShaderManager::instance() -{ - if (!s_shaderManager) { - s_shaderManager = new ShaderManager(); - s_shaderManager->initShaders(); - s_shaderManager->m_inited = true; - } - return s_shaderManager; -} - -void ShaderManager::disable() -{ - // for safety do a Cleanup first - ShaderManager::cleanup(); - - // create a new ShaderManager and set it to inited without calling init - // that will ensure that the ShaderManager is not valid - s_shaderManager = new ShaderManager(); - s_shaderManager->m_inited = true; -} - -void ShaderManager::cleanup() -{ - delete s_shaderManager; - s_shaderManager = NULL; -} - -ShaderManager::ShaderManager() - : m_inited(false) - , m_valid(false) -{ - for (int i = 0; i < 3; i++) - m_shader[i] = 0; - - m_debug = qstrcmp(qgetenv("KWIN_GL_DEBUG"), "1") == 0; -} - -ShaderManager::~ShaderManager() -{ - while (!m_boundShaders.isEmpty()) { - popShader(); - } - - for (int i = 0; i < 3; i++) - delete m_shader[i]; -} - -GLShader *ShaderManager::getBoundShader() const -{ - if (m_boundShaders.isEmpty()) { - return NULL; - } else { - return m_boundShaders.top(); - } -} - -bool ShaderManager::isShaderBound() const -{ - return !m_boundShaders.isEmpty(); -} - -bool ShaderManager::isValid() const -{ - return m_valid; -} - -bool ShaderManager::isShaderDebug() const -{ - return m_debug; -} - -GLShader *ShaderManager::pushShader(ShaderType type, bool reset) -{ - if (m_inited && !m_valid) { - return NULL; - } - - pushShader(m_shader[type]); - if (reset) { - resetShader(type); - } - - return m_shader[type]; -} - -void ShaderManager::resetAllShaders() -{ - if (!m_inited || !m_valid) { - return; - } - - for (int i = 0; i < 3; i++) { - pushShader(ShaderType(i), true); - popShader(); - } -} - -void ShaderManager::resetShader(GLShader *shader, ShaderType type) -{ - if (!(shader && shader->isValid())) - return; - - pushShader(shader); - resetShader(type); - popShader(); -} - - -void ShaderManager::pushShader(GLShader *shader) -{ - // only bind shader if it is not already bound - if (shader != getBoundShader()) { - shader->bind(); - } - m_boundShaders.push(shader); -} - -void ShaderManager::popShader() -{ - if (m_boundShaders.isEmpty()) { - return; - } - GLShader *shader = m_boundShaders.pop(); - if (m_boundShaders.isEmpty()) { - // no more shader bound - unbind - shader->unbind(); - } else if (shader != m_boundShaders.top()) { - // only rebind if a different shader is on top of stack - m_boundShaders.top()->bind(); - } -} - -void ShaderManager::bindFragDataLocations(GLShader *shader) -{ - shader->bindFragDataLocation("fragColor", 0); -} - -void ShaderManager::bindAttributeLocations(GLShader *shader) const -{ - shader->bindAttributeLocation("vertex", VA_Position); - shader->bindAttributeLocation("texCoord", VA_TexCoord); -} - -GLShader *ShaderManager::loadFragmentShader(ShaderType vertex, const QString &fragmentFile) -{ - const char *vertexFile[] = { - "scene-vertex.glsl", - "scene-generic-vertex.glsl", - "scene-color-vertex.glsl" - }; - - QByteArray shaderpath = m_shaderDir + vertexFile[vertex]; - GLShader *shader = new GLShader(shaderpath.data(), fragmentFile, GLShader::ExplicitLinking); - bindAttributeLocations(shader); - bindFragDataLocations(shader); - shader->link(); - - if (shader->isValid()) { - pushShader(shader); - resetShader(vertex); - popShader(); - } - - return shader; -} - -GLShader *ShaderManager::loadVertexShader(ShaderType fragment, const QString &vertexFile) -{ - // The Simple and Generic shaders use same fragment shader - const char *fragmentFile[] = { - "scene-fragment.glsl", - "scene-fragment.glsl", - "scene-color-fragment.glsl" - }; - - QByteArray fragmentpath = m_shaderDir + fragmentFile[fragment]; - GLShader *shader = new GLShader(vertexFile, fragmentpath.data(), GLShader::ExplicitLinking); - bindAttributeLocations(shader); - bindFragDataLocations(shader); - shader->link(); - - if (shader->isValid()) { - pushShader(shader); - resetShader(fragment); - popShader(); - } - - return shader; -} - -GLShader *ShaderManager::loadShaderFromCode(const QByteArray &vertexSource, const QByteArray &fragmentSource) -{ - GLShader *shader = new GLShader(GLShader::ExplicitLinking); - shader->load(vertexSource, fragmentSource); - bindAttributeLocations(shader); - bindFragDataLocations(shader); - shader->link(); - return shader; -} - -void ShaderManager::initShaders() -{ - const char *vertexFile[] = { - "scene-vertex.glsl", - "scene-generic-vertex.glsl", - "scene-color-vertex.glsl", - }; - - const char *fragmentFile[] = { - "scene-fragment.glsl", - "scene-fragment.glsl", - "scene-color-fragment.glsl", - }; - -#ifdef KWIN_HAVE_OPENGLES - const qint64 coreVersionNumber = kVersionNumber(3, 0); -#else - const qint64 coreVersionNumber = kVersionNumber(1, 40); -#endif - if (GLPlatform::instance()->glslVersion() >= coreVersionNumber) - m_shaderDir = ":/resources/shaders/1.40/"; - else - m_shaderDir = ":/resources/shaders/1.10/"; - - // Be optimistic - m_valid = true; - - for (int i = 0; i < 3; i++) { - QByteArray shaderpath = m_shaderDir + vertexFile[i]; - QByteArray fragmentpath = m_shaderDir + fragmentFile[i]; - m_shader[i] = new GLShader(shaderpath, fragmentpath, GLShader::ExplicitLinking); - bindAttributeLocations(m_shader[i]); - bindFragDataLocations(m_shader[i]); - m_shader[i]->link(); - - if (!m_shader[i]->isValid()) { - m_valid = false; - break; - } - - pushShader(m_shader[i]); - resetShader(ShaderType(i)); - popShader(); - } - - if (!m_valid) { - for (int i = 0; i < 3; i++) { - delete m_shader[i]; - m_shader[i] = 0; - } - } -} - -void ShaderManager::resetShader(ShaderType type) -{ - // resetShader is either called from init or from push, we know that a built-in shader is bound - const QMatrix4x4 identity; - - QMatrix4x4 projection; - QMatrix4x4 modelView; - - GLShader *shader = getBoundShader(); - - switch(type) { - case SimpleShader: - projection.ortho(0, displayWidth(), displayHeight(), 0, 0, 65535); - break; - - case GenericShader: { - // Set up the projection matrix - float fovy = 60.0f; - float aspect = 1.0f; - float zNear = 0.1f; - float zFar = 100.0f; - float ymax = zNear * tan(fovy * M_PI / 360.0f); - float ymin = -ymax; - float xmin = ymin * aspect; - float xmax = ymax * aspect; - projection.frustum(xmin, xmax, ymin, ymax, zNear, zFar); - - // Set up the model-view matrix - float scaleFactor = 1.1 * tan(fovy * M_PI / 360.0f) / ymax; - modelView.translate(xmin * scaleFactor, ymax * scaleFactor, -1.1); - modelView.scale((xmax - xmin)*scaleFactor / displayWidth(), -(ymax - ymin)*scaleFactor / displayHeight(), 0.001); - break; - } - - case ColorShader: - projection.ortho(0, displayWidth(), displayHeight(), 0, 0, 65535); - shader->setUniform("geometryColor", QVector4D(0, 0, 0, 1)); - break; - } - - shader->setUniform("sampler", 0); - - shader->setUniform(GLShader::ProjectionMatrix, projection); - shader->setUniform(GLShader::ModelViewMatrix, modelView); - shader->setUniform(GLShader::ScreenTransformation, identity); - shader->setUniform(GLShader::WindowTransformation, identity); - - shader->setUniform(GLShader::Offset, QVector2D(0, 0)); - shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); - - shader->setUniform(GLShader::Saturation, 1.0f); -} - -/*** GLRenderTarget ***/ -bool GLRenderTarget::sSupported = false; -bool GLRenderTarget::s_blitSupported = false; -QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>(); - -void GLRenderTarget::initStatic() -{ -#ifdef KWIN_HAVE_OPENGLES - sSupported = true; - s_blitSupported = false; -#else - sSupported = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object") || hasGLExtension("GL_EXT_framebuffer_object"); - s_blitSupported = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object") || hasGLExtension("GL_EXT_framebuffer_blit"); -#endif -} - -bool GLRenderTarget::isRenderTargetBound() -{ - return !s_renderTargets.isEmpty(); -} - -bool GLRenderTarget::blitSupported() -{ - return s_blitSupported; -} - -void GLRenderTarget::pushRenderTarget(GLRenderTarget* target) -{ - target->enable(); - s_renderTargets.push(target); -} - -GLRenderTarget* GLRenderTarget::popRenderTarget() -{ - GLRenderTarget* ret = s_renderTargets.pop(); - ret->disable(); - - if (!s_renderTargets.isEmpty()) { - s_renderTargets.top()->enable(); - } else { - glViewport (0, 0, displayWidth(), displayHeight()); - } - - return ret; -} - -GLRenderTarget::GLRenderTarget(const GLTexture& color) -{ - // Reset variables - mValid = false; - - mTexture = color; - - // Make sure FBO is supported - if (sSupported && !mTexture.isNull()) { - initFBO(); - } else - kError(1212) << "Render targets aren't supported!" << endl; -} - -GLRenderTarget::~GLRenderTarget() -{ - if (mValid) { - glDeleteFramebuffers(1, &mFramebuffer); - } -} - -bool GLRenderTarget::enable() -{ - if (!valid()) { - kError(1212) << "Can't enable invalid render target!" << endl; - return false; - } - - glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); - glViewport(0, 0, mTexture.width(), mTexture.height()); - mTexture.setDirty(); - - return true; -} - -bool GLRenderTarget::disable() -{ - if (!valid()) { - kError(1212) << "Can't disable invalid render target!" << endl; - return false; - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - mTexture.setDirty(); - - return true; -} - -static QString formatFramebufferStatus(GLenum status) -{ - switch(status) { - case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: - // An attachment is the wrong type / is invalid / has 0 width or height - return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"; - case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: - // There are no images attached to the framebuffer - return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"; - case GL_FRAMEBUFFER_UNSUPPORTED: - // A format or the combination of formats of the attachments is unsupported - return "GL_FRAMEBUFFER_UNSUPPORTED"; -#ifndef KWIN_HAVE_OPENGLES - case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: - // Not all attached images have the same width and height - return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT"; - case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: - // The color attachments don't have the same format - return "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT"; - case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT: - // The attachments don't have the same number of samples - return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"; - case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: - // The draw buffer is missing - return "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"; - case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: - // The read buffer is missing - return "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"; -#endif - default: - return "Unknown (0x" + QString::number(status, 16) + ')'; - } -} - -void GLRenderTarget::initFBO() -{ -#if DEBUG_GLRENDERTARGET - GLenum err = glGetError(); - if (err != GL_NO_ERROR) - kError(1212) << "Error status when entering GLRenderTarget::initFBO: " << formatGLError(err); -#endif - - glGenFramebuffers(1, &mFramebuffer); - -#if DEBUG_GLRENDERTARGET - if ((err = glGetError()) != GL_NO_ERROR) { - kError(1212) << "glGenFramebuffers failed: " << formatGLError(err); - return; - } -#endif - - glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); - -#if DEBUG_GLRENDERTARGET - if ((err = glGetError()) != GL_NO_ERROR) { - kError(1212) << "glBindFramebuffer failed: " << formatGLError(err); - glDeleteFramebuffers(1, &mFramebuffer); - return; - } -#endif - - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - mTexture.target(), mTexture.texture(), 0); - -#if DEBUG_GLRENDERTARGET - if ((err = glGetError()) != GL_NO_ERROR) { - kError(1212) << "glFramebufferTexture2D failed: " << formatGLError(err); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glDeleteFramebuffers(1, &mFramebuffer); - return; - } -#endif - - const GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - if (status != GL_FRAMEBUFFER_COMPLETE) { - // We have an incomplete framebuffer, consider it invalid - if (status == 0) - kError(1212) << "glCheckFramebufferStatus failed: " << formatGLError(glGetError()); - else - kError(1212) << "Invalid framebuffer status: " << formatFramebufferStatus(status); - glDeleteFramebuffers(1, &mFramebuffer); - return; - } - - mValid = true; -} - -void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &destination, GLenum filter) -{ - if (!GLRenderTarget::blitSupported()) { - return; - } -#ifdef KWIN_HAVE_OPENGLES - Q_UNUSED(source) - Q_UNUSED(destination) - Q_UNUSED(filter) -#else - GLRenderTarget::pushRenderTarget(this); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - const QRect s = source.isNull() ? QRect(0, 0, displayWidth(), displayHeight()) : source; - const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination; - - glBlitFramebuffer(s.x(), displayHeight() - s.y() - s.height(), s.x() + s.width(), displayHeight() - s.y(), - d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(), - GL_COLOR_BUFFER_BIT, filter); - GLRenderTarget::popRenderTarget(); -#endif -} - -void GLRenderTarget::attachTexture(const GLTexture& target) -{ - if (!mValid || mTexture.texture() == target.texture()) { - return; - } - - pushRenderTarget(this); - - mTexture = target; - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - mTexture.target(), mTexture.texture(), 0); - - popRenderTarget(); -} - - -// ------------------------------------------------------------------ - - -#ifndef KWIN_HAVE_OPENGLES - -static const uint16_t indices[] = { - 1, 0, 3, 3, 2, 1, 5, 4, 7, 7, 6, 5, 9, 8, 11, 11, 10, 9, - 13, 12, 15, 15, 14, 13, 17, 16, 19, 19, 18, 17, 21, 20, 23, 23, 22, 21, - 25, 24, 27, 27, 26, 25, 29, 28, 31, 31, 30, 29, 33, 32, 35, 35, 34, 33, - 37, 36, 39, 39, 38, 37, 41, 40, 43, 43, 42, 41, 45, 44, 47, 47, 46, 45, - 49, 48, 51, 51, 50, 49, 53, 52, 55, 55, 54, 53, 57, 56, 59, 59, 58, 57, - 61, 60, 63, 63, 62, 61, 65, 64, 67, 67, 66, 65, 69, 68, 71, 71, 70, 69, - 73, 72, 75, 75, 74, 73, 77, 76, 79, 79, 78, 77, 81, 80, 83, 83, 82, 81, - 85, 84, 87, 87, 86, 85, 89, 88, 91, 91, 90, 89, 93, 92, 95, 95, 94, 93, - 97, 96, 99, 99, 98, 97, 101, 100, 103, 103, 102, 101, 105, 104, 107, 107, 106, 105, - 109, 108, 111, 111, 110, 109, 113, 112, 115, 115, 114, 113, 117, 116, 119, 119, 118, 117, - 121, 120, 123, 123, 122, 121, 125, 124, 127, 127, 126, 125, 129, 128, 131, 131, 130, 129, - 133, 132, 135, 135, 134, 133, 137, 136, 139, 139, 138, 137, 141, 140, 143, 143, 142, 141, - 145, 144, 147, 147, 146, 145, 149, 148, 151, 151, 150, 149, 153, 152, 155, 155, 154, 153, - 157, 156, 159, 159, 158, 157, 161, 160, 163, 163, 162, 161, 165, 164, 167, 167, 166, 165, - 169, 168, 171, 171, 170, 169, 173, 172, 175, 175, 174, 173, 177, 176, 179, 179, 178, 177, - 181, 180, 183, 183, 182, 181, 185, 184, 187, 187, 186, 185, 189, 188, 191, 191, 190, 189, - 193, 192, 195, 195, 194, 193, 197, 196, 199, 199, 198, 197, 201, 200, 203, 203, 202, 201, - 205, 204, 207, 207, 206, 205, 209, 208, 211, 211, 210, 209, 213, 212, 215, 215, 214, 213, - 217, 216, 219, 219, 218, 217, 221, 220, 223, 223, 222, 221, 225, 224, 227, 227, 226, 225, - 229, 228, 231, 231, 230, 229, 233, 232, 235, 235, 234, 233, 237, 236, 239, 239, 238, 237, - 241, 240, 243, 243, 242, 241, 245, 244, 247, 247, 246, 245, 249, 248, 251, 251, 250, 249, - 253, 252, 255, 255, 254, 253, 257, 256, 259, 259, 258, 257, 261, 260, 263, 263, 262, 261, - 265, 264, 267, 267, 266, 265, 269, 268, 271, 271, 270, 269, 273, 272, 275, 275, 274, 273, - 277, 276, 279, 279, 278, 277, 281, 280, 283, 283, 282, 281, 285, 284, 287, 287, 286, 285, - 289, 288, 291, 291, 290, 289, 293, 292, 295, 295, 294, 293, 297, 296, 299, 299, 298, 297, - 301, 300, 303, 303, 302, 301, 305, 304, 307, 307, 306, 305, 309, 308, 311, 311, 310, 309, - 313, 312, 315, 315, 314, 313, 317, 316, 319, 319, 318, 317, 321, 320, 323, 323, 322, 321, - 325, 324, 327, 327, 326, 325, 329, 328, 331, 331, 330, 329, 333, 332, 335, 335, 334, 333, - 337, 336, 339, 339, 338, 337, 341, 340, 343, 343, 342, 341, 345, 344, 347, 347, 346, 345, - 349, 348, 351, 351, 350, 349, 353, 352, 355, 355, 354, 353, 357, 356, 359, 359, 358, 357, - 361, 360, 363, 363, 362, 361, 365, 364, 367, 367, 366, 365, 369, 368, 371, 371, 370, 369, - 373, 372, 375, 375, 374, 373, 377, 376, 379, 379, 378, 377, 381, 380, 383, 383, 382, 381, - 385, 384, 387, 387, 386, 385, 389, 388, 391, 391, 390, 389, 393, 392, 395, 395, 394, 393, - 397, 396, 399, 399, 398, 397, 401, 400, 403, 403, 402, 401, 405, 404, 407, 407, 406, 405, - 409, 408, 411, 411, 410, 409, 413, 412, 415, 415, 414, 413, 417, 416, 419, 419, 418, 417, - 421, 420, 423, 423, 422, 421, 425, 424, 427, 427, 426, 425, 429, 428, 431, 431, 430, 429, - 433, 432, 435, 435, 434, 433, 437, 436, 439, 439, 438, 437, 441, 440, 443, 443, 442, 441, - 445, 444, 447, 447, 446, 445, 449, 448, 451, 451, 450, 449, 453, 452, 455, 455, 454, 453, - 457, 456, 459, 459, 458, 457, 461, 460, 463, 463, 462, 461, 465, 464, 467, 467, 466, 465, - 469, 468, 471, 471, 470, 469, 473, 472, 475, 475, 474, 473, 477, 476, 479, 479, 478, 477, - 481, 480, 483, 483, 482, 481, 485, 484, 487, 487, 486, 485, 489, 488, 491, 491, 490, 489, - 493, 492, 495, 495, 494, 493, 497, 496, 499, 499, 498, 497, 501, 500, 503, 503, 502, 501, - 505, 504, 507, 507, 506, 505, 509, 508, 511, 511, 510, 509, 513, 512, 515, 515, 514, 513, - 517, 516, 519, 519, 518, 517, 521, 520, 523, 523, 522, 521, 525, 524, 527, 527, 526, 525, - 529, 528, 531, 531, 530, 529, 533, 532, 535, 535, 534, 533, 537, 536, 539, 539, 538, 537, - 541, 540, 543, 543, 542, 541, 545, 544, 547, 547, 546, 545, 549, 548, 551, 551, 550, 549, - 553, 552, 555, 555, 554, 553, 557, 556, 559, 559, 558, 557, 561, 560, 563, 563, 562, 561, - 565, 564, 567, 567, 566, 565, 569, 568, 571, 571, 570, 569, 573, 572, 575, 575, 574, 573, - 577, 576, 579, 579, 578, 577, 581, 580, 583, 583, 582, 581, 585, 584, 587, 587, 586, 585, - 589, 588, 591, 591, 590, 589, 593, 592, 595, 595, 594, 593, 597, 596, 599, 599, 598, 597, - 601, 600, 603, 603, 602, 601, 605, 604, 607, 607, 606, 605, 609, 608, 611, 611, 610, 609, - 613, 612, 615, 615, 614, 613, 617, 616, 619, 619, 618, 617, 621, 620, 623, 623, 622, 621, - 625, 624, 627, 627, 626, 625, 629, 628, 631, 631, 630, 629, 633, 632, 635, 635, 634, 633, - 637, 636, 639, 639, 638, 637, 641, 640, 643, 643, 642, 641, 645, 644, 647, 647, 646, 645, - 649, 648, 651, 651, 650, 649, 653, 652, 655, 655, 654, 653, 657, 656, 659, 659, 658, 657, - 661, 660, 663, 663, 662, 661, 665, 664, 667, 667, 666, 665, 669, 668, 671, 671, 670, 669, - 673, 672, 675, 675, 674, 673, 677, 676, 679, 679, 678, 677, 681, 680, 683, 683, 682, 681, - 685, 684, 687, 687, 686, 685, 689, 688, 691, 691, 690, 689, 693, 692, 695, 695, 694, 693, - 697, 696, 699, 699, 698, 697, 701, 700, 703, 703, 702, 701, 705, 704, 707, 707, 706, 705, - 709, 708, 711, 711, 710, 709, 713, 712, 715, 715, 714, 713, 717, 716, 719, 719, 718, 717, - 721, 720, 723, 723, 722, 721, 725, 724, 727, 727, 726, 725, 729, 728, 731, 731, 730, 729, - 733, 732, 735, 735, 734, 733, 737, 736, 739, 739, 738, 737, 741, 740, 743, 743, 742, 741, - 745, 744, 747, 747, 746, 745, 749, 748, 751, 751, 750, 749, 753, 752, 755, 755, 754, 753, - 757, 756, 759, 759, 758, 757, 761, 760, 763, 763, 762, 761, 765, 764, 767, 767, 766, 765, - 769, 768, 771, 771, 770, 769, 773, 772, 775, 775, 774, 773, 777, 776, 779, 779, 778, 777, - 781, 780, 783, 783, 782, 781, 785, 784, 787, 787, 786, 785, 789, 788, 791, 791, 790, 789, - 793, 792, 795, 795, 794, 793, 797, 796, 799, 799, 798, 797, 801, 800, 803, 803, 802, 801, - 805, 804, 807, 807, 806, 805, 809, 808, 811, 811, 810, 809, 813, 812, 815, 815, 814, 813, - 817, 816, 819, 819, 818, 817, 821, 820, 823, 823, 822, 821, 825, 824, 827, 827, 826, 825, - 829, 828, 831, 831, 830, 829, 833, 832, 835, 835, 834, 833, 837, 836, 839, 839, 838, 837, - 841, 840, 843, 843, 842, 841, 845, 844, 847, 847, 846, 845, 849, 848, 851, 851, 850, 849, - 853, 852, 855, 855, 854, 853, 857, 856, 859, 859, 858, 857, 861, 860, 863, 863, 862, 861, - 865, 864, 867, 867, 866, 865, 869, 868, 871, 871, 870, 869, 873, 872, 875, 875, 874, 873, - 877, 876, 879, 879, 878, 877, 881, 880, 883, 883, 882, 881, 885, 884, 887, 887, 886, 885, - 889, 888, 891, 891, 890, 889, 893, 892, 895, 895, 894, 893, 897, 896, 899, 899, 898, 897, - 901, 900, 903, 903, 902, 901, 905, 904, 907, 907, 906, 905, 909, 908, 911, 911, 910, 909, - 913, 912, 915, 915, 914, 913, 917, 916, 919, 919, 918, 917, 921, 920, 923, 923, 922, 921, - 925, 924, 927, 927, 926, 925, 929, 928, 931, 931, 930, 929, 933, 932, 935, 935, 934, 933, - 937, 936, 939, 939, 938, 937, 941, 940, 943, 943, 942, 941, 945, 944, 947, 947, 946, 945, - 949, 948, 951, 951, 950, 949, 953, 952, 955, 955, 954, 953, 957, 956, 959, 959, 958, 957, - 961, 960, 963, 963, 962, 961, 965, 964, 967, 967, 966, 965, 969, 968, 971, 971, 970, 969, - 973, 972, 975, 975, 974, 973, 977, 976, 979, 979, 978, 977, 981, 980, 983, 983, 982, 981, - 985, 984, 987, 987, 986, 985, 989, 988, 991, 991, 990, 989, 993, 992, 995, 995, 994, 993, - 997, 996, 999, 999, 998, 997, 1001, 1000, 1003, 1003, 1002, 1001, 1005, 1004, 1007, 1007, 1006, 1005, - 1009, 1008, 1011, 1011, 1010, 1009, 1013, 1012, 1015, 1015, 1014, 1013, 1017, 1016, 1019, 1019, 1018, 1017, - 1021, 1020, 1023, 1023, 1022, 1021, 1025, 1024, 1027, 1027, 1026, 1025, 1029, 1028, 1031, 1031, 1030, 1029, - 1033, 1032, 1035, 1035, 1034, 1033, 1037, 1036, 1039, 1039, 1038, 1037, 1041, 1040, 1043, 1043, 1042, 1041, - 1045, 1044, 1047, 1047, 1046, 1045, 1049, 1048, 1051, 1051, 1050, 1049, 1053, 1052, 1055, 1055, 1054, 1053, - 1057, 1056, 1059, 1059, 1058, 1057, 1061, 1060, 1063, 1063, 1062, 1061, 1065, 1064, 1067, 1067, 1066, 1065, - 1069, 1068, 1071, 1071, 1070, 1069, 1073, 1072, 1075, 1075, 1074, 1073, 1077, 1076, 1079, 1079, 1078, 1077, - 1081, 1080, 1083, 1083, 1082, 1081, 1085, 1084, 1087, 1087, 1086, 1085, 1089, 1088, 1091, 1091, 1090, 1089, - 1093, 1092, 1095, 1095, 1094, 1093, 1097, 1096, 1099, 1099, 1098, 1097, 1101, 1100, 1103, 1103, 1102, 1101, - 1105, 1104, 1107, 1107, 1106, 1105, 1109, 1108, 1111, 1111, 1110, 1109, 1113, 1112, 1115, 1115, 1114, 1113, - 1117, 1116, 1119, 1119, 1118, 1117, 1121, 1120, 1123, 1123, 1122, 1121, 1125, 1124, 1127, 1127, 1126, 1125, - 1129, 1128, 1131, 1131, 1130, 1129, 1133, 1132, 1135, 1135, 1134, 1133, 1137, 1136, 1139, 1139, 1138, 1137, - 1141, 1140, 1143, 1143, 1142, 1141, 1145, 1144, 1147, 1147, 1146, 1145, 1149, 1148, 1151, 1151, 1150, 1149, - 1153, 1152, 1155, 1155, 1154, 1153, 1157, 1156, 1159, 1159, 1158, 1157, 1161, 1160, 1163, 1163, 1162, 1161, - 1165, 1164, 1167, 1167, 1166, 1165, 1169, 1168, 1171, 1171, 1170, 1169, 1173, 1172, 1175, 1175, 1174, 1173, - 1177, 1176, 1179, 1179, 1178, 1177, 1181, 1180, 1183, 1183, 1182, 1181, 1185, 1184, 1187, 1187, 1186, 1185, - 1189, 1188, 1191, 1191, 1190, 1189, 1193, 1192, 1195, 1195, 1194, 1193, 1197, 1196, 1199, 1199, 1198, 1197, - 1201, 1200, 1203, 1203, 1202, 1201, 1205, 1204, 1207, 1207, 1206, 1205, 1209, 1208, 1211, 1211, 1210, 1209, - 1213, 1212, 1215, 1215, 1214, 1213, 1217, 1216, 1219, 1219, 1218, 1217, 1221, 1220, 1223, 1223, 1222, 1221, - 1225, 1224, 1227, 1227, 1226, 1225, 1229, 1228, 1231, 1231, 1230, 1229, 1233, 1232, 1235, 1235, 1234, 1233, - 1237, 1236, 1239, 1239, 1238, 1237, 1241, 1240, 1243, 1243, 1242, 1241, 1245, 1244, 1247, 1247, 1246, 1245, - 1249, 1248, 1251, 1251, 1250, 1249, 1253, 1252, 1255, 1255, 1254, 1253, 1257, 1256, 1259, 1259, 1258, 1257, - 1261, 1260, 1263, 1263, 1262, 1261, 1265, 1264, 1267, 1267, 1266, 1265, 1269, 1268, 1271, 1271, 1270, 1269, - 1273, 1272, 1275, 1275, 1274, 1273, 1277, 1276, 1279, 1279, 1278, 1277, 1281, 1280, 1283, 1283, 1282, 1281, - 1285, 1284, 1287, 1287, 1286, 1285, 1289, 1288, 1291, 1291, 1290, 1289, 1293, 1292, 1295, 1295, 1294, 1293, - 1297, 1296, 1299, 1299, 1298, 1297, 1301, 1300, 1303, 1303, 1302, 1301, 1305, 1304, 1307, 1307, 1306, 1305, - 1309, 1308, 1311, 1311, 1310, 1309, 1313, 1312, 1315, 1315, 1314, 1313, 1317, 1316, 1319, 1319, 1318, 1317, - 1321, 1320, 1323, 1323, 1322, 1321, 1325, 1324, 1327, 1327, 1326, 1325, 1329, 1328, 1331, 1331, 1330, 1329, - 1333, 1332, 1335, 1335, 1334, 1333, 1337, 1336, 1339, 1339, 1338, 1337, 1341, 1340, 1343, 1343, 1342, 1341, - 1345, 1344, 1347, 1347, 1346, 1345, 1349, 1348, 1351, 1351, 1350, 1349, 1353, 1352, 1355, 1355, 1354, 1353, - 1357, 1356, 1359, 1359, 1358, 1357, 1361, 1360, 1363, 1363, 1362, 1361, 1365, 1364, 1367, 1367, 1366, 1365, - 1369, 1368, 1371, 1371, 1370, 1369, 1373, 1372, 1375, 1375, 1374, 1373, 1377, 1376, 1379, 1379, 1378, 1377, - 1381, 1380, 1383, 1383, 1382, 1381, 1385, 1384, 1387, 1387, 1386, 1385, 1389, 1388, 1391, 1391, 1390, 1389, - 1393, 1392, 1395, 1395, 1394, 1393, 1397, 1396, 1399, 1399, 1398, 1397, 1401, 1400, 1403, 1403, 1402, 1401, - 1405, 1404, 1407, 1407, 1406, 1405, 1409, 1408, 1411, 1411, 1410, 1409, 1413, 1412, 1415, 1415, 1414, 1413, - 1417, 1416, 1419, 1419, 1418, 1417, 1421, 1420, 1423, 1423, 1422, 1421, 1425, 1424, 1427, 1427, 1426, 1425, - 1429, 1428, 1431, 1431, 1430, 1429, 1433, 1432, 1435, 1435, 1434, 1433, 1437, 1436, 1439, 1439, 1438, 1437, - 1441, 1440, 1443, 1443, 1442, 1441, 1445, 1444, 1447, 1447, 1446, 1445, 1449, 1448, 1451, 1451, 1450, 1449, - 1453, 1452, 1455, 1455, 1454, 1453, 1457, 1456, 1459, 1459, 1458, 1457, 1461, 1460, 1463, 1463, 1462, 1461, - 1465, 1464, 1467, 1467, 1466, 1465, 1469, 1468, 1471, 1471, 1470, 1469, 1473, 1472, 1475, 1475, 1474, 1473, - 1477, 1476, 1479, 1479, 1478, 1477, 1481, 1480, 1483, 1483, 1482, 1481, 1485, 1484, 1487, 1487, 1486, 1485, - 1489, 1488, 1491, 1491, 1490, 1489, 1493, 1492, 1495, 1495, 1494, 1493, 1497, 1496, 1499, 1499, 1498, 1497, - 1501, 1500, 1503, 1503, 1502, 1501, 1505, 1504, 1507, 1507, 1506, 1505, 1509, 1508, 1511, 1511, 1510, 1509, - 1513, 1512, 1515, 1515, 1514, 1513, 1517, 1516, 1519, 1519, 1518, 1517, 1521, 1520, 1523, 1523, 1522, 1521, - 1525, 1524, 1527, 1527, 1526, 1525, 1529, 1528, 1531, 1531, 1530, 1529, 1533, 1532, 1535, 1535, 1534, 1533, - 1537, 1536, 1539, 1539, 1538, 1537, 1541, 1540, 1543, 1543, 1542, 1541, 1545, 1544, 1547, 1547, 1546, 1545, - 1549, 1548, 1551, 1551, 1550, 1549, 1553, 1552, 1555, 1555, 1554, 1553, 1557, 1556, 1559, 1559, 1558, 1557, - 1561, 1560, 1563, 1563, 1562, 1561, 1565, 1564, 1567, 1567, 1566, 1565, 1569, 1568, 1571, 1571, 1570, 1569, - 1573, 1572, 1575, 1575, 1574, 1573, 1577, 1576, 1579, 1579, 1578, 1577, 1581, 1580, 1583, 1583, 1582, 1581, - 1585, 1584, 1587, 1587, 1586, 1585, 1589, 1588, 1591, 1591, 1590, 1589, 1593, 1592, 1595, 1595, 1594, 1593, - 1597, 1596, 1599, 1599, 1598, 1597, 1601, 1600, 1603, 1603, 1602, 1601, 1605, 1604, 1607, 1607, 1606, 1605, - 1609, 1608, 1611, 1611, 1610, 1609, 1613, 1612, 1615, 1615, 1614, 1613, 1617, 1616, 1619, 1619, 1618, 1617, - 1621, 1620, 1623, 1623, 1622, 1621, 1625, 1624, 1627, 1627, 1626, 1625, 1629, 1628, 1631, 1631, 1630, 1629, - 1633, 1632, 1635, 1635, 1634, 1633, 1637, 1636, 1639, 1639, 1638, 1637, 1641, 1640, 1643, 1643, 1642, 1641, - 1645, 1644, 1647, 1647, 1646, 1645, 1649, 1648, 1651, 1651, 1650, 1649, 1653, 1652, 1655, 1655, 1654, 1653, - 1657, 1656, 1659, 1659, 1658, 1657, 1661, 1660, 1663, 1663, 1662, 1661, 1665, 1664, 1667, 1667, 1666, 1665, - 1669, 1668, 1671, 1671, 1670, 1669, 1673, 1672, 1675, 1675, 1674, 1673, 1677, 1676, 1679, 1679, 1678, 1677, - 1681, 1680, 1683, 1683, 1682, 1681, 1685, 1684, 1687, 1687, 1686, 1685, 1689, 1688, 1691, 1691, 1690, 1689, - 1693, 1692, 1695, 1695, 1694, 1693, 1697, 1696, 1699, 1699, 1698, 1697, 1701, 1700, 1703, 1703, 1702, 1701, - 1705, 1704, 1707, 1707, 1706, 1705, 1709, 1708, 1711, 1711, 1710, 1709, 1713, 1712, 1715, 1715, 1714, 1713, - 1717, 1716, 1719, 1719, 1718, 1717, 1721, 1720, 1723, 1723, 1722, 1721, 1725, 1724, 1727, 1727, 1726, 1725, - 1729, 1728, 1731, 1731, 1730, 1729, 1733, 1732, 1735, 1735, 1734, 1733, 1737, 1736, 1739, 1739, 1738, 1737, - 1741, 1740, 1743, 1743, 1742, 1741, 1745, 1744, 1747, 1747, 1746, 1745, 1749, 1748, 1751, 1751, 1750, 1749, - 1753, 1752, 1755, 1755, 1754, 1753, 1757, 1756, 1759, 1759, 1758, 1757, 1761, 1760, 1763, 1763, 1762, 1761, - 1765, 1764, 1767, 1767, 1766, 1765, 1769, 1768, 1771, 1771, 1770, 1769, 1773, 1772, 1775, 1775, 1774, 1773, - 1777, 1776, 1779, 1779, 1778, 1777, 1781, 1780, 1783, 1783, 1782, 1781, 1785, 1784, 1787, 1787, 1786, 1785, - 1789, 1788, 1791, 1791, 1790, 1789, 1793, 1792, 1795, 1795, 1794, 1793, 1797, 1796, 1799, 1799, 1798, 1797, - 1801, 1800, 1803, 1803, 1802, 1801, 1805, 1804, 1807, 1807, 1806, 1805, 1809, 1808, 1811, 1811, 1810, 1809, - 1813, 1812, 1815, 1815, 1814, 1813, 1817, 1816, 1819, 1819, 1818, 1817, 1821, 1820, 1823, 1823, 1822, 1821, - 1825, 1824, 1827, 1827, 1826, 1825, 1829, 1828, 1831, 1831, 1830, 1829, 1833, 1832, 1835, 1835, 1834, 1833, - 1837, 1836, 1839, 1839, 1838, 1837, 1841, 1840, 1843, 1843, 1842, 1841, 1845, 1844, 1847, 1847, 1846, 1845, - 1849, 1848, 1851, 1851, 1850, 1849, 1853, 1852, 1855, 1855, 1854, 1853, 1857, 1856, 1859, 1859, 1858, 1857, - 1861, 1860, 1863, 1863, 1862, 1861, 1865, 1864, 1867, 1867, 1866, 1865, 1869, 1868, 1871, 1871, 1870, 1869, - 1873, 1872, 1875, 1875, 1874, 1873, 1877, 1876, 1879, 1879, 1878, 1877, 1881, 1880, 1883, 1883, 1882, 1881, - 1885, 1884, 1887, 1887, 1886, 1885, 1889, 1888, 1891, 1891, 1890, 1889, 1893, 1892, 1895, 1895, 1894, 1893, - 1897, 1896, 1899, 1899, 1898, 1897, 1901, 1900, 1903, 1903, 1902, 1901, 1905, 1904, 1907, 1907, 1906, 1905, - 1909, 1908, 1911, 1911, 1910, 1909, 1913, 1912, 1915, 1915, 1914, 1913, 1917, 1916, 1919, 1919, 1918, 1917, - 1921, 1920, 1923, 1923, 1922, 1921, 1925, 1924, 1927, 1927, 1926, 1925, 1929, 1928, 1931, 1931, 1930, 1929, - 1933, 1932, 1935, 1935, 1934, 1933, 1937, 1936, 1939, 1939, 1938, 1937, 1941, 1940, 1943, 1943, 1942, 1941, - 1945, 1944, 1947, 1947, 1946, 1945, 1949, 1948, 1951, 1951, 1950, 1949, 1953, 1952, 1955, 1955, 1954, 1953, - 1957, 1956, 1959, 1959, 1958, 1957, 1961, 1960, 1963, 1963, 1962, 1961, 1965, 1964, 1967, 1967, 1966, 1965, - 1969, 1968, 1971, 1971, 1970, 1969, 1973, 1972, 1975, 1975, 1974, 1973, 1977, 1976, 1979, 1979, 1978, 1977, - 1981, 1980, 1983, 1983, 1982, 1981, 1985, 1984, 1987, 1987, 1986, 1985, 1989, 1988, 1991, 1991, 1990, 1989, - 1993, 1992, 1995, 1995, 1994, 1993, 1997, 1996, 1999, 1999, 1998, 1997, 2001, 2000, 2003, 2003, 2002, 2001, - 2005, 2004, 2007, 2007, 2006, 2005, 2009, 2008, 2011, 2011, 2010, 2009, 2013, 2012, 2015, 2015, 2014, 2013, - 2017, 2016, 2019, 2019, 2018, 2017, 2021, 2020, 2023, 2023, 2022, 2021, 2025, 2024, 2027, 2027, 2026, 2025, - 2029, 2028, 2031, 2031, 2030, 2029, 2033, 2032, 2035, 2035, 2034, 2033, 2037, 2036, 2039, 2039, 2038, 2037, - 2041, 2040, 2043, 2043, 2042, 2041, 2045, 2044, 2047, 2047, 2046, 2045 -}; - -#endif // KWIN_HAVE_OPENGLES - -template <typename T> -T align(T value, int bytes) -{ - return (value + bytes - 1) & ~T(bytes - 1); -} - -#ifndef KWIN_HAVE_OPENGLES - -// This class is not be used with OpenGL ES for now, since we need -// GL_ARB_draw_elements_base_vertex and GL_ARB_copy_buffer. -class IndexBuffer -{ -public: - IndexBuffer(); - ~IndexBuffer(); - - void accomodate(int count); - void bind(); - -private: - GLuint m_buffer; - size_t m_size; - int m_count; -}; - -IndexBuffer::IndexBuffer() -{ - // The maximum number of quads we can render with 16 bit indices is 16,384. - // But we start with 512 and grow the buffer as needed. - m_size = sizeof(indices); - m_count = m_size / (6 * sizeof(uint16_t)); - - glGenBuffers(1, &m_buffer); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_buffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW); -} - -IndexBuffer::~IndexBuffer() -{ - glDeleteBuffers(1, &m_buffer); -} - -void IndexBuffer::accomodate(int count) -{ - // Check if we need to grow the buffer. - if (count <= m_count) - return; - - count = align(count, 128); - size_t size = 6 * sizeof(uint16_t) * count; - - // Create a new buffer object - GLuint buffer; - glGenBuffers(1, &buffer); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW); - - // Use the GPU to copy the data from the old object to the new object, - glBindBuffer(GL_COPY_READ_BUFFER, m_buffer); - glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_ELEMENT_ARRAY_BUFFER, 0, 0, m_size); - glDeleteBuffers(1, &m_buffer); - glFlush(); // Needed to work around what appears to be a CP DMA issue in r600g - - // Map the new object and fill in the uninitialized section - const GLbitfield access = GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_RANGE_BIT; - uint16_t *map = (uint16_t *) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, m_size, size - m_size, access); - - const uint16_t index[] = { 1, 0, 3, 3, 2, 1 }; - for (int i = m_count; i < count; i++) { - for (int j = 0; j < 6; j++) - *(map++) = i * 4 + index[j]; - } - - glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); - m_buffer = buffer; - m_count = count; - m_size = size; -} - -void IndexBuffer::bind() -{ - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_buffer); -} - -#endif // KWIN_HAVE_OPENGLES - - - -// ------------------------------------------------------------------ - - -class BitRef -{ -public: - BitRef(uint32_t &bitfield, int bit) : m_bitfield(bitfield), m_mask(1 << bit) {} - - void operator = (bool val) { - if (val) - m_bitfield |= m_mask; - else - m_bitfield &= ~m_mask; - } - - operator bool () const { return m_bitfield & m_mask; } - -private: - uint32_t &m_bitfield; - int const m_mask; -}; - - -// ------------------------------------------------------------------ - - -class Bitfield -{ -public: - Bitfield() : m_bitfield(0) {} - Bitfield(uint32_t bits) : m_bitfield(bits) {} - - void set(int i) { m_bitfield |= (1 << i); } - void clear(int i) { m_bitfield &= ~(1 << i); } - - BitRef operator [] (int i) { return BitRef(m_bitfield, i); } - operator uint32_t () const { return m_bitfield; } - -private: - uint32_t m_bitfield; -}; - - -// ------------------------------------------------------------------ - - -class BitfieldIterator -{ -public: - BitfieldIterator(uint32_t bitfield) : m_bitfield(bitfield) {} - - bool hasNext() const { return m_bitfield != 0; } - - int next() { - const int bit = ffs(m_bitfield) - 1; - m_bitfield ^= (1 << bit); - return bit; - } - -private: - uint32_t m_bitfield; -}; - - - -// ------------------------------------------------------------------ - - - -struct VertexAttrib -{ - int size; - GLenum type; - int offset; -}; - - -//********************************* -// GLVertexBufferPrivate -//********************************* -class GLVertexBufferPrivate -{ -public: - GLVertexBufferPrivate(GLVertexBuffer::UsageHint usageHint) - : vertexCount(0) - , useColor(false) - , color(0, 0, 0, 255) - , bufferSize(0) - , mappedSize(0) - , nextOffset(0) - , baseAddress(0) - { - if (GLVertexBufferPrivate::supported) - glGenBuffers(1, &buffer); - - switch(usageHint) { - case GLVertexBuffer::Dynamic: - usage = GL_DYNAMIC_DRAW; - break; - case GLVertexBuffer::Static: - usage = GL_STATIC_DRAW; - break; - default: - usage = GL_STREAM_DRAW; - break; - } - } - - ~GLVertexBufferPrivate() { - if (GLVertexBufferPrivate::supported) - glDeleteBuffers(1, &buffer); - } - - void interleaveArrays(float *array, int dim, const float *vertices, const float *texcoords, int count); - void bindArrays(); - void unbindArrays(); - void reallocateBuffer(size_t size); - GLvoid *mapNextFreeRange(size_t size); - - GLuint buffer; - GLenum usage; - int stride; - int vertexCount; - static bool supported; - static GLVertexBuffer *streamingBuffer; - static bool hasMapBufferRange; - static bool supportsIndexedQuads; - QByteArray dataStore; - bool useColor; - QVector4D color; - size_t bufferSize; - size_t mappedSize; - intptr_t nextOffset; - intptr_t baseAddress; - VertexAttrib attrib[VertexAttributeCount]; - Bitfield enabledArrays; -#ifndef KWIN_HAVE_OPENGLES - static IndexBuffer *s_indexBuffer; -#endif -}; - -bool GLVertexBufferPrivate::supported = false; -bool GLVertexBufferPrivate::hasMapBufferRange = false; -bool GLVertexBufferPrivate::supportsIndexedQuads = false; -GLVertexBuffer *GLVertexBufferPrivate::streamingBuffer = NULL; -#ifndef KWIN_HAVE_OPENGLES -IndexBuffer *GLVertexBufferPrivate::s_indexBuffer = NULL; -#endif - -void GLVertexBufferPrivate::interleaveArrays(float *dst, int dim, - const float *vertices, const float *texcoords, - int count) -{ - if (!texcoords) { - memcpy((void *) dst, vertices, dim * sizeof(float) * count); - return; - } - - switch (dim) - { - case 2: - for (int i = 0; i < count; i++) { - *(dst++) = *(vertices++); - *(dst++) = *(vertices++); - *(dst++) = *(texcoords++); - *(dst++) = *(texcoords++); - } - break; - - case 3: - for (int i = 0; i < count; i++) { - *(dst++) = *(vertices++); - *(dst++) = *(vertices++); - *(dst++) = *(vertices++); - *(dst++) = *(texcoords++); - *(dst++) = *(texcoords++); - } - break; - - default: - for (int i = 0; i < count; i++) { - for (int j = 0; j < dim; j++) - *(dst++) = *(vertices++); - - *(dst++) = *(texcoords++); - *(dst++) = *(texcoords++); - } - } -} - -void GLVertexBufferPrivate::bindArrays() -{ -#ifndef KWIN_HAVE_OPENGLES - if (ShaderManager::instance()->isShaderBound()) { -#endif - if (useColor) { - GLShader *shader = ShaderManager::instance()->getBoundShader(); - shader->setUniform(GLShader::Color, color); - } - - glBindBuffer(GL_ARRAY_BUFFER, buffer); - - BitfieldIterator it(enabledArrays); - while (it.hasNext()) { - const int index = it.next(); - glVertexAttribPointer(index, attrib[index].size, attrib[index].type, GL_FALSE, stride, - (const GLvoid *) (baseAddress + attrib[index].offset)); - glEnableVertexAttribArray(index); - } -#ifndef KWIN_HAVE_OPENGLES - } else { - if (GLVertexBufferPrivate::supported) - glBindBuffer(GL_ARRAY_BUFFER, buffer); - - // FIXME Is there any good reason to not leave this array permanently enabled? - // When do we not use it in the GL 1.x path? - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(attrib[VA_Position].size, attrib[VA_Position].type, stride, - (const GLvoid *) (baseAddress + attrib[VA_Position].offset)); - - if (enabledArrays[VA_TexCoord]) { - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(attrib[VA_TexCoord].size, attrib[VA_TexCoord].type, stride, - (const GLvoid *) (baseAddress + attrib[VA_TexCoord].offset)); - } - - if (useColor) - glColor4f(color.x(), color.y(), color.z(), color.w()); - } -#endif -} - -void GLVertexBufferPrivate::unbindArrays() -{ -#ifndef KWIN_HAVE_OPENGLES - if (ShaderManager::instance()->isShaderBound()) { -#endif - BitfieldIterator it(enabledArrays); - while (it.hasNext()) - glDisableVertexAttribArray(it.next()); -#ifndef KWIN_HAVE_OPENGLES - } else { - // Assume that the conventional arrays were enabled - glDisableClientState(GL_VERTEX_ARRAY); - - if (enabledArrays[VA_TexCoord]) - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - } -#endif -} - -void GLVertexBufferPrivate::reallocateBuffer(size_t size) -{ - // Round the size up to 4 Kb for streaming/dynamic buffers. - const size_t minSize = 32768; // Minimum size for streaming buffers - const size_t alloc = usage != GL_STATIC_DRAW ? align(qMax(size, minSize), 4096) : size; - - glBufferData(GL_ARRAY_BUFFER, alloc, 0, usage); - - bufferSize = alloc; -} - -GLvoid *GLVertexBufferPrivate::mapNextFreeRange(size_t size) -{ - GLbitfield access = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT; - - if ((nextOffset + size) > bufferSize) { - // Reallocate the data store if it's too small. - if (size > bufferSize) { - reallocateBuffer(size); - } else { - access |= GL_MAP_INVALIDATE_BUFFER_BIT; - access ^= GL_MAP_UNSYNCHRONIZED_BIT; - } - - nextOffset = 0; - } - - return glMapBufferRange(GL_ARRAY_BUFFER, nextOffset, size, access); -} - - -//********************************* -// GLVertexBuffer -//********************************* -GLVertexBuffer::GLVertexBuffer(UsageHint hint) - : d(new GLVertexBufferPrivate(hint)) -{ -} - -GLVertexBuffer::~GLVertexBuffer() -{ - delete d; -} - -void GLVertexBuffer::setData(const void *data, size_t size) -{ - GLvoid *ptr = map(size); - memcpy(ptr, data, size); - unmap(); -} - -void GLVertexBuffer::setData(int vertexCount, int dim, const float* vertices, const float* texcoords) -{ - const GLVertexAttrib layout[] = { - { VA_Position, dim, GL_FLOAT, 0 }, - { VA_TexCoord, 2, GL_FLOAT, int(dim * sizeof(float)) } - }; - - int stride = (texcoords ? dim + 2 : dim) * sizeof(float); - int attribCount = texcoords ? 2 : 1; - - setAttribLayout(layout, attribCount, stride); - setVertexCount(vertexCount); - - GLvoid *ptr = map(vertexCount * stride); - d->interleaveArrays((float *) ptr, dim, vertices, texcoords, vertexCount); - unmap(); -} - -GLvoid *GLVertexBuffer::map(size_t size) -{ - d->mappedSize = size; - - if (GLVertexBufferPrivate::supported) - glBindBuffer(GL_ARRAY_BUFFER, d->buffer); - - bool preferBufferSubData = GLPlatform::instance()->preferBufferSubData(); - - if (GLVertexBufferPrivate::hasMapBufferRange && !preferBufferSubData) - return (GLvoid *) d->mapNextFreeRange(size); - - // If we can't map the buffer we allocate local memory to hold the - // buffer data and return a pointer to it. The data will be submitted - // to the actual buffer object when the user calls unmap(). - if (size_t(d->dataStore.size()) < size) - d->dataStore.resize(size); - - return (GLvoid *) d->dataStore.data(); -} - -void GLVertexBuffer::unmap() -{ - bool preferBufferSubData = GLPlatform::instance()->preferBufferSubData(); - - if (GLVertexBufferPrivate::hasMapBufferRange && !preferBufferSubData) { - glUnmapBuffer(GL_ARRAY_BUFFER); - - d->baseAddress = d->nextOffset; - d->nextOffset += align(d->mappedSize, 16); // Align to 16 bytes for SSE - } else if (GLVertexBufferPrivate::supported) { - // Upload the data from local memory to the buffer object - if (preferBufferSubData) { - if ((d->nextOffset + d->mappedSize) > d->bufferSize) { - d->reallocateBuffer(d->mappedSize); - d->nextOffset = 0; - } - - glBufferSubData(GL_ARRAY_BUFFER, d->nextOffset, d->mappedSize, d->dataStore.constData()); - - d->baseAddress = d->nextOffset; - d->nextOffset += align(d->mappedSize, 16); // Align to 16 bytes for SSE - } else { - glBufferData(GL_ARRAY_BUFFER, d->mappedSize, d->dataStore.data(), d->usage); - d->baseAddress = 0; - } - - // Free the local memory buffer if it's unlikely to be used again - if (d->usage == GL_STATIC_DRAW) - d->dataStore = QByteArray(); - - } else { - // If buffer objects aren't supported we just need to update - // the client memory pointer and we're done. - d->baseAddress = intptr_t(d->dataStore.data()); - } - - d->mappedSize = 0; -} - -void GLVertexBuffer::setVertexCount(int count) -{ - d->vertexCount = count; -} - -void GLVertexBuffer::setAttribLayout(const GLVertexAttrib *attribs, int count, int stride) -{ - // Start by disabling all arrays - d->enabledArrays = 0; - - for (int i = 0; i < count; i++) { - const int index = attribs[i].index; - - assert(index >= 0 && index < VertexAttributeCount); - assert(!d->enabledArrays[index]); - - d->attrib[index].size = attribs[i].size; - d->attrib[index].type = attribs[i].type; - d->attrib[index].offset = attribs[i].relativeOffset; - - d->enabledArrays[index] = true; - } - - d->stride = stride; -} - -void GLVertexBuffer::render(GLenum primitiveMode) -{ - render(infiniteRegion(), primitiveMode, false); -} - -void GLVertexBuffer::render(const QRegion& region, GLenum primitiveMode, bool hardwareClipping) -{ - d->bindArrays(); - draw(region, primitiveMode, 0, d->vertexCount, hardwareClipping); - d->unbindArrays(); -} - -void GLVertexBuffer::bindArrays() -{ - d->bindArrays(); -} - -void GLVertexBuffer::unbindArrays() -{ - d->unbindArrays(); -} - -void GLVertexBuffer::draw(GLenum primitiveMode, int first, int count) -{ - draw(infiniteRegion(), primitiveMode, first, count, false); -} - -void GLVertexBuffer::draw(const QRegion ®ion, GLenum primitiveMode, int first, int count, bool hardwareClipping) -{ -#ifndef KWIN_HAVE_OPENGLES - if (primitiveMode == GL_QUADS) { - IndexBuffer *&indexBuffer = GLVertexBufferPrivate::s_indexBuffer; - - if (!indexBuffer) - indexBuffer = new IndexBuffer; - - indexBuffer->bind(); - indexBuffer->accomodate(count / 4); - - count = count * 6 / 4; - - if (!hardwareClipping) { - glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, NULL, first); - } else { - // Clip using scissoring - foreach (const QRect &r, region.rects()) { - glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height()); - glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, NULL, first); - } - } - return; - } -#endif - - if (!hardwareClipping) { - glDrawArrays(primitiveMode, first, count); - } else { - // Clip using scissoring - foreach (const QRect &r, region.rects()) { - glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height()); - glDrawArrays(primitiveMode, first, count); - } - } -} - -bool GLVertexBuffer::isSupported() -{ - return GLVertexBufferPrivate::supported; -} - -bool GLVertexBuffer::supportsIndexedQuads() -{ - return GLVertexBufferPrivate::supportsIndexedQuads; -} - -bool GLVertexBuffer::isUseColor() const -{ - return d->useColor; -} - -void GLVertexBuffer::setUseColor(bool enable) -{ - d->useColor = enable; -} - -void GLVertexBuffer::setColor(const QColor& color, bool enable) -{ - d->useColor = enable; - d->color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); -} - -void GLVertexBuffer::reset() -{ - d->useColor = false; - d->color = QVector4D(0, 0, 0, 1); - d->vertexCount = 0; -} - -void GLVertexBuffer::initStatic() -{ -#ifdef KWIN_HAVE_OPENGLES - GLVertexBufferPrivate::supported = true; - GLVertexBufferPrivate::hasMapBufferRange = hasGLExtension("GL_EXT_map_buffer_range"); - GLVertexBufferPrivate::supportsIndexedQuads = false; -#else - GLVertexBufferPrivate::supported = hasGLVersion(1, 5) || hasGLExtension("GL_ARB_vertex_buffer_object"); - GLVertexBufferPrivate::hasMapBufferRange = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_map_buffer_range"); - GLVertexBufferPrivate::supportsIndexedQuads = glMapBufferRange && glCopyBufferSubData && glDrawElementsBaseVertex; - GLVertexBufferPrivate::s_indexBuffer = 0; -#endif - GLVertexBufferPrivate::streamingBuffer = new GLVertexBuffer(GLVertexBuffer::Stream); -} - -void GLVertexBuffer::cleanup() -{ -#ifndef KWIN_HAVE_OPENGLES - delete GLVertexBufferPrivate::s_indexBuffer; - GLVertexBufferPrivate::s_indexBuffer = 0; -#endif -} - -GLVertexBuffer *GLVertexBuffer::streamingBuffer() -{ - return GLVertexBufferPrivate::streamingBuffer; -} - -} // namespace diff --git a/kwin/libkwineffects/kwinglutils.h b/kwin/libkwineffects/kwinglutils.h deleted file mode 100644 index e5c6f766..00000000 --- a/kwin/libkwineffects/kwinglutils.h +++ /dev/null @@ -1,820 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee> -Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_GLUTILS_H -#define KWIN_GLUTILS_H - -// kwin -#include "kwinglutils_funcs.h" -#include "kwingltexture.h" - -// Qt -#include <QSize> -#include <QStack> - -/** @addtogroup kwineffects */ -/** @{ */ - -class QVector2D; -class QVector3D; -class QVector4D; -class QMatrix4x4; - -template< class K, class V > class QHash; - - -namespace KWin -{ - -class GLVertexBuffer; -class GLVertexBufferPrivate; - - -// Initializes GLX function pointers -void KWIN_EXPORT initGLX(); -// Initializes OpenGL stuff. This includes resolving function pointers as -// well as checking for GL version and extensions -// Note that GL context has to be created by the time this function is called -void KWIN_EXPORT initGL(OpenGLPlatformInterface platformInterface); -// Initializes EGL function pointers -void KWIN_EXPORT initEGL(); -// Cleans up all resources hold by the GL Context -void KWIN_EXPORT cleanupGL(); - -// Number of supported texture units -extern KWIN_EXPORT int glTextureUnitsCount; - - -bool KWIN_EXPORT hasGLVersion(int major, int minor, int release = 0); -bool KWIN_EXPORT hasGLXVersion(int major, int minor, int release = 0); -bool KWIN_EXPORT hasEGLVersion(int major, int minor, int release = 0); -// use for both OpenGL and GLX extensions -bool KWIN_EXPORT hasGLExtension(const QString& extension); - -// detect OpenGL error (add to various places in code to pinpoint the place) -bool KWIN_EXPORT checkGLError(const char* txt); - -inline bool KWIN_EXPORT isPowerOfTwo(int x) -{ - return ((x & (x - 1)) == 0); -} -/** - * @return power of two integer _greater or equal to_ x. - * E.g. nearestPowerOfTwo(513) = nearestPowerOfTwo(800) = 1024 - **/ -int KWIN_EXPORT nearestPowerOfTwo(int x); - -/** - * Push a new matrix on the GL matrix stack. - * In GLES this method is a noop. This method should be preferred over glPushMatrix - * as it also handles GLES. - * @since 4.7 - **/ -KWIN_EXPORT void pushMatrix(); -/** - * Multiplies current matrix on GL stack with @p matrix and pushes the result on the matrix stack. - * This method is the same as pushMatrix followed by multiplyMatrix. - * In GLES this method is a noop. This method should be preferred over glPushMatrix - * as it also handles GLES. - * @param matrix The matrix the current matrix on the stack should be multiplied with. - * @see pushMatrix - * @see multiplyMatrix - * @since 4.7 - **/ -KWIN_EXPORT void pushMatrix(const QMatrix4x4 &matrix); -/** - * Multiplies the current matrix on GL stack with @p matrix. - * In GLES this method is a noop. This method should be preferred over glMultMatrix - * as it also handles GLES. - * @param matrix The matrix the current matrix on the stack should be multiplied with. - * @since 4.7 - **/ -KWIN_EXPORT void multiplyMatrix(const QMatrix4x4 &matrix); -/** - * Replaces the current matrix on GL stack with @p matrix. - * In GLES this method is a no-op. This method should be preferred over glLoadMatrix - * as it also handles GLES. - * @param matrix The new matrix to replace the existing one on the GL stack. - * @since 4.7 - **/ -KWIN_EXPORT void loadMatrix(const QMatrix4x4 &matrix); -/** - * Pops the current matrix from the GL matrix stack. - * In GLES this method is a noop. This method should be preferred over glPopMatrix - * as it also handles GLES. - * @since 4.7 - **/ -KWIN_EXPORT void popMatrix(); - -class KWIN_EXPORT GLShader -{ -public: - enum Flags { - NoFlags = 0, - ExplicitLinking = (1 << 0) - }; - - GLShader(const QString &vertexfile, const QString &fragmentfile, unsigned int flags = NoFlags); - ~GLShader(); - - bool isValid() const { - return mValid; - } - - void bindAttributeLocation(const char *name, int index); - void bindFragDataLocation(const char *name, int index); - - bool link(); - - int uniformLocation(const char* name); - - bool setUniform(const char* name, float value); - bool setUniform(const char* name, int value); - bool setUniform(const char* name, const QVector2D& value); - bool setUniform(const char* name, const QVector3D& value); - bool setUniform(const char* name, const QVector4D& value); - bool setUniform(const char* name, const QMatrix4x4& value); - bool setUniform(const char* name, const QColor& color); - - bool setUniform(int location, float value); - bool setUniform(int location, int value); - bool setUniform(int location, const QVector2D &value); - bool setUniform(int location, const QVector3D &value); - bool setUniform(int location, const QVector4D &value); - bool setUniform(int location, const QMatrix4x4 &value); - bool setUniform(int location, const QColor &value); - - int attributeLocation(const char* name); - bool setAttribute(const char* name, float value); - /** - * @return The value of the uniform as a matrix - * @since 4.7 - **/ - QMatrix4x4 getUniformMatrix4x4(const char* name); - - enum MatrixUniform { - TextureMatrix = 0, - ProjectionMatrix, - ModelViewMatrix, - WindowTransformation, - ScreenTransformation, - MatrixCount - }; - - enum Vec2Uniform { - Offset, - Vec2UniformCount - }; - - enum Vec4Uniform { - ModulationConstant, - Vec4UniformCount - }; - - enum FloatUniform { - Saturation, - FloatUniformCount - }; - - enum IntUniform { - AlphaToOne, ///< @deprecated no longer used - ColorCorrectionLookupTextureUnit, - IntUniformCount - }; - - enum ColorUniform { - Color, - ColorUniformCount - }; - - bool setUniform(MatrixUniform uniform, const QMatrix4x4 &matrix); - bool setUniform(Vec2Uniform uniform, const QVector2D &value); - bool setUniform(Vec4Uniform uniform, const QVector4D &value); - bool setUniform(FloatUniform uniform, float value); - bool setUniform(IntUniform uniform, int value); - bool setUniform(ColorUniform uniform, const QVector4D &value); - bool setUniform(ColorUniform uniform, const QColor &value); - -protected: - GLShader(unsigned int flags = NoFlags); - bool loadFromFiles(const QString& vertexfile, const QString& fragmentfile); - bool load(const QByteArray &vertexSource, const QByteArray &fragmentSource); - const QByteArray prepareSource(GLenum shaderType, const QByteArray &sourceCode) const; - bool compile(GLuint program, GLenum shaderType, const QByteArray &sourceCode) const; - void bind(); - void unbind(); - void resolveLocations(); - -private: - unsigned int mProgram; - bool mValid:1; - bool mLocationsResolved:1; - bool mExplicitLinking:1; - int mMatrixLocation[MatrixCount]; - int mVec2Location[Vec2UniformCount]; - int mVec4Location[Vec4UniformCount]; - int mFloatLocation[FloatUniformCount]; - int mIntLocation[IntUniformCount]; - int mColorLocation[ColorUniformCount]; - - static bool sColorCorrect; - - friend class ColorCorrection; - friend class ColorCorrectionPrivate; - friend class ShaderManager; -}; - -/** - * @short Manager for Shaders. - * - * This class provides some built-in shaders to be used by both compositing scene and effects. - * The ShaderManager provides methods to bind a built-in or a custom shader and keeps track of - * the shaders which have been bound. When a shader is unbound the previously bound shader - * will be rebound. - * - * @author Martin Gräßlin <mgraesslin@kde.org> - * @since 4.7 - **/ -class KWIN_EXPORT ShaderManager -{ -public: - /** - * Identifiers for built-in shaders available for effects and scene - **/ - enum ShaderType { - /** - * An orthographic projection shader able to render textured geometries. - * Expects a @c vec2 uniform @c offset describing the offset from top-left corner - * and defaults to @c (0/0). Expects a @c vec2 uniform @c textureSize to calculate - * normalized texture coordinates. Defaults to @c (1.0/1.0). And expects a @c vec3 - * uniform @c colorManiuplation, with @c x being opacity, @c y being brightness and - * @c z being saturation. All three values default to @c 1.0. - * The sampler uniform is @c sample and defaults to @c 0. - * The shader uses two vertex attributes @c vertex and @c texCoord. - **/ - SimpleShader = 0, - /** - * A generic shader able to render transformed, textured geometries. - * This shader is mostly needed by the scene and not of much interest for effects. - * Effects can influence this shader through @link ScreenPaintData and @link WindowPaintData. - * The shader expects four @c mat4 uniforms @c projection, @c modelview, - * @c screenTransformation and @c windowTransformation. The fragment shader expect the - * same uniforms as the SimpleShader and the same vertex attributes are used. - **/ - GenericShader, - /** - * An orthographic shader to render simple colored geometries without texturing. - * Expects a @c vec2 uniform @c offset describing the offset from top-left corner - * and defaults to @c (0/0). The fragment shader expects a single @c vec4 uniform - * @c geometryColor, which defaults to fully opaque black. - * The Shader uses one vertex attribute @c vertex. - **/ - ColorShader - }; - - /** - * @return The currently bound shader or @c null if no shader is bound. - **/ - GLShader *getBoundShader() const; - - /** - * @return @c true if a shader is bound, @c false otherwise - **/ - bool isShaderBound() const; - /** - * Allows to query whether Shaders are supported by the compositor, that is - * whether the Shaders compiled successfully. - * - * With OpenGL 1 compositing this method will always return @c false. - * - * Do not use this method to check whether the compositor uses OpenGL 1 or 2, - * use @link EffectsHandler::compositingType instead. - * @return @c true if the built-in shaders are valid, @c false otherwise - **/ - bool isValid() const; - /** - * Is @c true if the environment variable KWIN_GL_DEBUG is set to 1. - * In that case shaders are compiled with KWIN_SHADER_DEBUG defined. - * @returns @c true if shaders are compiled with debug information - * @since 4.8 - **/ - bool isShaderDebug() const; - - /** - * Binds the shader of specified @p type. - * To unbind the shader use @link popShader. A previous bound shader will be rebound. - * @param type The built-in shader to bind - * @param reset Whether all uniforms should be reset to their default values - * @return The bound shader or @c NULL if shaders are not valid - * @see popShader - **/ - GLShader *pushShader(ShaderType type, bool reset = false); - /** - * Binds the @p shader. - * To unbind the shader use @link popShader. A previous bound shader will be rebound. - * To bind a built-in shader use the more specific method. - * @param shader The shader to be bound - * @see popShader - **/ - void pushShader(GLShader *shader); - - /** - * Unbinds the currently bound shader and rebinds a previous stored shader. - * If there is no previous shader, no shader will be rebound. - * It is not safe to call this method if there is no bound shader. - * @see pushShader - * @see getBoundShader - **/ - void popShader(); - - /** - * Resets all shaders to the default uniform values. - * Only built in shaders are changed. - * @since 4.8 - **/ - void resetAllShaders(); - - /** - * Resets ShaderType @p type uniforms of a custom shader - * @since 4.11.1 - */ - void resetShader(GLShader *shader, ShaderType type); - - /** - * Creates a GLShader with a built-in vertex shader and a custom fragment shader. - * @param vertex The generic vertex shader - * @param fragmentFile The path to the source code of the fragment shader - * @return The created shader - **/ - GLShader *loadFragmentShader(ShaderType vertex, const QString &fragmentFile); - /** - * Creates a GLShader with a built-in fragment shader and a custom vertex shader. - * @param fragment The generic fragment shader - * @param vertexFile The path to the source code of the vertex shader - * @return The created shader - **/ - GLShader *loadVertexShader(ShaderType fragment, const QString &vertexFile); - /** - * Creates a GLShader with the specified sources. - * The difference to GLShader is that it does not need to be loaded from files. - * @param vertexSource The source code of the vertex shader - * @param fragmentSource The source code of the fragment shader. - * @return The created shader - **/ - GLShader *loadShaderFromCode(const QByteArray &vertexSource, const QByteArray &fragmentSource); - - /** - * @return a pointer to the ShaderManager instance - **/ - static ShaderManager *instance(); - /** - * @brief Ensures that the ShaderManager is disabled. - * - * Used only by an OpenGL 1 Scene which does not use OpenGL 2 Shaders. - * - * @internal - * @since 4.10 - **/ - static void disable(); - - /** - * @internal - **/ - static void cleanup(); - -private: - ShaderManager(); - ~ShaderManager(); - - void initShaders(); - void resetShader(ShaderType type); - void bindFragDataLocations(GLShader *shader); - void bindAttributeLocations(GLShader *shader) const; - - QStack<GLShader*> m_boundShaders; - GLShader *m_shader[3]; - bool m_inited; - bool m_valid; - bool m_debug; - QByteArray m_shaderDir; - static ShaderManager *s_shaderManager; -}; - -/** - * An helper class to push a Shader on to ShaderManager's stack and ensuring that the Shader - * gets popped again from the stack automatically once the object goes out of life. - * - * How to use: - * @code - * { - * GLShader *myCustomShaderIWantToPush; - * ShaderBinder binder(myCustomShaderIWantToPush); - * // do stuff with the shader being pushed on the stack - * } - * // here the Shader is automatically popped as helper does no longer exist. - * @endcode - * - * This class takes care for the case that the Compositor uses OpenGL 1 and the ShaderManager is - * not valid. In that case the helper does not do anything. So this helper can be used to simplify - * the code to remove checks for OpenGL 1/2. - * @since 4.10 - **/ -class KWIN_EXPORT ShaderBinder -{ -public: - /** - * @brief Pushes the Shader of the given @p type to the ShaderManager's stack. - * - * @param type The built-in Shader type - * @param reset Whether all uniforms should be reset to their default values. Defaults to false. - * @see ShaderManager::pushShader - **/ - explicit ShaderBinder(ShaderManager::ShaderType type, bool reset = false); - /** - * @brief Pushes the given @p shader to the ShaderManager's stack. - * - * @param shader The Shader to push on the stack - * @see ShaderManager::pushShader - **/ - explicit ShaderBinder(GLShader *shader); - ~ShaderBinder(); - - /** - * @return The Shader pushed to the Stack. On OpenGL 1 this returns a @c null pointer. - **/ - GLShader *shader(); - -private: - GLShader *m_shader; -}; - -inline -ShaderBinder::ShaderBinder(ShaderManager::ShaderType type, bool reset) - : m_shader(NULL) -{ -#ifdef KWIN_HAVE_OPENGL_1 - if (!ShaderManager::instance()->isValid()) { - return; - } -#endif - m_shader = ShaderManager::instance()->pushShader(type, reset); -} - -inline -ShaderBinder::ShaderBinder(GLShader *shader) - : m_shader(shader) -{ -#ifdef KWIN_HAVE_OPENGL_1 - if (!ShaderManager::instance()->isValid()) { - return; - } -#endif - ShaderManager::instance()->pushShader(shader); -} - -inline -ShaderBinder::~ShaderBinder() -{ -#ifdef KWIN_HAVE_OPENGL_1 - if (!ShaderManager::instance()->isValid()) { - return; - } -#endif - ShaderManager::instance()->popShader(); -} - -inline -GLShader* ShaderBinder::shader() -{ - return m_shader; -} - -/** - * @short Render target object - * - * Render target object enables you to render onto a texture. This texture can - * later be used to e.g. do post-processing of the scene. - * - * @author Rivo Laks <rivolaks@hot.ee> - **/ -class KWIN_EXPORT GLRenderTarget -{ -public: - /** - * Constructs a GLRenderTarget - * @param color texture where the scene will be rendered onto - **/ - explicit GLRenderTarget(const GLTexture& color); - ~GLRenderTarget(); - - /** - * Enables this render target. - * All OpenGL commands from now on affect this render target until the - * @ref disable method is called - **/ - bool enable(); - /** - * Disables this render target, activating whichever target was active - * when @ref enable was called. - **/ - bool disable(); - - /** - * Sets the target texture - * @param target texture where the scene will be rendered on - * @since 4.8 - **/ - void attachTexture(const GLTexture& target); - - bool valid() const { - return mValid; - } - - static void initStatic(); - static bool supported() { - return sSupported; - } - static void pushRenderTarget(GLRenderTarget *target); - static GLRenderTarget *popRenderTarget(); - static bool isRenderTargetBound(); - /** - * Whether the GL_EXT_framebuffer_blit extension is supported. - * This functionality is not available in OpenGL ES 2.0. - * - * @returns whether framebuffer blitting is supported. - * @since 4.8 - **/ - static bool blitSupported(); - - /** - * Blits the content of the current draw framebuffer into the texture attached to this FBO. - * - * Be aware that framebuffer blitting may not be supported on all hardware. Use @link blitSupported to check whether - * it is supported. - * @param source Geometry in screen coordinates which should be blitted, if not specified complete framebuffer is used - * @param destination Geometry in attached texture, if not specified complete texture is used as destination - * @param filter The filter to use if blitted content needs to be scaled. - * @see blitSupported - * @since 4.8 - **/ - void blitFromFramebuffer(const QRect &source = QRect(), const QRect &destination = QRect(), GLenum filter = GL_LINEAR); - - -protected: - void initFBO(); - - -private: - static bool sSupported; - static bool s_blitSupported; - static QStack<GLRenderTarget*> s_renderTargets; - - GLTexture mTexture; - bool mValid; - - GLuint mFramebuffer; -}; - -enum VertexAttributeType { - VA_Position = 0, - VA_TexCoord = 1, - VertexAttributeCount = 2 -}; - -/** - * Describes the format of a vertex attribute stored in a buffer object. - * - * The attribute format consists of the attribute index, the number of - * vector components, the data type, and the offset of the first element - * relative to the start of the vertex data. - */ -struct GLVertexAttrib -{ - int index; /** The attribute index */ - int size; /** The number of components [1..4] */ - GLenum type; /** The type (e.g. GL_FLOAT) */ - int relativeOffset; /** The relative offset of the attribute */ -}; - -/** - * @short Vertex Buffer Object - * - * This is a short helper class to use vertex buffer objects (VBO). A VBO can be used to buffer - * vertex data and to store them on graphics memory. It is the only allowed way to pass vertex - * data to the GPU in OpenGL ES 2 and OpenGL 3 with forward compatible mode. - * - * If VBOs are not supported on the used OpenGL profile this class falls back to legacy - * rendering using client arrays. Therefore this class should always be used for rendering geometries. - * - * @author Martin Gräßlin <mgraesslin@kde.org> - * @since 4.6 - */ -class KWIN_EXPORT GLVertexBuffer -{ -public: - /** - * Enum to define how often the vertex data in the buffer object changes. - */ - enum UsageHint { - Dynamic, ///< frequent changes, but used several times for rendering - Static, ///< No changes to data - Stream ///< Data only used once for rendering, updated very frequently - }; - - explicit GLVertexBuffer(UsageHint hint); - ~GLVertexBuffer(); - - /** - * Specifies how interleaved vertex attributes are laid out in - * the buffer object. - * - * Note that the attributes and the stride should be 32 bit aligned - * or a performance penalty may be incurred. - * - * For some hardware the optimal stride is a multiple of 32 bytes. - * - * Example: - * - * struct Vertex { - * QVector3D position; - * QVector2D texcoord; - * }; - * - * const GLVertexAttrib attribs[] = { - * { VA_Position, 3, GL_FLOAT, offsetof(Vertex, position) }, - * { VA_TexCoord, 2, GL_FLOAT, offsetof(Vertex, texcoord) } - * }; - * - * Vertex vertices[6]; - * vbo->setAttribLayout(attribs, 2, sizeof(Vertex)); - * vbo->setData(vertices, sizeof(vertices)); - */ - void setAttribLayout(const GLVertexAttrib *attribs, int count, int stride); - - /** - * Uploads data into the buffer object's data store. - */ - void setData(const void *data, size_t sizeInBytes); - - /** - * Sets the number of vertices that will be drawn by the render() method. - */ - void setVertexCount(int count); - - /** - * Sets the vertex data. - * @param numberVertices The number of vertices in the arrays - * @param dim The dimension of the vertices: 2 for x/y, 3 for x/y/z - * @param vertices The vertices, size must equal @a numberVertices * @a dim - * @param texcoords The texture coordinates for each vertex. - * Size must equal 2 * @a numberVertices. - */ - void setData(int numberVertices, int dim, const float* vertices, const float* texcoords); - - /** - * Maps an unused range of the data store into the client's address space. - * - * The data store will be reallocated if it is smaller than the given size. - * - * The buffer object is mapped for writing, not reading. Attempts to read from - * the mapped buffer range may result in system errors, including program - * termination. The data in the mapped region is undefined until it has been - * written to. If subsequent GL calls access unwritten memory, the results are - * undefined and system errors, including program termination, may occur. - * - * No GL calls that access the buffer object must be made while the buffer - * object is mapped. The returned pointer must not be passed as a parameter - * value to any GL function. - * - * It is assumed that the GL_ARRAY_BUFFER_BINDING will not be changed while - * the buffer object is mapped. - */ - GLvoid *map(size_t size); - - /** - * Flushes the mapped buffer range and unmaps the buffer. - */ - void unmap(); - - /** - * Binds the vertex arrays to the context. - */ - void bindArrays(); - - /** - * Disables the vertex arrays. - */ - void unbindArrays(); - - /** - * Draws count vertices beginning with first. - */ - void draw(GLenum primitiveMode, int first, int count); - - /** - * Draws count vertices beginning with first. - */ - void draw(const QRegion ®ion, GLenum primitiveMode, int first, int count, bool hardwareClipping = false); - - /** - * Renders the vertex data in given @a primitiveMode. - * Please refer to OpenGL documentation of glDrawArrays or glDrawElements for allowed - * values for @a primitiveMode. Best is to use GL_TRIANGLES or similar to be future - * compatible. - */ - void render(GLenum primitiveMode); - /** - * Same as above restricting painting to @a region if @a hardwareClipping is true. - * It's within the caller's responsibility to enable GL_SCISSOR_TEST. - */ - void render(const QRegion& region, GLenum primitiveMode, bool hardwareClipping = false); - /** - * Sets the color the geometry will be rendered with. - * For legacy rendering glColor is used before rendering the geometry. - * For core shader a uniform "geometryColor" is expected and is set. - * @param color The color to render the geometry - * @param enableColor Whether the geometry should be rendered with a color or not - * @see setUseColor - * @see isUseColor - * @since 4.7 - **/ - void setColor(const QColor& color, bool enableColor = true); - /** - * @return @c true if geometry will be painted with a color, @c false otherwise - * @see setUseColor - * @see setColor - * @since 4.7 - **/ - bool isUseColor() const; - /** - * Enables/Disables rendering the geometry with a color. - * If no color is set an opaque, black color is used. - * @param enable Enable/Disable rendering with color - * @see isUseColor - * @see setColor - * @since 4.7 - **/ - void setUseColor(bool enable); - - /** - * Resets the instance to default values. - * Useful for shared buffers. - * @since 4.7 - **/ - void reset(); - - /** - * @internal - */ - static void initStatic(); - - /** - * @internal - */ - static void cleanup(); - - /** - * Returns true if VBOs are supported, it is save to use this class even if VBOs are not - * supported. - * @returns true if vertex buffer objects are supported - */ - static bool isSupported(); - - /** - * Returns true if indexed quad mode is supported, and false otherwise. - */ - static bool supportsIndexedQuads(); - - /** - * @return A shared VBO for streaming data - * @since 4.7 - **/ - static GLVertexBuffer *streamingBuffer(); - -private: - GLVertexBufferPrivate* const d; -}; - -} // namespace - -/** @} */ - -#endif diff --git a/kwin/libkwineffects/kwinglutils_funcs.cpp b/kwin/libkwineffects/kwinglutils_funcs.cpp deleted file mode 100644 index cb5391e3..00000000 --- a/kwin/libkwineffects/kwinglutils_funcs.cpp +++ /dev/null @@ -1,794 +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 "kwinglutils.h" - -#include <dlfcn.h> - - -// Resolves given function, using getProcAddress -#ifdef KWIN_HAVE_EGL -#define GL_RESOLVE( function ) \ - if (platformInterface == GlxPlatformInterface) \ - function = (function ## _func)getProcAddress( #function ); \ - else if (platformInterface == EglPlatformInterface) \ - function = (function ## _func)eglGetProcAddress( #function ); -// Same as above but tries to use function "symbolName" -// Useful when functionality is defined in an extension with a different name -#define GL_RESOLVE_WITH_EXT( function, symbolName ) \ - if (platformInterface == GlxPlatformInterface) { \ - function = (function ## _func)getProcAddress( #symbolName ); \ - } else if (platformInterface == EglPlatformInterface) { \ - function = (function ## _func)eglGetProcAddress( #symbolName ); \ - } -#else -// same without the switch to egl -#define GL_RESOLVE( function ) function = (function ## _func)getProcAddress( #function ); - -#define GL_RESOLVE_WITH_EXT( function, symbolName ) \ - function = (function ## _func)getProcAddress( #symbolName ); -#endif - -#define EGL_RESOLVE( function ) function = (function ## _func)eglGetProcAddress( #function ); - - -namespace KWin -{ - -static GLenum GetGraphicsResetStatus(); -static void ReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, - GLenum type, GLsizei bufSize, GLvoid *data); -static void GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); - -#ifndef KWIN_HAVE_OPENGLES -// Function pointers -glXGetProcAddress_func glXGetProcAddress; -// GLX 1.3 -glXQueryDrawable_func glXQueryDrawable; -// texture_from_pixmap extension functions -glXReleaseTexImageEXT_func glXReleaseTexImageEXT; -glXBindTexImageEXT_func glXBindTexImageEXT; -// glXCopySubBufferMESA -glXCopySubBuffer_func glXCopySubBuffer; -// video_sync extension functions -glXGetVideoSync_func glXGetVideoSync; -glXWaitVideoSync_func glXWaitVideoSync; -glXSwapIntervalMESA_func glXSwapIntervalMESA; -glXSwapIntervalEXT_func glXSwapIntervalEXT; -glXSwapIntervalSGI_func glXSwapIntervalSGI; - -// GLX_ARB_create_context -glXCreateContextAttribsARB_func glXCreateContextAttribsARB; - -// glActiveTexture -glActiveTexture_func glActiveTexture; -// framebuffer_object extension functions -glIsRenderbuffer_func glIsRenderbuffer; -glBindRenderbuffer_func glBindRenderbuffer; -glDeleteRenderbuffers_func glDeleteRenderbuffers; -glGenRenderbuffers_func glGenRenderbuffers; -glRenderbufferStorage_func glRenderbufferStorage; -glGetRenderbufferParameteriv_func glGetRenderbufferParameteriv; -glIsFramebuffer_func glIsFramebuffer; -glBindFramebuffer_func glBindFramebuffer; -glDeleteFramebuffers_func glDeleteFramebuffers; -glGenFramebuffers_func glGenFramebuffers; -glCheckFramebufferStatus_func glCheckFramebufferStatus; -glFramebufferTexture1D_func glFramebufferTexture1D; -glFramebufferTexture2D_func glFramebufferTexture2D; -glFramebufferTexture3D_func glFramebufferTexture3D; -glFramebufferRenderbuffer_func glFramebufferRenderbuffer; -glGetFramebufferAttachmentParameteriv_func glGetFramebufferAttachmentParameteriv; -glGenerateMipmap_func glGenerateMipmap; -glBlitFramebuffer_func glBlitFramebuffer; -// Shader functions -glCreateShader_func glCreateShader; -glShaderSource_func glShaderSource; -glCompileShader_func glCompileShader; -glDeleteShader_func glDeleteShader; -glCreateProgram_func glCreateProgram; -glAttachShader_func glAttachShader; -glLinkProgram_func glLinkProgram; -glUseProgram_func glUseProgram; -glDeleteProgram_func glDeleteProgram; -glGetShaderInfoLog_func glGetShaderInfoLog; -glGetProgramInfoLog_func glGetProgramInfoLog; -glGetProgramiv_func glGetProgramiv; -glGetShaderiv_func glGetShaderiv; -glUniform1f_func glUniform1f; -glUniform2f_func glUniform2f; -glUniform3f_func glUniform3f; -glUniform4f_func glUniform4f; -glUniform1i_func glUniform1i; -glUniform1fv_func glUniform1fv; -glUniform2fv_func glUniform2fv; -glUniform3fv_func glUniform3fv; -glUniform4fv_func glUniform4fv; -glGetUniformfv_func glGetUniformfv; -glUniformMatrix4fv_func glUniformMatrix4fv; -glValidateProgram_func glValidateProgram; -glGetUniformLocation_func glGetUniformLocation; -glVertexAttrib1f_func glVertexAttrib1f; -glGetAttribLocation_func glGetAttribLocation; -glBindAttribLocation_func glBindAttribLocation; -glGenProgramsARB_func glGenProgramsARB; -glBindProgramARB_func glBindProgramARB; -glProgramStringARB_func glProgramStringARB; -glProgramLocalParameter4fARB_func glProgramLocalParameter4fARB; -glDeleteProgramsARB_func glDeleteProgramsARB; -glGetProgramivARB_func glGetProgramivARB; -// vertex buffer objects -glGenBuffers_func glGenBuffers; -glDeleteBuffers_func glDeleteBuffers; -glBindBuffer_func glBindBuffer; -glBufferData_func glBufferData; -glBufferSubData_func glBufferSubData; -glGetBufferSubData_func glGetBufferSubData; -glEnableVertexAttribArray_func glEnableVertexAttribArray; -glDisableVertexAttribArray_func glDisableVertexAttribArray; -glVertexAttribPointer_func glVertexAttribPointer; -glMapBuffer_func glMapBuffer; -glUnmapBuffer_func glUnmapBuffer; - -// GL_ARB_map_buffer_range -glMapBufferRange_func glMapBufferRange; -glFlushMappedBufferRange_func glFlushMappedBufferRange; - -// GL_ARB_vertex_array_object -glBindVertexArray_func glBindVertexArray; -glDeleteVertexArrays_func glDeleteVertexArrays; -glGenVertexArrays_func glGenVertexArrays; -glIsVertexArray_func glIsVertexArray; - - -// GL_EXT_gpu_shader4 -glVertexAttribI1i_func glVertexAttribI1i; -glVertexAttribI2i_func glVertexAttribI2i; -glVertexAttribI3i_func glVertexAttribI3i; -glVertexAttribI4i_func glVertexAttribI4i; -glVertexAttribI1ui_func glVertexAttribI1ui; -glVertexAttribI2ui_func glVertexAttribI2ui; -glVertexAttribI3ui_func glVertexAttribI3ui; -glVertexAttribI4ui_func glVertexAttribI4ui; -glVertexAttribI1iv_func glVertexAttribI1iv; -glVertexAttribI2iv_func glVertexAttribI2iv; -glVertexAttribI3iv_func glVertexAttribI3iv; -glVertexAttribI4iv_func glVertexAttribI4iv; -glVertexAttribI1uiv_func glVertexAttribI1uiv; -glVertexAttribI2uiv_func glVertexAttribI2uiv; -glVertexAttribI3uiv_func glVertexAttribI3uiv; -glVertexAttribI4uiv_func glVertexAttribI4uiv; -glVertexAttribI4bv_func glVertexAttribI4bv; -glVertexAttribI4sv_func glVertexAttribI4sv; -glVertexAttribI4ubv_func glVertexAttribI4ubv; -glVertexAttribI4usv_func glVertexAttribI4usv; -glVertexAttribIPointer_func glVertexAttribIPointer; -glGetVertexAttribIiv_func glGetVertexAttribIiv; -glGetVertexAttribIuiv_func glGetVertexAttribIuiv; -glGetUniformuiv_func glGetUniformuiv; -glBindFragDataLocation_func glBindFragDataLocation; -glGetFragDataLocation_func glGetFragDataLocation; -glUniform1ui_func glUniform1ui; -glUniform2ui_func glUniform2ui; -glUniform3ui_func glUniform3ui; -glUniform4ui_func glUniform4ui; -glUniform1uiv_func glUniform1uiv; -glUniform2uiv_func glUniform2uiv; -glUniform3uiv_func glUniform3uiv; - -// GL_ARB_robustness -glGetGraphicsResetStatus_func glGetGraphicsResetStatus; -glReadnPixels_func glReadnPixels; -glGetnUniformfv_func glGetnUniformfv; - -// GL_ARB_draw_elements_base_vertex -glDrawElementsBaseVertex_func glDrawElementsBaseVertex; -glDrawElementsInstancedBaseVertex_func glDrawElementsInstancedBaseVertex; - -// GL_ARB_copy_buffer -glCopyBufferSubData_func glCopyBufferSubData; - - -static glXFuncPtr getProcAddress(const char* name) -{ - glXFuncPtr ret = NULL; - if (glXGetProcAddress != NULL) - ret = glXGetProcAddress((const GLubyte*) name); - if (ret == NULL) - ret = (glXFuncPtr) dlsym(RTLD_DEFAULT, name); - return ret; -} - -void glxResolveFunctions() -{ - // handle OpenGL extensions functions - glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddress"); - if (glXGetProcAddress == NULL) - glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddressARB"); - glXQueryDrawable = (glXQueryDrawable_func) getProcAddress("glXQueryDrawable"); - if (hasGLExtension("GLX_EXT_texture_from_pixmap")) { - glXBindTexImageEXT = (glXBindTexImageEXT_func) getProcAddress("glXBindTexImageEXT"); - glXReleaseTexImageEXT = (glXReleaseTexImageEXT_func) getProcAddress("glXReleaseTexImageEXT"); - } else { - glXBindTexImageEXT = NULL; - glXReleaseTexImageEXT = NULL; - } - if (hasGLExtension("GLX_MESA_copy_sub_buffer")) - glXCopySubBuffer = (glXCopySubBuffer_func) getProcAddress("glXCopySubBufferMESA"); - else - glXCopySubBuffer = NULL; - if (hasGLExtension("GLX_SGI_video_sync")) { - glXGetVideoSync = (glXGetVideoSync_func) getProcAddress("glXGetVideoSyncSGI"); - glXWaitVideoSync = (glXWaitVideoSync_func) getProcAddress("glXWaitVideoSyncSGI"); - } else { - glXGetVideoSync = NULL; - glXWaitVideoSync = NULL; - } - - if (hasGLExtension("GLX_SGI_swap_control")) - glXSwapIntervalSGI = (glXSwapIntervalSGI_func) getProcAddress("glXSwapIntervalSGI"); - else - glXSwapIntervalSGI = NULL; - if (hasGLExtension("GLX_EXT_swap_control")) - glXSwapIntervalEXT = (glXSwapIntervalEXT_func) getProcAddress("glXSwapIntervalEXT"); - else - glXSwapIntervalEXT = NULL; - if (hasGLExtension("GLX_MESA_swap_control")) - glXSwapIntervalMESA = (glXSwapIntervalMESA_func) getProcAddress("glXSwapIntervalMESA"); - else - glXSwapIntervalMESA = NULL; - - if (hasGLExtension("GLX_ARB_create_context")) - glXCreateContextAttribsARB = (glXCreateContextAttribsARB_func) getProcAddress("glXCreateContextAttribsARB"); - else - glXCreateContextAttribsARB = NULL; -} - -#else - -// GL_OES_mapbuffer -glMapBuffer_func glMapBuffer; -glUnmapBuffer_func glUnmapBuffer; -glGetBufferPointerv_func glGetBufferPointerv; - -// GL_OES_texture_3D -glTexImage3DOES_func glTexImage3D; - -// GL_EXT_map_buffer_range -glMapBufferRange_func glMapBufferRange; -glFlushMappedBufferRange_func glFlushMappedBufferRange; - -#endif // KWIN_HAVE_OPENGLES - -#ifdef KWIN_HAVE_EGL - -// EGL -eglCreateImageKHR_func eglCreateImageKHR; -eglDestroyImageKHR_func eglDestroyImageKHR; -eglPostSubBufferNV_func eglPostSubBufferNV; -// GLES -glEGLImageTargetTexture2DOES_func glEGLImageTargetTexture2DOES; - -#ifdef KWIN_HAVE_OPENGLES -// GL_EXT_robustness -glGetGraphicsResetStatus_func glGetGraphicsResetStatus; -glReadnPixels_func glReadnPixels; -glGetnUniformfv_func glGetnUniformfv; -#endif - -void eglResolveFunctions() -{ - if (hasGLExtension("EGL_KHR_image") || - (hasGLExtension("EGL_KHR_image_base") && - hasGLExtension("EGL_KHR_image_pixmap"))) { - eglCreateImageKHR = (eglCreateImageKHR_func)eglGetProcAddress("eglCreateImageKHR"); - eglDestroyImageKHR = (eglDestroyImageKHR_func)eglGetProcAddress("eglDestroyImageKHR"); - } else { - eglCreateImageKHR = NULL; - eglDestroyImageKHR = NULL; - } - - if (hasGLExtension("EGL_NV_post_sub_buffer")) { - eglPostSubBufferNV = (eglPostSubBufferNV_func)eglGetProcAddress("eglPostSubBufferNV"); - } else { - eglPostSubBufferNV = NULL; - } -} -#endif - -void glResolveFunctions(OpenGLPlatformInterface platformInterface) -{ -#ifndef KWIN_HAVE_OPENGLES - if (hasGLVersion(1, 3)) { - GL_RESOLVE(glActiveTexture); - // Get number of texture units - glGetIntegerv(GL_MAX_TEXTURE_UNITS, &glTextureUnitsCount); - } else if (hasGLExtension("GL_ARB_multitexture")) { - GL_RESOLVE_WITH_EXT(glActiveTexture, glActiveTextureARB); - // Get number of texture units - glGetIntegerv(GL_MAX_TEXTURE_UNITS, &glTextureUnitsCount); - } else { - glActiveTexture = NULL; - glTextureUnitsCount = 0; - } - - if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object")) { - // see http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt - GL_RESOLVE(glIsRenderbuffer); - GL_RESOLVE(glBindRenderbuffer); - GL_RESOLVE(glDeleteRenderbuffers); - GL_RESOLVE(glGenRenderbuffers); - - GL_RESOLVE(glRenderbufferStorage); - - GL_RESOLVE(glGetRenderbufferParameteriv); - - GL_RESOLVE(glIsFramebuffer); - GL_RESOLVE(glBindFramebuffer); - GL_RESOLVE(glDeleteFramebuffers); - GL_RESOLVE(glGenFramebuffers); - - GL_RESOLVE(glCheckFramebufferStatus); - - GL_RESOLVE(glFramebufferTexture1D); - GL_RESOLVE(glFramebufferTexture2D); - GL_RESOLVE(glFramebufferTexture3D); - - GL_RESOLVE(glFramebufferRenderbuffer); - - GL_RESOLVE(glGetFramebufferAttachmentParameteriv); - - GL_RESOLVE(glGenerateMipmap); - } else if (hasGLExtension("GL_EXT_framebuffer_object")) { - // see http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt - GL_RESOLVE_WITH_EXT(glIsRenderbuffer, glIsRenderbufferEXT); - GL_RESOLVE_WITH_EXT(glBindRenderbuffer, glBindRenderbufferEXT); - GL_RESOLVE_WITH_EXT(glDeleteRenderbuffers, glDeleteRenderbuffersEXT); - GL_RESOLVE_WITH_EXT(glGenRenderbuffers, glGenRenderbuffersEXT); - - GL_RESOLVE_WITH_EXT(glRenderbufferStorage, glRenderbufferStorageEXT); - - GL_RESOLVE_WITH_EXT(glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT); - - GL_RESOLVE_WITH_EXT(glIsFramebuffer, glIsFramebufferEXT); - GL_RESOLVE_WITH_EXT(glBindFramebuffer, glBindFramebufferEXT); - GL_RESOLVE_WITH_EXT(glDeleteFramebuffers, glDeleteFramebuffersEXT); - GL_RESOLVE_WITH_EXT(glGenFramebuffers, glGenFramebuffersEXT); - - GL_RESOLVE_WITH_EXT(glCheckFramebufferStatus, glCheckFramebufferStatusEXT); - - GL_RESOLVE_WITH_EXT(glFramebufferTexture1D, glFramebufferTexture1DEXT); - GL_RESOLVE_WITH_EXT(glFramebufferTexture2D, glFramebufferTexture2DEXT); - GL_RESOLVE_WITH_EXT(glFramebufferTexture3D, glFramebufferTexture3DEXT); - - GL_RESOLVE_WITH_EXT(glFramebufferRenderbuffer, glFramebufferRenderbufferEXT); - - GL_RESOLVE_WITH_EXT(glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT); - - GL_RESOLVE_WITH_EXT(glGenerateMipmap, glGenerateMipmapEXT); - } else { - glIsRenderbuffer = NULL; - glBindRenderbuffer = NULL; - glDeleteRenderbuffers = NULL; - glGenRenderbuffers = NULL; - glRenderbufferStorage = NULL; - glGetRenderbufferParameteriv = NULL; - glIsFramebuffer = NULL; - glBindFramebuffer = NULL; - glDeleteFramebuffers = NULL; - glGenFramebuffers = NULL; - glCheckFramebufferStatus = NULL; - glFramebufferTexture1D = NULL; - glFramebufferTexture2D = NULL; - glFramebufferTexture3D = NULL; - glFramebufferRenderbuffer = NULL; - glGetFramebufferAttachmentParameteriv = NULL; - glGenerateMipmap = NULL; - } - - if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object")) { - // see http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt - GL_RESOLVE(glBlitFramebuffer); - } else if (hasGLExtension("GL_EXT_framebuffer_blit")) { - // see http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt - GL_RESOLVE_WITH_EXT(glBlitFramebuffer, glBlitFramebufferEXT); - } else { - glBlitFramebuffer = NULL; - } - - if (hasGLVersion(2, 0)) { - // see http://www.opengl.org/registry/specs/ARB/shader_objects.txt - GL_RESOLVE(glCreateShader); - GL_RESOLVE(glShaderSource); - GL_RESOLVE(glCompileShader); - GL_RESOLVE(glDeleteShader); - GL_RESOLVE(glCreateProgram); - GL_RESOLVE(glAttachShader); - GL_RESOLVE(glLinkProgram); - GL_RESOLVE(glUseProgram); - GL_RESOLVE(glDeleteProgram); - GL_RESOLVE(glGetShaderInfoLog); - GL_RESOLVE(glGetProgramInfoLog); - GL_RESOLVE(glGetProgramiv); - GL_RESOLVE(glGetShaderiv); - GL_RESOLVE(glUniform1f); - GL_RESOLVE(glUniform2f); - GL_RESOLVE(glUniform3f); - GL_RESOLVE(glUniform4f); - GL_RESOLVE(glUniform1i); - GL_RESOLVE(glUniform1fv); - GL_RESOLVE(glUniform2fv); - GL_RESOLVE(glUniform3fv); - GL_RESOLVE(glUniform4fv); - GL_RESOLVE(glUniformMatrix4fv); - GL_RESOLVE(glValidateProgram); - GL_RESOLVE(glGetUniformLocation); - GL_RESOLVE(glGetUniformfv); - } else if (hasGLExtension("GL_ARB_shader_objects")) { - GL_RESOLVE_WITH_EXT(glCreateShader, glCreateShaderObjectARB); - GL_RESOLVE_WITH_EXT(glShaderSource, glShaderSourceARB); - GL_RESOLVE_WITH_EXT(glCompileShader, glCompileShaderARB); - GL_RESOLVE_WITH_EXT(glDeleteShader, glDeleteObjectARB); - GL_RESOLVE_WITH_EXT(glCreateProgram, glCreateProgramObjectARB); - GL_RESOLVE_WITH_EXT(glAttachShader, glAttachObjectARB); - GL_RESOLVE_WITH_EXT(glLinkProgram, glLinkProgramARB); - GL_RESOLVE_WITH_EXT(glUseProgram, glUseProgramObjectARB); - GL_RESOLVE_WITH_EXT(glDeleteProgram, glDeleteObjectARB); - GL_RESOLVE_WITH_EXT(glGetShaderInfoLog, glGetInfoLogARB); - GL_RESOLVE_WITH_EXT(glGetProgramInfoLog, glGetInfoLogARB); - GL_RESOLVE_WITH_EXT(glGetProgramiv, glGetObjectParameterivARB); - GL_RESOLVE_WITH_EXT(glGetShaderiv, glGetObjectParameterivARB); - GL_RESOLVE_WITH_EXT(glUniform1f, glUniform1fARB); - GL_RESOLVE_WITH_EXT(glUniform2f, glUniform2fARB); - GL_RESOLVE_WITH_EXT(glUniform3f, glUniform3fARB); - GL_RESOLVE_WITH_EXT(glUniform4f, glUniform4fARB); - GL_RESOLVE_WITH_EXT(glUniform1i, glUniform1iARB); - GL_RESOLVE_WITH_EXT(glUniform1fv, glUniform1fvARB); - GL_RESOLVE_WITH_EXT(glUniform2fv, glUniform2fvARB); - GL_RESOLVE_WITH_EXT(glUniform3fv, glUniform3fvARB); - GL_RESOLVE_WITH_EXT(glUniform4fv, glUniform4fvARB); - GL_RESOLVE_WITH_EXT(glUniformMatrix4fv, glUniformMatrix4fvARB); - GL_RESOLVE_WITH_EXT(glValidateProgram, glValidateProgramARB); - GL_RESOLVE_WITH_EXT(glGetUniformLocation, glGetUniformLocationARB); - GL_RESOLVE_WITH_EXT(glGetUniformfv, glGetUniformfvARB); - } else { - glCreateShader = NULL; - glShaderSource = NULL; - glCompileShader = NULL; - glDeleteShader = NULL; - glCreateProgram = NULL; - glAttachShader = NULL; - glLinkProgram = NULL; - glUseProgram = NULL; - glDeleteProgram = NULL; - glGetShaderInfoLog = NULL; - glGetProgramInfoLog = NULL; - glGetProgramiv = NULL; - glGetShaderiv = NULL; - glUniform1f = NULL; - glUniform2f = NULL; - glUniform3f = NULL; - glUniform4f = NULL; - glUniform1i = NULL; - glUniform1fv = NULL; - glUniform2fv = NULL; - glUniform3fv = NULL; - glUniform4fv = NULL; - glUniformMatrix4fv = NULL; - glValidateProgram = NULL; - glGetUniformLocation = NULL; - glGetUniformfv = NULL; - } - - if (hasGLVersion(2, 0)) { - // see http://www.opengl.org/registry/specs/ARB/vertex_shader.txt - GL_RESOLVE(glVertexAttrib1f); - GL_RESOLVE(glBindAttribLocation); - GL_RESOLVE(glGetAttribLocation); - GL_RESOLVE(glEnableVertexAttribArray); - GL_RESOLVE(glDisableVertexAttribArray); - GL_RESOLVE(glVertexAttribPointer); - } else if (hasGLExtension("GL_ARB_vertex_shader")) { - GL_RESOLVE_WITH_EXT(glVertexAttrib1f, glVertexAttrib1fARB); - GL_RESOLVE_WITH_EXT(glBindAttribLocation, glBindAttribLocationARB); - GL_RESOLVE_WITH_EXT(glGetAttribLocation, glGetAttribLocationARB); - GL_RESOLVE_WITH_EXT(glEnableVertexAttribArray, glEnableVertexAttribArrayARB); - GL_RESOLVE_WITH_EXT(glDisableVertexAttribArray, glDisableVertexAttribArrayARB); - GL_RESOLVE_WITH_EXT(glVertexAttribPointer, glVertexAttribPointerARB); - } else { - glVertexAttrib1f = NULL; - glBindAttribLocation = NULL; - glGetAttribLocation = NULL; - glEnableVertexAttribArray = NULL; - glDisableVertexAttribArray = NULL; - glVertexAttribPointer = NULL; - } - - if (hasGLExtension("GL_ARB_fragment_program") && hasGLExtension("GL_ARB_vertex_program")) { - // see http://www.opengl.org/registry/specs/ARB/fragment_program.txt - GL_RESOLVE(glProgramStringARB); - GL_RESOLVE(glBindProgramARB); - GL_RESOLVE(glDeleteProgramsARB); - GL_RESOLVE(glGenProgramsARB); - GL_RESOLVE(glProgramLocalParameter4fARB); - GL_RESOLVE(glGetProgramivARB); - } else { - glProgramStringARB = NULL; - glBindProgramARB = NULL; - glDeleteProgramsARB = NULL; - glGenProgramsARB = NULL; - glProgramLocalParameter4fARB = NULL; - glGetProgramivARB = NULL; - } - - if (hasGLVersion(1, 5)) { - // see http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt - GL_RESOLVE(glGenBuffers); - GL_RESOLVE(glDeleteBuffers); - GL_RESOLVE(glBindBuffer); - GL_RESOLVE(glBufferData); - GL_RESOLVE(glBufferSubData); - GL_RESOLVE(glMapBuffer); - GL_RESOLVE(glUnmapBuffer); - } else if (hasGLExtension("GL_ARB_vertex_buffer_object")) { - GL_RESOLVE_WITH_EXT(glGenBuffers, glGenBuffersARB); - GL_RESOLVE_WITH_EXT(glDeleteBuffers, glDeleteBuffersARB); - GL_RESOLVE_WITH_EXT(glBindBuffer, glBindBufferARB); - GL_RESOLVE_WITH_EXT(glBufferData, glBufferDataARB); - GL_RESOLVE_WITH_EXT(glBufferSubData, glBufferSubDataARB); - GL_RESOLVE_WITH_EXT(glGetBufferSubData, glGetBufferSubDataARB); - GL_RESOLVE_WITH_EXT(glMapBuffer, glMapBufferARB); - GL_RESOLVE_WITH_EXT(glUnmapBuffer, glUnmapBufferARB); - } else { - glGenBuffers = NULL; - glDeleteBuffers = NULL; - glBindBuffer = NULL; - glBufferData = NULL; - glBufferSubData = NULL; - glGetBufferSubData = NULL; - glMapBuffer = NULL; - glUnmapBuffer = NULL; - } - - if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_vertex_array_object")) { - // see http://www.opengl.org/registry/specs/ARB/vertex_array_object.txt - GL_RESOLVE(glBindVertexArray); - GL_RESOLVE(glDeleteVertexArrays); - GL_RESOLVE(glGenVertexArrays); - GL_RESOLVE(glIsVertexArray); - } else { - glBindVertexArray = NULL; - glDeleteVertexArrays = NULL; - glGenVertexArrays = NULL; - glIsVertexArray = NULL; - } - - if (hasGLVersion(3, 0)) { - GL_RESOLVE(glVertexAttribI1i); - GL_RESOLVE(glVertexAttribI2i); - GL_RESOLVE(glVertexAttribI3i); - GL_RESOLVE(glVertexAttribI4i); - GL_RESOLVE(glVertexAttribI1ui); - GL_RESOLVE(glVertexAttribI2ui); - GL_RESOLVE(glVertexAttribI3ui); - GL_RESOLVE(glVertexAttribI4ui); - GL_RESOLVE(glVertexAttribI1iv); - GL_RESOLVE(glVertexAttribI2iv); - GL_RESOLVE(glVertexAttribI3iv); - GL_RESOLVE(glVertexAttribI4iv); - GL_RESOLVE(glVertexAttribI1uiv); - GL_RESOLVE(glVertexAttribI2uiv); - GL_RESOLVE(glVertexAttribI3uiv); - GL_RESOLVE(glVertexAttribI4uiv); - GL_RESOLVE(glVertexAttribI4bv); - GL_RESOLVE(glVertexAttribI4sv); - GL_RESOLVE(glVertexAttribI4ubv); - GL_RESOLVE(glVertexAttribI4usv); - GL_RESOLVE(glVertexAttribIPointer); - GL_RESOLVE(glGetVertexAttribIiv); - GL_RESOLVE(glGetVertexAttribIuiv); - GL_RESOLVE(glGetUniformuiv); - GL_RESOLVE(glBindFragDataLocation); - GL_RESOLVE(glGetFragDataLocation); - GL_RESOLVE(glUniform1ui); - GL_RESOLVE(glUniform2ui); - GL_RESOLVE(glUniform3ui); - GL_RESOLVE(glUniform4ui); - GL_RESOLVE(glUniform1uiv); - GL_RESOLVE(glUniform2uiv); - GL_RESOLVE(glUniform3uiv); - } else if (hasGLExtension("GL_EXT_gpu_shader4")) { - // See http://www.opengl.org/registry/specs/EXT/gpu_shader4.txt - GL_RESOLVE_WITH_EXT(glVertexAttribI1i, glVertexAttribI1iEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI2i, glVertexAttribI2iEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI3i, glVertexAttribI3iEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4i, glVertexAttribI4iEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI1ui, glVertexAttribI1uiEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI2ui, glVertexAttribI2uiEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI3ui, glVertexAttribI3uiEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4ui, glVertexAttribI4uiEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI1iv, glVertexAttribI1ivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI2iv, glVertexAttribI2ivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI3iv, glVertexAttribI3ivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4iv, glVertexAttribI4ivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI1uiv, glVertexAttribI1uivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI2uiv, glVertexAttribI2uivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI3uiv, glVertexAttribI3uivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4uiv, glVertexAttribI4uivEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4bv, glVertexAttribI4bvEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4sv, glVertexAttribI4svEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4ubv, glVertexAttribI4ubvEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribI4usv, glVertexAttribI4usvEXT); - GL_RESOLVE_WITH_EXT(glVertexAttribIPointer, glVertexAttribIPointerEXT); - GL_RESOLVE_WITH_EXT(glGetVertexAttribIiv, glGetVertexAttribIivEXT); - GL_RESOLVE_WITH_EXT(glGetVertexAttribIuiv, glGetVertexAttribIuivEXT); - GL_RESOLVE_WITH_EXT(glGetUniformuiv, glGetUniformuivEXT); - GL_RESOLVE_WITH_EXT(glBindFragDataLocation, glBindFragDataLocationEXT); - GL_RESOLVE_WITH_EXT(glGetFragDataLocation, glGetFragDataLocationEXT); - GL_RESOLVE_WITH_EXT(glUniform1ui, glUniform1uiEXT); - GL_RESOLVE_WITH_EXT(glUniform2ui, glUniform2uiEXT); - GL_RESOLVE_WITH_EXT(glUniform3ui, glUniform3uiEXT); - GL_RESOLVE_WITH_EXT(glUniform4ui, glUniform4uiEXT); - GL_RESOLVE_WITH_EXT(glUniform1uiv, glUniform1uivEXT); - GL_RESOLVE_WITH_EXT(glUniform2uiv, glUniform2uivEXT); - GL_RESOLVE_WITH_EXT(glUniform3uiv, glUniform3uivEXT); - } else { - glVertexAttribI1i = NULL; - glVertexAttribI2i = NULL; - glVertexAttribI3i = NULL; - glVertexAttribI4i = NULL; - glVertexAttribI1ui = NULL; - glVertexAttribI2ui = NULL; - glVertexAttribI3ui = NULL; - glVertexAttribI4ui = NULL; - glVertexAttribI1iv = NULL; - glVertexAttribI2iv = NULL; - glVertexAttribI3iv = NULL; - glVertexAttribI4iv = NULL; - glVertexAttribI1uiv = NULL; - glVertexAttribI2uiv = NULL; - glVertexAttribI3uiv = NULL; - glVertexAttribI4uiv = NULL; - glVertexAttribI4bv = NULL; - glVertexAttribI4sv = NULL; - glVertexAttribI4ubv = NULL; - glVertexAttribI4usv = NULL; - glVertexAttribIPointer = NULL; - glGetVertexAttribIiv = NULL; - glGetVertexAttribIuiv = NULL; - glGetUniformuiv = NULL; - glBindFragDataLocation = NULL; - glGetFragDataLocation = NULL; - glUniform1ui = NULL; - glUniform2ui = NULL; - glUniform3ui = NULL; - glUniform4ui = NULL; - glUniform1uiv = NULL; - glUniform2uiv = NULL; - glUniform3uiv = NULL; - } - - if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_map_buffer_range")) { - // See http://www.opengl.org/registry/specs/ARB/map_buffer_range.txt - GL_RESOLVE(glMapBufferRange); - GL_RESOLVE(glFlushMappedBufferRange); - } else { - glMapBufferRange = NULL; - glFlushMappedBufferRange = NULL; - } - - if (hasGLExtension("GL_ARB_robustness")) { - // See http://www.opengl.org/registry/specs/ARB/robustness.txt - GL_RESOLVE_WITH_EXT(glGetGraphicsResetStatus, glGetGraphicsResetStatusARB); - GL_RESOLVE_WITH_EXT(glReadnPixels, glReadnPixelsARB); - GL_RESOLVE_WITH_EXT(glGetnUniformfv, glGetnUniformfvARB); - } else { - glGetGraphicsResetStatus = KWin::GetGraphicsResetStatus; - glReadnPixels = KWin::ReadnPixels; - glGetnUniformfv = KWin::GetnUniformfv; - } - - if (hasGLVersion(3, 2) || hasGLExtension("GL_ARB_draw_elements_base_vertex")) { - // See http://www.opengl.org/registry/specs/ARB/draw_elements_base_vertex.txt - GL_RESOLVE(glDrawElementsBaseVertex); - GL_RESOLVE(glDrawElementsInstancedBaseVertex); - } else { - glDrawElementsBaseVertex = NULL; - glDrawElementsInstancedBaseVertex = NULL; - } - - if (hasGLVersion(3, 1) || hasGLExtension("GL_ARB_copy_buffer")) { - // See http://www.opengl.org/registry/specs/ARB/copy_buffer.txt - GL_RESOLVE(glCopyBufferSubData); - } else { - glCopyBufferSubData = NULL; - } - -#else - - if (hasGLExtension("GL_OES_mapbuffer")) { - // See http://www.khronos.org/registry/gles/extensions/OES/OES_mapbuffer.txt - glMapBuffer = (glMapBuffer_func) eglGetProcAddress("glMapBufferOES"); - glUnmapBuffer = (glUnmapBuffer_func) eglGetProcAddress("glUnmapBufferOES"); - glGetBufferPointerv = (glGetBufferPointerv_func) eglGetProcAddress("glGetBufferPointervOES"); - } else { - glMapBuffer = NULL; - glUnmapBuffer = NULL; - glGetBufferPointerv = NULL; - } - - if (hasGLExtension("GL_OES_texture_3D")) { - glTexImage3D = (glTexImage3DOES_func)eglGetProcAddress("glTexImage3DOES"); - } else { - glTexImage3D = NULL; - } - - if (hasGLExtension("GL_EXT_map_buffer_range")) { - // See http://www.khronos.org/registry/gles/extensions/EXT/EXT_map_buffer_range.txt - glMapBufferRange = (glMapBufferRange_func) eglGetProcAddress("glMapBufferRangeEXT"); - glFlushMappedBufferRange = (glFlushMappedBufferRange_func) eglGetProcAddress("glFlushMappedBufferRangeEXT"); - } else { - glMapBufferRange = NULL; - glFlushMappedBufferRange = NULL; - } - - if (hasGLExtension("GL_EXT_robustness")) { - // See http://www.khronos.org/registry/gles/extensions/EXT/EXT_robustness.txt - glGetGraphicsResetStatus = (glGetGraphicsResetStatus_func) eglGetProcAddress("glGetGraphicsResetStatusEXT"); - glReadnPixels = (glReadnPixels_func) eglGetProcAddress("glReadnPixelsEXT"); - glGetnUniformfv = (glGetnUniformfv_func) eglGetProcAddress("glGetnUniformfvEXT"); - } else { - glGetGraphicsResetStatus = KWin::GetGraphicsResetStatus; - glReadnPixels = KWin::ReadnPixels; - glGetnUniformfv = KWin::GetnUniformfv; - } - -#endif // KWIN_HAVE_OPENGLES - -#ifdef KWIN_HAVE_EGL - if (platformInterface == EglPlatformInterface) { - if (hasGLExtension("GL_OES_EGL_image")) { - glEGLImageTargetTexture2DOES = (glEGLImageTargetTexture2DOES_func)eglGetProcAddress("glEGLImageTargetTexture2DOES"); - } else { - glEGLImageTargetTexture2DOES = NULL; - } - } -#endif -} - -static GLenum GetGraphicsResetStatus() -{ - return GL_NO_ERROR; -} - -static void ReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, - GLenum type, GLsizei bufSize, GLvoid *data) -{ - Q_UNUSED(bufSize) - glReadPixels(x, y, width, height, format, type, data); -} - -static void GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params) -{ - Q_UNUSED(bufSize) - glGetUniformfv(program, location, params); -} - -} // namespace diff --git a/kwin/libkwineffects/kwinglutils_funcs.h b/kwin/libkwineffects/kwinglutils_funcs.h deleted file mode 100644 index 09faa264..00000000 --- a/kwin/libkwineffects/kwinglutils_funcs.h +++ /dev/null @@ -1,608 +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_GLUTILS_FUNCS_H -#define KWIN_GLUTILS_FUNCS_H - -#include <kdemacros.h> -#include <kwinconfig.h> -#include <kwinglobals.h> - -#define KWIN_EXPORT KDE_EXPORT - -// common functionality -namespace KWin { - -void KWIN_EXPORT glResolveFunctions(OpenGLPlatformInterface platformInterface); - -} - -#define GL_QUADS_KWIN 0x0007 - -#ifndef KWIN_HAVE_OPENGLES - -#include <GL/gl.h> -#include <GL/glx.h> - -#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#endif - -#ifndef GL_FRAMEBUFFER -#define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT -#endif - -#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT -#endif - -#ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT -#endif - -#ifndef GL_FRAMEBUFFER_UNSUPPORTED -#define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_EXT -#endif - -#ifndef GL_COLOR_ATTACHMENT0 -#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT -#endif - -#ifndef GL_FRAMEBUFFER_COMPLETE -#define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT -#endif - -#ifndef GL_DRAW_FRAMEBUFFER -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#endif - -#ifndef GL_READ_FRAMEBUFFER -#define GL_READ_FRAMEBUFFER 0x8CA8 -#endif - -#ifndef GLX_BACK_BUFFER_AGE_EXT -#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 -#endif - -#include <fixx11h.h> - -namespace KWin -{ - -void KWIN_EXPORT glxResolveFunctions(); - - -// Defines -/* -** GLX_EXT_texture_from_pixmap -*/ -#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 -#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 -#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 -#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 -#define GLX_Y_INVERTED_EXT 0x20D4 - -#define GLX_TEXTURE_FORMAT_EXT 0x20D5 -#define GLX_TEXTURE_TARGET_EXT 0x20D6 -#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 - -#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 -#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 -#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA - -#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 -#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 -#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 - -#define GLX_TEXTURE_1D_EXT 0x20DB -#define GLX_TEXTURE_2D_EXT 0x20DC -#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD - -#define GLX_FRONT_LEFT_EXT 0x20DE - -// Shader stuff -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 - -// FBO -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 - - -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 - - -// GLX typedefs -typedef struct __GLXcontextRec *GLXContext; -/* GLX 1.3 and later */ -typedef struct __GLXFBConfigRec *GLXFBConfig; - -// GL typedefs -typedef char GLchar; - -// Function pointers -// finding of OpenGL extensions functions -typedef void (*glXFuncPtr)(); -typedef glXFuncPtr(*glXGetProcAddress_func)(const GLubyte*); -extern KWIN_EXPORT glXGetProcAddress_func glXGetProcAddress; -// glXQueryDrawable (added in GLX 1.3) -typedef void (*glXQueryDrawable_func)(Display* dpy, GLXDrawable drawable, - int attribute, unsigned int *value); -extern KWIN_EXPORT glXQueryDrawable_func glXQueryDrawable; -// texture_from_pixmap extension functions -typedef void (*glXBindTexImageEXT_func)(Display* dpy, GLXDrawable drawable, - int buffer, const int* attrib_list); -typedef void (*glXReleaseTexImageEXT_func)(Display* dpy, GLXDrawable drawable, int buffer); -extern KWIN_EXPORT glXReleaseTexImageEXT_func glXReleaseTexImageEXT; -extern KWIN_EXPORT glXBindTexImageEXT_func glXBindTexImageEXT; -// glXCopySubBufferMESA -typedef void (*glXCopySubBuffer_func)(Display* , GLXDrawable, int, int, int, int); -extern KWIN_EXPORT glXCopySubBuffer_func glXCopySubBuffer; -// video_sync extension functions -typedef int (*glXGetVideoSync_func)(unsigned int *count); -typedef int (*glXWaitVideoSync_func)(int divisor, int remainder, unsigned int *count); -typedef int (*glXSwapIntervalMESA_func)(unsigned int interval); -typedef void (*glXSwapIntervalEXT_func)(Display *dpy, GLXDrawable drawable, int interval); -typedef int (*glXSwapIntervalSGI_func)(int interval); -extern KWIN_EXPORT glXGetVideoSync_func glXGetVideoSync; -extern KWIN_EXPORT glXWaitVideoSync_func glXWaitVideoSync; -extern KWIN_EXPORT glXSwapIntervalMESA_func glXSwapIntervalMESA; -extern KWIN_EXPORT glXSwapIntervalEXT_func glXSwapIntervalEXT; -extern KWIN_EXPORT glXSwapIntervalSGI_func glXSwapIntervalSGI; - -// GLX_ARB_create_context -typedef GLXContext (*glXCreateContextAttribsARB_func)(Display *dpy, GLXFBConfig config, - GLXContext share_context, Bool direct, - const int *attrib_list); - -extern KWIN_EXPORT glXCreateContextAttribsARB_func glXCreateContextAttribsARB; - -// glActiveTexture -typedef void (*glActiveTexture_func)(GLenum); -extern KWIN_EXPORT glActiveTexture_func glActiveTexture; -// framebuffer_object extension functions -typedef GLboolean(*glIsRenderbuffer_func)(GLuint renderbuffer); -typedef void (*glBindRenderbuffer_func)(GLenum target, GLuint renderbuffer); -typedef void (*glDeleteRenderbuffers_func)(GLsizei n, const GLuint *renderbuffers); -typedef void (*glGenRenderbuffers_func)(GLsizei n, GLuint *renderbuffers); -typedef void (*glRenderbufferStorage_func)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (*glGetRenderbufferParameteriv_func)(GLenum target, GLenum pname, GLint *params); -typedef GLboolean(*glIsFramebuffer_func)(GLuint framebuffer); -typedef void (*glBindFramebuffer_func)(GLenum target, GLuint framebuffer); -typedef void (*glDeleteFramebuffers_func)(GLsizei n, const GLuint *framebuffers); -typedef void (*glGenFramebuffers_func)(GLsizei n, GLuint *framebuffers); -typedef GLenum(*glCheckFramebufferStatus_func)(GLenum target); -typedef void (*glFramebufferTexture1D_func)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (*glFramebufferTexture2D_func)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (*glFramebufferTexture3D_func)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (*glFramebufferRenderbuffer_func)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (*glGetFramebufferAttachmentParameteriv_func)(GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (*glGenerateMipmap_func)(GLenum target); -typedef void (*glBlitFramebuffer_func)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -extern KWIN_EXPORT glIsRenderbuffer_func glIsRenderbuffer; -extern KWIN_EXPORT glBindRenderbuffer_func glBindRenderbuffer; -extern KWIN_EXPORT glDeleteRenderbuffers_func glDeleteRenderbuffers; -extern KWIN_EXPORT glGenRenderbuffers_func glGenRenderbuffers; -extern KWIN_EXPORT glRenderbufferStorage_func glRenderbufferStorage; -extern KWIN_EXPORT glGetRenderbufferParameteriv_func glGetRenderbufferParameteriv; -extern KWIN_EXPORT glIsFramebuffer_func glIsFramebuffer; -extern KWIN_EXPORT glBindFramebuffer_func glBindFramebuffer; -extern KWIN_EXPORT glDeleteFramebuffers_func glDeleteFramebuffers; -extern KWIN_EXPORT glGenFramebuffers_func glGenFramebuffers; -extern KWIN_EXPORT glCheckFramebufferStatus_func glCheckFramebufferStatus; -extern KWIN_EXPORT glFramebufferTexture1D_func glFramebufferTexture1D; -extern KWIN_EXPORT glFramebufferTexture2D_func glFramebufferTexture2D; -extern KWIN_EXPORT glFramebufferTexture3D_func glFramebufferTexture3D; -extern KWIN_EXPORT glFramebufferRenderbuffer_func glFramebufferRenderbuffer; -extern KWIN_EXPORT glGetFramebufferAttachmentParameteriv_func glGetFramebufferAttachmentParameteriv; -extern KWIN_EXPORT glGenerateMipmap_func glGenerateMipmap; -extern KWIN_EXPORT glBlitFramebuffer_func glBlitFramebuffer; -// Shader stuff -typedef GLuint(*glCreateShader_func)(GLenum); -typedef GLvoid(*glShaderSource_func)(GLuint, GLsizei, const GLchar**, const GLint*); -typedef GLvoid(*glCompileShader_func)(GLuint); -typedef GLvoid(*glDeleteShader_func)(GLuint); -typedef GLuint(*glCreateProgram_func)(); -typedef GLvoid(*glAttachShader_func)(GLuint, GLuint); -typedef GLvoid(*glLinkProgram_func)(GLuint); -typedef GLvoid(*glUseProgram_func)(GLuint); -typedef GLvoid(*glDeleteProgram_func)(GLuint); -typedef GLvoid(*glGetShaderInfoLog_func)(GLuint, GLsizei, GLsizei*, GLchar*); -typedef GLvoid(*glGetProgramInfoLog_func)(GLuint, GLsizei, GLsizei*, GLchar*); -typedef GLvoid(*glGetProgramiv_func)(GLuint, GLenum, GLint*); -typedef GLvoid(*glGetShaderiv_func)(GLuint, GLenum, GLint*); -typedef GLvoid(*glUniform1f_func)(GLint, GLfloat); -typedef GLvoid(*glUniform2f_func)(GLint, GLfloat, GLfloat); -typedef GLvoid(*glUniform3f_func)(GLint, GLfloat, GLfloat, GLfloat); -typedef GLvoid(*glUniform4f_func)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); -typedef GLvoid(*glUniformf_func)(GLint, GLfloat); -typedef GLvoid(*glUniform1i_func)(GLint, GLint); -typedef GLvoid(*glUniform1fv_func)(GLint, GLsizei, const GLfloat*); -typedef GLvoid(*glUniform2fv_func)(GLint, GLsizei, const GLfloat*); -typedef GLvoid(*glUniform3fv_func)(GLint, GLsizei, const GLfloat*); -typedef GLvoid(*glUniform4fv_func)(GLint, GLsizei, const GLfloat*); -typedef GLvoid(*glUniformMatrix4fv_func)(GLint, GLsizei, GLboolean, const GLfloat*); -typedef GLvoid(*glGetUniformfv_func)(GLuint, GLint, GLfloat*); -typedef GLvoid(*glValidateProgram_func)(GLuint); -typedef GLint(*glGetUniformLocation_func)(GLuint, const GLchar*); -typedef GLvoid(*glVertexAttrib1f_func)(GLuint, GLfloat); -typedef GLint(*glGetAttribLocation_func)(GLuint, const GLchar*); -typedef GLvoid(*glBindAttribLocation_func)(GLuint, GLuint, const GLchar*); -typedef void (*glGenProgramsARB_func)(GLsizei, GLuint*); -typedef void (*glBindProgramARB_func)(GLenum, GLuint); -typedef void (*glProgramStringARB_func)(GLenum, GLenum, GLsizei, const GLvoid*); -typedef void (*glProgramLocalParameter4fARB_func)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (*glDeleteProgramsARB_func)(GLsizei, const GLuint*); -typedef void (*glGetProgramivARB_func)(GLenum, GLenum, GLint*); -extern KWIN_EXPORT glCreateShader_func glCreateShader; -extern KWIN_EXPORT glShaderSource_func glShaderSource; -extern KWIN_EXPORT glCompileShader_func glCompileShader; -extern KWIN_EXPORT glDeleteShader_func glDeleteShader; -extern KWIN_EXPORT glCreateProgram_func glCreateProgram; -extern KWIN_EXPORT glAttachShader_func glAttachShader; -extern KWIN_EXPORT glLinkProgram_func glLinkProgram; -extern KWIN_EXPORT glUseProgram_func glUseProgram; -extern KWIN_EXPORT glDeleteProgram_func glDeleteProgram; -extern KWIN_EXPORT glGetShaderInfoLog_func glGetShaderInfoLog; -extern KWIN_EXPORT glGetProgramInfoLog_func glGetProgramInfoLog; -extern KWIN_EXPORT glGetProgramiv_func glGetProgramiv; -extern KWIN_EXPORT glGetShaderiv_func glGetShaderiv; -extern KWIN_EXPORT glUniform1f_func glUniform1f; -extern KWIN_EXPORT glUniform2f_func glUniform2f; -extern KWIN_EXPORT glUniform3f_func glUniform3f; -extern KWIN_EXPORT glUniform4f_func glUniform4f; -extern KWIN_EXPORT glUniform1i_func glUniform1i; -extern KWIN_EXPORT glUniform1fv_func glUniform1fv; -extern KWIN_EXPORT glUniform2fv_func glUniform2fv; -extern KWIN_EXPORT glUniform3fv_func glUniform3fv; -extern KWIN_EXPORT glUniform4fv_func glUniform4fv; -extern KWIN_EXPORT glGetUniformfv_func glGetUniformfv; -extern KWIN_EXPORT glUniformMatrix4fv_func glUniformMatrix4fv; -extern KWIN_EXPORT glValidateProgram_func glValidateProgram; -extern KWIN_EXPORT glGetUniformLocation_func glGetUniformLocation; -extern KWIN_EXPORT glVertexAttrib1f_func glVertexAttrib1f; -extern KWIN_EXPORT glGetAttribLocation_func glGetAttribLocation; -extern KWIN_EXPORT glBindAttribLocation_func glBindAttribLocation; -extern KWIN_EXPORT glGenProgramsARB_func glGenProgramsARB; -extern KWIN_EXPORT glBindProgramARB_func glBindProgramARB; -extern KWIN_EXPORT glProgramStringARB_func glProgramStringARB; -extern KWIN_EXPORT glProgramLocalParameter4fARB_func glProgramLocalParameter4fARB; -extern KWIN_EXPORT glDeleteProgramsARB_func glDeleteProgramsARB; -extern KWIN_EXPORT glGetProgramivARB_func glGetProgramivARB; -// vertex buffer objects -typedef void (*glGenBuffers_func)(GLsizei, GLuint*); -extern KWIN_EXPORT glGenBuffers_func glGenBuffers; -typedef void (*glDeleteBuffers_func)(GLsizei n, const GLuint*); -extern KWIN_EXPORT glDeleteBuffers_func glDeleteBuffers; -typedef void (*glBindBuffer_func)(GLenum, GLuint); -extern KWIN_EXPORT glBindBuffer_func glBindBuffer; -typedef void (*glBufferData_func)(GLenum, GLsizeiptr, const GLvoid*, GLenum); -extern KWIN_EXPORT glBufferData_func glBufferData; -typedef void (*glBufferSubData_func)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -extern KWIN_EXPORT glBufferSubData_func glBufferSubData; -typedef void (*glGetBufferSubData_func)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -extern KWIN_EXPORT glGetBufferSubData_func glGetBufferSubData; -typedef void (*glEnableVertexAttribArray_func)(GLuint); -extern KWIN_EXPORT glEnableVertexAttribArray_func glEnableVertexAttribArray; -typedef void (*glDisableVertexAttribArray_func)(GLuint); -extern KWIN_EXPORT glDisableVertexAttribArray_func glDisableVertexAttribArray; -typedef void (*glVertexAttribPointer_func)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*); -extern KWIN_EXPORT glVertexAttribPointer_func glVertexAttribPointer; -typedef GLvoid *(*glMapBuffer_func)(GLenum target, GLenum access); -extern KWIN_EXPORT glMapBuffer_func glMapBuffer; -typedef GLboolean (*glUnmapBuffer_func)(GLenum target); -extern KWIN_EXPORT glUnmapBuffer_func glUnmapBuffer; - -// GL_ARB_vertex_array_object -typedef void (*glBindVertexArray_func)(GLuint array); -typedef void (*glDeleteVertexArrays_func)(GLsizei n, const GLuint *arrays); -typedef void (*glGenVertexArrays_func)(GLsizei n, GLuint *arrays); -typedef GLboolean (*glIsVertexArray_func)(GLuint array); - -extern KWIN_EXPORT glBindVertexArray_func glBindVertexArray; -extern KWIN_EXPORT glDeleteVertexArrays_func glDeleteVertexArrays; -extern KWIN_EXPORT glGenVertexArrays_func glGenVertexArrays; -extern KWIN_EXPORT glIsVertexArray_func glIsVertexArray; - -// GL_EXT_gpu_shader4 / GL 3.0 -typedef void (*glVertexAttribI1i_func)(GLuint index, GLint x_func); -typedef void (*glVertexAttribI2i_func)(GLuint index, GLint x, GLint y_func); -typedef void (*glVertexAttribI3i_func)(GLuint index, GLint x, GLint y, GLint z_func); -typedef void (*glVertexAttribI4i_func)(GLuint index, GLint x, GLint y, GLint z, GLint w_func); -typedef void (*glVertexAttribI1ui_func)(GLuint index, GLuint x_func); -typedef void (*glVertexAttribI2ui_func)(GLuint index, GLuint x, GLuint y_func); -typedef void (*glVertexAttribI3ui_func)(GLuint index, GLuint x, GLuint y, GLuint z_func); -typedef void (*glVertexAttribI4ui_func)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w_func); -typedef void (*glVertexAttribI1iv_func)(GLuint index, const GLint *v_func); -typedef void (*glVertexAttribI2iv_func)(GLuint index, const GLint *v_func); -typedef void (*glVertexAttribI3iv_func)(GLuint index, const GLint *v_func); -typedef void (*glVertexAttribI4iv_func)(GLuint index, const GLint *v_func); -typedef void (*glVertexAttribI1uiv_func)(GLuint index, const GLuint *v_func); -typedef void (*glVertexAttribI2uiv_func)(GLuint index, const GLuint *v_func); -typedef void (*glVertexAttribI3uiv_func)(GLuint index, const GLuint *v_func); -typedef void (*glVertexAttribI4uiv_func)(GLuint index, const GLuint *v_func); -typedef void (*glVertexAttribI4bv_func)(GLuint index, const GLbyte *v_func); -typedef void (*glVertexAttribI4sv_func)(GLuint index, const GLshort *v_func); -typedef void (*glVertexAttribI4ubv_func)(GLuint index, const GLubyte *v_func); -typedef void (*glVertexAttribI4usv_func)(GLuint index, const GLushort *v_func); -typedef void (*glVertexAttribIPointer_func)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer_func); -typedef void (*glGetVertexAttribIiv_func)(GLuint index, GLenum pname, GLint *params_func); -typedef void (*glGetVertexAttribIuiv_func)(GLuint index, GLenum pname, GLuint *params_func); -typedef void (*glGetUniformuiv_func)(GLuint program, GLint location, GLuint *params); -typedef void (*glBindFragDataLocation_func)(GLuint program, GLuint color, const GLchar *name); -typedef GLint (*glGetFragDataLocation_func)(GLuint program, const GLchar *name); -typedef void (*glUniform1ui_func)(GLint location, GLuint v0); -typedef void (*glUniform2ui_func)(GLint location, GLuint v0, GLuint v1); -typedef void (*glUniform3ui_func)(GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (*glUniform4ui_func)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (*glUniform1uiv_func)(GLint location, GLsizei count, const GLuint *value); -typedef void (*glUniform2uiv_func)(GLint location, GLsizei count, const GLuint *value); -typedef void (*glUniform3uiv_func)(GLint location, GLsizei count, const GLuint *value); - -extern KWIN_EXPORT glVertexAttribI1i_func glVertexAttribI1i; -extern KWIN_EXPORT glVertexAttribI2i_func glVertexAttribI2i; -extern KWIN_EXPORT glVertexAttribI3i_func glVertexAttribI3i; -extern KWIN_EXPORT glVertexAttribI4i_func glVertexAttribI4i; -extern KWIN_EXPORT glVertexAttribI1ui_func glVertexAttribI1ui; -extern KWIN_EXPORT glVertexAttribI2ui_func glVertexAttribI2ui; -extern KWIN_EXPORT glVertexAttribI3ui_func glVertexAttribI3ui; -extern KWIN_EXPORT glVertexAttribI4ui_func glVertexAttribI4ui; -extern KWIN_EXPORT glVertexAttribI1iv_func glVertexAttribI1iv; -extern KWIN_EXPORT glVertexAttribI2iv_func glVertexAttribI2iv; -extern KWIN_EXPORT glVertexAttribI3iv_func glVertexAttribI3iv; -extern KWIN_EXPORT glVertexAttribI4iv_func glVertexAttribI4iv; -extern KWIN_EXPORT glVertexAttribI1uiv_func glVertexAttribI1uiv; -extern KWIN_EXPORT glVertexAttribI2uiv_func glVertexAttribI2uiv; -extern KWIN_EXPORT glVertexAttribI3uiv_func glVertexAttribI3uiv; -extern KWIN_EXPORT glVertexAttribI4uiv_func glVertexAttribI4uiv; -extern KWIN_EXPORT glVertexAttribI4bv_func glVertexAttribI4bv; -extern KWIN_EXPORT glVertexAttribI4sv_func glVertexAttribI4sv; -extern KWIN_EXPORT glVertexAttribI4ubv_func glVertexAttribI4ubv; -extern KWIN_EXPORT glVertexAttribI4usv_func glVertexAttribI4usv; -extern KWIN_EXPORT glVertexAttribIPointer_func glVertexAttribIPointer; -extern KWIN_EXPORT glGetVertexAttribIiv_func glGetVertexAttribIiv; -extern KWIN_EXPORT glGetVertexAttribIuiv_func glGetVertexAttribIuiv; -extern KWIN_EXPORT glGetUniformuiv_func glGetUniformuiv; -extern KWIN_EXPORT glBindFragDataLocation_func glBindFragDataLocation; -extern KWIN_EXPORT glGetFragDataLocation_func glGetFragDataLocation; -extern KWIN_EXPORT glUniform1ui_func glUniform1ui; -extern KWIN_EXPORT glUniform2ui_func glUniform2ui; -extern KWIN_EXPORT glUniform3ui_func glUniform3ui; -extern KWIN_EXPORT glUniform4ui_func glUniform4ui; -extern KWIN_EXPORT glUniform1uiv_func glUniform1uiv; -extern KWIN_EXPORT glUniform2uiv_func glUniform2uiv; -extern KWIN_EXPORT glUniform3uiv_func glUniform3uiv; - -// GL_ARB_map_buffer_range -typedef GLvoid* (*glMapBufferRange_func)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (*glFlushMappedBufferRange_func)(GLenum target, GLintptr offset, GLsizeiptr length); - -extern KWIN_EXPORT glMapBufferRange_func glMapBufferRange; -extern KWIN_EXPORT glFlushMappedBufferRange_func glFlushMappedBufferRange; - -// GL_ARB_robustness -typedef GLenum (*glGetGraphicsResetStatus_func)(); -typedef void (*glReadnPixels_func)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -typedef void (*glGetnUniformfv_func)(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); - -extern KWIN_EXPORT glGetGraphicsResetStatus_func glGetGraphicsResetStatus; -extern KWIN_EXPORT glReadnPixels_func glReadnPixels; -extern KWIN_EXPORT glGetnUniformfv_func glGetnUniformfv; - -// GL_ARB_draw_elements_base_vertex -typedef void (*glDrawElementsBaseVertex_func)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (*glDrawElementsInstancedBaseVertex_func)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); - -extern KWIN_EXPORT glDrawElementsBaseVertex_func glDrawElementsBaseVertex; -extern KWIN_EXPORT glDrawElementsInstancedBaseVertex_func glDrawElementsInstancedBaseVertex; - -// GL_ARB_copy_buffer -typedef void (*glCopyBufferSubData_func)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, - GLintptr writeOffset, GLsizeiptr size); - -extern KWIN_EXPORT glCopyBufferSubData_func glCopyBufferSubData; - -} // namespace - -#endif // not KWIN_HAVE_OPENGLES - -#ifdef KWIN_HAVE_EGL -#define EGL_EGLEXT_PROTOTYPES -#define GL_GLEXT_PROTOTYPES - -#ifdef KWIN_HAVE_OPENGLES -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -// see http://www.khronos.org/registry/gles/extensions/EXT/EXT_robustness.txt -#ifndef GL_GUILTY_CONTEXT_RESET_EXT -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#endif - -#ifndef GL_INNOCENT_CONTEXT_RESET_EXT -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#endif - -#ifndef GL_UNKNOWN_CONTEXT_RESET_EXT -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#endif - -#endif - -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <fixx11h.h> - -#ifndef EGL_POST_SUB_BUFFER_SUPPORTED_NV -#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE -#endif - -#ifndef EGL_BUFFER_AGE_EXT -#define EGL_BUFFER_AGE_EXT 0x313D -#endif - -#ifndef GL_UNPACK_ROW_LENGTH -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#endif - -#ifndef GL_UNPACK_SKIP_ROWS -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#endif - -#ifndef GL_UNPACK_SKIP_PIXELS -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#endif - -#ifndef EGL_KHR_create_context -#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION -#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB -#define EGL_CONTEXT_FLAGS_KHR 0x30FC -#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD -#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD -#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE -#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF -#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 -#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 -#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 -#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 -#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 -#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 -#endif - -#ifndef __gl3_h_ -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_TEXTURE_3D 0x806F -#define GL_TEXTURE_WRAP_R 0x8072 -#endif - -namespace KWin -{ - -void KWIN_EXPORT eglResolveFunctions(); -void KWIN_EXPORT glResolveFunctions(OpenGLPlatformInterface platformInterface); - -// EGL -typedef EGLImageKHR(*eglCreateImageKHR_func)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*); -typedef EGLBoolean(*eglDestroyImageKHR_func)(EGLDisplay, EGLImageKHR); -typedef EGLBoolean (*eglPostSubBufferNV_func)(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -extern KWIN_EXPORT eglCreateImageKHR_func eglCreateImageKHR; -extern KWIN_EXPORT eglDestroyImageKHR_func eglDestroyImageKHR; -extern KWIN_EXPORT eglPostSubBufferNV_func eglPostSubBufferNV; - -// GLES -typedef GLvoid(*glEGLImageTargetTexture2DOES_func)(GLenum, GLeglImageOES); -extern KWIN_EXPORT glEGLImageTargetTexture2DOES_func glEGLImageTargetTexture2DOES; - - -#ifdef KWIN_HAVE_OPENGLES - -// GL_OES_mapbuffer -typedef GLvoid *(*glMapBuffer_func)(GLenum target, GLenum access); -typedef GLboolean (*glUnmapBuffer_func)(GLenum target); -typedef void (*glGetBufferPointerv_func)(GLenum target, GLenum pname, GLvoid **params); - -extern KWIN_EXPORT glMapBuffer_func glMapBuffer; -extern KWIN_EXPORT glUnmapBuffer_func glUnmapBuffer; -extern KWIN_EXPORT glGetBufferPointerv_func glGetBufferPointerv; - -// GL_OES_texture_3D -typedef GLvoid(*glTexImage3DOES_func)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*); -extern KWIN_EXPORT glTexImage3DOES_func glTexImage3D; - -// GL_EXT_map_buffer_range -typedef GLvoid *(*glMapBufferRange_func)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (*glFlushMappedBufferRange_func)(GLenum target, GLintptr offset, GLsizeiptr length); - -extern KWIN_EXPORT glMapBufferRange_func glMapBufferRange; -extern KWIN_EXPORT glFlushMappedBufferRange_func glFlushMappedBufferRange; - -// GL_EXT_robustness -typedef GLenum (*glGetGraphicsResetStatus_func)(); -typedef void (*glReadnPixels_func)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -typedef void (*glGetnUniformfv_func)(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); - -extern KWIN_EXPORT glGetGraphicsResetStatus_func glGetGraphicsResetStatus; -extern KWIN_EXPORT glReadnPixels_func glReadnPixels; -extern KWIN_EXPORT glGetnUniformfv_func glGetnUniformfv; - -#endif // KWIN_HAVE_OPENGLES - -} // namespace - -#endif // KWIN_HAVE_EGL - -#endif // KWIN_GLUTILS_FUNCS_H diff --git a/kwin/main.cpp b/kwin/main.cpp index 498541a6..5ebb1047 100644 --- a/kwin/main.cpp +++ b/kwin/main.cpp @@ -488,7 +488,7 @@ int main(int argc, char * argv[]) // "!= XRender" is intended since eg. pot. SW backends likely would profit from raster as well KConfigGroup config(KSharedConfig::openConfig("kwinrc"), "Compositing"); QString preferredSystem("native"); - if (config.readEntry("Enabled", true) && config.readEntry("Backend", "OpenGL") != "XRender") + if (config.readEntry("Enabled", true) && config.readEntry("Backend", "XRender") != "XRender") preferredSystem = ""; QApplication::setGraphicsSystem(config.readEntry("GraphicsSystem", preferredSystem)); diff --git a/kwin/opengltest/CMakeLists.txt b/kwin/opengltest/CMakeLists.txt deleted file mode 100644 index 85df5381..00000000 --- a/kwin/opengltest/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -########### next target ############### - -set(kwin_opengl_test_SRCS opengltest.cpp ) - -add_executable(kwin_opengl_test ${kwin_opengl_test_SRCS}) - -target_link_libraries(kwin_opengl_test ${X11_LIBRARIES} ${OPENGL_gl_LIBRARY}) - -install(TARGETS kwin_opengl_test DESTINATION ${LIBEXEC_INSTALL_DIR} ) - diff --git a/kwin/opengltest/opengltest.cpp b/kwin/opengltest/opengltest.cpp deleted file mode 100644 index c4aa3b20..00000000 --- a/kwin/opengltest/opengltest.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#include <X11/Xlib.h> -#include <GL/glx.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -// Command to get Catalyst release version string -// The output is similar as "String: 9.00-120629n-045581E-ATI" -#define SHELL_COMMAND "aticonfig --get-pcs-key=LDC,ReleaseVersion" - -static bool getCatalystVersion(int *first, int *second) -{ - FILE *fp = NULL; - - fp = popen(SHELL_COMMAND, "r"); - - if (!fp) - return false; - - fscanf(fp, "String: %d.%d", first, second); - - if (pclose(fp) != 0) - return false; - - return true; -} - -// Return 0 if we can use a direct context, 1 otherwise -int main() -{ - Display *dpy = XOpenDisplay(0); - - int error_base, event_base; - if (!glXQueryExtension(dpy, &error_base, &event_base)) - return 1; - - int major, minor; - if (!glXQueryVersion(dpy, &major, &minor)) - return 1; - - int attribs[] = { - GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - None, - None - }; - - // Try to find an RGBA visual - XVisualInfo *xvi = glXChooseVisual(dpy, DefaultScreen(dpy), attribs); - if (!xvi) { - // Try again for a doubled buffered visual - attribs[sizeof(attribs) / sizeof(int) - 2] = GLX_DOUBLEBUFFER; - xvi = glXChooseVisual(dpy, DefaultScreen(dpy), attribs); - } - - if (!xvi) - return 1; - - // Create a direct rendering context - GLXContext ctx = glXCreateContext(dpy, xvi, NULL, True); - if (!glXIsDirect(dpy, ctx)) - return 1; - - // Create a window using the visual. - // We only need it to make the context current - XSetWindowAttributes attr; - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), xvi->visual, AllocNone); - Window win = XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, - xvi->depth, InputOutput, xvi->visual, - CWBackPixel | CWBorderPixel | CWColormap, &attr); - - // Try to make the context current - if (!glXMakeCurrent(dpy, win, ctx)) - return 1; - - // glXCreatePixmap() is a GLX 1.3+ function, but it's also provided by EXT_texture_from_pixmap - const char *glxExtensions = glXQueryExtensionsString(dpy, DefaultScreen(dpy)); - if ((major == 1 && minor < 3) && !strstr(glxExtensions, "GLX_EXT_texture_from_pixmap")) - return 1; - - // Assume that all Mesa drivers support direct rendering - const GLubyte *version = glGetString(GL_VERSION); - if (strstr((const char *)version, "Mesa")) - return 0; - - // Direct contexts also work with the NVidia driver - const GLubyte *vendor = glGetString(GL_VENDOR); - if (strstr((const char *)vendor, "NVIDIA")) - return 0; - - // Enable direct rendering for AMD Catalyst driver 8.973/8.98 and later. There are - // three kinds of Catalyst releases, major, minor and point releses. For example, - // 8.98 is one major release, 8.981 is one minor release based on 8.98, and 8.981.1 - // is one point release based on 8.981, 8.98.1 is one point release based on 8.98 - if (strstr((const char *)vendor, "ATI") || strstr((const char *)vendor, "AMD")) { - int first = 0, second = 0; - if (getCatalystVersion(&first, &second)) - if ((first > 8) || // 9.xx and future releases - ((first == 8) && (second >= 98) && (second < 100)) || // 8.xx and 8.xx.z - ((first == 8) && (second >= 973))) //8.xxy and 8.xxy.z - return 0; - } - - // Direct context also works with VirtualBox's driver - const GLubyte *renderer = glGetString(GL_RENDERER); - if (strstr((const char *)vendor, "Humper") && strstr((const char *)renderer, "Chromium")) - return 0; - - return 1; -} - diff --git a/kwin/options.cpp b/kwin/options.cpp index b5561301..e0ae5763 100644 --- a/kwin/options.cpp +++ b/kwin/options.cpp @@ -35,17 +35,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <klocale.h> #include "client.h" -#include "compositingprefs.h" #include "settings.h" #include "xcbutils.h" -#include <kwinglplatform.h> #include <X11/extensions/Xrandr.h> -#ifndef KWIN_HAVE_OPENGLES -#ifndef KWIN_NO_XF86VM -#include <X11/extensions/xf86vmode.h> -#endif -#endif #endif //KCMRULES @@ -59,46 +52,6 @@ int currentRefreshRate() int rate = -1; if (options->refreshRate() > 0) // use manually configured refresh rate rate = options->refreshRate(); -#ifndef KWIN_HAVE_OPENGLES - else if (GLPlatform::instance()->driver() == Driver_NVidia) { -#ifndef KWIN_NO_XF86VM - int major, event, error; - if (XQueryExtension(display(), "XFree86-VidModeExtension", &major, &event, &error)) { - XF86VidModeModeLine modeline; - int dotclock, vtotal; - if (XF86VidModeGetModeLine(display(), 0, &dotclock, &modeline)) { - vtotal = modeline.vtotal; - if (modeline.flags & 0x0010) // V_INTERLACE - dotclock *= 2; - if (modeline.flags & 0x0020) // V_DBLSCAN - vtotal *= 2; - if (modeline.htotal*vtotal) // BUG 313996 - rate = 1000*dotclock/(modeline.htotal*vtotal); // WTF was wikipedia 1998 when I nedded it? - kDebug(1212) << "Vertical Refresh Rate (as detected by XF86VM): " << rate << "Hz"; - } - } - if (rate < 1) -#endif - { // modeline approach failed - QProcess nvidia_settings; - QStringList env = QProcess::systemEnvironment(); - env << "LC_ALL=C"; - nvidia_settings.setEnvironment(env); - nvidia_settings.start("nvidia-settings", QStringList() << "-t" << "-q" << "RefreshRate", QIODevice::ReadOnly); - nvidia_settings.waitForFinished(); - if (nvidia_settings.exitStatus() == QProcess::NormalExit) { - QString reply = QString::fromLocal8Bit(nvidia_settings.readAllStandardOutput()).split(' ').first(); - bool ok; - float frate = QLocale::c().toFloat(reply, &ok); - if (!ok) - rate = -1; - else - rate = qRound(frate); - kDebug(1212) << "Vertical Refresh Rate (as detected by nvidia-settings): " << rate << "Hz"; - } - } - } -#endif else if (Xcb::Extensions::self()->isRandrAvailable()) { XRRScreenConfiguration *config = XRRGetScreenInfo(display(), rootWindow()); rate = XRRConfigCurrentRate(config); @@ -147,18 +100,10 @@ Options::Options(QObject *parent) , m_compositingInitialized(Options::defaultCompositingInitialized()) , m_hiddenPreviews(Options::defaultHiddenPreviews()) , m_unredirectFullscreen(Options::defaultUnredirectFullscreen()) - , m_glSmoothScale(Options::defaultGlSmoothScale()) - , m_colorCorrected(Options::defaultColorCorrected()) , m_xrenderSmoothScale(Options::defaultXrenderSmoothScale()) , m_maxFpsInterval(Options::defaultMaxFpsInterval()) , m_refreshRate(Options::defaultRefreshRate()) , m_vBlankTime(Options::defaultVBlankTime()) - , m_glDirect(Options::defaultGlDirect()) - , m_glStrictBinding(Options::defaultGlStrictBinding()) - , m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver()) - , m_glLegacy(Options::defaultGlLegacy()) - , m_glCoreProfile(Options::defaultGLCoreProfile()) - , m_glPreferBufferSwap(Options::defaultGlPreferBufferSwap()) , OpTitlebarDblClick(Options::defaultOperationTitlebarDblClick()) , CmdActiveTitlebar1(Options::defaultCommandActiveTitlebar1()) , CmdActiveTitlebar2(Options::defaultCommandActiveTitlebar2()) @@ -651,36 +596,13 @@ void Options::setHiddenPreviews(int hiddenPreviews) void Options::setUnredirectFullscreen(bool unredirectFullscreen) { - if (GLPlatform::instance()->driver() == Driver_Intel) - unredirectFullscreen = false; // bug #252817 if (m_unredirectFullscreen == unredirectFullscreen) { return; } - if (GLPlatform::instance()->driver() == Driver_Intel) { // write back the value - KConfigGroup(KGlobal::config(), "Compositing").writeEntry("UnredirectFullscreen", false); - } m_unredirectFullscreen = unredirectFullscreen; emit unredirectFullscreenChanged(); } -void Options::setGlSmoothScale(int glSmoothScale) -{ - if (m_glSmoothScale == glSmoothScale) { - return; - } - m_glSmoothScale = glSmoothScale; - emit glSmoothScaleChanged(); -} - -void Options::setColorCorrected(bool colorCorrected) -{ - if (m_colorCorrected == colorCorrected) { - return; - } - m_colorCorrected = colorCorrected; - emit colorCorrectedChanged(); -} - void Options::setXrenderSmoothScale(bool xrenderSmoothScale) { if (m_xrenderSmoothScale == xrenderSmoothScale) { @@ -717,69 +639,6 @@ void Options::setVBlankTime(qint64 vBlankTime) emit vBlankTimeChanged(); } -void Options::setGlDirect(bool glDirect) -{ - if (m_glDirect == glDirect) { - return; - } - m_glDirect = glDirect; - emit glDirectChanged(); -} - -void Options::setGlStrictBinding(bool glStrictBinding) -{ - if (m_glStrictBinding == glStrictBinding) { - return; - } - m_glStrictBinding = glStrictBinding; - emit glStrictBindingChanged(); -} - -void Options::setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver) -{ - if (m_glStrictBindingFollowsDriver == glStrictBindingFollowsDriver) { - return; - } - m_glStrictBindingFollowsDriver = glStrictBindingFollowsDriver; - emit glStrictBindingFollowsDriverChanged(); -} - -void Options::setGlLegacy(bool glLegacy) -{ - if (m_glLegacy == glLegacy) { - return; - } - m_glLegacy = glLegacy; - emit glLegacyChanged(); -} - -void Options::setGLCoreProfile(bool value) -{ - if (m_glCoreProfile == value) { - return; - } - m_glCoreProfile = value; - emit glCoreProfileChanged(); -} - -void Options::setGlPreferBufferSwap(char glPreferBufferSwap) -{ - if (glPreferBufferSwap == 'a') { - // buffer cpying is very fast with the nvidia blob - // but due to restrictions in DRI2 *incredibly* slow for all MESA drivers - // see http://www.x.org/releases/X11R7.7/doc/dri2proto/dri2proto.txt, item 2.5 - if (GLPlatform::instance()->driver() == Driver_NVidia) - glPreferBufferSwap = CopyFrontBuffer; - else if (GLPlatform::instance()->driver() != Driver_Unknown) // undetected, finally resolved when context is initialized - glPreferBufferSwap = ExtendDamage; - } - if (m_glPreferBufferSwap == (GlSwapStrategy)glPreferBufferSwap) { - return; - } - m_glPreferBufferSwap = (GlSwapStrategy)glPreferBufferSwap; - emit glPreferBufferSwapChanged(); -} - void Options::reparseConfiguration() { KGlobal::config()->reparseConfiguration(); @@ -892,19 +751,12 @@ bool Options::loadCompositingConfig (bool force) bool useCompositing = false; CompositingType compositingMode = NoCompositing; - QString compositingBackend = config.readEntry("Backend", "OpenGL"); + QString compositingBackend = config.readEntry("Backend", "XRender"); if (compositingBackend == "XRender") compositingMode = XRenderCompositing; - else - compositingMode = OpenGLCompositing; if (const char *c = getenv("KWIN_COMPOSE")) { switch(c[0]) { - case 'O': - kDebug(1212) << "Compositing forced to OpenGL mode by environment variable"; - compositingMode = OpenGLCompositing; - useCompositing = true; - break; case 'X': kDebug(1212) << "Compositing forced to XRender mode by environment variable"; compositingMode = XRenderCompositing; @@ -946,34 +798,9 @@ void Options::reloadCompositingSettings(bool force) // see Workspace::setupCompositing(), composite.cpp setCompositingInitialized(true); - // Compositing settings - CompositingPrefs prefs; - if (compositingMode() == OpenGLCompositing) { - prefs.detect(); - } - KSharedConfig::Ptr _config = KGlobal::config(); KConfigGroup config(_config, "Compositing"); - setGlDirect(prefs.enableDirectRendering()); - setGlSmoothScale(qBound(-1, config.readEntry("GLTextureFilter", Options::defaultGlSmoothScale()), 2)); - setGlStrictBindingFollowsDriver(!config.hasKey("GLStrictBinding")); - if (!isGlStrictBindingFollowsDriver()) { - setGlStrictBinding(config.readEntry("GLStrictBinding", Options::defaultGlStrictBinding())); - } - setGlLegacy(config.readEntry("GLLegacy", Options::defaultGlLegacy())); - setGLCoreProfile(config.readEntry("GLCore", Options::defaultGLCoreProfile())); - - char c = 0; - const QString s = config.readEntry("GLPreferBufferSwap", QString(Options::defaultGlPreferBufferSwap())); - if (!s.isEmpty()) - c = s.at(0).toAscii(); - if (c != 'a' && c != 'c' && c != 'p' && c != 'e') - c = 0; - setGlPreferBufferSwap(c); - - setColorCorrected(config.readEntry("GLColorCorrection", Options::defaultColorCorrected())); - m_xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false); HiddenPreviews previews = Options::defaultHiddenPreviews(); diff --git a/kwin/options.h b/kwin/options.h index 3ac9947b..3d03c859 100644 --- a/kwin/options.h +++ b/kwin/options.h @@ -34,15 +34,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. namespace KWin { -class Client; -class CompositingPrefs; class Settings; class Options : public QObject, public KDecorationOptions { Q_OBJECT Q_ENUMS(FocusPolicy) - Q_ENUMS(GlSwapStrategy) Q_ENUMS(MouseCommand) Q_ENUMS(MouseWheelCommand) @@ -165,26 +162,10 @@ class Options : public QObject, public KDecorationOptions * 2 = try trilinear when transformed; else 1, * -1 = auto **/ - Q_PROPERTY(int glSmoothScale READ glSmoothScale WRITE setGlSmoothScale NOTIFY glSmoothScaleChanged) - Q_PROPERTY(bool colorCorrected READ isColorCorrected WRITE setColorCorrected NOTIFY colorCorrectedChanged) Q_PROPERTY(bool xrenderSmoothScale READ isXrenderSmoothScale WRITE setXrenderSmoothScale NOTIFY xrenderSmoothScaleChanged) Q_PROPERTY(qint64 maxFpsInterval READ maxFpsInterval WRITE setMaxFpsInterval NOTIFY maxFpsIntervalChanged) Q_PROPERTY(uint refreshRate READ refreshRate WRITE setRefreshRate NOTIFY refreshRateChanged) Q_PROPERTY(qint64 vBlankTime READ vBlankTime WRITE setVBlankTime NOTIFY vBlankTimeChanged) - Q_PROPERTY(bool glDirect READ isGlDirect WRITE setGlDirect NOTIFY glDirectChanged) - Q_PROPERTY(bool glStrictBinding READ isGlStrictBinding WRITE setGlStrictBinding NOTIFY glStrictBindingChanged) - /** - * Whether strict binding follows the driver or has been overwritten by a user defined config value. - * If @c true @link glStrictBinding is set by the OpenGL Scene during initialization. - * If @c false @link glStrictBinding is set from a config value and not updated during scene initialization. - **/ - Q_PROPERTY(bool glStrictBindingFollowsDriver READ isGlStrictBindingFollowsDriver WRITE setGlStrictBindingFollowsDriver NOTIFY glStrictBindingFollowsDriverChanged) - /** - * Whether legacy OpenGL should be used or OpenGL (ES) 2 - **/ - Q_PROPERTY(bool glLegacy READ isGlLegacy WRITE setGlLegacy NOTIFY glLegacyChanged) - Q_PROPERTY(bool glCoreProfile READ glCoreProfile WRITE setGLCoreProfile NOTIFY glCoreProfileChanged) - Q_PROPERTY(GlSwapStrategy glPreferBufferSwap READ glPreferBufferSwap WRITE setGlPreferBufferSwap NOTIFY glPreferBufferSwapChanged) public: explicit Options(QObject *parent = NULL); @@ -502,16 +483,6 @@ public: bool isUnredirectFullscreen() const { return m_unredirectFullscreen; } - // OpenGL - // 0 = no, 1 = yes when transformed, - // 2 = try trilinear when transformed; else 1, - // -1 = auto - int glSmoothScale() const { - return m_glSmoothScale; - } - bool isColorCorrected() const { - return m_colorCorrected; - } // XRender bool isXrenderSmoothScale() const { return m_xrenderSmoothScale; @@ -527,26 +498,6 @@ public: qint64 vBlankTime() const { return m_vBlankTime; } - bool isGlDirect() const { - return m_glDirect; - } - bool isGlStrictBinding() const { - return m_glStrictBinding; - } - bool isGlStrictBindingFollowsDriver() const { - return m_glStrictBindingFollowsDriver; - } - bool isGlLegacy() const { - return m_glLegacy; - } - bool glCoreProfile() const { - return m_glCoreProfile; - } - - enum GlSwapStrategy { NoSwapEncourage = 0, CopyFrontBuffer = 'c', PaintFullScreen = 'p', ExtendDamage = 'e', AutoSwapStrategy = 'a' }; - GlSwapStrategy glPreferBufferSwap() const { - return m_glPreferBufferSwap; - } // setters void setFocusPolicy(FocusPolicy focusPolicy); @@ -598,17 +549,10 @@ public: void setCompositingInitialized(bool compositingInitialized); void setHiddenPreviews(int hiddenPreviews); void setUnredirectFullscreen(bool unredirectFullscreen); - void setGlSmoothScale(int glSmoothScale); void setXrenderSmoothScale(bool xrenderSmoothScale); void setMaxFpsInterval(qint64 maxFpsInterval); void setRefreshRate(uint refreshRate); void setVBlankTime(qint64 vBlankTime); - void setGlDirect(bool glDirect); - void setGlStrictBinding(bool glStrictBinding); - void setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver); - void setGlLegacy(bool glLegacy); - void setGLCoreProfile(bool glCoreProfile); - void setGlPreferBufferSwap(char glPreferBufferSwap); // default values static WindowOperation defaultOperationTitlebarDblClick() { @@ -666,7 +610,7 @@ public: return true; } static CompositingType defaultCompositingMode() { - return OpenGLCompositing; + return XRenderCompositing; } static bool defaultUseCompositing() { return true; @@ -680,12 +624,6 @@ public: static bool defaultUnredirectFullscreen() { return false; } - static int defaultGlSmoothScale() { - return 2; - } - static bool defaultColorCorrected() { - return false; - } static bool defaultXrenderSmoothScale() { return false; } @@ -701,24 +639,6 @@ public: static uint defaultVBlankTime() { return 6000; // 6ms } - static bool defaultGlDirect() { - return true; - } - static bool defaultGlStrictBinding() { - return true; - } - static bool defaultGlStrictBindingFollowsDriver() { - return true; - } - static bool defaultGlLegacy() { - return false; - } - static bool defaultGLCoreProfile() { - return false; - } - static GlSwapStrategy defaultGlPreferBufferSwap() { - return AutoSwapStrategy; - } static int defaultAnimationSpeed() { return 3; } @@ -728,7 +648,7 @@ public: **/ unsigned long loadConfig(); /** - * Performs loading of compositing settings which do not depend on OpenGL. + * Performs loading of compositing settings **/ bool loadCompositingConfig(bool force); void reparseConfiguration(); @@ -787,21 +707,10 @@ Q_SIGNALS: void compositingInitializedChanged(); void hiddenPreviewsChanged(); void unredirectFullscreenChanged(); - void glSmoothScaleChanged(); - void colorCorrectedChanged(); void xrenderSmoothScaleChanged(); void maxFpsIntervalChanged(); void refreshRateChanged(); void vBlankTimeChanged(); - void glDirectChanged(); - void glStrictBindingChanged(); - void glStrictBindingFollowsDriverChanged(); - void glLegacyChanged(); - void glCoreProfileChanged(); - void glPreferBufferSwapChanged(); - -public Q_SLOTS: - void setColorCorrected(bool colorCorrected = false); private: void setElectricBorders(int borders); @@ -836,19 +745,11 @@ private: bool m_compositingInitialized; HiddenPreviews m_hiddenPreviews; bool m_unredirectFullscreen; - int m_glSmoothScale; - bool m_colorCorrected; bool m_xrenderSmoothScale; qint64 m_maxFpsInterval; // Settings that should be auto-detected uint m_refreshRate; qint64 m_vBlankTime; - bool m_glDirect; - bool m_glStrictBinding; - bool m_glStrictBindingFollowsDriver; - bool m_glLegacy; - bool m_glCoreProfile; - GlSwapStrategy m_glPreferBufferSwap; WindowOperation OpTitlebarDblClick; diff --git a/kwin/org.kde.KWin.xml b/kwin/org.kde.KWin.xml index cf76c0a7..00a112a6 100644 --- a/kwin/org.kde.KWin.xml +++ b/kwin/org.kde.KWin.xml @@ -80,16 +80,10 @@ <method name="compositingNotPossibleReason"> <arg type="s" direction="out"/> </method> - <method name="openGLIsBroken"> - <arg type="b" direction="out"/> - </method> <method name="compositingType"> <!-- none: No Compositing xrender: XRender - gl1: OpenGL 1 - gl2: OpenGL 2 - gles: OpenGL ES 2 --> <arg type="s" direction="out"/> </method> diff --git a/kwin/org.kde.kwin.Compositing.xml b/kwin/org.kde.kwin.Compositing.xml index ed83fd02..af367ad5 100644 --- a/kwin/org.kde.kwin.Compositing.xml +++ b/kwin/org.kde.kwin.Compositing.xml @@ -4,7 +4,6 @@ <property name="active" type="b" access="read"/> <property name="compositingPossible" type="b" access="read"/> <property name="compositingNotPossibleReason" type="s" access="read"/> - <property name="openGLIsBroken" type="b" access="read"/> <property name="compositingType" type="s" access="read"/> <signal name="compositingToggled"> <arg name="active" type="b" direction="out"/> diff --git a/kwin/paintredirector.cpp b/kwin/paintredirector.cpp index 4c168527..370c4663 100644 --- a/kwin/paintredirector.cpp +++ b/kwin/paintredirector.cpp @@ -28,8 +28,6 @@ DEALINGS IN THE SOFTWARE. #include "client.h" #include "deleted.h" #include "effects.h" -#include <kwinglplatform.h> -#include <kwinglutils.h> #include <kwinxrenderutils.h> #include <kdebug.h> #include <QPaintEngine> @@ -42,14 +40,10 @@ namespace KWin PaintRedirector *PaintRedirector::create(Client *c, QWidget *widget) { - if (effects->isOpenGLCompositing()) { - return new OpenGLPaintRedirector(c, widget); - } else { - if (!Extensions::nonNativePixmaps()) { - return new NativeXRenderPaintRedirector(c, widget); - } - return new RasterXRenderPaintRedirector(c, widget); + if (!Extensions::nonNativePixmaps()) { + return new NativeXRenderPaintRedirector(c, widget); } + return new RasterXRenderPaintRedirector(c, widget); } PaintRedirector::PaintRedirector(Client *c, QWidget* w) @@ -242,12 +236,6 @@ void PaintRedirector::resizePixmaps(const QRect *rects) } } -GLTexture *PaintRedirector::texture(PaintRedirector::DecorationPixmap border) const -{ - Q_UNUSED(border) - return NULL; -} - xcb_render_picture_t PaintRedirector::picture(PaintRedirector::DecorationPixmap border) const { Q_UNUSED(border) @@ -307,94 +295,9 @@ void ImageBasedPaintRedirector::discardScratch() } - // ------------------------------------------------------------------ -OpenGLPaintRedirector::OpenGLPaintRedirector(Client *c, QWidget *widget) - : ImageBasedPaintRedirector(c, widget) -{ - for (int i = 0; i < TextureCount; ++i) - m_textures[i] = NULL; - - PaintRedirector::resizePixmaps(); -} - -OpenGLPaintRedirector::~OpenGLPaintRedirector() -{ - for (int i = 0; i < TextureCount; ++i) - delete m_textures[i]; -} - -void OpenGLPaintRedirector::resizePixmaps(const QRect *rects) -{ - QSize size[2]; - size[LeftRight] = QSize(rects[LeftPixmap].width() + rects[RightPixmap].width(), - align(qMax(rects[LeftPixmap].height(), rects[RightPixmap].height()), 128)); - size[TopBottom] = QSize(align(qMax(rects[TopPixmap].width(), rects[BottomPixmap].width()), 128), - rects[TopPixmap].height() + rects[BottomPixmap].height()); - - if (!GLTexture::NPOTTextureSupported()) { - for (int i = 0; i < 2; i++) { - size[i].rwidth() = nearestPowerOfTwo(size[i].width()); - size[i].rheight() = nearestPowerOfTwo(size[i].height()); - } - } - - for (int i = 0; i < 2; i++) { - if (m_textures[i] && m_textures[i]->size() == size[i]) - continue; - - delete m_textures[i]; - m_textures[i] = NULL; - - if (size[i].isEmpty()) - continue; - - m_textures[i] = new GLTexture(size[i].width(), size[i].height()); - m_textures[i]->setYInverted(true); - m_textures[i]->setWrapMode(GL_CLAMP_TO_EDGE); - m_textures[i]->clear(); - } -} - -void OpenGLPaintRedirector::preparePaint(const QPixmap &pending) -{ - m_tempImage = pending.toImage(); -} - -void OpenGLPaintRedirector::updatePixmaps(const QRect *rects, const QRegion ®ion) -{ - const QImage &image = scratchImage(); - const QRect bounding = region.boundingRect(); - - const int leftWidth = rects[LeftPixmap].width(); - const int topHeight = rects[TopPixmap].height(); - - // Top, Right, Bottom, Left - GLTexture *textures[4] = { m_textures[TopBottom], m_textures[LeftRight], m_textures[TopBottom], m_textures[LeftRight] }; - QPoint offsets[4] = { QPoint(0, 0), QPoint(leftWidth, 0), QPoint(0, topHeight), QPoint(0, 0) }; - - for (int i = 0; i < 4; i++) { - const QRect dirty = (region & rects[i]).boundingRect(); - if (!textures[i] || dirty.isEmpty()) - continue; - - const QPoint dst = dirty.topLeft() - rects[i].topLeft() + offsets[i]; - const QRect src(dirty.topLeft() - bounding.topLeft(), dirty.size()); - - textures[i]->update(image, dst, src); - } -} - - - - -// ------------------------------------------------------------------ - - - - RasterXRenderPaintRedirector::RasterXRenderPaintRedirector(Client *c, QWidget *widget) : ImageBasedPaintRedirector(c, widget) , m_gc(0) diff --git a/kwin/paintredirector.h b/kwin/paintredirector.h index be96f051..97cb998e 100644 --- a/kwin/paintredirector.h +++ b/kwin/paintredirector.h @@ -40,7 +40,6 @@ namespace KWin class Client; class Deleted; class XRenderPicture; -class GLTexture; // This class redirects all painting of a given widget (including its children) // into a paint device (QPixmap). @@ -91,7 +90,6 @@ public slots: protected: PaintRedirector(Client *c, QWidget* widget); virtual xcb_render_picture_t picture(DecorationPixmap border) const; - virtual GLTexture *texture(DecorationPixmap border) const; virtual void resizePixmaps(const QRect *rects); virtual void resize(DecorationPixmap border, const QSize &size); virtual void preparePaint(const QPixmap &pending); @@ -136,29 +134,6 @@ private: QImage m_scratchImage; }; -class OpenGLPaintRedirector : public ImageBasedPaintRedirector -{ - Q_OBJECT - - enum Texture { LeftRight = 0, TopBottom, TextureCount }; - -public: - OpenGLPaintRedirector(Client *c, QWidget *widget); - virtual ~OpenGLPaintRedirector(); - - GLTexture *leftRightTexture() const { return m_textures[LeftRight]; } - GLTexture *topBottomTexture() const { return m_textures[TopBottom]; } - -protected: - virtual void resizePixmaps(const QRect *rects); - virtual void updatePixmaps(const QRect *rects, const QRegion ®ion); - virtual void preparePaint(const QPixmap &pending); - -private: - QImage m_tempImage; - GLTexture *m_textures[2]; -}; - class NativeXRenderPaintRedirector : public PaintRedirector { Q_OBJECT @@ -199,34 +174,6 @@ private: QImage m_tempImage; }; -template <> -inline -GLTexture *PaintRedirector::bottomDecoPixmap() const -{ - return texture(BottomPixmap); -} - -template <> -inline -GLTexture *PaintRedirector::leftDecoPixmap() const -{ - return texture(LeftPixmap); -} - -template <> -inline -GLTexture *PaintRedirector::rightDecoPixmap() const -{ - return texture(RightPixmap); -} - -template <> -inline -GLTexture *PaintRedirector::topDecoPixmap() const -{ - return texture(TopPixmap); -} - template <> inline xcb_render_picture_t PaintRedirector::bottomDecoPixmap() const diff --git a/kwin/resources.qrc b/kwin/resources.qrc deleted file mode 100644 index 58e6f333..00000000 --- a/kwin/resources.qrc +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/resources"> - <file>shaders/1.10/lanczos-fragment.glsl</file> - <file>shaders/1.10/scene-vertex.glsl</file> - <file>shaders/1.10/scene-fragment.glsl</file> - <file>shaders/1.10/scene-color-vertex.glsl</file> - <file>shaders/1.10/scene-color-fragment.glsl</file> - <file>shaders/1.10/scene-generic-vertex.glsl</file> - - <file>shaders/1.40/lanczos-fragment.glsl</file> - <file>shaders/1.40/scene-vertex.glsl</file> - <file>shaders/1.40/scene-fragment.glsl</file> - <file>shaders/1.40/scene-color-vertex.glsl</file> - <file>shaders/1.40/scene-color-fragment.glsl</file> - <file>shaders/1.40/scene-generic-vertex.glsl</file> - </qresource> -</RCC> diff --git a/kwin/scene.cpp b/kwin/scene.cpp index 2929f85d..7ebb5da6 100644 --- a/kwin/scene.cpp +++ b/kwin/scene.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* The base class for compositing, implementing shared functionality - between the OpenGL and XRender backends. + between the OpenGL (that is no more) and XRender backends. Design: @@ -254,10 +254,7 @@ void Scene::paintSimpleScreen(int orig_mask, QRegion region) QRegion dirtyArea = region; bool opaqueFullscreen(false); - for (int i = 0; // do prePaintWindow bottom to top - i < stacking_order.count(); - ++i) { - Window* w = stacking_order[ i ]; + foreach (Window *w, stacking_order) { // do prePaintWindow bottom to top Toplevel* topw = w->window(); WindowPrePaintData data; data.mask = orig_mask | (w->isOpaque() ? PAINT_WINDOW_OPAQUE : PAINT_WINDOW_TRANSLUCENT); @@ -469,7 +466,7 @@ void Scene::paintWindowThumbnails(Scene::Window *w, QRegion region, qreal opacit y += (thumb->y()-visualThumbRect.y())*thumbData.yScale(); thumbData.setXTranslation(x); thumbData.setYTranslation(y); - int thumbMask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS; + int thumbMask = PAINT_WINDOW_TRANSFORMED; if (thumbData.opacity() == 1.0) { thumbMask |= PAINT_WINDOW_OPAQUE; } else { diff --git a/kwin/scene.h b/kwin/scene.h index 9ddae938..f2c666f6 100644 --- a/kwin/scene.h +++ b/kwin/scene.h @@ -92,10 +92,6 @@ public: PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS = 1 << 5, // Clear whole background as the very first step, without optimizing it PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6, - // PAINT_DECORATION_ONLY = 1 << 7 has been removed - // Window will be painted with a lanczos filter. - PAINT_WINDOW_LANCZOS = 1 << 8 - // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed }; // types of filtering available enum ImageFilterType { ImageFilterFast, ImageFilterGood }; diff --git a/kwin/scene_opengl.cpp b/kwin/scene_opengl.cpp deleted file mode 100644 index 5c293ec3..00000000 --- a/kwin/scene_opengl.cpp +++ /dev/null @@ -1,2569 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org> -Copyright (C) 2009, 2010, 2011 Martin Gräßlin <mgraesslin@kde.org> - -Based on glcompmgr code by Felix Bellaby. -Using code from Compiz and Beryl. - -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 "scene_opengl.h" -#ifdef KWIN_HAVE_EGL -#include "eglonxbackend.h" -// for Wayland -#include "config-workspace.h" -#endif -#ifndef KWIN_HAVE_OPENGLES -#include "glxbackend.h" -#endif - -#include <kxerrorhandler.h> - -#include <kwinglcolorcorrection.h> -#include <kwinglplatform.h> - -#include "utils.h" -#include "client.h" -#include "composite.h" -#include "deleted.h" -#include "effects.h" -#include "lanczosfilter.h" -#include "overlaywindow.h" -#include "paintredirector.h" -#include "screens.h" -#include "workspace.h" - -#include <cmath> -#include <unistd.h> -#include <stddef.h> - -// turns on checks for opengl errors in various places (for easier finding of them) -// normally only few of them are enabled -//#define CHECK_GL_ERROR - -#include <X11/extensions/Xcomposite.h> - -#include <qpainter.h> -#include <QDBusConnection> -#include <QDBusConnectionInterface> -#include <QDBusInterface> -#include <QtGui/qgraphicstransform.h> -#include <QStringList> -#include <QVector2D> -#include <QVector4D> -#include <QMatrix4x4> -#include <QProcess> - -#include <KLocalizedString> -#include <KNotification> - -namespace KWin -{ - -extern int currentRefreshRate(); - -//**************************************** -// SceneOpenGL -//**************************************** -OpenGLBackend::OpenGLBackend() - : m_overlayWindow(new OverlayWindow()) // TODO: maybe create only if needed? - , m_syncsToVBlank(false) - , m_blocksForRetrace(false) - , m_directRendering(false) - , m_haveBufferAge(false) - , m_failed(false) -{ -} - -OpenGLBackend::~OpenGLBackend() -{ - if (isFailed()) { - m_overlayWindow->destroy(); - } - delete m_overlayWindow; -} - -void OpenGLBackend::setFailed(const QString &reason) -{ - kWarning(1212) << "Creating the OpenGL rendering failed: " << reason; - m_failed = true; -} - -void OpenGLBackend::idle() -{ - if (hasPendingFlush()) - present(); -} - -void OpenGLBackend::addToDamageHistory(const QRegion ®ion) -{ - if (m_damageHistory.count() > 10) - m_damageHistory.removeLast(); - - m_damageHistory.prepend(region); -} - -QRegion OpenGLBackend::accumulatedDamageHistory(int bufferAge) const -{ - QRegion region; - - // Note: An age of zero means the buffer contents are undefined - if (bufferAge > 0 && bufferAge <= m_damageHistory.count()) { - for (int i = 0; i < bufferAge - 1; i++) - region |= m_damageHistory[i]; - } else { - region = QRegion(0, 0, displayWidth(), displayHeight()); - } - - return region; -} - -/************************************************ - * SceneOpenGL - ***********************************************/ - -SceneOpenGL::SceneOpenGL(Workspace* ws, OpenGLBackend *backend) - : Scene(ws) - , init_ok(true) - , m_backend(backend) -{ - if (m_backend->isFailed()) { - init_ok = false; - return; - } - if (!viewportLimitsMatched(QSize(displayWidth(), displayHeight()))) - return; - - // perform Scene specific checks - GLPlatform *glPlatform = GLPlatform::instance(); -#ifndef KWIN_HAVE_OPENGLES - if (!hasGLExtension("GL_ARB_texture_non_power_of_two") - && !hasGLExtension("GL_ARB_texture_rectangle")) { - kError(1212) << "GL_ARB_texture_non_power_of_two and GL_ARB_texture_rectangle missing"; - init_ok = false; - return; // error - } -#endif - if (glPlatform->isMesaDriver() && glPlatform->mesaVersion() < kVersionNumber(8, 0)) { - kError(1212) << "KWin requires at least Mesa 8.0 for OpenGL compositing."; - init_ok = false; - return; - } -#ifndef KWIN_HAVE_OPENGLES - glDrawBuffer(GL_BACK); -#endif - - m_debug = qstrcmp(qgetenv("KWIN_GL_DEBUG"), "1") == 0; - - // set strict binding - if (options->isGlStrictBindingFollowsDriver()) { - options->setGlStrictBinding(!glPlatform->supports(LooseBinding)); - } -} - -SceneOpenGL::~SceneOpenGL() -{ - foreach (Window * w, windows) { - delete w; - } - // do cleanup after initBuffer() - SceneOpenGL::EffectFrame::cleanup(); - if (init_ok) { - // backend might be still needed for a different scene - delete m_backend; - } -} - -SceneOpenGL *SceneOpenGL::createScene() -{ - OpenGLBackend *backend = NULL; - OpenGLPlatformInterface platformInterface = NoOpenGLPlatformInterface; - // should we use glx? -#ifndef KWIN_HAVE_OPENGLES - // on OpenGL we default to glx - platformInterface = GlxPlatformInterface; -#endif - - const QByteArray envOpenGLInterface(qgetenv("KWIN_OPENGL_INTERFACE")); -#ifdef KWIN_HAVE_EGL -#ifdef KWIN_HAVE_OPENGLES - // for OpenGL ES we need to use the Egl Backend - platformInterface = EglPlatformInterface; -#else - // check environment variable - if (qstrcmp(envOpenGLInterface, "egl") == 0) { - kDebug(1212) << "Forcing EGL native interface through environment variable"; - platformInterface = EglPlatformInterface; - } -#endif -#endif - - switch (platformInterface) { - case GlxPlatformInterface: -#ifndef KWIN_HAVE_OPENGLES - backend = new GlxBackend(); -#endif - break; - case EglPlatformInterface: -#ifdef KWIN_HAVE_EGL - backend = new EglOnXBackend(); -#endif - break; - default: - // no backend available - return NULL; - } - if (!backend || backend->isFailed()) { - delete backend; - return NULL; - } - SceneOpenGL *scene = NULL; - // first let's try an OpenGL 2 scene - if (SceneOpenGL2::supported(backend)) { - scene = new SceneOpenGL2(backend); - if (scene->initFailed()) { - delete scene; - scene = NULL; - } else { - return scene; - } - } -#ifdef KWIN_HAVE_OPENGL_1 - if (SceneOpenGL1::supported(backend)) { - scene = new SceneOpenGL1(backend); - if (scene->initFailed()) { - delete scene; - scene = NULL; - } - } -#endif - if (!scene) { - if (GLPlatform::instance()->recommendedCompositor() == XRenderCompositing) { - kError(1212) << "OpenGL driver recommends XRender based compositing. Falling back to XRender."; - kError(1212) << "To overwrite the detection use the environment variable KWIN_COMPOSE"; - kError(1212) << "For more information see http://community.kde.org/KWin/Environment_Variables#KWIN_COMPOSE"; - QTimer::singleShot(0, Compositor::self(), SLOT(fallbackToXRenderCompositing())); - } - delete backend; - } - - return scene; -} - -OverlayWindow *SceneOpenGL::overlayWindow() -{ - return m_backend->overlayWindow(); -} - -bool SceneOpenGL::syncsToVBlank() const -{ - return m_backend->syncsToVBlank(); -} - -bool SceneOpenGL::blocksForRetrace() const -{ - return m_backend->blocksForRetrace(); -} - -void SceneOpenGL::idle() -{ - m_backend->idle(); - Scene::idle(); -} - -bool SceneOpenGL::initFailed() const -{ - return !init_ok; -} - -#ifndef KWIN_HAVE_OPENGLES -void SceneOpenGL::copyPixels(const QRegion ®ion) -{ - foreach (const QRect &r, region.rects()) { - const int x0 = r.x(); - const int y0 = displayHeight() - r.y() - r.height(); - const int x1 = r.x() + r.width(); - const int y1 = displayHeight() - r.y(); - - glBlitFramebuffer(x0, y0, x1, y1, x0, y0, x1, y1, GL_COLOR_BUFFER_BIT, GL_NEAREST); - } -} -#endif - -#ifndef KWIN_HAVE_OPENGLES -# define GL_GUILTY_CONTEXT_RESET_KWIN GL_GUILTY_CONTEXT_RESET_ARB -# define GL_INNOCENT_CONTEXT_RESET_KWIN GL_INNOCENT_CONTEXT_RESET_ARB -# define GL_UNKNOWN_CONTEXT_RESET_KWIN GL_UNKNOWN_CONTEXT_RESET_ARB -#else -# define GL_GUILTY_CONTEXT_RESET_KWIN GL_GUILTY_CONTEXT_RESET_EXT -# define GL_INNOCENT_CONTEXT_RESET_KWIN GL_INNOCENT_CONTEXT_RESET_EXT -# define GL_UNKNOWN_CONTEXT_RESET_KWIN GL_UNKNOWN_CONTEXT_RESET_EXT -#endif - -void SceneOpenGL::handleGraphicsReset(GLenum status) -{ - switch (status) { - case GL_GUILTY_CONTEXT_RESET_KWIN: - kDebug(1212) << "A graphics reset attributable to the current GL context occurred."; - break; - - case GL_INNOCENT_CONTEXT_RESET_KWIN: - kDebug(1212) << "A graphics reset not attributable to the current GL context occurred."; - break; - - case GL_UNKNOWN_CONTEXT_RESET_KWIN: - kDebug(1212) << "A graphics reset of an unknown cause occurred."; - break; - - default: - break; - } - - QElapsedTimer timer; - timer.start(); - - // Wait until the reset is completed or max 10 seconds - while (timer.elapsed() < 10000 && glGetGraphicsResetStatus() != GL_NO_ERROR) - usleep(50); - - kDebug(1212) << "Attempting to reset compositing."; - QMetaObject::invokeMethod(this, "resetCompositing", Qt::QueuedConnection); - - KNotification::event("graphicsreset", i18n("Desktop effects were restarted due to a graphics reset")); -} - -qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels) -{ - // actually paint the frame, flushed with the NEXT frame - foreach (Toplevel * c, toplevels) { - // TODO: cache the stacking_order in case it has not changed - assert(windows.contains(c)); - stacking_order.append(windows[ c ]); - } - - QRegion repaint = m_backend->prepareRenderingFrame(); - - const GLenum status = glGetGraphicsResetStatus(); - if (status != GL_NO_ERROR) { - handleGraphicsReset(status); - return 0; - } - - int mask = 0; -#ifdef CHECK_GL_ERROR - checkGLError("Paint1"); -#endif - - // After this call, updateRegion will contain the damaged region in the - // back buffer. This is the region that needs to be posted to repair - // the front buffer. It doesn't include the additional damage returned - // by prepareRenderingFrame(). validRegion is the region that has been - // repainted, and may be larger than updateRegion. - QRegion updateRegion, validRegion; - paintScreen(&mask, damage, repaint, &updateRegion, &validRegion); // call generic implementation - -#ifndef KWIN_HAVE_OPENGLES - const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); - - // copy dirty parts from front to backbuffer - if (!m_backend->supportsBufferAge() && - options->glPreferBufferSwap() == Options::CopyFrontBuffer && - validRegion != displayRegion) { - glReadBuffer(GL_FRONT); - copyPixels(displayRegion - validRegion); - glReadBuffer(GL_BACK); - validRegion = displayRegion; - } -#endif - -#ifdef CHECK_GL_ERROR - checkGLError("Paint2"); -#endif - - m_backend->endRenderingFrame(validRegion, updateRegion); - - // do cleanup - stacking_order.clear(); - checkGLError("PostPaint"); - return m_backend->renderTime(); -} - -QMatrix4x4 SceneOpenGL::transformation(int mask, const ScreenPaintData &data) const -{ - QMatrix4x4 matrix; - - if (!(mask & PAINT_SCREEN_TRANSFORMED)) - return matrix; - - matrix.translate(data.translation()); - data.scale().applyTo(&matrix); - - if (data.rotationAngle() == 0.0) - return matrix; - - // Apply the rotation - // cannot use data.rotation->applyTo(&matrix) as QGraphicsRotation uses projectedRotate to map back to 2D - matrix.translate(data.rotationOrigin()); - const QVector3D axis = data.rotationAxis(); - matrix.rotate(data.rotationAngle(), axis.x(), axis.y(), axis.z()); - matrix.translate(-data.rotationOrigin()); - - return matrix; -} - -void SceneOpenGL::paintBackground(QRegion region) -{ - PaintClipper pc(region); - if (!PaintClipper::clip()) { - glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT); - return; - } - if (pc.clip() && pc.paintArea().isEmpty()) - return; // no background to paint - QVector<float> verts; - for (PaintClipper::Iterator iterator; !iterator.isDone(); iterator.next()) { - QRect r = iterator.boundingRect(); - verts << r.x() + r.width() << r.y(); - verts << r.x() << r.y(); - verts << r.x() << r.y() + r.height(); - verts << r.x() << r.y() + r.height(); - verts << r.x() + r.width() << r.y() + r.height(); - verts << r.x() + r.width() << r.y(); - } - doPaintBackground(verts); -} - -void SceneOpenGL::extendPaintRegion(QRegion ®ion, bool opaqueFullscreen) -{ - if (m_backend->supportsBufferAge()) - return; - - if (options->glPreferBufferSwap() == Options::ExtendDamage) { // only Extend "large" repaints - const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); - uint damagedPixels = 0; - const uint fullRepaintLimit = (opaqueFullscreen?0.49f:0.748f)*displayWidth()*displayHeight(); - // 16:9 is 75% of 4:3 and 2.55:1 is 49.01% of 5:4 - // (5:4 is the most square format and 2.55:1 is Cinemascope55 - the widest ever shot - // movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict - // to 2.20:1 - Panavision - which has actually been used for interesting movies ...) - // would be 57% of 5/4 - foreach (const QRect &r, region.rects()) { -// damagedPixels += r.width() * r.height(); // combined window damage test - damagedPixels = r.width() * r.height(); // experimental single window damage testing - if (damagedPixels > fullRepaintLimit) { - region = displayRegion; - return; - } - } - } else if (options->glPreferBufferSwap() == Options::PaintFullScreen) { // forced full rePaint - region = QRegion(0, 0, displayWidth(), displayHeight()); - } -} - -void SceneOpenGL::windowAdded(Toplevel* c) -{ - assert(!windows.contains(c)); - Window *w = createWindow(c); - windows[ c ] = w; - w->setScene(this); - connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), SLOT(windowOpacityChanged(KWin::Toplevel*))); - connect(c, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SLOT(windowGeometryShapeChanged(KWin::Toplevel*))); - connect(c, SIGNAL(windowClosed(KWin::Toplevel*,KWin::Deleted*)), SLOT(windowClosed(KWin::Toplevel*,KWin::Deleted*))); - c->effectWindow()->setSceneWindow(windows[ c ]); - c->getShadow(); - windows[ c ]->updateShadow(c->shadow()); -} - -void SceneOpenGL::windowClosed(KWin::Toplevel* c, KWin::Deleted* deleted) -{ - assert(windows.contains(c)); - if (deleted != NULL) { - // replace c with deleted - Window* w = windows.take(c); - w->updateToplevel(deleted); - if (w->shadow()) { - w->shadow()->setToplevel(deleted); - } - windows[ deleted ] = w; - } else { - delete windows.take(c); - c->effectWindow()->setSceneWindow(NULL); - } -} - -void SceneOpenGL::windowDeleted(Deleted* c) -{ - assert(windows.contains(c)); - delete windows.take(c); - c->effectWindow()->setSceneWindow(NULL); -} - -void SceneOpenGL::windowGeometryShapeChanged(KWin::Toplevel* c) -{ - if (!windows.contains(c)) // this is ok, shape is not valid - return; // by default - Window* w = windows[ c ]; - w->discardShape(); -} - -void SceneOpenGL::windowOpacityChanged(KWin::Toplevel* t) -{ - Q_UNUSED(t) -#if 0 // not really needed, windows are painted on every repaint - // and opacity is used when applying texture, not when - // creating it - if (!windows.contains(c)) // this is ok, texture is created - return; // on demand - Window* w = windows[ c ]; - w->discardTexture(); -#endif -} - -SceneOpenGL::Texture *SceneOpenGL::createTexture() -{ - return new Texture(m_backend); -} - -SceneOpenGL::Texture *SceneOpenGL::createTexture(const QPixmap &pix, GLenum target) -{ - return new Texture(m_backend, pix, target); -} - -bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const { - GLint limit[2]; - glGetIntegerv(GL_MAX_VIEWPORT_DIMS, limit); - if (limit[0] < size.width() || limit[1] < size.height()) { - QMetaObject::invokeMethod(Compositor::self(), "suspend", - Qt::QueuedConnection, Q_ARG(Compositor::SuspendReason, Compositor::AllReasonSuspend)); - const QString message = i18n("<h1>OpenGL desktop effects not possible</h1>" - "Your system cannot perform OpenGL Desktop Effects at the " - "current resolution<br><br>" - "You can try to select the XRender backend, but it " - "might be very slow for this resolution as well.<br>" - "Alternatively, lower the combined resolution of all screens " - "to %1x%2 ", limit[0], limit[1]); - const QString details = i18n("The demanded resolution exceeds the GL_MAX_VIEWPORT_DIMS " - "limitation of your GPU and is therefore not compatible " - "with the OpenGL compositor.<br>" - "XRender does not know such limitation, but the performance " - "will usually be impacted by the hardware limitations that " - "restrict the OpenGL viewport size."); - const int oldTimeout = QDBusConnection::sessionBus().interface()->timeout(); - QDBusConnection::sessionBus().interface()->setTimeout(500); - if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kwinCompositingDialog").value()) { - QDBusInterface dialog( "org.kde.kwinCompositingDialog", "/CompositorSettings", "org.kde.kwinCompositingDialog" ); - dialog.asyncCall("warn", message, details, ""); - } else { - const QByteArray args = "warn " + message.toLocal8Bit().toBase64() + " details " + details.toLocal8Bit().toBase64(); - QProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args); - } - QDBusConnection::sessionBus().interface()->setTimeout(oldTimeout); - return false; - } - glGetIntegerv(GL_MAX_TEXTURE_SIZE, limit); - if (limit[0] < size.width() || limit[0] < size.height()) { - KConfig cfg("kwin_dialogsrc"); - - if (!KConfigGroup(&cfg, "Notification Messages").readEntry("max_tex_warning", true)) - return true; - - const QString message = i18n("<h1>OpenGL desktop effects might be unusable</h1>" - "OpenGL Desktop Effects at the current resolution are supported " - "but might be exceptionally slow.<br>" - "Also large windows will turn entirely black.<br><br>" - "Consider to suspend compositing, switch to the XRender backend " - "or lower the resolution to %1x%1." , limit[0]); - const QString details = i18n("The demanded resolution exceeds the GL_MAX_TEXTURE_SIZE " - "limitation of your GPU, thus windows of that size cannot be " - "assigned to textures and will be entirely black.<br>" - "Also this limit will often be a performance level barrier despite " - "below GL_MAX_VIEWPORT_DIMS, because the driver might fall back to " - "software rendering in this case."); - const int oldTimeout = QDBusConnection::sessionBus().interface()->timeout(); - QDBusConnection::sessionBus().interface()->setTimeout(500); - if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kwinCompositingDialog").value()) { - QDBusInterface dialog( "org.kde.kwinCompositingDialog", "/CompositorSettings", "org.kde.kwinCompositingDialog" ); - dialog.asyncCall("warn", message, details, "kwin_dialogsrc:max_tex_warning"); - } else { - const QByteArray args = "warn " + message.toLocal8Bit().toBase64() + " details " + - details.toLocal8Bit().toBase64() + " dontagain kwin_dialogsrc:max_tex_warning"; - QProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args); - } - QDBusConnection::sessionBus().interface()->setTimeout(oldTimeout); - } - return true; -} - -void SceneOpenGL::screenGeometryChanged(const QSize &size) -{ - if (!viewportLimitsMatched(size)) - return; - Scene::screenGeometryChanged(size); - glViewport(0,0, size.width(), size.height()); - m_backend->screenGeometryChanged(size); - ShaderManager::instance()->resetAllShaders(); -} - -void SceneOpenGL::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) -{ - const QRect r = region.boundingRect(); - glEnable(GL_SCISSOR_TEST); - glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height()); - KWin::Scene::paintDesktop(desktop, mask, region, data); - glDisable(GL_SCISSOR_TEST); -} - -//**************************************** -// SceneOpenGL2 -//**************************************** -bool SceneOpenGL2::supported(OpenGLBackend *backend) -{ - const QByteArray forceEnv = qgetenv("KWIN_COMPOSE"); - if (!forceEnv.isEmpty()) { - if (qstrcmp(forceEnv, "O2") == 0) { - kDebug(1212) << "OpenGL 2 compositing enforced by environment variable"; - return true; - } else { - // OpenGL 2 disabled by environment variable - return false; - } - } - if (!backend->isDirectRendering()) { - return false; - } - if (GLPlatform::instance()->recommendedCompositor() < OpenGL2Compositing) { - kDebug(1212) << "Driver does not recommend OpenGL 2 compositing"; -#ifndef KWIN_HAVE_OPENGLES - return false; -#endif - } - if (options->isGlLegacy()) { - kDebug(1212) << "OpenGL 2 disabled by config option"; - return false; - } - return true; -} - -SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend) - : SceneOpenGL(Workspace::self(), backend) - , m_lanczosFilter(NULL) - , m_colorCorrection() -{ - if (!init_ok) { - // base ctor already failed - return; - } - // Initialize color correction before the shaders - slotColorCorrectedChanged(false); - connect(options, SIGNAL(colorCorrectedChanged()), this, SLOT(slotColorCorrectedChanged()), Qt::QueuedConnection); - - if (!ShaderManager::instance()->isValid()) { - kDebug(1212) << "No Scene Shaders available"; - init_ok = false; - return; - } - - // push one shader on the stack so that one is always bound - ShaderManager::instance()->pushShader(ShaderManager::SimpleShader); - if (checkGLError("Init")) { - kError(1212) << "OpenGL 2 compositing setup failed"; - init_ok = false; - return; // error - } - - kDebug(1212) << "OpenGL 2 compositing successfully initialized"; - -#ifndef KWIN_HAVE_OPENGLES - // It is not legal to not have a vertex array object bound in a core context - if (hasGLExtension("GL_ARB_vertex_array_object")) { - glGenVertexArrays(1, &vao); - glBindVertexArray(vao); - } -#endif - - init_ok = true; -} - -SceneOpenGL2::~SceneOpenGL2() -{ -} - -void SceneOpenGL2::paintGenericScreen(int mask, ScreenPaintData data) -{ - ShaderBinder binder(ShaderManager::GenericShader); - - binder.shader()->setUniform(GLShader::ScreenTransformation, transformation(mask, data)); - - Scene::paintGenericScreen(mask, data); -} - -void SceneOpenGL2::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) -{ - ShaderBinder binder(ShaderManager::GenericShader); - GLShader *shader = binder.shader(); - QMatrix4x4 screenTransformation = shader->getUniformMatrix4x4("screenTransformation"); - - KWin::SceneOpenGL::paintDesktop(desktop, mask, region, data); - - shader->setUniform(GLShader::ScreenTransformation, screenTransformation); -} - -void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices) -{ - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setUseColor(true); - vbo->setData(vertices.count() / 2, 2, vertices.data(), NULL); - - ShaderBinder binder(ShaderManager::ColorShader); - binder.shader()->setUniform(GLShader::Offset, QVector2D(0, 0)); - - vbo->render(GL_TRIANGLES); -} - -SceneOpenGL::Window *SceneOpenGL2::createWindow(Toplevel *t) -{ - return new SceneOpenGL2Window(t); -} - -void SceneOpenGL2::finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data) -{ - if (!m_colorCorrection.isNull() && m_colorCorrection->isEnabled()) { - // Split the painting for separate screens - const int numScreens = screens()->count(); - for (int screen = 0; screen < numScreens; ++ screen) { - QRegion regionForScreen(region); - if (numScreens > 1) - regionForScreen = region.intersected(screens()->geometry(screen)); - - data.setScreen(screen); - performPaintWindow(w, mask, regionForScreen, data); - } - } else { - performPaintWindow(w, mask, region, data); - } -} - -void SceneOpenGL2::performPaintWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data) -{ - if (mask & PAINT_WINDOW_LANCZOS) { - if (!m_lanczosFilter) { - m_lanczosFilter = new LanczosFilter(this); - // recreate the lanczos filter when the screen gets resized - connect(screens(), SIGNAL(changed()), SLOT(resetLanczosFilter())); - } - m_lanczosFilter->performPaint(w, mask, region, data); - } else - w->sceneWindow()->performPaint(mask, region, data); -} - -void SceneOpenGL2::resetLanczosFilter() -{ - // TODO: Qt5 - replace by a lambda slot - delete m_lanczosFilter; - m_lanczosFilter = NULL; -} - -ColorCorrection *SceneOpenGL2::colorCorrection() -{ - return m_colorCorrection.data(); -} - -void SceneOpenGL2::slotColorCorrectedChanged(bool recreateShaders) -{ - kDebug(1212) << "Color correction:" << options->isColorCorrected(); - if (options->isColorCorrected() && m_colorCorrection.isNull()) { - m_colorCorrection.reset(new ColorCorrection(this)); - if (!m_colorCorrection->setEnabled(true)) { - m_colorCorrection.reset(); - return; - } - connect(m_colorCorrection.data(), SIGNAL(changed()), Compositor::self(), SLOT(addRepaintFull())); - connect(m_colorCorrection.data(), SIGNAL(errorOccured()), options, SLOT(setColorCorrected()), Qt::QueuedConnection); - if (recreateShaders) { - // Reload all shaders - ShaderManager::cleanup(); - ShaderManager::instance(); - } - } else { - m_colorCorrection.reset(); - } - Compositor::self()->addRepaintFull(); -} - - -//**************************************** -// SceneOpenGL1 -//**************************************** -#ifdef KWIN_HAVE_OPENGL_1 -bool SceneOpenGL1::supported(OpenGLBackend *backend) -{ - Q_UNUSED(backend) - const QByteArray forceEnv = qgetenv("KWIN_COMPOSE"); - if (!forceEnv.isEmpty()) { - if (qstrcmp(forceEnv, "O1") == 0) { - kDebug(1212) << "OpenGL 1 compositing enforced by environment variable"; - return true; - } else { - // OpenGL 1 disabled by environment variable - return false; - } - } - if (GLPlatform::instance()->recommendedCompositor() < OpenGL1Compositing) { - kDebug(1212) << "Driver does not recommend OpenGL 1 compositing"; - return false; - } - return true; -} - -SceneOpenGL1::SceneOpenGL1(OpenGLBackend *backend) - : SceneOpenGL(Workspace::self(), backend) - , m_resetModelViewProjectionMatrix(true) -{ - if (!init_ok) { - // base ctor already failed - return; - } - ShaderManager::disable(); - setupModelViewProjectionMatrix(); - if (checkGLError("Init")) { - kError(1212) << "OpenGL 1 compositing setup failed"; - init_ok = false; - return; // error - } - - kDebug(1212) << "OpenGL 1 compositing successfully initialized"; -} - -SceneOpenGL1::~SceneOpenGL1() -{ -} - -qint64 SceneOpenGL1::paint(QRegion damage, ToplevelList windows) -{ - if (m_resetModelViewProjectionMatrix) { - // reset model view projection matrix if required - setupModelViewProjectionMatrix(); - } - return SceneOpenGL::paint(damage, windows); -} - -void SceneOpenGL1::paintGenericScreen(int mask, ScreenPaintData data) -{ - pushMatrix(transformation(mask, data)); - Scene::paintGenericScreen(mask, data); - popMatrix(); -} - -void SceneOpenGL1::doPaintBackground(const QVector< float >& vertices) -{ - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setUseColor(true); - vbo->setData(vertices.count() / 2, 2, vertices.data(), NULL); - vbo->render(GL_TRIANGLES); -} - -void SceneOpenGL1::setupModelViewProjectionMatrix() -{ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - float fovy = 60.0f; - float aspect = 1.0f; - float zNear = 0.1f; - float zFar = 100.0f; - float ymax = zNear * tan(fovy * M_PI / 360.0f); - float ymin = -ymax; - float xmin = ymin * aspect; - float xmax = ymax * aspect; - // swap top and bottom to have OpenGL coordinate system match X system - glFrustum(xmin, xmax, ymin, ymax, zNear, zFar); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - float scaleFactor = 1.1 * tan(fovy * M_PI / 360.0f) / ymax; - glTranslatef(xmin * scaleFactor, ymax * scaleFactor, -1.1); - glScalef((xmax - xmin)*scaleFactor / displayWidth(), -(ymax - ymin)*scaleFactor / displayHeight(), 0.001); - m_resetModelViewProjectionMatrix = false; -} - -void SceneOpenGL1::screenGeometryChanged(const QSize &size) -{ - SceneOpenGL::screenGeometryChanged(size); - m_resetModelViewProjectionMatrix = true; -} - -SceneOpenGL::Window *SceneOpenGL1::createWindow(Toplevel *t) -{ - return new SceneOpenGL1Window(t); -} - -#endif - -//**************************************** -// SceneOpenGL::Texture -//**************************************** - -SceneOpenGL::Texture::Texture(OpenGLBackend *backend) - : GLTexture(*backend->createBackendTexture(this)) -{ -} - -SceneOpenGL::Texture::Texture(OpenGLBackend *backend, const QPixmap &pix, GLenum target) - : GLTexture(*backend->createBackendTexture(this)) -{ - load(pix, target); -} - -SceneOpenGL::Texture::~Texture() -{ -} - -SceneOpenGL::Texture& SceneOpenGL::Texture::operator = (const SceneOpenGL::Texture& tex) -{ - d_ptr = tex.d_ptr; - return *this; -} - -void SceneOpenGL::Texture::discard() -{ - d_ptr = d_func()->backend()->createBackendTexture(this); -} - -bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size, - int depth) -{ - if (pix == None) - return false; - return load(pix, size, depth, - QRegion(0, 0, size.width(), size.height())); -} - -bool SceneOpenGL::Texture::load(const QImage& image, GLenum target) -{ - if (image.isNull()) - return false; - return load(QPixmap::fromImage(image), target); -} - -bool SceneOpenGL::Texture::load(const QPixmap& pixmap, GLenum target) -{ - if (pixmap.isNull()) - return false; - - // Checking whether QPixmap comes with its own X11 Pixmap - if (Extensions::nonNativePixmaps()) { - return GLTexture::load(pixmap.toImage(), target); - } - - // use the X11 pixmap provided by Qt - return load(pixmap.handle(), pixmap.size(), pixmap.depth()); -} - -void SceneOpenGL::Texture::findTarget() -{ - Q_D(Texture); - d->findTarget(); -} - -bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size, - int depth, QRegion region) -{ - Q_UNUSED(region) - // decrease the reference counter for the old texture - d_ptr = d_func()->backend()->createBackendTexture(this); //new TexturePrivate(); - - Q_D(Texture); - return d->loadTexture(pix, size, depth); -} - -bool SceneOpenGL::Texture::update(const QRegion &damage) -{ - Q_D(Texture); - return d->update(damage); -} - -//**************************************** -// SceneOpenGL::Texture -//**************************************** -SceneOpenGL::TexturePrivate::TexturePrivate() -{ -} - -SceneOpenGL::TexturePrivate::~TexturePrivate() -{ -} - -bool SceneOpenGL::TexturePrivate::update(const QRegion &damage) -{ - Q_UNUSED(damage) - return true; -} - -//**************************************** -// SceneOpenGL::Window -//**************************************** - -SceneOpenGL::Window::Window(Toplevel* c) - : Scene::Window(c) - , m_scene(NULL) -{ -} - -SceneOpenGL::Window::~Window() -{ -} - -static SceneOpenGL::Texture *s_frameTexture = NULL; -// Bind the window pixmap to an OpenGL texture. -bool SceneOpenGL::Window::bindTexture() -{ - s_frameTexture = NULL; - OpenGLWindowPixmap *pixmap = windowPixmap<OpenGLWindowPixmap>(); - if (!pixmap) { - return false; - } - s_frameTexture = pixmap->texture(); - if (pixmap->isDiscarded()) { - return !pixmap->texture()->isNull(); - } - return pixmap->bind(); -} - -QMatrix4x4 SceneOpenGL::Window::transformation(int mask, const WindowPaintData &data) const -{ - QMatrix4x4 matrix; - matrix.translate(x(), y()); - - if (!(mask & PAINT_WINDOW_TRANSFORMED)) - return matrix; - - matrix.translate(data.translation()); - data.scale().applyTo(&matrix); - - if (data.rotationAngle() == 0.0) - return matrix; - - // Apply the rotation - // cannot use data.rotation.applyTo(&matrix) as QGraphicsRotation uses projectedRotate to map back to 2D - matrix.translate(data.rotationOrigin()); - const QVector3D axis = data.rotationAxis(); - matrix.rotate(data.rotationAngle(), axis.x(), axis.y(), axis.z()); - matrix.translate(-data.rotationOrigin()); - - return matrix; -} - -bool SceneOpenGL::Window::beginRenderWindow(int mask, const QRegion ®ion, WindowPaintData &data) -{ - if (region.isEmpty()) - return false; - - m_hardwareClipping = region != infiniteRegion() && (mask & PAINT_WINDOW_TRANSFORMED) && !(mask & PAINT_SCREEN_TRANSFORMED); - if (region != infiniteRegion() && !m_hardwareClipping) { - WindowQuadList quads; - quads.reserve(data.quads.count()); - - const QRegion filterRegion = region.translated(-x(), -y()); - // split all quads in bounding rect with the actual rects in the region - foreach (const WindowQuad &quad, data.quads) { - foreach (const QRect &r, filterRegion.rects()) { - const QRectF rf(r); - const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); - // case 1: completely contains, include and do not check other rects - if (rf.contains(quadRect)) { - quads << quad; - break; - } - // case 2: intersection - if (rf.intersects(quadRect)) { - const QRectF intersected = rf.intersected(quadRect); - quads << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom()); - } - } - } - data.quads = quads; - } - - if (data.quads.isEmpty()) - return false; - - if (!bindTexture() || !s_frameTexture) { - return false; - } - - if (m_hardwareClipping) { - glEnable(GL_SCISSOR_TEST); - } - - // Update the texture filter - if (options->glSmoothScale() != 0 && - (mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED))) - filter = ImageFilterGood; - else - filter = ImageFilterFast; - - s_frameTexture->setFilter(filter == ImageFilterGood ? GL_LINEAR : GL_NEAREST); - - const GLVertexAttrib attribs[] = { - { VA_Position, 2, GL_FLOAT, offsetof(GLVertex2D, position) }, - { VA_TexCoord, 2, GL_FLOAT, offsetof(GLVertex2D, texcoord) }, - }; - - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setAttribLayout(attribs, 2, sizeof(GLVertex2D)); - - return true; -} - -void SceneOpenGL::Window::endRenderWindow() -{ - if (m_hardwareClipping) { - glDisable(GL_SCISSOR_TEST); - } -} - - -OpenGLPaintRedirector *SceneOpenGL::Window::paintRedirector() const -{ - if (toplevel->isClient()) { - Client *client = static_cast<Client *>(toplevel); - if (client->noBorder()) - return 0; - - return static_cast<OpenGLPaintRedirector *>(client->decorationPaintRedirector()); - } - - if (toplevel->isDeleted()) { - Deleted *deleted = static_cast<Deleted *>(toplevel); - if (deleted->noBorder()) - return 0; - - return static_cast<OpenGLPaintRedirector *>(deleted->decorationPaintRedirector()); - } - - return 0; -} - -bool SceneOpenGL::Window::getDecorationTextures(GLTexture **textures) const -{ - OpenGLPaintRedirector *redirector = paintRedirector(); - if (!redirector) - return false; - - redirector->ensurePixmapsPainted(); - - textures[0] = redirector->leftRightTexture(); - textures[1] = redirector->topBottomTexture(); - - redirector->markAsRepainted(); - return true; -} - -void SceneOpenGL::Window::paintDecorations(const WindowPaintData &data, const QRegion ®ion) -{ - GLTexture *textures[2]; - if (!getDecorationTextures(textures)) - return; - - WindowQuadList quads[2]; // left-right, top-bottom - - // Split the quads into two lists - foreach (const WindowQuad &quad, data.quads) { - switch (quad.type()) { - case WindowQuadDecorationLeftRight: - quads[0].append(quad); - continue; - - case WindowQuadDecorationTopBottom: - quads[1].append(quad); - continue; - - default: - continue; - } - } - - TextureType type[] = { DecorationLeftRight, DecorationTopBottom }; - for (int i = 0; i < 2; i++) - paintDecoration(textures[i], type[i], region, data, quads[i]); -} - -void SceneOpenGL::Window::paintDecoration(GLTexture *texture, TextureType type, - const QRegion ®ion, const WindowPaintData &data, - const WindowQuadList &quads) -{ - if (!texture || quads.isEmpty()) - return; - - if (filter == ImageFilterGood) - texture->setFilter(GL_LINEAR); - else - texture->setFilter(GL_NEAREST); - - texture->setWrapMode(GL_CLAMP_TO_EDGE); - texture->bind(); - - prepareStates(type, data.opacity() * data.decorationOpacity(), data.brightness(), data.saturation(), data.screen()); - renderQuads(0, region, quads, texture, false); - restoreStates(type, data.opacity() * data.decorationOpacity(), data.brightness(), data.saturation()); - - texture->unbind(); - -#ifndef KWIN_HAVE_OPENGLES - if (m_scene && m_scene->debug()) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - GLVertexBuffer::streamingBuffer()->render(region, GL_TRIANGLES, m_hardwareClipping); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } -#endif -} - -void SceneOpenGL::Window::paintShadow(const QRegion ®ion, const WindowPaintData &data) -{ - WindowQuadList quads; - - foreach (const WindowQuad &quad, data.quads) { - switch (quad.type()) { - case WindowQuadShadowTopLeft: - case WindowQuadShadowTop: - case WindowQuadShadowTopRight: - case WindowQuadShadowLeft: - case WindowQuadShadowRight: - case WindowQuadShadowBottomLeft: - case WindowQuadShadowBottom: - case WindowQuadShadowBottomRight: - quads.append(quad); - break; - - default: - break; - } - } - - if (quads.isEmpty()) - return; - - GLTexture *texture = static_cast<SceneOpenGLShadow*>(m_shadow)->shadowTexture(); - if (!texture) { - return; - } - if (filter == ImageFilterGood) - texture->setFilter(GL_LINEAR); - else - texture->setFilter(GL_NEAREST); - texture->setWrapMode(GL_CLAMP_TO_EDGE); - texture->bind(); - prepareStates(Shadow, data.opacity(), data.brightness(), data.saturation(), data.screen()); - renderQuads(0, region, quads, texture, true); - restoreStates(Shadow, data.opacity(), data.brightness(), data.saturation()); - texture->unbind(); -#ifndef KWIN_HAVE_OPENGLES - if (m_scene && m_scene->debug()) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - renderQuads(0, region, quads, texture, true); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } -#endif -} - -void SceneOpenGL::Window::renderQuads(int, const QRegion& region, const WindowQuadList& quads, - GLTexture *tex, bool normalized) -{ - if (quads.isEmpty()) - return; - - const QMatrix4x4 matrix = tex->matrix(normalized ? NormalizedCoordinates : UnnormalizedCoordinates); - - // Render geometry - GLenum primitiveType; - int primcount; - - if (GLVertexBuffer::supportsIndexedQuads()) { - primitiveType = GL_QUADS_KWIN; - primcount = quads.count() * 4; - } else { - primitiveType = GL_TRIANGLES; - primcount = quads.count() * 6; - } - - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->setVertexCount(primcount); - - GLVertex2D *map = (GLVertex2D *) vbo->map(primcount * sizeof(GLVertex2D)); - quads.makeInterleavedArrays(primitiveType, map, matrix); - vbo->unmap(); - - vbo->render(region, primitiveType, m_hardwareClipping); -} - -GLTexture *SceneOpenGL::Window::textureForType(SceneOpenGL::Window::TextureType type) -{ - GLTexture *tex = NULL; - OpenGLPaintRedirector *redirector = NULL; - - if (type != Content && type != Shadow) { - if (toplevel->isClient()) { - Client *client = static_cast<Client*>(toplevel); - redirector = static_cast<OpenGLPaintRedirector*>(client->decorationPaintRedirector()); - } else if (toplevel->isDeleted()) { - Deleted *deleted = static_cast<Deleted*>(toplevel); - redirector = static_cast<OpenGLPaintRedirector*>(deleted->decorationPaintRedirector()); - } - } - - switch(type) { - case Content: - tex = s_frameTexture; - break; - - case DecorationLeftRight: - tex = redirector ? redirector->leftRightTexture() : 0; - break; - - case DecorationTopBottom: - tex = redirector ? redirector->topBottomTexture() : 0; - break; - - case Shadow: - tex = static_cast<SceneOpenGLShadow*>(m_shadow)->shadowTexture(); - } - return tex; -} - -WindowPixmap* SceneOpenGL::Window::createWindowPixmap() -{ - return new OpenGLWindowPixmap(this, m_scene); -} - -//*************************************** -// SceneOpenGL2Window -//*************************************** -SceneOpenGL2Window::SceneOpenGL2Window(Toplevel *c) - : SceneOpenGL::Window(c) - , m_blendingEnabled(false) -{ -} - -SceneOpenGL2Window::~SceneOpenGL2Window() -{ -} - -QVector4D SceneOpenGL2Window::modulate(float opacity, float brightness) const -{ - const float a = opacity; - const float rgb = opacity * brightness; - - return QVector4D(rgb, rgb, rgb, a); -} - -void SceneOpenGL2Window::setBlendEnabled(bool enabled) -{ - if (enabled && !m_blendingEnabled) - glEnable(GL_BLEND); - else if (!enabled && m_blendingEnabled) - glDisable(GL_BLEND); - - m_blendingEnabled = enabled; -} - -void SceneOpenGL2Window::setupLeafNodes(LeafNode *nodes, const WindowQuadList *quads, const WindowPaintData &data) -{ - if (!quads[ShadowLeaf].isEmpty()) { - nodes[ShadowLeaf].texture = static_cast<SceneOpenGLShadow *>(m_shadow)->shadowTexture(); - nodes[ShadowLeaf].opacity = data.opacity(); - nodes[ShadowLeaf].hasAlpha = true; - nodes[ShadowLeaf].coordinateType = NormalizedCoordinates; - } - - if (!quads[LeftRightLeaf].isEmpty() || !quads[TopBottomLeaf].isEmpty()) { - GLTexture *textures[2]; - getDecorationTextures(textures); - - nodes[LeftRightLeaf].texture = textures[0]; - nodes[LeftRightLeaf].opacity = data.opacity(); - nodes[LeftRightLeaf].hasAlpha = true; - nodes[LeftRightLeaf].coordinateType = UnnormalizedCoordinates; - - nodes[TopBottomLeaf].texture = textures[1]; - nodes[TopBottomLeaf].opacity = data.opacity(); - nodes[TopBottomLeaf].hasAlpha = true; - nodes[TopBottomLeaf].coordinateType = UnnormalizedCoordinates; - } - - nodes[ContentLeaf].texture = s_frameTexture; - nodes[ContentLeaf].hasAlpha = !isOpaque(); - // TODO: ARGB crsoofading is atm. a hack, playing on opacities for two dumb SrcOver operations - // Should be a shader - if (data.crossFadeProgress() != 1.0 && (data.opacity() < 0.95 || toplevel->hasAlpha())) { - const float opacity = 1.0 - data.crossFadeProgress(); - nodes[ContentLeaf].opacity = data.opacity() * (1 - pow(opacity, 1.0f + 2.0f * data.opacity())); - } else { - nodes[ContentLeaf].opacity = data.opacity(); - } - nodes[ContentLeaf].coordinateType = UnnormalizedCoordinates; - - if (data.crossFadeProgress() != 1.0) { - OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); - nodes[PreviousContentLeaf].texture = previous ? previous->texture() : NULL; - nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); - nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); - nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; - } -} - -void SceneOpenGL2Window::performPaint(int mask, QRegion region, WindowPaintData data) -{ - if (!beginRenderWindow(mask, region, data)) - return; - - GLShader *shader = data.shader; - if (!shader) { - if ((mask & Scene::PAINT_WINDOW_TRANSFORMED) || (mask & Scene::PAINT_SCREEN_TRANSFORMED)) { - shader = ShaderManager::instance()->pushShader(ShaderManager::GenericShader); - } else { - shader = ShaderManager::instance()->pushShader(ShaderManager::SimpleShader); - shader->setUniform(GLShader::Offset, QVector2D(x(), y())); - } - } - - if (ColorCorrection *cc = static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()) { - cc->setupForOutput(data.screen()); - } - - shader->setUniform(GLShader::WindowTransformation, transformation(mask, data)); - shader->setUniform(GLShader::Saturation, data.saturation()); - - const GLenum filter = (mask & (Effect::PAINT_WINDOW_TRANSFORMED | Effect::PAINT_SCREEN_TRANSFORMED)) - && options->glSmoothScale() != 0 ? GL_LINEAR : GL_NEAREST; - - WindowQuadList quads[LeafCount]; - - // Split the quads into separate lists for each type - foreach (const WindowQuad &quad, data.quads) { - switch (quad.type()) { - case WindowQuadDecorationLeftRight: - quads[LeftRightLeaf].append(quad); - continue; - - case WindowQuadDecorationTopBottom: - quads[TopBottomLeaf].append(quad); - continue; - - case WindowQuadContents: - quads[ContentLeaf].append(quad); - continue; - - case WindowQuadShadowTopLeft: - case WindowQuadShadowTop: - case WindowQuadShadowTopRight: - case WindowQuadShadowLeft: - case WindowQuadShadowRight: - case WindowQuadShadowBottomLeft: - case WindowQuadShadowBottom: - case WindowQuadShadowBottomRight: - quads[ShadowLeaf].append(quad); - continue; - - default: - continue; - } - } - - if (data.crossFadeProgress() != 1.0) { - OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); - if (previous) { - const QRect &oldGeometry = previous->contentsRect(); - Q_FOREACH (const WindowQuad &quad, quads[ContentLeaf]) { - // we need to create new window quads with normalize texture coordinates - // normal quads divide the x/y position by width/height. This would not work as the texture - // is larger than the visible content in case of a decorated Client resulting in garbage being shown. - // So we calculate the normalized texture coordinate in the Client's new content space and map it to - // the previous Client's content space. - WindowQuad newQuad(WindowQuadContents); - for (int i = 0; i < 4; ++i) { - const qreal xFactor = qreal(quad[i].textureX() - toplevel->clientPos().x())/qreal(toplevel->clientSize().width()); - const qreal yFactor = qreal(quad[i].textureY() - toplevel->clientPos().y())/qreal(toplevel->clientSize().height()); - WindowVertex vertex(quad[i].x(), quad[i].y(), - (xFactor * oldGeometry.width() + oldGeometry.x())/qreal(previous->size().width()), - (yFactor * oldGeometry.height() + oldGeometry.y())/qreal(previous->size().height())); - newQuad[i] = vertex; - } - quads[PreviousContentLeaf].append(newQuad); - } - } - } - - const bool indexedQuads = GLVertexBuffer::supportsIndexedQuads(); - const GLenum primitiveType = indexedQuads ? GL_QUADS_KWIN : GL_TRIANGLES; - const int verticesPerQuad = indexedQuads ? 4 : 6; - - const size_t size = verticesPerQuad * - (quads[0].count() + quads[1].count() + quads[2].count() + quads[3].count() + quads[4].count()) * sizeof(GLVertex2D); - - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - GLVertex2D *map = (GLVertex2D *) vbo->map(size); - - LeafNode nodes[LeafCount]; - setupLeafNodes(nodes, quads, data); - - for (int i = 0, v = 0; i < LeafCount; i++) { - if (quads[i].isEmpty() || !nodes[i].texture) - continue; - - nodes[i].firstVertex = v; - nodes[i].vertexCount = quads[i].count() * verticesPerQuad; - - const QMatrix4x4 matrix = nodes[i].texture->matrix(nodes[i].coordinateType); - - quads[i].makeInterleavedArrays(primitiveType, &map[v], matrix); - v += quads[i].count() * verticesPerQuad; - } - - vbo->unmap(); - vbo->bindArrays(); - - // Make sure the blend function is set up correctly in case we will be doing blending - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - float opacity = -1.0; - - for (int i = 0; i < LeafCount; i++) { - if (nodes[i].vertexCount == 0) - continue; - - setBlendEnabled(nodes[i].hasAlpha || nodes[i].opacity < 1.0); - - if (opacity != nodes[i].opacity) { - shader->setUniform(GLShader::ModulationConstant, - modulate(nodes[i].opacity, data.brightness())); - opacity = nodes[i].opacity; - } - - nodes[i].texture->setFilter(filter); - nodes[i].texture->setWrapMode(GL_CLAMP_TO_EDGE); - nodes[i].texture->bind(); - - vbo->draw(region, primitiveType, nodes[i].firstVertex, nodes[i].vertexCount, m_hardwareClipping); - } - - vbo->unbindArrays(); - - setBlendEnabled(false); - - if (!data.shader) - ShaderManager::instance()->popShader(); - - endRenderWindow(); -} - -void SceneOpenGL2Window::prepareStates(TextureType type, qreal opacity, qreal brightness, qreal saturation, int screen) -{ - // setup blending of transparent windows - bool opaque = isOpaque() && opacity == 1.0; - bool alpha = toplevel->hasAlpha() || type != Content; - if (type != Content) { - if (type == Shadow) { - opaque = false; - } else { - if (opacity == 1.0 && toplevel->isClient()) { - opaque = !(static_cast<Client*>(toplevel)->decorationHasAlpha()); - } else { - // TODO: add support in Deleted - opaque = false; - } - } - } - if (!opaque) { - glEnable(GL_BLEND); - if (alpha) { - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } else { - glBlendColor((float)opacity, (float)opacity, (float)opacity, (float)opacity); - glBlendFunc(GL_ONE, GL_ONE_MINUS_CONSTANT_ALPHA); - } - } - m_blendingEnabled = !opaque; - - const qreal rgb = brightness * opacity; - const qreal a = opacity; - - GLShader *shader = ShaderManager::instance()->getBoundShader(); - shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); - shader->setUniform(GLShader::Saturation, saturation); - - if (ColorCorrection *cc = static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()) { - cc->setupForOutput(screen); - } -} - -void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation) -{ - Q_UNUSED(type); - Q_UNUSED(opacity); - Q_UNUSED(brightness); - Q_UNUSED(saturation); - if (m_blendingEnabled) { - glDisable(GL_BLEND); - } - - if (ColorCorrection *cc = static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()) { - cc->setupForOutput(-1); - } -} - -//*************************************** -// SceneOpenGL1Window -//*************************************** -#ifdef KWIN_HAVE_OPENGL_1 -SceneOpenGL1Window::SceneOpenGL1Window(Toplevel *c) - : SceneOpenGL::Window(c) -{ -} - -SceneOpenGL1Window::~SceneOpenGL1Window() -{ -} - -// paint the window -void SceneOpenGL1Window::performPaint(int mask, QRegion region, WindowPaintData data) -{ - if (!beginRenderWindow(mask, region, data)) - return; - - pushMatrix(transformation(mask, data)); - - // shadow - if (m_shadow) { - paintShadow(region, data); - } - // decorations - paintDecorations(data, region); - - // paint the content - OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); - const WindowQuadList contentQuads = data.quads.select(WindowQuadContents); - if (previous && data.crossFadeProgress() != 1.0) { - // TODO: ARGB crsoofading is atm. a hack, playing on opacities for two dumb SrcOver operations - // Will require a caching texture or sth. else 1.2 compliant - float opacity = data.opacity(); - if (opacity < 0.95f || toplevel->hasAlpha()) { - opacity = 1 - data.crossFadeProgress(); - opacity = data.opacity() * (1 - pow(opacity, 1.0f + 2.0f * data.opacity())); - } - paintContent(s_frameTexture, region, mask, opacity, data, contentQuads, false); - previous->texture()->setFilter(filter == Scene::ImageFilterGood ? GL_LINEAR : GL_NEAREST); - WindowQuadList oldContents; - const QRect &oldGeometry = previous->contentsRect(); - Q_FOREACH (const WindowQuad &quad, contentQuads) { - // we need to create new window quads with normalize texture coordinates - // normal quads divide the x/y position by width/height. This would not work as the texture - // is larger than the visible content in case of a decorated Client resulting in garbage being shown. - // So we calculate the normalized texture coordinate in the Client's new content space and map it to - // the previous Client's content space. - WindowQuad newQuad(WindowQuadContents); - for (int i = 0; i < 4; ++i) { - const qreal xFactor = qreal(quad[i].textureX() - toplevel->clientPos().x())/qreal(toplevel->clientSize().width()); - const qreal yFactor = qreal(quad[i].textureY() - toplevel->clientPos().y())/qreal(toplevel->clientSize().height()); - WindowVertex vertex(quad[i].x(), quad[i].y(), - (xFactor * oldGeometry.width() + oldGeometry.x())/qreal(previous->size().width()), - (yFactor * oldGeometry.height() + oldGeometry.y())/qreal(previous->size().height())); - newQuad[i] = vertex; - } - oldContents.append(newQuad); - } - opacity = data.opacity() * (1.0 - data.crossFadeProgress()); - paintContent(previous->texture(), region, mask, opacity, data, oldContents, true); - } else { - paintContent(s_frameTexture, region, mask, data.opacity(), data, contentQuads, false); - } - - popMatrix(); - - endRenderWindow(); -} - -void SceneOpenGL1Window::paintContent(SceneOpenGL::Texture* content, const QRegion& region, int mask, - qreal opacity, const WindowPaintData& data, const WindowQuadList &contentQuads, bool normalized) -{ - if (contentQuads.isEmpty()) { - return; - } - content->bind(); - prepareStates(Content, opacity, data.brightness(), data.saturation(), data.screen()); - renderQuads(mask, region, contentQuads, content, normalized); - restoreStates(Content, opacity, data.brightness(), data.saturation()); - content->unbind(); -#ifndef KWIN_HAVE_OPENGLES - if (m_scene && m_scene->debug()) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - renderQuads(mask, region, contentQuads, content, normalized); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } -#endif -} - -void SceneOpenGL1Window::prepareStates(TextureType type, qreal opacity, qreal brightness, qreal saturation, int screen) -{ - Q_UNUSED(screen) - - GLTexture *tex = textureForType(type); - bool alpha = false; - bool opaque = true; - if (type == Content) { - alpha = toplevel->hasAlpha(); - opaque = isOpaque() && opacity == 1.0; - } else { - alpha = true; - opaque = false; - } - // setup blending of transparent windows - glPushAttrib(GL_ENABLE_BIT); - if (!opaque) { - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - if (saturation != 1.0 && tex->saturationSupported()) { - // First we need to get the color from [0; 1] range to [0.5; 1] range - glActiveTexture(GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_CONSTANT); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); - const float scale_constant[] = { 1.0, 1.0, 1.0, 0.5}; - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, scale_constant); - tex->bind(); - - // Then we take dot product of the result of previous pass and - // saturation_constant. This gives us completely unsaturated - // (greyscale) image - // Note that both operands have to be in range [0.5; 1] since opengl - // automatically substracts 0.5 from them - glActiveTexture(GL_TEXTURE1); - float saturation_constant[] = { 0.5 + 0.5 * 0.30, 0.5 + 0.5 * 0.59, 0.5 + 0.5 * 0.11, - static_cast<float>(saturation) }; - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, saturation_constant); - tex->bind(); - - // Finally we need to interpolate between the original image and the - // greyscale image to get wanted level of saturation - glActiveTexture(GL_TEXTURE2); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_CONSTANT); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, saturation_constant); - // Also replace alpha by primary color's alpha here - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - // And make primary color contain the wanted opacity - glColor4f(opacity, opacity, opacity, opacity); - tex->bind(); - - if (alpha || !opaque || brightness != 1.0f) { - glActiveTexture(GL_TEXTURE3); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - // The color has to be multiplied by both opacity and brightness - float opacityByBrightness = opacity * brightness; - glColor4f(opacityByBrightness, opacityByBrightness, opacityByBrightness, opacity); - if (alpha) { - // Multiply original texture's alpha by our opacity - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); - } else { - // Alpha will be taken from previous stage - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - } - tex->bind(); - } - - glActiveTexture(GL_TEXTURE0); - } else if (opacity != 1.0 || brightness != 1.0) { - // the window is additionally configured to have its opacity adjusted, - // do it - float opacityByBrightness = opacity * brightness; - if (alpha) { - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glColor4f(opacityByBrightness, opacityByBrightness, opacityByBrightness, - opacity); - } else { - // Multiply color by brightness and replace alpha by opacity - float constant[] = { opacityByBrightness, opacityByBrightness, opacityByBrightness, - static_cast<float>(opacity) }; - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_CONSTANT); - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); - } - } else if (!alpha && opaque) { - float constant[] = { 1.0, 1.0, 1.0, 1.0 }; - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_CONSTANT); - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant); - } -} - -void SceneOpenGL1Window::restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation) -{ - GLTexture *tex = textureForType(type); - if (opacity != 1.0 || saturation != 1.0 || brightness != 1.0f) { - if (saturation != 1.0 && tex->saturationSupported()) { - glActiveTexture(GL_TEXTURE3); - glDisable(tex->target()); - glActiveTexture(GL_TEXTURE2); - glDisable(tex->target()); - glActiveTexture(GL_TEXTURE1); - glDisable(tex->target()); - glActiveTexture(GL_TEXTURE0); - } - } - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glColor4f(0, 0, 0, 0); - - glPopAttrib(); // ENABLE_BIT -} -#endif - -//**************************************** -// OpenGLWindowPixmap -//**************************************** - -OpenGLWindowPixmap::OpenGLWindowPixmap(Scene::Window *window, SceneOpenGL* scene) - : WindowPixmap(window) - , m_scene(scene) - , m_texture(scene->createTexture()) -{ -} - -OpenGLWindowPixmap::~OpenGLWindowPixmap() -{ -} - -bool OpenGLWindowPixmap::bind() -{ - if (!m_texture->isNull()) { - if (!toplevel()->damage().isEmpty()) { - const bool success = m_texture->update(toplevel()->damage()); - // mipmaps need to be updated - m_texture->setDirty(); - toplevel()->resetDamage(); - return success; - } - return true; - } - if (!isValid()) { - return false; - } - - bool success = m_texture->load(pixmap(), toplevel()->size(), toplevel()->depth(), toplevel()->damage()); - - if (success) - toplevel()->resetDamage(); - else - kDebug(1212) << "Failed to bind window"; - return success; -} - -//**************************************** -// SceneOpenGL::EffectFrame -//**************************************** - -GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL; -QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL; - -SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) - : Scene::EffectFrame(frame) - , m_texture(NULL) - , m_textTexture(NULL) - , m_oldTextTexture(NULL) - , m_textPixmap(NULL) - , m_iconTexture(NULL) - , m_oldIconTexture(NULL) - , m_selectionTexture(NULL) - , m_unstyledVBO(NULL) - , m_scene(scene) -{ - if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { - updateUnstyledTexture(); - } -} - -SceneOpenGL::EffectFrame::~EffectFrame() -{ - delete m_texture; - delete m_textTexture; - delete m_textPixmap; - delete m_oldTextTexture; - delete m_iconTexture; - delete m_oldIconTexture; - delete m_selectionTexture; - delete m_unstyledVBO; -} - -void SceneOpenGL::EffectFrame::free() -{ - glFlush(); - delete m_texture; - m_texture = NULL; - delete m_textTexture; - m_textTexture = NULL; - delete m_textPixmap; - m_textPixmap = NULL; - delete m_iconTexture; - m_iconTexture = NULL; - delete m_selectionTexture; - m_selectionTexture = NULL; - delete m_unstyledVBO; - m_unstyledVBO = NULL; - delete m_oldIconTexture; - m_oldIconTexture = NULL; - delete m_oldTextTexture; - m_oldTextTexture = NULL; -} - -void SceneOpenGL::EffectFrame::freeIconFrame() -{ - delete m_iconTexture; - m_iconTexture = NULL; -} - -void SceneOpenGL::EffectFrame::freeTextFrame() -{ - delete m_textTexture; - m_textTexture = NULL; - delete m_textPixmap; - m_textPixmap = NULL; -} - -void SceneOpenGL::EffectFrame::freeSelection() -{ - delete m_selectionTexture; - m_selectionTexture = NULL; -} - -void SceneOpenGL::EffectFrame::crossFadeIcon() -{ - delete m_oldIconTexture; - m_oldIconTexture = m_iconTexture; - m_iconTexture = NULL; -} - -void SceneOpenGL::EffectFrame::crossFadeText() -{ - delete m_oldTextTexture; - m_oldTextTexture = m_textTexture; - m_textTexture = NULL; -} - -void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) -{ - if (m_effectFrame->geometry().isEmpty()) - return; // Nothing to display - - region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL - - GLShader* shader = m_effectFrame->shader(); - bool sceneShader = false; - if (!shader && ShaderManager::instance()->isValid()) { - shader = ShaderManager::instance()->pushShader(ShaderManager::SimpleShader); - sceneShader = true; - } else if (shader) { - ShaderManager::instance()->pushShader(shader); - } - - if (shader) { - if (sceneShader) - shader->setUniform(GLShader::Offset, QVector2D(0, 0)); - - shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); - shader->setUniform(GLShader::Saturation, 1.0f); - } - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#ifdef KWIN_HAVE_OPENGL_1 - if (!shader) - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); -#endif - - // Render the actual frame - if (m_effectFrame->style() == EffectFrameUnstyled) { - if (!m_unstyledVBO) { - m_unstyledVBO = new GLVertexBuffer(GLVertexBuffer::Static); - QRect area = m_effectFrame->geometry(); - area.moveTo(0, 0); - area.adjust(-5, -5, 5, 5); - - const int roundness = 5; - QVector<float> verts, texCoords; - verts.reserve(84); - texCoords.reserve(84); - - // top left - verts << area.left() << area.top(); - texCoords << 0.0f << 0.0f; - verts << area.left() << area.top() + roundness; - texCoords << 0.0f << 0.5f; - verts << area.left() + roundness << area.top(); - texCoords << 0.5f << 0.0f; - verts << area.left() + roundness << area.top() + roundness; - texCoords << 0.5f << 0.5f; - verts << area.left() << area.top() + roundness; - texCoords << 0.0f << 0.5f; - verts << area.left() + roundness << area.top(); - texCoords << 0.5f << 0.0f; - // top - verts << area.left() + roundness << area.top(); - texCoords << 0.5f << 0.0f; - verts << area.left() + roundness << area.top() + roundness; - texCoords << 0.5f << 0.5f; - verts << area.right() - roundness << area.top(); - texCoords << 0.5f << 0.0f; - verts << area.left() + roundness << area.top() + roundness; - texCoords << 0.5f << 0.5f; - verts << area.right() - roundness << area.top() + roundness; - texCoords << 0.5f << 0.5f; - verts << area.right() - roundness << area.top(); - texCoords << 0.5f << 0.0f; - // top right - verts << area.right() - roundness << area.top(); - texCoords << 0.5f << 0.0f; - verts << area.right() - roundness << area.top() + roundness; - texCoords << 0.5f << 0.5f; - verts << area.right() << area.top(); - texCoords << 1.0f << 0.0f; - verts << area.right() - roundness << area.top() + roundness; - texCoords << 0.5f << 0.5f; - verts << area.right() << area.top() + roundness; - texCoords << 1.0f << 0.5f; - verts << area.right() << area.top(); - texCoords << 1.0f << 0.0f; - // bottom left - verts << area.left() << area.bottom() - roundness; - texCoords << 0.0f << 0.5f; - verts << area.left() << area.bottom(); - texCoords << 0.0f << 1.0f; - verts << area.left() + roundness << area.bottom() - roundness; - texCoords << 0.5f << 0.5f; - verts << area.left() + roundness << area.bottom(); - texCoords << 0.5f << 1.0f; - verts << area.left() << area.bottom(); - texCoords << 0.0f << 1.0f; - verts << area.left() + roundness << area.bottom() - roundness; - texCoords << 0.5f << 0.5f; - // bottom - verts << area.left() + roundness << area.bottom() - roundness; - texCoords << 0.5f << 0.5f; - verts << area.left() + roundness << area.bottom(); - texCoords << 0.5f << 1.0f; - verts << area.right() - roundness << area.bottom() - roundness; - texCoords << 0.5f << 0.5f; - verts << area.left() + roundness << area.bottom(); - texCoords << 0.5f << 1.0f; - verts << area.right() - roundness << area.bottom(); - texCoords << 0.5f << 1.0f; - verts << area.right() - roundness << area.bottom() - roundness; - texCoords << 0.5f << 0.5f; - // bottom right - verts << area.right() - roundness << area.bottom() - roundness; - texCoords << 0.5f << 0.5f; - verts << area.right() - roundness << area.bottom(); - texCoords << 0.5f << 1.0f; - verts << area.right() << area.bottom() - roundness; - texCoords << 1.0f << 0.5f; - verts << area.right() - roundness << area.bottom(); - texCoords << 0.5f << 1.0f; - verts << area.right() << area.bottom(); - texCoords << 1.0f << 1.0f; - verts << area.right() << area.bottom() - roundness; - texCoords << 1.0f << 0.5f; - // center - verts << area.left() << area.top() + roundness; - texCoords << 0.0f << 0.5f; - verts << area.left() << area.bottom() - roundness; - texCoords << 0.0f << 0.5f; - verts << area.right() << area.top() + roundness; - texCoords << 1.0f << 0.5f; - verts << area.left() << area.bottom() - roundness; - texCoords << 0.0f << 0.5f; - verts << area.right() << area.bottom() - roundness; - texCoords << 1.0f << 0.5f; - verts << area.right() << area.top() + roundness; - texCoords << 1.0f << 0.5f; - - m_unstyledVBO->setData(verts.count() / 2, 2, verts.data(), texCoords.data()); - } - - if (shader) { - const float a = opacity * frameOpacity; - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(0.0, 0.0, 0.0, opacity * frameOpacity); -#endif - - m_unstyledTexture->bind(); - const QPoint pt = m_effectFrame->geometry().topLeft(); - if (sceneShader) { - shader->setUniform(GLShader::Offset, QVector2D(pt.x(), pt.y())); - } else { - QMatrix4x4 translation; - translation.translate(pt.x(), pt.y()); - if (shader) { - shader->setUniform(GLShader::WindowTransformation, translation); - } else { - pushMatrix(translation); - } - } - m_unstyledVBO->render(region, GL_TRIANGLES); - if (!sceneShader) { - if (shader) { - shader->setUniform(GLShader::WindowTransformation, QMatrix4x4()); - } else { - popMatrix(); - } - } - m_unstyledTexture->unbind(); - } else if (m_effectFrame->style() == EffectFrameStyled) { - if (!m_texture) // Lazy creation - updateTexture(); - - if (shader) { - const float a = opacity * frameOpacity; - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity * frameOpacity); -#endif - m_texture->bind(); - qreal left, top, right, bottom; - m_effectFrame->frame().getMargins(left, top, right, bottom); // m_geometry is the inner geometry - m_texture->render(region, m_effectFrame->geometry().adjusted(-left, -top, right, bottom)); - m_texture->unbind(); - - } - if (!m_effectFrame->selection().isNull()) { - if (!m_selectionTexture) { // Lazy creation - QPixmap pixmap = m_effectFrame->selectionFrame().framePixmap(); - if (!pixmap.isNull()) - m_selectionTexture = m_scene->createTexture(pixmap); - } - if (m_selectionTexture) { - if (shader) { - const float a = opacity * frameOpacity; - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } - #ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity * frameOpacity); - #endif - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - m_selectionTexture->bind(); - m_selectionTexture->render(region, m_effectFrame->selection()); - m_selectionTexture->unbind(); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - } - - // Render icon - if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) { - QPoint topLeft(m_effectFrame->geometry().x(), - m_effectFrame->geometry().center().y() - m_effectFrame->iconSize().height() / 2); - - if (m_effectFrame->isCrossFade() && m_oldIconTexture) { - if (shader) { - const float a = opacity * (1.0 - m_effectFrame->crossFadeProgress()); - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity * (1.0 - m_effectFrame->crossFadeProgress())); -#endif - - m_oldIconTexture->bind(); - m_oldIconTexture->render(region, QRect(topLeft, m_effectFrame->iconSize())); - m_oldIconTexture->unbind(); - if (shader) { - const float a = opacity * m_effectFrame->crossFadeProgress(); - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity * m_effectFrame->crossFadeProgress()); -#endif - } else { - if (shader) { - const QVector4D constant(opacity, opacity, opacity, opacity); - shader->setUniform(GLShader::ModulationConstant, constant); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity); -#endif - } - - if (!m_iconTexture) { // lazy creation - m_iconTexture = m_scene->createTexture(m_effectFrame->icon()); - } - m_iconTexture->bind(); - m_iconTexture->render(region, QRect(topLeft, m_effectFrame->iconSize())); - m_iconTexture->unbind(); - } - - // Render text - if (!m_effectFrame->text().isEmpty()) { - if (m_effectFrame->isCrossFade() && m_oldTextTexture) { - if (shader) { - const float a = opacity * (1.0 - m_effectFrame->crossFadeProgress()); - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity *(1.0 - m_effectFrame->crossFadeProgress())); -#endif - - m_oldTextTexture->bind(); - m_oldTextTexture->render(region, m_effectFrame->geometry()); - m_oldTextTexture->unbind(); - if (shader) { - const float a = opacity * m_effectFrame->crossFadeProgress(); - shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity * m_effectFrame->crossFadeProgress()); -#endif - } else { - if (shader) { - const QVector4D constant(opacity, opacity, opacity, opacity); - shader->setUniform(GLShader::ModulationConstant, constant); - } -#ifdef KWIN_HAVE_OPENGL_1 - else - glColor4f(1.0, 1.0, 1.0, opacity); -#endif - } - if (!m_textTexture) // Lazy creation - updateTextTexture(); - m_textTexture->bind(); - m_textTexture->render(region, m_effectFrame->geometry()); - m_textTexture->unbind(); - } - - if (shader) { - ShaderManager::instance()->popShader(); - } - glDisable(GL_BLEND); -} - -void SceneOpenGL::EffectFrame::updateTexture() -{ - delete m_texture; - m_texture = 0L; - if (m_effectFrame->style() == EffectFrameStyled) { - QPixmap pixmap = m_effectFrame->frame().framePixmap(); - m_texture = m_scene->createTexture(pixmap); - } -} - -void SceneOpenGL::EffectFrame::updateTextTexture() -{ - delete m_textTexture; - m_textTexture = 0L; - delete m_textPixmap; - m_textPixmap = 0L; - - if (m_effectFrame->text().isEmpty()) - return; - - // Determine position on texture to paint text - QRect rect(QPoint(0, 0), m_effectFrame->geometry().size()); - if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) - rect.setLeft(m_effectFrame->iconSize().width()); - - // If static size elide text as required - QString text = m_effectFrame->text(); - if (m_effectFrame->isStatic()) { - QFontMetrics metrics(m_effectFrame->font()); - text = metrics.elidedText(text, Qt::ElideRight, rect.width()); - } - - m_textPixmap = new QPixmap(m_effectFrame->geometry().size()); - m_textPixmap->fill(Qt::transparent); - QPainter p(m_textPixmap); - p.setFont(m_effectFrame->font()); - if (m_effectFrame->style() == EffectFrameStyled) - p.setPen(m_effectFrame->styledTextColor()); - else // TODO: What about no frame? Custom color setting required - p.setPen(Qt::white); - p.drawText(rect, m_effectFrame->alignment(), text); - p.end(); - m_textTexture = m_scene->createTexture(*m_textPixmap); -} - -void SceneOpenGL::EffectFrame::updateUnstyledTexture() -{ - delete m_unstyledTexture; - m_unstyledTexture = 0L; - delete m_unstyledPixmap; - m_unstyledPixmap = 0L; - // Based off circle() from kwinxrenderutils.cpp -#define CS 8 - m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); - m_unstyledPixmap->fill(Qt::transparent); - QPainter p(m_unstyledPixmap); - p.setRenderHint(QPainter::Antialiasing); - p.setPen(Qt::NoPen); - p.setBrush(Qt::black); - p.drawEllipse(m_unstyledPixmap->rect()); - p.end(); -#undef CS - m_unstyledTexture = new GLTexture(*m_unstyledPixmap); -} - -void SceneOpenGL::EffectFrame::cleanup() -{ - delete m_unstyledTexture; - m_unstyledTexture = NULL; - delete m_unstyledPixmap; - m_unstyledPixmap = NULL; -} - -//**************************************** -// SceneOpenGL::Shadow -//**************************************** -SceneOpenGLShadow::SceneOpenGLShadow(Toplevel *toplevel) - : Shadow(toplevel) - , m_texture(NULL) -{ -} - -SceneOpenGLShadow::~SceneOpenGLShadow() -{ - delete m_texture; -} - -void SceneOpenGLShadow::buildQuads() -{ - // prepare window quads - m_shadowQuads.clear(); - const QSizeF top(shadowPixmap(ShadowElementTop).size()); - const QSizeF topRight(shadowPixmap(ShadowElementTopRight).size()); - const QSizeF right(shadowPixmap(ShadowElementRight).size()); - const QSizeF bottomRight(shadowPixmap(ShadowElementBottomRight).size()); - const QSizeF bottom(shadowPixmap(ShadowElementBottom).size()); - const QSizeF bottomLeft(shadowPixmap(ShadowElementBottomLeft).size()); - const QSizeF left(shadowPixmap(ShadowElementLeft).size()); - const QSizeF topLeft(shadowPixmap(ShadowElementTopLeft).size()); - if ((left.width() - leftOffset() > topLevel()->width()) || - (right.width() - rightOffset() > topLevel()->width()) || - (top.height() - topOffset() > topLevel()->height()) || - (bottom.height() - bottomOffset() > topLevel()->height())) { - // if our shadow is bigger than the window, we don't render the shadow - setShadowRegion(QRegion()); - return; - } - - const QRectF outerRect(QPointF(-leftOffset(), -topOffset()), - QPointF(topLevel()->width() + rightOffset(), topLevel()->height() + bottomOffset())); - - const qreal width = topLeft.width() + top.width() + topRight.width(); - const qreal height = topLeft.height() + left.height() + bottomLeft.height(); - - qreal tx1(0.0), tx2(0.0), ty1(0.0), ty2(0.0); - - tx2 = topLeft.width()/width; - ty2 = topLeft.height()/height; - WindowQuad topLeftQuad(WindowQuadShadowTopLeft); - topLeftQuad[ 0 ] = WindowVertex(outerRect.x(), outerRect.y(), tx1, ty1); - topLeftQuad[ 1 ] = WindowVertex(outerRect.x() + topLeft.width(), outerRect.y(), tx2, ty1); - topLeftQuad[ 2 ] = WindowVertex(outerRect.x() + topLeft.width(), outerRect.y() + topLeft.height(), tx2, ty2); - topLeftQuad[ 3 ] = WindowVertex(outerRect.x(), outerRect.y() + topLeft.height(), tx1, ty2); - m_shadowQuads.append(topLeftQuad); - - tx1 = tx2; - tx2 = (topLeft.width() + top.width())/width; - ty2 = top.height()/height; - WindowQuad topQuad(WindowQuadShadowTop); - topQuad[ 0 ] = WindowVertex(outerRect.x() + topLeft.width(), outerRect.y(), tx1, ty1); - topQuad[ 1 ] = WindowVertex(outerRect.right() - topRight.width(), outerRect.y(), tx2, ty1); - topQuad[ 2 ] = WindowVertex(outerRect.right() - topRight.width(), outerRect.y() + top.height(),tx2, ty2); - topQuad[ 3 ] = WindowVertex(outerRect.x() + topLeft.width(), outerRect.y() + top.height(), tx1, ty2); - m_shadowQuads.append(topQuad); - - tx1 = tx2; - tx2 = 1.0; - ty2 = topRight.height()/height; - WindowQuad topRightQuad(WindowQuadShadowTopRight); - topRightQuad[ 0 ] = WindowVertex(outerRect.right() - topRight.width(), outerRect.y(), tx1, ty1); - topRightQuad[ 1 ] = WindowVertex(outerRect.right(), outerRect.y(), tx2, ty1); - topRightQuad[ 2 ] = WindowVertex(outerRect.right(), outerRect.y() + topRight.height(), tx2, ty2); - topRightQuad[ 3 ] = WindowVertex(outerRect.right() - topRight.width(), outerRect.y() + topRight.height(), tx1, ty2); - m_shadowQuads.append(topRightQuad); - - tx1 = (width - right.width())/width; - ty1 = topRight.height()/height; - ty2 = (topRight.height() + right.height())/height; - WindowQuad rightQuad(WindowQuadShadowRight); - rightQuad[ 0 ] = WindowVertex(outerRect.right() - right.width(), outerRect.y() + topRight.height(), tx1, ty1); - rightQuad[ 1 ] = WindowVertex(outerRect.right(), outerRect.y() + topRight.height(), tx2, ty1); - rightQuad[ 2 ] = WindowVertex(outerRect.right(), outerRect.bottom() - bottomRight.height(), tx2, ty2); - rightQuad[ 3 ] = WindowVertex(outerRect.right() - right.width(), outerRect.bottom() - bottomRight.height(), tx1, ty2); - m_shadowQuads.append(rightQuad); - - tx1 = (width - bottomRight.width())/width; - ty1 = ty2; - ty2 = 1.0; - WindowQuad bottomRightQuad(WindowQuadShadowBottomRight); - bottomRightQuad[ 0 ] = WindowVertex(outerRect.right() - bottomRight.width(), outerRect.bottom() - bottomRight.height(), tx1, ty1); - bottomRightQuad[ 1 ] = WindowVertex(outerRect.right(), outerRect.bottom() - bottomRight.height(), tx2, ty1); - bottomRightQuad[ 2 ] = WindowVertex(outerRect.right(), outerRect.bottom(), tx2, ty2); - bottomRightQuad[ 3 ] = WindowVertex(outerRect.right() - bottomRight.width(), outerRect.bottom(), tx1, ty2); - m_shadowQuads.append(bottomRightQuad); - - tx2 = tx1; - tx1 = bottomLeft.width()/width; - ty1 = (height - bottom.height())/height; - WindowQuad bottomQuad(WindowQuadShadowBottom); - bottomQuad[ 0 ] = WindowVertex(outerRect.x() + bottomLeft.width(), outerRect.bottom() - bottom.height(), tx1, ty1); - bottomQuad[ 1 ] = WindowVertex(outerRect.right() - bottomRight.width(), outerRect.bottom() - bottom.height(), tx2, ty1); - bottomQuad[ 2 ] = WindowVertex(outerRect.right() - bottomRight.width(), outerRect.bottom(), tx2, ty2); - bottomQuad[ 3 ] = WindowVertex(outerRect.x() + bottomLeft.width(), outerRect.bottom(), tx1, ty2); - m_shadowQuads.append(bottomQuad); - - tx1 = 0.0; - tx2 = bottomLeft.width()/width; - ty1 = (height - bottomLeft.height())/height; - WindowQuad bottomLeftQuad(WindowQuadShadowBottomLeft); - bottomLeftQuad[ 0 ] = WindowVertex(outerRect.x(), outerRect.bottom() - bottomLeft.height(), tx1, ty1); - bottomLeftQuad[ 1 ] = WindowVertex(outerRect.x() + bottomLeft.width(), outerRect.bottom() - bottomLeft.height(), tx2, ty1); - bottomLeftQuad[ 2 ] = WindowVertex(outerRect.x() + bottomLeft.width(), outerRect.bottom(), tx2, ty2); - bottomLeftQuad[ 3 ] = WindowVertex(outerRect.x(), outerRect.bottom(), tx1, ty2); - m_shadowQuads.append(bottomLeftQuad); - - tx2 = left.width()/width; - ty2 = ty1; - ty1 = topLeft.height()/height; - WindowQuad leftQuad(WindowQuadShadowLeft); - leftQuad[ 0 ] = WindowVertex(outerRect.x(), outerRect.y() + topLeft.height(), tx1, ty1); - leftQuad[ 1 ] = WindowVertex(outerRect.x() + left.width(), outerRect.y() + topLeft.height(), tx2, ty1); - leftQuad[ 2 ] = WindowVertex(outerRect.x() + left.width(), outerRect.bottom() - bottomLeft.height(), tx2, ty2); - leftQuad[ 3 ] = WindowVertex(outerRect.x(), outerRect.bottom() - bottomLeft.height(), tx1, ty2); - m_shadowQuads.append(leftQuad); -} - -bool SceneOpenGLShadow::prepareBackend() -{ - const QSize top(shadowPixmap(ShadowElementTop).size()); - const QSize topRight(shadowPixmap(ShadowElementTopRight).size()); - const QSize right(shadowPixmap(ShadowElementRight).size()); - const QSize bottomRight(shadowPixmap(ShadowElementBottomRight).size()); - const QSize bottom(shadowPixmap(ShadowElementBottom).size()); - const QSize bottomLeft(shadowPixmap(ShadowElementBottomLeft).size()); - const QSize left(shadowPixmap(ShadowElementLeft).size()); - const QSize topLeft(shadowPixmap(ShadowElementTopLeft).size()); - - const int width = topLeft.width() + top.width() + topRight.width(); - const int height = topLeft.height() + left.height() + bottomLeft.height(); - - QImage image(width, height, QImage::Format_ARGB32); - image.fill(Qt::transparent); - QPainter p; - p.begin(&image); - p.drawPixmap(0, 0, shadowPixmap(ShadowElementTopLeft)); - p.drawPixmap(topLeft.width(), 0, shadowPixmap(ShadowElementTop)); - p.drawPixmap(topLeft.width() + top.width(), 0, shadowPixmap(ShadowElementTopRight)); - p.drawPixmap(0, topLeft.height(), shadowPixmap(ShadowElementLeft)); - p.drawPixmap(width - right.width(), topRight.height(), shadowPixmap(ShadowElementRight)); - p.drawPixmap(0, topLeft.height() + left.height(), shadowPixmap(ShadowElementBottomLeft)); - p.drawPixmap(bottomLeft.width(), height - bottom.height(), shadowPixmap(ShadowElementBottom)); - p.drawPixmap(bottomLeft.width() + bottom.width(), topRight.height() + right.height(), shadowPixmap(ShadowElementBottomRight)); - p.end(); - - delete m_texture; - m_texture = new GLTexture(image); - - return true; -} - -SwapProfiler::SwapProfiler() -{ - init(); -} - -void SwapProfiler::init() -{ - m_time = 2 * 1000*1000; // we start with a long time mean of 2ms ... - m_counter = 0; -} - -void SwapProfiler::begin() -{ - m_timer.start(); -} - -char SwapProfiler::end() -{ - // .. and blend in actual values. - // this way we prevent extremes from killing our long time mean - m_time = (10*m_time + m_timer.nsecsElapsed())/11; - if (++m_counter > 500) { - const bool blocks = m_time > 1000 * 1000; // 1ms, i get ~250µs and ~7ms w/o triple buffering... - kDebug(1212) << "Triple buffering detection:" << QString(blocks ? "NOT available" : "Available") << - " - Mean block time:" << m_time/(1000.0*1000.0) << "ms"; - return blocks ? 'd' : 't'; - } - return 0; -} - -} // namespace diff --git a/kwin/scene_opengl.h b/kwin/scene_opengl.h deleted file mode 100644 index 753d1cab..00000000 --- a/kwin/scene_opengl.h +++ /dev/null @@ -1,683 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org> -Copyright (C) 2009, 2010, 2011 Martin Gräßlin <mgraesslin@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. If not, see <http://www.gnu.org/licenses/>. -*********************************************************************/ - -#ifndef KWIN_SCENE_OPENGL_H -#define KWIN_SCENE_OPENGL_H - -#include "scene.h" -#include "shadow.h" - -#include "kwinglutils.h" -#include "kwingltexture_p.h" - -namespace KWin -{ -class ColorCorrection; -class LanczosFilter; -class OpenGLBackend; -class OpenGLPaintRedirector; - -class SceneOpenGL - : public Scene -{ - Q_OBJECT -public: - class EffectFrame; - class Texture; - class TexturePrivate; - class Window; - virtual ~SceneOpenGL(); - virtual bool initFailed() const; - virtual bool hasPendingFlush() const; - virtual qint64 paint(QRegion damage, ToplevelList windows); - virtual void windowAdded(Toplevel*); - virtual void windowDeleted(Deleted*); - virtual void screenGeometryChanged(const QSize &size); - virtual OverlayWindow *overlayWindow(); - virtual bool blocksForRetrace() const; - virtual bool syncsToVBlank() const; - - void idle(); - - bool debug() const { return m_debug; } - - /** - * @brief Factory method to create a backend specific texture. - * - * @return :SceneOpenGL::Texture* - **/ - Texture *createTexture(); - Texture *createTexture(const QPixmap& pix, GLenum target = GL_TEXTURE_2D); - -#ifndef KWIN_HAVE_OPENGLES - /** - * Copy a region of pixels from the current read to the current draw buffer - */ - static void copyPixels(const QRegion ®ion); -#endif - - static SceneOpenGL *createScene(); - -protected: - SceneOpenGL(Workspace* ws, OpenGLBackend *backend); - virtual void paintBackground(QRegion region); - virtual void extendPaintRegion(QRegion ®ion, bool opaqueFullscreen); - QMatrix4x4 transformation(int mask, const ScreenPaintData &data) const; - virtual void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data); - - void handleGraphicsReset(GLenum status); - - virtual void doPaintBackground(const QVector<float> &vertices) = 0; - virtual SceneOpenGL::Window *createWindow(Toplevel *t) = 0; - -Q_SIGNALS: - void resetCompositing(); - -public Q_SLOTS: - virtual void windowOpacityChanged(KWin::Toplevel* c); - virtual void windowGeometryShapeChanged(KWin::Toplevel* c); - virtual void windowClosed(KWin::Toplevel* c, KWin::Deleted* deleted); -protected: - bool init_ok; -private: - bool viewportLimitsMatched(const QSize &size) const; -private: - QHash< Toplevel*, Window* > windows; - bool m_debug; - OpenGLBackend *m_backend; -}; - -class SceneOpenGL2 : public SceneOpenGL -{ - Q_OBJECT -public: - explicit SceneOpenGL2(OpenGLBackend *backend); - virtual ~SceneOpenGL2(); - virtual CompositingType compositingType() const { - return OpenGL2Compositing; - } - - static bool supported(OpenGLBackend *backend); - - ColorCorrection *colorCorrection(); - -protected: - virtual void paintGenericScreen(int mask, ScreenPaintData data); - virtual void doPaintBackground(const QVector< float >& vertices); - virtual SceneOpenGL::Window *createWindow(Toplevel *t); - virtual void finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data); - virtual void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data); - -private Q_SLOTS: - void slotColorCorrectedChanged(bool recreateShaders = true); - void resetLanczosFilter(); - -private: - void performPaintWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data); - -private: - LanczosFilter *m_lanczosFilter; - QScopedPointer<ColorCorrection> m_colorCorrection; - GLuint vao; -}; - -#ifdef KWIN_HAVE_OPENGL_1 -class SceneOpenGL1 : public SceneOpenGL -{ -public: - explicit SceneOpenGL1(OpenGLBackend *backend); - virtual ~SceneOpenGL1(); - virtual void screenGeometryChanged(const QSize &size); - virtual qint64 paint(QRegion damage, ToplevelList windows); - virtual CompositingType compositingType() const { - return OpenGL1Compositing; - } - - static bool supported(OpenGLBackend *backend); - -protected: - virtual void paintGenericScreen(int mask, ScreenPaintData data); - virtual void doPaintBackground(const QVector< float >& vertices); - virtual SceneOpenGL::Window *createWindow(Toplevel *t); - -private: - void setupModelViewProjectionMatrix(); - bool m_resetModelViewProjectionMatrix; -}; -#endif - -class SceneOpenGL::TexturePrivate - : public GLTexturePrivate -{ -public: - virtual ~TexturePrivate(); - - virtual void findTarget() = 0; - virtual bool loadTexture(const Pixmap& pix, const QSize& size, int depth) = 0; - virtual OpenGLBackend *backend() = 0; - virtual bool update(const QRegion &damage); - -protected: - TexturePrivate(); - -private: - Q_DISABLE_COPY(TexturePrivate) -}; - -class SceneOpenGL::Texture - : public GLTexture -{ -public: - Texture(OpenGLBackend *backend); - Texture(OpenGLBackend *backend, const QPixmap& pix, GLenum target = GL_TEXTURE_2D); - virtual ~Texture(); - - Texture & operator = (const Texture& tex); - - using GLTexture::load; - virtual bool load(const QImage& image, GLenum target = GL_TEXTURE_2D); - virtual bool load(const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D); - virtual void discard(); - bool update(const QRegion &damage); - -protected: - void findTarget(); - virtual bool load(const Pixmap& pix, const QSize& size, int depth, - QRegion region); - virtual bool load(const Pixmap& pix, const QSize& size, int depth); - - Texture(TexturePrivate& dd); - -private: - Q_DECLARE_PRIVATE(Texture) - - friend class OpenGLWindowPixmap; -}; - -class SceneOpenGL::Window - : public Scene::Window -{ -public: - virtual ~Window(); - bool beginRenderWindow(int mask, const QRegion ®ion, WindowPaintData &data); - virtual void performPaint(int mask, QRegion region, WindowPaintData data) = 0; - void endRenderWindow(); - bool bindTexture(); - void setScene(SceneOpenGL *scene) { - m_scene = scene; - } - -protected: - virtual WindowPixmap* createWindowPixmap(); - Window(Toplevel* c); - enum TextureType { - Content, - DecorationLeftRight, - DecorationTopBottom, - Shadow - }; - - QMatrix4x4 transformation(int mask, const WindowPaintData &data) const; - bool getDecorationTextures(GLTexture **textures) const; - void paintDecoration(GLTexture *texture, TextureType type, const QRegion ®ion, const WindowPaintData &data, const WindowQuadList &quads); - void paintShadow(const QRegion ®ion, const WindowPaintData &data); - void renderQuads(int, const QRegion& region, const WindowQuadList& quads, GLTexture* tex, bool normalized); - /** - * @brief Prepare the OpenGL rendering state before the texture with @p type will be rendered. - * - * @param type The type of the Texture which will be rendered - * @param opacity The opacity value to use for this rendering - * @param brightness The brightness value to use for this rendering - * @param saturation The saturation value to use for this rendering - * @param screen The index of the screen to use for this rendering - **/ - virtual void prepareStates(TextureType type, qreal opacity, qreal brightness, qreal saturation, int screen) = 0; - /** - * @brief Restores the OpenGL rendering state after the texture with @p type has been rendered. - * - * @param type The type of the Texture which has been rendered - * @param opacity The opacity value used for the rendering - * @param brightness The brightness value used for this rendering - * @param saturation The saturation value used for this rendering - * @param screen The index of the screen to use for this rendering - **/ - virtual void restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation) = 0; - - /** - * @brief Returns the texture for the given @p type. - * - * @param type The Texture Type for which the texture should be retrieved - * @return :GLTexture* the texture - **/ - GLTexture *textureForType(TextureType type); - - void paintDecorations(const WindowPaintData &data, const QRegion ®ion); - -protected: - SceneOpenGL *m_scene; - bool m_hardwareClipping; - -private: - OpenGLPaintRedirector *paintRedirector() const; -}; - -class SceneOpenGL2Window : public SceneOpenGL::Window -{ -public: - enum Leaf { ShadowLeaf = 0, LeftRightLeaf, TopBottomLeaf, ContentLeaf, PreviousContentLeaf, LeafCount }; - - struct LeafNode - { - LeafNode() - : texture(0), - firstVertex(0), - vertexCount(0), - opacity(1.0), - hasAlpha(false), - coordinateType(UnnormalizedCoordinates) - { - } - - GLTexture *texture; - int firstVertex; - int vertexCount; - float opacity; - bool hasAlpha; - TextureCoordinateType coordinateType; - }; - - explicit SceneOpenGL2Window(Toplevel *c); - virtual ~SceneOpenGL2Window(); - -protected: - QVector4D modulate(float opacity, float brightness) const; - void setBlendEnabled(bool enabled); - void setupLeafNodes(LeafNode *nodes, const WindowQuadList *quads, const WindowPaintData &data); - virtual void performPaint(int mask, QRegion region, WindowPaintData data); - virtual void prepareStates(TextureType type, qreal opacity, qreal brightness, qreal saturation, int screen); - virtual void restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation); - -private: - /** - * Whether prepareStates enabled blending and restore states should disable again. - **/ - bool m_blendingEnabled; -}; - -#ifdef KWIN_HAVE_OPENGL_1 -class SceneOpenGL1Window : public SceneOpenGL::Window -{ -public: - explicit SceneOpenGL1Window(Toplevel *c); - virtual ~SceneOpenGL1Window(); - -protected: - virtual void performPaint(int mask, QRegion region, WindowPaintData data); - virtual void prepareStates(TextureType type, qreal opacity, qreal brightness, qreal saturation, int screen); - virtual void restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation); -private: - void paintContent(SceneOpenGL::Texture* content, const QRegion& region, int mask, qreal opacity, - const WindowPaintData& data, const WindowQuadList &contentQuads, bool normalized); -}; -#endif - -class OpenGLWindowPixmap : public WindowPixmap -{ -public: - explicit OpenGLWindowPixmap(Scene::Window *window, SceneOpenGL *scene); - virtual ~OpenGLWindowPixmap(); - SceneOpenGL::Texture *texture() const; - bool bind(); -private: - SceneOpenGL *m_scene; - QScopedPointer<SceneOpenGL::Texture> m_texture; -}; - -class SceneOpenGL::EffectFrame - : public Scene::EffectFrame -{ -public: - EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene); - virtual ~EffectFrame(); - - virtual void free(); - virtual void freeIconFrame(); - virtual void freeTextFrame(); - virtual void freeSelection(); - - virtual void render(QRegion region, double opacity, double frameOpacity); - - virtual void crossFadeIcon(); - virtual void crossFadeText(); - - static void cleanup(); - -private: - void updateTexture(); - void updateTextTexture(); - - Texture* m_texture; - Texture* m_textTexture; - Texture* m_oldTextTexture; - QPixmap* m_textPixmap; // need to keep the pixmap around to workaround some driver problems - Texture* m_iconTexture; - Texture* m_oldIconTexture; - Texture* m_selectionTexture; - GLVertexBuffer* m_unstyledVBO; - SceneOpenGL *m_scene; - - static GLTexture* m_unstyledTexture; - static QPixmap* m_unstyledPixmap; // need to keep the pixmap around to workaround some driver problems - static void updateUnstyledTexture(); // Update OpenGL unstyled frame texture -}; - -/** - * @short OpenGL implementation of Shadow. - * - * This class extends Shadow by the Elements required for OpenGL rendering. - * @author Martin Gräßlin <mgraesslin@kde.org> - **/ -class SceneOpenGLShadow - : public Shadow -{ -public: - explicit SceneOpenGLShadow(Toplevel *toplevel); - virtual ~SceneOpenGLShadow(); - - GLTexture *shadowTexture() { - return m_texture; - } -protected: - virtual void buildQuads(); - virtual bool prepareBackend(); -private: - GLTexture *m_texture; -}; - -/** - * @short Profiler to detect whether we have triple buffering - * The strategy is to start setBlocksForRetrace(false) but assume blocking and have the system prove that assumption wrong - **/ -class SwapProfiler -{ -public: - SwapProfiler(); - void init(); - void begin(); - /** - * @return char being 'd' for double, 't' for triple (or more - but non-blocking) buffering and - * 0 (NOT '0') otherwise, so you can act on "if (char result = SwapProfiler::end()) { fooBar(); } - **/ - char end(); -private: - QElapsedTimer m_timer; - qint64 m_time; - int m_counter; -}; - -/** - * @brief The OpenGLBackend creates and holds the OpenGL context and is responsible for Texture from Pixmap. - * - * The OpenGLBackend is an abstract base class used by the SceneOpenGL to abstract away the differences - * between various OpenGL windowing systems such as GLX and EGL. - * - * A concrete implementation has to create and release the OpenGL context in a way so that the - * SceneOpenGL does not have to care about it. - * - * In addition a major task for this class is to generate the SceneOpenGL::TexturePrivate which is - * able to perform the texture from pixmap operation in the given backend. - * - * @author Martin Gräßlin <mgraesslin@kde.org> - **/ -class OpenGLBackend -{ -public: - OpenGLBackend(); - virtual ~OpenGLBackend(); - /** - * @return Time passes since start of rendering current frame. - * @see startRenderTimer - **/ - qint64 renderTime() { - return m_renderTimer.nsecsElapsed(); - } - virtual void screenGeometryChanged(const QSize &size) = 0; - virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture) = 0; - - /** - * @brief Backend specific code to prepare the rendering of a frame including flushing the - * previously rendered frame to the screen if the backend works this way. - * - * @return A region that if not empty will be repainted in addition to the damaged region - **/ - virtual QRegion prepareRenderingFrame() = 0; - - /** - * @brief Backend specific code to handle the end of rendering a frame. - * - * @param renderedRegion The possibly larger region that has been rendered - * @param damagedRegion The damaged region that should be posted - **/ - virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0; - - /** - * @brief Compositor is going into idle mode, flushes any pending paints. - **/ - void idle(); - - /** - * @return bool Whether the scene needs to flush a frame. - **/ - bool hasPendingFlush() const { - return !m_lastDamage.isEmpty(); - } - - /** - * @brief Returns the OverlayWindow used by the backend. - * - * A backend does not have to use an OverlayWindow, this is mostly for the X world. - * In case the backend does not use an OverlayWindow it is allowed to return @c null. - * It's the task of the caller to check whether it is @c null. - * - * @return :OverlayWindow* - **/ - OverlayWindow *overlayWindow() { - return m_overlayWindow; - } - /** - * @brief Whether the creation of the Backend failed. - * - * The SceneOpenGL should test whether the Backend got constructed correctly. If this method - * returns @c true, the SceneOpenGL should not try to start the rendering. - * - * @return bool @c true if the creation of the Backend failed, @c false otherwise. - **/ - bool isFailed() const { - return m_failed; - } - /** - * @brief Whether the Backend provides VSync. - * - * Currently only the GLX backend can provide VSync. - * - * @return bool @c true if VSync support is available, @c false otherwise - **/ - bool syncsToVBlank() const { - return m_syncsToVBlank; - } - /** - * @brief Whether VSync blocks execution until the screen is in the retrace - * - * Case for waitVideoSync and non triple buffering buffer swaps - * - **/ - bool blocksForRetrace() const { - return m_blocksForRetrace; - } - /** - * @brief Whether the backend uses direct rendering. - * - * Some OpenGLScene modes require direct rendering. E.g. the OpenGL 2 should not be used - * if direct rendering is not supported by the Scene. - * - * @return bool @c true if the GL context is direct, @c false if indirect - **/ - bool isDirectRendering() const { - return m_directRendering; - } - - bool supportsBufferAge() const { - return m_haveBufferAge; - } - - /** - * Returns the damage that has accumulated since a buffer of the given age was presented. - */ - QRegion accumulatedDamageHistory(int bufferAge) const; - - /** - * Saves the given region to damage history. - */ - void addToDamageHistory(const QRegion ®ion); - -protected: - /** - * @brief Backend specific flushing of frame to screen. - **/ - virtual void present() = 0; - /** - * @brief Sets the backend initialization to failed. - * - * This method should be called by the concrete subclass in case the initialization failed. - * The given @p reason is logged as a warning. - * - * @param reason The reason why the initialization failed. - **/ - void setFailed(const QString &reason); - /** - * @brief Sets whether the backend provides VSync. - * - * Should be called by the concrete subclass once it is determined whether VSync is supported. - * If the subclass does not call this method, the backend defaults to @c false. - * @param enabled @c true if VSync support available, @c false otherwise. - **/ - void setSyncsToVBlank(bool enabled) { - m_syncsToVBlank = enabled; - } - /** - * @brief Sets whether the VSync iplementation blocks - * - * Should be called by the concrete subclass once it is determined how VSync works. - * If the subclass does not call this method, the backend defaults to @c false. - * @param enabled @c true if VSync blocks, @c false otherwise. - **/ - void setBlocksForRetrace(bool enabled) { - m_blocksForRetrace = enabled; - } - /** - * @brief Sets whether the OpenGL context is direct. - * - * Should be called by the concrete subclass once it is determined whether the OpenGL context is - * direct or indirect. - * If the subclass does not call this method, the backend defaults to @c false. - * - * @param direct @c true if the OpenGL context is direct, @c false if indirect - **/ - void setIsDirectRendering(bool direct) { - m_directRendering = direct; - } - - void setSupportsBufferAge(bool value) { - m_haveBufferAge = value; - } - - /** - * @return const QRegion& Damage of previously rendered frame - **/ - const QRegion &lastDamage() const { - return m_lastDamage; - } - void setLastDamage(const QRegion &damage) { - m_lastDamage = damage; - } - /** - * @brief Starts the timer for how long it takes to render the frame. - * - * @see renderTime - **/ - void startRenderTimer() { - m_renderTimer.start(); - } - - SwapProfiler m_swapProfiler; - -private: - /** - * @brief The OverlayWindow used by this Backend. - **/ - OverlayWindow *m_overlayWindow; - /** - * @brief Whether VSync is available and used, defaults to @c false. - **/ - bool m_syncsToVBlank; - /** - * @brief Whether present() will block execution until the next vertical retrace @c false. - **/ - bool m_blocksForRetrace; - /** - * @brief Whether direct rendering is used, defaults to @c false. - **/ - bool m_directRendering; - /** - * @brief Whether the backend supports GLX_EXT_buffer_age / EGL_EXT_buffer_age. - */ - bool m_haveBufferAge; - /** - * @brief Whether the initialization failed, of course default to @c false. - **/ - bool m_failed; - /** - * @brief Damaged region of previously rendered frame. - **/ - QRegion m_lastDamage; - /** - * @brief The damage history for the past 10 frames. - */ - QList<QRegion> m_damageHistory; - /** - * @brief Timer to measure how long a frame renders. - **/ - QElapsedTimer m_renderTimer; -}; - -inline bool SceneOpenGL::hasPendingFlush() const -{ - return m_backend->hasPendingFlush(); -} - -inline SceneOpenGL::Texture* OpenGLWindowPixmap::texture() const -{ - return m_texture.data(); -} - -} // namespace - -#endif diff --git a/kwin/scene_xrender.cpp b/kwin/scene_xrender.cpp index fb532889..cfc9caee 100644 --- a/kwin/scene_xrender.cpp +++ b/kwin/scene_xrender.cpp @@ -19,9 +19,12 @@ 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 "config-kwin.h" + #include "scene_xrender.h" -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include "toplevel.h" #include "client.h" @@ -120,7 +123,7 @@ SceneXrender::~SceneXrender() buffer = XCB_RENDER_PICTURE_NONE; m_overlayWindow->destroy(); foreach (Window * w, windows) - delete w; + delete w; delete m_overlayWindow; } @@ -1018,7 +1021,6 @@ void SceneXrender::EffectFrame::updatePicture() void SceneXrender::EffectFrame::updateTextPicture() { - // Mostly copied from SceneOpenGL::EffectFrame::updateTextTexture() above delete m_textPicture; m_textPicture = 0L; diff --git a/kwin/scene_xrender.h b/kwin/scene_xrender.h index 0edf8900..0bf50db6 100644 --- a/kwin/scene_xrender.h +++ b/kwin/scene_xrender.h @@ -21,10 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef KWIN_SCENE_XRENDER_H #define KWIN_SCENE_XRENDER_H +#include "config-kwin.h" + #include "scene.h" #include "shadow.h" -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE namespace KWin { diff --git a/kwin/shaders/1.10/lanczos-fragment.glsl b/kwin/shaders/1.10/lanczos-fragment.glsl deleted file mode 100644 index 3141d790..00000000 --- a/kwin/shaders/1.10/lanczos-fragment.glsl +++ /dev/null @@ -1,16 +0,0 @@ -uniform sampler2D texUnit; -uniform vec2 offsets[16]; -uniform vec4 kernel[16]; - -varying vec2 varyingTexCoords; - -void main(void) -{ - vec4 sum = texture2D(texUnit, varyingTexCoords.st) * kernel[0]; - for (int i = 1; i < 16; i++) { - sum += texture2D(texUnit, varyingTexCoords.st - offsets[i]) * kernel[i]; - sum += texture2D(texUnit, varyingTexCoords.st + offsets[i]) * kernel[i]; - } - gl_FragColor = sum; -} - diff --git a/kwin/shaders/1.10/scene-color-fragment.glsl b/kwin/shaders/1.10/scene-color-fragment.glsl deleted file mode 100644 index db3473ea..00000000 --- a/kwin/shaders/1.10/scene-color-fragment.glsl +++ /dev/null @@ -1,5 +0,0 @@ -uniform vec4 geometryColor; - -void main() { - gl_FragColor = geometryColor; -} diff --git a/kwin/shaders/1.10/scene-color-vertex.glsl b/kwin/shaders/1.10/scene-color-vertex.glsl deleted file mode 100644 index d06dff09..00000000 --- a/kwin/shaders/1.10/scene-color-vertex.glsl +++ /dev/null @@ -1,10 +0,0 @@ -uniform mat4 projection; -// offset of the window/texture to be rendered -uniform vec2 offset; - -// passed in vertex - only x and y are used -attribute vec4 vertex; - -void main() { - gl_Position = projection*vec4(vertex.xy + offset, vertex.zw); -} diff --git a/kwin/shaders/1.10/scene-fragment.glsl b/kwin/shaders/1.10/scene-fragment.glsl deleted file mode 100644 index 314bf5a6..00000000 --- a/kwin/shaders/1.10/scene-fragment.glsl +++ /dev/null @@ -1,23 +0,0 @@ -uniform sampler2D sampler; -uniform vec4 modulation; -uniform float saturation; - -varying vec2 varyingTexCoords; - -//varying vec4 color; - -void main() { - vec4 tex = texture2D(sampler, varyingTexCoords); - - if (saturation != 1.0) { - tex.rgb = mix(vec3(dot( vec3( 0.30, 0.59, 0.11 ), tex.rgb )), tex.rgb, saturation); - } - - tex *= modulation; - -#ifdef KWIN_SHADER_DEBUG - tex.g = min(tex.g + 0.5, 1.0); -#endif - - gl_FragColor = tex; -} diff --git a/kwin/shaders/1.10/scene-generic-vertex.glsl b/kwin/shaders/1.10/scene-generic-vertex.glsl deleted file mode 100644 index 6b970c48..00000000 --- a/kwin/shaders/1.10/scene-generic-vertex.glsl +++ /dev/null @@ -1,17 +0,0 @@ -uniform mat4 projection; -uniform mat4 modelview; -uniform mat4 screenTransformation; -uniform mat4 windowTransformation; - -// passed in vertex - only x and y are used -attribute vec4 vertex; -// passed in texCoords - to be forwarded -attribute vec2 texCoord; - -// texCoords passed to fragment shader -varying vec2 varyingTexCoords; - -void main() { - varyingTexCoords = texCoord; - gl_Position = projection*(modelview*screenTransformation*windowTransformation)*vertex; -} diff --git a/kwin/shaders/1.10/scene-vertex.glsl b/kwin/shaders/1.10/scene-vertex.glsl deleted file mode 100644 index 1aab8a8b..00000000 --- a/kwin/shaders/1.10/scene-vertex.glsl +++ /dev/null @@ -1,16 +0,0 @@ -uniform mat4 projection; -// offset of the window/texture to be rendered -uniform vec2 offset; - -// passed in vertex - only x and y are used -attribute vec4 vertex; -// passed in texCoords - to be forwarded -attribute vec2 texCoord; - -// texCoords passed to fragment shader -varying vec2 varyingTexCoords; - -void main() { - varyingTexCoords = texCoord; - gl_Position = projection*vec4(vertex.xy + offset, vertex.zw); -} diff --git a/kwin/shaders/1.40/lanczos-fragment.glsl b/kwin/shaders/1.40/lanczos-fragment.glsl deleted file mode 100644 index 0852ea10..00000000 --- a/kwin/shaders/1.40/lanczos-fragment.glsl +++ /dev/null @@ -1,19 +0,0 @@ -#version 140 - -uniform sampler2D texUnit; -uniform vec2 offsets[16]; -uniform vec4 kernel[16]; - -in vec2 varyingTexCoords; -out vec4 fragColor; - -void main(void) -{ - vec4 sum = texture(texUnit, varyingTexCoords.st) * kernel[0]; - for (int i = 1; i < 16; i++) { - sum += texture(texUnit, varyingTexCoords.st - offsets[i]) * kernel[i]; - sum += texture(texUnit, varyingTexCoords.st + offsets[i]) * kernel[i]; - } - fragColor = sum; -} - diff --git a/kwin/shaders/1.40/scene-color-fragment.glsl b/kwin/shaders/1.40/scene-color-fragment.glsl deleted file mode 100644 index 1272a35b..00000000 --- a/kwin/shaders/1.40/scene-color-fragment.glsl +++ /dev/null @@ -1,10 +0,0 @@ -#version 140 - -uniform vec4 geometryColor; - -out vec4 fragColor; - -void main() -{ - fragColor = geometryColor; -} diff --git a/kwin/shaders/1.40/scene-color-vertex.glsl b/kwin/shaders/1.40/scene-color-vertex.glsl deleted file mode 100644 index dfe4b86c..00000000 --- a/kwin/shaders/1.40/scene-color-vertex.glsl +++ /dev/null @@ -1,13 +0,0 @@ -#version 140 - -uniform mat4 projection; - -// offset of the window/texture to be rendered -uniform vec2 offset; - -in vec4 vertex; - -void main() -{ - gl_Position = projection * vec4(vertex.xy + offset, vertex.zw); -} diff --git a/kwin/shaders/1.40/scene-fragment.glsl b/kwin/shaders/1.40/scene-fragment.glsl deleted file mode 100644 index bfe0c7cb..00000000 --- a/kwin/shaders/1.40/scene-fragment.glsl +++ /dev/null @@ -1,26 +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) { - tex.rgb = mix(vec3(dot(vec3(0.30, 0.59, 0.11), tex.rgb)), tex.rgb, saturation); - } - - tex *= modulation; - -#ifdef KWIN_SHADER_DEBUG - tex.g = min(tex.g + 0.5, 1.0); -#endif - - fragColor = tex; -} diff --git a/kwin/shaders/1.40/scene-generic-vertex.glsl b/kwin/shaders/1.40/scene-generic-vertex.glsl deleted file mode 100644 index 1cfcaa31..00000000 --- a/kwin/shaders/1.40/scene-generic-vertex.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 140 - -uniform mat4 projection; -uniform mat4 modelview; -uniform mat4 screenTransformation; -uniform mat4 windowTransformation; - -in vec4 vertex; -in vec2 texCoord; - -out vec2 varyingTexCoords; - -void main() -{ - varyingTexCoords = texCoord; - gl_Position = projection * (modelview * screenTransformation * windowTransformation) * vertex; -} diff --git a/kwin/shaders/1.40/scene-vertex.glsl b/kwin/shaders/1.40/scene-vertex.glsl deleted file mode 100644 index f7506112..00000000 --- a/kwin/shaders/1.40/scene-vertex.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 140 - -uniform mat4 projection; - -// offset of the window/texture to be rendered -uniform vec2 offset; - -in vec4 vertex; -in vec2 texCoord; - -out vec2 varyingTexCoords; - -void main() -{ - varyingTexCoords = texCoord; - gl_Position = projection * vec4(vertex.xy + offset, vertex.zw); -} diff --git a/kwin/shadow.cpp b/kwin/shadow.cpp index 4470749c..1558341e 100644 --- a/kwin/shadow.cpp +++ b/kwin/shadow.cpp @@ -17,13 +17,15 @@ 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 "config-kwin.h" + #include "shadow.h" // kwin #include "atoms.h" #include "effects.h" #include "toplevel.h" -#include "scene_opengl.h" -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE #include "scene_xrender.h" #endif @@ -49,13 +51,11 @@ Shadow *Shadow::createShadow(Toplevel *toplevel) QVector<long> data = Shadow::readX11ShadowProperty(toplevel->window()); if (!data.isEmpty()) { Shadow *shadow = NULL; - if (effects->isOpenGLCompositing()) { - shadow = new SceneOpenGLShadow(toplevel); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING +#ifdef KWIN_BUILD_COMPOSITE + if (effects->compositingType() == XRenderCompositing) { shadow = new SceneXRenderShadow(toplevel); -#endif } +#endif if (shadow) { if (!shadow->init(data)) { diff --git a/kwin/useractions.cpp b/kwin/useractions.cpp index 5f639af3..4ffccc32 100755 --- a/kwin/useractions.cpp +++ b/kwin/useractions.cpp @@ -1764,14 +1764,6 @@ void Workspace::slotInvertScreen() return; #endif - //BEGIN effect plugin inversion - atm only works with OpenGL and has an overhead to it - if (effects) { - if (Effect *inverter = static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::ScreenInversion)) { - kDebug(1212) << "inverting screen using Effect plugin"; - QMetaObject::invokeMethod(inverter, "toggleScreenInversion", Qt::DirectConnection); - } - } - if (!succeeded) kDebug(1212) << "sorry - neither Xrandr, nor XF86VidModeSetGammaRamp worked and there's no inversion supplying effect plugin either"; diff --git a/kwin/utils.h b/kwin/utils.h index 72e1d725..a748c8d2 100644 --- a/kwin/utils.h +++ b/kwin/utils.h @@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // cmake stuff #include <config-X11.h> #include <config-kwin.h> -#include <kwinconfig.h> // kwin #include <kwinglobals.h> // KDE diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp index 345f68a0..4616867a 100644 --- a/kwin/workspace.cpp +++ b/kwin/workspace.cpp @@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "workspace.h" // kwin libs #include <kdecorationfactory.h> -#include <kwinglplatform.h> // kwin #ifdef KWIN_BUILD_KAPPMENU #include "appmenu.h" @@ -1338,92 +1337,6 @@ QString Workspace::supportInformation() const if (effects) { support.append("Compositing is active\n"); switch (effects->compositingType()) { - case OpenGL1Compositing: - case OpenGL2Compositing: - case OpenGLCompositing: { -#ifdef KWIN_HAVE_OPENGLES - support.append("Compositing Type: OpenGL ES 2.0\n"); -#else - support.append("Compositing Type: OpenGL\n"); -#endif - - GLPlatform *platform = GLPlatform::instance(); - support.append("OpenGL vendor string: " % platform->glVendorString() % '\n'); - support.append("OpenGL renderer string: " % platform->glRendererString() % '\n'); - support.append("OpenGL version string: " % platform->glVersionString() % '\n'); - - if (platform->supports(LimitedGLSL) || platform->supports(GLSL)) - support.append("OpenGL shading language version string: " % platform->glShadingLanguageVersionString() % '\n'); - - support.append("Driver: " % GLPlatform::driverToString(platform->driver()) % '\n'); - if (!platform->isMesaDriver()) - support.append("Driver version: " % GLPlatform::versionToString(platform->driverVersion()) % '\n'); - - support.append("GPU class: " % GLPlatform::chipClassToString(platform->chipClass()) % '\n'); - - support.append("OpenGL version: " % GLPlatform::versionToString(platform->glVersion()) % '\n'); - - if (platform->supports(LimitedGLSL) || platform->supports(GLSL)) - support.append("GLSL version: " % GLPlatform::versionToString(platform->glslVersion()) % '\n'); - - if (platform->isMesaDriver()) - support.append("Mesa version: " % GLPlatform::versionToString(platform->mesaVersion()) % '\n'); - if (platform->serverVersion() > 0) - support.append("X server version: " % GLPlatform::versionToString(platform->serverVersion()) % '\n'); - if (platform->kernelVersion() > 0) - support.append("Linux kernel version: " % GLPlatform::versionToString(platform->kernelVersion()) % '\n'); - - support.append("Direct rendering: "); - if (platform->isDirectRendering()) { - support.append("yes\n"); - } else { - support.append("no\n"); - } - support.append("Requires strict binding: "); - if (!platform->isLooseBinding()) { - support.append("yes\n"); - } else { - support.append("no\n"); - } - support.append("GLSL shaders: "); - if (platform->supports(GLSL)) { - if (platform->supports(LimitedGLSL)) { - support.append(" limited\n"); - } else { - support.append(" yes\n"); - } - } else { - support.append(" no\n"); - } - support.append("Texture NPOT support: "); - if (platform->supports(TextureNPOT)) { - if (platform->supports(LimitedNPOT)) { - support.append(" limited\n"); - } else { - support.append(" yes\n"); - } - } else { - support.append(" no\n"); - } - support.append("Virtual Machine: "); - if (platform->isVirtualMachine()) { - support.append(" yes\n"); - } else { - support.append(" no\n"); - } - - if (effects->compositingType() == OpenGL2Compositing) { - support.append("OpenGL 2 Shaders are used\n"); - } else { - support.append("OpenGL 2 Shaders are not used. Legacy OpenGL 1.x code path is used.\n"); - } - support.append("Painting blocks for vertical retrace: "); - if (m_compositor->scene()->blocksForRetrace()) - support.append(" yes\n"); - else - support.append(" no\n"); - break; - } case XRenderCompositing: support.append("Compositing Type: XRender\n"); break; diff --git a/libs/oxygen/CMakeLists.txt b/libs/oxygen/CMakeLists.txt index 45a41e19..598ce3e2 100644 --- a/libs/oxygen/CMakeLists.txt +++ b/libs/oxygen/CMakeLists.txt @@ -19,7 +19,10 @@ if ( X11_FOUND ) target_link_libraries(oxygenstyle ${X11_LIBRARIES}) endif( X11_FOUND ) -set_target_properties(oxygenstyle PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) +set_target_properties(oxygenstyle PROPERTIES + VERSION ${GENERIC_LIB_VERSION} + SOVERSION ${GENERIC_LIB_SOVERSION} +) install(TARGETS oxygenstyle ${INSTALL_TARGETS_DEFAULT_ARGS} ) # next target @@ -42,7 +45,12 @@ if ( X11_FOUND ) target_link_libraries(oxygenstyleconfig ${X11_LIBRARIES}) endif( X11_FOUND ) -set_target_properties(oxygenstyleconfig PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} DEFINE_SYMBOL MAKE_OXYGENSTYLE_LIB) +set_target_properties(oxygenstyleconfig PROPERTIES + VERSION ${GENERIC_LIB_VERSION} + SOVERSION ${GENERIC_LIB_SOVERSION} +) install(TARGETS oxygenstyleconfig ${INSTALL_TARGETS_DEFAULT_ARGS} ) +generate_export_header(oxygenstyle BASE_NAME oxygen) + # Note: no headers installed diff --git a/libs/oxygen/oxygen_export.h b/libs/oxygen/oxygen_export.h deleted file mode 100644 index 6856b02e..00000000 --- a/libs/oxygen/oxygen_export.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure <faure@kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef OXYGEN_EXPORT_H -#define OXYGEN_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include <kdemacros.h> - -#ifndef OXYGEN_EXPORT -# if defined(MAKE_OXYGENSTYLE_LIB) - /* We are building this library */ -# define OXYGEN_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define OXYGEN_EXPORT KDE_IMPORT -# endif -#endif - -# ifndef OXYGEN_EXPORT_DEPRECATED -# define OXYGEN_EXPORT_DEPRECATED KDE_DEPRECATED OXYGEN_EXPORT -# endif - -#endif diff --git a/plasma/runners/bookmarks/tests/CMakeLists.txt b/plasma/runners/bookmarks/tests/CMakeLists.txt index 8ec346e4..b4320e49 100644 --- a/plasma/runners/bookmarks/tests/CMakeLists.txt +++ b/plasma/runners/bookmarks/tests/CMakeLists.txt @@ -15,7 +15,7 @@ target_link_libraries(plasma-runner-bookmarks-TestChromeBookmarks ${QT_QTSQL_LIBRARY} ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} - qjson + ${QJSON_LIBRARIES} ${qjson_LIBRARIES} ) file(COPY chrome-config-home DESTINATION ${CMAKE_CURRENT_BINARY_DIR})