more compact code

This commit is contained in:
Mathias Gumz 2013-05-23 09:19:34 +02:00
parent 2da8086673
commit c6489ab1b1

View file

@ -229,8 +229,7 @@ bool isWindowVisibleOnSomeHeadOrScreen(FluxboxWindow const& w) {
class SetClientCmd:public FbTk::Command<void> { class SetClientCmd:public FbTk::Command<void> {
public: public:
explicit SetClientCmd(WinClient &client):m_client(client) { explicit SetClientCmd(WinClient &client):m_client(client) { }
}
void execute() { void execute() {
m_client.focus(); m_client.focus();
} }
@ -480,7 +479,7 @@ void FluxboxWindow::init() {
// we must do this now, or else resizing may not work properly // we must do this now, or else resizing may not work properly
applyDecorations(); applyDecorations();
Fluxbox::instance()->attachSignals(*this); fluxbox.attachSignals(*this);
// this window is managed, we are now allowed to modify actual state // this window is managed, we are now allowed to modify actual state
m_initialized = true; m_initialized = true;
@ -489,25 +488,23 @@ void FluxboxWindow::init() {
m_workspace_number = screen().currentWorkspaceID(); m_workspace_number = screen().currentWorkspaceID();
// if we're a transient then we should be on the same layer and workspace // if we're a transient then we should be on the same layer and workspace
if (m_client->isTransient() && FluxboxWindow* twin = m_client->transientFor() ? m_client->transientFor()->fbwindow() : 0;
m_client->transientFor()->fbwindow() && if (twin && twin != this) {
m_client->transientFor()->fbwindow() != this) { layerItem().setLayer(twin->layerItem().getLayer());
layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); m_state.layernum = twin->layerNum();
m_state.layernum = m_client->transientFor()->fbwindow()->layerNum(); m_workspace_number = twin->workspaceNumber();
m_workspace_number =
m_client->transientFor()->fbwindow()->workspaceNumber();
} else // if no parent then set default layer } else // if no parent then set default layer
moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL); moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL);
fbdbg<<"FluxboxWindow::init("<<title().logical()<<") transientFor: "<< fbdbg<<"FluxboxWindow::init("<<title().logical()<<") transientFor: "<<
m_client->transientFor()<<endl; m_client->transientFor()<<endl;
if (m_client->transientFor() && m_client->transientFor()->fbwindow()) { if (twin) {
fbdbg<<"FluxboxWindow::init("<<title().logical()<<") transientFor->title(): "<< fbdbg<<"FluxboxWindow::init("<<title().logical()<<") transientFor->title(): "<<
m_client->transientFor()->fbwindow()->title().logical()<<endl; twin->title().logical()<<endl;
} }
unsigned int real_width = frame().width();
unsigned int real_width = frame().width(), real_height = frame().height(); unsigned int real_height = frame().height();
frame().applySizeHints(real_width, real_height); frame().applySizeHints(real_width, real_height);
screen().getWorkspace(m_workspace_number)->addWindow(*this); screen().getWorkspace(m_workspace_number)->addWindow(*this);
@ -555,14 +552,10 @@ void FluxboxWindow::init() {
} }
m_workspacesig.emit(*this); m_workspacesig.emit(*this);
m_creation_time = FbTk::FbTime::mono(); m_creation_time = FbTk::FbTime::mono();
frame().frameExtentSig().emit(); frame().frameExtentSig().emit();
setupWindow(); setupWindow();
fluxbox.sync(false);
FbTk::App::instance()->sync(false);
} }