summaryrefslogtreecommitdiff
path: root/kde/window-decorator-kde4
diff options
context:
space:
mode:
Diffstat (limited to 'kde/window-decorator-kde4')
-rw-r--r--kde/window-decorator-kde4/decorator.cpp78
-rw-r--r--kde/window-decorator-kde4/decorator.h2
-rw-r--r--kde/window-decorator-kde4/kdecoration_plugins.h4
-rw-r--r--kde/window-decorator-kde4/main.cpp26
-rw-r--r--kde/window-decorator-kde4/options.cpp4
-rw-r--r--kde/window-decorator-kde4/switcher.cpp23
-rw-r--r--kde/window-decorator-kde4/switcher.h2
-rw-r--r--kde/window-decorator-kde4/utils.cpp12
-rw-r--r--kde/window-decorator-kde4/window.cpp191
-rw-r--r--kde/window-decorator-kde4/window.h11
10 files changed, 181 insertions, 172 deletions
diff --git a/kde/window-decorator-kde4/decorator.cpp b/kde/window-decorator-kde4/decorator.cpp
index ee533a4..24ae4aa 100644
--- a/kde/window-decorator-kde4/decorator.cpp
+++ b/kde/window-decorator-kde4/decorator.cpp
@@ -86,8 +86,10 @@ struct _cursor cursors[3][3] = {
KWD::PluginManager::PluginManager (KSharedConfigPtr config):
KWD::KDecorationPlugins (config)
{
- defaultPlugin = (QPixmap::defaultDepth() > 8) ?
- "kwin3_oxygen" : "kwin3_plastik";
+ if (QPixmap::defaultDepth () > 8)
+ defaultPlugin = "kwin3_oxygen";
+ else
+ defaultPlugin = "kwin3_plastik";
}
#ifdef QT_45
@@ -105,13 +107,14 @@ KWD::Decorator::Decorator (Display* display,
{
XSetWindowAttributes attr;
int i, j;
- QDBusConnection dbus = QDBusConnection::sessionBus();
+ QDBusConnection dbus = QDBusConnection::sessionBus ();
- mRootInfo = new NETRootInfo (QX11Info::display(), 0);
+ mRootInfo = new NETRootInfo (QX11Info::display (), 0);
mActiveId = 0;
- KConfigGroup cfg (KSharedConfig::openConfig("plasmarc"), QString("Theme"));
+ KConfigGroup cfg (KSharedConfig::openConfig ("plasmarc"),
+ QString ("Theme"));
Plasma::Theme::defaultTheme ()->setThemeName (cfg.readEntry ("name"));
Atoms::init ();
@@ -144,7 +147,7 @@ KWD::Decorator::Decorator (Display* display,
mConfig = new KConfig ("kwinrc");
mOptions = new KWD::Options (mConfig);
- mPlugins = new PluginManager (KSharedConfig::openConfig("kwinrc"));
+ mPlugins = new PluginManager (KSharedConfig::openConfig ("kwinrc"));
mShadowOptions.shadow_radius = SHADOW_RADIUS;
mShadowOptions.shadow_opacity = SHADOW_OPACITY;
@@ -160,23 +163,25 @@ KWD::Decorator::Decorator (Display* display,
{
if (cursors[i][j].shape != XC_left_ptr)
cursors[i][j].cursor =
- XCreateFontCursor (QX11Info::display(), cursors[i][j].shape);
+ XCreateFontCursor (QX11Info::display (),
+ cursors[i][j].shape);
}
}
attr.override_redirect = True;
- mCompositeWindow = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(),
+ mCompositeWindow = XCreateWindow (QX11Info::display (),
+ QX11Info::appRootWindow (),
-ROOT_OFF_X, -ROOT_OFF_Y, 1, 1, 0,
CopyFromParent,
CopyFromParent,
CopyFromParent,
CWOverrideRedirect, &attr);
- XCompositeRedirectSubwindows (QX11Info::display(), mCompositeWindow,
+ XCompositeRedirectSubwindows (QX11Info::display (), mCompositeWindow,
CompositeRedirectManual);
- XMapWindow (QX11Info::display(), mCompositeWindow);
+ XMapWindow (QX11Info::display (), mCompositeWindow);
}
KWD::Decorator::~Decorator (void)
@@ -195,7 +200,7 @@ KWD::Decorator::~Decorator (void)
if (mSwitcher)
delete mSwitcher;
- XDestroyWindow (QX11Info::display(), mCompositeWindow);
+ XDestroyWindow (QX11Info::display (), mCompositeWindow);
delete mOptions;
delete mPlugins;
@@ -223,9 +228,11 @@ KWD::Decorator::enableDecorations (Time timestamp,
updateShadow ();
- mDecorNormal = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow(),
+ mDecorNormal = new KWD::Window (mCompositeWindow,
+ QX11Info::appRootWindow (),
0, Window::Default);
- mDecorActive = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow(),
+ mDecorActive = new KWD::Window (mCompositeWindow,
+ QX11Info::appRootWindow (),
0, Window::DefaultActive);
mActiveId = KWindowSystem::activeWindow ();
@@ -249,7 +256,7 @@ KWD::Decorator::enableDecorations (Time timestamp,
SLOT (plasmaThemeChanged ()));
// select for client messages
- XSelectInput (QX11Info::display(), QX11Info::appRootWindow(),
+ XSelectInput (QX11Info::display (), QX11Info::appRootWindow (),
StructureNotifyMask | PropertyChangeMask);
return true;
@@ -262,7 +269,7 @@ KWD::Decorator::updateDefaultShadow (KWD::Window *w)
if (mDefaultShadow)
{
- decor_shadow_destroy (QX11Info::display(), mDefaultShadow);
+ decor_shadow_destroy (QX11Info::display (), mDefaultShadow);
mDefaultShadow = NULL;
}
@@ -360,7 +367,7 @@ KWD::Decorator::changeShadowOptions (decor_shadow_options_t *opt)
void
KWD::Decorator::updateShadow (void)
{
- Display *xdisplay = QX11Info::display();
+ Display *xdisplay = QX11Info::display ();
Screen *xscreen;
decor_context_t context;
@@ -405,7 +412,7 @@ KWD::Decorator::updateShadow (void)
0, 0, quads, nQuad);
KWD::trapXError ();
- XChangeProperty (QX11Info::display(), QX11Info::appRootWindow(),
+ XChangeProperty (QX11Info::display (), QX11Info::appRootWindow (),
Atoms::netWindowDecorBare,
XA_INTEGER,
32, PropModeReplace, (unsigned char *) data,
@@ -479,10 +486,11 @@ KWD::Decorator::x11EventFilter (XEvent *xevent)
}
} break;
case SelectionRequest:
- decor_handle_selection_request (QX11Info::display(), xevent, mDmSnTimestamp);
+ decor_handle_selection_request (QX11Info::display (),
+ xevent, mDmSnTimestamp);
break;
case SelectionClear:
- status = decor_handle_selection_clear (QX11Info::display(),
+ status = decor_handle_selection_clear (QX11Info::display (),
xevent, 0);
if (status == DECOR_SELECTION_GIVE_UP)
KApplication::exit (0);
@@ -545,12 +553,12 @@ KWD::Decorator::x11EventFilter (XEvent *xevent)
if (client->activeChild ())
QApplication::sendEvent (client->activeChild (), &qe);
- XUndefineCursor (QX11Info::display(), client->frameId ());
+ XUndefineCursor (QX11Info::display (), client->frameId ());
}
} break;
case MotionNotify:
{
- XMotionEvent *xme = reinterpret_cast < XMotionEvent * >(xevent);
+ XMotionEvent *xme = reinterpret_cast <XMotionEvent *> (xevent);
QWidget *child;
if (!mFrames.contains (xme->window))
@@ -591,9 +599,9 @@ KWD::Decorator::x11EventFilter (XEvent *xevent)
case ButtonPress:
case ButtonRelease:
{
- XButtonEvent *xbe = reinterpret_cast <XButtonEvent *>(xevent);
+ XButtonEvent *xbe = reinterpret_cast <XButtonEvent *> (xevent);
QWidget *child;
-
+
if (!mFrames.contains (xbe->window))
break;
@@ -672,7 +680,7 @@ KWD::Decorator::x11EventFilter (XEvent *xevent)
if (xevent->type == mDamageEvent + XDamageNotify)
{
XDamageNotifyEvent *xde =
- reinterpret_cast <XDamageNotifyEvent *>(xevent);
+ reinterpret_cast <XDamageNotifyEvent *> (xevent);
if (mWindows.contains (xde->drawable))
client = mWindows[xde->drawable];
@@ -743,13 +751,13 @@ KWD::Decorator::handleWindowAdded (WId id)
QWidgetList widgets;
/* avoid adding any of our own top level windows */
- foreach (QWidget *widget, QApplication::topLevelWidgets()) {
- if (widget->winId() == id)
+ foreach (QWidget *widget, QApplication::topLevelWidgets ()) {
+ if (widget->winId () == id)
return;
}
KWD::trapXError ();
- XGetGeometry (QX11Info::display(), id, &root, &x, &y, &width, &height,
+ XGetGeometry (QX11Info::display (), id, &root, &x, &y, &width, &height,
&border, &depth);
if (KWD::popXError ())
return;
@@ -800,14 +808,15 @@ KWD::Decorator::handleWindowAdded (WId id)
}
KWD::trapXError ();
- XSelectInput (QX11Info::display(), id, StructureNotifyMask | PropertyChangeMask);
+ XSelectInput (QX11Info::display (), id,
+ StructureNotifyMask | PropertyChangeMask);
KWD::popXError ();
if (frame)
{
XWindowAttributes attr;
KWD::trapXError ();
- XGetWindowAttributes (QX11Info::display(), frame, &attr);
+ XGetWindowAttributes (QX11Info::display (), frame, &attr);
if (KWD::popXError ())
frame = None;
}
@@ -925,7 +934,6 @@ KWD::Decorator::handleWindowChanged (WId id,
client->updateIcons ();
if (properties[0] & NET::WMGeometry)
client->updateWindowGeometry ();
-
}
void
@@ -948,16 +956,16 @@ KWD::Decorator::sendClientMessage (WId eventWid,
ev.xclient.format = 32;
ev.xclient.data.l[0] = value;
- ev.xclient.data.l[1] = QX11Info::appTime();
+ 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())
+ if (eventWid == QX11Info::appRootWindow ())
mask = SubstructureRedirectMask | SubstructureNotifyMask;
KWD::trapXError ();
- XSendEvent (QX11Info::display(), eventWid, false, mask, &ev);
+ XSendEvent (QX11Info::display (), eventWid, false, mask, &ev);
KWD::popXError ();
}
@@ -1008,7 +1016,7 @@ KWD::Decorator::shadowColorChanged (QString value)
int c[4];
- if (sscanf (value.toAscii().data(), "#%2x%2x%2x%2x",
+ 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];
@@ -1024,7 +1032,7 @@ KWD::Decorator::plasmaThemeChanged ()
{
if (mSwitcher)
{
- WId win = mSwitcher->xid();
+ WId win = mSwitcher->xid ();
delete mSwitcher;
mSwitcher = new Switcher (mCompositeWindow, win);
}
diff --git a/kde/window-decorator-kde4/decorator.h b/kde/window-decorator-kde4/decorator.h
index 0ab3522..bd41b6a 100644
--- a/kde/window-decorator-kde4/decorator.h
+++ b/kde/window-decorator-kde4/decorator.h
@@ -139,7 +139,7 @@ class Decorator:public KApplication {
public slots:
void reconfigure (void);
-
+
private:
WId fetchFrame (WId window);
void updateShadow (void);
diff --git a/kde/window-decorator-kde4/kdecoration_plugins.h b/kde/window-decorator-kde4/kdecoration_plugins.h
index 14a1454..d609796 100644
--- a/kde/window-decorator-kde4/kdecoration_plugins.h
+++ b/kde/window-decorator-kde4/kdecoration_plugins.h
@@ -36,7 +36,7 @@ DEALINGS IN THE SOFTWARE.
//
// This header file is internal. I mean it.
-//
+//
#include <QtGui/QWidget>
@@ -84,7 +84,7 @@ class KDecorationPlugins
*/
}
-
+
/** @} */
#endif
diff --git a/kde/window-decorator-kde4/main.cpp b/kde/window-decorator-kde4/main.cpp
index 3a6581d..91c96ee 100644
--- a/kde/window-decorator-kde4/main.cpp
+++ b/kde/window-decorator-kde4/main.cpp
@@ -99,15 +99,15 @@ main (int argc, char **argv)
}
// Disable window less child widgets
- QApplication::setAttribute(Qt::AA_NativeWindows, true);
+ QApplication::setAttribute (Qt::AA_NativeWindows, true);
#ifdef QT_45
app = new KWD::Decorator ();
#else
- dpy = XOpenDisplay(0); // open default display
+ dpy = XOpenDisplay (0); // open default display
screen = DefaultScreen (dpy);
if (!dpy) {
- kError() << "Cannot connect to the X server" << endl;
+ kError () << "Cannot connect to the X server" << endl;
return 0;
}
@@ -136,23 +136,23 @@ main (int argc, char **argv)
}
}
- app = new KWD::Decorator (dpy, visual ? Qt::HANDLE(visual) : 0,
- colormap ? Qt::HANDLE(colormap) : 0);
+ app = new KWD::Decorator (dpy, visual ? Qt::HANDLE (visual) : 0,
+ colormap ? Qt::HANDLE (colormap) : 0);
#endif
if (args->isSet ("sm-disable"))
app->disableSessionManagement ();
- if (!XDamageQueryExtension (QX11Info::display(), &event, &error))
+ if (!XDamageQueryExtension (QX11Info::display (), &event, &error))
{
fprintf (stderr,
"%s: Damage extension is missing on display \"%s\"\n",
- argv[0], DisplayString (QX11Info::display()));
+ argv[0], DisplayString (QX11Info::display ()));
return 1;
}
- status = decor_acquire_dm_session (QX11Info::display(),
+ status = decor_acquire_dm_session (QX11Info::display (),
QX11Info::appScreen (),
"kwd", args->isSet ("replace"),
&timestamp);
@@ -164,7 +164,7 @@ main (int argc, char **argv)
"%s: Could not acquire decoration manager "
"selection on screen %d display \"%s\"\n",
argv[0], QX11Info::appScreen (),
- DisplayString (QX11Info::display()));
+ DisplayString (QX11Info::display ()));
}
else if (status == DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING)
{
@@ -174,13 +174,13 @@ main (int argc, char **argv)
"--replace option to replace the current "
"decoration manager.\n",
argv[0], QX11Info::appScreen (),
- DisplayString (QX11Info::display()));
+ DisplayString (QX11Info::display ()));
}
return 1;
}
- decor_set_dm_check_hint (QX11Info::display(), QX11Info::appScreen (),
+ decor_set_dm_check_hint (QX11Info::display (), QX11Info::appScreen (),
WINDOW_DECORATION_TYPE_PIXMAP |
WINDOW_DECORATION_TYPE_WINDOW);
@@ -188,7 +188,7 @@ main (int argc, char **argv)
{
fprintf (stderr,
"%s: Could not enable decorations on display \"%s\"\n",
- argv[0], DisplayString (QX11Info::display()));
+ argv[0], DisplayString (QX11Info::display ()));
return 1;
}
@@ -196,7 +196,7 @@ main (int argc, char **argv)
if (QX11Info::appScreen () == 0)
appname = "org.kde.kwin";
else
- appname.sprintf("org.kde.kwin-screen-%d", QX11Info::appScreen ());
+ appname.sprintf ("org.kde.kwin-screen-%d", QX11Info::appScreen ());
QDBusConnection::sessionBus ().interface ()->registerService
(appname, QDBusConnectionInterface::DontQueueService);
diff --git a/kde/window-decorator-kde4/options.cpp b/kde/window-decorator-kde4/options.cpp
index c91c014..d0e1879 100644
--- a/kde/window-decorator-kde4/options.cpp
+++ b/kde/window-decorator-kde4/options.cpp
@@ -36,7 +36,7 @@ unsigned long
KWD::Options::updateSettings (void)
{
unsigned long changed = 0;
- KConfigGroup config = mConfig->group("Windows");
+ KConfigGroup config = mConfig->group ("Windows");
changed |= KDecorationOptions::updateSettings (mConfig);
@@ -54,7 +54,7 @@ KWD::Options::updateSettings (void)
"Maximize (horizontal only)"),
true));
- config = mConfig->group("MouseBindings");
+ config = mConfig->group ("MouseBindings");
CmdActiveTitlebar1 =
mouseCommand (config.readEntry ("CommandActiveTitlebar1",
diff --git a/kde/window-decorator-kde4/switcher.cpp b/kde/window-decorator-kde4/switcher.cpp
index 27fc810..f9ec4b3 100644
--- a/kde/window-decorator-kde4/switcher.cpp
+++ b/kde/window-decorator-kde4/switcher.cpp
@@ -49,15 +49,16 @@ KWD::Switcher::Switcher (WId, WId id):
QColor color;
color = Plasma::Theme::defaultTheme ()->color (Plasma::Theme::TextColor);
- mBackground = new Plasma::FrameSvg();
+ mBackground = new Plasma::FrameSvg ();
mBackground->setImagePath ("dialogs/background");
- mBackground->setEnabledBorders(Plasma::FrameSvg::AllBorders);
+ 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;
+ 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;
@@ -128,7 +129,7 @@ KWD::Switcher::updateGeometry ()
mPixmap = QPixmap::fromX11Pixmap (mX11Pixmap, QPixmap::ExplicitlyShared);
mBackgroundPixmap = QPixmap::fromX11Pixmap (mX11BackgroundPixmap,
- QPixmap::ExplicitlyShared);
+ QPixmap::ExplicitlyShared);
#else
mPixmap = QPixmap (width + mBorder.left + mBorder.right,
height + mBorder.top + mBorder.bottom);
@@ -205,7 +206,7 @@ KWD::Switcher::update ()
fm.height ()));
p.setFont (font);
- p.setPen (Plasma::Theme::defaultTheme ()->color(Plasma::Theme::TextColor));
+ 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);
@@ -240,7 +241,7 @@ KWD::Switcher::updateWindowProperties ()
quads, nQuad);
#endif
KWD::trapXError ();
- XChangeProperty (QX11Info::display(), mId, Atoms::netWindowDecor,
+ XChangeProperty (QX11Info::display (), mId, Atoms::netWindowDecor,
XA_INTEGER, 32, PropModeReplace, (unsigned char *) data,
BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
KWD::popXError ();
@@ -269,7 +270,7 @@ KWD::Switcher::updateBlurProperty (int topOffset,
if (blurType != BLUR_TYPE_NONE)
{
QRegion r;
-
+
topQRegion = QRegion (-mContext.extents.left, -mContext.extents.top,
w, mContext.extents.top);
topRegion = topQRegion.handle ();
diff --git a/kde/window-decorator-kde4/switcher.h b/kde/window-decorator-kde4/switcher.h
index f6305a0..cb0c350 100644
--- a/kde/window-decorator-kde4/switcher.h
+++ b/kde/window-decorator-kde4/switcher.h
@@ -61,7 +61,7 @@ class Switcher
int bottomOffset,
int leftOffset,
int rightOffset);
- void redrawPixmap ();
+ void redrawPixmap ();
private:
diff --git a/kde/window-decorator-kde4/utils.cpp b/kde/window-decorator-kde4/utils.cpp
index a9ef8e4..d9ed12e 100644
--- a/kde/window-decorator-kde4/utils.cpp
+++ b/kde/window-decorator-kde4/utils.cpp
@@ -78,7 +78,7 @@ KWD::trapXError (void)
int
KWD::popXError (void)
{
- XSync (QX11Info::display(), false);
+ XSync (QX11Info::display (), false);
XSetErrorHandler (oldErrorHandler);
return trappedErrorCode;
@@ -98,7 +98,7 @@ KWD::readXProperty (WId window,
int result;
KWD::trapXError ();
- result = XGetWindowProperty (QX11Info::display(), window, property, offset,
+ result = XGetWindowProperty (QX11Info::display (), window, property, offset,
length, false, type,
&actualType, &format, &nItems,
&bytesRemaining, &data);
@@ -111,7 +111,7 @@ KWD::readXProperty (WId window,
if (items)
*items = nItems;
- return reinterpret_cast <void *>(data);
+ return reinterpret_cast <void *> (data);
}
if (data)
@@ -133,7 +133,7 @@ KWD::readWindowProperty (long window,
if (data)
{
if (value)
- *value = *reinterpret_cast <int *>(data);
+ *value = *reinterpret_cast <int *> (data);
XFree (data);
@@ -154,7 +154,7 @@ KWD::readPropertyShort (WId id,
unsigned char *data;
KWD::trapXError ();
- result = XGetWindowProperty (QX11Info::display(), id, property,
+ result = XGetWindowProperty (QX11Info::display (), id, property,
0L, 1L, FALSE, XA_CARDINAL, &actual, &format,
&n, &left, &data);
if (KWD::popXError ())
@@ -177,7 +177,7 @@ KWD::readPropertyShort (WId id,
void
KWD::Atoms::init (void)
{
- Display *xdisplay = QX11Info::display();
+ Display *xdisplay = QX11Info::display ();
netInputFrameWindow =
XInternAtom (xdisplay, DECOR_INPUT_FRAME_ATOM_NAME, false);
diff --git a/kde/window-decorator-kde4/window.cpp b/kde/window-decorator-kde4/window.cpp
index 0d0c1d4..a5e8d8e 100644
--- a/kde/window-decorator-kde4/window.cpp
+++ b/kde/window-decorator-kde4/window.cpp
@@ -158,25 +158,25 @@ KWD::Window::Window (WId parentId,
KWD::Window::~Window (void)
{
if (mShadow)
- decor_shadow_destroy (QX11Info::display(), mShadow);
+ decor_shadow_destroy (QX11Info::display (), mShadow);
if (mPicture)
- XRenderFreePicture (QX11Info::display(), mPicture);
+ XRenderFreePicture (QX11Info::display (), mPicture);
if (mPixmap)
- XFreePixmap (QX11Info::display(), mPixmap);
+ XFreePixmap (QX11Info::display (), mPixmap);
if (mTexturePicture)
- XRenderFreePicture (QX11Info::display(), mTexturePicture);
+ XRenderFreePicture (QX11Info::display (), mTexturePicture);
if (mDecorationPicture)
- XRenderFreePicture (QX11Info::display(), mDecorationPicture);
+ XRenderFreePicture (QX11Info::display (), mDecorationPicture);
if (mTexturePixmap)
- XFreePixmap (QX11Info::display(), mTexturePixmap);
+ XFreePixmap (QX11Info::display (), mTexturePixmap);
if (mTexturePixmapBuffer)
- XFreePixmap (QX11Info::display(), mTexturePixmapBuffer);
+ XFreePixmap (QX11Info::display (), mTexturePixmapBuffer);
if (mDecor)
delete mDecor;
@@ -379,7 +379,7 @@ KWD::Window::showWindowMenu (const QPoint &pos)
{
QAction *action;
const int levels[] = { 100, 90, 75, 50, 25, 10 };
-
+
mPopup = new QMenu ();
mPopup->setFont (KGlobalSettings::menuFont ());
@@ -427,7 +427,6 @@ KWD::Window::showWindowMenu (const QPoint &pos)
connect (mOpacityMenu, SIGNAL (triggered (QAction*)),
SLOT (handleOpacityPopupActivated (QAction*)));
-
for (unsigned int i = 0;
i < sizeof (levels) / sizeof (levels[0]); ++i)
@@ -458,7 +457,7 @@ KWD::Window::showWindowMenu (const QPoint &pos)
mMoveOpAction->setData (KDecorationDefines::MoveOp);
mResizeOpAction = mPopup->addAction (i18n ("Re&size"));
- kaction = qobject_cast<KAction*> (mKeys.action("Window Resize"));
+ kaction = qobject_cast<KAction*> (mKeys.action ("Window Resize"));
if (kaction != 0)
mResizeOpAction->setShortcut (kaction->globalShortcut ().primary ());
mResizeOpAction->setData (KDecorationDefines::ResizeOp);
@@ -485,9 +484,9 @@ KWD::Window::showWindowMenu (const QPoint &pos)
mPopup->addSeparator ();
- mCloseOpAction = mPopup->addAction (i18n("&Close"));
+ mCloseOpAction = mPopup->addAction (i18n ("&Close"));
mCloseOpAction->setIcon (KIcon ("window-close" ));
- kaction = qobject_cast<KAction*> (mKeys.action("Window Close"));
+ kaction = qobject_cast<KAction*> (mKeys.action ("Window Close"));
if (kaction != 0)
mCloseOpAction->setShortcut (kaction->globalShortcut ().primary ());
mCloseOpAction->setData (KDecorationDefines::CloseOp);
@@ -497,7 +496,7 @@ KWD::Window::showWindowMenu (const QPoint &pos)
pnt += QPoint (mGeometry.x () - mBorder.left,
mGeometry.y () - mBorder.top);
-
+
mPopup->exec (pnt);
}
@@ -519,15 +518,15 @@ KWD::Window::processMousePressEvent (QMouseEvent *qme)
switch (qme->button ()) {
case Qt::LeftButton:
com = active ? Decorator::options ()->commandActiveTitlebar1 () :
- Decorator::options()->commandInactiveTitlebar1 ();
+ Decorator::options ()->commandInactiveTitlebar1 ();
break;
case Qt::MidButton:
com = active ? Decorator::options ()->commandActiveTitlebar2 () :
- Decorator::options()->commandInactiveTitlebar2 ();
+ Decorator::options ()->commandInactiveTitlebar2 ();
break;
case Qt::RightButton:
com = active ? Decorator::options ()->commandActiveTitlebar3 () :
- Decorator::options()->commandInactiveTitlebar3 ();
+ Decorator::options ()->commandInactiveTitlebar3 ();
default:
break;
}
@@ -733,7 +732,7 @@ KWD::Window::titlebarMouseWheelOperation (int delta)
{
Options::MouseCommand com;
- com = Decorator::options()->operationTitlebarMouseWheel (delta);
+ com = Decorator::options ()->operationTitlebarMouseWheel (delta);
performMouseCommand (com, 0);
}
@@ -783,7 +782,7 @@ KWD::Window::createDecoration (void)
if (mFrame)
{
KWD::trapXError ();
- XSelectInput (QX11Info::display(), mFrame,
+ XSelectInput (QX11Info::display (), mFrame,
StructureNotifyMask | PropertyChangeMask |
ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
EnterWindowMask | LeaveWindowMask);
@@ -792,7 +791,7 @@ KWD::Window::createDecoration (void)
}
KWD::trapXError ();
- XSelectInput (QX11Info::display(), QWidget::winId(),
+ XSelectInput (QX11Info::display (), QWidget::winId (),
StructureNotifyMask | PropertyChangeMask);
KWD::popXError ();
@@ -1010,7 +1009,7 @@ cornersFromQRegion (QRegion *region,
void
KWD::Window::updateShadow (void)
{
- Display *xdisplay = QX11Info::display();
+ Display *xdisplay = QX11Info::display ();
Screen *xscreen;
XRenderPictFormat *xformat;
int leftCorner, rightCorner, topCorner, bottomCorner;
@@ -1022,7 +1021,7 @@ KWD::Window::updateShadow (void)
if (mShadow)
{
- decor_shadow_destroy (QX11Info::display(), mShadow);
+ decor_shadow_destroy (QX11Info::display (), mShadow);
mShadow = NULL;
}
@@ -1094,38 +1093,38 @@ KWD::Window::updateShadow (void)
&mLayout);
if (mDecorationPicture)
- XRenderFreePicture (QX11Info::display(), mDecorationPicture);
+ XRenderFreePicture (QX11Info::display (), mDecorationPicture);
if (mTexturePicture)
- XRenderFreePicture (QX11Info::display(), mTexturePicture);
+ XRenderFreePicture (QX11Info::display (), mTexturePicture);
if (mTexturePixmap)
- XFreePixmap (QX11Info::display(), mTexturePixmap);
+ XFreePixmap (QX11Info::display (), mTexturePixmap);
if (mTexturePixmapBuffer)
- XFreePixmap (QX11Info::display(), mTexturePixmapBuffer);
+ XFreePixmap (QX11Info::display (), mTexturePixmapBuffer);
- mTexturePixmap = XCreatePixmap (QX11Info::display(),
+ mTexturePixmap = XCreatePixmap (QX11Info::display (),
QX11Info::appRootWindow (),
mLayout.width, mLayout.height, 32);
- mTexturePixmapBuffer = XCreatePixmap (QX11Info::display(),
+ mTexturePixmapBuffer = XCreatePixmap (QX11Info::display (),
QX11Info::appRootWindow (),
mLayout.width, mLayout.height, 32);
mTexturePixmapSize = QSize (mLayout.width, mLayout.height);
- xformat = XRenderFindStandardFormat (QX11Info::display(),
+ xformat = XRenderFindStandardFormat (QX11Info::display (),
PictStandardARGB32);
mDecorationPicture =
- XRenderCreatePicture (QX11Info::display(),
+ XRenderCreatePicture (QX11Info::display (),
mTexturePixmap,
xformat, 0, NULL);
mTexturePicture =
- XRenderCreatePicture (QX11Info::display(),
+ XRenderCreatePicture (QX11Info::display (),
mTexturePixmapBuffer,
xformat, 0, NULL);
- decor_fill_picture_extents_with_shadow (QX11Info::display(),
+ decor_fill_picture_extents_with_shadow (QX11Info::display (),
mShadow,
&mContext,
mTexturePicture,
@@ -1157,7 +1156,7 @@ KWD::Window::setMask (const QRegion &reg, int)
mGeometry.width (), mGeometry.height ());
KWD::trapXError ();
- XShapeCombineRegion (QX11Info::display(),
+ XShapeCombineRegion (QX11Info::display (),
mFrame,
(mType == Normal2D) ? ShapeBounding : ShapeInput,
0,
@@ -1213,7 +1212,7 @@ KWD::Window::resizeDecoration (bool force)
if (mType != Normal && mType != Normal2D)
{
- Display *xdisplay = QX11Info::display();
+ Display *xdisplay = QX11Info::display ();
Screen *xscreen;
decor_shadow_t *tmpShadow;
decor_context_t c;
@@ -1257,17 +1256,17 @@ KWD::Window::resizeDecoration (bool force)
if (mPixmap)
{
- XFreePixmap (QX11Info::display(), mPixmap);
+ XFreePixmap (QX11Info::display (), mPixmap);
mPixmap = None;
}
if (mPicture)
{
- XRenderFreePicture (QX11Info::display(), mPicture);
+ XRenderFreePicture (QX11Info::display (), mPicture);
mPicture = 0;
}
- if (w != width() || h != height())
+ if (w != width () || h != height ())
{
mPendingConfigure = 1;
}
@@ -1280,7 +1279,7 @@ KWD::Window::resizeDecoration (bool force)
if (mType != Normal2D)
{
- XMoveResizeWindow (QX11Info::display(), winId(),
+ XMoveResizeWindow (QX11Info::display (), winId (),
mGeometry.x () + ROOT_OFF_X - mBorder.left,
mGeometry.y () + ROOT_OFF_Y - mBorder.top,
w, h);
@@ -1289,7 +1288,7 @@ KWD::Window::resizeDecoration (bool force)
{
mPendingMap = 1;
- XReparentWindow (QX11Info::display(), winId (), mParentId, 0, 0);
+ XReparentWindow (QX11Info::display (), winId (), mParentId, 0, 0);
show ();
mMapped = true;
@@ -1297,7 +1296,7 @@ KWD::Window::resizeDecoration (bool force)
if (mDamageId != winId ())
{
mDamageId = winId ();
- XDamageCreate (QX11Info::display(), mDamageId,
+ XDamageCreate (QX11Info::display (), mDamageId,
XDamageReportRawRectangles);
}
}
@@ -1306,7 +1305,7 @@ KWD::Window::resizeDecoration (bool force)
{
if (!mMapped)
{
- XReparentWindow (QX11Info::display(), mDecor->widget ()->winId (),
+ XReparentWindow (QX11Info::display (), mDecor->widget ()->winId (),
mFrame, 0, 0);
mMapped = true;
updateProperty ();
@@ -1329,17 +1328,17 @@ KWD::Window::rebindPixmap (void)
return;
if (mPicture)
- XRenderFreePicture (QX11Info::display(), mPicture);
+ XRenderFreePicture (QX11Info::display (), mPicture);
if (mPixmap)
- XFreePixmap (QX11Info::display(), mPixmap);
+ XFreePixmap (QX11Info::display (), mPixmap);
- mPixmap = XCompositeNameWindowPixmap (QX11Info::display(), winId ());
+ mPixmap = XCompositeNameWindowPixmap (QX11Info::display (), winId ());
- xformat = XRenderFindVisualFormat (QX11Info::display(),
+ xformat = XRenderFindVisualFormat (QX11Info::display (),
(Visual *) QX11Info::appVisual ());
- mPicture = XRenderCreatePicture (QX11Info::display(), mPixmap,
+ mPicture = XRenderCreatePicture (QX11Info::display (), mPixmap,
xformat, 0, NULL);
updateShadow ();
@@ -1469,7 +1468,7 @@ KWD::Window::updateBlurProperty (int topOffset,
rightRegion, rightOffset);
KWD::trapXError ();
- XChangeProperty (QX11Info::display(), mClientId, atom,
+ XChangeProperty (QX11Info::display (), mClientId, atom,
XA_INTEGER,
32, PropModeReplace, (unsigned char *) data,
2 + size * 6);
@@ -1478,7 +1477,7 @@ KWD::Window::updateBlurProperty (int topOffset,
else
{
KWD::trapXError ();
- XDeleteProperty (QX11Info::display(), mClientId, atom);
+ XDeleteProperty (QX11Info::display (), mClientId, atom);
KWD::popXError ();
}
}
@@ -1517,12 +1516,12 @@ KWD::Window::updateProperty (void)
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;
@@ -1535,18 +1534,18 @@ KWD::Window::updateProperty (void)
x = w - mContext.left_space - mContext.left_corner_space;
if (x > topXOffset)
topXOffset = 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 () - mBorder.left - 2;
@@ -1561,9 +1560,9 @@ KWD::Window::updateProperty (void)
rh / 2,
topXOffset,
w / 2);
-
+
updateBlurProperty (topXOffset, w / 2, lh / 2, rh / 2);
-
+
minWidth = mContext.left_corner_space + 1 + mContext.right_corner_space;
}
else
@@ -1582,9 +1581,9 @@ KWD::Window::updateProperty (void)
{
decor_gen_window_property (data, &normExtents, &maxExtents, 1, 0);
}
-
+
KWD::trapXError ();
- XChangeProperty (QX11Info::display(), mClientId, atom,
+ XChangeProperty (QX11Info::display (), mClientId, atom,
XA_INTEGER,
32, PropModeReplace, (unsigned char *) data,
BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
@@ -1605,12 +1604,12 @@ KWD::Window::updateFrame (WId frame)
{
if (mMapped && mType == Normal2D && mFrame != frame)
{
- XReparentWindow (QX11Info::display(), winId (), frame, 0, 0);
+ XReparentWindow (QX11Info::display (), winId (), frame, 0, 0);
}
mFrame = frame;
KWD::trapXError ();
- XSelectInput (QX11Info::display(), mFrame,
+ XSelectInput (QX11Info::display (), mFrame,
StructureNotifyMask | PropertyChangeMask |
ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
EnterWindowMask | LeaveWindowMask);
@@ -1665,7 +1664,7 @@ KWD::Window::reloadDecoration (void)
if (mShadow)
{
- decor_shadow_destroy (QX11Info::display(), mShadow);
+ decor_shadow_destroy (QX11Info::display (), mShadow);
mShadow = NULL;
}
@@ -1706,9 +1705,9 @@ KWD::Window::updateCursor (QPoint pos)
{
KWD::trapXError ();
if (mType == Normal2D)
- XDefineCursor (QX11Info::display(), winId (), positionToCursor (pos));
+ XDefineCursor (QX11Info::display (), winId (), positionToCursor (pos));
else
- XDefineCursor (QX11Info::display(), mFrame, positionToCursor (pos));
+ XDefineCursor (QX11Info::display (), mFrame, positionToCursor (pos));
KWD::popXError ();
}
@@ -1723,7 +1722,7 @@ KWD::Window::getWindowProtocols (void)
mSupportContextHelp = false;
KWD::trapXError ();
- status = XGetWMProtocols (QX11Info::display(), mClientId, &p, &n);
+ status = XGetWMProtocols (QX11Info::display (), mClientId, &p, &n);
if (KWD::popXError ())
return;
@@ -1747,20 +1746,21 @@ KWD::Window::getWindowProtocols (void)
void
KWD::Window::handlePopupActivated (QAction * action)
{
- WindowOperation op = static_cast <WindowOperation> (action->data().toInt());
+ WindowOperation op;
+ op = static_cast <WindowOperation> (action->data ().toInt ());
performWindowOperation (op);
}
void
KWD::Window::handleOpacityPopupActivated (QAction *action)
{
- int op = action->data().toInt();
+ int op = action->data ().toInt ();
op = op * 0xffff / 100;
if (op != mOpacity)
- Decorator::sendClientMessage (QX11Info::appRootWindow(), mClientId,
+ Decorator::sendClientMessage (QX11Info::appRootWindow (), mClientId,
Atoms::netWmWindowOpacity,
(op << 16) | op);
}
@@ -1769,9 +1769,8 @@ KWD::Window::handleOpacityPopupActivated (QAction *action)
void
KWD::Window::handleDesktopPopupActivated (QAction *action)
{
-
- if (action->data().toInt())
- setDesktop (action->data().toInt());
+ if (action->data ().toInt ())
+ setDesktop (action->data ().toInt ());
else
KWindowSystem::setOnAllDesktops (mClientId, true);
}
@@ -1844,11 +1843,11 @@ KWD::Window::handlePopupAboutToShow (void)
{
foreach (QAction* action, mOpacityMenu->actions ())
{
- if(action->data ().toInt () ==
- qRound ((float)mOpacity * 100.0 / 0xffff))
- action->setChecked( true );
+ if (action->data ().toInt () ==
+ qRound ((float) mOpacity * 100.0 / 0xffff))
+ action->setChecked (true);
else
- action->setChecked( false );
+ action->setChecked (false);
}
}
@@ -1954,12 +1953,12 @@ KWD::Window::moveWindow (QMouseEvent *qme)
direction = positionToDirection (mDecor->mousePosition (qme->pos ()));
- XUngrabPointer (QX11Info::display(), CurrentTime);
- XUngrabKeyboard (QX11Info::display(), CurrentTime);
+ XUngrabPointer (QX11Info::display (), CurrentTime);
+ XUngrabKeyboard (QX11Info::display (), CurrentTime);
Decorator::rootInfo ()->restackRequest (mClientId, NET::FromApplication,
- None, Above,
- QX11Info::appTime());
+ None, Above,
+ QX11Info::appTime ());
Decorator::rootInfo ()->moveResizeRequest (mClientId,
qme->globalX (),
qme->globalY (),
@@ -2034,7 +2033,7 @@ KWD::Window::performMouseCommand (Options::MouseCommand command,
if (opacity > 0xffff)
opacity = 0xffff;
- Decorator::sendClientMessage (QX11Info::appRootWindow(),
+ Decorator::sendClientMessage (QX11Info::appRootWindow (),
mClientId,
Atoms::netWmWindowOpacity,
(opacity << 16) | opacity);
@@ -2050,7 +2049,7 @@ KWD::Window::performMouseCommand (Options::MouseCommand command,
if (opacity < OPACITY_STEP)
opacity = OPACITY_STEP;
- Decorator::sendClientMessage (QX11Info::appRootWindow(),
+ Decorator::sendClientMessage (QX11Info::appRootWindow (),
mClientId,
Atoms::netWmWindowOpacity,
(opacity << 16) | opacity);
@@ -2110,7 +2109,7 @@ KWD::Window::processDamage (void)
{
r2.translate (-xOff, -yOff);
- decor_blend_border_picture (QX11Info::display(),
+ decor_blend_border_picture (QX11Info::display (),
&mContext,
mPicture,
xOff, xOff,
@@ -2133,7 +2132,7 @@ KWD::Window::processDamage (void)
{
r2.translate (-xOff, -yOff);
- decor_blend_border_picture (QX11Info::display(),
+ decor_blend_border_picture (QX11Info::display (),
&mContext,
mPicture,
xOff, yOff,
@@ -2156,7 +2155,7 @@ KWD::Window::processDamage (void)
{
r2.translate (-xOff, -yOff);
- decor_blend_border_picture (QX11Info::display(),
+ decor_blend_border_picture (QX11Info::display (),
&mContext,
mPicture,
xOff, yOff,
@@ -2179,7 +2178,7 @@ KWD::Window::processDamage (void)
{
r2.translate (-xOff, -yOff);
- decor_blend_border_picture (QX11Info::display(),
+ decor_blend_border_picture (QX11Info::display (),
&mContext,
mPicture,
xOff, yOff,
@@ -2194,7 +2193,7 @@ KWD::Window::processDamage (void)
mDamage = QRegion ();
- XRenderComposite (QX11Info::display(),
+ XRenderComposite (QX11Info::display (),
PictOpSrc,
mTexturePicture,
None,
@@ -2215,8 +2214,9 @@ 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);
+ NETWinInfo wInfo = NETWinInfo (QX11Info::display (), mClientId,
+ QX11Info::appRootWindow (),
+ NET::WMPid);
QByteArray clientMachine, resourceClass;
pid_t pid;
char buf[257];
@@ -2254,37 +2254,38 @@ KWD::Window::hideKillProcessDialog (void)
}
bool
-KWD::Window::eventFilter( QObject* o, QEvent* e )
+KWD::Window::eventFilter (QObject *o,
+ QEvent *e)
{
- if (mDecor == NULL || o != mDecor->widget())
+ if (!mDecor || o != mDecor->widget ())
return false;
- if (e->type() == QEvent::MouseMove)
+ if (e->type () == QEvent::MouseMove)
{
- QMouseEvent* ev = static_cast< QMouseEvent* >( e );
- updateCursor (QPoint (ev->x(), ev->y()));
+ QMouseEvent* ev = static_cast<QMouseEvent *> (e);
+ updateCursor (QPoint (ev->x (), ev->y ()));
}
return false;
}
// unsable API part
void
-KWD::Window::repaintShadow()
+KWD::Window::repaintShadow ()
{
}
bool
-KWD::Window::compositingActive() const
+KWD::Window::compositingActive () const
{
return false;
}
bool
-KWD::Window::shadowsActive() const
+KWD::Window::shadowsActive () const
{
return false;
}
-double KWD::Window::opacity() const
+double KWD::Window::opacity () const
{
return 1.0;
}
diff --git a/kde/window-decorator-kde4/window.h b/kde/window-decorator-kde4/window.h
index c8229a6..de7031a 100644
--- a/kde/window-decorator-kde4/window.h
+++ b/kde/window-decorator-kde4/window.h
@@ -62,10 +62,10 @@ class Window:public QWidget, public KDecorationBridgeUnstable {
~Window (void);
// unsable API part
- virtual void repaintShadow();
- virtual bool compositingActive() const;
- virtual bool shadowsActive() const;
- virtual double opacity() const;
+ virtual void repaintShadow ();
+ virtual bool compositingActive () const;
+ virtual bool shadowsActive () const;
+ virtual double opacity () const;
// stable API part;
virtual bool isActive (void) const;
@@ -212,9 +212,8 @@ class Window:public QWidget, public KDecorationBridgeUnstable {
}
return QWidget::childAt (x, y);
}
-
- virtual bool eventFilter( QObject* o, QEvent* e );
+ virtual bool eventFilter (QObject *o, QEvent *e);
private:
bool resizeDecoration (bool force = false);