- if (! config->getValue(screenstr + "placementIgnoreShaded",
- resource.ignore_shaded))
- resource.ignore_shaded = true;
-
- if (! config->getValue(screenstr + "placementIgnoreMaximized",
- resource.ignore_maximized))
- resource.ignore_maximized = true;
-
- if (! config->getValue(screenstr + "disableBindingsWithScrollLock",
- resource.allow_scroll_lock))
- resource.allow_scroll_lock = false;
-
- if (! config->getValue(screenstr + "workspaceWarping",
- resource.workspace_warping))
- resource.workspace_warping = false;
-
- resource.root_scroll = NormalScroll;
- if (config->getValue(screenstr + "rootScrollDirection", s)) {
- if (s == "None")
- resource.root_scroll = NoScroll;
- else if (s == "Reverse")
- resource.root_scroll = ReverseScroll;
- }
-}
-
-
-void BScreen::changeWorkspaceCount(unsigned int new_count) {
- assert(new_count > 0);
-
- if (new_count < workspacesList.size()) {
- // shrink
- for (unsigned int i = workspacesList.size(); i > new_count; --i)
- removeLastWorkspace();
- // removeLast already sets the current workspace to the
- // last available one.
- } else if (new_count > workspacesList.size()) {
- // grow
- for(unsigned int i = workspacesList.size(); i < new_count; ++i)
- addWorkspace();
- }
-}
-
-
-void BScreen::reconfigure(void) {
- // don't reconfigure while saving the initial rc file, it's a waste and it
- // breaks somethings (workspace names)
- if (blackbox->state() == Openbox::State_Starting) return;
-
- load_rc();
- LoadStyle();
+ // specify that if we exit, the window should not be destroyed and should be
+ // reparented back to root automatically
+ XChangeSaveSet(**otk::display, window, SetModeInsert);
+
+ // create the decoration frame for the client window
+ client->frame = new Frame(client, &_style);
+ // register the plate for events (map req's)
+ // this involves removing itself from the handler list first, since it is
+ // auto added to the list, being a widget. we won't get any events on the
+ // plate except for events for the client (SubstructureRedirectMask)
+ openbox->clearHandler(client->frame->plate());
+ openbox->registerHandler(client->frame->plate(), client);
+
+ // add to the wm's map
+ openbox->addClient(client->frame->window(), client);
+ openbox->addClient(client->frame->plate(), client);
+ openbox->addClient(client->frame->titlebar(), client);
+ openbox->addClient(client->frame->label(), client);
+ openbox->addClient(client->frame->button_max(), client);
+ openbox->addClient(client->frame->button_iconify(), client);
+ openbox->addClient(client->frame->button_alldesk(), client);
+ openbox->addClient(client->frame->button_close(), client);
+ openbox->addClient(client->frame->handle(), client);
+ openbox->addClient(client->frame->grip_left(), client);
+ openbox->addClient(client->frame->grip_right(), client);
+
+ // reparent the client to the frame
+ client->frame->grabClient();
+
+ if (!(openbox->state() == Openbox::State_Starting ||
+ client->positionRequested())) {
+ // position the window intelligenty .. hopefully :)
+ // call the python PLACEWINDOW binding
+ EventData data(_number, client, EventAction::PlaceWindow, 0);
+ openbox->bindings()->fireEvent(&data);
+ }
+
+ EventData ddata(_number, client, EventAction::DisplayingWindow, 0);
+ openbox->bindings()->fireEvent(&ddata);
+
+ // if on the current desktop.. (or all desktops)
+ if (client->desktop() == _desktop ||
+ client->desktop() == (signed)0xffffffff) {
+ client->frame->show();
+ }
+
+ client->applyStartupState();
+
+ otk::display->ungrab();
+
+ // add to the screen's list
+ clients.push_back(client);
+ // once the client is in the list, update our strut to include the new
+ // client's (it is good that this happens after window placement!)
+ updateStrut();
+ // this puts into the stacking order, then raises it
+ _stacking.push_back(client);
+ raiseWindow(client);
+ // update the root properties
+ changeClientList();
+
+ openbox->bindings()->grabButtons(true, client);
+
+ EventData ndata(_number, client, EventAction::NewWindow, 0);
+ openbox->bindings()->fireEvent(&ndata);
+
+#ifdef DEBUG
+ printf("Managed window 0x%lx frame 0x%lx\n",
+ window, client->frame->window());
+#endif
+}
+
+
+void Screen::unmanageWindow(Client *client)
+{
+ Frame *frame = client->frame;
+
+ // call the python CLOSEWINDOW binding
+ EventData data(_number, client, EventAction::CloseWindow, 0);
+ openbox->bindings()->fireEvent(&data);
+
+ openbox->bindings()->grabButtons(false, client);
+
+ // remove from the wm's map
+ openbox->removeClient(client->window());
+ openbox->removeClient(frame->window());
+ openbox->removeClient(frame->plate());
+ openbox->removeClient(frame->titlebar());
+ openbox->removeClient(frame->label());
+ openbox->removeClient(frame->button_max());
+ openbox->removeClient(frame->button_iconify());
+ openbox->removeClient(frame->button_alldesk());
+ openbox->removeClient(frame->button_close());
+ openbox->removeClient(frame->handle());
+ openbox->removeClient(frame->grip_left());
+ openbox->removeClient(frame->grip_right());
+ // unregister for handling events
+ openbox->clearHandler(client->window());
+
+ // remove the window from our save set
+ XChangeSaveSet(**otk::display, client->window(), SetModeDelete);