compiz/compiz_remove_kde.patch
2013-05-26 15:49:09 +02:00

10921 lines
286 KiB
Diff

diff -uprN compiz-0.8.8-orig/compiz-kconfig.pc.in compiz-0.8.8/compiz-kconfig.pc.in
--- compiz-0.8.8-orig/compiz-kconfig.pc.in 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/compiz-kconfig.pc.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-prefix=@prefix@
-xsltdir=@datarootdir@/compiz
-kcfgdir=@kcfgdir@
-
-Name: compiz-kconfig
-Description: Kconfig plugin for compiz
-Version: @VERSION@
diff -uprN compiz-0.8.8-orig/configure.ac compiz-0.8.8/configure.ac
--- compiz-0.8.8-orig/configure.ac 2013-04-19 11:25:07.375310000 +0200
+++ compiz-0.8.8/configure.ac 2013-04-19 11:37:51.368916779 +0200
@@ -400,174 +400,6 @@ if test "$use_mate_keybindings" = yes; t
AC_DEFINE(USE_MATE_KEYBINDINGS, 1, [Install custom keybindings])
fi
-AC_ARG_ENABLE(kde,
- [ --disable-kde Disable kde window decorator],
- [use_kde=$enableval], [use_kde=yes])
-
-if test "x$use_kde" = "xyes"; then
- qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt3/include /usr/lib/qt/include /usr/share/qt3/include"
- qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib"
-
- if test -n "$QTDIR" ; then
- qt_incdirs="$QTDIR/include $qt_incdirs"
- qt_libdirs="$QTDIR/lib $qt_libdirs"
- fi
-
- qt_test_include="qstyle.h"
- qt_test_library="libqt-mt.so"
-
- dnl Check for Qt headers
- AC_MSG_CHECKING([for Qt headers])
- qt_incdir="no"
- for it in $qt_incdirs ; do
- if test -r "$it/$qt_test_include" ; then
- qt_incdir="$it"
- break
- fi
- done
- AC_MSG_RESULT([$qt_incdir])
-
- dnl Check for Qt libraries
- AC_MSG_CHECKING([for Qt libraries])
- qt_libdir="no"
- for qt_check in $qt_libdirs ; do
- if test -r "$qt_check/$qt_test_library" ; then
- qt_libdir="$qt_check"
- break
- fi
- done
- AC_MSG_RESULT([$qt_libdir])
-
- use_kde=no;
- if test "x$qt_libdir" != "xno" ; then
- if test "x$qt_incdir" != "xno" ; then
- use_kde=yes;
- fi
- fi
-
- QT_CXXFLAGS="-I$qt_incdir"
- QT_LIBS="-L$qt_libdir"
-
- if test "x$use_kde" = xyes; then
- kdedir=`kde-config --prefix --expandvars 2>/dev/null`
- kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
- kdeincs=`kde-config --install include --expandvars 2>/dev/null`
- if test -d "$kdelibs"; then
- PKG_CHECK_MODULES(KDE_WINDOW_DECORATOR,
- dbus-1 xdamage xcomposite,
- [use_kde=yes], [use_kde=no])
-
- KDE_CFLAGS="$QT_CXXFLAGS -I$kdeincs"
- KDE_LIBS="$QT_LIBS -L$kdelibs -lkdecore -lkdecorations -ldbus-qt-1"
-
- QT_MOC=$QTDIR/bin/moc
- DCOPIDL=$kdedir/bin/dcopidl
- DCOPIDL2CPP=$kdedir/bin/dcopidl2cpp
- else
- use_kde=no;
- fi
- fi
-fi
-
-AM_CONDITIONAL(USE_KDE, test "x$use_kde" = "xyes")
-if test "$use_kde" = yes; then
- AC_DEFINE(USE_KDE, 1, [Build kde window decorator])
-fi
-
-AC_SUBST(KDE_CFLAGS)
-AC_SUBST(KDE_LIBS)
-AC_SUBST(QT_MOC)
-AC_SUBST(DCOPIDL)
-AC_SUBST(DCOPIDL2CPP)
-
-AC_ARG_ENABLE(kde4,
- [ --disable-kde4 Disable kde4 window decorator],
- [use_kde4=$enableval], [use_kde4=yes])
-
-if test "x$use_kde4" = "xyes"; then
-
- kde4dir=`kde4-config --prefix --expandvars 2>/dev/null`
- kde4libs=`kde4-config --install lib --expandvars 2>/dev/null`
- kde4incs=`kde4-config --install include --expandvars 2>/dev/null`
-
- kde4_test_includes="kdecoration.h kcommondecoration.h kdecorationbridge.h plasma/framesvg.h"
-
- dnl Check for KWin headers
- AC_MSG_CHECKING([for KWin headers])
-
- kde4_notfound=""
- for file in $kde4_test_includes ; do
- status=" $file"
- for it in $kde4incs ; do
- if test -r "$it/$file" ; then
- status=""
- break;
- fi
- done
- kde4_notfound="$kde4_notfound$status"
- done
- if test -z "$kde4_notfound" ; then
- kde4_notfound="yes"
- else
- kde4_notfound="$kde4_notfound not found"
- kde4libs=""
- fi
-
- AC_MSG_RESULT([$kde4_notfound])
-
- if test -d "$kde4libs"; then
- PKG_CHECK_MODULES(KDE4_WINDOW_DECORATOR,
- dbus-1 xdamage xext xcomposite QtCore >= 4.5.0 QtGui QtDBus,
- [use_kde4=yes], [use_kde4=no])
-
- KDE4_CFLAGS="-I$kde4incs"
- KDE4_LIBS="-L$kde4libs -lkdecore -lkdecorations -lkdeui -lplasma"
-
- QT4_MOC=`pkg-config QtGui --variable=moc_location`
- QDBUSXML2CPP=`pkg-config QtGui --variable=exec_prefix`"/bin/qdbusxml2cpp"
- else
- use_kde4=no;
- fi
-fi
-
-AM_CONDITIONAL(USE_KDE4, test "x$use_kde4" = "xyes")
-if test "$use_kde4" = yes; then
- AC_DEFINE(USE_KDE4, 1, [Build kde4 window decorator])
-fi
-
-AC_SUBST(KDE4_CFLAGS)
-AC_SUBST(KDE4_LIBS)
-AC_SUBST(QT4_MOC)
-AC_SUBST(QDBUSXML2CPP)
-
-AC_ARG_ENABLE(kconfig,
- [ --disable-kconfig Disable kconfig plugin],
- [use_kconfig=$enableval], [use_kconfig=yes])
-
-if test "x$use_kde" != "xyes"; then
- use_kconfig=no;
-fi
-
-if test "x$use_kconfig" = "xyes"; then
- KCONFIG_CFLAGS=$KDE_CFLAGS
- KCONFIG_LIBS=$KDE_LIBS
- KDE_KCFG_DIR=`kde-config --install kcfg --expandvars 2>/dev/null`
- KDE_KCONFIG_DIR=`kde-config --install config --expandvars 2>/dev/null`
-fi
-
-AM_CONDITIONAL(USE_KCONFIG, test "x$use_kconfig" = "xyes")
-if test "$use_kconfig" = yes; then
- AC_DEFINE(USE_KCONFIG, 1, [Build kconfig plugin])
-fi
-
-AC_SUBST(KCONFIG_CFLAGS)
-AC_SUBST(KCONFIG_LIBS)
-AC_SUBST(KDE_KCFG_DIR)
-AC_SUBST(KDE_KCONFIG_DIR)
-
-kcfgdir=$KDE_KCFG_DIR
-AC_SUBST(kcfgdir)
-
AC_ARG_WITH(max-desktops,
[ --with-max-desktops Max reasonable desktops],
[MAX_DESKTOPS=$withval],
@@ -620,7 +452,6 @@ compiz.pc
compiz-cube.pc
compiz-scale.pc
compiz-mateconf.pc
-compiz-kconfig.pc
Makefile
src/Makefile
libdecoration/Makefile
@@ -631,9 +462,6 @@ images/Makefile
gtk/Makefile
gtk/window-decorator/Makefile
gtk/mate/Makefile
-kde/Makefile
-kde/window-decorator/Makefile
-kde/window-decorator-kde4/Makefile
po/Makefile.in
metadata/Makefile
])
@@ -642,7 +470,6 @@ echo ""
echo "the following optional plugins will be compiled:"
echo " glib: $use_glib"
echo " mateconf: $use_mateconf"
-echo " kconfig: $use_kconfig"
echo " dbus: $use_dbus"
echo " annotate: $use_annotate"
echo " svg: $use_librsvg"
@@ -653,6 +480,4 @@ echo "and the following optional feature
echo " gtk: $use_gtk"
echo " marco: $use_marco"
echo " mate: $use_mate"
-echo " kde: $use_kde"
-echo " kde4: $use_kde4"
echo ""
diff -uprN compiz-0.8.8-orig/kde/Makefile.am compiz-0.8.8/kde/Makefile.am
--- compiz-0.8.8-orig/kde/Makefile.am 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/Makefile.am 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-SUBDIRS = window-decorator window-decorator-kde4
diff -uprN compiz-0.8.8-orig/kde/window-decorator/decorator.cpp compiz-0.8.8/kde/window-decorator/decorator.cpp
--- compiz-0.8.8-orig/kde/window-decorator/decorator.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/decorator.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,1055 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include <qglobal.h>
-
-#include <dcopclient.h>
-#include <kcmdlineargs.h>
-#include <kconfig.h>
-#include <kdebug.h>
-#include <kglobal.h>
-#include <kwinmodule.h>
-#include <klocale.h>
-#include <kcommondecoration.h>
-#include <kwin.h>
-#include <qwidgetlist.h>
-#include <qpoint.h>
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xcomposite.h>
-
-#include "decorator.h"
-#include "options.h"
-#include "utils.h"
-
-#include <stdio.h>
-
-#define SHADOW_RADIUS 8.0
-#define SHADOW_OPACITY 0.5
-#define SHADOW_OFFSET_X 1
-#define SHADOW_OFFSET_Y 1
-#define SHADOW_COLOR_RED 0x0000
-#define SHADOW_COLOR_GREEN 0x0000
-#define SHADOW_COLOR_BLUE 0x0000
-
-#define DBUS_DEST "org.freedesktop.compiz"
-#define DBUS_PATH "/org/freedesktop/compiz/decoration/display"
-#define DBUS_INTERFACE "org.freedesktop.compiz"
-#define DBUS_METHOD_GET "get"
-
-double decorationOpacity = 0.75;
-bool decorationOpacityShade = false;
-double activeDecorationOpacity = 1.0;
-bool activeDecorationOpacityShade = false;
-int blurType = BLUR_TYPE_NONE;
-
-decor_context_t KWD::Decorator::mDefaultContext;
-decor_extents_t KWD::Decorator::mDefaultBorder;
-decor_shadow_t *KWD::Decorator::mNoBorderShadow = 0;
-decor_shadow_t *KWD::Decorator::mDefaultShadow = 0;
-KWD::PluginManager *KWD::Decorator::mPlugins = 0;
-KWD::Options *KWD::Decorator::mOptions = 0;
-NETRootInfo *KWD::Decorator::mRootInfo;
-WId KWD::Decorator::mActiveId;
-decor_shadow_options_t KWD::Decorator::mShadowOptions;
-
-extern Time qt_x_time;
-
-struct _cursor cursors[3][3] = {
- { C (top_left_corner), C (top_side), C (top_right_corner) },
- { C (left_side), C (left_ptr), C (right_side) },
- { C (bottom_left_corner), C (bottom_side), C (bottom_right_corner) }
-};
-
-KWD::PluginManager::PluginManager (KConfig *config): KDecorationPlugins (config)
-{
- defaultPlugin = "kwin3_plastik";
-}
-
-static DBusHandlerResult
-dbusHandleMessage (DBusConnection *connection,
- DBusMessage *message,
- void *userData)
-{
- KWD::Decorator *d = (KWD::Decorator *) userData;
- char **path;
- const char *interface, *member;
- DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- interface = dbus_message_get_interface (message);
- member = dbus_message_get_member (message);
-
- (void) connection;
-
- if (!interface || !member)
- return result;
-
- if (!dbus_message_is_signal (message, interface, member))
- return result;
-
- if (strcmp (member, "changed"))
- return result;
-
- if (!dbus_message_get_path_decomposed (message, &path))
- return result;
-
- if (!path[0] || !path[1] || !path[2] || !path[3] || !path[4] || !path[5])
- {
- dbus_free_string_array (path);
- return result;
- }
-
- if (!strcmp (path[0], "org") &&
- !strcmp (path[1], "freedesktop") &&
- !strcmp (path[2], "compiz") &&
- !strcmp (path[3], "decoration") &&
- !strcmp (path[4], "display"))
- {
- decor_shadow_options_t opt = *d->shadowOptions ();
-
- result = DBUS_HANDLER_RESULT_HANDLED;
-
- if (strcmp (path[5], "shadow_radius") == 0)
- {
- dbus_message_get_args (message, NULL,
- DBUS_TYPE_DOUBLE, &opt.shadow_radius,
- DBUS_TYPE_INVALID);
- }
- else if (strcmp (path[5], "shadow_opacity") == 0)
- {
- dbus_message_get_args (message, NULL,
- DBUS_TYPE_DOUBLE, &opt.shadow_opacity,
- DBUS_TYPE_INVALID);
- }
- else if (strcmp (path[5], "shadow_color") == 0)
- {
- DBusError error;
- char *str;
-
- dbus_error_init (&error);
-
- dbus_message_get_args (message, &error,
- DBUS_TYPE_STRING, &str,
- DBUS_TYPE_INVALID);
-
- if (!dbus_error_is_set (&error))
- {
- int c[4];
-
- if (sscanf (str, "#%2x%2x%2x%2x",
- &c[0], &c[1], &c[2], &c[3]) == 4)
- {
- opt.shadow_color[0] = c[0] << 8 | c[0];
- opt.shadow_color[1] = c[1] << 8 | c[1];
- opt.shadow_color[2] = c[2] << 8 | c[2];
- }
- }
-
- dbus_error_free (&error);
- }
- else if (strcmp (path[5], "shadow_x_offset") == 0)
- {
- dbus_message_get_args (message, NULL,
- DBUS_TYPE_INT32, &opt.shadow_offset_x,
- DBUS_TYPE_INVALID);
- }
- else if (strcmp (path[5], "shadow_y_offset") == 0)
- {
- dbus_message_get_args (message, NULL,
- DBUS_TYPE_INT32, &opt.shadow_offset_y,
- DBUS_TYPE_INVALID);
- }
-
- d->changeShadowOptions (&opt);
- }
-
- dbus_free_string_array (path);
-
- return result;
-}
-
-KWD::Decorator::Decorator (void) : DCOPObject ("KWinInterface"),
- KApplication (),
- mConfig (0),
- mKWinModule (new KWinModule (this, KWinModule::INFO_ALL)),
- mDBusQtConnection (this),
- mCompositeWindow (0)
-{
- XSetWindowAttributes attr;
- DCOPClient *client;
- int i, j;
-
- mRootInfo = new NETRootInfo (qt_xdisplay (), 0);
-
- mActiveId = 0;
-
- Atoms::init ();
-
- mConfig = new KConfig ("kwinrc");
- mConfig->setGroup ("Style");
-
- mOptions = new KWD::Options (mConfig);
- mPlugins = new PluginManager (mConfig);
-
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 3; j++)
- {
- if (cursors[i][j].shape != XC_left_ptr)
- cursors[i][j].cursor =
- XCreateFontCursor (qt_xdisplay (), cursors[i][j].shape);
- }
- }
-
- client = dcopClient ();
- client->registerAs ("kwin", false);
- client->setDefaultObject ("KWinInterface");
-
- mShadowOptions.shadow_radius = SHADOW_RADIUS;
- mShadowOptions.shadow_opacity = SHADOW_OPACITY;
- mShadowOptions.shadow_offset_x = SHADOW_OFFSET_X;
- mShadowOptions.shadow_offset_y = SHADOW_OFFSET_Y;
- mShadowOptions.shadow_color[0] = SHADOW_COLOR_RED;
- mShadowOptions.shadow_color[1] = SHADOW_COLOR_GREEN;
- mShadowOptions.shadow_color[2] = SHADOW_COLOR_BLUE;
-
- attr.override_redirect = True;
-
- mCompositeWindow = XCreateWindow (qt_xdisplay (), qt_xrootwin (),
- -ROOT_OFF_X, -ROOT_OFF_Y, 1, 1, 0,
- CopyFromParent,
- CopyFromParent,
- CopyFromParent,
- CWOverrideRedirect, &attr);
-
- XCompositeRedirectSubwindows (qt_xdisplay (), mCompositeWindow,
- CompositeRedirectManual);
-
- XMapWindow (qt_xdisplay (), mCompositeWindow);
-}
-
-KWD::Decorator::~Decorator (void)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
-
- for (it = mClients.begin (); it != mClients.end (); it++)
- delete (*it);
-
- if (mDecorNormal)
- delete mDecorNormal;
-
- if (mDecorActive)
- delete mDecorActive;
-
- XDestroyWindow (qt_xdisplay (), mCompositeWindow);
-
- delete mOptions;
- delete mPlugins;
- delete mConfig;
- delete mKWinModule;
- delete mRootInfo;
-}
-
-bool
-KWD::Decorator::enableDecorations (Time timestamp,
- int damageEvent)
-{
- QValueList <WId>::ConstIterator it;
- DBusError error;
-
- mDmSnTimestamp = timestamp;
- mDamageEvent = damageEvent;
-
- if (!pluginManager ()->loadPlugin (""))
- return false;
-
- dbus_error_init (&error);
-
- mDBusConnection = dbus_bus_get (DBUS_BUS_SESSION, &error);
- if (!dbus_error_is_set (&error))
- {
- dbus_bus_add_match (mDBusConnection, "type='signal'", &error);
-
- dbus_connection_add_filter (mDBusConnection,
- dbusHandleMessage,
- this, NULL);
-
- mDBusQtConnection.dbus_connection_setup_with_qt_main (mDBusConnection);
-
- updateAllShadowOptions ();
- }
-
- dbus_error_free (&error);
-
- updateShadow ();
-
- mDecorNormal = new KWD::Window (mCompositeWindow, qt_xrootwin (),
- 0, Window::Default);
- mDecorActive = new KWD::Window (mCompositeWindow, qt_xrootwin (),
- 0, Window::DefaultActive);
-
- connect (mKWinModule, SIGNAL (windowAdded (WId)),
- SLOT (handleWindowAdded (WId)));
- connect (mKWinModule, SIGNAL (windowRemoved (WId)),
- SLOT (handleWindowRemoved (WId)));
- connect (mKWinModule, SIGNAL (activeWindowChanged (WId)),
- SLOT (handleActiveWindowChanged (WId)));
- connect (mKWinModule,
- SIGNAL (windowChanged (WId, const unsigned long *)),
- SLOT (handleWindowChanged (WId, const unsigned long *)));
-
- connect (&mIdleTimer, SIGNAL (timeout ()), SLOT (processDamage ()));
-
- mActiveId = mKWinModule->activeWindow ();
-
- it = mKWinModule->windows ().begin ();
- for (; it != mKWinModule->windows ().end (); it++)
- handleWindowAdded ((*it));
-
- connect (this, SIGNAL (appearanceChanged ()), SLOT (reconfigure ()));
-
- (void) QApplication::desktop (); // trigger creation of desktop widget
-
- // select for client messages
- XSelectInput (qt_xdisplay(), qt_xrootwin (),
- StructureNotifyMask | PropertyChangeMask);
-
- return true;
-}
-
-void
-KWD::Decorator::updateDefaultShadow (KWD::Window *w)
-{
- bool uniqueHorzShape, uniqueVertShape;
-
- if (mDefaultShadow)
- {
- decor_shadow_destroy (qt_xdisplay (), mDefaultShadow);
- mDefaultShadow = NULL;
- }
-
- w->getShapeInfo (&uniqueHorzShape, &uniqueVertShape);
-
- /* only return shadow if decoration doesn't use a unique shape */
- if (uniqueHorzShape || uniqueVertShape)
- return;
-
- mDefaultContext = *w->context ();
- mDefaultBorder = *w->border ();
- mDefaultShadow = w->shadow ();
-
- if (mDefaultShadow)
- decor_shadow_reference (mDefaultShadow);
-}
-
-DBusMessage *
-KWD::Decorator::sendAndBlockForShadowOptionReply (const char *path)
-{
- DBusMessage *message;
-
- message = dbus_message_new_method_call (NULL,
- path,
- DBUS_INTERFACE,
- DBUS_METHOD_GET);
- if (message)
- {
- DBusMessage *reply;
- DBusError error;
-
- dbus_message_set_destination (message, DBUS_DEST);
-
- dbus_error_init (&error);
- reply = dbus_connection_send_with_reply_and_block (mDBusConnection,
- message, -1,
- &error);
- dbus_message_unref (message);
-
- if (!dbus_error_is_set (&error))
- return reply;
- }
-
- return NULL;
-}
-
-void
-KWD::Decorator::updateAllShadowOptions (void)
-{
- DBusMessage *reply;
-
- reply = sendAndBlockForShadowOptionReply (DBUS_PATH "/shadow_radius");
- if (reply)
- {
- dbus_message_get_args (reply, NULL,
- DBUS_TYPE_DOUBLE, &mShadowOptions.shadow_radius,
- DBUS_TYPE_INVALID);
-
- dbus_message_unref (reply);
- }
-
- reply = sendAndBlockForShadowOptionReply (DBUS_PATH "/shadow_opacity");
- if (reply)
- {
- dbus_message_get_args (reply, NULL,
- DBUS_TYPE_DOUBLE, &mShadowOptions.shadow_opacity,
- DBUS_TYPE_INVALID);
- dbus_message_unref (reply);
- }
-
- reply = sendAndBlockForShadowOptionReply (DBUS_PATH "/shadow_color");
- if (reply)
- {
- DBusError error;
- char *str;
-
- dbus_error_init (&error);
-
- dbus_message_get_args (reply, &error,
- DBUS_TYPE_STRING, &str,
- DBUS_TYPE_INVALID);
-
- if (!dbus_error_is_set (&error))
- {
- int c[4];
-
- if (sscanf (str, "#%2x%2x%2x%2x", &c[0], &c[1], &c[2], &c[3]) == 4)
- {
- mShadowOptions.shadow_color[0] = c[0] << 8 | c[0];
- mShadowOptions.shadow_color[1] = c[1] << 8 | c[1];
- mShadowOptions.shadow_color[2] = c[2] << 8 | c[2];
- }
- }
-
- dbus_error_free (&error);
-
- dbus_message_unref (reply);
- }
-
- reply = sendAndBlockForShadowOptionReply (DBUS_PATH "/shadow_x_offset");
- if (reply)
- {
- dbus_message_get_args (reply, NULL,
- DBUS_TYPE_INT32, &mShadowOptions.shadow_offset_x,
- DBUS_TYPE_INVALID);
- dbus_message_unref (reply);
- }
-
- reply = sendAndBlockForShadowOptionReply (DBUS_PATH "/shadow_y_offset");
- if (reply)
- {
- dbus_message_get_args (reply, NULL,
- DBUS_TYPE_INT32, &mShadowOptions.shadow_offset_y,
- DBUS_TYPE_INVALID);
- dbus_message_unref (reply);
- }
-}
-
-void
-KWD::Decorator::changeShadowOptions (decor_shadow_options_t *opt)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
-
- if (!memcmp (opt, &mShadowOptions, sizeof (decor_shadow_options_t)))
- return;
-
- mShadowOptions = *opt;
-
- updateShadow ();
-
- mDecorNormal->reloadDecoration ();
- mDecorActive->reloadDecoration ();
-
- for (it = mClients.constBegin (); it != mClients.constEnd (); it++)
- it.data ()->reloadDecoration ();
-}
-
-void
-KWD::Decorator::updateShadow (void)
-{
- Display *xdisplay = qt_xdisplay ();
- Screen *xscreen = ScreenOfDisplay (xdisplay, qt_xscreen ());
- decor_context_t context;
-
- if (mDefaultShadow)
- {
- decor_shadow_destroy (xdisplay, mDefaultShadow);
- mDefaultShadow = NULL;
- }
-
- if (mNoBorderShadow)
- decor_shadow_destroy (xdisplay, mNoBorderShadow);
-
- mNoBorderShadow = decor_shadow_create (xdisplay,
- xscreen,
- 1, 1,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- &mShadowOptions,
- &context,
- decor_draw_simple,
- 0);
-
- if (mNoBorderShadow)
- {
- decor_extents_t extents = { 0, 0, 0, 0 };
- long data[256];
- decor_quad_t quads[N_QUADS_MAX];
- int nQuad;
- decor_layout_t layout;
-
- decor_get_default_layout (&context, 1, 1, &layout);
-
- nQuad = decor_set_lSrStSbS_window_quads (quads, &context, &layout);
-
- decor_quads_to_property (data, mNoBorderShadow->pixmap,
- &extents, &extents,
- 0, 0, quads, nQuad);
-
- KWD::trapXError ();
- XChangeProperty (qt_xdisplay (), qt_xrootwin (),
- Atoms::netWindowDecorBare,
- XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
- KWD::popXError ();
- }
-}
-
-void
-KWD::Decorator::processDamage (void)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
-
- mDecorNormal->processDamage ();
- mDecorActive->processDamage ();
-
- for (it = mClients.constBegin (); it != mClients.constEnd (); it++)
- it.data ()->processDamage ();
-}
-
-bool
-KWD::Decorator::x11EventFilter (XEvent *xevent)
-{
- KWD::Window *client;
- int status;
-
- switch (xevent->type) {
- case MapNotify: {
- XMapEvent *xme = reinterpret_cast <XMapEvent *> (xevent);
-
- if (mWindows.contains (xme->window))
- client = mWindows[xme->window];
- else if (mDecorNormal->winId () == xme->window)
- client = mDecorNormal;
- else if (mDecorActive->winId () == xme->window)
- client = mDecorActive;
- else
- break;
-
- if (client->handleMap ())
- {
- if (!mIdleTimer.isActive ())
- mIdleTimer.start (0, TRUE);
- }
- } break;
- case ConfigureNotify: {
- XConfigureEvent *xce = reinterpret_cast <XConfigureEvent *> (xevent);
-
- if (mFrames.contains (xce->window))
- mFrames[xce->window]->updateFrame (xce->window);
-
- if (mWindows.contains (xce->window))
- client = mWindows[xce->window];
- else if (mDecorNormal->winId () == xce->window)
- client = mDecorNormal;
- else if (mDecorActive->winId () == xce->window)
- client = mDecorActive;
- else
- break;
-
- if (client->handleConfigure (QSize (xce->width, xce->height)))
- {
- if (!mIdleTimer.isActive ())
- mIdleTimer.start (0, TRUE);
- }
- } break;
- case SelectionRequest:
- decor_handle_selection_request (qt_xdisplay (), xevent, mDmSnTimestamp);
- break;
- case SelectionClear:
- status = decor_handle_selection_clear (qt_xdisplay (),
- xevent, 0);
- if (status == DECOR_SELECTION_GIVE_UP)
- KApplication::exit (0);
-
- break;
- case PropertyNotify:
- if (xevent->xproperty.atom == Atoms::netFrameWindow)
- {
- handleWindowAdded (xevent->xproperty.window);
- }
- else if (xevent->xproperty.atom == Atoms::switchSelectWindow)
- {
- if (!mClients.contains (xevent->xproperty.window))
- {
- handleWindowAdded (xevent->xproperty.window);
- }
- else
- {
- WId id;
-
- if (KWD::readWindowProperty (xevent->xproperty.window,
- Atoms::switchSelectWindow,
- (long *) &id))
- mClients[xevent->xproperty.window]->updateSelected (id);
- }
- }
- else if (xevent->xproperty.atom == Atoms::netWmWindowOpacity)
- {
- if (mClients.contains (xevent->xproperty.window))
- mClients[xevent->xproperty.window]->updateOpacity ();
- }
- break;
- case EnterNotify:
- {
- XCrossingEvent *xce = reinterpret_cast <XCrossingEvent *> (xevent);
- QWidget *widget, *child;
-
- if (!mFrames.contains (xce->window))
- break;
-
- client = mFrames[xce->window];
-
- widget = client->decoration ()->widget ();
- child = widget->childAt (xce->x, xce->y, true);
- if (child)
- {
- QEvent qe (QEvent::Enter);
-
- QApplication::sendEvent (child, &qe);
-
- client->setActiveChild (child);
- client->updateCursor (QPoint (xce->x, xce->y));
- }
- } break;
- case LeaveNotify:
- {
- XCrossingEvent *xce = reinterpret_cast <XCrossingEvent *> (xevent);
-
- if (mFrames.contains (xce->window))
- {
- QEvent qe (QEvent::Leave);
-
- client = mFrames[xce->window];
-
- QApplication::sendEvent (client->activeChild (), &qe);
-
- XUndefineCursor (qt_xdisplay (), client->frameId ());
- }
- } break;
- case MotionNotify:
- {
- XMotionEvent *xme = reinterpret_cast < XMotionEvent * >(xevent);
- QWidget *widget, *child;
-
- if (!mFrames.contains (xme->window))
- break;
-
- client = mFrames[xme->window];
-
- widget = client->decoration ()->widget ();
- child = widget->childAt (xme->x, xme->y, true);
- if (child)
- {
- QPoint qp (xme->x, xme->y);
-
- if (child != client->activeChild ())
- {
- QEvent qee (QEvent::Enter);
- QEvent qle (QEvent::Leave);
-
- if (client->activeChild ())
- QApplication::sendEvent (client->activeChild (), &qle);
-
- QApplication::sendEvent (child, &qee);
-
- client->setActiveChild (child);
- }
-
- if (widget != child)
- qp -= QPoint (child->pos ().x (), child->pos ().y ());
-
- QMouseEvent qme (QEvent::MouseMove, qp, Qt::NoButton, Qt::NoButton);
-
- QApplication::sendEvent (child, &qme);
-
- client->updateCursor (QPoint (xme->x, xme->y));
- }
- } break;
- case ButtonPress:
- case ButtonRelease:
- {
- XButtonEvent *xbe = reinterpret_cast <XButtonEvent *>(xevent);
- QWidget *widget, *child;
-
- if (!mFrames.contains (xbe->window))
- break;
-
- client = mFrames[xbe->window];
-
- widget = client->decoration ()->widget ();
- child = widget->childAt (xbe->x, xbe->y, true);
-
- if (child)
- {
- XButtonEvent xbe2 = *xbe;
-
- xbe2.window = child->winId ();
- if (widget != child)
- {
- xbe2.x = xbe->x - child->pos ().x ();
- xbe2.y = xbe->y - child->pos ().y ();
- }
-
- QApplication::x11ProcessEvent ((XEvent *) &xbe2);
-
- return true;
- }
- } break;
- case ClientMessage:
- if (xevent->xclient.message_type == Atoms::toolkitActionAtom)
- {
- unsigned long action;
-
- action = xevent->xclient.data.l[0];
- if (action == Atoms::toolkitActionWindowMenuAtom)
- {
- if (mClients.contains (xevent->xclient.window))
- {
- QPoint pos;
-
- client = mClients[xevent->xclient.window];
-
- if (xevent->xclient.data.l[2])
- {
- pos = QPoint (xevent->xclient.data.l[3],
- xevent->xclient.data.l[4]);
- }
- else
- {
- pos = client->clientGeometry ().topLeft ();
- }
-
- client->showWindowMenu (pos);
- }
- }
- else if (action == Atoms::toolkitActionForceQuitDialogAtom)
- {
- if (mClients.contains (xevent->xclient.window))
- {
- Time timestamp = xevent->xclient.data.l[1];
-
- client = mClients[xevent->xclient.window];
-
- if (xevent->xclient.data.l[2])
- client->showKillProcessDialog (timestamp);
- else
- client->hideKillProcessDialog ();
- }
- }
- }
- break;
- default:
- if (xevent->type == mDamageEvent + XDamageNotify)
- {
- XDamageNotifyEvent *xde =
- reinterpret_cast <XDamageNotifyEvent *>(xevent);
-
- if (mWindows.contains (xde->drawable))
- client = mWindows[xde->drawable];
- else if (mDecorNormal->winId () == xde->drawable)
- client = mDecorNormal;
- else if (mDecorActive->winId () == xde->drawable)
- client = mDecorActive;
- else
- break;
-
- client->addDamageRect (xde->area.x,
- xde->area.y,
- xde->area.width,
- xde->area.height);
-
- if (client->pixmapId ())
- {
- if (!mIdleTimer.isActive ())
- mIdleTimer.start (0, TRUE);
- }
-
- return true;
- }
- break;
- }
-
- return KApplication::x11EventFilter (xevent);
-}
-
-void
-KWD::Decorator::reconfigure (void)
-{
- unsigned long changed;
-
- mConfig->reparseConfiguration ();
-
- changed = mOptions->updateSettings ();
- if (mPlugins->reset (changed))
- {
- QMap < WId, KWD::Window * >::ConstIterator it;
-
- updateShadow ();
-
- mDecorNormal->reloadDecoration ();
- mDecorActive->reloadDecoration ();
-
- for (it = mClients.constBegin (); it != mClients.constEnd (); it++)
- it.data ()->reloadDecoration ();
-
- mPlugins->destroyPreviousPlugin ();
- }
-}
-
-void
-KWD::Decorator::handleWindowAdded (WId id)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
- KWD::Window *client = 0;
- WId select, frame = 0;
- KWD::Window::Type type;
- unsigned int width, height, border, depth;
- int x, y;
- XID root;
- QWidgetList *widgets;
-
- /* avoid adding any of our own top level windows */
- widgets = QApplication::topLevelWidgets ();
- if (widgets)
- {
- for (QWidgetListIt it (*widgets); it.current (); ++it)
- {
- if (it.current ()->winId () == id)
- {
- delete widgets;
- return;
- }
- }
-
- delete widgets;
- }
-
- KWD::trapXError ();
- XGetGeometry (qt_xdisplay (), id, &root, &x, &y, &width, &height,
- &border, &depth);
- if (KWD::popXError ())
- return;
-
- KWD::readWindowProperty (id, Atoms::netFrameWindow, (long *) &frame);
- if (KWD::readWindowProperty (id, Atoms::switchSelectWindow,
- (long *) &select))
- {
- type = KWD::Window::Switcher;
- }
- else
- {
- KWin::WindowInfo wInfo = KWin::windowInfo (id, NET::WMWindowType, 0);
-
- switch (wInfo.windowType (~0)) {
- case NET::Normal:
- case NET::Dialog:
- case NET::Toolbar:
- case NET::Menu:
- case NET::Utility:
- case NET::Splash:
- case NET::Unknown:
- /* decorate these window types */
- break;
- default:
- return;
- }
-
- type = KWD::Window::Normal;
- }
-
- KWD::trapXError ();
- XSelectInput (qt_xdisplay (), id, StructureNotifyMask | PropertyChangeMask);
- KWD::popXError ();
-
- if (frame)
- {
- if (!mClients.contains (id))
- {
- client = new KWD::Window (mCompositeWindow, id, frame, type,
- x, y,
- width + border * 2,
- height + border * 2);
-
- mClients.insert (id, client);
- mWindows.insert (client->winId (), client);
- mFrames.insert (frame, client);
- }
- else
- {
- client = mClients[id];
- mFrames.remove (client->frameId ());
- mFrames.insert (frame, client);
-
- client->updateFrame (frame);
- }
- }
- else if (type == KWD::Window::Switcher)
- {
- if (!mClients.contains (id))
- {
- client = new KWD::Window (mCompositeWindow, id, 0, type,
- x, y,
- width + border * 2,
- height + border * 2);
- mClients.insert (id, client);
- mWindows.insert (client->winId (), client);
- }
- }
- else
- {
- if (mClients.contains (id))
- client = mClients[id];
-
- if (client)
- {
- mClients.remove (client->windowId ());
- mWindows.remove (client->winId ());
- mFrames.remove (client->frameId ());
-
- delete client;
- }
- }
-}
-
-void
-KWD::Decorator::handleWindowRemoved (WId id)
-{
- KWD::Window *window = 0;
-
- if (mClients.contains (id))
- window = mClients[id];
- else if (mFrames.contains (id))
- window = mFrames[id];
-
- if (window)
- {
- mClients.remove (window->windowId ());
- mWindows.remove (window->winId ());
- mFrames.remove (window->frameId ());
-
- delete window;
- }
-}
-
-void
-KWD::Decorator::handleActiveWindowChanged (WId id)
-{
- if (id != mActiveId)
- {
- KWD::Window *newActiveWindow = 0;
- KWD::Window *oldActiveWindow = 0;
-
- if (mClients.contains (id))
- newActiveWindow = mClients[id];
-
- if (mClients.contains (mActiveId))
- oldActiveWindow = mClients[mActiveId];
-
- mActiveId = id;
-
- if (oldActiveWindow)
- oldActiveWindow->handleActiveChange ();
-
- if (newActiveWindow)
- newActiveWindow->handleActiveChange ();
- }
-}
-
-void
-KWD::Decorator::handleWindowChanged (WId id,
- const unsigned long *properties)
-{
- KWD::Window *client;
-
- if (!mClients.contains (id))
- return;
-
- client = mClients[id];
-
- if (properties[0] & NET::WMName)
- client->updateName ();
- if (properties[0] & NET::WMVisibleName)
- client->updateName ();
- if (properties[0] & NET::WMState)
- client->updateState ();
- if (properties[0] & NET::WMIcon)
- client->updateIcons ();
- if (properties[0] & NET::WMGeometry)
- client->updateWindowGeometry ();
-}
-
-void
-KWD::Decorator::sendClientMessage (WId eventWid,
- WId wid,
- Atom atom,
- Atom value,
- long data1,
- long data2,
- long data3)
-{
- XEvent ev;
- long mask = 0;
-
- memset (&ev, 0, sizeof (ev));
-
- ev.xclient.type = ClientMessage;
- ev.xclient.window = wid;
- ev.xclient.message_type = atom;
- ev.xclient.format = 32;
-
- ev.xclient.data.l[0] = value;
- ev.xclient.data.l[1] = qt_x_time;
- ev.xclient.data.l[2] = data1;
- ev.xclient.data.l[3] = data2;
- ev.xclient.data.l[4] = data3;
-
- if (eventWid == qt_xrootwin ())
- mask = SubstructureRedirectMask | SubstructureNotifyMask;
-
- KWD::trapXError ();
- XSendEvent (qt_xdisplay (), eventWid, false, mask, &ev);
- KWD::popXError ();
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator/decorator.h compiz-0.8.8/kde/window-decorator/decorator.h
--- compiz-0.8.8-orig/kde/window-decorator/decorator.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/decorator.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,183 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _DECORATOR_H
-#define _DECORATOR_H
-
-#include <kapplication.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/cursorfont.h>
-
-#include <qtimer.h>
-
-#include <fixx11h.h>
-#include <kconfig.h>
-#include <kdecoration_plugins_p.h>
-#include <kdecoration_p.h>
-#include <netwm.h>
-
-#include <decoration.h>
-
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/connection.h>
-
-#include "window.h"
-#include "KWinInterface.h"
-
-#define ROOT_OFF_X 8192
-#define ROOT_OFF_Y 8192
-
-#define C(name) { 0, XC_ ## name }
-
-struct _cursor {
- Cursor cursor;
- unsigned int shape;
-};
-
-extern struct _cursor cursors[3][3];
-
-extern double decorationOpacity;
-extern bool decorationOpacityShade;
-extern double activeDecorationOpacity;
-extern bool activeDecorationOpacityShade;
-
-#define BLUR_TYPE_NONE 0
-#define BLUR_TYPE_TITLEBAR 1
-#define BLUR_TYPE_ALL 2
-
-extern int blurType;
-
-class KConfig;
-class KWinModule;
-
-namespace KWD
-{
- class Options;
-
-class PluginManager:public KDecorationPlugins {
- public:
- PluginManager (KConfig *config);
- virtual bool provides (Requirement)
- {
- return false;
- }
- };
-
-
-class Decorator:public KApplication, public KWinInterface {
- Q_OBJECT public:
- Decorator (void);
- ~Decorator (void);
-
- static NETRootInfo *rootInfo (void)
- {
- return mRootInfo;
- }
- static PluginManager *pluginManager (void)
- {
- return mPlugins;
- }
- static KWD::Options *options (void)
- {
- return mOptions;
- }
- static WId activeId (void)
- {
- return mActiveId;
- }
- static decor_shadow_options_t *shadowOptions (void)
- {
- return &mShadowOptions;
- }
- static decor_shadow_t *defaultWindowShadow (decor_context_t *context,
- decor_extents_t *border)
- {
- if (!mDefaultShadow)
- return NULL;
-
- if (memcmp (border, &mDefaultBorder, sizeof (decor_extents_t)) != 0)
- return NULL;
-
- *context = mDefaultContext;
- return mDefaultShadow;
- }
- static void sendClientMessage (WId eventWid,
- WId wid,
- Atom atom,
- Atom value,
- long data1 = 0,
- long data2 = 0,
- long data3 = 0);
- static void updateDefaultShadow (KWD::Window *w);
-
- bool enableDecorations (Time timestamp, int damageEvent);
- bool x11EventFilter (XEvent *xevent);
- void changeShadowOptions (decor_shadow_options_t *opt);
-
- public slots:
- void reconfigure (void);
-
- private:
- DBusMessage *sendAndBlockForShadowOptionReply (const char *path);
- WId fetchFrame (WId window);
- void updateShadow (void);
- void updateAllShadowOptions (void);
-
- private slots:
- void handleWindowAdded (WId id);
- void handleWindowRemoved (WId id);
- void handleActiveWindowChanged (WId id);
- void handleWindowChanged (WId id,
- const unsigned long *properties);
- void processDamage (void);
-
- private:
- static PluginManager *mPlugins;
- static KWD::Options *mOptions;
- static decor_extents_t mDefaultBorder;
- static decor_context_t mDefaultContext;
- static decor_shadow_t *mDefaultShadow;
- static decor_shadow_t *mNoBorderShadow;
- static decor_shadow_options_t mShadowOptions;
- static NETRootInfo *mRootInfo;
- static WId mActiveId;
-
- KWD::Window *mDecorNormal;
- KWD::Window *mDecorActive;
- QMap <WId, KWD::Window *>mClients;
- QMap <WId, KWD::Window *>mFrames;
- QMap <WId, KWD::Window *>mWindows;
- KConfig *mConfig;
- Time mDmSnTimestamp;
- int mDamageEvent;
- QTimer mIdleTimer;
- KWinModule *mKWinModule;
- DBusConnection *mDBusConnection;
- DBusQt::Connection mDBusQtConnection;
- WId mCompositeWindow;
- };
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator/KWinInterface.h compiz-0.8.8/kde/window-decorator/KWinInterface.h
--- compiz-0.8.8-orig/kde/window-decorator/KWinInterface.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/KWinInterface.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,17 +0,0 @@
-// taken from KWin
-
-#ifndef KWIN_INTERFACE_H
-#define KWIN_INTERFACE_H
-
-#include <dcopobject.h>
-
-class KWinInterface:virtual public DCOPObject
-{
- K_DCOP
-
- k_dcop:
-
- virtual ASYNC reconfigure () = 0;
-};
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator/main.cpp compiz-0.8.8/kde/window-decorator/main.cpp
--- compiz-0.8.8-orig/kde/window-decorator/main.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/main.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,143 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xdamage.h>
-
-#include <fixx11h.h>
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <klocale.h>
-
-#include "decorator.h"
-
-static const KCmdLineOptions options[] = {
- { "replace", "Replace existing window decorator", 0 },
- { "sm-disable", "Disable connection to session manager", 0 },
- { "opacity <value>", "Decoration opacity", "0.75" },
- { "no-opacity-shade", "No decoration opacity shading", 0 },
- { "active-opacity <value>", "Active decoration opacity", "1.0" },
- { "no-active-opacity-shade", "No active decoration opacity shading", 0 },
- { "blur <type>", "Blur type", "none" },
- KCmdLineLastOption
-};
-
-#include <kdebug.h>
-int
-main (int argc, char **argv)
-{
- KWD::Decorator *app;
- KCmdLineArgs *args;
- int status;
- int event, error;
- Time timestamp;
-
- KLocale::setMainCatalogue("kwin");
-
- KCmdLineArgs::init (argc, argv,
- "kde-window-decorator",
- "KWD",
- "KDE Window Decorator",
- "0.0.1");
- KCmdLineArgs::addCmdLineOptions (options);
- args = KCmdLineArgs::parsedArgs ();
-
- if (args->isSet ("opacity"))
- decorationOpacity = args->getOption ("opacity").toDouble ();
-
- if (args->isSet ("-opacity-shade"))
- decorationOpacityShade = true;
-
- if (args->isSet ("active-opacity"))
- activeDecorationOpacity =
- args->getOption ("active-opacity").toDouble ();
-
- if (args->isSet ("-active-opacity-shade"))
- activeDecorationOpacityShade = true;
-
- if (args->isSet ("blur"))
- {
- QString blur = args->getOption ("blur");
-
- if (blur == QString ("titlebar"))
- blurType = BLUR_TYPE_TITLEBAR;
- else if (blur == QString ("all"))
- blurType = BLUR_TYPE_ALL;
- }
-
- app = new KWD::Decorator ();
-
- if (args->isSet ("sm-disable"))
- app->disableSessionManagement ();
-
- if (!XDamageQueryExtension (qt_xdisplay (), &event, &error))
- {
- fprintf (stderr,
- "%s: Damage extension is missing on display \"%s\"\n",
- argv[0], DisplayString (qt_xdisplay ()));
-
- return 1;
- }
-
- status = decor_acquire_dm_session (qt_xdisplay (), qt_xscreen (), "kwd",
- args->isSet ("replace"),
- &timestamp);
- if (status != DECOR_ACQUIRE_STATUS_SUCCESS)
- {
- if (status == DECOR_ACQUIRE_STATUS_FAILED)
- {
- fprintf (stderr,
- "%s: Could not acquire decoration manager "
- "selection on screen %d display \"%s\"\n",
- argv[0], qt_xscreen (), DisplayString (qt_xdisplay ()));
- }
- else if (status == DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING)
- {
- fprintf (stderr,
- "%s: Screen %d on display \"%s\" already "
- "has a decoration manager; try using the "
- "--replace option to replace the current "
- "decoration manager.\n",
- argv[0], qt_xscreen (), DisplayString (qt_xdisplay ()));
- }
-
- return 1;
- }
-
- decor_set_dm_check_hint (qt_xdisplay (), qt_xscreen ());
-
- if (!app->enableDecorations (timestamp, event))
- {
- fprintf (stderr,
- "%s: Could not enable decorations on display \"%s\"\n",
- argv[0], DisplayString (qt_xdisplay ()));
-
- return 1;
- }
-
- status = app->exec ();
-
- delete app;
-
- return status;
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator/Makefile.am compiz-0.8.8/kde/window-decorator/Makefile.am
--- compiz-0.8.8-orig/kde/window-decorator/Makefile.am 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/Makefile.am 1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-if USE_KDE
-
-BUILDSOURCES = \
- decorator.moc.cpp \
- window.moc.cpp \
- KWinInterface_skel.cpp
-
-kde_window_decorator_DEPENDENCIES = \
- $(top_builddir)/libdecoration/libdecoration.la
-kde_window_decorator_LDADD = \
- $(top_builddir)/libdecoration/libdecoration.la \
- @KDE_WINDOW_DECORATOR_LIBS@ @KDE_LIBS@
-dist_kde_window_decorator_SOURCES = \
- main.cpp \
- utils.cpp \
- utils.h \
- decorator.cpp \
- decorator.h \
- window.cpp \
- window.h \
- options.cpp \
- options.h \
- KWinInterface.h
-
-nodist_kde_window_decorator_SOURCES = $(BUILDSOURCES)
-
-kde_window_decorator_program = kde-window-decorator
-
-INCLUDES = -I$(top_srcdir)/include @KDE_WINDOW_DECORATOR_CFLAGS@ @KDE_CFLAGS@
-
-bin_PROGRAMS = $(kde_window_decorator_program)
-
-%.moc.cpp: %.h
- $(QT_MOC) $< > $@
-
-%.kidl: %.h
- $(DCOPIDL) $< > $@
-
-%_skel.cpp: %.kidl
- $(DCOPIDL2CPP) $< > $@
-
-CLEANFILES = $(BUILDSOURCES) KWinInterface_skel.* KWinInterface_stub.*
-
-endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator/options.cpp compiz-0.8.8/kde/window-decorator/options.cpp
--- compiz-0.8.8-orig/kde/window-decorator/options.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/options.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,187 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "options.h"
-
-#include <kconfig.h>
-#include <kdecoration_p.h>
-
-KWD::Options::Options (KConfig *config): KDecorationOptions (), mConfig (config)
-{
- d = new KDecorationOptionsPrivate;
- updateSettings ();
-}
-
-unsigned long
-KWD::Options::updateSettings (void)
-{
- unsigned long changed = 0;
-
- changed |= d->updateKWinSettings (mConfig);
-
- mConfig->setGroup ("Windows");
-
- OpTitlebarDblClick =
- windowOperation (mConfig->readEntry ("TitlebarDoubleClickCommand",
- "Shade"), true);
- d->OpMaxButtonLeftClick =
- windowOperation (mConfig->readEntry ("MaximizeButtonLeftClickCommand",
- "Maximize"), true);
- d->OpMaxButtonMiddleClick =
- windowOperation (mConfig->readEntry ("MaximizeButtonMiddleClickCommand",
- "Maximize (vertical only)"), true);
- d->OpMaxButtonRightClick =
- windowOperation (mConfig->readEntry ("MaximizeButtonRightClickCommand",
- "Maximize (horizontal only)"),
- true);
-
- mConfig->setGroup ("MouseBindings");
-
- CmdActiveTitlebar1 =
- mouseCommand (mConfig->readEntry ("CommandActiveTitlebar1",
- "Raise"), true);
- CmdActiveTitlebar2 =
- mouseCommand (mConfig->readEntry ("CommandActiveTitlebar2",
- "Lower"), true);
- CmdActiveTitlebar3 =
- mouseCommand (mConfig->readEntry ("CommandActiveTitlebar3",
- "Operations menu"), true);
- CmdInactiveTitlebar1 =
- mouseCommand (mConfig->readEntry ("CommandInactiveTitlebar1",
- "Activate and raise"), true);
- CmdInactiveTitlebar2 =
- mouseCommand (mConfig->readEntry ("CommandInactiveTitlebar2",
- "Activate and lower"), true);
- CmdInactiveTitlebar3 =
- mouseCommand (mConfig->readEntry ("CommandInactiveTitlebar3",
- "Operations menu"), true);
-
- CmdTitlebarWheel =
- mouseWheelCommand (mConfig->readEntry ("CommandTitlebarWheel",
- "Nothing"));
-
- return changed;
-}
-
-// restricted should be true for operations that the user may not be able to
-// repeat if the window is moved out of the workspace (e.g. if the user moves
-// a window by the titlebar, and moves it too high beneath Kicker at the top
-// edge, they may not be able to move it back, unless they know about Alt+LMB)
-KDecorationDefines::WindowOperation
-KWD::Options::windowOperation (const QString &name, bool restricted)
-{
- if (name == "Move")
- return restricted ? KWD::Options::MoveOp :
- KWD::Options::UnrestrictedMoveOp;
- else if (name == "Resize")
- return restricted ? KWD::Options::ResizeOp :
- KWD::Options::UnrestrictedResizeOp;
- else if (name == "Maximize")
- return KWD::Options::MaximizeOp;
- else if (name == "Minimize")
- return KWD::Options::MinimizeOp;
- else if (name == "Close")
- return KWD::Options::CloseOp;
- else if (name == "OnAllDesktops")
- return KWD::Options::OnAllDesktopsOp;
- else if (name == "Shade")
- return KWD::Options::ShadeOp;
- else if (name == "Operations")
- return KWD::Options::OperationsOp;
- else if (name == "Maximize (vertical only)")
- return KWD::Options::VMaximizeOp;
- else if (name == "Maximize (horizontal only)")
- return KWD::Options::HMaximizeOp;
- else if (name == "Lower")
- return KWD::Options::LowerOp;
- return KWD::Options::NoOp;
-}
-
-KWD::Options::MouseCommand
-KWD::Options::mouseCommand (const QString &name,
- bool restricted)
-{
- QString lowerName = name.lower ();
-
- if (lowerName == "raise") return MouseRaise;
- if (lowerName == "lower") return MouseLower;
- if (lowerName == "operations menu") return MouseOperationsMenu;
- if (lowerName == "toggle raise and lower") return MouseToggleRaiseAndLower;
- if (lowerName == "activate and raise") return MouseActivateAndRaise;
- if (lowerName == "activate and lower") return MouseActivateAndLower;
- if (lowerName == "activate") return MouseActivate;
- if (lowerName == "activate, raise and pass click")
- return MouseActivateRaiseAndPassClick;
- if (lowerName == "activate and pass click")
- return MouseActivateAndPassClick;
- if (lowerName == "activate, raise and move")
- return restricted ? MouseActivateRaiseAndMove :
- MouseActivateRaiseAndUnrestrictedMove;
- if (lowerName == "move")
- return restricted ? MouseMove : MouseUnrestrictedMove;
- if (lowerName == "resize")
- return restricted ? MouseResize : MouseUnrestrictedResize;
- if (lowerName == "shade") return MouseShade;
- if (lowerName == "minimize") return MouseMinimize;
- if (lowerName == "nothing") return MouseNothing;
-
- return MouseNothing;
-}
-
-KWD::Options::MouseWheelCommand
-KWD::Options::mouseWheelCommand (const QString &name)
-{
- QString lowerName = name.lower ();
-
- if (lowerName == "raise/lower") return MouseWheelRaiseLower;
- if (lowerName == "shade/unshade") return MouseWheelShadeUnshade;
- if (lowerName == "maximize/restore") return MouseWheelMaximizeRestore;
- if (lowerName == "above/below") return MouseWheelAboveBelow;
- if (lowerName == "previous/next desktop")
- return MouseWheelPreviousNextDesktop;
- if (lowerName == "change opacity") return MouseWheelChangeOpacity;
-
- return MouseWheelNothing;
-}
-
-KWD::Options::MouseCommand
-KWD::Options::wheelToMouseCommand (MouseWheelCommand com,
- int delta)
-{
- switch (com) {
- case MouseWheelRaiseLower:
- return delta > 0 ? MouseRaise : MouseLower;
- case MouseWheelShadeUnshade:
- return delta > 0 ? MouseSetShade : MouseUnsetShade;
- case MouseWheelMaximizeRestore:
- return delta > 0 ? MouseMaximize : MouseRestore;
- case MouseWheelAboveBelow:
- return delta > 0 ? MouseAbove : MouseBelow;
- case MouseWheelPreviousNextDesktop:
- return delta > 0 ? MousePreviousDesktop : MouseNextDesktop;
- case MouseWheelChangeOpacity:
- return delta > 0 ? MouseOpacityMore : MouseOpacityLess;
- default:
- return MouseNothing;
- }
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator/options.h compiz-0.8.8/kde/window-decorator/options.h
--- compiz-0.8.8-orig/kde/window-decorator/options.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/options.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,140 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _OPTIONS_H
-#define _OPTIONS_H
-
-#include <kdecoration.h>
-
-class KConfig;
-
-namespace KWD
-{
-
-class Options : public KDecorationOptions
- {
- public:
- enum MouseCommand
- {
- MouseRaise,
- MouseLower,
- MouseOperationsMenu,
- MouseToggleRaiseAndLower,
- MouseActivateAndRaise,
- MouseActivateAndLower,
- MouseActivate,
- MouseActivateRaiseAndPassClick,
- MouseActivateAndPassClick,
- MouseMove,
- MouseUnrestrictedMove,
- MouseActivateRaiseAndMove,
- MouseActivateRaiseAndUnrestrictedMove,
- MouseResize,
- MouseUnrestrictedResize,
- MouseShade,
- MouseSetShade,
- MouseUnsetShade,
- MouseMaximize,
- MouseRestore,
- MouseMinimize,
- MouseNextDesktop,
- MousePreviousDesktop,
- MouseAbove,
- MouseBelow,
- MouseOpacityMore,
- MouseOpacityLess,
- MouseNothing
- };
- enum MouseWheelCommand
- {
- MouseWheelRaiseLower,
- MouseWheelShadeUnshade,
- MouseWheelMaximizeRestore,
- MouseWheelAboveBelow,
- MouseWheelPreviousNextDesktop,
- MouseWheelChangeOpacity,
- MouseWheelNothing
- };
-
- Options (KConfig *config);
-
- virtual unsigned long updateSettings (void);
-
- WindowOperation operationTitlebarDblClick (void)
- {
- return OpTitlebarDblClick;
- }
-
- MouseCommand commandActiveTitlebar1 (void)
- {
- return CmdActiveTitlebar1;
- }
- MouseCommand commandActiveTitlebar2 (void)
- {
- return CmdActiveTitlebar2;
- }
- MouseCommand commandActiveTitlebar3 (void)
- {
- return CmdActiveTitlebar3;
- }
- MouseCommand commandInactiveTitlebar1 (void)
- {
- return CmdInactiveTitlebar1;
- }
- MouseCommand commandInactiveTitlebar2 (void)
- {
- return CmdInactiveTitlebar2;
- }
- MouseCommand commandInactiveTitlebar3 (void)
- {
- return CmdInactiveTitlebar3;
- }
-
- MouseCommand operationTitlebarMouseWheel (int delta)
- {
- return wheelToMouseCommand (CmdTitlebarWheel, delta);
- }
-
- private:
- static KDecorationDefines::WindowOperation
- windowOperation (const QString &name, bool restricted);
- MouseCommand mouseCommand (const QString &name, bool restricted);
- MouseWheelCommand mouseWheelCommand (const QString &name);
- MouseCommand wheelToMouseCommand (MouseWheelCommand com, int delta);
-
- private:
- KDecorationDefines::WindowOperation OpTitlebarDblClick;
- MouseCommand CmdActiveTitlebar1;
- MouseCommand CmdActiveTitlebar2;
- MouseCommand CmdActiveTitlebar3;
- MouseCommand CmdInactiveTitlebar1;
- MouseCommand CmdInactiveTitlebar2;
- MouseCommand CmdInactiveTitlebar3;
- MouseWheelCommand CmdTitlebarWheel;
-
- KConfig *mConfig;
- };
-
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator/utils.cpp compiz-0.8.8/kde/window-decorator/utils.cpp
--- compiz-0.8.8-orig/kde/window-decorator/utils.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/utils.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,205 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "utils.h"
-
-#include <qt.h>
-
-#include <decoration.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#include <stdlib.h>
-
-static int trappedErrorCode = 0;
-
-namespace KWD
-{
- namespace Atoms
- {
- Atom switchSelectWindow;
- Atom netWmWindowOpacity;
- Atom netFrameWindow;
- Atom netWindowDecor;
- Atom netWindowDecorNormal;
- Atom netWindowDecorActive;
- Atom netWindowDecorBare;
- Atom wmTakeFocus;
- Atom netWmContextHelp;
- Atom wmProtocols;
- Atom toolkitActionAtom;
- Atom toolkitActionWindowMenuAtom;
- Atom toolkitActionForceQuitDialogAtom;
- Atom compizWindowBlurDecor;
- }
-}
-
-static int (*oldErrorHandler) (Display *display, XErrorEvent *error);
-
-static int
-xErrorHandler (Display *display,
- XErrorEvent *error)
-{
- (void) display;
-
- trappedErrorCode = error->error_code;
-
- return 0;
-}
-
-void
-KWD::trapXError (void)
-{
- trappedErrorCode = 0;
- oldErrorHandler = XSetErrorHandler (xErrorHandler);
-}
-
-int
-KWD::popXError (void)
-{
- XSync (qt_xdisplay(), false);
- XSetErrorHandler (oldErrorHandler);
-
- return trappedErrorCode;
-}
-
-void *
-KWD::readXProperty (WId window,
- Atom property,
- Atom type,
- int *items)
-{
- long offset = 0, length = 2048L;
- Atom actualType;
- int format;
- unsigned long nItems, bytesRemaining;
- unsigned char *data = 0l;
- int result;
-
- KWD::trapXError ();
- result = XGetWindowProperty (qt_xdisplay (), window, property, offset,
- length, false, type,
- &actualType, &format, &nItems,
- &bytesRemaining, &data);
-
- if (KWD::popXError ())
- return NULL;
-
- if (result == Success && actualType == type && format == 32 && nItems > 0)
- {
- if (items)
- *items = nItems;
-
- return reinterpret_cast <void *>(data);
- }
-
- if (data)
- XFree (data);
-
- if (items)
- *items = 0;
-
- return NULL;
-}
-
-bool
-KWD::readWindowProperty (long window,
- long property,
- long *value)
-{
- void *data = readXProperty (window, property, XA_WINDOW, NULL);
-
- if (data)
- {
- if (value)
- *value = *reinterpret_cast <int *>(data);
-
- XFree (data);
-
- return true;
- }
-
- return false;
-}
-
-unsigned short
-KWD::readPropertyShort (WId id,
- Atom property,
- unsigned short defaultValue)
-{
- Atom actual;
- int result, format;
- unsigned long n, left;
- unsigned char *data;
-
- KWD::trapXError ();
- result = XGetWindowProperty (qt_xdisplay (), id, property,
- 0L, 1L, FALSE, XA_CARDINAL, &actual, &format,
- &n, &left, &data);
- if (KWD::popXError ())
- return defaultValue;
-
- if (result == Success && n && data)
- {
- unsigned int value;
-
- memcpy (&value, data, sizeof (unsigned int));
-
- XFree (data);
-
- return value >> 16;
- }
-
- return defaultValue;
-}
-
-void
-KWD::Atoms::init (void)
-{
- Display *xdisplay = qt_xdisplay ();
-
- netFrameWindow = XInternAtom (xdisplay, "_NET_FRAME_WINDOW", false);
- netWindowDecor = XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, false);
- netWindowDecorNormal =
- XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, false);
- netWindowDecorActive =
- XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, false);
- netWindowDecorBare =
- XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, false);
- switchSelectWindow =
- XInternAtom (xdisplay, DECOR_SWITCH_WINDOW_ATOM_NAME, false);
- wmTakeFocus = XInternAtom (xdisplay, "WM_TAKE_FOCUS", false);
- netWmContextHelp =
- XInternAtom (xdisplay, "_NET_WM_CONTEXT_HELP", false);
- wmProtocols = XInternAtom (xdisplay, "WM_PROTOCOLS", false);
- netWmWindowOpacity =
- XInternAtom (xdisplay, "_NET_WM_WINDOW_OPACITY", false);
- toolkitActionAtom = XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION", false);
- toolkitActionWindowMenuAtom =
- XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_WINDOW_MENU", false);
- toolkitActionForceQuitDialogAtom =
- XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_FORCE_QUIT_DIALOG",
- false);
- compizWindowBlurDecor =
- XInternAtom (xdisplay, DECOR_BLUR_ATOM_NAME, false);
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator/utils.h compiz-0.8.8/kde/window-decorator/utils.h
--- compiz-0.8.8-orig/kde/window-decorator/utils.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/utils.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,63 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _UTILS_H
-#define _UTILS_H
-
-#include <X11/Xlib.h>
-#include <fixx11h.h>
-#include <qwidget.h>
-
-namespace KWD
-{
- namespace Atoms
- {
- extern Atom switchSelectWindow;
- extern Atom netWmWindowOpacity;
- extern Atom netFrameWindow;
- extern Atom netWindowDecor;
- extern Atom netWindowDecorNormal;
- extern Atom netWindowDecorActive;
- extern Atom netWindowDecorBare;
- extern Atom wmTakeFocus;
- extern Atom netWmContextHelp;
- extern Atom wmProtocols;
- extern Atom toolkitActionAtom;
- extern Atom toolkitActionWindowMenuAtom;
- extern Atom toolkitActionForceQuitDialogAtom;
- extern Atom compizWindowBlurDecor;
-
- void init (void);
- }
-
- void trapXError (void);
- int popXError (void);
- bool eventFilter (void *message, long *result);
- void *readXProperty (WId window, Atom property, Atom type, int *items);
- bool readWindowProperty (long wId, long property, long *value);
- unsigned short readPropertyShort (WId id,
- Atom property,
- unsigned short defaultValue);
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator/window.cpp compiz-0.8.8/kde/window-decorator/window.cpp
--- compiz-0.8.8-orig/kde/window-decorator/window.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/window.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,2091 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "window.h"
-#include "decorator.h"
-#include "options.h"
-#include "utils.h"
-
-#include <X11/Xlib.h>
-#include <X11/extensions/shape.h>
-#include <X11/extensions/Xcomposite.h>
-#include <X11/Xregion.h>
-
-#include <fixx11h.h>
-
-#include <kdebug.h>
-#include <kglobal.h>
-#include <kglobalsettings.h>
-#include <kiconloader.h>
-#include <kdecoration.h>
-#include <kwin.h>
-#include <klocale.h>
-#include <kprocess.h>
-#include <kstandarddirs.h>
-
-#include <qapplication.h>
-#include <qlayout.h>
-#include <qevent.h>
-#include <qpainter.h>
-#include <qobjectlist.h>
-#include <qwidget.h>
-#include <qstring.h>
-#include <qtimer.h>
-#include <qcursor.h>
-#include <qpopupmenu.h>
-
-KWD::Window::Window (WId parentId,
- WId clientId,
- WId frame,
- Type type,
- int x,
- int y,
- int w,
- int h): QWidget (0, 0),
- mType (type),
- mParentId (parentId),
- mFrame (0),
- mClientId (clientId),
- mSelectedId (0),
- mDecor (0),
- mPixmap (0),
- mDamageId (0),
- mShadow (0),
- mPicture (0),
- mTexturePicture (0),
- mDecorationPicture (0),
- mUpdateProperty (false),
- mShapeSet (false),
- mUniqueHorzShape (false),
- mUniqueVertShape (false),
- mPopup (0),
- mAdvancedMenu (0),
- mDesktopMenu (0),
- mMapped (false),
- mPendingMap (0),
- mPendingConfigure (0),
- mProcessKiller (0)
-{
- memset (&mBorder, 0, sizeof (mBorder));
-
- if (mType == Normal || mType == Switcher)
- {
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMState |
- NET::WMVisibleName, 0);
-
- mState = wInfo.state ();
-
- if (mType == Normal)
- {
- mName = wInfo.visibleName ();
-
- mIcons = QIconSet (KWin::icon (mClientId, 16, 16, TRUE),
- KWin::icon (mClientId, 32, 32, TRUE));
- mOpacity = readPropertyShort (mClientId, Atoms::netWmWindowOpacity,
- 0xffff);
- }
- else
- {
- mIcons = QIconSet ();
- mName = QString ("");
- }
-
- updateFrame (frame);
-
- mGeometry = QRect (x, y, w, h);
-
- getWindowProtocols ();
- }
- else
- {
- mIcons = QIconSet ();
- mName = QString ("");
- mGeometry = QRect (50, 50, 30, 1);
- }
-
- setGeometry (QRect (mGeometry.x () + ROOT_OFF_X,
- mGeometry.y () + ROOT_OFF_Y,
- mGeometry.width (), mGeometry.height ()));
-
- createDecoration ();
-
- mActiveChild = NULL;
-}
-
-KWD::Window::~Window (void)
-{
- if (mShadow)
- decor_shadow_destroy (qt_xdisplay (), mShadow);
-
- if (mPicture)
- XRenderFreePicture (qt_xdisplay (), mPicture);
-
- if (mPixmap)
- XFreePixmap (qt_xdisplay (), mPixmap);
-
- if (mTexturePicture)
- XRenderFreePicture (qt_xdisplay (), mTexturePicture);
-
- if (mDecorationPicture)
- XRenderFreePicture (qt_xdisplay (), mDecorationPicture);
-
- if (mDecor)
- delete mDecor;
-
- if (mPopup)
- delete mPopup;
-
- if (mProcessKiller)
- delete mProcessKiller;
-}
-
-bool
-KWD::Window::isActive (void) const
-{
- if (mType == DefaultActive)
- return true;
-
- if (mType == Switcher)
- return true;
-
- return Decorator::activeId () == mClientId;
-}
-
-bool
-KWD::Window::isCloseable (void) const
-{
- KWin::WindowInfo wInfo;
-
- if (mType != Normal)
- return false;
-
- wInfo = KWin::windowInfo (mClientId, NET::WMPid, NET::WM2AllowedActions);
- return wInfo.actionSupported (NET::ActionClose);
-}
-
-bool
-KWD::Window::isMaximizable (void) const
-{
- KWin::WindowInfo wInfo;
-
- if (mType != Normal)
- return false;
-
- wInfo = KWin::windowInfo (mClientId, NET::WMPid, NET::WM2AllowedActions);
- return wInfo.actionSupported (NET::ActionMax);
-}
-
-KDecoration::MaximizeMode
-KWD::Window::maximizeMode (void) const
-{
- MaximizeMode mode = MaximizeRestore;
-
- if (mType != Normal)
- return mode;
-
- mode =
- ((mState & NET::MaxVert) ? MaximizeVertical : MaximizeRestore) |
- ((mState & NET::MaxHoriz) ? MaximizeHorizontal : MaximizeRestore);
-
- return mode;
-}
-
-bool
-KWD::Window::isMinimizable (void) const
-{
- KWin::WindowInfo wInfo;
-
- if (mType != Normal)
- return false;
-
- wInfo = KWin::windowInfo (mClientId, NET::WMPid, NET::WM2AllowedActions);
- return wInfo.actionSupported (NET::ActionMinimize);
-}
-
-bool
-KWD::Window::providesContextHelp (void) const
-{
- if (mType != Normal)
- return false;
-
- return mSupportContextHelp;
-}
-
-int
-KWD::Window::desktop (void) const
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMDesktop, 0);
-
- return wInfo.desktop ();
-}
-
-bool
-KWD::Window::isModal (void) const
-{
- return mState & NET::Modal;
-}
-
-bool
-KWD::Window::isShadeable (void) const
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
-
- return wInfo.actionSupported (NET::ActionShade);
-}
-
-bool
-KWD::Window::isShade (void) const
-{
- if (mType != Normal)
- return false;
-
- return (mState & NET::Shaded);
-}
-
-bool
-KWD::Window::isSetShade (void) const
-{
- return isShade ();
-}
-
-bool
-KWD::Window::keepAbove (void) const
-{
- if (mType != Normal)
- return false;
-
- return (mState & NET::KeepAbove);
-}
-
-bool
-KWD::Window::keepBelow (void) const
-{
- if (mType != Normal)
- return false;
-
- return (mState & NET::KeepBelow);
-}
-
-bool
-KWD::Window::isMovable (void) const
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
-
- return wInfo.actionSupported (NET::ActionMove);
-}
-
-NET::WindowType
-KWD::Window::windowType (unsigned long mask) const
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMWindowType, 0);
-
- return wInfo.windowType (mask);
-}
-
-bool
-KWD::Window::isResizable (void) const
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
-
- return wInfo.actionSupported (NET::ActionResize);
-}
-
-QIconSet
-KWD::Window::icon (void) const
-{
- return mIcons;
-}
-
-QString
-KWD::Window::caption (void) const
-{
- return mName;
-}
-
-/* TODO: We should use libtaskmanager, which is part of kdebase to create
- the window menu instead but the headers for that library are currently
- not installed. If kdebase could install those headers, we wouldn't have
- to have our own window menu implementaion here. */
-void
-KWD::Window::showWindowMenu (QPoint pos)
-{
- if (!mPopup)
- {
- mPopup = new QPopupMenu ();
- mPopup->setCheckable (true);
- mPopup->setFont (KGlobalSettings::menuFont ());
-
- mAdvancedMenu = new QPopupMenu (mPopup);
- mAdvancedMenu->setCheckable (true);
- mAdvancedMenu->setFont (KGlobalSettings::menuFont ());
-
- connect (mAdvancedMenu, SIGNAL (activated (int)),
- SLOT (handlePopupActivated (int)));
-
- mAdvancedMenu->insertItem (SmallIconSet ("up"),
- i18n ("Keep &Above Others"),
- Options::KeepAboveOp);
- mAdvancedMenu->insertItem (SmallIconSet ("down"),
- i18n ("Keep &Below Others"),
- Options::KeepBelowOp);
- mAdvancedMenu->insertItem (SmallIconSet ("window_fullscreen"),
- i18n ("&Fullscreen"),
- Options::FullScreenOp);
-
- mPopup->insertItem (i18n ("Ad&vanced"), mAdvancedMenu);
-
- mDesktopMenu = new QPopupMenu (mPopup);
- mDesktopMenu->setCheckable (true);
- mDesktopMenu->setFont (KGlobalSettings::menuFont ());
-
- connect (mDesktopMenu, SIGNAL (activated (int)),
- SLOT (handleDesktopPopupActivated (int)));
-
- mPopup->insertItem (i18n ("To &Desktop"), mDesktopMenu, Options::NoOp);
-
- mPopup->insertItem (SmallIconSet ("move"), i18n ("&Move"),
- Options::MoveOp);
- mPopup->insertItem (i18n ("Re&size"), Options::ResizeOp);
-
- mPopup->insertItem (i18n ("Mi&nimize"), Options::MinimizeOp);
- mPopup->insertItem (i18n ("Ma&ximize"), Options::MaximizeOp);
- mPopup->insertItem (i18n ("Sh&ade"), Options::ShadeOp);
-
- mPopup->insertSeparator ();
-
- mPopup->insertItem (SmallIconSet ("fileclose"), i18n ("&Close"),
- Options::CloseOp);
-
- connect (mPopup, SIGNAL (aboutToShow ()),
- SLOT (handlePopupAboutToShow ()));
- connect (mPopup, SIGNAL (activated (int)),
- SLOT (handlePopupActivated (int)));
- }
-
- mPopup->exec (pos);
-}
-
-void
-KWD::Window::showWindowMenu (const QRect &pos)
-{
- showWindowMenu (pos.bottomLeft ());
-}
-
-void
-KWD::Window::processMousePressEvent (QMouseEvent *qme)
-{
- Options::MouseCommand com = Options::MouseNothing;
- bool active = isActive ();
-
- if (!mSupportTakeFocus)
- active = TRUE;
-
- switch (qme->button ()) {
- case Qt::LeftButton:
- com = active ? Decorator::options ()->commandActiveTitlebar1 () :
- Decorator::options()->commandInactiveTitlebar1 ();
- break;
- case Qt::MidButton:
- com = active ? Decorator::options ()->commandActiveTitlebar2 () :
- Decorator::options()->commandInactiveTitlebar2 ();
- break;
- case Qt::RightButton:
- com = active ? Decorator::options ()->commandActiveTitlebar3 () :
- Decorator::options()->commandInactiveTitlebar3 ();
- default:
- break;
- }
-
- if (qme->button () == Qt::LeftButton)
- {
- // actions where it's not possible to get the matching release event
- if (com != Options::MouseOperationsMenu &&
- com != Options::MouseMinimize)
- {
- moveWindow (qme);
- return;
- }
- }
-
- performMouseCommand (com, qme);
-}
-
-void
-KWD::Window::performWindowOperation (WindowOperation wo)
-{
- switch (wo) {
- case KDecoration::MaximizeOp:
- maximize (maximizeMode () == KDecoration::MaximizeFull ?
- KDecoration::MaximizeRestore : KDecoration::MaximizeFull);
- break;
- case KDecoration::HMaximizeOp:
- maximize (maximizeMode () ^ KDecoration::MaximizeHorizontal);
- break;
- case KDecoration::VMaximizeOp:
- maximize (maximizeMode () ^ KDecoration::MaximizeVertical);
- break;
- case KDecoration::MinimizeOp:
- minimize ();
- break;
- case KDecoration::ShadeOp:
- setShade (!isShade ());
- break;
- case KDecoration::CloseOp:
- closeWindow ();
- break;
- case KDecoration::KeepAboveOp:
- setKeepAbove (!keepAbove ());
- break;
- case KDecoration::KeepBelowOp:
- setKeepBelow (!keepBelow ());
- break;
- case KDecoration::FullScreenOp:
- if (mState & NET::FullScreen)
- KWin::clearState (mClientId, NET::FullScreen);
- else
- KWin::setState (mClientId, NET::FullScreen);
- break;
- case KDecoration::MoveOp:
- Decorator::rootInfo ()->moveResizeRequest (mClientId,
- mGeometry.x () +
- mGeometry.width () / 2,
- mGeometry.y () +
- mGeometry.height () / 2,
- NET::KeyboardMove);
- break;
- case KDecoration::ResizeOp:
- Decorator::rootInfo ()->moveResizeRequest (mClientId,
- mGeometry.x () +
- mGeometry.width () / 2,
- mGeometry.y () +
- mGeometry.height () / 2,
- NET::KeyboardSize);
- default:
- break;
- }
-}
-
-bool
-KWD::Window::isPreview (void) const
-{
- return false;
-}
-
-QRect
-KWD::Window::geometry (void) const
-{
- QRect rect = QWidget::geometry ();
-
- return QRect (rect.x () - ROOT_OFF_X,
- rect.y () - ROOT_OFF_Y,
- rect.width (),
- rect.height ());
-}
-
-QRect
-KWD::Window::iconGeometry (void) const
-{
- return QRect ();
-}
-
-QRect
-KWD::Window::clientGeometry (void)
-{
- QRect frame = geometry ();
-
- return QRect (frame.x () + mBorder.left,
- frame.y () + mBorder.top,
- frame.width () - mBorder.left - mBorder.right,
- frame.height () - mBorder.top - mBorder.bottom);
-}
-
-QRegion
-KWD::Window::unobscuredRegion (const QRegion & r) const
-{
- return r;
-}
-
-QWidget *
-KWD::Window::workspaceWidget (void) const
-{
- return const_cast <Window *> (this);
-}
-
-WId
-KWD::Window::windowId (void) const
-{
- return mClientId;
-}
-
-void
-KWD::Window::closeWindow (void)
-{
- Decorator::rootInfo ()->closeWindowRequest (mClientId);
-}
-
-void
-KWD::Window::maximize (MaximizeMode mode)
-{
- KWin::setState (mClientId,
- ((mode & MaximizeVertical) ? NET::MaxVert : 0) |
- ((mode & MaximizeHorizontal) ? NET::MaxHoriz : 0));
- KWin::clearState (mClientId,
- ((mode & MaximizeVertical) ? 0 : NET::MaxVert) |
- ((mode & MaximizeHorizontal) ? 0 : NET::MaxHoriz));
-}
-
-void
-KWD::Window::minimize (void)
-{
- KWin::iconifyWindow (mClientId, false);
-}
-
-void
-KWD::Window::showContextHelp (void)
-{
- if (mSupportContextHelp)
- KWD::Decorator::sendClientMessage (mClientId, mClientId,
- Atoms::wmProtocols,
- Atoms::netWmContextHelp);
-}
-
-void
-KWD::Window::titlebarDblClickOperation (void)
-{
- WindowOperation op;
-
- op = KWD::Decorator::options ()->operationTitlebarDblClick ();
- performWindowOperation (op);
-}
-
-void
-KWD::Window::setDesktop (int desktop)
-{
- KWin::setOnDesktop (mClientId, desktop);
-}
-
-void
-KWD::Window::setKeepBelow (bool set)
-{
- if (set)
- {
- KWin::clearState (mClientId, NET::KeepAbove);
- KWin::setState (mClientId, NET::KeepBelow);
- }
- else
- {
- KWin::clearState (mClientId, NET::KeepBelow);
- }
-}
-
-void
-KWD::Window::setKeepAbove (bool set)
-{
- if (set)
- {
- KWin::clearState (mClientId, NET::KeepBelow);
- KWin::setState (mClientId, NET::KeepAbove);
- }
- else
- {
- KWin::clearState (mClientId, NET::KeepAbove);
- }
-}
-
-void
-KWD::Window::setShade (bool set)
-{
- if (set)
- KWin::setState (mClientId, NET::Shaded);
- else
- KWin::clearState (mClientId, NET::Shaded);
-
- mDecor->shadeChange ();
-}
-
-void
-KWD::Window::titlebarMouseWheelOperation (int delta)
-{
- Options::MouseCommand com;
-
- com = Decorator::options()->operationTitlebarMouseWheel (delta);
- performMouseCommand (com, 0);
-}
-
-int
-KWD::Window::currentDesktop (void) const
-{
- return KWin::currentDesktop ();
-}
-
-QWidget *
-KWD::Window::initialParentWidget (void) const
-{
- return const_cast <Window *> (this);
-}
-
-Qt::WFlags
-KWD::Window::initialWFlags (void) const
-{
- return 0;
-}
-
-void
-KWD::Window::helperShowHide (bool)
-{
-}
-
-void
-KWD::Window::grabXServer (bool)
-{
-}
-
-void
-KWD::Window::createDecoration (void)
-{
- KDecoration *decor;
-
- if (mDecor)
- return;
-
- decor = Decorator::pluginManager ()->createDecoration (this);
- decor->init ();
-
- mDecor = decor;
-
- if (mType == Normal && mFrame)
- {
- KWD::trapXError ();
- XSelectInput (qt_xdisplay (), mFrame,
- StructureNotifyMask | PropertyChangeMask |
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
- EnterWindowMask | LeaveWindowMask);
- if (KWD::popXError ())
- return;
- }
-
- resizeDecoration (true);
-}
-
-static void
-fillQRegion (Display *xdisplay,
- Picture picture,
- int clipX1,
- int clipY1,
- int clipX2,
- int clipY2,
- int xOff,
- int yOff,
- QRegion *region)
-{
- static XRenderColor white = { 0xffff, 0xffff, 0xffff, 0xffff };
- QMemArray <QRect> rects = region->rects ();
- QMemArray <QRect>::ConstIterator it;
- int x1, y1, x2, y2;
-
- for (it = rects.begin (); it != rects.end (); it++)
- {
- x1 = it->x ();
- y1 = it->y ();
- x2 = x1 + it->width ();
- y2 = y1 + it->height ();
-
- if (x1 < clipX1)
- x1 = clipX1;
- if (y1 < clipY1)
- y1 = clipY1;
- if (x2 > clipX2)
- x2 = clipX2;
- if (y2 > clipY2)
- y2 = clipY2;
-
- if (x1 < x2 && y1 < y2)
- XRenderFillRectangle (xdisplay, PictOpSrc, picture, &white,
- xOff + x1,
- yOff + y1,
- x2 - x1,
- y2 - y1);
- }
-}
-
-static void
-drawBorderShape (Display *xdisplay,
- Pixmap pixmap,
- Picture picture,
- int width,
- int height,
- decor_context_t *c,
- void *closure)
-{
- static XRenderColor clear = { 0x0000, 0x0000, 0x0000, 0x0000 };
- static XRenderColor white = { 0xffff, 0xffff, 0xffff, 0xffff };
- KWD::Window *w = (KWD::Window *) closure;
- QRegion *shape;
- bool uniqueHorzShade;
- bool uniqueVertShade;
- int xOffLeft, yOffTop, xOffRight, yOffBottom;
- QRect rect = w->geometry ();
- int x1, y1, x2, y2;
-
- (void) pixmap;
-
- XRenderFillRectangle (xdisplay, PictOpSrc, picture, &clear,
- 0, 0, width, height);
-
- shape = w->getShape ();
- w->getShapeInfo (&uniqueHorzShade, &uniqueVertShade);
-
- xOffLeft = c->left_space - c->extents.left;
- yOffTop = c->top_space - c->extents.top;
-
- xOffRight = c->left_space - c->extents.left;
- yOffBottom = c->top_space - c->extents.top;
-
- x1 = c->left_space;
- y1 = c->top_space;
- x2 = width - c->right_space;
- y2 = height - c->bottom_space;
-
- if (shape)
- {
- if (uniqueHorzShade && uniqueVertShade)
- {
- fillQRegion (xdisplay, picture,
- 0, 0,
- rect.width (), rect.height (),
- xOffLeft, yOffTop, shape);
- }
- else
- {
- if (!uniqueHorzShade)
- xOffRight = x2 - (rect.width () - c->extents.right);
-
- if (!uniqueVertShade)
- yOffBottom = y2 - (rect.height () - c->extents.bottom);
-
- if (uniqueHorzShade)
- {
- fillQRegion (xdisplay, picture,
- 0, 0,
- rect.width (), c->extents.top,
- xOffLeft, yOffTop, shape);
- fillQRegion (xdisplay, picture,
- 0, rect.height () - c->extents.bottom,
- rect.width (), rect.height (),
- xOffLeft, yOffBottom, shape);
- }
- else
- {
- fillQRegion (xdisplay, picture,
- 0, 0,
- c->extents.left, c->extents.top,
- xOffLeft, yOffTop, shape);
- fillQRegion (xdisplay, picture,
- rect.width () - c->extents.right, 0,
- rect.width (), c->extents.top,
- xOffRight, yOffTop, shape);
- fillQRegion (xdisplay, picture,
- 0, rect.height () - c->extents.bottom,
- c->extents.left, rect.height (),
- xOffLeft, yOffBottom, shape);
- fillQRegion (xdisplay, picture,
- rect.width () - c->extents.right,
- rect.height () - c->extents.bottom,
- rect.width (), rect.height (),
- xOffRight, yOffBottom, shape);
-
- y1 -= c->extents.top;
- y2 += c->extents.bottom;
- }
-
- if (uniqueVertShade)
- {
- fillQRegion (xdisplay, picture,
- 0, c->extents.top,
- c->extents.left,
- rect.height () - c->extents.bottom,
- xOffLeft, yOffTop, shape);
- fillQRegion (xdisplay, picture,
- rect.width () - c->extents.right, c->extents.top,
- rect.width (),
- rect.height () - c->extents.bottom,
- xOffRight, yOffTop, shape);
- }
- else
- {
- x1 -= c->extents.left;
- x2 += c->extents.right;
- }
- }
- }
- else
- {
- x1 -= c->extents.left;
- x2 += c->extents.right;
- y1 -= c->extents.top;
- y2 += c->extents.bottom;
- }
-
- XRenderFillRectangle (xdisplay, PictOpSrc, picture, &white,
- x1,
- y1,
- x2 - x1,
- y2 - y1);
-}
-
-static void
-cornersFromQRegion (QRegion *region,
- int width,
- int height,
- int left,
- int right,
- int top,
- int bottom,
- int *leftCorner,
- int *rightCorner,
- int *topCorner,
- int *bottomCorner)
-{
- QRegion l, r, t, b;
-
- l = QRegion (0, top, left, height - top - bottom) - *region;
- r = QRegion (width - right, top, right, height - top - bottom) - *region;
- t = QRegion (0, 0, width, top) - *region;
- b = QRegion (0, height - bottom, width, bottom) - *region;
-
- if (l.isEmpty ())
- *leftCorner = left;
- else
- *leftCorner = left -
- (l.boundingRect ().x () + l.boundingRect ().width ());
-
- if (r.isEmpty ())
- *rightCorner = right;
- else
- *rightCorner = r.boundingRect ().x () - width + right;
-
- if (t.isEmpty ())
- *topCorner = top;
- else
- *topCorner = top -
- (t.boundingRect ().y () + t.boundingRect ().height ());
-
- if (b.isEmpty ())
- *bottomCorner = bottom;
- else
- *bottomCorner = b.boundingRect ().y () - height + bottom;
-}
-
-void
-KWD::Window::updateShadow (void)
-{
- Display *xdisplay = qt_xdisplay ();
- Screen *xscreen = ScreenOfDisplay (xdisplay, qt_xscreen ());
- XRenderPictFormat *xformat;
- int leftCorner, rightCorner, topCorner, bottomCorner;
-
- if (mShadow)
- {
- decor_shadow_destroy (qt_xdisplay (), mShadow);
- mShadow = NULL;
- }
-
- if (mShapeSet)
- {
- cornersFromQRegion (&mShape,
- mGeometry.width () + mBorder.left + mBorder.right,
- mGeometry.height () + mBorder.top + mBorder.bottom,
- mBorder.left,
- mBorder.right,
- mBorder.top,
- mBorder.bottom,
- &leftCorner,
- &rightCorner,
- &topCorner,
- &bottomCorner);
- }
- else
- {
- leftCorner = mBorder.left;
- rightCorner = mBorder.right;
- topCorner = mBorder.top;
- bottomCorner = mBorder.bottom;
- }
-
- /* use default shadow if such exist */
- if (!mUniqueHorzShape && !mUniqueVertShape)
- {
- mShadow = Decorator::defaultWindowShadow (&mContext, &mBorder);
- if (mShadow)
- decor_shadow_reference (mShadow);
- }
-
- if (!mShadow)
- {
- mShadow = decor_shadow_create (xdisplay,
- xscreen,
- mUniqueHorzShape ?
- mGeometry.width () : 1,
- mUniqueVertShape ?
- mGeometry.height () : 1,
- mBorder.left,
- mBorder.right,
- mBorder.top,
- mBorder.bottom,
- leftCorner,
- rightCorner,
- topCorner,
- bottomCorner,
- KWD::Decorator::shadowOptions (),
- &mContext,
- drawBorderShape,
- (void *) this);
-
- if (mType == Default)
- KWD::Decorator::updateDefaultShadow (this);
- }
-
- /* create new layout */
- if (mType == Normal || mType == Switcher)
- decor_get_best_layout (&mContext,
- mGeometry.width (),
- mGeometry.height (),
- &mLayout);
- else
- decor_get_default_layout (&mContext,
- mGeometry.width (),
- mGeometry.height (),
- &mLayout);
-
- if (mDecorationPicture)
- XRenderFreePicture (qt_xdisplay (), mDecorationPicture);
-
- if (mTexturePicture)
- XRenderFreePicture (qt_xdisplay (), mTexturePicture);
-
- if (!mTexturePixmapBuffer.isNull ())
- mTexturePixmapBuffer.resize (0, 0);
-
- if (!mTexturePixmap.isNull ())
- mTexturePixmap.resize (0, 0);
-
- mTexturePixmap = QPixmap (mLayout.width, mLayout.height, 32);
- mTexturePixmapBuffer = QPixmap (mLayout.width, mLayout.height, 32);
-
- xformat = XRenderFindStandardFormat (qt_xdisplay (),
- PictStandardARGB32);
-
- mDecorationPicture =
- XRenderCreatePicture (qt_xdisplay (),
- mTexturePixmap.handle (),
- xformat, 0, NULL);
- mTexturePicture =
- XRenderCreatePicture (qt_xdisplay (),
- mTexturePixmapBuffer.handle (),
- xformat, 0, NULL);
-
- decor_fill_picture_extents_with_shadow (qt_xdisplay (),
- mShadow,
- &mContext,
- mTexturePicture,
- &mLayout);
-
- if (mPixmap)
- mDecor->widget ()->repaint ();
-
- mUpdateProperty = true;
-}
-
-void
-KWD::Window::setMask (const QRegion &reg, int)
-{
- QRegion top, bottom, left, right;
- bool uniqueHorzShape, uniqueVertShape;
-
- if (mShapeSet && reg == mShape)
- return;
-
- mShape = reg;
- mShapeSet = true;
-
- if (mFrame)
- {
- QRegion r;
-
- r = reg - QRegion (mBorder.left, mBorder.top,
- mGeometry.width (), mGeometry.height ());
-
- KWD::trapXError ();
- XShapeCombineRegion (qt_xdisplay (),
- mFrame,
- ShapeInput,
- 0,
- 0,
- r.handle (),
- ShapeSet);
- KWD::popXError ();
- }
-
- top = QRegion (mBorder.left, 0,
- mGeometry.width (), mBorder.top) - reg;
- bottom = QRegion (mBorder.left, mGeometry.height () + mBorder.top,
- mGeometry.width (), mBorder.bottom) - reg;
- left = QRegion (0, mBorder.top, mBorder.left,
- mGeometry.height ()) - reg;
- right = QRegion (mBorder.left + mGeometry.width (), mBorder.top,
- mBorder.right, mGeometry.height ()) - reg;
-
- uniqueHorzShape = !top.isEmpty () || !bottom.isEmpty ();
- uniqueVertShape = !left.isEmpty () || !right.isEmpty ();
-
- if (uniqueHorzShape || mUniqueHorzShape ||
- uniqueVertShape || mUniqueVertShape)
- {
- mUniqueHorzShape = uniqueHorzShape;
- mUniqueVertShape = uniqueVertShape;
-
- if (mPixmap)
- updateShadow ();
- }
-}
-
-bool
-KWD::Window::resizeDecoration (bool force)
-{
- int w, h;
-
- mDecor->borders (mBorder.left, mBorder.right, mBorder.top, mBorder.bottom);
-
- w = mGeometry.width () + mBorder.left + mBorder.right;
- h = mGeometry.height () + mBorder.top + mBorder.bottom;
-
- if (!force)
- {
- if (w == width () && h == height ())
- return FALSE;
- }
-
- /* reset shape */
- mShapeSet = false;
- mUniqueHorzShape = false;
- mUniqueVertShape = false;
-
- if (mType != Normal && mType != Switcher)
- {
- Display *xdisplay = qt_xdisplay ();
- Screen *xscreen = ScreenOfDisplay (xdisplay, qt_xscreen ());
- decor_shadow_t *tmpShadow;
- decor_context_t c;
-
- /* XXX: we have to create a temporary shadow to get the client
- geometry. libdecoration should be fixed so it's able to just
- fill out a context struct and not necessarily generate a
- shadow for this purpose. */
- tmpShadow = decor_shadow_create (xdisplay,
- xscreen,
- 1, 1,
- mBorder.left,
- mBorder.right,
- mBorder.top,
- mBorder.bottom,
- mBorder.left,
- mBorder.right,
- mBorder.top,
- mBorder.bottom,
- KWD::Decorator::shadowOptions (),
- &c,
- decor_draw_simple,
- (void *) 0);
-
- decor_shadow_destroy (xdisplay, tmpShadow);
-
- w = c.left_corner_space + 1 + c.right_corner_space;
-
- /* most styles render something useful at least 30 px width */
- if (w < 30)
- w = 30;
-
- mGeometry = QRect (50, 50, w,
- c.top_corner_space + 1 + c.bottom_corner_space);
- }
-
- w = mGeometry.width () + mBorder.left + mBorder.right;
- h = mGeometry.height () + mBorder.top + mBorder.bottom;
-
- if (mPixmap)
- {
- XFreePixmap (qt_xdisplay (), mPixmap);
- mPixmap = None;
- }
-
- if (mPicture)
- {
- XRenderFreePicture (qt_xdisplay (), mPicture);
- mPicture = 0;
- }
-
- if (w != width() || h != height())
- {
- mPendingConfigure = 1;
- }
-
- setGeometry (QRect (mGeometry.x () + ROOT_OFF_X - mBorder.left,
- mGeometry.y () + ROOT_OFF_Y - mBorder.top,
- w, h));
-
- mSize = QSize (w, h);
-
- if (!mMapped)
- {
- mPendingMap = 1;
-
- XReparentWindow (qt_xdisplay (), winId (), mParentId, 0, 0);
-
- show ();
-
- mMapped = true;
-
- if (mDamageId != winId ())
- {
- mDamageId = winId ();
- XDamageCreate (qt_xdisplay (), mDamageId,
- XDamageReportRawRectangles);
- }
- }
-
- mDecor->resize (QSize (w, h));
- mDecor->widget ()->show ();
- mDecor->widget ()->repaint ();
-
- return TRUE;
-}
-
-void
-KWD::Window::rebindPixmap (void)
-{
- XRenderPictFormat *xformat;
- QPaintEvent *e;
-
- if (mPicture)
- XRenderFreePicture (qt_xdisplay (), mPicture);
-
- if (mPixmap)
- XFreePixmap (qt_xdisplay (), mPixmap);
-
- mPixmap = XCompositeNameWindowPixmap (qt_xdisplay (), winId ());
-
- xformat = XRenderFindVisualFormat (qt_xdisplay (),
- (Visual *) x11Visual ());
-
- mPicture = XRenderCreatePicture (qt_xdisplay (), mPixmap,
- xformat, 0, NULL);
-
- updateShadow ();
-
- e = new QPaintEvent (mDecor->widget ()->rect (), false);
- QApplication::postEvent (mDecor->widget (), e);
-}
-
-bool
-KWD::Window::handleMap (void)
-{
- if (!mPendingMap)
- return FALSE;
-
- mPendingMap = 0;
- if (mPendingConfigure)
- return FALSE;
-
- rebindPixmap ();
-
- return TRUE;
-}
-
-bool
-KWD::Window::handleConfigure (QSize size)
-{
- if (!mPendingConfigure)
- return FALSE;
-
- if (size != mSize)
- return FALSE;
-
- mPendingConfigure = 0;
- if (mPendingConfigure || mPendingMap)
- return FALSE;
-
- rebindPixmap ();
-
- return TRUE;
-}
-
-void
-KWD::Window::updateBlurProperty (int topOffset,
- int bottomOffset,
- int leftOffset,
- int rightOffset)
-{
- Atom atom = Atoms::compizWindowBlurDecor;
- QRegion topQRegion, bottomQRegion, leftQRegion, rightQRegion;
- Region topRegion = NULL;
- Region bottomRegion = NULL;
- Region leftRegion = NULL;
- Region rightRegion = NULL;
- int size = 0;
- int w, h;
-
- w = mGeometry.width () + mContext.extents.left + mContext.extents.right;
- h = mGeometry.height () + mContext.extents.top + mContext.extents.bottom;
-
- if (blurType != BLUR_TYPE_NONE)
- {
- QRegion r, shape = QRegion (0, 0, w, h);
-
- if (mShapeSet)
- shape = mShape;
-
- r = QRegion (0, 0, w, mContext.extents.top);
- topQRegion = r.intersect (shape);
- if (!topQRegion.isEmpty ())
- {
- topQRegion.translate (-mContext.extents.left,
- -mContext.extents.top);
- topRegion = topQRegion.handle ();
- }
-
- if (blurType == BLUR_TYPE_ALL)
- {
- r = QRegion (0, h - mContext.extents.bottom,
- w, mContext.extents.bottom);
- bottomQRegion = r.intersect (shape);
- if (!bottomQRegion.isEmpty ())
- {
- bottomQRegion.translate (-mContext.extents.left,
- -(h - mContext.extents.bottom));
- bottomRegion = bottomQRegion.handle ();
- }
-
- r = QRegion (0, mContext.extents.top,
- mContext.extents.left, mGeometry.height ());
- leftQRegion = r.intersect (shape);
- if (!leftQRegion.isEmpty ())
- {
- leftQRegion.translate (-mContext.extents.left,
- -mContext.extents.top);
- leftRegion = leftQRegion.handle ();
- }
-
- r = QRegion (w - mContext.extents.right, mContext.extents.top,
- mContext.extents.right, mGeometry.height ());
- rightQRegion = r.intersect (shape);
- if (!rightQRegion.isEmpty ())
- {
- rightQRegion.translate (-(w - mContext.extents.right),
- -mContext.extents.top);
- rightRegion = rightQRegion.handle ();
- }
- }
- }
-
- if (topRegion)
- size += topRegion->numRects;
- if (bottomRegion)
- size += bottomRegion->numRects;
- if (leftRegion)
- size += leftRegion->numRects;
- if (rightRegion)
- size += rightRegion->numRects;
-
- if (size)
- {
- long data[size * 6 + 2];
-
- decor_region_to_blur_property (data, 4, 0,
- mGeometry.width (),
- mGeometry.height (),
- topRegion, topOffset,
- bottomRegion, bottomOffset,
- leftRegion, leftOffset,
- rightRegion, rightOffset);
-
- KWD::trapXError ();
- XChangeProperty (qt_xdisplay (), mClientId, atom,
- XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- 2 + size * 6);
- KWD::popXError ();
- }
- else
- {
- KWD::trapXError ();
- XDeleteProperty (qt_xdisplay (), mClientId, atom);
- KWD::popXError ();
- }
-}
-
-void
-KWD::Window::updateProperty (void)
-{
- Atom atom = Atoms::netWindowDecor;
- decor_extents_t maxExtents;
- long data[256];
- decor_quad_t quads[N_QUADS_MAX];
- int nQuad;
- int lh, rh;
- int w;
- int minWidth;
- unsigned int saveState;
-
- if (mType == Default)
- atom = Atoms::netWindowDecorNormal;
- else if (mType == DefaultActive)
- atom = Atoms::netWindowDecorActive;
-
- saveState = mState;
- mState = NET::MaxVert | NET::MaxHoriz;
- mDecor->borders (maxExtents.left, maxExtents.right,
- maxExtents.top, maxExtents.bottom);
- mState = saveState;
- mDecor->borders (mBorder.left, mBorder.right, mBorder.top, mBorder.bottom);
-
- if (mLayout.rotation)
- lh = mLayout.left.x2 - mLayout.left.x1;
- else
- lh = mLayout.left.y2 - mLayout.left.y1;
-
- if (mLayout.rotation)
- rh = mLayout.right.x2 - mLayout.right.x1;
- else
- rh = mLayout.right.y2 - mLayout.right.y1;
-
- w = mLayout.top.x2 - mLayout.top.x1 - mContext.left_space -
- mContext.right_space;
-
- if (mType == Normal || mType == Switcher)
- {
- int topXOffset = w / 2;
- QWidget *widget = mDecor->widget ();
- int x;
-
- x = w - mContext.left_space - mContext.left_corner_space;
- if (x > topXOffset)
- topXOffset = x;
-
- if (widget)
- {
- const QObjectList *children = widget->children ();
-
- if (children)
- {
- QWidget *child;
-
- for (QObjectListIt it(*children); it.current (); ++it)
- {
- if (!it.current ()->isWidgetType ())
- continue;
-
- child = static_cast <QWidget *> (it.current ());
-
- x = child->x () - mBorder.left - 2;
- if (x > w / 2 && x < topXOffset)
- topXOffset = x;
- }
- }
- }
-
- nQuad = decor_set_lXrXtXbX_window_quads (quads,
- &mContext,
- &mLayout,
- lh / 2,
- rh / 2,
- topXOffset,
- w / 2);
-
- updateBlurProperty (topXOffset, w / 2, lh / 2, rh / 2);
-
- minWidth = mContext.left_corner_space + 1 + mContext.right_corner_space;
- }
- else
- {
- nQuad = decor_set_lSrStSbS_window_quads (quads, &mContext, &mLayout);
-
- minWidth = 1;
- }
-
- decor_quads_to_property (data, mTexturePixmap.handle (),
- &mBorder, &maxExtents,
- minWidth, 0,
- quads, nQuad);
-
- KWD::trapXError ();
- XChangeProperty (qt_xdisplay (), mClientId, atom,
- XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
- KWD::popXError ();
-
- mUpdateProperty = false;
-}
-
-void
-KWD::Window::handleActiveChange (void)
-{
- mDecor->activeChange ();
- resizeDecoration ();
-}
-
-void
-KWD::Window::updateFrame (WId frame)
-{
- mFrame = frame;
-
- KWD::trapXError ();
- XSelectInput (qt_xdisplay (), mFrame,
- StructureNotifyMask | PropertyChangeMask |
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
- EnterWindowMask | LeaveWindowMask);
- KWD::popXError ();
-}
-
-void
-KWD::Window::updateSelected (WId selectedId)
-{
- mSelectedId = selectedId;
-
- updateName ();
-}
-
-void
-KWD::Window::updateWindowGeometry (void)
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMGeometry);
- QRect geometry = wInfo.geometry ();
-
- if (mGeometry.width () != geometry.width () ||
- mGeometry.height () != geometry.height ())
- {
- mGeometry = geometry;
-
- if (resizeDecoration ())
- return;
- }
- else
- {
- mGeometry = geometry;
- }
-
- move (mGeometry.x () + ROOT_OFF_X - mBorder.left,
- mGeometry.y () + ROOT_OFF_Y - mBorder.top);
-}
-
-void
-KWD::Window::reloadDecoration (void)
-{
- delete mDecor;
- mDecor = 0;
-
- mMapped = false;
- mShapeSet = false;
-
- if (mShadow)
- {
- decor_shadow_destroy (qt_xdisplay (), mShadow);
- mShadow = NULL;
- }
-
- createDecoration ();
-}
-
-Cursor
-KWD::Window::positionToCursor (QPoint pos)
-{
- switch (mDecor->mousePosition (pos)) {
- case PositionCenter:
- return cursors[1][1].cursor;
- case PositionLeft:
- return cursors[1][0].cursor;
- case PositionRight:
- return cursors[1][2].cursor;
- case PositionTop:
- return cursors[0][1].cursor;
- case PositionBottom:
- return cursors[2][1].cursor;
- case PositionTopLeft:
- return cursors[0][0].cursor;
- case PositionTopRight:
- return cursors[0][2].cursor;
- case PositionBottomLeft:
- return cursors[2][0].cursor;
- case PositionBottomRight:
- return cursors[2][2].cursor;
- default:
- break;
- }
-
- return cursors[1][1].cursor;
-}
-
-void
-KWD::Window::updateCursor (QPoint pos)
-{
- KWD::trapXError ();
- XDefineCursor (qt_xdisplay (), mFrame, positionToCursor (pos));
- KWD::popXError ();
-}
-
-void
-KWD::Window::getWindowProtocols (void)
-{
- Atom *p;
- int n;
- int status;
-
- mSupportTakeFocus = false;
- mSupportContextHelp = false;
-
- KWD::trapXError ();
- status = XGetWMProtocols (qt_xdisplay (), mClientId, &p, &n);
- if (KWD::popXError ())
- return;
-
- if (status)
- {
- int i;
-
- for (i = 0; i < n; i++)
- {
- if (p[i] == Atoms::wmTakeFocus)
- mSupportTakeFocus = true;
- else if (p[i] == Atoms::netWmContextHelp)
- mSupportContextHelp = true;
- }
-
- if (n > 0)
- XFree (p);
- }
-}
-
-void
-KWD::Window::handlePopupActivated (int id)
-{
- WindowOperation op = static_cast <WindowOperation> (id);
-
- performWindowOperation (op);
-}
-
-void
-KWD::Window::handleDesktopPopupActivated (int id)
-{
- if (id)
- setDesktop (id);
- else
- KWin::setOnAllDesktops (mClientId, true);
-}
-
-void
-KWD::Window::handlePopupAboutToShow (void)
-{
- int numberOfDesktops;
-
- numberOfDesktops = KWin::numberOfDesktops ();
- if (numberOfDesktops > 1)
- {
- NETRootInfo *rootInfo = Decorator::rootInfo ();
- QString name;
- int id, i;
- int winDesktop = desktop ();
-
- mDesktopMenu->clear ();
-
- id = mDesktopMenu->insertItem (i18n ("&All Desktops"), 0);
-
- mDesktopMenu->setItemChecked (id, (winDesktop == NET::OnAllDesktops));
- mDesktopMenu->insertSeparator ();
-
- for (i = 1; i <= numberOfDesktops; i++)
- {
- QString name;
-
- name =
- QString ("&%1 ").arg (i) +
- QString (rootInfo->desktopName (i)).replace ('&', "&&");
-
- id = mDesktopMenu->insertItem (name, i);
- mDesktopMenu->setItemChecked (id, (winDesktop == i));
- }
-
- mPopup->setItemVisible (Options::NoOp, true);
- }
- else
- {
- mPopup->setItemVisible (Options::NoOp, false);
- }
-
- mPopup->setItemEnabled (Options::ResizeOp, isResizable ());
- mPopup->setItemEnabled (Options::MoveOp, isMovable ());
-
- mPopup->setItemEnabled (Options::MaximizeOp, isMaximizable ());
- mPopup->setItemChecked (Options::MaximizeOp,
- maximizeMode () == MaximizeFull);
-
- mPopup->setItemChecked (Options::ShadeOp, isShade ());
- mPopup->setItemEnabled (Options::ShadeOp, isShadeable ());
-
- mAdvancedMenu->setItemChecked (Options::KeepAboveOp, keepAbove ());
- mAdvancedMenu->setItemChecked (Options::KeepBelowOp, keepBelow ());
- mAdvancedMenu->setItemChecked (Options::FullScreenOp,
- mState & NET::FullScreen);
-
- mPopup->setItemEnabled (Options::MinimizeOp, isMinimizable ());
- mPopup->setItemEnabled (Options::CloseOp, isCloseable ());
-}
-
-void
-KWD::Window::updateState (void)
-{
- KWin::WindowInfo wInfo = KWin::windowInfo (mClientId, NET::WMState, 0);
- unsigned long newState = wInfo.state ();
- unsigned long stateChange = mState ^ newState;
-
- mState = newState;
-
- if (stateChange & NET::Max)
- {
- mDecor->maximizeChange ();
- resizeDecoration (false);
- }
-
- if (stateChange & NET::KeepAbove && !(mState & NET::KeepAbove))
- mDecor->emitKeepAboveChanged (mState & NET::KeepAbove);
- if (stateChange & NET::KeepBelow && !(mState & NET::KeepBelow))
- mDecor->emitKeepBelowChanged (mState & NET::KeepBelow);
- if (stateChange & NET::KeepAbove && mState & NET::KeepAbove)
- mDecor->emitKeepAboveChanged (mState & NET::KeepAbove);
- if (stateChange & NET::KeepBelow && mState & NET::KeepBelow)
- mDecor->emitKeepBelowChanged (mState & NET::KeepBelow);
- if (stateChange & NET::Shaded)
- mDecor->shadeChange ();
- if (stateChange & NET::Sticky)
- mDecor->desktopChange ();
-}
-
-void
-KWD::Window::updateName (void)
-{
- KWin::WindowInfo wInfo;
- WId window;
-
- if (mType == Switcher)
- {
- if (!mSelectedId)
- return;
- window = mSelectedId;
- }
- else
- window = mClientId;
-
- wInfo = KWin::windowInfo (window, NET::WMVisibleName, 0);
-
- mName = wInfo.visibleName ();
-
- mDecor->captionChange ();
-}
-
-void
-KWD::Window::updateIcons (void)
-{
- mIcons = QIconSet (KWin::icon (mClientId, 16, 16, TRUE),
- KWin::icon (mClientId, 32, 32, TRUE));
- mDecor->iconChange ();
-}
-
-NET::Direction
-KWD::Window::positionToDirection (int pos)
-{
- switch (pos) {
- case PositionLeft:
- return NET::Left;
- case PositionRight:
- return NET::Right;
- case PositionTop:
- return NET::Top;
- case PositionBottom:
- return NET::Bottom;
- case PositionTopLeft:
- return NET::TopLeft;
- case PositionTopRight:
- return NET::TopRight;
- case PositionBottomLeft:
- return NET::BottomLeft;
- case PositionBottomRight:
- return NET::BottomRight;
- default:
- break;
- }
-
- return NET::Move;
-}
-
-void
-KWD::Window::moveWindow (QMouseEvent *qme)
-{
- NET::Direction direction;
-
- direction = positionToDirection (mDecor->mousePosition (qme->pos ()));
-
- XUngrabPointer (qt_xdisplay (), CurrentTime);
- XUngrabKeyboard (qt_xdisplay (), CurrentTime);
-
- Decorator::rootInfo ()->restackRequest (mClientId, None, Above);
- Decorator::rootInfo ()->moveResizeRequest (mClientId,
- qme->globalX (),
- qme->globalY (),
- direction);
-}
-
-#define OPACITY_STEP (0xffff / 10)
-
-void
-KWD::Window::performMouseCommand (Options::MouseCommand command,
- QMouseEvent *qme)
-{
- switch (command) {
- case Options::MouseRaise:
- KWin::raiseWindow (mClientId);
- break;
- case Options::MouseLower:
- KWin::lowerWindow (mClientId);
- break;
- case Options::MouseShade :
- setShade (!isShade ());
- break;
- case Options::MouseSetShade:
- setShade (true);
- break;
- case Options::MouseUnsetShade:
- setShade (false);
- break;
- case Options::MouseOperationsMenu:
- {
- QPoint mp (0, 0);
-
- if (qme)
- mp = QPoint (qme->globalX (), qme->globalY ());
-
- showWindowMenu (mp);
- } break;
- case Options::MouseMaximize:
- maximize (KDecoration::MaximizeFull);
- break;
- case Options::MouseRestore:
- maximize (KDecoration::MaximizeRestore);
- break;
- case Options::MouseMinimize:
- minimize ();
- break;
- case Options::MouseAbove:
- if (keepBelow ())
- setKeepBelow (false);
- else
- setKeepAbove (true);
- break;
- case Options::MouseBelow:
- if (keepAbove ())
- setKeepAbove (false);
- else
- setKeepBelow (true);
- break;
- case Options::MousePreviousDesktop:
- break;
- case Options::MouseNextDesktop:
- break;
- case Options::MouseOpacityMore:
- {
- int opacity = mOpacity;
-
- if (opacity < 0xffff)
- {
- opacity += OPACITY_STEP;
- if (opacity > 0xffff)
- opacity = 0xffff;
-
- Decorator::sendClientMessage (qt_xrootwin (),
- mClientId,
- Atoms::netWmWindowOpacity,
- (opacity << 16) | opacity);
- }
- } break;
- case Options::MouseOpacityLess:
- {
- int opacity = mOpacity;
-
- if (opacity > OPACITY_STEP)
- {
- opacity -= OPACITY_STEP;
- if (opacity < OPACITY_STEP)
- opacity = OPACITY_STEP;
-
- Decorator::sendClientMessage (qt_xrootwin (),
- mClientId,
- Atoms::netWmWindowOpacity,
- (opacity << 16) | opacity);
- }
- } break;
- case Options::MouseActivateRaiseAndMove:
- case Options::MouseActivateRaiseAndUnrestrictedMove:
- case Options::MouseMove:
- case Options::MouseUnrestrictedMove:
- case Options::MouseResize:
- case Options::MouseUnrestrictedResize:
- if (qme)
- moveWindow (qme);
- case Options::MouseNothing:
- default:
- break;
- }
-}
-
-void
-KWD::Window::processDamage (void)
-{
- QRegion r1, r2;
- int xOff, yOff, w;
- double alpha;
- int shade_alpha;
-
- if (isActive ())
- {
- alpha = activeDecorationOpacity;
- shade_alpha = activeDecorationOpacityShade;
- }
- else
- {
- alpha = decorationOpacity;
- shade_alpha = decorationOpacityShade;
- }
-
- if (!mPixmap)
- return;
-
- if (mDamage.isEmpty ())
- return;
-
- if (mShapeSet)
- mDamage = mShape.intersect (mDamage);
-
- w = mGeometry.width () + mContext.extents.left + mContext.extents.right;
-
- if (mType == Switcher)
- shade_alpha = 0;
-
- xOff = 0;
- yOff = 0;
-
- r1 = QRegion (xOff, yOff, w, mContext.extents.top);
- r2 = r1.intersect (mDamage);
-
- if (!r2.isEmpty ())
- {
- r2.translate (-xOff, -yOff);
-
- decor_blend_border_picture (qt_xdisplay (),
- &mContext,
- mPicture,
- xOff, xOff,
- mTexturePicture,
- &mLayout,
- BORDER_TOP,
- r2.handle (),
- (unsigned short) (alpha * 0xffff),
- shade_alpha,
- TRUE);
- }
-
- xOff = 0;
- yOff = mContext.extents.top + mGeometry.height ();
-
- r1 = QRegion (xOff, yOff, w, mContext.extents.bottom);
- r2 = r1.intersect (mDamage);
-
- if (!r2.isEmpty ())
- {
- r2.translate (-xOff, -yOff);
-
- decor_blend_border_picture (qt_xdisplay (),
- &mContext,
- mPicture,
- xOff, yOff,
- mTexturePicture,
- &mLayout,
- BORDER_BOTTOM,
- r2.handle (),
- (unsigned short) (alpha * 0xffff),
- shade_alpha,
- TRUE);
- }
-
- xOff = 0;
- yOff = mContext.extents.top;
-
- r1 = QRegion (xOff, yOff, mContext.extents.left, mGeometry.height ());
- r2 = r1.intersect (mDamage);
-
- if (!r2.isEmpty ())
- {
- r2.translate (-xOff, -yOff);
-
- decor_blend_border_picture (qt_xdisplay (),
- &mContext,
- mPicture,
- xOff, yOff,
- mTexturePicture,
- &mLayout,
- BORDER_LEFT,
- r2.handle (),
- (unsigned short) (alpha * 0xffff),
- shade_alpha,
- TRUE);
- }
-
- xOff = mContext.extents.left + mGeometry.width ();
- yOff = mContext.extents.top;
-
- r1 = QRegion (xOff, yOff, mContext.extents.right, mGeometry.height ());
- r2 = r1.intersect (mDamage);
-
- if (!r2.isEmpty ())
- {
- r2.translate (-xOff, -yOff);
-
- decor_blend_border_picture (qt_xdisplay (),
- &mContext,
- mPicture,
- xOff, yOff,
- mTexturePicture,
- &mLayout,
- BORDER_RIGHT,
- r2.handle (),
- (unsigned short) (alpha * 0xffff),
- shade_alpha,
- TRUE);
- }
-
- mDamage = QRegion ();
-
- XRenderComposite (qt_xdisplay (),
- PictOpSrc,
- mTexturePicture,
- None,
- mDecorationPicture,
- 0, 0,
- 0, 0,
- 0, 0,
- mTexturePixmap.width (),
- mTexturePixmap.height ());
-
- if (mUpdateProperty)
- {
- if (mType == Switcher)
- {
- QPainter p (this);
- unsigned long pixel;
- QColor bg = p.backgroundColor ();
-
- pixel = (((int) (alpha * 0xff) << 24) |
- ((int) (alpha * bg.red ()) << 16) |
- ((int) (alpha * bg.green ()) << 8) |
- ((int) (alpha * bg.blue ()) << 0));
-
- KWD::trapXError ();
- XSetWindowBackground (qt_xdisplay (), mClientId, pixel);
- XClearWindow (qt_xdisplay (), mClientId);
- KWD::popXError ();
- }
-
- updateProperty ();
- }
-}
-
-void
-KWD::Window::handleProcessKillerExited (void)
-{
- if (mProcessKiller)
- {
- delete mProcessKiller;
- mProcessKiller = NULL;
- }
-}
-
-void
-KWD::Window::showKillProcessDialog (Time timestamp)
-{
- KWin::WindowInfo kWinInfo =
- KWin::windowInfo (mClientId, 0,
- NET::WM2WindowClass | NET::WM2ClientMachine);
- NETWinInfo wInfo = NETWinInfo (qt_xdisplay(), mClientId,
- qt_xrootwin (), NET::WMPid);
- QCString clientMachine, resourceClass;
- pid_t pid;
- char buf[257];
-
- if (mProcessKiller)
- return;
-
- clientMachine = kWinInfo.clientMachine ();
- resourceClass = kWinInfo.windowClassClass ();
- pid = wInfo.pid ();
-
- if (gethostname (buf, sizeof (buf) - 1) == 0)
- {
- if (strcmp (buf, clientMachine) == 0)
- clientMachine = "localhost";
- }
-
- mProcessKiller = new KProcess (this);
-
- *mProcessKiller << KStandardDirs::findExe ("kwin_killer_helper") <<
- "--pid" << QCString ().setNum (pid) <<
- "--hostname" << clientMachine <<
- "--windowname" << mName.utf8 () <<
- "--applicationname" << resourceClass <<
- "--wid" << QCString ().setNum (mClientId) <<
- "--timestamp" << QCString ().setNum (timestamp);
-
- connect (mProcessKiller, SIGNAL (processExited (KProcess *)),
- SLOT (handleProcessKillerExited ()));
-
- if (!mProcessKiller->start (KProcess::NotifyOnExit))
- {
- delete mProcessKiller;
- mProcessKiller = NULL;
- }
-}
-
-void
-KWD::Window::hideKillProcessDialog (void)
-{
- handleProcessKillerExited ();
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator/window.h compiz-0.8.8/kde/window-decorator/window.h
--- compiz-0.8.8-orig/kde/window-decorator/window.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator/window.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,243 +0,0 @@
-/*
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Dennis Kasprzyk <onestone@beryl-project.org>
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _WINDOW_H
-#define _WINDOW_H
-
-#include <kdecoration_p.h>
-
-#include <qpixmap.h>
-#include <qwidget.h>
-
-#include <decoration.h>
-
-#include <X11/extensions/Xdamage.h>
-
-#include "utils.h"
-#include "options.h"
-
-class KProcess;
-class KDecoration;
-class QPopupMenu;
-
-namespace KWD
-{
-class Window:public QWidget, public KDecorationBridge {
- Q_OBJECT public:
-
- enum Type
- {
- Normal,
- Switcher,
- Default,
- DefaultActive
- };
-
- public:
- Window (WId parentId, WId clientId, WId frame, Type type,
- int x = 0, int y = 0, int w = 1, int h = 1);
- ~Window (void);
-
- virtual bool isActive (void) const;
- virtual bool isCloseable (void) const;
- virtual bool isMaximizable (void) const;
- virtual MaximizeMode maximizeMode (void) const;
- virtual bool isMinimizable (void) const;
- virtual bool providesContextHelp (void) const;
- virtual int desktop (void) const;
- virtual bool isModal (void) const;
- virtual bool isShadeable (void) const;
- virtual bool isShade (void) const;
- virtual bool isSetShade (void) const;
- virtual bool keepAbove (void) const;
- virtual bool keepBelow (void) const;
- virtual bool isMovable (void) const;
- virtual bool isResizable (void) const;
- virtual NET::WindowType
- windowType (unsigned long supported_types) const;
- virtual QIconSet icon (void) const;
- virtual QString caption (void) const;
- virtual void processMousePressEvent (QMouseEvent *);
- virtual void showWindowMenu (const QRect &);
- virtual void showWindowMenu (QPoint);
- virtual void performWindowOperation (WindowOperation);
- virtual void setMask (const QRegion &, int);
- virtual bool isPreview (void) const;
- virtual QRect geometry (void) const;
- virtual QRect iconGeometry (void) const;
- virtual QRegion unobscuredRegion (const QRegion & r) const;
- virtual QWidget *workspaceWidget (void) const;
- virtual WId windowId (void) const;
- virtual void closeWindow (void);
- virtual void maximize (MaximizeMode mode);
- virtual void minimize (void);
- virtual void showContextHelp (void);
- virtual void setDesktop (int desktop);
- virtual void titlebarDblClickOperation (void);
- virtual void titlebarMouseWheelOperation (int delta);
- virtual void setShade (bool set);
- virtual void setKeepAbove (bool);
- virtual void setKeepBelow (bool);
- virtual int currentDesktop (void) const;
- virtual QWidget *initialParentWidget (void) const;
- virtual Qt::WFlags initialWFlags (void) const;
- virtual void helperShowHide (bool);
- virtual void grabXServer (bool grab);
-
- void handleActiveChange (void);
- void updateFrame (WId frame);
- void updateWindowGeometry (void);
- void updateCursor (QPoint pos);
- void updateSelected (WId selected);
- WId frameId (void) const
- {
- return mFrame;
- }
- KDecoration *decoration (void) const
- {
- return mDecor;
- }
- QWidget *activeChild (void) const
- {
- return mActiveChild;
- }
- void setActiveChild (QWidget * child)
- {
- mActiveChild = child;
- }
- QRegion *getShape (void)
- {
- if (mShapeSet)
- return &mShape;
-
- return NULL;
- }
- void getShapeInfo (bool *horz, bool *vert)
- {
- *horz = mUniqueHorzShape;
- *vert = mUniqueVertShape;
- }
- void moveWindow (QMouseEvent *qme);
- void reloadDecoration (void);
- void updateState (void);
- void updateName (void);
- void updateIcons (void);
- void updateOpacity (void)
- {
- mOpacity = readPropertyShort (mClientId, Atoms::netWmWindowOpacity,
- 0xffff);
- }
- Drawable pixmapId (void) const
- {
- return mPixmap;
- }
- void addDamageRect (int x, int y, int w, int h)
- {
- mDamage += QRegion (x, y, w, h);
- }
- bool handleMap (void);
- bool handleConfigure (QSize size);
- void processDamage (void);
- decor_context_t *context (void)
- {
- return &mContext;
- }
- decor_shadow_t *shadow (void)
- {
- return mShadow;
- }
- decor_extents_t *border (void)
- {
- return &mBorder;
- }
- QRect clientGeometry (void);
- void showKillProcessDialog (Time timestamp);
- void hideKillProcessDialog (void);
-
- private:
- void createDecoration (void);
- void updateShadow (void);
- bool resizeDecoration (bool force = false);
- void updateBlurProperty (int topOffset,
- int bottomOffset,
- int leftOffset,
- int rightOffset);
- void updateProperty (void);
- void getWindowProtocols (void);
- void performMouseCommand (KWD::Options::MouseCommand command,
- QMouseEvent *qme);
- NET::Direction positionToDirection (int pos);
- Cursor positionToCursor (QPoint pos);
- void rebindPixmap (void);
-
-
- private slots:
- void handlePopupActivated (int id);
- void handleDesktopPopupActivated (int id);
- void handlePopupAboutToShow (void);
- void handleProcessKillerExited (void);
-
- private:
- Type mType;
- WId mParentId;
- WId mFrame;
- WId mClientId;
- WId mSelectedId;
- QRect mGeometry;
- QString mName;
- QIconSet mIcons;
- decor_extents_t mBorder;
- unsigned short mOpacity;
- KDecoration *mDecor;
- QPixmap mTexturePixmap;
- QPixmap mTexturePixmapBuffer;
- Pixmap mPixmap;
- QRegion mDamage;
- WId mDamageId;
- decor_layout_t mLayout;
- decor_context_t mContext;
- decor_shadow_t *mShadow;
- Picture mPicture;
- Picture mTexturePicture;
- Picture mDecorationPicture;
- bool mUpdateProperty;
- bool mShapeSet;
- bool mUniqueHorzShape;
- bool mUniqueVertShape;
- QRegion mShape;
- QWidget *mActiveChild;
- bool mSupportTakeFocus;
- bool mSupportContextHelp;
- QPopupMenu *mPopup;
- QPopupMenu *mAdvancedMenu;
- QPopupMenu *mDesktopMenu;
- unsigned long mState;
- bool mMapped;
- int mPendingMap;
- int mPendingConfigure;
- QSize mSize;
- KProcess *mProcessKiller;
- };
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/decorator.cpp compiz-0.8.8/kde/window-decorator-kde4/decorator.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/decorator.cpp 2010-12-14 14:56:09.000000000 +0100
+++ compiz-0.8.8/kde/window-decorator-kde4/decorator.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,890 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include <KDE/KCmdLineArgs>
-#include <KDE/KConfig>
-#include <KDE/KConfigGroup>
-#include <KDE/KGlobal>
-#include <kwindowsystem.h>
-#include <KDE/KLocale>
-#include <KDE/Plasma/Theme>
-#include <kcommondecoration.h>
-#include <kwindowsystem.h>
-
-#include <QPoint>
-#include <QList>
-#include <QX11Info>
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xcomposite.h>
-
-#include "decorator.h"
-#include "options.h"
-#include "utils.h"
-
-#include "kwinadaptor.h"
-
-#include <stdio.h>
-
-#define SHADOW_RADIUS 8.0
-#define SHADOW_OPACITY 0.5
-#define SHADOW_OFFSET_X 1
-#define SHADOW_OFFSET_Y 1
-#define SHADOW_COLOR_RED 0x0000
-#define SHADOW_COLOR_GREEN 0x0000
-#define SHADOW_COLOR_BLUE 0x0000
-
-#define DBUS_DEST "org.freedesktop.compiz"
-#define DBUS_SIGNAL_PATH "/org/freedesktop/compiz/decoration/display"
-#define DBUS_QUERY_PATH "/org/freedesktop/compiz/decoration/allscreens"
-#define DBUS_INTERFACE "org.freedesktop.compiz"
-#define DBUS_METHOD_GET "get"
-#define DBUS_SIGNAL_CHANGED "changed"
-
-int blurType = BLUR_TYPE_NONE;
-
-decor_shadow_t *KWD::Decorator::mNoBorderShadow = 0;
-KWD::PluginManager *KWD::Decorator::mPlugins = 0;
-KWD::Options *KWD::Decorator::mOptions = 0;
-NETRootInfo *KWD::Decorator::mRootInfo;
-WId KWD::Decorator::mActiveId;
-decor_shadow_options_t KWD::Decorator::mShadowOptions;
-
-struct _cursor cursors[3][3] = {
- { C (top_left_corner), C (top_side), C (top_right_corner) },
- { C (left_side), C (left_ptr), C (right_side) },
- { C (bottom_left_corner), C (bottom_side), C (bottom_right_corner) }
-};
-
-KWD::PluginManager::PluginManager (KSharedConfigPtr config):
- KWD::KDecorationPlugins (config)
-{
- defaultPlugin = (QPixmap::defaultDepth() > 8) ?
- "kwin3_oxygen" : "kwin3_plastik";
-}
-
-
-KWD::Decorator::Decorator () :
- KApplication (),
- mConfig (0),
- mCompositeWindow (0),
- mSwitcher (0)
-{
- XSetWindowAttributes attr;
- int i, j;
- QDBusConnection dbus = QDBusConnection::sessionBus();
-
- mRootInfo = new NETRootInfo (QX11Info::display(), 0);
-
- mActiveId = 0;
-
- KConfigGroup cfg (KSharedConfig::openConfig("plasmarc"), QString("Theme"));
- Plasma::Theme::defaultTheme ()->setThemeName (cfg.readEntry ("name"));
-
- Atoms::init ();
-
- (void *) new KWinAdaptor (this);
- dbus.registerObject ("/KWin", this);
- dbus.connect (QString (), "/KWin", "org.kde.KWin", "reloadConfig", this,
- SLOT (reconfigure ()));
-
- dbus.connect (QString (), DBUS_SIGNAL_PATH "/shadow_radius",
- DBUS_INTERFACE, DBUS_SIGNAL_CHANGED, this,
- SLOT (shadowRadiusChanged (double)));
-
- dbus.connect (QString (), DBUS_SIGNAL_PATH "/shadow_opacity",
- DBUS_INTERFACE, DBUS_SIGNAL_CHANGED, this,
- SLOT (shadowOpacityChanged (double)));
-
- dbus.connect (QString (), DBUS_SIGNAL_PATH "/shadow_x_offset",
- DBUS_INTERFACE, DBUS_SIGNAL_CHANGED, this,
- SLOT (shadowXOffsetChanged (int)));
-
- dbus.connect (QString (), DBUS_SIGNAL_PATH "/shadow_y_offset",
- DBUS_INTERFACE, DBUS_SIGNAL_CHANGED, this,
- SLOT (shadowYOffsetChanged (int)));
-
- dbus.connect (QString (), DBUS_SIGNAL_PATH "/shadow_color",
- DBUS_INTERFACE, DBUS_SIGNAL_CHANGED, this,
- SLOT (shadowColorChanged (QString)));
-
- mConfig = new KConfig ("kwinrc");
-
- mOptions = new KWD::Options (mConfig);
- mPlugins = new PluginManager (KSharedConfig::openConfig("kwinrc"));
-
- mShadowOptions.shadow_radius = SHADOW_RADIUS;
- mShadowOptions.shadow_opacity = SHADOW_OPACITY;
- mShadowOptions.shadow_offset_x = SHADOW_OFFSET_X;
- mShadowOptions.shadow_offset_y = SHADOW_OFFSET_Y;
- mShadowOptions.shadow_color[0] = SHADOW_COLOR_RED;
- mShadowOptions.shadow_color[1] = SHADOW_COLOR_GREEN;
- mShadowOptions.shadow_color[2] = SHADOW_COLOR_BLUE;
-
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 3; j++)
- {
- if (cursors[i][j].shape != XC_left_ptr)
- cursors[i][j].cursor =
- XCreateFontCursor (QX11Info::display(), cursors[i][j].shape);
- }
- }
-
- attr.override_redirect = True;
-
- mCompositeWindow = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(),
- -ROOT_OFF_X, -ROOT_OFF_Y, 1, 1, 0,
- CopyFromParent,
- CopyFromParent,
- CopyFromParent,
- CWOverrideRedirect, &attr);
-
- long data = 1;
- XChangeProperty (QX11Info::display(), mCompositeWindow, Atoms::enlightmentDesktop,
- XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1);
-
- XCompositeRedirectSubwindows (QX11Info::display(), mCompositeWindow,
- CompositeRedirectManual);
-
- XMapWindow (QX11Info::display(), mCompositeWindow);
-}
-
-KWD::Decorator::~Decorator (void)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
-
- for (it = mClients.begin (); it != mClients.end (); it++)
- delete (*it);
-
- if (mDecorNormal)
- delete mDecorNormal;
-
- if (mDecorActive)
- delete mDecorActive;
-
- if (mSwitcher)
- delete mSwitcher;
-
- XDestroyWindow (QX11Info::display(), mCompositeWindow);
-
- delete mOptions;
- delete mPlugins;
- delete mConfig;
- delete mRootInfo;
-}
-
-bool
-KWD::Decorator::enableDecorations (Time timestamp)
-{
- QList <WId>::ConstIterator it;
-
- mDmSnTimestamp = timestamp;
-
- if (!pluginManager ()->loadPlugin (""))
- return false;
-
- updateAllShadowOptions ();
-
- KWD::trapXError ();
- (void) QApplication::desktop (); // trigger creation of desktop widget
- KWD::popXError ();
-
- updateShadow ();
-
- mDecorNormal = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow(),
- 0, Window::Default);
- mDecorActive = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow(),
- 0, Window::DefaultActive);
-
- mActiveId = KWindowSystem::activeWindow ();
-
- connect (KWindowSystem::self (), SIGNAL (windowAdded (WId)),
- SLOT (handleWindowAdded (WId)));
- connect (KWindowSystem::self (), SIGNAL (windowRemoved (WId)),
- SLOT (handleWindowRemoved (WId)));
- connect (KWindowSystem::self (), SIGNAL (activeWindowChanged (WId)),
- SLOT (handleActiveWindowChanged (WId)));
- connect (KWindowSystem::self (),
- SIGNAL (windowChanged (WId, const unsigned long *)),
- SLOT (handleWindowChanged (WId, const unsigned long *)));
-
- foreach (WId id, KWindowSystem::windows ())
- handleWindowAdded (id);
-
- connect (Plasma::Theme::defaultTheme (), SIGNAL (themeChanged ()),
- SLOT (plasmaThemeChanged ()));
-
- // select for client messages
- XSelectInput (QX11Info::display(), QX11Info::appRootWindow(),
- StructureNotifyMask | PropertyChangeMask);
-
- return true;
-}
-
-void
-KWD::Decorator::updateAllShadowOptions (void)
-{
- QDBusInterface *compiz;
- QDBusReply<QString> stringReply;
- QDBusReply<double> doubleReply;
- QDBusReply<int> intReply;
- int c[4];
-
- compiz = new QDBusInterface (DBUS_DEST, DBUS_QUERY_PATH "/shadow_radius",
- DBUS_INTERFACE);
- doubleReply = compiz->call (DBUS_METHOD_GET);
- delete compiz;
-
- if (doubleReply.isValid ())
- mShadowOptions.shadow_radius = doubleReply.value ();
-
- compiz = new QDBusInterface (DBUS_DEST, DBUS_QUERY_PATH "/shadow_opacity",
- DBUS_INTERFACE);
- doubleReply = compiz->call (DBUS_METHOD_GET);
- delete compiz;
-
- if (doubleReply.isValid ())
- mShadowOptions.shadow_opacity = doubleReply.value ();
-
- compiz = new QDBusInterface (DBUS_DEST, DBUS_QUERY_PATH "/shadow_x_offset",
- DBUS_INTERFACE);
- intReply = compiz->call (DBUS_METHOD_GET);
- delete compiz;
-
- if (intReply.isValid ())
- mShadowOptions.shadow_offset_x = intReply.value ();
-
- compiz = new QDBusInterface (DBUS_DEST, DBUS_QUERY_PATH "/shadow_y_offset",
- DBUS_INTERFACE);
- intReply = compiz->call (DBUS_METHOD_GET);
- delete compiz;
-
- if (intReply.isValid ())
- mShadowOptions.shadow_offset_y = intReply.value ();
- else
- mShadowOptions.shadow_offset_y = SHADOW_OFFSET_Y;
-
- compiz = new QDBusInterface (DBUS_DEST, DBUS_QUERY_PATH "/shadow_color",
- DBUS_INTERFACE);
- stringReply = compiz->call (DBUS_METHOD_GET);
- delete compiz;
-
- if (stringReply.isValid () &&
- sscanf (stringReply.value ().toAscii ().data (), "#%2x%2x%2x%2x",
- &c[0], &c[1], &c[2], &c[3]) == 4)
- {
- mShadowOptions.shadow_color[0] = c[0] << 8 | c[0];
- mShadowOptions.shadow_color[1] = c[1] << 8 | c[1];
- mShadowOptions.shadow_color[2] = c[2] << 8 | c[2];
- }
-}
-
-void
-KWD::Decorator::changeShadowOptions (decor_shadow_options_t *opt)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
-
- if (!memcmp (opt, &mShadowOptions, sizeof (decor_shadow_options_t)))
- return;
-
- mShadowOptions = *opt;
-
- updateShadow ();
-}
-
-void
-KWD::Decorator::updateShadow (void)
-{
- Display *xdisplay = QX11Info::display();
- Screen *xscreen;
- decor_context_t context;
-
- xscreen = ScreenOfDisplay (xdisplay, QX11Info::appScreen ());
-
- if (mNoBorderShadow)
- decor_shadow_destroy (xdisplay, mNoBorderShadow);
-
- mNoBorderShadow = decor_shadow_create (xdisplay,
- xscreen,
- 1, 1,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- &mShadowOptions,
- &context,
- decor_draw_simple,
- 0);
-
- if (mNoBorderShadow)
- {
- decor_extents_t extents = { 0, 0, 0, 0 };
- long data[256];
- decor_quad_t quads[N_QUADS_MAX];
- int nQuad;
- decor_layout_t layout;
-
- decor_get_default_layout (&context, 1, 1, &layout);
-
- nQuad = decor_set_lSrStSbS_window_quads (quads, &context, &layout);
-
- decor_quads_to_property (data, mNoBorderShadow->pixmap,
- &extents, &extents,
- 0, 0, quads, nQuad);
-
- KWD::trapXError ();
- XChangeProperty (QX11Info::display(), QX11Info::appRootWindow(),
- Atoms::netWindowDecorBare,
- XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
- KWD::popXError ();
- }
-}
-
-bool
-KWD::Decorator::x11EventFilter (XEvent *xevent)
-{
- KWD::Window *client;
- int status;
-
- switch (xevent->type) {
- case ConfigureNotify: {
- XConfigureEvent *xce = reinterpret_cast <XConfigureEvent *> (xevent);
-
- if (mFrames.contains (xce->window))
- mFrames[xce->window]->updateFrame (xce->window);
-
- } break;
- case SelectionRequest:
- decor_handle_selection_request (QX11Info::display(), xevent, mDmSnTimestamp);
- break;
- case SelectionClear:
- status = decor_handle_selection_clear (QX11Info::display(),
- xevent, 0);
- if (status == DECOR_SELECTION_GIVE_UP)
- KApplication::exit (0);
-
- break;
- case PropertyNotify:
- if (xevent->xproperty.atom == Atoms::netFrameWindow)
- {
- handleWindowAdded (xevent->xproperty.window);
- }
- else if (xevent->xproperty.atom == Atoms::switchSelectWindow)
- {
- WId id = xevent->xproperty.window;
-
- if (!mSwitcher || mSwitcher->xid () != id)
- handleWindowAdded (id);
- mSwitcher->update ();
- }
- else if (xevent->xproperty.atom == Atoms::netWmWindowOpacity)
- {
- if (mClients.contains (xevent->xproperty.window))
- mClients[xevent->xproperty.window]->updateOpacity ();
- }
- break;
- case EnterNotify:
- {
- XCrossingEvent *xce = reinterpret_cast <XCrossingEvent *> (xevent);
- QWidget *child;
-
- if (!mFrames.contains (xce->window))
- break;
-
- client = mFrames[xce->window];
-
- if (!client->decorWidget ())
- break;
-
- child = client->childAt (xce->x, xce->y);
- if (child)
- {
- QEvent qe (QEvent::Enter);
-
- QApplication::sendEvent (child, &qe);
-
- client->setActiveChild (child);
- client->updateCursor (QPoint (xce->x, xce->y));
- }
- } break;
- case LeaveNotify:
- {
- XCrossingEvent *xce = reinterpret_cast <XCrossingEvent *> (xevent);
-
- if (mFrames.contains (xce->window))
- {
- QEvent qe (QEvent::Leave);
-
- client = mFrames[xce->window];
-
- if (client->activeChild ())
- QApplication::sendEvent (client->activeChild (), &qe);
-
- XUndefineCursor (QX11Info::display(), client->frameId ());
- }
- } break;
- case MotionNotify:
- {
- XMotionEvent *xme = reinterpret_cast < XMotionEvent * >(xevent);
- QWidget *child;
-
- if (!mFrames.contains (xme->window))
- break;
-
- client = mFrames[xme->window];
-
- if (!client->decorWidget ())
- break;
-
- child = client->childAt (xme->x, xme->y);
-
- if (child)
- {
- QPoint qp (xme->x, xme->y);
-
- if (child != client->activeChild ())
- {
- QEvent qee (QEvent::Enter);
- QEvent qle (QEvent::Leave);
-
- if (client->activeChild ())
- QApplication::sendEvent (client->activeChild (), &qle);
-
- QApplication::sendEvent (child, &qee);
-
- client->setActiveChild (child);
- }
-
- if (client->decorWidget () != child)
- qp = child->mapFrom (client->decorWidget (), qp);
-
- QMouseEvent qme (QEvent::MouseMove, qp, Qt::NoButton,
- Qt::NoButton, Qt::NoModifier);
-
- QApplication::sendEvent (child, &qme);
-
- client->updateCursor (QPoint (xme->x, xme->y));
- }
- } break;
- case ButtonPress:
- case ButtonRelease:
- {
- XButtonEvent *xbe = reinterpret_cast <XButtonEvent *>(xevent);
- QWidget *child;
-
- if (!mFrames.contains (xbe->window))
- break;
-
- client = mFrames[xbe->window];
-
- if (!client->decorWidget ())
- break;
-
- child = client->childAt (xbe->x, xbe->y);
-
- if (child)
- {
- XButtonEvent xbe2 = *xbe;
- xbe2.window = child->winId ();
-
- QPoint p;
-
- p = client->mapToChildAt (QPoint (xbe->x, xbe->y));
- xbe2.x = p.x ();
- xbe2.y = p.y ();
-
- p = child->mapToGlobal(p);
- xbe2.x_root = p.x ();
- xbe2.y_root = p.y ();
-
- client->setFakeRelease (false);
- QApplication::x11ProcessEvent ((XEvent *) &xbe2);
-
- /* We won't get a button release event, because of the screengrabs
- in compiz */
- if (client->getFakeRelease () && xevent->type == ButtonPress)
- {
- xbe2.type = ButtonRelease;
- QApplication::x11ProcessEvent ((XEvent *) &xbe2);
- }
-
- return true;
- }
- } break;
- case ClientMessage:
- if (xevent->xclient.message_type == Atoms::toolkitActionAtom)
- {
- unsigned long action;
-
- action = xevent->xclient.data.l[0];
- if (action == Atoms::toolkitActionWindowMenuAtom)
- {
- if (mClients.contains (xevent->xclient.window))
- {
- QPoint pos;
-
- client = mClients[xevent->xclient.window];
-
- if (xevent->xclient.data.l[2])
- {
- pos = QPoint (xevent->xclient.data.l[3],
- xevent->xclient.data.l[4]);
- }
- else
- {
- pos = client->clientGeometry ().topLeft ();
- }
-
- client->showWindowMenu (pos);
- }
- }
- else if (action == Atoms::toolkitActionForceQuitDialogAtom)
- {
- if (mClients.contains (xevent->xclient.window))
- {
- Time timestamp = xevent->xclient.data.l[1];
-
- client = mClients[xevent->xclient.window];
-
- if (xevent->xclient.data.l[2])
- client->showKillProcessDialog (timestamp);
- else
- client->hideKillProcessDialog ();
- }
- }
- }
- break;
- default:
- break;
- }
-
- return KApplication::x11EventFilter (xevent);
-}
-
-void
-KWD::Decorator::reconfigure (void)
-{
- unsigned long changed;
-
- mConfig->reparseConfiguration ();
-
- changed = mOptions->updateSettings ();
- if (mPlugins->reset (changed))
- {
- QMap < WId, KWD::Window * >::ConstIterator it;
-
- updateShadow ();
-
- mDecorNormal->reloadDecoration ();
- mDecorActive->reloadDecoration ();
-
- for (it = mClients.constBegin (); it != mClients.constEnd (); it++)
- it.value ()->reloadDecoration ();
-
- mPlugins->destroyPreviousPlugin ();
- }
-}
-
-void
-KWD::Decorator::handleWindowAdded (WId id)
-{
- QMap <WId, KWD::Window *>::ConstIterator it;
- KWD::Window *client = 0;
- WId select, frame = 0;
- KWD::Window::Type type = KWD::Window::Normal;
- unsigned int width, height, border, depth;
- int x, y;
- XID root;
- QWidgetList widgets;
-
- /* avoid adding any of our own top level windows */
- foreach (QWidget *widget, QApplication::topLevelWidgets()) {
- if (widget->winId() == id)
- return;
- }
-
- KWD::trapXError ();
- XGetGeometry (QX11Info::display(), id, &root, &x, &y, &width, &height,
- &border, &depth);
- if (KWD::popXError ())
- return;
-
- KWD::readWindowProperty (id, Atoms::netFrameWindow, (long *) &frame);
-
- if (KWD::readWindowProperty (id, Atoms::switchSelectWindow,
- (long *) &select))
- {
- if (!mSwitcher)
- mSwitcher = new Switcher (mCompositeWindow, id);
- if (mSwitcher->xid () != id)
- {
- delete mSwitcher;
- mSwitcher = new Switcher (mCompositeWindow, id);
- }
- frame = None;
- }
- else
- {
- KWindowInfo wInfo = KWindowSystem::windowInfo (id, NET::WMWindowType, 0);
-
- switch (wInfo.windowType (~0)) {
- case NET::Normal:
- case NET::Dialog:
- case NET::Toolbar:
- case NET::Menu:
- case NET::Utility:
- case NET::Splash:
- case NET::Unknown:
- /* decorate these window types */
- break;
- default:
- return;
- }
-
- type = KWD::Window::Normal;
- }
-
- KWD::trapXError ();
- XSelectInput (QX11Info::display(), id, StructureNotifyMask | PropertyChangeMask);
- KWD::popXError ();
-
- if (frame)
- {
- if (!mClients.contains (id))
- {
- client = new KWD::Window (mCompositeWindow, id, frame, type,
- x, y,
- width + border * 2,
- height + border * 2);
-
- mClients.insert (id, client);
- mFrames.insert (frame, client);
- }
- else
- {
- client = mClients[id];
- mFrames.remove (client->frameId ());
- mFrames.insert (frame, client);
-
- client->updateFrame (frame);
- }
- }
- else
- {
- if (mClients.contains (id))
- client = mClients[id];
-
- if (client)
- {
- mClients.remove (client->windowId ());
- mFrames.remove (client->frameId ());
-
- delete client;
- }
- }
-}
-
-void
-KWD::Decorator::handleWindowRemoved (WId id)
-{
- KWD::Window *window = 0;
-
- if (mClients.contains (id))
- window = mClients[id];
- else if (mFrames.contains (id))
- window = mFrames[id];
-
- if (window)
- {
- mClients.remove (window->windowId ());
- mFrames.remove (window->frameId ());
- delete window;
- }
-
- if (mSwitcher && mSwitcher->xid () == id)
- {
- delete mSwitcher;
- mSwitcher = NULL;
- }
-}
-
-void
-KWD::Decorator::handleActiveWindowChanged (WId id)
-{
- if (id != mActiveId)
- {
- KWD::Window *newActiveWindow = 0;
- KWD::Window *oldActiveWindow = 0;
-
- if (mClients.contains (id))
- newActiveWindow = mClients[id];
-
- if (mClients.contains (mActiveId))
- oldActiveWindow = mClients[mActiveId];
-
- mActiveId = id;
-
- if (oldActiveWindow)
- oldActiveWindow->handleActiveChange ();
-
- if (newActiveWindow)
- newActiveWindow->handleActiveChange ();
- }
-}
-
-void
-KWD::Decorator::handleWindowChanged (WId id,
- const unsigned long *properties)
-{
- KWD::Window *client;
-
- if (mSwitcher && mSwitcher->xid () == id)
- {
- if (properties[0] & NET::WMGeometry)
- mSwitcher->updateGeometry ();
- return;
- }
-
- if (!mClients.contains (id))
- return;
-
- client = mClients[id];
-
- if (properties[0] & NET::WMName)
- client->updateName ();
- if (properties[0] & NET::WMVisibleName)
- client->updateName ();
- if (properties[0] & NET::WMState)
- client->updateState ();
- if (properties[0] & NET::WMIcon)
- client->updateIcons ();
- if (properties[0] & NET::WMGeometry)
- client->updateWindowGeometry ();
-
-}
-
-void
-KWD::Decorator::sendClientMessage (WId eventWid,
- WId wid,
- Atom atom,
- Atom value,
- long data1,
- long data2,
- long data3)
-{
- XEvent ev;
- long mask = 0;
-
- memset (&ev, 0, sizeof (ev));
-
- ev.xclient.type = ClientMessage;
- ev.xclient.window = wid;
- ev.xclient.message_type = atom;
- ev.xclient.format = 32;
-
- ev.xclient.data.l[0] = value;
- ev.xclient.data.l[1] = QX11Info::appTime();
- ev.xclient.data.l[2] = data1;
- ev.xclient.data.l[3] = data2;
- ev.xclient.data.l[4] = data3;
-
- if (eventWid == QX11Info::appRootWindow())
- mask = SubstructureRedirectMask | SubstructureNotifyMask;
-
- KWD::trapXError ();
- XSendEvent (QX11Info::display(), eventWid, false, mask, &ev);
- KWD::popXError ();
-}
-
-void
-KWD::Decorator::shadowRadiusChanged (double value)
-{
- decor_shadow_options_t opt = *shadowOptions ();
-
- opt.shadow_radius = value;
-
- changeShadowOptions (&opt);
-}
-
-void
-KWD::Decorator::shadowOpacityChanged (double value)
-{
- decor_shadow_options_t opt = *shadowOptions ();
-
- opt.shadow_opacity = value;
-
- changeShadowOptions (&opt);
-}
-
-void
-KWD::Decorator::shadowXOffsetChanged (int value)
-{
- decor_shadow_options_t opt = *shadowOptions ();
-
- opt.shadow_offset_x = value;
-
- changeShadowOptions (&opt);
-}
-
-void
-KWD::Decorator::shadowYOffsetChanged (int value)
-{
- decor_shadow_options_t opt = *shadowOptions ();
-
- opt.shadow_offset_y = value;
-
- changeShadowOptions (&opt);
-}
-
-void
-KWD::Decorator::shadowColorChanged (QString value)
-{
- decor_shadow_options_t opt = *shadowOptions ();
-
- int c[4];
-
- if (sscanf (value.toAscii().data(), "#%2x%2x%2x%2x",
- &c[0], &c[1], &c[2], &c[3]) == 4)
- {
- opt.shadow_color[0] = c[0] << 8 | c[0];
- opt.shadow_color[1] = c[1] << 8 | c[1];
- opt.shadow_color[2] = c[2] << 8 | c[2];
- }
-
- changeShadowOptions (&opt);
-}
-
-void
-KWD::Decorator::plasmaThemeChanged ()
-{
- if (mSwitcher)
- {
- WId win = mSwitcher->xid();
- delete mSwitcher;
- mSwitcher = new Switcher (mCompositeWindow, win);
- }
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/decorator.h compiz-0.8.8/kde/window-decorator-kde4/decorator.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/decorator.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/decorator.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,164 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _DECORATOR_H
-#define _DECORATOR_H
-
-#include <kapplication.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/cursorfont.h>
-
-#include <QTimer>
-
-#include <fixx11h.h>
-#include <KDE/KConfig>
-#include <netwm.h>
-
-#include <decoration.h>
-
-#include "window.h"
-#include "switcher.h"
-#include "kdecoration_plugins.h"
-#include "utils.h"
-
-#define ROOT_OFF_X 8192
-#define ROOT_OFF_Y 8192
-
-#define C(name) { 0, XC_ ## name }
-
-struct _cursor {
- Cursor cursor;
- unsigned int shape;
-};
-
-extern struct _cursor cursors[3][3];
-
-#define BLUR_TYPE_NONE 0
-#define BLUR_TYPE_TITLEBAR 1
-#define BLUR_TYPE_ALL 2
-
-extern int blurType;
-
-class KConfig;
-class KWindowSystem;
-
-namespace KWD
-{
- class Options;
-
-class PluginManager:public KDecorationPlugins {
- public:
- PluginManager (KSharedConfigPtr config);
- virtual bool provides (Requirement)
- {
- return false;
- }
- };
-
-
-class Decorator:public KApplication {
- Q_OBJECT public:
-
- Decorator ();
- ~Decorator (void);
-
- static NETRootInfo *rootInfo (void)
- {
- return mRootInfo;
- }
- static PluginManager *pluginManager (void)
- {
- return mPlugins;
- }
- static KWD::Options *options (void)
- {
- return mOptions;
- }
- static WId activeId (void)
- {
- return mActiveId;
- }
- static decor_shadow_options_t *shadowOptions (void)
- {
- return &mShadowOptions;
- }
-
- static void sendClientMessage (WId eventWid,
- WId wid,
- Atom atom,
- Atom value,
- long data1 = 0,
- long data2 = 0,
- long data3 = 0);
-
- bool enableDecorations (Time timestamp);
- bool x11EventFilter (XEvent *xevent);
- void changeShadowOptions (decor_shadow_options_t *opt);
-
- public slots:
- void reconfigure (void);
-
- private:
- WId fetchFrame (WId window);
- void updateShadow (void);
- void updateAllShadowOptions (void);
-
- private slots:
- void handleWindowAdded (WId id);
- void handleWindowRemoved (WId id);
- void handleActiveWindowChanged (WId id);
- void handleWindowChanged (WId id,
- const unsigned long *properties);
-
- void shadowRadiusChanged (double value);
- void shadowOpacityChanged (double value);
- void shadowXOffsetChanged (int value);
- void shadowYOffsetChanged (int value);
- void shadowColorChanged (QString value);
-
- void plasmaThemeChanged ();
-
- private:
- static PluginManager *mPlugins;
- static KWD::Options *mOptions;
- static decor_shadow_t *mNoBorderShadow;
- static decor_shadow_options_t mShadowOptions;
- static NETRootInfo *mRootInfo;
- static WId mActiveId;
-
- KWD::Window *mDecorNormal;
- KWD::Window *mDecorActive;
- QMap <WId, KWD::Window *>mClients;
- QMap <WId, KWD::Window *>mFrames;
- KConfig *mConfig;
- Time mDmSnTimestamp;
-
- WId mCompositeWindow;
-
- Switcher *mSwitcher;
- };
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/kdecoration_plugins.cpp compiz-0.8.8/kde/window-decorator-kde4/kdecoration_plugins.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/kdecoration_plugins.cpp 2010-05-21 13:17:43.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/kdecoration_plugins.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,212 +0,0 @@
-/*****************************************************************
-
-This file is a copy of the KWin internal API. It allows the KDE4
-window decorator the loading of KWin decoration plugins.
-
-Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
-
-******************************************************************
-
-This file is part of the KDE project.
-
-Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
-Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-******************************************************************/
-
-#include "kdecoration_plugins.h"
-
-#include <kconfig.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <klibloader.h>
-#include <kconfiggroup.h>
-#include <assert.h>
-
-#include <QDir>
-#include <QFile>
-
-#include <kdecorationfactory.h>
-
-KWD::KDecorationPlugins::KDecorationPlugins(const KSharedConfigPtr &cfg)
- : create_ptr( NULL ),
- library( NULL ),
- fact( NULL ),
- old_library( NULL ),
- old_fact( NULL ),
- pluginStr( "kwin3_undefined " ),
- config( cfg )
- {
- }
-
-KWD::KDecorationPlugins::~KDecorationPlugins()
- {
- if(library)
- {
- assert( fact != NULL );
- delete fact;
- library->unload();
- }
- if(old_library)
- {
- assert( old_fact != NULL );
- delete old_fact;
- old_library->unload();
- }
- }
-
-QString KWD::KDecorationPlugins::currentPlugin()
- {
- return pluginStr;
- }
-
-bool KWD::KDecorationPlugins::reset( unsigned long changed )
- {
- QString oldPlugin = pluginStr;
- config->reparseConfiguration();
- bool ret = false;
- if(( !loadPlugin( "" ) && library ) // "" = read the one in cfg file
- || oldPlugin == pluginStr )
- { // no new plugin loaded, reset the old one
- assert( fact != NULL );
- ret = fact->reset( changed );
- }
- return ret || oldPlugin != pluginStr;
- }
-
-KDecorationFactory* KWD::KDecorationPlugins::factory()
- {
- return fact;
- }
-
-// convenience
-KDecoration* KWD::KDecorationPlugins::createDecoration( KDecorationBridge* bridge )
- {
- if( fact != NULL )
- return fact->createDecoration( bridge );
- return NULL;
- }
-
-// returns true if plugin was loaded successfully
-bool KWD::KDecorationPlugins::loadPlugin( QString nameStr )
- {
- if( nameStr.isEmpty())
- {
- KConfigGroup group( config, QString("Style") );
- nameStr = group.readEntry("PluginLib", defaultPlugin );
- }
- // make sure people can switch between HEAD and kwin_iii branch
- if( nameStr.startsWith( "kwin_" ))
- nameStr = "kwin3_" + nameStr.mid( 5 );
-
- KLibrary *oldLibrary = library;
- KDecorationFactory* oldFactory = fact;
-
- QString path = KLibLoader::findLibrary(nameStr);
- kDebug() << "kwin : path " << path << " for " << nameStr;
-
- // If the plugin was not found, try to find the default
- if (path.isEmpty())
- {
- nameStr = defaultPlugin;
- path = KLibLoader::findLibrary(nameStr);
- }
-
- // If no library was found, exit kwin with an error message
- if (path.isEmpty())
- {
- error( i18n("No window decoration plugin library was found." ));
- return false;
- }
-
- // Check if this library is not already loaded.
- if(pluginStr == nameStr)
- return true;
-
- // Try loading the requested plugin
- library = KLibLoader::self()->library(path);
-
- // If that fails, fall back to the default plugin
- if (!library)
- {
- kDebug() << " could not load library, try default plugin again";
- nameStr = defaultPlugin;
- if ( pluginStr == nameStr )
- return true;
- path = KLibLoader::findLibrary(nameStr);
- if (!path.isEmpty())
- library = KLibLoader::self()->library(path);
- }
-
- if (!library)
- {
- error( i18n("The default decoration plugin is corrupt "
- "and could not be loaded." ));
- return false;
- }
-
- create_ptr = NULL;
- KLibrary::void_function_ptr create_func = library->resolveFunction("create_factory");
- if(create_func)
- create_ptr = (KDecorationFactory* (*)())create_func;
-
- if(!create_ptr)
- {
- error( i18n( "The library %1 is not a KWin plugin.", path ));
- library->unload();
- return false;
- }
- fact = create_ptr();
- fact->checkRequirements( this ); // let it check what is supported
-
- pluginStr = nameStr;
-
- // For clients in kdeartwork
- QString catalog = nameStr;
- catalog.replace( "kwin3_", "kwin_" );
- KGlobal::locale()->insertCatalog( catalog );
- // For KCommonDecoration based clients
- KGlobal::locale()->insertCatalog( "kwin_lib" );
- // For clients in kdebase
- KGlobal::locale()->insertCatalog( "kwin_clients" );
- // For clients in kdeartwork
- KGlobal::locale()->insertCatalog( "kwin_art_clients" );
-
- old_library = oldLibrary; // save for delayed destroying
- old_fact = oldFactory;
-
- return true;
-}
-
-void KWD::KDecorationPlugins::destroyPreviousPlugin()
-{
- // Destroy the old plugin
- if(old_library)
- {
- delete old_fact;
- old_fact = NULL;
- old_library->unload();
- old_library = NULL;
- }
-}
-
-void KWD::KDecorationPlugins::error( const QString& )
- {
- }
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/kdecoration_plugins.h compiz-0.8.8/kde/window-decorator-kde4/kdecoration_plugins.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/kdecoration_plugins.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/kdecoration_plugins.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,90 +0,0 @@
-/*****************************************************************
-
-This file is a copy of the KWin internal API. It allows the KDE4
-window decorator the loading of KWin decoration plugins.
-
-Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
-
-******************************************************************
-
-This file is part of the KDE project.
-
-Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
-Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-******************************************************************/
-
-#ifndef KWD_KDECORATION_PLUGINS_H
-#define KWD_KDECORATION_PLUGINS_H
-
-//
-// This header file is internal. I mean it.
-//
-
-
-#include <QtGui/QWidget>
-#include <ksharedconfig.h>
-
-#include "kdecoration.h"
-
-class KLibrary;
-class KDecoration;
-class KDecorationBridge;
-class KDecorationFactory;
-
-namespace KWD
-{
-
-class KDecorationPlugins
- : public KDecorationProvides
- {
- public:
- KDecorationPlugins(const KSharedConfigPtr &cfg);
- virtual ~KDecorationPlugins();
- bool loadPlugin( QString name );
- void destroyPreviousPlugin();
- KDecorationFactory* factory();
- KDecoration* createDecoration( KDecorationBridge* );
- QString currentPlugin();
- bool reset( unsigned long changed ); // returns true if decorations need to be recreated
- protected:
- virtual void error( const QString& error_msg );
- QString defaultPlugin; // FRAME normalne protected?
- private:
- KDecorationFactory* (*create_ptr)();
- KLibrary *library;
- KDecorationFactory* fact;
- KLibrary *old_library;
- KDecorationFactory* old_fact;
- QString pluginStr;
- KSharedConfigPtr config;
- };
-
-/*
-
- Plugins API:
- KDecorationFactory* create_factory(); - called once after loading
-
-*/
-}
-
-/** @} */
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/main.cpp compiz-0.8.8/kde/window-decorator-kde4/main.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/main.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/main.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,135 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xdamage.h>
-
-#include <fixx11h.h>
-#include <KDE/KApplication>
-#include <KDE/KCmdLineArgs>
-#include <KDE/KAboutData>
-#include <KDE/KDebug>
-#include <KDE/KLocale>
-
-#include "decorator.h"
-#include "utils.h"
-
-#include <QX11Info>
-#include <QtDBus/QtDBus>
-
-
-
-int
-main (int argc, char **argv)
-{
- KWD::Decorator *app;
- KCmdLineArgs *args;
- KCmdLineOptions options;
- int status;
- Time timestamp;
- QString appname;
-
- options.add ("replace", ki18n ("Replace existing window decorator"));
- options.add ("sm-disable", ki18n ("Disable connection to session manager"));
- options.add ("blur <type>", ki18n ("Blur type (none/titlebar/all)"), "none");
-
- KAboutData about("kde-window-decorator", "kwin", ki18n ("KDE Window Decorator"),
- "0.0.1", KLocalizedString(), KAboutData::License_GPL,
- KLocalizedString(), KLocalizedString(), "http://www.compiz.org",
- "dev@lists.compiz-fusion.org");
- KCmdLineArgs::init (argc, argv,
- "kde-window-decorator",
- "kwin",
- ki18n ("KDE Window Decorator"),
- "0.0.1");
- KCmdLineArgs::addCmdLineOptions (options);
- args = KCmdLineArgs::parsedArgs ();
-
- if (args->isSet ("blur"))
- {
- QString blur = args->getOption ("blur");
-
- if (blur == QString ("titlebar"))
- blurType = BLUR_TYPE_TITLEBAR;
- else if (blur == QString ("all"))
- blurType = BLUR_TYPE_ALL;
- }
-
- app = new KWD::Decorator ();
-
- if (args->isSet ("sm-disable"))
- app->disableSessionManagement ();
-
- status = decor_acquire_dm_session (QX11Info::display(),
- QX11Info::appScreen (),
- "kwd", args->isSet ("replace"),
- &timestamp);
- if (status != DECOR_ACQUIRE_STATUS_SUCCESS)
- {
- if (status == DECOR_ACQUIRE_STATUS_FAILED)
- {
- fprintf (stderr,
- "%s: Could not acquire decoration manager "
- "selection on screen %d display \"%s\"\n",
- argv[0], QX11Info::appScreen (),
- DisplayString (QX11Info::display()));
- }
- else if (status == DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING)
- {
- fprintf (stderr,
- "%s: Screen %d on display \"%s\" already "
- "has a decoration manager; try using the "
- "--replace option to replace the current "
- "decoration manager.\n",
- argv[0], QX11Info::appScreen (),
- DisplayString (QX11Info::display()));
- }
-
- return 1;
- }
-
- decor_set_dm_check_hint (QX11Info::display(), QX11Info::appScreen ());
-
- if (!app->enableDecorations (timestamp))
- {
- fprintf (stderr,
- "%s: Could not enable decorations on display \"%s\"\n",
- argv[0], DisplayString (QX11Info::display()));
-
- return 1;
- }
-
- if (QX11Info::appScreen () == 0)
- appname = "org.kde.kwin";
- else
- appname.sprintf("org.kde.kwin-screen-%d", QX11Info::appScreen ());
-
- QDBusConnection::sessionBus ().interface ()->registerService
- (appname, QDBusConnectionInterface::DontQueueService);
-
- status = app->exec ();
-
- delete app;
-
- return status;
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/Makefile.am compiz-0.8.8/kde/window-decorator-kde4/Makefile.am
--- compiz-0.8.8-orig/kde/window-decorator-kde4/Makefile.am 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/Makefile.am 1970-01-01 01:00:00.000000000 +0100
@@ -1,58 +0,0 @@
-if USE_KDE4
-
-BUILDSOURCES = \
- decorator.moc.cpp \
- window.moc.cpp \
- paintredirector.moc.cpp \
- kwinadaptor.moc.cpp \
- kwinadaptor.cpp \
- kwinadaptor.h
-
-kde4_window_decorator_DEPENDENCIES = \
- $(top_builddir)/libdecoration/libdecoration.la
-kde4_window_decorator_LDADD = \
- $(top_builddir)/libdecoration/libdecoration.la \
- @KDE4_WINDOW_DECORATOR_LIBS@ @KDE4_LIBS@ -ldl
-
-nodist_kde4_window_decorator_SOURCES = \
- $(BUILDSOURCES)
-
-dist_kde4_window_decorator_SOURCES = \
- main.cpp \
- utils.cpp \
- utils.h \
- decorator.cpp \
- decorator.h \
- window.cpp \
- window.h \
- options.cpp \
- options.h \
- kdecoration_plugins.cpp \
- kdecoration_plugins.h \
- switcher.cpp \
- switcher.h \
- paintredirector.cpp \
- paintredirector.h \
- org.kde.KWin.xml
-
-kde4_window_decorator_program = kde4-window-decorator
-
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include @KDE4_WINDOW_DECORATOR_CFLAGS@ @KDE4_CFLAGS@
-
-bin_PROGRAMS = $(kde4_window_decorator_program)
-
-%.moc.cpp: %.h
- $(QT4_MOC) $< > $@
-
-kwinadaptor.h: kwinadaptor.cpp
-
-kwinadaptor.cpp: org.kde.KWin.xml
- $(QDBUSXML2CPP) -a kwinadaptor -i decorator.h -l KWD::Decorator $<
-
-# make sure kwinadaptor.h is built before any of the dist_SOURCES uses it
-main.cpp: kwinadaptor.h
-
-CLEANFILES = $(BUILDSOURCES)
-EXTRA_DIST = org.kde.KWin.xml
-
-endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/options.cpp compiz-0.8.8/kde/window-decorator-kde4/options.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/options.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/options.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,186 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "options.h"
-
-#include <KDE/KConfig>
-#include <KDE/KConfigGroup>
-#include <kdecoration.h>
-
-KWD::Options::Options (KConfig *config): KDecorationOptions (), mConfig (config)
-{
- updateSettings ();
-}
-
-unsigned long
-KWD::Options::updateSettings (void)
-{
- unsigned long changed = 0;
- KConfigGroup config = mConfig->group("Windows");
-
- changed |= KDecorationOptions::updateSettings (mConfig);
-
- OpTitlebarDblClick =
- windowOperation (config.readEntry ("TitlebarDoubleClickCommand",
- "Shade"), true);
- setOpMaxButtonLeftClick (
- windowOperation (config.readEntry ("MaximizeButtonLeftClickCommand",
- "Maximize"), true));
- setOpMaxButtonMiddleClick (
- windowOperation (config.readEntry ("MaximizeButtonMiddleClickCommand",
- "Maximize (vertical only)"), true));
- setOpMaxButtonRightClick (
- windowOperation (config.readEntry ("MaximizeButtonRightClickCommand",
- "Maximize (horizontal only)"),
- true));
-
- config = mConfig->group("MouseBindings");
-
- CmdActiveTitlebar1 =
- mouseCommand (config.readEntry ("CommandActiveTitlebar1",
- "Raise"), true);
- CmdActiveTitlebar2 =
- mouseCommand (config.readEntry ("CommandActiveTitlebar2",
- "Lower"), true);
- CmdActiveTitlebar3 =
- mouseCommand (config.readEntry ("CommandActiveTitlebar3",
- "Operations menu"), true);
- CmdInactiveTitlebar1 =
- mouseCommand (config.readEntry ("CommandInactiveTitlebar1",
- "Activate and raise"), true);
- CmdInactiveTitlebar2 =
- mouseCommand (config.readEntry ("CommandInactiveTitlebar2",
- "Activate and lower"), true);
- CmdInactiveTitlebar3 =
- mouseCommand (config.readEntry ("CommandInactiveTitlebar3",
- "Operations menu"), true);
-
- CmdTitlebarWheel =
- mouseWheelCommand (config.readEntry ("CommandTitlebarWheel",
- "Nothing"));
-
- return changed;
-}
-
-// restricted should be true for operations that the user may not be able to
-// repeat if the window is moved out of the workspace (e.g. if the user moves
-// a window by the titlebar, and moves it too high beneath Kicker at the top
-// edge, they may not be able to move it back, unless they know about Alt+LMB)
-KDecorationDefines::WindowOperation
-KWD::Options::windowOperation (const QString &name, bool restricted)
-{
- if (name == "Move")
- return restricted ? KWD::Options::MoveOp :
- KWD::Options::UnrestrictedMoveOp;
- else if (name == "Resize")
- return restricted ? KWD::Options::ResizeOp :
- KWD::Options::UnrestrictedResizeOp;
- else if (name == "Maximize")
- return KWD::Options::MaximizeOp;
- else if (name == "Minimize")
- return KWD::Options::MinimizeOp;
- else if (name == "Close")
- return KWD::Options::CloseOp;
- else if (name == "OnAllDesktops")
- return KWD::Options::OnAllDesktopsOp;
- else if (name == "Shade")
- return KWD::Options::ShadeOp;
- else if (name == "Operations")
- return KWD::Options::OperationsOp;
- else if (name == "Maximize (vertical only)")
- return KWD::Options::VMaximizeOp;
- else if (name == "Maximize (horizontal only)")
- return KWD::Options::HMaximizeOp;
- else if (name == "Lower")
- return KWD::Options::LowerOp;
- return KWD::Options::NoOp;
-}
-
-KWD::Options::MouseCommand
-KWD::Options::mouseCommand (const QString &name,
- bool restricted)
-{
- QString lowerName = name.toLower ();
-
- if (lowerName == "raise") return MouseRaise;
- if (lowerName == "lower") return MouseLower;
- if (lowerName == "operations menu") return MouseOperationsMenu;
- if (lowerName == "toggle raise and lower") return MouseToggleRaiseAndLower;
- if (lowerName == "activate and raise") return MouseActivateAndRaise;
- if (lowerName == "activate and lower") return MouseActivateAndLower;
- if (lowerName == "activate") return MouseActivate;
- if (lowerName == "activate, raise and pass click")
- return MouseActivateRaiseAndPassClick;
- if (lowerName == "activate and pass click")
- return MouseActivateAndPassClick;
- if (lowerName == "activate, raise and move")
- return restricted ? MouseActivateRaiseAndMove :
- MouseActivateRaiseAndUnrestrictedMove;
- if (lowerName == "move")
- return restricted ? MouseMove : MouseUnrestrictedMove;
- if (lowerName == "resize")
- return restricted ? MouseResize : MouseUnrestrictedResize;
- if (lowerName == "shade") return MouseShade;
- if (lowerName == "minimize") return MouseMinimize;
- if (lowerName == "nothing") return MouseNothing;
-
- return MouseNothing;
-}
-
-KWD::Options::MouseWheelCommand
-KWD::Options::mouseWheelCommand (const QString &name)
-{
- QString lowerName = name.toLower ();
-
- if (lowerName == "raise/lower") return MouseWheelRaiseLower;
- if (lowerName == "shade/unshade") return MouseWheelShadeUnshade;
- if (lowerName == "maximize/restore") return MouseWheelMaximizeRestore;
- if (lowerName == "above/below") return MouseWheelAboveBelow;
- if (lowerName == "previous/next desktop")
- return MouseWheelPreviousNextDesktop;
- if (lowerName == "change opacity") return MouseWheelChangeOpacity;
-
- return MouseWheelNothing;
-}
-
-KWD::Options::MouseCommand
-KWD::Options::wheelToMouseCommand (MouseWheelCommand com,
- int delta)
-{
- switch (com) {
- case MouseWheelRaiseLower:
- return delta > 0 ? MouseRaise : MouseLower;
- case MouseWheelShadeUnshade:
- return delta > 0 ? MouseSetShade : MouseUnsetShade;
- case MouseWheelMaximizeRestore:
- return delta > 0 ? MouseMaximize : MouseRestore;
- case MouseWheelAboveBelow:
- return delta > 0 ? MouseAbove : MouseBelow;
- case MouseWheelPreviousNextDesktop:
- return delta > 0 ? MousePreviousDesktop : MouseNextDesktop;
- case MouseWheelChangeOpacity:
- return delta > 0 ? MouseOpacityMore : MouseOpacityLess;
- default:
- return MouseNothing;
- }
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/options.h compiz-0.8.8/kde/window-decorator-kde4/options.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/options.h 2010-05-21 13:17:43.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/options.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,140 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _OPTIONS_H
-#define _OPTIONS_H
-
-#include <kdecoration.h>
-
-class KConfig;
-
-namespace KWD
-{
-
-class Options : public KDecorationOptions
- {
- public:
- enum MouseCommand
- {
- MouseRaise,
- MouseLower,
- MouseOperationsMenu,
- MouseToggleRaiseAndLower,
- MouseActivateAndRaise,
- MouseActivateAndLower,
- MouseActivate,
- MouseActivateRaiseAndPassClick,
- MouseActivateAndPassClick,
- MouseMove,
- MouseUnrestrictedMove,
- MouseActivateRaiseAndMove,
- MouseActivateRaiseAndUnrestrictedMove,
- MouseResize,
- MouseUnrestrictedResize,
- MouseShade,
- MouseSetShade,
- MouseUnsetShade,
- MouseMaximize,
- MouseRestore,
- MouseMinimize,
- MouseNextDesktop,
- MousePreviousDesktop,
- MouseAbove,
- MouseBelow,
- MouseOpacityMore,
- MouseOpacityLess,
- MouseNothing
- };
- enum MouseWheelCommand
- {
- MouseWheelRaiseLower,
- MouseWheelShadeUnshade,
- MouseWheelMaximizeRestore,
- MouseWheelAboveBelow,
- MouseWheelPreviousNextDesktop,
- MouseWheelChangeOpacity,
- MouseWheelNothing
- };
-
- Options (KConfig *config);
-
- virtual unsigned long updateSettings (void);
-
- WindowOperation operationTitlebarDblClick (void)
- {
- return OpTitlebarDblClick;
- }
-
- MouseCommand commandActiveTitlebar1 (void)
- {
- return CmdActiveTitlebar1;
- }
- MouseCommand commandActiveTitlebar2 (void)
- {
- return CmdActiveTitlebar2;
- }
- MouseCommand commandActiveTitlebar3 (void)
- {
- return CmdActiveTitlebar3;
- }
- MouseCommand commandInactiveTitlebar1 (void)
- {
- return CmdInactiveTitlebar1;
- }
- MouseCommand commandInactiveTitlebar2 (void)
- {
- return CmdInactiveTitlebar2;
- }
- MouseCommand commandInactiveTitlebar3 (void)
- {
- return CmdInactiveTitlebar3;
- }
-
- MouseCommand operationTitlebarMouseWheel (int delta)
- {
- return wheelToMouseCommand (CmdTitlebarWheel, delta);
- }
-
- private:
- static KDecorationDefines::WindowOperation
- windowOperation (const QString &name, bool restricted);
- MouseCommand mouseCommand (const QString &name, bool restricted);
- MouseWheelCommand mouseWheelCommand (const QString &name);
- MouseCommand wheelToMouseCommand (MouseWheelCommand com, int delta);
-
- private:
- KDecorationDefines::WindowOperation OpTitlebarDblClick;
- MouseCommand CmdActiveTitlebar1;
- MouseCommand CmdActiveTitlebar2;
- MouseCommand CmdActiveTitlebar3;
- MouseCommand CmdInactiveTitlebar1;
- MouseCommand CmdInactiveTitlebar2;
- MouseCommand CmdInactiveTitlebar3;
- MouseWheelCommand CmdTitlebarWheel;
-
- KConfig *mConfig;
- };
-
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/org.kde.KWin.xml compiz-0.8.8/kde/window-decorator-kde4/org.kde.KWin.xml
--- compiz-0.8.8-orig/kde/window-decorator-kde4/org.kde.KWin.xml 2010-05-21 13:17:43.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/org.kde.KWin.xml 1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.kde.KWin">
- <method name="reconfigure">
- <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
- </method>
- <signal name="reloadConfig"/>
- </interface>
-</node>
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/paintredirector.cpp compiz-0.8.8/kde/window-decorator-kde4/paintredirector.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/paintredirector.cpp 2010-05-21 13:17:43.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/paintredirector.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,124 +0,0 @@
-/*****************************************************************
-This file is part of the KDE project.
-
-Copyright (C) 2009 Lubos Lunak <l.lunak@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-******************************************************************/
-
-#include "paintredirector.h"
-
-#include <kdebug.h>
-#include <qevent.h>
-#include <qpainter.h>
-
-namespace KWin
-{
-
-PaintRedirector::PaintRedirector( QWidget* w )
- : widget( w )
- , recursionCheck( false )
- {
- timer.setSingleShot( true );
- connect( &timer, SIGNAL( timeout()), SIGNAL( paintPending()));
- added( w );
- }
-
-QPixmap PaintRedirector::performPendingPaint()
- {
- //qDebug() << "### performing paint, pending:" << pending.boundingRect();
- QPixmap pixmap( pending.boundingRect().size());
- pixmap.fill( Qt::transparent );
- recursionCheck = true;
- // do not use DrawWindowBackground, it's ok to be transparent
- widget->render( &pixmap, QPoint(), pending.boundingRect(), QWidget::DrawChildren );
- recursionCheck = false;
- pending = QRegion();
- return pixmap;
- }
-
-bool PaintRedirector::isToolTip( QWidget *object ) const
- {
- // ### We need a more reliable way of doing this
- return object->windowFlags() & Qt::ToolTip;
- }
-
-bool PaintRedirector::eventFilter( QObject* o, QEvent* e )
- {
- switch( e->type())
- {
- case QEvent::ChildAdded:
- {
- QChildEvent* c = static_cast< QChildEvent* >( e );
- if( c->child()->isWidgetType() && !isToolTip( static_cast< QWidget* >( c->child() ) ) )
- added( static_cast< QWidget* >( c->child()));
- break;
- }
- case QEvent::ChildRemoved:
- {
- QChildEvent* c = static_cast< QChildEvent* >( e );
- if( c->child()->isWidgetType())
- removed( static_cast< QWidget* >( c->child()));
- break;
- }
- case QEvent::Paint:
- {
- if( !recursionCheck )
- {
- QPaintEvent* pe = static_cast< QPaintEvent* >( e );
- QWidget* w = static_cast< QWidget* >( o );
- pending |= pe->region().translated( w->mapTo( widget, QPoint( 0, 0 )));
- timer.start( 0 );
- return true; // filter out
- }
- }
- default:
- break;
- }
- return false;
- }
-
-QRegion PaintRedirector::pendingRegion() const
- {
- return pending;
- }
-
-void PaintRedirector::added( QWidget* w )
- {
- w->installEventFilter( this );
- foreach( QObject* o, w->children())
- {
- if( o->isWidgetType() && !isToolTip( static_cast< QWidget* >( o ) ) )
- added( static_cast< QWidget* >( o ));
- }
- }
-
-void PaintRedirector::removed( QWidget* w )
- {
- foreach( QObject* o, w->children())
- {
- if( o->isWidgetType())
- removed( static_cast< QWidget* >( o ));
- }
- w->installEventFilter( this );
- }
-
-} // namespace
-
-//#include "paintredirector.moc"
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/paintredirector.h compiz-0.8.8/kde/window-decorator-kde4/paintredirector.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/paintredirector.h 2010-05-21 13:17:43.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/paintredirector.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
-/*****************************************************************
-This file is part of the KDE project.
-
-Copyright (C) 2009 Lubos Lunak <l.lunak@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-******************************************************************/
-
-#ifndef PAINTREDIRECTOR_H
-#define PAINTREDIRECTOR_H
-
-#include <qregion.h>
-#include <qtimer.h>
-#include <qwidget.h>
-
-namespace KWin
-{
-
-// This class redirects all painting of a given widget (including its children)
-// into a paint device (QPixmap).
-class PaintRedirector
- : public QObject
- {
- Q_OBJECT
- public:
- PaintRedirector( QWidget* widget );
- QPixmap performPendingPaint();
- virtual bool eventFilter( QObject* o, QEvent* e );
- QRegion pendingRegion() const;
- signals:
- void paintPending();
- private:
- void added( QWidget* widget );
- void removed( QWidget* widget );
- bool isToolTip( QWidget* widget ) const;
- QWidget* widget;
- QRegion pending;
- bool recursionCheck;
- QTimer timer;
- };
-
-} // namespace
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/switcher.cpp compiz-0.8.8/kde/window-decorator-kde4/switcher.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/switcher.cpp 2010-11-23 10:55:14.000000000 +0100
+++ compiz-0.8.8/kde/window-decorator-kde4/switcher.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,308 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: Dennis Kasprzyk <onestone@opencompositing.org>
- */
-
-#include "switcher.h"
-#include "utils.h"
-#include "decorator.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/Xcomposite.h>
-#include <X11/Xregion.h>
-
-#include <fixx11h.h>
-
-#include <KDE/Plasma/FrameSvg>
-#include <KDE/Plasma/Theme>
-
-#include <kwindowsystem.h>
-
-#include <QString>
-#include <QPainter>
-
-KWD::Switcher::Switcher (WId parentId, WId id):
- mId (id),
- mX11Pixmap (0),
- mX11BackgroundPixmap (0)
-{
- QPalette palette;
- long prop[4];
- QColor color;
- color = Plasma::Theme::defaultTheme ()->color (Plasma::Theme::TextColor);
-
- mBackground = new Plasma::FrameSvg();
- mBackground->setImagePath ("dialogs/background");
- mBackground->setEnabledBorders(Plasma::FrameSvg::AllBorders);
-
- mBorder.left = mBackground->marginSize(Plasma::LeftMargin);
- mBorder.right = mBackground->marginSize(Plasma::RightMargin);
- mBorder.top = mBackground->marginSize(Plasma::TopMargin);
- mBorder.bottom = mBackground->marginSize(Plasma::BottomMargin) +
- Plasma::Theme::defaultTheme ()->fontMetrics ().height () + 10;
-
- mContext.extents.left = mBorder.left;
- mContext.extents.right = mBorder.right;
- mContext.extents.top = mBorder.top;
- mContext.extents.bottom = mBorder.bottom;
-
- mContext.left_space = mBorder.left;
- mContext.right_space = mBorder.right;
- mContext.top_space = mBorder.top;
- mContext.bottom_space = mBorder.bottom;
-
- mContext.left_corner_space = 0;
- mContext.right_corner_space = 0;
- mContext.top_corner_space = 0;
- mContext.bottom_corner_space = 0;
-
- updateGeometry ();
-
- prop[0] = (color.red () * 256) + color.red ();
- prop[1] = (color.green () * 256) + color.green ();
- prop[2] = (color.blue () * 256) + color.blue ();
- prop[3] = (color.alpha () * 256) + color.alpha ();
-
- KWD::trapXError ();
- XChangeProperty (QX11Info::display (), id, Atoms::switchFgColor, XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) prop, 4);
- KWD::popXError ();
-}
-
-KWD::Switcher::~Switcher ()
-{
- if (mX11Pixmap)
- XFreePixmap (QX11Info::display (), mX11Pixmap);
- if (mX11BackgroundPixmap)
- XFreePixmap (QX11Info::display (), mX11BackgroundPixmap);
- delete mBackground;
-}
-
-void
-KWD::Switcher::updateGeometry ()
-{
- int x, y;
- unsigned int width, height, border, depth;
- XID root;
-
- XGetGeometry (QX11Info::display (), mId, &root, &x, &y, &width, &height,
- &border, &depth);
-
- mGeometry = QRect (x, y, width, height);
-
- KWD::readWindowProperty (mId, Atoms::switchSelectWindow,
- (long *)&mSelected);
-
- if (mX11Pixmap)
- XFreePixmap (QX11Info::display (), mX11Pixmap);
- if (mX11BackgroundPixmap)
- XFreePixmap (QX11Info::display (), mX11BackgroundPixmap);
-
- mX11Pixmap = XCreatePixmap (QX11Info::display (),
- QX11Info::appRootWindow (),
- width + mBorder.left + mBorder.right,
- height + mBorder.top + mBorder.bottom, 32);
-
- mX11BackgroundPixmap = XCreatePixmap (QX11Info::display (),
- QX11Info::appRootWindow (),
- width, height, 32);
-
- mPixmap = QPixmap::fromX11Pixmap (mX11Pixmap, QPixmap::ExplicitlyShared);
- mBackgroundPixmap = QPixmap::fromX11Pixmap (mX11BackgroundPixmap,
- QPixmap::ExplicitlyShared);
-
- redrawPixmap ();
- update ();
-
- decor_get_default_layout (&mContext,
- mGeometry.width (),
- mGeometry.height (),
- &mDecorLayout);
-
- updateWindowProperties ();
-}
-
-void
-KWD::Switcher::redrawPixmap ()
-{
- QPainter p (&mPixmap);
- QPainter bp (&mBackgroundPixmap);
-
- const int contentWidth = mPixmap.width ();
- const int contentHeight = mPixmap.height ();
-
- mPixmap.fill (Qt::transparent);
-
- p.setCompositionMode (QPainter::CompositionMode_Source);
- p.setRenderHint (QPainter::SmoothPixmapTransform);
-
- mBackground->resizeFrame (QSizeF (contentWidth, contentHeight));
- mBackground->paintFrame (&p, QRect (0, 0, contentWidth, contentHeight));
-
- bp.setCompositionMode (QPainter::CompositionMode_Source);
- bp.drawPixmap (0, 0, mPixmap, mBorder.left, mBorder.top,
- mGeometry.width (), mGeometry.height ());
-
- XSetWindowBackgroundPixmap (QX11Info::display (), mId,
- mX11BackgroundPixmap);
-
- XClearWindow (QX11Info::display (), mId);
-}
-
-void
-KWD::Switcher::update ()
-{
- QFontMetrics fm = Plasma::Theme::defaultTheme ()->fontMetrics ();
- QFont font (Plasma::Theme::defaultTheme ()->
- font (Plasma::Theme::DefaultFont));
- QString name;
- QPainter p (&mPixmap);
-
- KWD::readWindowProperty (mId, Atoms::switchSelectWindow,
- (long *)&mSelected);
-
- name = KWindowSystem::windowInfo
- (mSelected, NET::WMVisibleName, 0).visibleName ();
-
- while (fm.width (name) > mGeometry.width ())
- {
- name.truncate (name.length () - 6);
- name += "...";
- }
-
- p.setCompositionMode (QPainter::CompositionMode_Source);
-
- mBackground->paintFrame (&p, QRect (mBorder.left,
- mBorder.top +
- mGeometry.height () + 5,
- mGeometry.width (),
- fm.height ()));
-
- p.setFont (font);
- p.setPen (Plasma::Theme::defaultTheme ()->color(Plasma::Theme::TextColor));
-
- p.drawText ((mPixmap.width () - fm.width (name)) / 2,
- mBorder.top + mGeometry.height () + 5 + fm.ascent (), name);
-}
-
-void
-KWD::Switcher::updateWindowProperties ()
-{
- long data[256];
- decor_quad_t quads[N_QUADS_MAX];
- int nQuad;
- int lh, rh;
- int w;
-
- lh = mDecorLayout.left.y2 - mDecorLayout.left.y1;
- rh = mDecorLayout.right.y2 - mDecorLayout.right.y1;
-
- w = mDecorLayout.top.x2 - mDecorLayout.top.x1 - mContext.left_space -
- mContext.right_space;
-
- nQuad = decor_set_lXrXtXbX_window_quads (quads, &mContext, &mDecorLayout,
- lh / 2, rh / 2, w, w / 2);
- decor_quads_to_property (data, mX11Pixmap,
- &mBorder, &mBorder,
- 0, 0,
- quads, nQuad);
-
- KWD::trapXError ();
- XChangeProperty (QX11Info::display(), mId, Atoms::netWindowDecor,
- XA_INTEGER, 32, PropModeReplace, (unsigned char *) data,
- BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
- KWD::popXError ();
-
- updateBlurProperty (lh / 2, rh / 2, w / 2, w / 2);
-}
-
-void
-KWD::Switcher::updateBlurProperty (int topOffset,
- int bottomOffset,
- int leftOffset,
- int rightOffset)
-{
- Atom atom = Atoms::compizWindowBlurDecor;
- QRegion topQRegion, bottomQRegion, leftQRegion, rightQRegion;
- Region topRegion = NULL;
- Region bottomRegion = NULL;
- Region leftRegion = NULL;
- Region rightRegion = NULL;
- int size = 0;
- int w, h;
-
- w = mGeometry.width () + mContext.extents.left + mContext.extents.right;
- h = mGeometry.height () + mContext.extents.top + mContext.extents.bottom;
-
- if (blurType != BLUR_TYPE_NONE)
- {
- QRegion r;
-
- topQRegion = QRegion (-mContext.extents.left, -mContext.extents.top,
- w, mContext.extents.top);
- topRegion = topQRegion.handle ();
-
- bottomQRegion = QRegion (-mContext.extents.left, 0,
- w, mContext.extents.bottom);
- bottomRegion = bottomQRegion.handle ();
-
- leftQRegion = QRegion (-mContext.extents.left, 0,
- mContext.extents.left, mGeometry.height ());
- leftRegion = leftQRegion.handle ();
-
- rightQRegion = QRegion (0, 0, mContext.extents.right,
- mGeometry.height ());
- rightRegion = rightQRegion.handle ();
- }
-
- if (topRegion)
- size += topRegion->numRects;
- if (bottomRegion)
- size += bottomRegion->numRects;
- if (leftRegion)
- size += leftRegion->numRects;
- if (rightRegion)
- size += rightRegion->numRects;
-
- if (size)
- {
- long data[size * 6 + 2];
-
- decor_region_to_blur_property (data, 4, 0,
- mGeometry.width (),
- mGeometry.height (),
- topRegion, topOffset,
- bottomRegion, bottomOffset,
- leftRegion, leftOffset,
- rightRegion, rightOffset);
-
- KWD::trapXError ();
- XChangeProperty (QX11Info::display (), mId, atom, XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- 2 + size * 6);
- KWD::popXError ();
- }
- else
- {
- KWD::trapXError ();
- XDeleteProperty (QX11Info::display (), mId, atom);
- KWD::popXError ();
- }
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/switcher.h compiz-0.8.8/kde/window-decorator-kde4/switcher.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/switcher.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/switcher.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,86 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: Dennis Kasprzyk <onestone@opencompositing.org>
- */
-
-#ifndef _SWITCHER_H
-#define _SWITCHER_H
-
-#include <QPixmap>
-#include <QRect>
-#include <QX11Info>
-#include <decoration.h>
-#include <fixx11h.h>
-
-namespace Plasma
-{
-class FrameSvg;
-}
-
-class QSpacerItem;
-class QLabel;
-class QVBoxLayout;
-
-namespace KWD
-{
-
-class Switcher
-{
-
- public:
- Switcher (WId parentId, WId id);
- ~Switcher ();
-
- void update ();
- void updateGeometry ();
-
- WId xid () const
- {
- return mId;
- }
-
- private:
- void updateWindowProperties ();
- void updateBlurProperty (int topOffset,
- int bottomOffset,
- int leftOffset,
- int rightOffset);
- void redrawPixmap ();
-
- private:
-
- WId mId;
- WId mSelected;
-
- QRect mGeometry;
-
- Plasma::FrameSvg *mBackground;
- QPixmap mPixmap;
- Pixmap mX11Pixmap;
- QPixmap mBackgroundPixmap;
- Pixmap mX11BackgroundPixmap;
-
- decor_layout_t mDecorLayout;
- decor_context_t mContext;
- decor_extents_t mBorder;
-};
-
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/utils.cpp compiz-0.8.8/kde/window-decorator-kde4/utils.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/utils.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/utils.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,209 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "utils.h"
-
-#include <decoration.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#include <stdlib.h>
-#include <QX11Info>
-
-static int trappedErrorCode = 0;
-
-namespace KWD
-{
- namespace Atoms
- {
- Atom switchSelectWindow;
- Atom switchFgColor;
- Atom netWmWindowOpacity;
- Atom netFrameWindow;
- Atom netWindowDecor;
- Atom netWindowDecorNormal;
- Atom netWindowDecorActive;
- Atom netWindowDecorBare;
- Atom wmTakeFocus;
- Atom netWmContextHelp;
- Atom wmProtocols;
- Atom toolkitActionAtom;
- Atom toolkitActionWindowMenuAtom;
- Atom toolkitActionForceQuitDialogAtom;
- Atom compizWindowBlurDecor;
- Atom enlightmentDesktop;
- }
-}
-
-static int (*oldErrorHandler) (Display *display, XErrorEvent *error);
-
-static int
-xErrorHandler (Display *display,
- XErrorEvent *error)
-{
- (void) display;
-
- trappedErrorCode = error->error_code;
-
- return 0;
-}
-
-void
-KWD::trapXError (void)
-{
- trappedErrorCode = 0;
- oldErrorHandler = XSetErrorHandler (xErrorHandler);
-}
-
-int
-KWD::popXError (void)
-{
- XSync (QX11Info::display(), false);
- XSetErrorHandler (oldErrorHandler);
-
- return trappedErrorCode;
-}
-
-void *
-KWD::readXProperty (WId window,
- Atom property,
- Atom type,
- int *items)
-{
- long offset = 0, length = 2048L;
- Atom actualType;
- int format;
- unsigned long nItems, bytesRemaining;
- unsigned char *data = 0l;
- int result;
-
- KWD::trapXError ();
- result = XGetWindowProperty (QX11Info::display(), window, property, offset,
- length, false, type,
- &actualType, &format, &nItems,
- &bytesRemaining, &data);
-
- if (KWD::popXError ())
- return NULL;
-
- if (result == Success && actualType == type && format == 32 && nItems > 0)
- {
- if (items)
- *items = nItems;
-
- return reinterpret_cast <void *>(data);
- }
-
- if (data)
- XFree (data);
-
- if (items)
- *items = 0;
-
- return NULL;
-}
-
-bool
-KWD::readWindowProperty (long window,
- long property,
- long *value)
-{
- void *data = readXProperty (window, property, XA_WINDOW, NULL);
-
- if (data)
- {
- if (value)
- *value = *reinterpret_cast <int *>(data);
-
- XFree (data);
-
- return true;
- }
-
- return false;
-}
-
-unsigned short
-KWD::readPropertyShort (WId id,
- Atom property,
- unsigned short defaultValue)
-{
- Atom actual;
- int result, format;
- unsigned long n, left;
- unsigned char *data;
-
- KWD::trapXError ();
- result = XGetWindowProperty (QX11Info::display(), id, property,
- 0L, 1L, FALSE, XA_CARDINAL, &actual, &format,
- &n, &left, &data);
- if (KWD::popXError ())
- return defaultValue;
-
- if (result == Success && n && data)
- {
- unsigned int value;
-
- memcpy (&value, data, sizeof (unsigned int));
-
- XFree (data);
-
- return value >> 16;
- }
-
- return defaultValue;
-}
-
-void
-KWD::Atoms::init (void)
-{
- Display *xdisplay = QX11Info::display();
-
- netFrameWindow = XInternAtom (xdisplay, "_NET_FRAME_WINDOW", false);
- netWindowDecor = XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, false);
- netWindowDecorNormal =
- XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, false);
- netWindowDecorActive =
- XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, false);
- netWindowDecorBare =
- XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, false);
- switchSelectWindow =
- XInternAtom (xdisplay, DECOR_SWITCH_WINDOW_ATOM_NAME, false);
- switchFgColor =
- XInternAtom (xdisplay, DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME, false);
- wmTakeFocus = XInternAtom (xdisplay, "WM_TAKE_FOCUS", false);
- netWmContextHelp =
- XInternAtom (xdisplay, "_NET_WM_CONTEXT_HELP", false);
- wmProtocols = XInternAtom (xdisplay, "WM_PROTOCOLS", false);
- netWmWindowOpacity =
- XInternAtom (xdisplay, "_NET_WM_WINDOW_OPACITY", false);
- toolkitActionAtom = XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION", false);
- toolkitActionWindowMenuAtom =
- XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_WINDOW_MENU", false);
- toolkitActionForceQuitDialogAtom =
- XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_FORCE_QUIT_DIALOG",
- false);
- compizWindowBlurDecor =
- XInternAtom (xdisplay, DECOR_BLUR_ATOM_NAME, false);
- enlightmentDesktop = XInternAtom (xdisplay, "ENLIGHTENMENT_DESKTOP", false);
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/utils.h compiz-0.8.8/kde/window-decorator-kde4/utils.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/utils.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/utils.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _UTILS_H
-#define _UTILS_H
-
-#include <X11/Xlib.h>
-#include <fixx11h.h>
-#include <QWidget>
-
-#include <qglobal.h>
-
-#if (QT_VERSION >= QT_VERSION_CHECK(4, 5, 0))
- #define QT_45
-#endif
-
-namespace KWD
-{
- namespace Atoms
- {
- extern Atom switchSelectWindow;
- extern Atom switchFgColor;
- extern Atom netWmWindowOpacity;
- extern Atom netFrameWindow;
- extern Atom netWindowDecor;
- extern Atom netWindowDecorNormal;
- extern Atom netWindowDecorActive;
- extern Atom netWindowDecorBare;
- extern Atom wmTakeFocus;
- extern Atom netWmContextHelp;
- extern Atom wmProtocols;
- extern Atom toolkitActionAtom;
- extern Atom toolkitActionWindowMenuAtom;
- extern Atom toolkitActionForceQuitDialogAtom;
- extern Atom compizWindowBlurDecor;
- extern Atom enlightmentDesktop;
-
- void init (void);
- }
-
- void trapXError (void);
- int popXError (void);
- bool eventFilter (void *message, long *result);
- void *readXProperty (WId window, Atom property, Atom type, int *items);
- bool readWindowProperty (long wId, long property, long *value);
- unsigned short readPropertyShort (WId id,
- Atom property,
- unsigned short defaultValue);
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/window.cpp compiz-0.8.8/kde/window-decorator-kde4/window.cpp
--- compiz-0.8.8-orig/kde/window-decorator-kde4/window.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/window.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,1884 +0,0 @@
-/*
- * Copyright © 2009 Dennis Kasprzyk <onestone@compiz-fusion.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "window.h"
-#include "decorator.h"
-#include "options.h"
-#include "utils.h"
-
-#include <X11/Xlib.h>
-#include <X11/extensions/shape.h>
-#include <X11/extensions/Xcomposite.h>
-#include <X11/Xregion.h>
-
-#include <fixx11h.h>
-
-#include <KDE/KGlobal>
-#include <KDE/KGlobalSettings>
-#include <KDE/KIconLoader>
-#include <kdecoration.h>
-#include <kwindowsystem.h>
-#include <KDE/KLocale>
-#include <KDE/KStandardDirs>
-#include <KDE/KAction>
-#include <KDE/KActionCollection>
-#include <KDE/KIcon>
-
-#include <QApplication>
-#include <QEvent>
-#include <QWidget>
-#include <QString>
-#include <QTimer>
-#include <QMenu>
-#include <QX11Info>
-#include <QObjectList>
-#include <QVector>
-#include <QProcess>
-#include <QStyle>
-#include <QPainter>
-
-#include "paintredirector.h"
-
-KWD::Window::Window (WId parentId,
- WId clientId,
- WId frame,
- Type type,
- int x,
- int y,
- int w,
- int h) :
- mType (type),
- mParentId (parentId),
- mFrame (0),
- mClientId (clientId),
- mSelectedId (0),
- mDecor (0),
- mPixmap (0),
- mUpdateProperty (false),
- mShapeSet (false),
- mPopup (0),
- mAdvancedMenu (0),
- mOpacityMenu (0),
- mDesktopMenu (0),
- mProcessKiller (this),
- mKeys (this),
- mResizeOpAction (0),
- mMoveOpAction (0),
- mMaximizeOpAction (0),
- mShadeOpAction (0),
- mKeepAboveOpAction (0),
- mKeepBelowOpAction (0),
- mFullScreenOpAction (0),
- mMinimizeOpAction (0),
- mCloseOpAction (0),
- mDesktopOpAction (0),
- mPaintRedirector (0)
-{
- memset (&mBorder, 0, sizeof (mBorder));
-
- if (mType == Normal)
- {
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId, NET::WMState |
- NET::WMVisibleName, 0);
-
- mState = wInfo.state ();
-
- if (mType == Normal)
- {
- mName = wInfo.visibleName ();
-
- mIcon = KWindowSystem::icon (mClientId, 32, 32, true,
- KWindowSystem::NETWM |
- KWindowSystem::WMHints );
-
- mMiniIcon = KWindowSystem::icon (mClientId, 16, 16, true,
- KWindowSystem::NETWM |
- KWindowSystem::WMHints );
-
- if (mIcon.isNull ())
- {
- mIcon = KWindowSystem::icon (mClientId, 32, 32, true,
- KWindowSystem::ClassHint |
- KWindowSystem::XApp );
- mMiniIcon = KWindowSystem::icon (mClientId, 16, 16, true,
- KWindowSystem::ClassHint |
- KWindowSystem::XApp );
- }
-
- mOpacity = readPropertyShort (mClientId, Atoms::netWmWindowOpacity,
- 0xffff);
- }
- else
- {
- mIcon = QPixmap ();
- mMiniIcon = QPixmap ();
- mName = QString ("");
- }
-
- updateFrame (frame);
-
- mGeometry = QRect (x, y, w, h);
-
- getWindowProtocols ();
- }
- else
- {
- mIcon = QPixmap ();
- mMiniIcon = QPixmap ();
- mName = QString ("");
- mGeometry = QRect (50, 50, 30, 1);
- }
-
- createDecoration ();
-
- mActiveChild = NULL;
-}
-
-KWD::Window::~Window (void)
-{
- if (mPixmap)
- XFreePixmap (QX11Info::display(), mPixmap);
-
- if (mDecor)
- delete mDecor;
-
- if (mPopup)
- delete mPopup;
-
- if (mPaintRedirector)
- delete mPaintRedirector;
-
- if (mProcessKiller.state () == QProcess::Running)
- {
- mProcessKiller.terminate ();
- mProcessKiller.waitForFinished (10000);
- if (mProcessKiller.state () == QProcess::Running)
- {
- mProcessKiller.kill ();
- mProcessKiller.waitForFinished (5000);
- }
- }
-}
-
-bool
-KWD::Window::isActive (void) const
-{
- if (mType == DefaultActive)
- return true;
-
- return Decorator::activeId () == mClientId;
-}
-
-bool
-KWD::Window::isCloseable (void) const
-{
- KWindowInfo wInfo;
-
- if (mType != Normal)
- return false;
-
- wInfo = KWindowSystem::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
- return wInfo.actionSupported (NET::ActionClose);
-}
-
-bool
-KWD::Window::isMaximizable (void) const
-{
- KWindowInfo wInfo;
-
- if (mType != Normal)
- return false;
-
- wInfo = KWindowSystem::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
- return wInfo.actionSupported (NET::ActionMax);
-}
-
-KDecoration::MaximizeMode
-KWD::Window::maximizeMode (void) const
-{
- MaximizeMode mode = MaximizeRestore;
-
- if (mType != Normal)
- return mode;
-
- mode =
- ((mState & NET::MaxVert) ? MaximizeVertical : MaximizeRestore) |
- ((mState & NET::MaxHoriz) ? MaximizeHorizontal : MaximizeRestore);
-
- return mode;
-}
-
-bool
-KWD::Window::isMinimizable (void) const
-{
- KWindowInfo wInfo;
-
- if (mType != Normal)
- return false;
-
- wInfo = KWindowSystem::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
- return wInfo.actionSupported (NET::ActionMinimize);
-}
-
-bool
-KWD::Window::providesContextHelp (void) const
-{
- if (mType != Normal)
- return false;
-
- return mSupportContextHelp;
-}
-
-int
-KWD::Window::desktop (void) const
-{
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId,
- NET::WMDesktop, 0);
-
- return wInfo.desktop ();
-}
-
-bool
-KWD::Window::isModal (void) const
-{
- return mState & NET::Modal;
-}
-
-bool
-KWD::Window::isShadeable (void) const
-{
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
-
- return wInfo.actionSupported (NET::ActionShade);
-}
-
-bool
-KWD::Window::isShade (void) const
-{
- if (mType != Normal)
- return false;
-
- return (mState & NET::Shaded);
-}
-
-bool
-KWD::Window::isSetShade (void) const
-{
- return isShade ();
-}
-
-bool
-KWD::Window::keepAbove (void) const
-{
- if (mType != Normal)
- return false;
-
- return (mState & NET::KeepAbove);
-}
-
-bool
-KWD::Window::keepBelow (void) const
-{
- if (mType != Normal)
- return false;
-
- return (mState & NET::KeepBelow);
-}
-
-bool
-KWD::Window::isMovable (void) const
-{
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
-
- return wInfo.actionSupported (NET::ActionMove);
-}
-
-NET::WindowType
-KWD::Window::windowType (unsigned long mask) const
-{
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId,
- NET::WMWindowType, 0);
-
- return wInfo.windowType (mask);
-}
-
-bool
-KWD::Window::isResizable (void) const
-{
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId, NET::WMPid,
- NET::WM2AllowedActions);
-
- return wInfo.actionSupported (NET::ActionResize);
-}
-
-QIcon
-KWD::Window::icon (void) const
-{
- QIcon icon (mIcon);
- icon.addPixmap (mMiniIcon);
- return icon;
-}
-
-QString
-KWD::Window::caption (void) const
-{
- return mName;
-}
-
-/* TODO: We should use libtaskmanager, which is part of kdebase to create
- the window menu instead but the headers for that library are currently
- not installed. If kdebase could install those headers, we wouldn't have
- to have our own window menu implementaion here. */
-void
-KWD::Window::showWindowMenu (const QPoint &pos)
-{
- if (!mPopup)
- {
- QAction *action;
- const int levels[] = { 100, 90, 75, 50, 25, 10 };
-
- mPopup = new QMenu ();
- mPopup->setFont (KGlobalSettings::menuFont ());
-
- connect (mPopup, SIGNAL (aboutToShow ()),
- SLOT (handlePopupAboutToShow ()));
- connect (mPopup, SIGNAL (triggered (QAction*)),
- SLOT (handlePopupActivated (QAction*)));
-
- mAdvancedMenu = new QMenu (mPopup);
- mAdvancedMenu->setFont (KGlobalSettings::menuFont ());
-
- mKeepAboveOpAction = mAdvancedMenu->addAction (i18n ("Keep &Above Others"));
- mKeepAboveOpAction->setIcon (KIcon ("go-up"));
- KAction *kaction = qobject_cast<KAction*>
- (mKeys.action ("Window Above Other Windows"));
- if (kaction != 0)
- mKeepAboveOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mKeepAboveOpAction->setCheckable (true);
- mKeepAboveOpAction->setData (KDecorationDefines::KeepAboveOp);
-
- mKeepBelowOpAction = mAdvancedMenu->addAction (i18n ("Keep &Below Others"));
- mKeepBelowOpAction->setIcon (KIcon ("go-down"));
- kaction = qobject_cast<KAction*>
- (mKeys.action ("Window Below Other Windows"));
- if (kaction != 0)
- mKeepBelowOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mKeepBelowOpAction->setCheckable (true);
- mKeepBelowOpAction->setData (KDecorationDefines::KeepBelowOp);
-
- mFullScreenOpAction = mAdvancedMenu->addAction (i18n ("&Fullscreen"));
- mFullScreenOpAction->setIcon (KIcon ("view-fullscreen"));
- kaction = qobject_cast<KAction*> (mKeys.action ("Window Fullscreen"));
- if (kaction != 0)
- mFullScreenOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mFullScreenOpAction->setCheckable (true);
- mFullScreenOpAction->setData (KDecorationDefines::FullScreenOp);
-
- action = mPopup->addMenu (mAdvancedMenu);
- action->setText (i18n ("Ad&vanced"));
-
- mOpacityMenu = new QMenu (mPopup);
- mOpacityMenu->setFont (KGlobalSettings::menuFont ());
-
- connect (mOpacityMenu, SIGNAL (triggered (QAction*)),
- SLOT (handleOpacityPopupActivated (QAction*)));
-
-
- for( unsigned int i = 0; i < sizeof (levels) / sizeof (levels[0]); ++i)
- {
- action = mOpacityMenu->addAction
- (QString::number (levels[i]) + "%");
- action->setCheckable (true);
- action->setData (levels[i]);
- }
- action = mPopup->addMenu (mOpacityMenu);
- action->setText (i18n ("&Opacity"));
-
-
- mDesktopMenu = new QMenu (mPopup);
- mDesktopMenu->setFont (KGlobalSettings::menuFont ());
-
- connect (mDesktopMenu, SIGNAL (triggered (QAction*)),
- SLOT (handleDesktopPopupActivated (QAction*)));
-
- mDesktopOpAction = mPopup->addMenu (mDesktopMenu);
- mDesktopOpAction->setText (i18n ("To &Desktop"));
-
- mMoveOpAction = mPopup->addAction (i18n ("&Move"));
- mMoveOpAction->setIcon (KIcon ("move"));
- kaction = qobject_cast<KAction*> (mKeys.action ("Window Move"));
- if (kaction != 0)
- mMoveOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mMoveOpAction->setData (KDecorationDefines::MoveOp);
-
- mResizeOpAction = mPopup->addAction (i18n ("Re&size"));
- kaction = qobject_cast<KAction*> (mKeys.action("Window Resize"));
- if (kaction != 0)
- mResizeOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mResizeOpAction->setData (KDecorationDefines::ResizeOp);
-
- mMinimizeOpAction = mPopup->addAction (i18n ("Mi&nimize"));
- kaction = qobject_cast<KAction*> (mKeys.action ("Window Minimize"));
- if (kaction != 0)
- mMinimizeOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mMinimizeOpAction->setData (KDecorationDefines::MinimizeOp);
-
- mMaximizeOpAction = mPopup->addAction (i18n ("Ma&ximize"));
- kaction = qobject_cast<KAction*> (mKeys.action ("Window Maximize"));
- if (kaction != 0)
- mMaximizeOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mMaximizeOpAction->setCheckable (true);
- mMaximizeOpAction->setData (KDecorationDefines::MaximizeOp);
-
- mShadeOpAction = mPopup->addAction (i18n ("Sh&ade"));
- kaction = qobject_cast<KAction*> (mKeys.action ("Window Shade"));
- if (kaction != 0)
- mShadeOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mShadeOpAction->setCheckable (true);
- mShadeOpAction->setData (KDecorationDefines::ShadeOp);
-
- mPopup->addSeparator ();
-
- mCloseOpAction = mPopup->addAction (i18n("&Close"));
- mCloseOpAction->setIcon (KIcon ("window-close" ));
- kaction = qobject_cast<KAction*> (mKeys.action("Window Close"));
- if (kaction != 0)
- mCloseOpAction->setShortcut (kaction->globalShortcut ().primary ());
- mCloseOpAction->setData (KDecorationDefines::CloseOp);
- }
-
- QPoint pnt = mDecor->widget ()->mapFromGlobal (pos);
-
- pnt += QPoint (mGeometry.x () - mBorder.left - mPadding.left,
- mGeometry.y () - mBorder.top - mPadding.top);
-
- mPopup->exec (pnt);
-}
-
-void
-KWD::Window::showWindowMenu (const QRect &pos)
-{
- showWindowMenu (pos.bottomLeft ());
-}
-
-KWD::Options::MouseCommand
-KWD::Window::buttonToCommand (Qt::MouseButtons button)
-{
- Options::MouseCommand com = Options::MouseNothing;
- bool active = isActive ();
-
- if (!mSupportTakeFocus)
- active = true;
-
- switch (button) {
- case Qt::LeftButton:
- com = active ? Decorator::options ()->commandActiveTitlebar1 () :
- Decorator::options()->commandInactiveTitlebar1 ();
- break;
- case Qt::MidButton:
- com = active ? Decorator::options ()->commandActiveTitlebar2 () :
- Decorator::options()->commandInactiveTitlebar2 ();
- break;
- case Qt::RightButton:
- com = active ? Decorator::options ()->commandActiveTitlebar3 () :
- Decorator::options()->commandInactiveTitlebar3 ();
- default:
- break;
- }
-
- return com;
-}
-
-void
-KWD::Window::processMousePressEvent (QMouseEvent *qme)
-{
- Options::MouseCommand com = buttonToCommand (qme->button ());
-
- if (qme->button () == Qt::LeftButton)
- {
- // actions where it's not possible to get the matching release event
- if (com != Options::MouseOperationsMenu &&
- com != Options::MouseMinimize)
- {
- moveWindow (qme);
- return;
- }
- }
-
- performMouseCommand (com, qme);
-}
-
-void
-KWD::Window::performWindowOperation (WindowOperation wo)
-{
- switch (wo) {
- case KDecoration::MaximizeOp:
- maximize (maximizeMode () == KDecoration::MaximizeFull ?
- KDecoration::MaximizeRestore : KDecoration::MaximizeFull);
- break;
- case KDecoration::HMaximizeOp:
- maximize (maximizeMode () ^ KDecoration::MaximizeHorizontal);
- break;
- case KDecoration::VMaximizeOp:
- maximize (maximizeMode () ^ KDecoration::MaximizeVertical);
- break;
- case KDecoration::MinimizeOp:
- minimize ();
- break;
- case KDecoration::ShadeOp:
- setShade (!isShade ());
- break;
- case KDecoration::CloseOp:
- closeWindow ();
- break;
- case KDecoration::KeepAboveOp:
- setKeepAbove (!keepAbove ());
- break;
- case KDecoration::KeepBelowOp:
- setKeepBelow (!keepBelow ());
- break;
- case KDecoration::FullScreenOp:
- if (mState & NET::FullScreen)
- KWindowSystem::clearState (mClientId, NET::FullScreen);
- else
- KWindowSystem::setState (mClientId, NET::FullScreen);
- break;
- case KDecoration::MoveOp:
- Decorator::rootInfo ()->moveResizeRequest (mClientId,
- mGeometry.x () +
- mGeometry.width () / 2,
- mGeometry.y () +
- mGeometry.height () / 2,
- NET::KeyboardMove);
- break;
- case KDecoration::ResizeOp:
- Decorator::rootInfo ()->moveResizeRequest (mClientId,
- mGeometry.x () +
- mGeometry.width () / 2,
- mGeometry.y () +
- mGeometry.height () / 2,
- NET::KeyboardSize);
- default:
- break;
- }
-}
-
-bool
-KWD::Window::isPreview (void) const
-{
- return false;
-}
-
-QRect
-KWD::Window::geometry (void) const
-{
- QRect rect = mGeometry;
-
- return QRect (rect.x () - ROOT_OFF_X,
- rect.y () - ROOT_OFF_Y,
- rect.width (),
- rect.height ());
-}
-
-QRect
-KWD::Window::iconGeometry (void) const
-{
- return QRect ();
-}
-
-QRect
-KWD::Window::clientGeometry (void)
-{
- return mGeometry;
-
- QRect frame = geometry ();
-
- return QRect (frame.x () + mBorder.left,
- frame.y () + mBorder.top,
- frame.width () - mBorder.left - mBorder.right,
- frame.height () - mBorder.top - mBorder.bottom);
-}
-
-QRegion
-KWD::Window::unobscuredRegion (const QRegion & r) const
-{
- return r;
-}
-
-WId
-KWD::Window::windowId (void) const
-{
- return mClientId;
-}
-
-void
-KWD::Window::closeWindow (void)
-{
- Decorator::rootInfo ()->closeWindowRequest (mClientId);
-}
-
-void
-KWD::Window::maximize (MaximizeMode mode)
-{
- KWindowSystem::setState (mClientId,
- ((mode & MaximizeVertical) ? NET::MaxVert : 0) |
- ((mode & MaximizeHorizontal) ? NET::MaxHoriz : 0));
- KWindowSystem::clearState (mClientId,
- ((mode & MaximizeVertical) ? 0 : NET::MaxVert) |
- ((mode & MaximizeHorizontal) ? 0 : NET::MaxHoriz));
-}
-
-void
-KWD::Window::minimize (void)
-{
- KWindowSystem::minimizeWindow (mClientId, false);
-}
-
-void
-KWD::Window::showContextHelp (void)
-{
- if (mSupportContextHelp)
- KWD::Decorator::sendClientMessage (mClientId, mClientId,
- Atoms::wmProtocols,
- Atoms::netWmContextHelp);
-}
-
-void
-KWD::Window::titlebarDblClickOperation (void)
-{
- WindowOperation op;
-
- op = KWD::Decorator::options ()->operationTitlebarDblClick ();
- performWindowOperation (op);
-}
-
-void
-KWD::Window::setDesktop (int desktop)
-{
- KWindowSystem::setOnDesktop (mClientId, desktop);
-}
-
-void
-KWD::Window::setKeepBelow (bool set)
-{
- if (set)
- {
- KWindowSystem::clearState (mClientId, NET::KeepAbove);
- KWindowSystem::setState (mClientId, NET::KeepBelow);
- }
- else
- {
- KWindowSystem::clearState (mClientId, NET::KeepBelow);
- }
-}
-
-void
-KWD::Window::setKeepAbove (bool set)
-{
- if (set)
- {
- KWindowSystem::clearState (mClientId, NET::KeepBelow);
- KWindowSystem::setState (mClientId, NET::KeepAbove);
- }
- else
- {
- KWindowSystem::clearState (mClientId, NET::KeepAbove);
- }
-}
-
-void
-KWD::Window::setShade (bool set)
-{
- if (set)
- KWindowSystem::setState (mClientId, NET::Shaded);
- else
- KWindowSystem::clearState (mClientId, NET::Shaded);
-
- mDecor->shadeChange ();
-}
-
-void
-KWD::Window::titlebarMouseWheelOperation (int delta)
-{
- Options::MouseCommand com;
-
- com = Decorator::options()->operationTitlebarMouseWheel (delta);
- performMouseCommand (com, 0);
-}
-
-int
-KWD::Window::currentDesktop (void) const
-{
- return KWindowSystem::currentDesktop ();
-}
-
-QWidget *
-KWD::Window::initialParentWidget (void) const
-{
- return 0;
-}
-
-Qt::WFlags
-KWD::Window::initialWFlags (void) const
-{
- return 0;
-}
-
-void
-KWD::Window::grabXServer (bool)
-{
-}
-
-bool
-KWD::Window::compositingActive (void) const
-{
- return true;
-}
-
-#if KDE_IS_VERSION(4,3,90)
-
-QRect
-KWD::Window::transparentRect () const
-{
- return QRect ();
-}
-
-bool
-KWD::Window::isClientGroupActive ()
-{
- return false;
-}
-
-QList<ClientGroupItem>
-KWD::Window::clientGroupItems () const
-{
- QList<ClientGroupItem> items;
-
- QIcon icon (mIcon);
- icon.addPixmap (mMiniIcon);
-
- items.append (ClientGroupItem (mName, icon));
-
- return items;
-}
-
-long
-KWD::Window::itemId (int index)
-{
- return (long) mClientId;
-}
-
-int
-KWD::Window::visibleClientGroupItem ()
-{
- return 0;
-}
-
-void
-KWD::Window::setVisibleClientGroupItem (int index)
-{
-}
-
-void
-KWD::Window::moveItemInClientGroup (int index, int before)
-{
-}
-
-void
-KWD::Window::moveItemToClientGroup (long itemId, int before)
-{
-}
-
-void
-KWD::Window::removeFromClientGroup (int index, const QRect& newGeom)
-{
-}
-
-void
-KWD::Window::closeClientGroupItem (int index)
-{
- closeWindow ();
-}
-
-void
-KWD::Window::closeAllInClientGroup ()
-{
- closeWindow ();
-}
-
-void
-KWD::Window::displayClientMenu (int index, const QPoint& pos)
-{
- showWindowMenu (pos);
-}
-
-KDecorationDefines::WindowOperation
-KWD::Window::buttonToWindowOperation(Qt::MouseButtons button)
-{
- Options::MouseCommand com = buttonToCommand (button);
-
- if (com == Options::MouseOperationsMenu)
- return KDecorationDefines::OperationsOp;
-
- return KDecorationDefines::NoOp;
-}
-
-#endif
-
-void
-KWD::Window::createDecoration (void)
-{
- KDecoration *decor;
-
- if (mDecor)
- return;
-
- decor = Decorator::pluginManager ()->createDecoration (this);
- decor->init ();
-
- mDecor = decor;
-
- mDecor->widget ()->installEventFilter (this);
-
- mPaintRedirector = new KWin::PaintRedirector (mDecor->widget ());
- connect (mPaintRedirector, SIGNAL (paintPending()),
- this, SLOT (decorRepaintPending ()));
-
- mPadding.top = mPadding.bottom = mPadding.left = mPadding.right = 0;
-
- if (KDecorationUnstable *deco2 = dynamic_cast<KDecorationUnstable*>(decor))
- deco2->padding (mPadding.left, mPadding.right, mPadding.top, mPadding.bottom);
-
- XReparentWindow (QX11Info::display(), mDecor->widget ()->winId (), mParentId, 0, 0);
-
- //decor->widget()->move(-mPadding.left, -mPadding.top);
-
- if (mType == Normal && mFrame)
- {
- KWD::trapXError ();
- XSelectInput (QX11Info::display(), mFrame,
- StructureNotifyMask | PropertyChangeMask |
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
- EnterWindowMask | LeaveWindowMask);
- if (KWD::popXError ())
- return;
- }
-
- resizeDecoration (true);
-}
-
-void
-KWD::Window::setMask (const QRegion &region, int)
-{
- if (region.isEmpty ())
- {
- mShapeSet = false;
- return;
- }
-
- if (mShapeSet && region == mShape)
- return;
-
- mShape = region;
- mShapeSet = true;
-
- if (mFrame)
- {
- QRegion r = region.translated (-mPadding.left, -mPadding.top);
-
- r -= QRegion (mBorder.left, mBorder.top,
- mGeometry.width (), mGeometry.height ());
-
- KWD::trapXError ();
- XShapeCombineRegion (QX11Info::display(),
- mFrame,
- ShapeInput,
- 0,
- 0,
- r.handle (),
- ShapeSet);
- KWD::popXError ();
- }
-}
-
-void
-KWD::Window::resizeDecoration (bool force)
-{
- int w, h;
-
- mDecor->borders (mBorder.left, mBorder.right, mBorder.top, mBorder.bottom);
-
- mExtents.left = mBorder.left + mPadding.left;
- mExtents.right = mBorder.right + mPadding.right;
- mExtents.top = mBorder.top + mPadding.top;
- mExtents.bottom = mBorder.bottom + mPadding.bottom;
-
- if (mType != Normal)
- {
- mGeometry = QRect (50, 50, 100, 100);
- }
-
- w = mGeometry.width () + mExtents.left + mExtents.right;
- h = mGeometry.height () + mExtents.top + mExtents.bottom;
-
- if (!force)
- {
- if (w == decorWidget ()->width () && h == decorWidget ()->height ())
- return;
- }
-
- /* reset shape */
- mShapeSet = false;
-
- if (mPixmap)
- {
- XFreePixmap (QX11Info::display(), mPixmap);
- mPixmap = None;
- }
-
- mDecor->resize (QSize (w, h));
- mDecor->widget ()->show ();
- mDecor->widget ()->update ();
-
- mPixmap = XCreatePixmap (QX11Info::display(),
- QX11Info::appRootWindow (),
- qMax (w, mGeometry.height ()),
- mExtents.top + mExtents.bottom +
- mExtents.left + mExtents.right, 32);
-
- mPixmapQt = QPixmap::fromX11Pixmap (mPixmap, QPixmap::ExplicitlyShared);
-
- mPixmapQt.fill (Qt::transparent);
-
- mUpdateProperty = true;
-}
-
-void
-KWD::Window::updateBlurProperty (int topOffset,
- int bottomOffset,
- int leftOffset,
- int rightOffset)
-{
- Atom atom = Atoms::compizWindowBlurDecor;
- QRegion topQRegion, bottomQRegion, leftQRegion, rightQRegion;
- Region topRegion = NULL;
- Region bottomRegion = NULL;
- Region leftRegion = NULL;
- Region rightRegion = NULL;
- int size = 0;
- int w, h;
-
- w = mGeometry.width () + mBorder.left + mBorder.right;
- h = mGeometry.height () + mBorder.top + mBorder.bottom;
-
- if (blurType != BLUR_TYPE_NONE)
- {
- QRegion r, shape = QRegion (0, 0, w, h);
-
- if (mShapeSet)
- shape = mShape.translated (-mPadding.left, -mPadding.top);
-
- r = QRegion (0, 0, w, mBorder.top);
- topQRegion = r.intersect (shape);
- if (!topQRegion.isEmpty ())
- {
- topQRegion.translate (-mBorder.left,
- -mBorder.top);
- topRegion = topQRegion.handle ();
- }
-
- if (blurType == BLUR_TYPE_ALL)
- {
- r = QRegion (0, h - mBorder.bottom,
- w, mBorder.bottom);
- bottomQRegion = r.intersect (shape);
- if (!bottomQRegion.isEmpty ())
- {
- bottomQRegion.translate (-mBorder.left,
- -(h - mBorder.bottom));
- bottomRegion = bottomQRegion.handle ();
- }
-
- r = QRegion (0, mBorder.top,
- mBorder.left, mGeometry.height ());
- leftQRegion = r.intersect (shape);
- if (!leftQRegion.isEmpty ())
- {
- leftQRegion.translate (-mBorder.left,
- -mBorder.top);
- leftRegion = leftQRegion.handle ();
- }
-
- r = QRegion (w - mBorder.right, mBorder.top,
- mBorder.right, mGeometry.height ());
- rightQRegion = r.intersect (shape);
- if (!rightQRegion.isEmpty ())
- {
- rightQRegion.translate (-(w - mBorder.right),
- -mBorder.top);
- rightRegion = rightQRegion.handle ();
- }
- }
- }
-
- if (topRegion)
- size += topRegion->numRects;
- if (bottomRegion)
- size += bottomRegion->numRects;
- if (leftRegion)
- size += leftRegion->numRects;
- if (rightRegion)
- size += rightRegion->numRects;
-
- if (size)
- {
- long data[size * 6 + 2];
-
- decor_region_to_blur_property (data, 4, 0,
- mGeometry.width (),
- mGeometry.height (),
- topRegion, topOffset,
- bottomRegion, bottomOffset,
- leftRegion, leftOffset,
- rightRegion, rightOffset);
-
- KWD::trapXError ();
- XChangeProperty (QX11Info::display(), mClientId, atom,
- XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- 2 + size * 6);
- KWD::popXError ();
- }
- else
- {
- KWD::trapXError ();
- XDeleteProperty (QX11Info::display(), mClientId, atom);
- KWD::popXError ();
- }
-}
-
-void
-KWD::Window::updateProperty (void)
-{
- Atom atom = Atoms::netWindowDecor;
- decor_extents_t maxExtents;
- long data[256];
- decor_quad_t quads[N_QUADS_MAX];
- int nQuad = 0;
- int left, right, top, bottom, width, height;
- unsigned int saveState;
-
- if (mType == Default)
- atom = Atoms::netWindowDecorNormal;
- else if (mType == DefaultActive)
- atom = Atoms::netWindowDecorActive;
-
- saveState = mState;
- mState = NET::MaxVert | NET::MaxHoriz;
- mDecor->borders (maxExtents.left, maxExtents.right,
- maxExtents.top, maxExtents.bottom);
- mState = saveState;
- mDecor->borders (mBorder.left, mBorder.right, mBorder.top, mBorder.bottom);
-
- left = mExtents.left;
- right = mExtents.right;
- top = mExtents.top;
- bottom = mExtents.bottom;
- width = mGeometry.width ();
- height = mGeometry.height ();
-
- if (mType == Normal)
- {
- decor_quad_t *q = quads;
- int n = 0;
-
- int topXOffset = width;
- QWidget *widget = mDecor->widget ();
- int x;
-
- if (widget)
- {
- const QList<QObject*> children = widget->children ();
-
- foreach (QObject *obj, children)
- {
- QWidget *child;
-
- if (!obj->isWidgetType ())
- continue;
-
- child = static_cast <QWidget *> (obj);
-
- x = child->x () - mExtents.left - 2;
- if (x > width / 2 && x < topXOffset)
- topXOffset = x;
- }
- }
-
- // top quads
- n = decor_set_horz_quad_line (q, left, topXOffset, right,
- width - topXOffset - 1, -top, 0, GRAVITY_NORTH,
- left + right + width, -(width - topXOffset - 1),
- GRAVITY_EAST, 0, 0);
-
- q += n; nQuad += n;
-
- // bottom quads
- n = decor_set_horz_quad_line (q, left, width / 2, right, (width / 2) - 1, 0,
- bottom, GRAVITY_SOUTH, left + right + width,
- -((width / 2) - 1), GRAVITY_EAST, 0, top);
-
- q += n; nQuad += n;
-
- // left quads
- n = decor_set_vert_quad_row (q, 0, height / 2, 0, (height / 2) - 1, -left, 0,
- GRAVITY_WEST, height, -((height / 2) - 1),
- GRAVITY_SOUTH, 0, top + bottom, 1);
-
- q += n; nQuad += n;
-
- // right quads
- n = decor_set_vert_quad_row (q, 0, height / 2, 0, (height / 2) - 1, 0, right,
- GRAVITY_EAST, height, -((height / 2) - 1),
- GRAVITY_SOUTH, 0, top + bottom + left, 1);
-
- q += n; nQuad += n;
-
- updateBlurProperty (topXOffset, width / 2, height / 2, height / 2);
- }
- else
- {
- decor_quad_t *q = quads;
- int n = 0;
-
- // top
- n = decor_set_horz_quad_line (q, left, 0, right, 0, -top, 0,
- GRAVITY_NORTH, left + right + width,
- width / 2, 0, 0, 0);
-
- q += n; nQuad += n;
-
- // bottom
- n = decor_set_horz_quad_line (q, left, 0, right, 0, 0, bottom,
- GRAVITY_SOUTH, left + right + width,
- width / 2, 0, 0, top);
-
- q += n; nQuad += n;
-
- // left
- n = decor_set_vert_quad_row (q, 0, 0, 0, 0, -left, 0, GRAVITY_WEST,
- height, height / 2, 0, 0, top + bottom, 1);
-
- q += n; nQuad += n;
-
- // right
- n = decor_set_vert_quad_row (q, 0, 0, 0, 0, 0, right, GRAVITY_EAST,
- height, height / 2, 0, 0, top + bottom + left, 1);
-
- q += n; nQuad += n;
- }
-
- decor_quads_to_property (data, mPixmap,
- &mBorder, &maxExtents,
- 1, 0,
- quads, nQuad);
-
- KWD::trapXError ();
- XChangeProperty (QX11Info::display(), mClientId, atom,
- XA_INTEGER,
- 32, PropModeReplace, (unsigned char *) data,
- BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
- KWD::popXError ();
-
- mUpdateProperty = false;
-}
-
-void
-KWD::Window::handleActiveChange (void)
-{
- mDecor->activeChange ();
- resizeDecoration ();
-}
-
-void
-KWD::Window::updateFrame (WId frame)
-{
- mFrame = frame;
-
- KWD::trapXError ();
- XSelectInput (QX11Info::display(), mFrame,
- StructureNotifyMask | PropertyChangeMask |
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
- EnterWindowMask | LeaveWindowMask);
- KWD::popXError ();
-}
-
-void
-KWD::Window::updateSelected (WId selectedId)
-{
- mSelectedId = selectedId;
-
- updateName ();
-}
-
-void
-KWD::Window::updateWindowGeometry (void)
-{
- KWD::trapXError ();
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId, NET::WMGeometry);
- KWD::popXError ();
-
- if (!wInfo.valid ())
- return;
-
- QRect geometry = wInfo.geometry ();
- int w, h;
-
- w = mGeometry.width () + mBorder.left + mBorder.right;
- h = mGeometry.height () + mBorder.top + mBorder.bottom;
-
- if (mGeometry.width () != geometry.width () ||
- mGeometry.height () != geometry.height ())
- {
- mGeometry = geometry;
- resizeDecoration ();
- }
- else if (mGeometry.x () != geometry.x () ||
- mGeometry.y () != geometry.y ())
- {
- mGeometry = geometry;
- }
-}
-
-void
-KWD::Window::reloadDecoration (void)
-{
- delete mDecor;
- mDecor = 0;
-
- delete mPaintRedirector;
- mPaintRedirector = 0;
-
- mShapeSet = false;
-
- createDecoration ();
-}
-
-Cursor
-KWD::Window::positionToCursor (QPoint pos)
-{
- switch (mDecor->mousePosition (pos + QPoint (mPadding.left, mPadding.top))) {
- case PositionCenter:
- return cursors[1][1].cursor;
- case PositionLeft:
- return cursors[1][0].cursor;
- case PositionRight:
- return cursors[1][2].cursor;
- case PositionTop:
- return cursors[0][1].cursor;
- case PositionBottom:
- return cursors[2][1].cursor;
- case PositionTopLeft:
- return cursors[0][0].cursor;
- case PositionTopRight:
- return cursors[0][2].cursor;
- case PositionBottomLeft:
- return cursors[2][0].cursor;
- case PositionBottomRight:
- return cursors[2][2].cursor;
- default:
- break;
- }
-
- return cursors[1][1].cursor;
-}
-
-void
-KWD::Window::updateCursor (QPoint pos)
-{
- KWD::trapXError ();
- XDefineCursor (QX11Info::display(), mFrame, positionToCursor (pos));
- KWD::popXError ();
-}
-
-void
-KWD::Window::getWindowProtocols (void)
-{
- Atom *p;
- int n;
- int status;
-
- mSupportTakeFocus = false;
- mSupportContextHelp = false;
-
- KWD::trapXError ();
- status = XGetWMProtocols (QX11Info::display(), mClientId, &p, &n);
- if (KWD::popXError ())
- return;
-
- if (status)
- {
- int i;
-
- for (i = 0; i < n; i++)
- {
- if (p[i] == Atoms::wmTakeFocus)
- mSupportTakeFocus = true;
- else if (p[i] == Atoms::netWmContextHelp)
- mSupportContextHelp = true;
- }
-
- if (n > 0)
- XFree (p);
- }
-}
-
-void
-KWD::Window::handlePopupActivated (QAction * action)
-{
- WindowOperation op = static_cast <WindowOperation> (action->data().toInt());
-
- performWindowOperation (op);
-}
-
-void
-KWD::Window::handleOpacityPopupActivated (QAction *action)
-{
- int op = action->data().toInt();
-
- op = op * 0xffff / 100;
-
- if (op != mOpacity)
- Decorator::sendClientMessage (QX11Info::appRootWindow(), mClientId,
- Atoms::netWmWindowOpacity,
- (op << 16) | op);
-}
-
-
-void
-KWD::Window::handleDesktopPopupActivated (QAction *action)
-{
-
- if (action->data().toInt())
- setDesktop (action->data().toInt());
- else
- KWindowSystem::setOnAllDesktops (mClientId, true);
-}
-
-void
-KWD::Window::handlePopupAboutToShow (void)
-{
- int numberOfDesktops;
-
- numberOfDesktops = KWindowSystem::numberOfDesktops ();
- if (numberOfDesktops > 1)
- {
- NETRootInfo *rootInfo = Decorator::rootInfo ();
- QString name;
- int i;
- int winDesktop = desktop ();
- QAction *action;
- const int BASE = 10;
-
- mDesktopMenu->clear ();
-
- action = mDesktopMenu->addAction (i18n ("&All Desktops"));
- action->setData (0);
- action->setCheckable (true);
-
-
- action->setChecked (winDesktop == NET::OnAllDesktops);
- mDesktopMenu->addSeparator ();
-
- for (i = 1; i <= numberOfDesktops; i++)
- {
- QString basic_name ("%1 %2");
- if (i < BASE)
- basic_name.prepend ('&');
-
- basic_name = basic_name.arg (i).arg (
- QString (rootInfo->desktopName (i)).replace
- ('&', "&&"));
-
- action = mDesktopMenu->addAction (basic_name);
- action->setData (i);
- action->setCheckable (true);
- action->setChecked (winDesktop == i);
- }
-
- mDesktopOpAction->setVisible (true);
- }
- else
- {
- mDesktopOpAction->setVisible (false);
- }
-
- mResizeOpAction->setEnabled (isResizable ());
- mMoveOpAction->setEnabled (isMovable ());
-
- mMaximizeOpAction->setEnabled (isMaximizable ());
- mMaximizeOpAction->setChecked (maximizeMode () == MaximizeFull);
-
- mShadeOpAction->setChecked (isShade ());
- mShadeOpAction->setEnabled (isShadeable ());
-
- mKeepAboveOpAction->setChecked (keepAbove ());
- mKeepBelowOpAction->setChecked (keepBelow ());
- mFullScreenOpAction->setChecked (mState & NET::FullScreen);
-
- mMinimizeOpAction->setEnabled (isMinimizable ());
- mCloseOpAction->setEnabled (isCloseable ());
-
- foreach (QAction* action, mOpacityMenu->actions ())
- {
- if(action->data ().toInt () ==
- qRound ((float)mOpacity * 100.0 / 0xffff))
- action->setChecked( true );
- else
- action->setChecked( false );
- }
-
-}
-
-void
-KWD::Window::updateState (void)
-{
- KWindowInfo wInfo = KWindowSystem::windowInfo (mClientId, NET::WMState, 0);
-
- unsigned long newState = wInfo.state ();
- unsigned long stateChange = mState ^ newState;
-
- mState = newState;
-
- if (stateChange & NET::Max)
- {
- mDecor->maximizeChange ();
- resizeDecoration (false);
- }
-
- if (stateChange & NET::KeepAbove && !(mState & NET::KeepAbove))
- mDecor->emitKeepAboveChanged (mState & NET::KeepAbove);
- if (stateChange & NET::KeepBelow && !(mState & NET::KeepBelow))
- mDecor->emitKeepBelowChanged (mState & NET::KeepBelow);
- if (stateChange & NET::KeepAbove && mState & NET::KeepAbove)
- mDecor->emitKeepAboveChanged (mState & NET::KeepAbove);
- if (stateChange & NET::KeepBelow && mState & NET::KeepBelow)
- mDecor->emitKeepBelowChanged (mState & NET::KeepBelow);
- if (stateChange & NET::Shaded)
- mDecor->shadeChange ();
- if (stateChange & NET::Sticky)
- mDecor->desktopChange ();
-}
-
-void
-KWD::Window::updateName (void)
-{
- KWindowInfo wInfo;
-
- wInfo = KWindowSystem::windowInfo (mClientId, NET::WMVisibleName, 0);
-
- mName = wInfo.visibleName ();
-
- mDecor->captionChange ();
-}
-
-void
-KWD::Window::updateIcons (void)
-{
- mIcon = KWindowSystem::icon (mClientId, 32, 32, true,
- KWindowSystem::NETWM |
- KWindowSystem::WMHints);
-
- mMiniIcon = KWindowSystem::icon (mClientId, 16, 16, true,
- KWindowSystem::NETWM |
- KWindowSystem::WMHints);
-
- if (mIcon.isNull ())
- {
- mIcon = KWindowSystem::icon (mClientId, 32, 32, true,
- KWindowSystem::ClassHint |
- KWindowSystem::XApp );
- mMiniIcon = KWindowSystem::icon (mClientId, 16, 16, true,
- KWindowSystem::ClassHint |
- KWindowSystem::XApp );
- }
-
- mDecor->iconChange ();
-}
-
-NET::Direction
-KWD::Window::positionToDirection (int pos)
-{
- switch (pos) {
- case PositionLeft:
- return NET::Left;
- case PositionRight:
- return NET::Right;
- case PositionTop:
- return NET::Top;
- case PositionBottom:
- return NET::Bottom;
- case PositionTopLeft:
- return NET::TopLeft;
- case PositionTopRight:
- return NET::TopRight;
- case PositionBottomLeft:
- return NET::BottomLeft;
- case PositionBottomRight:
- return NET::BottomRight;
- default:
- break;
- }
-
- return NET::Move;
-}
-
-void
-KWD::Window::moveWindow (QMouseEvent *qme)
-{
- NET::Direction direction;
-
- direction = positionToDirection (mDecor->mousePosition (qme->pos ()));
-
- QPoint p (mGeometry.x () - mExtents.left, mGeometry.y () - mExtents.top);
- p += qme->pos ();
-
- XUngrabPointer (QX11Info::display(), CurrentTime);
- XUngrabKeyboard (QX11Info::display(), CurrentTime);
-
- Decorator::rootInfo ()->restackRequest (mClientId, NET::FromApplication,
- None, Above,
- QX11Info::appTime());
-
- Decorator::rootInfo ()->moveResizeRequest (mClientId,
- p.x (),
- p.y (),
- direction);
- mFakeRelease = true;
-
-}
-
-#define OPACITY_STEP (0xffff / 10)
-
-void
-KWD::Window::performMouseCommand (Options::MouseCommand command,
- QMouseEvent *qme)
-{
- switch (command) {
- case Options::MouseRaise:
- KWindowSystem::raiseWindow (mClientId);
- break;
- case Options::MouseLower:
- KWindowSystem::lowerWindow (mClientId);
- break;
- case Options::MouseShade :
- setShade (!isShade ());
- break;
- case Options::MouseSetShade:
- setShade (true);
- break;
- case Options::MouseUnsetShade:
- setShade (false);
- break;
- case Options::MouseOperationsMenu:
- showWindowMenu (mDecor->widget ()->mapToGlobal (qme->pos ()));
- break;
- case Options::MouseMaximize:
- maximize (KDecoration::MaximizeFull);
- break;
- case Options::MouseRestore:
- maximize (KDecoration::MaximizeRestore);
- break;
- case Options::MouseMinimize:
- minimize ();
- break;
- case Options::MouseAbove:
- if (keepBelow ())
- setKeepBelow (false);
- else
- setKeepAbove (true);
- break;
- case Options::MouseBelow:
- if (keepAbove ())
- setKeepAbove (false);
- else
- setKeepBelow (true);
- break;
- case Options::MousePreviousDesktop:
- break;
- case Options::MouseNextDesktop:
- break;
- case Options::MouseOpacityMore:
- {
- int opacity = mOpacity;
-
- if (opacity < 0xffff)
- {
- opacity += OPACITY_STEP;
- if (opacity > 0xffff)
- opacity = 0xffff;
-
- Decorator::sendClientMessage (QX11Info::appRootWindow(),
- mClientId,
- Atoms::netWmWindowOpacity,
- (opacity << 16) | opacity);
- }
- } break;
- case Options::MouseOpacityLess:
- {
- int opacity = mOpacity;
-
- if (opacity > OPACITY_STEP)
- {
- opacity -= OPACITY_STEP;
- if (opacity < OPACITY_STEP)
- opacity = OPACITY_STEP;
-
- Decorator::sendClientMessage (QX11Info::appRootWindow(),
- mClientId,
- Atoms::netWmWindowOpacity,
- (opacity << 16) | opacity);
- }
- } break;
- case Options::MouseActivateRaiseAndMove:
- case Options::MouseActivateRaiseAndUnrestrictedMove:
- case Options::MouseMove:
- case Options::MouseUnrestrictedMove:
- case Options::MouseResize:
- case Options::MouseUnrestrictedResize:
- if (qme)
- moveWindow (qme);
- case Options::MouseNothing:
- default:
- break;
- }
-}
-
-void
-KWD::Window::showKillProcessDialog (Time timestamp)
-{
- KWindowInfo kWinInfo =
- KWindowSystem::windowInfo (mClientId, 0, NET::WM2WindowClass |
- NET::WM2ClientMachine);
- NETWinInfo wInfo = NETWinInfo (QX11Info::display(), mClientId,
- QX11Info::appRootWindow(), NET::WMPid);
- QByteArray clientMachine, resourceClass;
- pid_t pid;
- char buf[257];
-
- if (mProcessKiller.state () == QProcess::Running)
- return;
-
- clientMachine = kWinInfo.clientMachine ();
- resourceClass = kWinInfo.windowClassClass ();
- pid = wInfo.pid ();
-
- if (gethostname (buf, sizeof (buf) - 1) == 0)
- {
- if (strcmp (buf, clientMachine) == 0)
- clientMachine = "localhost";
- }
-
- mProcessKiller.start (KStandardDirs::findExe ("kwin_killer_helper"),
- QStringList () << "--pid" << QByteArray ().setNum (pid) <<
- "--hostname" << clientMachine <<
- "--windowname" << mName.toUtf8 () <<
- "--applicationname" << resourceClass <<
- "--wid" << QByteArray ().setNum ((unsigned int) mClientId) <<
- "--timestamp" << QByteArray ().setNum ((unsigned int) timestamp),
- QIODevice::NotOpen);
-}
-
-void
-KWD::Window::hideKillProcessDialog (void)
-{
- if (mProcessKiller.state () == QProcess::Running)
- {
- mProcessKiller.terminate ();
- }
-}
-
-void
-KWD::Window::decorRepaintPending ()
-{
- if (!mPaintRedirector || !mPixmap)
- return;
-
- QRegion reg = mPaintRedirector->pendingRegion();
- if (reg.isEmpty())
- return;
-
- QRect bBox = reg.boundingRect();
-
- if (mShapeSet)
- reg &= mShape;
-
- int l = mExtents.left;
- int r = mExtents.right;
- int t = mExtents.top;
- int b = mExtents.bottom;
- int w = mGeometry.width ();
- int h = mGeometry.height ();
-
- QRect top = QRect (0, 0, w + l + r, t);
- QRect bottom = QRect (0, t + h, w + l + r, b);
- QRect left = QRect (0, t, l, h);
- QRect right = QRect (l + w, t, r, h);
-
- QRegion rtop = reg & top;
- QRegion rbottom = reg & bottom;
- QRegion rleft = reg & left;
- QRegion rright = reg & right;
-
- QPixmap p = mPaintRedirector->performPendingPaint();
-
- QPainter pt (&mPixmapQt);
- pt.setCompositionMode( QPainter::CompositionMode_Source );
-
- QRect bb, pb;
-
- // Top
- if (!rtop.isEmpty ())
- {
- bb = rtop.boundingRect();
- pb = bb;
- pb.moveTo (bb.topLeft () - bBox.topLeft ());
- pt.resetTransform ();
- pt.setClipRegion( reg );
- pt.drawPixmap( bb.topLeft(), p, pb );
- }
-
- // Bottom
- if (!rbottom.isEmpty ())
- {
- bb = rbottom.boundingRect();
- pb = bb;
- pb.moveTo (bb.topLeft () - bBox.topLeft ());
- pt.resetTransform ();
- pt.translate(0, -h);
- pt.setClipRegion( reg );
- pt.drawPixmap( bb.topLeft(), p, pb );
- }
-
- // Left
- if (!rleft.isEmpty ())
- {
- bb = rleft.boundingRect();
- pb = bb;
- pb.moveTo (bb.topLeft () - bBox.topLeft ());
- pt.resetTransform ();
- pt.translate(0, t + b);
- pt.rotate (90);
- pt.scale (1.0, -1.0);
- pt.translate(0, -t);
- pt.setClipRegion( reg );
- pt.drawPixmap( bb.topLeft(), p, pb );
- }
-
- // Right
- if (!rright.isEmpty ())
- {
- bb = rright.boundingRect();
- pb = bb;
- pb.moveTo (bb.topLeft () - bBox.topLeft ());
- pt.resetTransform ();
- pt.translate(0, t + b + l);
- pt.rotate (90);
- pt.scale (1.0, -1.0);
- pt.translate(- (l + w), -t);
- pt.setClipRegion( reg );
- pt.drawPixmap( bb.topLeft(), p, pb );
- }
-
-
-
- if (mUpdateProperty)
- updateProperty ();
-}
-
-QWidget *
-KWD::Window::decorWidget (void) const
-{
- if (!mDecor)
- return 0;
- return mDecor->widget ();
-}
-
-QWidget *
-KWD::Window::childAt (int x, int y) const
-{
- if (!mDecor)
- return 0;
-
- QWidget *child = mDecor->widget ()->childAt (x + mPadding.left, y + mPadding.top);
- return (child)? child : decorWidget ();
-}
-
-QPoint
-KWD::Window::mapToChildAt (QPoint p) const
-{
- if (!mDecor)
- return p;
- if (childAt (p.x (), p.y ()) == decorWidget ())
- return p + QPoint (mPadding.left, mPadding.right);
- return childAt (p.x (), p.y ())->mapFrom (decorWidget (), p + QPoint (mPadding.left, mPadding.right));
-}
-
-bool
-KWD::Window::eventFilter (QObject* o, QEvent* e)
-{
- if (mDecor == NULL || o != mDecor->widget ())
- return false;
- if (e->type() == QEvent::Resize)
- {
- QResizeEvent* ev = static_cast<QResizeEvent*> (e);
- // Filter out resize events that inform about size different than frame size.
- // This will ensure that mDecor->width() etc. and mDecor->widget()->width() will be in sync.
- // These events only seem to be delayed events from initial resizing before show() was called
- // on the decoration widget.
- if (ev->size () != (mGeometry.size () + QSize (mExtents.left + mExtents.right,
- mExtents.top + mExtents.bottom)))
- {
- int w = mGeometry.width () + mExtents.left + mExtents.right;
- int h = mGeometry.height () + mExtents.top + mExtents.bottom;
-
- mDecor->resize (QSize (w, h));
- return true;
- }
- // HACK: Avoid decoration redraw delays. On resize Qt sets WA_WStateConfigPending
- // which delays all painting until a matching ConfigureNotify event comes.
- // But this process itself is the window manager, so it's not needed
- // to wait for that event, the geometry is known.
- // Note that if Qt in the future changes how this flag is handled and what it
- // triggers then this may potentionally break things. See mainly QETWidget::translateConfigEvent().
- mDecor->widget()->setAttribute( Qt::WA_WState_ConfigPending, false );
- mDecor->widget()->update();
- return false;
- }
- return false;
-}
diff -uprN compiz-0.8.8-orig/kde/window-decorator-kde4/window.h compiz-0.8.8/kde/window-decorator-kde4/window.h
--- compiz-0.8.8-orig/kde/window-decorator-kde4/window.h 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/kde/window-decorator-kde4/window.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,276 +0,0 @@
-/*
- * Copyright © 2008 Dennis Kasprzyk <onestone@opencompositing.org>
- * Copyright © 2006 Novell, Inc.
- * Copyright © 2006 Volker Krause <vkrause@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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _WINDOW_H
-#define _WINDOW_H
-
-#include <kdecorationbridge.h>
-#include <KDE/KActionCollection>
-#include <kdeversion.h>
-
-#include <qpixmap.h>
-#include <qwidget.h>
-#include <qprocess.h>
-
-#include <decoration.h>
-
-#include <X11/extensions/Xdamage.h>
-
-#include "utils.h"
-#include "options.h"
-
-class QProcess;
-class KDecoration;
-class KActionCollection;
-class QMenu;
-
-namespace KWin
-{
- class PaintRedirector;
-}
-
-namespace KWD
-{
-class Window: public QObject, public KDecorationBridgeUnstable {
- Q_OBJECT public:
-
- enum Type
- {
- Normal,
- Default,
- DefaultActive
- };
-
- public:
- Window (WId parentId, WId clientId, WId frame, Type type,
- int x = 0, int y = 0, int w = 1, int h = 1);
- ~Window (void);
-
- virtual bool isActive (void) const;
- virtual bool isCloseable (void) const;
- virtual bool isMaximizable (void) const;
- virtual MaximizeMode maximizeMode (void) const;
- virtual bool isMinimizable (void) const;
- virtual bool providesContextHelp (void) const;
- virtual int desktop (void) const;
- virtual bool isModal (void) const;
- virtual bool isShadeable (void) const;
- virtual bool isShade (void) const;
- virtual bool isSetShade (void) const;
- virtual bool keepAbove (void) const;
- virtual bool keepBelow (void) const;
- virtual bool isMovable (void) const;
- virtual bool isResizable (void) const;
- virtual NET::WindowType
- windowType (unsigned long supported_types) const;
- virtual QIcon icon (void) const;
- virtual QString caption (void) const;
- virtual void processMousePressEvent (QMouseEvent *);
- virtual void showWindowMenu (const QRect &);
- virtual void showWindowMenu (const QPoint &);
- virtual void performWindowOperation (WindowOperation);
- virtual void setMask (const QRegion &, int);
- virtual bool isPreview (void) const;
- virtual QRect geometry (void) const;
- virtual QRect iconGeometry (void) const;
- virtual QRegion unobscuredRegion (const QRegion & r) const;
- virtual WId windowId (void) const;
- virtual void closeWindow (void);
- virtual void maximize (MaximizeMode mode);
- virtual void minimize (void);
- virtual void showContextHelp (void);
- virtual void setDesktop (int desktop);
- virtual void titlebarDblClickOperation (void);
- virtual void titlebarMouseWheelOperation (int delta);
- virtual void setShade (bool set);
- virtual void setKeepAbove (bool);
- virtual void setKeepBelow (bool);
- virtual int currentDesktop (void) const;
- virtual QWidget *initialParentWidget (void) const;
- virtual Qt::WFlags initialWFlags (void) const;
- virtual void grabXServer (bool grab);
-
- /* unstable API */
- virtual bool compositingActive () const;
-#if KDE_IS_VERSION(4,3,90)
- virtual QRect transparentRect () const;
-
- virtual bool isClientGroupActive ();
- virtual QList<ClientGroupItem> clientGroupItems () const;
- virtual long itemId (int index);
- virtual int visibleClientGroupItem ();
- virtual void setVisibleClientGroupItem (int index);
- virtual void moveItemInClientGroup (int index, int before);
- virtual void moveItemToClientGroup (long itemId, int before);
- virtual void removeFromClientGroup (int index, const QRect& newGeom);
- virtual void closeClientGroupItem (int index);
- virtual void closeAllInClientGroup ();
- virtual void displayClientMenu (int index, const QPoint& pos);
-
- virtual WindowOperation
- buttonToWindowOperation(Qt::MouseButtons button);
-#endif
- virtual bool eventFilter (QObject* o, QEvent* e);
-
- void handleActiveChange (void);
- void updateFrame (WId frame);
- void updateWindowGeometry (void);
- void updateCursor (QPoint pos);
- void updateSelected (WId selected);
-
- WId frameId (void) const
- {
- return mFrame;
- }
-
- KDecoration *decoration (void) const
- {
- return mDecor;
- }
-
- QWidget *decorWidget (void) const;
- QWidget *childAt (int x, int y) const;
- QPoint mapToChildAt (QPoint p) const;
-
- QWidget *activeChild (void) const
- {
- return mActiveChild;
- }
-
- void setActiveChild (QWidget * child)
- {
- mActiveChild = child;
- }
-
- void moveWindow (QMouseEvent *qme);
- void reloadDecoration (void);
- void updateState (void);
- void updateName (void);
- void updateIcons (void);
- void updateOpacity (void)
- {
- mOpacity = readPropertyShort (mClientId, Atoms::netWmWindowOpacity,
- 0xffff);
- }
- Drawable pixmapId (void) const
- {
- return mPixmap;
- }
-
- bool handleMap (void);
- bool handleConfigure (QSize size);
-
- decor_extents_t *border (void)
- {
- return &mBorder;
- }
-
- QRect clientGeometry (void);
- void showKillProcessDialog (Time timestamp);
- void hideKillProcessDialog (void);
-
- void setFakeRelease (bool fakeRelease)
- {
- mFakeRelease = fakeRelease;
- }
-
- bool getFakeRelease ()
- {
- return mFakeRelease;
- }
-
-
- private:
- void createDecoration (void);
- void resizeDecoration (bool force = false);
- void updateBlurProperty (int topOffset,
- int bottomOffset,
- int leftOffset,
- int rightOffset);
- void updateProperty (void);
- void getWindowProtocols (void);
-
- Options::MouseCommand buttonToCommand (Qt::MouseButtons button);
- void performMouseCommand (KWD::Options::MouseCommand command,
- QMouseEvent *qme);
- NET::Direction positionToDirection (int pos);
- Cursor positionToCursor (QPoint pos);
-
- private slots:
- void handlePopupActivated (QAction *action);
- void handleOpacityPopupActivated (QAction *action);
- void handleDesktopPopupActivated (QAction *action);
- void handlePopupAboutToShow (void);
-
- void decorRepaintPending ();
-
- private:
- Type mType;
- WId mParentId;
- WId mFrame;
- WId mClientId;
- WId mSelectedId;
- QRect mGeometry;
- QString mName;
- QPixmap mIcon;
- QPixmap mMiniIcon;
- decor_extents_t mBorder;
- decor_extents_t mPadding;
- decor_extents_t mExtents;
- unsigned short mOpacity;
- KDecoration *mDecor;
- Pixmap mPixmap;
- QPixmap mPixmapQt;
- bool mUpdateProperty;
- bool mShapeSet;
- QRegion mShape;
- QWidget *mActiveChild;
- bool mSupportTakeFocus;
- bool mSupportContextHelp;
- QMenu *mPopup;
- QMenu *mAdvancedMenu;
- QMenu *mOpacityMenu;
- QMenu *mDesktopMenu;
- unsigned long mState;
-
- QProcess mProcessKiller;
- KActionCollection mKeys;
- bool mFakeRelease;
-
- QAction *mResizeOpAction;
- QAction *mMoveOpAction;
- QAction *mMaximizeOpAction;
- QAction *mShadeOpAction;
- QAction *mKeepAboveOpAction;
- QAction *mKeepBelowOpAction;
- QAction *mFullScreenOpAction;
- QAction *mNoBorderOpAction;
- QAction *mMinimizeOpAction;
- QAction *mCloseOpAction;
- QAction *mDesktopOpAction;
-
- KWin::PaintRedirector *mPaintRedirector;
- };
-}
-
-#endif
diff -uprN compiz-0.8.8-orig/Makefile.am compiz-0.8.8/Makefile.am
--- compiz-0.8.8-orig/Makefile.am 2013-04-19 11:25:07.306309000 +0200
+++ compiz-0.8.8/Makefile.am 2013-04-19 11:45:47.724650591 +0200
@@ -1,4 +1,4 @@
-SUBDIRS = include src libdecoration plugins images gtk kde po metadata
+SUBDIRS = include src libdecoration plugins images gtk po metadata
EXTRA_DIST = \
COPYING \
@@ -18,17 +18,12 @@ if USE_MATECONF
mateconfdata = compiz-mateconf.pc
endif
-if USE_KCONFIG
-kconfigdata = compiz-kconfig.pc
-endif
-
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
compiz.pc \
compiz-cube.pc \
compiz-scale.pc \
- $(mateconfdata) \
- $(kconfigdata)
+ $(mateconfdata)
# Some custom targets to make it easier to release things.
# Use either:
diff -uprN compiz-0.8.8-orig/metadata/kcfg.xslt compiz-0.8.8/metadata/kcfg.xslt
--- compiz-0.8.8-orig/metadata/kcfg.xslt 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/metadata/kcfg.xslt 1970-01-01 01:00:00.000000000 +0100
@@ -1,322 +0,0 @@
-<!--
- Copyright © 2007 Dennis Kasprzyk
- Copyright © 2007 Novell, Inc.
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without
- fee, provided that the above copyright notice appear in all copies
- and that both that copyright notice and this permission notice
- appear in supporting documentation, and that the name of
- Dennis Kasprzyk not be used in advertising or publicity pertaining to
- distribution of the software without specific, written prior permission.
- Dennis Kasprzyk makes no representations about the suitability of this
- software for any purpose. It is provided "as is" without express or
- implied warranty.
-
- DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Authors: Dennis Kasprzyk <onestone@deltatauchi.de>
- David Reveman <davidr@novell.com>
- -->
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
- <xsl:output method="xml" indent="yes"/>
-
- <xsl:template match="/compiz">
- <kcfg>
- <kcfgfile name="compizrc">
- <parameter name="screen"/>
- </kcfgfile>
- <xsl:for-each select="/compiz/*/display | /compiz/*/screen">
- <group>
- <xsl:variable name="group">
- <xsl:choose>
- <xsl:when test="ancestor::plugin">
- <xsl:value-of select="ancestor::plugin/@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>core</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>_</xsl:text>
- <xsl:value-of select="name()"/>
- </xsl:variable>
- <xsl:attribute name='name'>
- <xsl:value-of select="$group"/>
- <xsl:if test="name() = 'screen'">
- <xsl:text>$(screen)</xsl:text>
- </xsl:if>
- </xsl:attribute>
- <xsl:for-each select="option[not(@read_only='true') and not(@type='action')]">
- <xsl:call-template name="print_option">
- <xsl:with-param name="group" select="$group"/>
- </xsl:call-template>
- </xsl:for-each>
- </group>
- </xsl:for-each>
- </kcfg>
- </xsl:template>
-
- <xsl:template name="print_option">
- <xsl:param name="group"/>
- <entry>
- <xsl:variable name="ktype">
- <xsl:call-template name="print_type"/>
- </xsl:variable>
- <xsl:attribute name='name'>
- <xsl:value-of select="$group"/>
- <xsl:text>_</xsl:text>
- <xsl:value-of select="@name"/>
- </xsl:attribute>
- <xsl:attribute name='key'>
- <xsl:value-of select="@name"/>
- </xsl:attribute>
- <xsl:attribute name='type'>
- <xsl:value-of select="$ktype"/>
- </xsl:attribute>
- <label><xsl:value-of select="short[not(@xml:lang)]/text()"/></label>
- <whatsthis>
- <xsl:value-of select="long[not(@xml:lang)]/text()"/>
- <xsl:if test="$ktype = 'Int'">
- <xsl:call-template name="print_info"/>
- </xsl:if>
- </whatsthis>
- <xsl:choose>
- <xsl:when test="@type = 'color'">
- <default>
- <xsl:choose>
- <xsl:when test="default">
- <xsl:for-each select="default[1]">
- <xsl:call-template name="print_color"/>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>#000000ff</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </default>
- </xsl:when>
- <xsl:when test="@type = 'edge'">
- <default>
- <xsl:for-each select="default[1]">
- <xsl:call-template name="print_edge_list"/>
- </xsl:for-each>
- </default>
- </xsl:when>
- <xsl:when test="$ktype = 'IntList' or $ktype = 'StringList'">
- <default>
- <xsl:choose>
- <xsl:when test="@type = 'color'">
- <xsl:for-each select="default[1]">
- <xsl:call-template name="print_color_list"/>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="default[1]">
- <xsl:call-template name="print_value_list"/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </default>
- </xsl:when>
- <xsl:otherwise>
- <default>
- <xsl:if test="default/text()">
- <xsl:value-of select="default/text()"/>
- </xsl:if>
- </default>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="contains('Int,Double', $ktype)">
- <xsl:if test="min/text()">
- <min><xsl:value-of select="min/text()"/></min>
- </xsl:if>
- <xsl:if test="max/text()">
- <max><xsl:value-of select="max/text()"/></max>
- </xsl:if>
- </xsl:if>
- </entry>
- </xsl:template>
-
- <xsl:template name="print_type">
- <xsl:param name="type">
- <xsl:value-of select="@type"/>
- </xsl:param>
- <xsl:choose>
- <xsl:when test="$type = 'bool'">
- <xsl:text>Bool</xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'int'">
- <xsl:text>Int</xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'float'">
- <xsl:text>Double</xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'bell'">
- <xsl:text>Bool</xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'list'">
- <xsl:choose>
- <xsl:when test="type/text() = 'int'">
- <xsl:text>Int</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>String</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>List</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>String</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="print_info">
- <xsl:variable name="info">
- <xsl:text> (</xsl:text>
- <xsl:choose>
- <xsl:when test="contains('int,float',@type) and not(desc/value/text())">
- <xsl:value-of select="min/text()"/> - <xsl:value-of select="max/text()"/>
- </xsl:when>
- <xsl:when test="@type='int' and desc/value/text()">
- <xsl:call-template name="print_int_desc_list"/>
- </xsl:when>
- <xsl:when test="@type = 'match'">
- <xsl:text>match</xsl:text>
- </xsl:when>
- </xsl:choose>
- <xsl:text>)</xsl:text>
- </xsl:variable>
- <xsl:if test="not(contains($info,' ()'))">
- <xsl:value-of select="$info"/>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="print_int_desc_list">
- <xsl:variable name="list">
- <xsl:for-each select="desc">
- <xsl:value-of select="value/text()"/>
- <xsl:text> = </xsl:text>
- <xsl:value-of select="name/text()"/>
- <xsl:text>, </xsl:text>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="substring($list,1,string-length($list) - 2)"/>
- </xsl:template>
-
- <xsl:template name="print_value_list">
- <xsl:variable name="list">
- <xsl:for-each select="value">
- <xsl:value-of select="text()"/>
- <xsl:text>,</xsl:text>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="substring($list,1,string-length($list) - 1)"/>
- </xsl:template>
-
- <xsl:template name="print_color_list">
- <xsl:variable name="list">
- <xsl:for-each select="value">
- <xsl:call-template name="print_color"/>
- <xsl:text>,</xsl:text>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="substring($list,1,string-length($list) - 1)"/>
- </xsl:template>
-
- <!--
- generates the #00aabbcc color value out of the compiz
- metadata color description
- -->
- <xsl:template name="print_color">
- <xsl:variable name="red">
- <xsl:call-template name="get_hex_num">
- <xsl:with-param name="value" select="red/text()"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="green">
- <xsl:call-template name="get_hex_num">
- <xsl:with-param name="value" select="green/text()"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="blue">
- <xsl:call-template name="get_hex_num">
- <xsl:with-param name="value" select="blue/text()"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="alpha">
- <xsl:choose>
- <xsl:when test="alpha/text()">
- <xsl:call-template name="get_hex_num">
- <xsl:with-param name="value" select="alpha/text()"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>ff</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="concat('#',concat($red,concat($green,concat($blue,$alpha))))"/>
- </xsl:template>
-
- <!--
- converts a decimal number in the range of 0-65535 or
- a hex number in the range of 0x0000 - 0xffff to a hex number in the
- range of 00 - ff
- -->
- <xsl:template name="get_hex_num">
- <xsl:param name="value"/>
- <xsl:choose>
- <xsl:when test="starts-with($value,'0x')">
- <xsl:variable name="number">
- <xsl:text>0000</xsl:text>
- <xsl:value-of select="substring-after($value,'0x')"/>
- </xsl:variable>
- <xsl:value-of select="substring(concat('000',$number),string-length($number),2)"/>
- </xsl:when>
- <xsl:when test="string-length($value)">
- <xsl:variable name="number">
- <xsl:call-template name="to_hex">
- <xsl:with-param name="decimal_number" select="$value"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="substring(concat('000',$number),string-length($number),2)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>00</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- converts a decimal number to a hex number -->
- <xsl:variable name="hex_digits" select="'0123456789abcdef'"/>
-
- <xsl:template name="to_hex">
- <xsl:param name="decimal_number"/>
- <xsl:if test="$decimal_number >= 16">
- <xsl:call-template name="to_hex">
- <xsl:with-param name="decimal_number" select="floor($decimal_number div 16)" />
- </xsl:call-template>
- </xsl:if>
- <xsl:value-of select="substring($hex_digits, ($decimal_number mod 16) + 1, 1)" />
- </xsl:template>
-
- <xsl:template name="print_edge_list">
- <xsl:variable name="list">
- <xsl:for-each select="edge">
- <xsl:value-of select="@name"/>
- <xsl:text> | </xsl:text>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="substring($list,1,string-length($list) - 3)"/>
- </xsl:template>
-
-</xsl:stylesheet>
diff -uprN compiz-0.8.8-orig/metadata/kconfig.xml.in compiz-0.8.8/metadata/kconfig.xml.in
--- compiz-0.8.8-orig/metadata/kconfig.xml.in 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/metadata/kconfig.xml.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-<compiz>
- <plugin name="kconfig">
- <_short>Kconfig</_short>
- <_long>Kconfig Control Backend</_long>
- </plugin>
-</compiz>
diff -uprN compiz-0.8.8-orig/metadata/kconfig.xslt compiz-0.8.8/metadata/kconfig.xslt
--- compiz-0.8.8-orig/metadata/kconfig.xslt 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/metadata/kconfig.xslt 1970-01-01 01:00:00.000000000 +0100
@@ -1,59 +0,0 @@
-<!--
- Copyright © 2007 Novell, Inc.
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without
- fee, provided that the above copyright notice appear in all copies
- and that both that copyright notice and this permission notice
- appear in supporting documentation, and that the name of
- Novell, Inc. not be used in advertising or publicity pertaining to
- distribution of the software without specific, written prior permission.
- Novell, Inc. makes no representations about the suitability of this
- software for any purpose. It is provided "as is" without express or
- implied warranty.
-
- NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: David Reveman <davidr@novell.com>
- -->
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-<xsl:output method="text"/>
-
-<xsl:template match="/kcfg">
- <xsl:for-each select="/kcfg/group">
- <xsl:variable name="prefix">
- <xsl:value-of select="substring(@name,1,string-length(@name) - 9)"/>
- </xsl:variable>
- <xsl:variable name="suffix">
- <xsl:value-of select="substring(@name,string-length(@name) - 8,string-length(@name))"/>
- </xsl:variable>
- <xsl:text>[</xsl:text>
- <xsl:choose>
- <xsl:when test="$suffix = '$(screen)'">
- <xsl:value-of select="$prefix"/>
- <xsl:value-of select="$screen"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@name"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>]&#10;</xsl:text>
- <xsl:for-each select="entry">
- <xsl:value-of select="@key"/>
- <xsl:text>=</xsl:text>
- <xsl:value-of select="default/text()"/>
- <xsl:text>&#10;</xsl:text>
- </xsl:for-each>
- <xsl:text>&#10;</xsl:text>
- </xsl:for-each>
-</xsl:template>
-
-</xsl:stylesheet>
diff -uprN compiz-0.8.8-orig/metadata/Makefile.am compiz-0.8.8/metadata/Makefile.am
--- compiz-0.8.8-orig/metadata/Makefile.am 2013-04-19 11:25:07.364310000 +0200
+++ compiz-0.8.8/metadata/Makefile.am 2013-04-19 11:52:17.717558999 +0200
@@ -15,7 +15,6 @@ xml_in_files = \
matecompat.xml.in \
ini.xml.in \
inotify.xml.in \
- kconfig.xml.in \
minimize.xml.in \
move.xml.in \
obs.xml.in \
@@ -57,30 +56,6 @@ schemas_stylesheets = schemas.xslt
endif
-if USE_KCONFIG
-kde_kcfgdir = $(DESTDIR)$(KDE_KCFG_DIR)
-kde_kcfg_files = $(patsubst %.xml.in,compiz-%.kcfg,$(xml_in_files))
-
-kde_kcfg_stylesheets = kcfg.xslt
-
-%.kcfg: $(xml_files)
- xsltproc -o $@ $(srcdir)/kcfg.xslt $(subst compiz-,,$*).xml;
-
-kde_configdir = $(DESTDIR)$(KDE_KCONFIG_DIR)
-kde_config_files = compizrc
-
-compizrc: $(kde_kcfg_files)
- xsltproc --stringparam screen 0 $(srcdir)/kconfig.xslt \
- $(kde_kcfg_files) > $@;
-
-kde_config_stylesheets = kconfig.xslt
-
-endif
-
-noinst_DATA = \
- $(kde_kcfg_files) \
- $(kde_config_files)
-
install-data-local:
if USE_MATECONF
if MATECONF_SCHEMAS_INSTALL
@@ -89,38 +64,11 @@ if MATECONF_SCHEMAS_INSTALL
fi
endif
endif
-if USE_KCONFIG
- if mkdir -p $(kde_kcfgdir) && test -w $(kde_kcfgdir); then ( \
- $(INSTALL) -m 644 $(kde_kcfg_files) $(kde_kcfgdir) \
- ); \
- fi
- if mkdir -p $(kde_configdir) && test -w $(kde_configdir); then ( \
- $(INSTALL) -m 644 $(kde_config_files) $(kde_configdir) \
- ); \
- fi
-endif
-
-uninstall-local:
-if USE_KCONFIG
- if test -w $(kde_kcfgdir); then ( \
- for file in $(kde_kcfg_files); do \
- rm -f $(kde_kcfgdir)/$$file; \
- done \
- ); \
- fi
- if test -w $(kde_configdir); then ( \
- for file in $(kde_config_files); do \
- rm -f $(kde_configdir)/$$file; \
- done \
- ); \
- fi
-endif
xsltdir = $(stylesheetdir)
xslt_files = \
- $(schemas_stylesheets) \
- $(kde_kcfg_stylesheets) \
- $(kde_config_stylesheets)
+ $(schemas_stylesheets)
+
xslt_DATA = $(xslt_files)
EXTRA_DIST = \
@@ -131,6 +79,4 @@ EXTRA_DIST = \
DISTCLEANFILES = \
$(xml_files) \
core.xml.in \
- $(schema_files) \
- $(kde_kcfg_files) \
- $(kde_config_files)
+ $(schema_files)
diff -uprN compiz-0.8.8-orig/plugins/kconfig.cpp compiz-0.8.8/plugins/kconfig.cpp
--- compiz-0.8.8-orig/plugins/kconfig.cpp 2010-05-21 13:18:14.000000000 +0200
+++ compiz-0.8.8/plugins/kconfig.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,752 +0,0 @@
-/*
- * Copyright © 2007 Novell, Inc.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <kglobal.h>
-#include <kstandarddirs.h>
-#include <kapplication.h>
-#include <ksimpleconfig.h>
-#include <qfile.h>
-
-#include <compiz-core.h>
-
-#define COMPIZ_KCONFIG_RC "compizrc"
-
-static KInstance *kInstance;
-
-static CompMetadata kconfigMetadata;
-
-static int corePrivateIndex;
-
-typedef struct _KconfigCore {
- KConfig *config;
-
- CompTimeoutHandle syncHandle;
- CompTimeoutHandle reloadHandle;
- CompFileWatchHandle fileWatch;
-
- InitPluginForObjectProc initPluginForObject;
- SetOptionForPluginProc setOptionForPlugin;
-} KconfigCore;
-
-#define GET_KCONFIG_CORE(c) \
- ((KconfigCore *) (c)->base.privates[corePrivateIndex].ptr)
-
-#define KCONFIG_CORE(c) \
- KconfigCore *kc = GET_KCONFIG_CORE (c)
-
-
-static void
-kconfigRcChanged (const char *name,
- void *closure);
-
-static Bool
-kconfigRcSync (void *closure)
-{
- KCONFIG_CORE (&core);
-
- kc->config->sync ();
-
- kc->syncHandle = 0;
-
- return FALSE;
-}
-
-static bool
-kconfigValueToBool (CompOptionType type,
- CompOptionValue *value)
-{
- switch (type) {
- case CompOptionTypeBool:
- return (value->b) ? true : false;
- case CompOptionTypeBell:
- return (value->action.bell) ? true : false;
- default:
- break;
- }
-
- return false;
-}
-
-static QString
-kconfigValueToString (CompObject *object,
- CompOptionType type,
- CompOptionValue *value)
-{
- QString str;
-
- switch (type) {
- case CompOptionTypeBool:
- str = QString::number (value->b ? TRUE : FALSE);
- break;
- case CompOptionTypeFloat:
- str = QString::number (value->f);
- break;
- case CompOptionTypeString:
- str = QString (value->s);
- break;
- case CompOptionTypeColor: {
- char *color;
-
- color = colorToString (value->c);
- if (color)
- {
- str = QString (color);
- free (color);
- }
- } break;
- case CompOptionTypeKey: {
- char *action = NULL;
-
- while (object && object->type != COMP_OBJECT_TYPE_DISPLAY)
- object = object->parent;
-
- if (object)
- action = keyActionToString (GET_CORE_DISPLAY (object),
- &value->action);
- if (action)
- {
- str = QString (action);
- free (action);
- }
- } break;
- case CompOptionTypeButton: {
- char *action = NULL;
-
- while (object && object->type != COMP_OBJECT_TYPE_DISPLAY)
- object = object->parent;
-
- if (object)
- action = buttonActionToString (GET_CORE_DISPLAY (object),
- &value->action);
- if (action)
- {
- str = QString (action);
- free (action);
- }
- } break;
- case CompOptionTypeEdge: {
- char *edge;
-
- edge = edgeMaskToString (value->action.edgeMask);
- if (edge)
- {
- str = QString (edge);
- free (edge);
- }
- } break;
- case CompOptionTypeBell:
- str = QString::number (value->action.bell ? TRUE : FALSE);
- break;
- case CompOptionTypeMatch: {
- char *match;
-
- match = matchToString (&value->match);
- if (match)
- {
- str = QString (match);
- free (match);
- }
- }
- default:
- break;
- }
-
- return str;
-}
-
-static QString
-kconfigObjectString (CompObject *object)
-{
- QString objectName (QString (compObjectTypeName (object->type)));
- char *name;
-
- name = compObjectName (object);
- if (name)
- {
- objectName += name;
- free (name);
- }
-
- return objectName;
-}
-
-static void
-kconfigSetOption (CompObject *object,
- CompOption *o,
- const char *plugin)
-{
- QString group (QString (plugin) + "_" + kconfigObjectString (object));
-
- KCONFIG_CORE (&core);
-
- kc->config->setGroup (group);
-
- switch (o->type) {
- case CompOptionTypeBool:
- case CompOptionTypeBell:
- kc->config->writeEntry (o->name,
- kconfigValueToBool (o->type, &o->value));
- break;
- case CompOptionTypeInt:
- kc->config->writeEntry (o->name, o->value.i);
- break;
- case CompOptionTypeFloat:
- kc->config->writeEntry (o->name, (double) o->value.f);
- break;
- case CompOptionTypeString:
- case CompOptionTypeColor:
- case CompOptionTypeKey:
- case CompOptionTypeButton:
- case CompOptionTypeEdge:
- case CompOptionTypeMatch:
- kc->config->writeEntry (o->name,
- kconfigValueToString (object, o->type,
- &o->value));
- break;
- case CompOptionTypeList: {
- int i;
-
- switch (o->value.list.type) {
- case CompOptionTypeInt: {
- QValueList< int > list;
-
- for (i = 0; i < o->value.list.nValue; i++)
- list += o->value.list.value[i].i;
-
- kc->config->writeEntry (o->name, list);
- } break;
- case CompOptionTypeBool:
- case CompOptionTypeFloat:
- case CompOptionTypeString:
- case CompOptionTypeColor:
- case CompOptionTypeKey:
- case CompOptionTypeButton:
- case CompOptionTypeEdge:
- case CompOptionTypeBell:
- case CompOptionTypeMatch: {
- QStringList list;
-
- for (i = 0; i < o->value.list.nValue; i++)
- list += kconfigValueToString (object,
- o->value.list.type,
- &o->value.list.value[i]);
-
- kc->config->writeEntry (o->name, list);
- } break;
- case CompOptionTypeAction:
- case CompOptionTypeList:
- break;
- }
- } break;
- case CompOptionTypeAction:
- return;
- }
-
- if (!kc->syncHandle)
- kc->syncHandle = compAddTimeout (0, 0, kconfigRcSync, 0);
-}
-
-static Bool
-kconfigStringToValue (CompObject *object,
- QString str,
- CompOptionType type,
- CompOptionValue *value)
-{
- switch (type) {
- case CompOptionTypeBool:
- value->b = str.toInt () ? TRUE : FALSE;
- break;
- case CompOptionTypeFloat:
- value->f = str.toFloat ();
- break;
- case CompOptionTypeString:
- value->s = strdup (str.ascii ());
- if (!value->s)
- return FALSE;
- break;
- case CompOptionTypeColor:
- if (!stringToColor (str.ascii (), value->c))
- return FALSE;
- break;
- case CompOptionTypeKey:
- while (object && object->type != COMP_OBJECT_TYPE_DISPLAY)
- object = object->parent;
-
- if (!object)
- return FALSE;
-
- stringToKeyAction (GET_CORE_DISPLAY (object), str.ascii (),
- &value->action);
- break;
- case CompOptionTypeButton:
- while (object && object->type != COMP_OBJECT_TYPE_DISPLAY)
- object = object->parent;
-
- if (!object)
- return FALSE;
-
- stringToButtonAction (GET_CORE_DISPLAY (object), str.ascii (),
- &value->action);
- break;
- case CompOptionTypeEdge:
- value->action.edgeMask = stringToEdgeMask (str.ascii ());
- break;
- case CompOptionTypeBell:
- value->action.bell = str.toInt () ? TRUE : FALSE;
- break;
- case CompOptionTypeMatch:
- matchInit (&value->match);
- matchAddFromString (&value->match, str.ascii ());
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-kconfigBoolToValue (bool b,
- CompOptionType type,
- CompOptionValue *value)
-{
- switch (type) {
- case CompOptionTypeBool:
- value->b = (b) ? TRUE : FALSE;
- break;
- case CompOptionTypeBell:
- value->action.bell = (b) ? TRUE : FALSE;
- default:
- break;
- }
-}
-
-static Bool
-kconfigReadOptionValue (CompObject *object,
- KConfig *config,
- CompOption *o,
- CompOptionValue *value)
-{
- compInitOptionValue (value);
-
- switch (o->type) {
- case CompOptionTypeBool:
- case CompOptionTypeBell:
- kconfigBoolToValue (config->readBoolEntry (o->name), o->type, value);
- break;
- case CompOptionTypeInt:
- value->i = config->readNumEntry (o->name);
- break;
- case CompOptionTypeFloat:
- value->f = config->readDoubleNumEntry (o->name);
- break;
- case CompOptionTypeString:
- case CompOptionTypeColor:
- case CompOptionTypeKey:
- case CompOptionTypeButton:
- case CompOptionTypeEdge:
- case CompOptionTypeMatch:
- if (!kconfigStringToValue (object,
- config->readEntry (o->name), o->type,
- value))
- return FALSE;
- break;
- case CompOptionTypeList: {
- int n, i;
-
- value->list.value = NULL;
- value->list.nValue = 0;
- value->list.type = o->value.list.type;
-
- switch (o->value.list.type) {
- case CompOptionTypeInt: {
- QValueList< int > list;
-
- list = config->readIntListEntry (o->name);
-
- n = list.size ();
- if (n)
- {
- value->list.value = (CompOptionValue *)
- malloc (sizeof (CompOptionValue) * n);
- if (value->list.value)
- {
- for (i = 0; i < n; i++)
- value->list.value[i].i = list[i];
-
- value->list.nValue = n;
- }
- }
- } break;
- case CompOptionTypeBool:
- case CompOptionTypeFloat:
- case CompOptionTypeString:
- case CompOptionTypeColor:
- case CompOptionTypeKey:
- case CompOptionTypeButton:
- case CompOptionTypeEdge:
- case CompOptionTypeBell:
- case CompOptionTypeMatch: {
- QStringList list;
-
- list = config->readListEntry (o->name);
-
- n = list.size ();
- if (n)
- {
- value->list.value = (CompOptionValue *)
- malloc (sizeof (CompOptionValue) * n);
- if (value->list.value)
- {
- for (i = 0; i < n; i++)
- {
- if (!kconfigStringToValue (object,
- list[i],
- value->list.type,
- &value->list.value[i]))
- break;
-
- value->list.nValue++;
- }
-
- if (value->list.nValue != n)
- {
- compFiniOptionValue (value, o->type);
- return FALSE;
- }
- }
- }
- } break;
- case CompOptionTypeList:
- case CompOptionTypeAction:
- return FALSE;
- }
- } break;
- case CompOptionTypeAction:
- return FALSE;
- break;
- }
-
- return TRUE;
-}
-
-static void
-kconfigGetOption (CompObject *object,
- CompOption *o,
- const char *plugin)
-{
- QString group (QString (plugin) + "_" +
- kconfigObjectString (object));
- const QString name (o->name);
-
- KCONFIG_CORE (&core);
-
- kc->config->setGroup (group);
-
- if (kc->config->hasKey (name))
- {
- CompOptionValue value;
-
- if (kconfigReadOptionValue (object, kc->config, o, &value))
- {
- (*core.setOptionForPlugin) (object, plugin, o->name, &value);
- compFiniOptionValue (&value, o->type);
- }
- }
- else
- {
- kconfigSetOption (object, o, plugin);
- }
-}
-
-static CompBool
-kconfigReloadObjectTree (CompObject *object,
- void *closure);
-
-static CompBool
-kconfigReloadObjectsWithType (CompObjectType type,
- CompObject *parent,
- void *closure)
-{
- compObjectForEach (parent, type, kconfigReloadObjectTree, closure);
-
- return TRUE;
-}
-
-static CompBool
-kconfigReloadObjectTree (CompObject *object,
- void *closure)
-{
- CompPlugin *p = (CompPlugin *) closure;
- CompOption *option;
- int nOption;
-
- option = (*p->vTable->getObjectOptions) (p, object, &nOption);
- while (nOption--)
- kconfigGetOption (object, option++, p->vTable->name);
-
- compObjectForEachType (object, kconfigReloadObjectsWithType, closure);
-
- return TRUE;
-}
-
-static Bool
-kconfigRcReload (void *closure)
-{
- CompPlugin *p;
-
- KCONFIG_CORE (&core);
-
- kc->config->reparseConfiguration ();
-
- for (p = getPlugins (); p; p = p->next)
- {
- if (!p->vTable->getObjectOptions)
- continue;
-
- kconfigReloadObjectTree (&core.base, (void *) p);
- }
-
- kc->reloadHandle = 0;
-
- return FALSE;
-}
-
-static void
-kconfigRcChanged (const char *name,
- void *closure)
-{
- if (strcmp (name, COMPIZ_KCONFIG_RC) == 0)
- {
- KCONFIG_CORE (&core);
-
- if (!kc->reloadHandle)
- kc->reloadHandle = compAddTimeout (0, 0, kconfigRcReload, closure);
- }
-}
-
-static CompBool
-kconfigSetOptionForPlugin (CompObject *object,
- const char *plugin,
- const char *name,
- CompOptionValue *value)
-{
- CompBool status;
-
- KCONFIG_CORE (&core);
-
- UNWRAP (kc, &core, setOptionForPlugin);
- status = (*core.setOptionForPlugin) (object, plugin, name, value);
- WRAP (kc, &core, setOptionForPlugin, kconfigSetOptionForPlugin);
-
- if (status && !kc->reloadHandle)
- {
- CompPlugin *p;
-
- p = findActivePlugin (plugin);
- if (p && p->vTable->getObjectOptions)
- {
- CompOption *option;
- int nOption;
-
- option = (*p->vTable->getObjectOptions) (p, object, &nOption);
- option = compFindOption (option, nOption, name, 0);
- if (option)
- kconfigSetOption (object, option, p->vTable->name);
- }
- }
-
- return status;
-}
-
-static CompBool
-kconfigInitPluginForObject (CompPlugin *p,
- CompObject *o)
-{
- CompBool status;
-
- KCONFIG_CORE (&core);
-
- UNWRAP (kc, &core, initPluginForObject);
- status = (*core.initPluginForObject) (p, o);
- WRAP (kc, &core, initPluginForObject, kconfigInitPluginForObject);
-
- if (status && p->vTable->getObjectOptions)
- {
- CompOption *option;
- int nOption;
-
- option = (*p->vTable->getObjectOptions) (p, o, &nOption);
- while (nOption--)
- kconfigGetOption (o, option++, p->vTable->name);
- }
-
- return status;
-}
-
-static Bool
-kconfigInitCore (CompPlugin *p,
- CompCore *c)
-{
- KconfigCore *kc;
- QString dir;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- kc = new KconfigCore;
- if (!kc)
- return FALSE;
-
- kc->config = new KConfig (COMPIZ_KCONFIG_RC);
- if (!kc->config)
- {
- delete kc;
- return FALSE;
- }
-
- kc->reloadHandle = compAddTimeout (0, 0, kconfigRcReload, 0);
- kc->syncHandle = 0;
- kc->fileWatch = 0;
-
- dir = KGlobal::dirs ()->saveLocation ("config", QString::null, false);
-
- if (QFile::exists (dir))
- {
- kc->fileWatch = addFileWatch (dir.ascii (), ~0, kconfigRcChanged, 0);
- }
- else
- {
- compLogMessage ("kconfig", CompLogLevelWarn, "Bad access \"%s\"",
- dir.ascii ());
- }
-
- WRAP (kc, c, initPluginForObject, kconfigInitPluginForObject);
- WRAP (kc, c, setOptionForPlugin, kconfigSetOptionForPlugin);
-
- c->base.privates[corePrivateIndex].ptr = kc;
-
- return TRUE;
-}
-
-static void
-kconfigFiniCore (CompPlugin *p,
- CompCore *c)
-{
- KCONFIG_CORE (c);
-
- UNWRAP (kc, c, initPluginForObject);
- UNWRAP (kc, c, setOptionForPlugin);
-
- if (kc->reloadHandle)
- compRemoveTimeout (kc->reloadHandle);
-
- if (kc->syncHandle)
- {
- compRemoveTimeout (kc->syncHandle);
- kconfigRcSync (0);
- }
-
- if (kc->fileWatch)
- removeFileWatch (kc->fileWatch);
-
- delete kc->config;
- delete kc;
-}
-
-static CompBool
-kconfigInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) kconfigInitCore
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-kconfigFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) kconfigFiniCore
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static Bool
-kconfigInit (CompPlugin *p)
-{
- if (!compInitPluginMetadataFromInfo (&kconfigMetadata, p->vTable->name,
- 0, 0, 0, 0))
- return FALSE;
-
- corePrivateIndex = allocateCorePrivateIndex ();
- if (corePrivateIndex < 0)
- {
- compFiniMetadata (&kconfigMetadata);
- return FALSE;
- }
-
- kInstance = new KInstance ("compiz-kconfig");
- if (!kInstance)
- {
- freeCorePrivateIndex (corePrivateIndex);
- compFiniMetadata (&kconfigMetadata);
- return FALSE;
- }
-
- compAddMetadataFromFile (&kconfigMetadata, p->vTable->name);
-
- return TRUE;
-}
-
-static void
-kconfigFini (CompPlugin *p)
-{
- delete kInstance;
-
- freeCorePrivateIndex (corePrivateIndex);
- compFiniMetadata (&kconfigMetadata);
-}
-
-static CompMetadata *
-kconfigGetMetadata (CompPlugin *plugin)
-{
- return &kconfigMetadata;
-}
-
-CompPluginVTable kconfigVTable = {
- "kconfig",
- kconfigGetMetadata,
- kconfigInit,
- kconfigFini,
- kconfigInitObject,
- kconfigFiniObject,
- 0, /* GetObjectOptions */
- 0 /* SetObjectOption */
-};
-
-CompPluginVTable *
-getCompPluginInfo20070830 (void)
-{
- return &kconfigVTable;
-}
diff -uprN compiz-0.8.8-orig/plugins/Makefile.am compiz-0.8.8/plugins/Makefile.am
--- compiz-0.8.8-orig/plugins/Makefile.am 2013-04-19 11:25:07.365310000 +0200
+++ compiz-0.8.8/plugins/Makefile.am 2013-04-19 11:57:09.395494418 +0200
@@ -108,13 +108,6 @@ libmateconf_la_SOURCES = mateconf.c
libmateconf_module = libmateconf.la
endif
-if USE_KCONFIG
-libkconfig_la_LDFLAGS = -module -avoid-version -no-undefined
-libkconfig_la_LIBADD = @KCONFIG_LIBS@
-libkconfig_la_SOURCES = kconfig.cpp
-libkconfig_module = libkconfig.la
-endif
-
if DBUS_PLUGIN
libdbus_la_LDFLAGS = -module -avoid-version -no-undefined
libdbus_la_LIBADD = @DBUS_LIBS@
@@ -141,7 +134,6 @@ INCLUDES = \
@LIBRSVG_CFLAGS@ \
@ANNOTATE_CFLAGS@ \
@MATECONF_CFLAGS@ \
- @KCONFIG_CFLAGS@ \
@DBUS_CFLAGS@ \
@GLIB_CFLAGS@ \
@FUSE_CFLAGS@ \
@@ -160,7 +152,6 @@ moduledir = $(plugindir)
module_LTLIBRARIES = \
$(libglib_module) \
$(libmateconf_module) \
- $(libkconfig_module) \
libdecoration.la \
libwobbly.la \
libfade.la \