Move everything to sway/old/

This commit is contained in:
Drew DeVault 2017-11-18 11:22:02 -05:00
parent 0c8491f7d0
commit 733993a651
128 changed files with 76 additions and 430 deletions

View file

@ -4,11 +4,9 @@
#include <wayland-server.h>
#include <wlr/types/wlr_output.h>
#include <wlr/render.h>
#include "sway/server.h"
#include "sway/container.h"
#include "sway/workspace.h"
#include "sway/output.h"
#include "log.h"
#include "sway/output.h"
#include "sway/server.h"
static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sway_output *soutput = wl_container_of(
@ -37,19 +35,10 @@ void output_add_notify(struct wl_listener *listener, void *data) {
output->wlr_output = wlr_output;
output->server = server;
swayc_t *node = new_output(output);
if (!sway_assert(node, "Failed to allocate output")) {
return;
}
// Switch to workspace if we need to
if (swayc_active_workspace() == NULL) {
swayc_t *ws = node->children->items[0];
workspace_switch(ws);
}
output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame);
// TODO: Add to tree
}
void output_remove_notify(struct wl_listener *listener, void *data) {

View file

@ -1,49 +1,10 @@
#include <stdlib.h>
#include <wayland-server.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include "sway/commands.h"
#include "sway/container.h"
#include "sway/focus.h"
#include "sway/ipc-server.h"
#include "sway/server.h"
#include "sway/view.h"
#include "log.h"
// TODO: move elsewhere
static void temp_ws_cleanup() {
swayc_t *op, *ws;
int i = 0, j;
if (!root_container.children)
return;
while (i < root_container.children->length) {
op = root_container.children->items[i++];
if (!op->children)
continue;
j = 0;
while (j < op->children->length) {
ws = op->children->items[j++];
if (ws->children->length == 0 && ws->floating->length == 0 && ws != op->focused) {
if (destroy_workspace(ws)) {
j--;
}
}
}
}
}
// TODO: move elsewhere
static swayc_t *move_focus_to_tiling(swayc_t *focused) {
if (focused->is_floating) {
if (focused->parent->children->length == 0) {
return focused->parent;
}
// TODO find a better way of doing this
// Or to focused container
return get_focused_container(focused->parent->children->items[0]);
}
return focused;
}
static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) {
if (!sway_assert(view->type == SWAY_XDG_SHELL_V6_VIEW,
"xdg get_prop for non-xdg view!")) {
@ -88,30 +49,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
sway_surface->view = sway_view;
// TODO:
// - Consolodate common logic between shells
// - Add to tree
// - Wire up listeners
// - Handle popups
// - Look up pid and open on appropriate workspace
// - Set new view to maximized so it behaves nicely
// - Criteria
suspend_workspace_cleanup = true;
//swayc_t *current_ws = swayc_active_workspace();
swayc_t *prev_focus = get_focused_container(&root_container);
swayc_t *focused = move_focus_to_tiling(prev_focus);
// TODO: fix new_view
swayc_t *view = new_view(focused, sway_view);
ipc_event_window(view, "new");
set_focused_container(view);
swayc_t *output = swayc_parent_by_type(view, C_OUTPUT);
arrange_windows(output, -1, -1);
swayc_t *workspace = swayc_parent_by_type(focused, C_WORKSPACE);
if (workspace && workspace->fullscreen) {
set_focused_container(workspace->fullscreen);
}
suspend_workspace_cleanup = false;
temp_ws_cleanup();
}