Merge branch 'KDE/4.11'

This commit is contained in:
Thomas Lübking 2013-08-05 21:02:45 +02:00
commit 7fce0006c0
12 changed files with 61 additions and 93 deletions

View file

@ -313,8 +313,6 @@ if(OPENGL_FOUND)
if (DL_LIBRARY)
target_link_libraries(kdeinit_kwin ${DL_LIBRARY})
endif()
# must be after opengl, to be initialized first by the linker
target_link_libraries(kdeinit_kwin kwinnvidiahack)
elseif(OPENGLES_FOUND)
target_link_libraries(kdeinit_kwin ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES})
set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
@ -333,18 +331,6 @@ if(OPENGLES_FOUND)
install(TARGETS kwin_gles ${INSTALL_TARGETS_DEFAULT_ARGS} )
endif()
########### next target ###############
set( kwinnvidiahack_LIB_SRCS
nvidiahack.cpp )
kde4_add_library(kwinnvidiahack SHARED ${kwinnvidiahack_LIB_SRCS})
set_target_properties(kwinnvidiahack PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
set_target_properties(kwinnvidiahack PROPERTIES OUTPUT_NAME ${KWIN_NAME}nvidiahack)
install(TARGETS kwinnvidiahack ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
########### install files ###############
install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg )

View file

@ -98,6 +98,7 @@ Compositor::Compositor(QObject* workspace)
connect(&unredirectTimer, SIGNAL(timeout()), SLOT(delayedCheckUnredirect()));
connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart()));
connect(workspace, SIGNAL(configChanged()), SLOT(slotConfigChanged()));
connect(options, SIGNAL(unredirectFullscreenChanged()), SLOT(delayedCheckUnredirect()));
unredirectTimer.setSingleShot(true);
compositeResetTimer.setSingleShot(true);
nextPaintReference.invalidate(); // Initialize the timer
@ -705,7 +706,7 @@ void Compositor::checkUnredirect(bool force)
void Compositor::delayedCheckUnredirect()
{
if (!hasScene() || m_scene->overlayWindow()->window() == None || !options->isUnredirectFullscreen())
if (!hasScene() || m_scene->overlayWindow()->window() == None || !(options->isUnredirectFullscreen() || sender() == options))
return;
ToplevelList list;
bool changed = forceUnredirectCheck;
@ -1072,7 +1073,8 @@ void Toplevel::addWorkspaceRepaint(const QRect& r2)
bool Toplevel::updateUnredirectedState()
{
assert(compositing());
bool should = shouldUnredirect() && !unredirectSuspend && !shape() && !hasAlpha() && opacity() == 1.0 &&
bool should = options->isUnredirectFullscreen() && shouldUnredirect() && !unredirectSuspend &&
!shape() && !hasAlpha() && opacity() == 1.0 &&
!static_cast<EffectsHandlerImpl*>(effects)->activeFullScreenEffect();
if (should == unredirect)
return false;

View file

@ -59,9 +59,9 @@ install( TARGETS kwin_update_settings_411 DESTINATION ${LIB_INSTALL_DIR}/kconf_u
install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules )
install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} )
install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd
install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd kwin_translate_confrequest_rule.upd
kwin_update_411.upd
DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh kwin_translate_confrequest_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin )

View file

@ -0,0 +1,14 @@
#!/bin/sh
COUNT=`kreadconfig --file kwinrulesrc --group General --key count`
if [ -z "$COUNT" ]; then
exit 0 # nothing to do for us
fi
# can you imaging how *much* faster sed is?
# it's however less reliable (installation, ini config, etc.)
for i in `seq 1 $COUNT`; do
if [ "`kreadconfig --file kwinrulesrc --group $i --key ignoregeometryrule`" = "2" ]; then
kwriteconfig --file kwinrulesrc --group $i --key ignoregeometryrule "3"
fi
done

View file

@ -0,0 +1,2 @@
Id=Kwin-4.11
Script=kwin_translate_confrequest_rule.sh

View file

@ -232,7 +232,18 @@ void ShowFpsEffect::paintGL(int fps)
paintDrawSizeGraph(x, y);
// Paint FPS numerical value
paintFPSText(fps);
if (fpsTextRect.isValid()) {
delete fpsText;
fpsText = 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);
@ -284,6 +295,15 @@ void ShowFpsEffect::paintXrender(int fps)
// Paint amount of rendered pixels graph
paintDrawSizeGraph(x + FPS_WIDTH + MAX_TIME, y);
// Paint FPS numerical value
if (fpsTextRect.isValid()) {
QImage textImg(fpsTextImage(fps));
XRenderPicture textPic(textImg);
xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, textPic, XCB_RENDER_PICTURE_NONE,
effects->xrenderBufferPicture(), 0, 0, 0, 0, fpsTextRect.x(), fpsTextRect.y(), textImg.width(), textImg.height());
effects->addRepaint(fpsTextRect);
}
}
#endif
@ -450,26 +470,16 @@ void ShowFpsEffect::postPaintScreen()
effects->addRepaint(fps_rect);
}
void ShowFpsEffect::paintFPSText(int fps)
QImage ShowFpsEffect::fpsTextImage(int fps)
{
if (!fpsTextRect.isValid())
return;
QImage im(100, 100, QImage::Format_ARGB32);
im.fill(0);
im.fill(Qt::transparent);
QPainter painter(&im);
painter.setFont(textFont);
painter.setPen(textColor);
painter.drawText(QRect(0, 0, 100, 100), textAlign, QString::number(fps));
delete fpsText;
fpsText = new GLTexture(im);
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);
painter.end();
return im;
}
} // namespace

View file

@ -80,7 +80,7 @@ private:
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);
void paintFPSText(int fps);
QImage fpsTextImage(int fps);
QTime t;
enum { NUM_PAINTS = 100 }; // remember time needed to paint this many paints
int paints[ NUM_PAINTS ]; // time needed to paint

View file

@ -145,7 +145,7 @@ void WindowGeometry::slotWindowStepUserMovedResized(EffectWindow *w, const QRect
{
if (iAmActivated && iAmActive && w == myResizeWindow) {
if (myExtraDirtyArea.isValid())
w->addLayerRepaint(myExtraDirtyArea);
effects->addRepaint(myExtraDirtyArea);
myExtraDirtyArea = QRect();
@ -197,11 +197,9 @@ void WindowGeometry::slotWindowStepUserMovedResized(EffectWindow *w, const QRect
myExtraDirtyArea |= myMeasure[1]->geometry();
myExtraDirtyArea |= myMeasure[2]->geometry();
myExtraDirtyArea.adjust(-6,-6,6,6);
if (w->expandedGeometry().contains(myExtraDirtyArea))
myExtraDirtyArea = QRect();
if (myExtraDirtyArea.isValid())
w->addLayerRepaint(myExtraDirtyArea);
effects->addRepaint(myExtraDirtyArea);
}
}

View file

@ -109,11 +109,15 @@ static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth)
XRenderPicture::XRenderPicture(const QPixmap &pix)
{
if (!Extensions::nonNativePixmaps()) {
if (Extensions::nonNativePixmaps()) {
XRenderPicture(pix.toImage());
} else {
d = new XRenderPictureData(createPicture(pix.handle(), pix.depth()));
return;
}
QImage img(pix.toImage());
}
XRenderPicture::XRenderPicture(const QImage &img)
{
const int depth = img.depth();
xcb_pixmap_t xpix = xcb_generate_id(connection());
xcb_create_pixmap(connection(), depth, xpix, rootWindow(), img.width(), img.height());

View file

@ -70,6 +70,7 @@ public:
explicit XRenderPicture(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE);
// TODO: Qt5 - replace QPixmap by QImage to make it more obvious that it uses PutImage
explicit XRenderPicture(const QPixmap &pix);
explicit XRenderPicture(const QImage &img);
XRenderPicture(xcb_pixmap_t pix, int depth);
operator xcb_render_picture_t();
private:

View file

@ -1,52 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Lubos Lunak <l.lunak@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/>.
*********************************************************************/
// krazy:skip
/*
The only purpose of this file is to be later in the link order than
(nvidia's) libGL, thus being initialized by the dynamic linker before it,
allowing it to set __GL_YIELD=NOTHING soon enough for libGL to notice it.
*/
#include <stdlib.h>
#include <kdefakes.h>
class kwinnvidiahack
{
public:
kwinnvidiahack();
};
kwinnvidiahack::kwinnvidiahack()
{
const char* env = getenv("KWIN_NVIDIA_HACK");
#if 1 // turned on by default
if (env == NULL || env[ 0 ] != '0')
setenv("__GL_YIELD", "NOTHING", true);
#else // turned off by default
if (env != NULL && env[ 0 ] != '0')
setenv("__GL_YIELD", "NOTHING", true);
#endif
}
kwinnvidiahack kwinnvidiahackinst;

View file

@ -656,6 +656,9 @@ void Options::setUnredirectFullscreen(bool unredirectFullscreen)
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();
}