[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/shells/mid
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2008-08-25 19:53:11
Message-ID: 1219693991.656459.8977.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 852357 by aseigo:
* use a MidView for the control bar
* reserve a strut for the control bar when used as the desktop
* remove some unnecessary code from midview
* disconnect old containment before connecting new one in midview
M +1 -1 midcorona.cpp
M +15 -25 midview.cpp
M +27 -3 plasmaapp.cpp
M +1 -0 plasmaapp.h
--- trunk/KDE/kdebase/workspace/plasma/shells/mid/midcorona.cpp #852356:852357
@@ -84,7 +84,7 @@
emit containmentAdded(c);
/*
- todo: replace with an applet layout at the top, perhaps reserve a WM strut while \
we're at it? + todo: replace with an applet layout at the top
loadDefaultApplet("systemtray", panel);
--- trunk/KDE/kdebase/workspace/plasma/shells/mid/midview.cpp #852356:852357
@@ -31,24 +31,8 @@
: Plasma::View(containment, defaultId(), parent)
{
setFocusPolicy(Qt::NoFocus);
+ connectContainment(containment);
- if (containment) {
- connectContainment(containment);
- containment->enableAction("add sibling containment", false);
- }
-
- //FIXME should we have next/prev or up/down/left/right or what?
- QAction *action = new QAction(i18n("Next Activity"), this);
- action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
- action->setShortcut(QKeySequence("ctrl+shift+n"));
- connect(action, SIGNAL(triggered()), this, SLOT(nextContainment()));
- addAction(action);
- action = new QAction(i18n("Previous Activity"), this);
- action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
- action->setShortcut(QKeySequence("ctrl+shift+p"));
- connect(action, SIGNAL(triggered()), this, SLOT(previousContainment()));
- addAction(action);
-
const int w = 25;
QPixmap tile(w * 2, w * 2);
tile.fill(palette().base().color());
@@ -68,18 +52,24 @@
void MidView::connectContainment(Plasma::Containment *containment)
{
- if (containment) {
- connect(containment, SIGNAL(showAddWidgetsInterface(QPointF)), this, \
SLOT(showAppletBrowser()));
- connect(containment, SIGNAL(focusRequested(Plasma::Containment *)), this, \
SLOT(setContainment(Plasma::Containment *)));
- connect(containment, SIGNAL(configureRequested()), this, \
SLOT(configureContainment())); + if (!containment) {
+ return;
}
+
+ connect(containment, SIGNAL(showAddWidgetsInterface(QPointF)), this, \
SLOT(showAppletBrowser())); + connect(containment, \
SIGNAL(focusRequested(Plasma::Containment *)), this, \
SLOT(setContainment(Plasma::Containment *))); + connect(containment, \
SIGNAL(configureRequested()), this, SLOT(configureContainment())); }
-void MidView::setContainment(Plasma::Containment *containment)
+void MidView::setContainment(Plasma::Containment *c)
{
- Plasma::View::setContainment(containment);
- containment->resize(size());
- kDebug() << "goin' in!" << size() << containment->geometry().size().toSize();
+ if (containment()) {
+ disconnect(containment(), 0, this, 0);
+ }
+
+ Plasma::View::setContainment(c);
+ connectContainment(c);
+ c->resize(size());
}
void MidView::configureContainment()
--- trunk/KDE/kdebase/workspace/plasma/shells/mid/plasmaapp.cpp #852356:852357
@@ -154,8 +154,7 @@
layout->setMargin(0);
layout->setSpacing(0);
- //FIXME: replace with a proper View subclass, or at least populate this one!
- m_controlBar = new Plasma::View(0, m_window);
+ m_controlBar = new MidView(0, m_window);
m_controlBar->setFixedHeight(CONTROL_BAR_HEIGHT);
m_controlBar->setBackgroundBrush(Qt::red);
m_mainView = new MidView(0, m_window);
@@ -166,6 +165,7 @@
int width = 400;
int height = 200;
if (isDesktop) {
+ //TODO: reserve a WM strut for m_controlBar
QRect rect = desktop()->screenGeometry(0);
width = rect.width();
height = rect.height();
@@ -187,8 +187,8 @@
// this line initializes the corona.
corona();
-
setIsDesktop(isDesktop);
+ reserveStruts();
if (isDesktop) {
notifyStartup(true);
@@ -251,6 +251,7 @@
int height = rect.height();
m_window->setFixedSize(width, height);
m_mainView->setFixedSize(width, height - CONTROL_BAR_HEIGHT);
+ reserveStruts();
}
void PlasmaApp::setCrashHandler()
@@ -268,6 +269,29 @@
system("plasma --nocrashhandler &"); // try to restart
}
+void PlasmaApp::reserveStruts()
+{
+ NETExtendedStrut strut;
+ if (isDesktop()) {
+ strut.top_width = m_controlBar->height();
+ strut.top_start = m_window->x();
+ strut.top_end = m_window->x() + m_window->width() - 1;
+ }
+
+ KWindowSystem::setExtendedStrut(m_window->winId(), strut.left_width,
+ strut.left_start,
+ strut.left_end,
+ strut.right_width,
+ strut.right_start,
+ strut.right_end,
+ strut.top_width,
+ strut.top_start,
+ strut.top_end,
+ strut.bottom_width,
+ strut.bottom_start,
+ strut.bottom_end);
+}
+
Plasma::Corona* PlasmaApp::corona()
{
if (!m_corona) {
--- trunk/KDE/kdebase/workspace/plasma/shells/mid/plasmaapp.h #852356:852357
@@ -66,6 +66,7 @@
private:
PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
static void crashHandler(int signal);
+ void reserveStruts();
private Q_SLOTS:
void setCrashHandler();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic