update wm_layout function to handle tree structure
This commit is contained in:
parent
ea2c1dcfbd
commit
6ae7143655
28
wm.c
28
wm.c
@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include "handler.h"
|
||||
#include "client.h"
|
||||
#include "util.h"
|
||||
@ -339,12 +340,35 @@ void wm_set_layout(Wm *wm, void(*f)(Wm *wm, Monitor*))
|
||||
wm->active_layout = f;
|
||||
}
|
||||
|
||||
// TODO: layout floating window, selected layout func p
|
||||
void wm_layout(Wm *wm, Monitor *m)
|
||||
{
|
||||
RETURN_IF_NULL(m);
|
||||
|
||||
wm_mstack(wm, m);
|
||||
Workspace *ws = &m->workspaces[m->selws];
|
||||
PtrArray clients = wm_treenode_find_client_nodes_ptr(&ws->tree);
|
||||
|
||||
for (size_t i = 0; i < clients.size; i++) {
|
||||
TreeNode *node = (TreeNode*) clients.ptrs[i];
|
||||
assert(node->client);
|
||||
|
||||
node->client->x = node->pos.x;
|
||||
node->client->y = node->pos.y;
|
||||
node->client->w = node->pos.w;
|
||||
node->client->h = node->pos.h;
|
||||
|
||||
unsigned int value_mask = CWX | CWY | CWWidth | CWHeight;
|
||||
XWindowChanges xwc = wm_client_to_xwchanges(*node->client);
|
||||
XConfigureWindow(wm->display, node->client->window, value_mask, &xwc);
|
||||
|
||||
if (node->client->focused)
|
||||
wm_client_focus(wm, node->client);
|
||||
}
|
||||
|
||||
XEvent e;
|
||||
XSync(wm->display, False);
|
||||
while(XCheckMaskEvent(wm->display, EnterWindowMask, &e));
|
||||
|
||||
wm_monitor_clients_border(wm, m);
|
||||
}
|
||||
|
||||
Client *wm_get_last_client(Wm *wm, Monitor m)
|
||||
|
Loading…
x
Reference in New Issue
Block a user