using associateClient to create new tab and map it to labelbuttons
This commit is contained in:
parent
bc3b377efb
commit
1bf17f9c32
2 changed files with 27 additions and 45 deletions
|
@ -422,20 +422,11 @@ void FluxboxWindow::init() {
|
||||||
frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
|
frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
|
||||||
frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
|
frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
|
||||||
|
|
||||||
|
associateClient(*m_client);
|
||||||
|
|
||||||
FbWinFrame::ButtonId btn = frame().createTab(m_client->title(),
|
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
|
||||||
new SetClientCmd(*m_client));
|
|
||||||
|
|
||||||
m_labelbuttons[m_client] = btn;
|
|
||||||
frame().setLabelButtonFocus(*btn);
|
|
||||||
|
|
||||||
FbTk::EventManager &evm = *FbTk::EventManager::instance();
|
|
||||||
|
|
||||||
evm.add(*this, btn->window()); // we take care of button events for this
|
|
||||||
evm.add(*this, m_client->window());
|
|
||||||
|
|
||||||
// redirect events from frame to us
|
// redirect events from frame to us
|
||||||
|
|
||||||
frame().setEventHandler(*this);
|
frame().setEventHandler(*this);
|
||||||
|
|
||||||
frame().resize(m_client->width(), m_client->height());
|
frame().resize(m_client->width(), m_client->height());
|
||||||
|
@ -473,10 +464,10 @@ void FluxboxWindow::init() {
|
||||||
// fetch client size and placement
|
// fetch client size and placement
|
||||||
XWindowAttributes wattrib;
|
XWindowAttributes wattrib;
|
||||||
if (! m_client->getAttrib(wattrib) ||
|
if (! m_client->getAttrib(wattrib) ||
|
||||||
!wattrib.screen // no screen? ??
|
!wattrib.screen || // no screen? ??
|
||||||
|| wattrib.override_redirect) { // override redirect
|
wattrib.override_redirect || // override redirect
|
||||||
|
m_client->initial_state == WithdrawnState) // Slit client
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// save old border width so we can restore it later
|
// save old border width so we can restore it later
|
||||||
m_client->old_bw = wattrib.border_width;
|
m_client->old_bw = wattrib.border_width;
|
||||||
|
@ -488,13 +479,6 @@ void FluxboxWindow::init() {
|
||||||
m_timer.setCommand(raise_cmd);
|
m_timer.setCommand(raise_cmd);
|
||||||
m_timer.fireOnce(true);
|
m_timer.fireOnce(true);
|
||||||
|
|
||||||
// Slit client?
|
|
||||||
if (m_client->initial_state == WithdrawnState) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this);
|
Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
@ -666,16 +650,13 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
|
||||||
|
|
||||||
ClientList::iterator client_insert_pos = getClientInsertPosition(x, y);
|
ClientList::iterator client_insert_pos = getClientInsertPosition(x, y);
|
||||||
FbTk::TextButton *button_insert_pos = NULL;
|
FbTk::TextButton *button_insert_pos = NULL;
|
||||||
if(client_insert_pos != m_clientlist.end())
|
if (client_insert_pos != m_clientlist.end())
|
||||||
button_insert_pos = m_labelbuttons[*client_insert_pos];
|
button_insert_pos = m_labelbuttons[*client_insert_pos];
|
||||||
|
|
||||||
// make sure we set new window search for each client
|
// make sure we set new window search for each client
|
||||||
ClientList::iterator client_it = old_win->clientList().begin();
|
ClientList::iterator client_it = old_win->clientList().begin();
|
||||||
ClientList::iterator client_it_end = old_win->clientList().end();
|
ClientList::iterator client_it_end = old_win->clientList().end();
|
||||||
for (; client_it != client_it_end; ++client_it) {
|
for (; client_it != client_it_end; ++client_it) {
|
||||||
// setup eventhandlers for client
|
|
||||||
evm.add(*this, (*client_it)->window());
|
|
||||||
|
|
||||||
// reparent window to this
|
// reparent window to this
|
||||||
frame().setClientWindow(**client_it);
|
frame().setClientWindow(**client_it);
|
||||||
if ((*client_it) == focused_win)
|
if ((*client_it) == focused_win)
|
||||||
|
@ -687,20 +668,13 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
|
||||||
frame().clientArea().width(),
|
frame().clientArea().width(),
|
||||||
frame().clientArea().height());
|
frame().clientArea().height());
|
||||||
|
|
||||||
(*client_it)->setFluxboxWindow(this);
|
|
||||||
|
|
||||||
// create a labelbutton for this client and
|
// create a labelbutton for this client and
|
||||||
// associate it with the pointer
|
// associate it with the pointer
|
||||||
FbWinFrame::ButtonId btn = frame().createTab((*client_it)->title(),
|
associateClient(*(*client_it));
|
||||||
new SetClientCmd(*(*client_it)));
|
|
||||||
m_labelbuttons[(*client_it)] = btn;
|
|
||||||
|
|
||||||
//null if we want the new button at the end of the list
|
//null if we want the new button at the end of the list
|
||||||
if(x >= 0 && button_insert_pos)
|
if (x >= 0 && button_insert_pos)
|
||||||
frame().moveLabelButtonLeftOf(*btn, *button_insert_pos);
|
frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos);
|
||||||
|
|
||||||
|
|
||||||
evm.add(*this, btn->window()); // we take care of button events for this
|
|
||||||
|
|
||||||
(*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
|
(*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
|
||||||
}
|
}
|
||||||
|
@ -714,20 +688,11 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
|
||||||
delete old_win;
|
delete old_win;
|
||||||
|
|
||||||
} else { // client.fbwindow() == 0
|
} else { // client.fbwindow() == 0
|
||||||
// create a labelbutton for this client and associate it with the pointer
|
associateClient(client);
|
||||||
FbWinFrame::ButtonId btn = frame().createTab(client.title(),
|
|
||||||
new SetClientCmd(client));
|
|
||||||
m_labelbuttons[&client] = btn;
|
|
||||||
|
|
||||||
FbTk::EventManager &evm = *FbTk::EventManager::instance();
|
|
||||||
|
|
||||||
evm.add(*this, btn->window()); // we take care of button events for this
|
|
||||||
|
|
||||||
if (&client == focused_win)
|
if (&client == focused_win)
|
||||||
was_focused = focused_win;
|
was_focused = focused_win;
|
||||||
|
|
||||||
client.setFluxboxWindow(this);
|
|
||||||
|
|
||||||
client.saveBlackboxAttribs(m_blackbox_attrib);
|
client.saveBlackboxAttribs(m_blackbox_attrib);
|
||||||
m_clientlist.push_back(&client);
|
m_clientlist.push_back(&client);
|
||||||
}
|
}
|
||||||
|
@ -3986,3 +3951,18 @@ void FluxboxWindow::ungrabPointer(Time time) {
|
||||||
if (s_num_grabs < 0)
|
if (s_num_grabs < 0)
|
||||||
s_num_grabs = 0;
|
s_num_grabs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluxboxWindow::associateClient(WinClient &client) {
|
||||||
|
|
||||||
|
FbWinFrame::ButtonId btn = frame().createTab(client.title(),
|
||||||
|
new SetClientCmd(client));
|
||||||
|
|
||||||
|
m_labelbuttons[&client] = btn;
|
||||||
|
|
||||||
|
|
||||||
|
FbTk::EventManager &evm = *FbTk::EventManager::instance();
|
||||||
|
|
||||||
|
evm.add(*this, btn->window()); // we take care of button events for this
|
||||||
|
evm.add(*this, client.window());
|
||||||
|
client.setFluxboxWindow(this);
|
||||||
|
}
|
||||||
|
|
|
@ -445,6 +445,8 @@ private:
|
||||||
Time time);
|
Time time);
|
||||||
static void ungrabPointer(Time time);
|
static void ungrabPointer(Time time);
|
||||||
|
|
||||||
|
void associateClient(WinClient &client);
|
||||||
|
|
||||||
// state and hint signals
|
// state and hint signals
|
||||||
WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig, m_focussig, m_titlesig;
|
WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig, m_focussig, m_titlesig;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue