mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 20:44:01 +01:00
Slightly better multihead support
This commit is contained in:
parent
dd115cece3
commit
96d7ff1e19
@ -27,6 +27,15 @@ void handle_output_resolution_change(wlc_handle output, const struct wlc_size *f
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
}
|
||||
|
||||
void handle_output_focused(wlc_handle output, bool focus) {
|
||||
swayc_t *c = get_swayc_for_handle(output, &root_container);
|
||||
if (!c) return;
|
||||
if (focus) {
|
||||
unfocus_all(&root_container);
|
||||
focus_view(c);
|
||||
}
|
||||
}
|
||||
|
||||
bool handle_view_created(wlc_handle view) {
|
||||
add_view(view);
|
||||
return true;
|
||||
|
@ -7,6 +7,7 @@
|
||||
bool handle_output_created(wlc_handle output);
|
||||
void handle_output_destroyed(wlc_handle output);
|
||||
void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to);
|
||||
void handle_output_focused(wlc_handle output, bool focus);
|
||||
|
||||
bool handle_view_created(wlc_handle view);
|
||||
void handle_view_destroyed(wlc_handle view);
|
||||
|
@ -44,10 +44,16 @@ void arrange_windows(swayc_t *container, int width, int height) {
|
||||
sway_log(L_DEBUG, "Arranging output at %d", x);
|
||||
child->x = x;
|
||||
child->y = y;
|
||||
arrange_windows(child, child->width, child->height);
|
||||
arrange_windows(child, -1, -1);
|
||||
x += child->width;
|
||||
}
|
||||
return;
|
||||
case C_OUTPUT:
|
||||
container->width = width;
|
||||
container->height = height;
|
||||
x -= container->x;
|
||||
y -= container->y;
|
||||
break;
|
||||
case C_VIEW:
|
||||
{
|
||||
struct wlc_geometry geometry = {
|
||||
@ -342,9 +348,8 @@ void add_output(wlc_handle output) {
|
||||
add_child(container, workspace);
|
||||
sway_log(L_DEBUG, "Added workspace %s for output %d", workspace->name, output);
|
||||
|
||||
workspace_switch(workspace);
|
||||
|
||||
if (root_container.focused == NULL) {
|
||||
workspace_switch(workspace);
|
||||
unfocus_all(&root_container);
|
||||
focus_view(workspace);
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ int main(int argc, char **argv) {
|
||||
.output = {
|
||||
.created = handle_output_created,
|
||||
.destroyed = handle_output_destroyed,
|
||||
.resolution = handle_output_resolution_change
|
||||
.resolution = handle_output_resolution_change,
|
||||
.focus = handle_output_focused
|
||||
},
|
||||
.view = {
|
||||
.created = handle_view_created,
|
||||
|
Loading…
Reference in New Issue
Block a user