----- Ursprüngliche Mitteilung ----- > Let me preface this post by saying that I have very little experience > programming in c++ and working with KDE development. > > I am developing a plasmoid similar to > http://kde-apps.org/content/show.php/Yet+Another+Window+Control?content=139916. > Except I am mainly re-purposing it to only work with the active maximized > window. So if no windows are maximized then the plasmoid is hidden and it > only operates on the active maximized window. > > That part I have covered and is working wonderfully. > > The part that I want to get a grasp over is how to hide the titlebar of > the active maximized window. I know I can add > "BorderlessMaximizedWindows=true" to the user's kwinrc, but I wish to > hide the titlebar programatically to avoid messing with the user's > settings and to also ensure that if the plasmoid is removed that > maximized windows will behave like they did before the plasmoid was > added. There is to my knowledge no way to programatically hide window decorations except for a legacy motif hint which I am currently considering to drop support for in KWin.
Cheers Martin > > I found that you can get and set window flags > http://doc.qt.nokia/latest/qt.html/#WindowType-enum through the QWidget > class. The flag I'm specifically wanting to set is > Qt::FramelessWindowHint. I'm supposed to be able to pass the window id > of the active window to QWidget's find() function and it will return a > QWidget object so I can manipulate the window flags. However, it always > returns 0 (not found). > > Here is the function that determines if the window is maximized, sets up > the plasmoid display, and is supposed to remove the titlebar. Any ideas > on why QWidget::find() always returns 0 even though the window ID passed > to it obviously belongs to a valid window? > > void MaxWinControl::syncActiveWindow() > { > m_syncDelay = false; > bool applicationActive = false; > > foreach (QWidget *widget, QApplication::topLevelWidgets()) { > if (widget->winId() == m_pendingActiveWindow || > widget->winId() == KWindowSystem::activeWindow()) { > applicationActive = true; > > break; > } > } > > if (applicationActive && m_pendingActiveWindow > 0) { > m_closeTask->hide(); > m_maximizeTask->hide(); > m_minimizeTask->hide(); > m_currentTaskTitle->hide(); > m_currentTaskIcon->hide(); > } else if (m_pendingActiveWindow > 0) { > m_activeWindow = m_pendingActiveWindow; > m_lastActiveWindow = m_pendingActiveWindow; > KWindowInfo info = KWindowSystem::windowInfo(m_activeWindow, > NET::WMName|NET::WMState); > > if (info.state() & NET::Max) { > QWidget *activeWidget = QWidget::find(m_activeWindow); > > /* !! This always evaluates to 0 !! */ > if (activeWidget) { > // store the previous flags for this window so we can >restore > them when the window is unmaximized > activeWidgetFlags = activeWidget->windowFlags(); > > activeWidget->setWindowFlags(Qt::FramelessWindowHint); > > activeWidget->show(); > } > if (m_showTitle) { > m_currentTaskTitle->setText(info.name()); > m_currentTaskTitle->update(); > > m_currentTaskTitle->show(); > } > > if (m_showClose) { > m_closeTask->show(); > } > if (m_showMaximize) { > m_maximizeTask->show(); > } > if (m_showMinimize) { > m_minimizeTask->show(); > } > > if (m_showCurrentTaskIcon) { > m_currentTaskIcon->setIcon(KWindowSystem::icon(m_activeWindow, > KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium)); > > m_currentTaskIcon->show(); > } > > m_maximizeTask->setSvg("widgets/configuration-icons", > "unmaximize"); } > else { > m_closeTask->hide(); > m_maximizeTask->hide(); > m_minimizeTask->hide(); > m_currentTaskTitle->hide(); > m_currentTaskIcon->hide(); > } > } > > m_pendingActiveWindow = 0; > } > > > in Christ, > Brian > > ~ Jesus answered, "I am the way and the truth and the life. No one comes > to the Father except through me." - John 14:6 >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<