mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
ext-workspace protocol integration
This commit is contained in:
parent
acde3b4a8b
commit
8156b91306
4 changed files with 50 additions and 0 deletions
|
|
@ -16,11 +16,13 @@
|
|||
#include "input/keyboard.h"
|
||||
#include "labwc.h"
|
||||
#include "protocols/cosmic-workspaces.h"
|
||||
#include "protocols/ext-workspace.h"
|
||||
#include "view.h"
|
||||
#include "workspaces.h"
|
||||
#include "xwayland.h"
|
||||
|
||||
#define COSMIC_WORKSPACES_VERSION 1
|
||||
#define EXT_WORKSPACES_VERSION 1
|
||||
|
||||
/* Internal helpers */
|
||||
static size_t
|
||||
|
|
@ -185,6 +187,15 @@ handle_cosmic_workspace_activate(struct wl_listener *listener, void *data)
|
|||
wlr_log(WLR_INFO, "cosmic activating workspace %s", workspace->name);
|
||||
}
|
||||
|
||||
/* ext workspace handlers */
|
||||
static void
|
||||
handle_ext_workspace_activate(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct workspace *workspace = wl_container_of(listener, workspace, on_ext.activate);
|
||||
workspaces_switch_to(workspace, /* update_focus */ true);
|
||||
wlr_log(WLR_INFO, "ext activating workspace %s", workspace->name);
|
||||
}
|
||||
|
||||
/* Internal API */
|
||||
static void
|
||||
add_workspace(struct server *server, const char *name)
|
||||
|
|
@ -210,6 +221,17 @@ add_workspace(struct server *server, const char *name)
|
|||
workspace->on_cosmic.activate.notify = handle_cosmic_workspace_activate;
|
||||
wl_signal_add(&workspace->cosmic_workspace->events.activate,
|
||||
&workspace->on_cosmic.activate);
|
||||
|
||||
/* ext */
|
||||
workspace->ext_workspace = lab_ext_workspace_create(
|
||||
server->workspaces.ext_manager, /*id*/ NULL);
|
||||
lab_ext_workspace_assign_to_group(workspace->ext_workspace, server->workspaces.ext_group);
|
||||
lab_ext_workspace_set_name(workspace->ext_workspace, name);
|
||||
lab_ext_workspace_set_active(workspace->ext_workspace, active);
|
||||
|
||||
workspace->on_ext.activate.notify = handle_ext_workspace_activate;
|
||||
wl_signal_add(&workspace->ext_workspace->events.activate,
|
||||
&workspace->on_ext.activate);
|
||||
}
|
||||
|
||||
static struct workspace *
|
||||
|
|
@ -288,9 +310,16 @@ workspaces_init(struct server *server)
|
|||
server->wl_display, /* capabilities */ CW_CAP_WS_ACTIVATE,
|
||||
COSMIC_WORKSPACES_VERSION);
|
||||
|
||||
server->workspaces.ext_manager = lab_ext_workspace_manager_create(
|
||||
server->wl_display, /* capabilities */ WS_CAP_WS_ACTIVATE,
|
||||
EXT_WORKSPACES_VERSION);
|
||||
|
||||
server->workspaces.cosmic_group = lab_cosmic_workspace_group_create(
|
||||
server->workspaces.cosmic_manager);
|
||||
|
||||
server->workspaces.ext_group = lab_ext_workspace_group_create(
|
||||
server->workspaces.ext_manager);
|
||||
|
||||
wl_list_init(&server->workspaces.all);
|
||||
|
||||
struct workspace *conf;
|
||||
|
|
@ -319,6 +348,8 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
|
|||
|
||||
lab_cosmic_workspace_set_active(
|
||||
server->workspaces.current->cosmic_workspace, false);
|
||||
lab_ext_workspace_set_active(
|
||||
server->workspaces.current->ext_workspace, false);
|
||||
|
||||
/* Move Omnipresent views to new workspace */
|
||||
struct view *view;
|
||||
|
|
@ -374,6 +405,7 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
|
|||
desktop_update_top_layer_visiblity(server);
|
||||
|
||||
lab_cosmic_workspace_set_active(target->cosmic_workspace, true);
|
||||
lab_ext_workspace_set_active(target->ext_workspace, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -440,6 +472,7 @@ destroy_workspace(struct workspace *workspace)
|
|||
wl_list_remove(&workspace->link);
|
||||
|
||||
lab_cosmic_workspace_destroy(workspace->cosmic_workspace);
|
||||
lab_ext_workspace_destroy(workspace->ext_workspace);
|
||||
free(workspace);
|
||||
}
|
||||
|
||||
|
|
@ -476,6 +509,8 @@ workspaces_reconfigure(struct server *server)
|
|||
actual_workspace->name = xstrdup(configured_workspace->name);
|
||||
lab_cosmic_workspace_set_name(
|
||||
actual_workspace->cosmic_workspace, actual_workspace->name);
|
||||
lab_ext_workspace_set_name(
|
||||
actual_workspace->ext_workspace, actual_workspace->name);
|
||||
}
|
||||
actual_workspace_link = actual_workspace_link->next;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue