more robust location switch

an horizontal panel will have a fixed height
a vertical panel will have a fixed height
this way window managers don't fiddle with it
This commit is contained in:
Marco Martin 2014-02-14 19:06:06 +01:00
parent d1b0e89a63
commit e03570227c
2 changed files with 8 additions and 11 deletions

View File

@ -45,7 +45,7 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa
setScreen(panelView->screen()); setScreen(panelView->screen());
connect(panelView, &PanelView::screenChanged, [=](QScreen *screen){setScreen(screen); syncGeometry();}); connect(panelView, &PanelView::screenChanged, [=](QScreen *screen){setScreen(screen); syncGeometry();});
setFlags(Qt::FramelessWindowHint); setFlags(Qt::BypassWindowManagerHint);
KWindowEffects::enableBlurBehind(winId(), true); KWindowEffects::enableBlurBehind(winId(), true);
if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) {

View File

@ -209,7 +209,7 @@ void PanelView::setLength(int value)
if (value == length()) { if (value == length()) {
return; return;
} }
return;
config().writeEntry("length", value); config().writeEntry("length", value);
m_corona->requestApplicationConfigSync(); m_corona->requestApplicationConfigSync();
positionPanel(); positionPanel();
@ -376,25 +376,21 @@ void PanelView::positionPanel()
} }
m_strutsTimer->stop(); m_strutsTimer->stop();
m_strutsTimer->start(STRUTSTIMERDELAY); m_strutsTimer->start(STRUTSTIMERDELAY);
qWarning()<<"11111"<<size()<<"T"<<thickness()<< "L"<<length();
setMinimumSize(QSize(0, 0)); setMinimumSize(QSize(0, 0));
setMaximumSize(screen()->size()); setMaximumSize(screen()->size());
if (formFactor() == Plasma::Types::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
resize(thickness(), length()); resize(thickness(), length());
//setMaximumSize(QSize(thickness(), length())); setMinimumSize(QSize(thickness(), m_minLength));
//setMinimumSize(QSize(thickness(), length())); setMaximumSize(QSize(thickness(), m_maxLength));
setMinimumSize(QSize(0, m_minLength));
setMaximumSize(QSize(9999, m_maxLength));
emit thicknessChanged(); emit thicknessChanged();
emit length(); emit length();
} else { } else {
resize(length(), thickness()); resize(length(), thickness());
//setMaximumSize(QSize(length(), thickness())); setMinimumSize(QSize(m_minLength, thickness()));
//setMinimumSize(QSize(length(), thickness())); setMaximumSize(QSize(m_maxLength, thickness()));
setMinimumSize(QSize(m_minLength, 0));
setMaximumSize(QSize(m_maxLength, 9999));
emit thicknessChanged(); emit thicknessChanged();
emit length(); emit length();
@ -487,6 +483,7 @@ void PanelView::showConfigurationInterface(Plasma::Applet *applet)
void PanelView::resizeEvent(QResizeEvent *ev) void PanelView::resizeEvent(QResizeEvent *ev)
{ {
if (containment()->formFactor() == Plasma::Types::Vertical) { if (containment()->formFactor() == Plasma::Types::Vertical) {
config().writeEntry("length", ev->size().height()); config().writeEntry("length", ev->size().height());
config().writeEntry("thickness", ev->size().width()); config().writeEntry("thickness", ev->size().width());