예제 #1
0
// switches parent focus to c. will switch it accordingly
// TODO: Everything needs a handle, so we can set front/back position properly
static void update_focus(swayc_t *c) {
	// Handle if focus switches
	swayc_t *parent = c->parent;
	if (parent->focused != c) {
		switch (c->type) {
		case C_ROOT: return;
		case C_OUTPUT:
			wlc_output_focus(c->handle);
			break;
		// switching workspaces
		case C_WORKSPACE:
			if (parent->focused) {
				swayc_t *ws = parent->focused;
				// hide visibility of old workspace
				uint32_t mask = 1;
				container_map(ws, set_view_visibility, &mask);
				// set visibility of new workspace
				mask = 2;
				container_map(c, set_view_visibility, &mask);
				wlc_output_set_mask(parent->handle, 2);
				destroy_workspace(ws);
			}
			active_workspace = c;
			break;
		default:
		case C_VIEW:
		case C_CONTAINER:
			// TODO whatever to do when container changes
			// for example, stacked and tabbing change stuff.
			break;
		}
	}
	c->parent->focused = c;
}
예제 #2
0
파일: handlers.c 프로젝트: Luminarys/sway
static bool handle_output_created(wlc_handle output) {
	swayc_t *op = new_output(output);

	// Visibility mask to be able to make view invisible
	wlc_output_set_mask(output, VISIBLE);

	if (!op) {
		return false;
	}

	// Switch to workspace if we need to
	if (swayc_active_workspace() == NULL) {
		swayc_t *ws = op->children->items[0];
		workspace_switch(ws);
	}
	return true;
}
예제 #3
0
파일: handlers.c 프로젝트: dardevelin/sway
static bool handle_output_created(wlc_handle output) {
	swayc_t *op = new_output(output);

	// Visibility mask to be able to make view invisible
	wlc_output_set_mask(output, VISIBLE);

	if (!op) {
		return false;
	}

	// Switch to workspace if we need to
	if (swayc_active_workspace() == NULL) {
		swayc_t *ws = op->children->items[0];
		workspace_switch(ws);
	}

	// Fixes issues with backgrounds and wlc
	wlc_handle prev = wlc_get_focused_output();
	wlc_output_focus(output);
	wlc_output_focus(prev);
	return true;
}