Properly #ifdef OpenGL-only and XRender-only stuff.

svn path=/trunk/KDE/kdebase/workspace/; revision=817585
This commit is contained in:
Luboš Luňák 2008-06-06 11:07:15 +00:00
parent bc137cca3b
commit 4fc3d50790
9 changed files with 70 additions and 47 deletions

View file

@ -46,9 +46,12 @@ add_subdirectory( lib )
add_subdirectory( killer )
add_subdirectory( kcmkwin )
add_subdirectory( clients )
add_subdirectory( effects )
add_subdirectory( data )
if( KWIN_HAVE_COMPOSITING )
add_subdirectory( effects )
endif( KWIN_HAVE_COMPOSITING )
########### next target ###############
set(kwin_KDEINIT_SRCS

View file

@ -47,6 +47,9 @@ SET(kwin4_effect_builtins_sources
minimizeanimation.cpp
presentwindows.cpp
scalein.cpp
shadow.cpp
showfps.cpp
showpaint.cpp
taskbarthumbnail.cpp
thumbnailaside.cpp
zoom.cpp
@ -66,6 +69,9 @@ install( FILES
minimizeanimation.desktop
presentwindows.desktop
scalein.desktop
shadow.desktop
showfps.desktop
showpaint.desktop
taskbarthumbnail.desktop
thumbnailaside.desktop
zoom.desktop
@ -80,6 +86,8 @@ SET(kwin4_effect_builtins_config_sources
maketransparent_config.ui
presentwindows_config.cpp
shadow_config.cpp
showfps_config.cpp
showfps_config.ui
thumbnailaside_config.cpp
thumbnailaside_config.ui
zoom_config.cpp
@ -90,6 +98,7 @@ install( FILES
maketransparent_config.desktop
presentwindows_config.desktop
shadow_config.desktop
showfps_config.desktop
thumbnailaside_config.desktop
zoom_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
@ -105,7 +114,6 @@ if(KWIN_HAVE_OPENGL_COMPOSITING)
lookingglass.cpp
magnifier.cpp
mousemark.cpp
shadow.cpp
sharpen.cpp
snow.cpp
trackmouse.cpp
@ -120,7 +128,6 @@ if(KWIN_HAVE_OPENGL_COMPOSITING)
lookingglass.desktop
magnifier.desktop
mousemark.desktop
shadow.desktop
sharpen.desktop
snow.desktop
trackmouse.desktop
@ -174,32 +181,12 @@ if(KWIN_HAVE_OPENGL_COMPOSITING)
magnifier_config.desktop
mousemark_config.desktop
sharpen_config.desktop
showfps_config.desktop
snow_config.desktop
trackmouse_config.desktop
wobblywindows_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
endif(KWIN_HAVE_OPENGL_COMPOSITING)
# showfps, showpaint - need xrender or opengl
if(KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING)
SET(kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
showfps.cpp
showpaint.cpp
)
install( FILES
showfps.desktop
showpaint.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
SET(kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
showfps_config.cpp
showfps_config.ui
)
install( FILES
showfps_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
endif(KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING)
# add the plugin
KWIN4_ADD_EFFECT(builtins ${kwin4_effect_builtins_sources})
KWIN4_ADD_EFFECT_CONFIG(builtins ${kwin4_effect_builtins_config_sources})

View file

@ -21,14 +21,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinconfig.h>
#include "shadow_config.h"
#include "presentwindows_config.h"
#include "desktopgrid_config.h"
#include "maketransparent_config.h"
#include "diminactive_config.h"
#include "maketransparent_config.h"
#include "presentwindows_config.h"
#include "shadow_config.h"
#include "showfps_config.h"
#include "thumbnailaside_config.h"
#include "zoom_config.h"
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#include "coverswitch_config.h"
#include "flipswitch_config.h"
@ -40,9 +42,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "snow_config.h"
#include "trackmouse_config.h"
#include "wobblywindows_config.h"
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include "showfps_config.h"
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
// xrender-only here if any
#endif
#ifdef HAVE_CAPTURY
#include "videorecord_config.h"
#endif
#include <kwineffects.h>
@ -52,16 +57,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
KWIN_EFFECT_CONFIG_FACTORY
#endif
#define NON_GL_PLUGINS \
#define COMMON_PLUGINS \
registerPlugin<KWin::DesktopGridEffectConfig>("desktopgrid"); \
registerPlugin<KWin::DimInactiveEffectConfig>("diminactive"); \
registerPlugin<KWin::MakeTransparentEffectConfig>("maketransparent"); \
registerPlugin<KWin::PresentWindowsEffectConfig>("presentwindows"); \
registerPlugin<KWin::ShadowEffectConfig>("shadow"); \
registerPlugin<KWin::ShowFpsEffectConfig> ("showfps"); \
registerPlugin<KWin::ThumbnailAsideEffectConfig>("thumbnailaside"); \
registerPlugin<KWin::ZoomEffectConfig>("zoom");
#define GL_PLUGINS \
#define OPENGL_PLUGINS \
registerPlugin<KWin::CoverSwitchEffectConfig>("coverswitch"); \
registerPlugin<KWin::FlipSwitchEffectConfig>("flipswitch"); \
registerPlugin<KWin::InvertEffectConfig>("invert"); \
@ -71,22 +77,27 @@ KWIN_EFFECT_CONFIG_FACTORY
registerPlugin<KWin::SharpenEffectConfig>("sharpen"); \
registerPlugin<KWin::SnowEffectConfig>("snow"); \
registerPlugin<KWin::TrackMouseEffectConfig>("trackmouse"); \
registerPlugin<KWin::WobblyWindowsEffectConfig> ("wobblywindows");
#define GL_RENDER_PLUGINS \
registerPlugin<KWin::ShowFpsEffectConfig> ("showfps"); \
registerPlugin<KWin::WobblyWindowsEffectConfig> ("wobblywindows"); \
#define XRENDER_PLUGINS
#define CAPTURY_PLUGINS \
registerPlugin<KWin::VideoRecordEffectConfig> ("videorecord");
K_PLUGIN_FACTORY_DEFINITION(EffectFactory,
COMMON_PLUGINS
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
K_PLUGIN_FACTORY_DEFINITION(EffectFactory,
NON_GL_PLUGINS
GL_PLUGINS
OPENGL_PLUGINS
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
GL_RENDER_PLUGINS
XRENDER_PLUGINS
#endif
#ifdef HAVE_CAPTURY
CAPTURY_PLUGINS
#endif
)
#else
K_PLUGIN_FACTORY_DEFINITION(EffectFactory,
NON_GL_PLUGINS
)
#endif
K_EXPORT_PLUGIN(EffectFactory("kwin"))
#undef COMMON_PLUGINS
#undef OPENGL_PLUGINS
#undef XRENDER_PLUGINS
#undef CAPTURY_PLUGINS

View file

@ -39,6 +39,7 @@ namespace KWin
KWIN_EFFECT( shadow, ShadowEffect )
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
ShadowTiles::ShadowTiles(const QPixmap& shadow)
{
int w = shadow.width() / 2, h = shadow.height() / 2;
@ -73,6 +74,8 @@ ShadowTiles::ShadowTiles(const QPixmap& shadow)
#undef DUMP_CNR
#undef DUMP_TILE
#endif
ShadowEffect::ShadowEffect()
{
KConfigGroup conf = effects->effectConfig("Shadow");

View file

@ -29,6 +29,7 @@ namespace KWin
class GLTexture;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
class ShadowTiles
{
public:
@ -38,6 +39,7 @@ class ShadowTiles
btmLeft, btm, btmRight;
QSize cornerSize;
};
#endif
class ShadowEffect
: public QObject, public Effect
@ -69,8 +71,12 @@ class ShadowEffect
int shadowSize;
bool intensifyActiveShadow;
QColor shadowColor;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
GLTexture* mShadowTexture;
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
ShadowTiles *mShadowPics;
#endif
struct ShadowData
{

View file

@ -50,7 +50,9 @@ const int MAX_TIME = 100;
ShowFpsEffect::ShowFpsEffect()
: paints_pos( 0 )
, frames_pos( 0 )
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
, fpsText(0)
#endif
{
for( int i = 0;
i < NUM_PAINTS;
@ -172,9 +174,9 @@ void ShowFpsEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data
#endif
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
void ShowFpsEffect::paintGL( int fps )
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
int x = this->x;
int y = this->y;
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
@ -223,9 +225,10 @@ void ShowFpsEffect::paintGL( int fps )
// Paint paint sizes
glPopAttrib();
#endif
}
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
/*
Differences between OpenGL and XRender:
- differently specified rectangles (X: width/height, O: x2,y2)
@ -233,7 +236,6 @@ void ShowFpsEffect::paintGL( int fps )
*/
void ShowFpsEffect::paintXrender( int fps )
{
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
Pixmap pixmap = XCreatePixmap( display(), rootWindow(), FPS_WIDTH, MAX_TIME, 32 );
XRenderPicture p( pixmap, 32 );
XFreePixmap( display(), pixmap );
@ -264,9 +266,8 @@ void ShowFpsEffect::paintXrender( int fps )
// Paint amount of rendered pixels graph
paintDrawSizeGraph( x + FPS_WIDTH + MAX_TIME, y );
#endif
}
#endif
void ShowFpsEffect::paintFPSGraph(int x, int y)
{

View file

@ -40,8 +40,12 @@ class ShowFpsEffect
virtual void postPaintScreen();
enum { INSIDE_GRAPH, NOWHERE, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT }; // fps text position
private:
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
void paintGL( int fps );
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
void paintXrender( int fps );
#endif
void paintFPSGraph(int x, int y);
void paintDrawSizeGraph(int x, int y);
void paintGraph( int x, int y, QList<int> values, QList<int> lines, bool colorize);
@ -58,7 +62,9 @@ class ShowFpsEffect
int x;
int y;
QRect fps_rect;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
GLTexture *fpsText;
#endif
int textPosition;
QFont textFont;
QColor textColor;

View file

@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <assert.h>
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
namespace KWin
{
@ -175,3 +176,4 @@ void ShaderEffect::postPaintScreen()
} // namespace
#endif

View file

@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwineffects.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
/** @addtogroup kwineffects */
/** @{ */
@ -68,3 +70,5 @@ class KWIN_EXPORT ShaderEffect : public Effect
/** @} */
#endif
#endif