[PATCH weston v2 9/9] Remove workspaces protocol
Jonas Ådahl
jadahl at gmail.com
Tue Nov 17 00:00:35 PST 2015
It doesn't fill a useful function and is not intended to be continued.
If there is need for workspace manipulation from clients a protocol
based on those future needs need to be properly designed.
workspaces.xml is probably not very relevant since it did the bare
minimum.
Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland at gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
Makefile.am | 7 ---
clients/window.c | 58 +------------------------
desktop-shell/shell.c | 113 ------------------------------------------------
protocol/workspaces.xml | 27 ------------
4 files changed, 1 insertion(+), 204 deletions(-)
delete mode 100644 protocol/workspaces.xml
diff --git a/Makefile.am b/Makefile.am
index bbd504f..cbb3b57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -121,8 +121,6 @@ nodist_weston_SOURCES = \
protocol/text-input-unstable-v1-server-protocol.h \
protocol/input-method-unstable-v1-protocol.c \
protocol/input-method-unstable-v1-server-protocol.h \
- protocol/workspaces-protocol.c \
- protocol/workspaces-server-protocol.h \
protocol/presentation_timing-protocol.c \
protocol/presentation_timing-server-protocol.h \
protocol/scaler-protocol.c \
@@ -552,8 +550,6 @@ nodist_libtoytoolkit_la_SOURCES = \
protocol/text-cursor-position-client-protocol.h \
protocol/scaler-protocol.c \
protocol/scaler-client-protocol.h \
- protocol/workspaces-protocol.c \
- protocol/workspaces-client-protocol.h \
protocol/presentation_timing-protocol.c \
protocol/presentation_timing-client-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c \
@@ -761,8 +757,6 @@ BUILT_SOURCES += \
protocol/weston-desktop-shell-protocol.c \
protocol/scaler-client-protocol.h \
protocol/scaler-protocol.c \
- protocol/workspaces-client-protocol.h \
- protocol/workspaces-protocol.c \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c \
@@ -1342,7 +1336,6 @@ BUILT_SOURCES += \
EXTRA_DIST += \
protocol/weston-desktop-shell.xml \
protocol/weston-screenshooter.xml \
- protocol/workspaces.xml \
protocol/text-cursor-position.xml \
protocol/weston-test.xml \
protocol/presentation_timing.xml \
diff --git a/clients/window.c b/clients/window.c
index 4b62988..f9797a2 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -70,7 +70,6 @@ typedef void *EGLContext;
#include "shared/helpers.h"
#include "xdg-shell-unstable-v5-client-protocol.h"
#include "text-cursor-position-client-protocol.h"
-#include "workspaces-client-protocol.h"
#include "shared/os-compatibility.h"
#include "window.h"
@@ -96,7 +95,6 @@ struct display {
struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager;
struct text_cursor_position *text_cursor_position;
- struct workspace_manager *workspace_manager;
struct xdg_shell *xdg_shell;
struct ivi_application *ivi_application; /* ivi style shell */
EGLDisplay dpy;
@@ -132,9 +130,6 @@ struct display {
struct xkb_context *xkb_context;
- uint32_t workspace;
- uint32_t workspace_count;
-
/* A hack to get text extents for tooltips */
cairo_surface_t *dummy_surface;
void *dummy_surface_data;
@@ -2130,22 +2125,6 @@ widget_set_tooltip(struct widget *parent, char *entry, float x, float y)
}
static void
-workspace_manager_state(void *data,
- struct workspace_manager *workspace_manager,
- uint32_t current,
- uint32_t count)
-{
- struct display *display = data;
-
- display->workspace = current;
- display->workspace_count = count;
-}
-
-static const struct workspace_manager_listener workspace_manager_listener = {
- workspace_manager_state
-};
-
-static void
frame_resize_handler(struct widget *widget,
int32_t width, int32_t height, void *data)
{
@@ -2272,29 +2251,12 @@ static void
frame_menu_func(void *data, struct input *input, int index)
{
struct window *window = data;
- struct display *display;
switch (index) {
case 0: /* close */
window_close(window);
break;
- case 1: /* move to workspace above */
- display = window->display;
- if (display->workspace > 0)
- workspace_manager_move_surface(
- display->workspace_manager,
- window->main_surface->surface,
- display->workspace - 1);
- break;
- case 2: /* move to workspace below */
- display = window->display;
- if (display->workspace < display->workspace_count - 1)
- workspace_manager_move_surface(
- display->workspace_manager,
- window->main_surface->surface,
- display->workspace + 1);
- break;
- case 3: /* fullscreen */
+ case 1: /* fullscreen */
/* we don't have a way to get out of fullscreen for now */
if (window->fullscreen_handler)
window->fullscreen_handler(window, window->user_data);
@@ -2311,7 +2273,6 @@ window_show_frame_menu(struct window *window,
static const char *entries[] = {
"Close",
- "Move to workspace above", "Move to workspace below",
"Fullscreen"
};
@@ -5312,18 +5273,6 @@ input_destroy(struct input *input)
}
static void
-init_workspace_manager(struct display *d, uint32_t id)
-{
- d->workspace_manager =
- wl_registry_bind(d->registry, id,
- &workspace_manager_interface, 1);
- if (d->workspace_manager != NULL)
- workspace_manager_add_listener(d->workspace_manager,
- &workspace_manager_listener,
- d);
-}
-
-static void
shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
{
struct display *d = data;
@@ -5390,8 +5339,6 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->text_cursor_position =
wl_registry_bind(registry, id,
&text_cursor_position_interface, 1);
- } else if (strcmp(interface, "workspace_manager") == 0) {
- init_workspace_manager(d, id);
} else if (strcmp(interface, "wl_subcompositor") == 0) {
d->subcompositor =
wl_registry_bind(registry, id,
@@ -5623,9 +5570,6 @@ display_create(int *argc, char *argv[])
wl_list_init(&d->output_list);
wl_list_init(&d->global_list);
- d->workspace = 0;
- d->workspace_count = 1;
-
d->registry = wl_display_get_registry(d->display);
wl_registry_add_listener(d->registry, ®istry_listener, d);
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index f93dc94..00c3260 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -37,7 +37,6 @@
#include "shell.h"
#include "weston-desktop-shell-server-protocol.h"
-#include "workspaces-server-protocol.h"
#include "shared/config-parser.h"
#include "shared/helpers.h"
#include "xdg-shell-unstable-v5-server-protocol.h"
@@ -1184,17 +1183,6 @@ workspace_translate_in(struct workspace *ws, double fraction)
}
static void
-broadcast_current_workspace_state(struct desktop_shell *shell)
-{
- struct wl_resource *resource;
-
- wl_resource_for_each(resource, &shell->workspaces.client_list)
- workspace_manager_send_state(resource,
- shell->workspaces.current,
- shell->workspaces.num);
-}
-
-static void
reverse_workspace_change_animation(struct desktop_shell *shell,
unsigned int index,
struct workspace *from,
@@ -1375,7 +1363,6 @@ change_workspace(struct desktop_shell *shell, unsigned int index)
shell->workspaces.anim_to == from) {
restore_focus_state(shell, to);
reverse_workspace_change_animation(shell, index, from, to);
- broadcast_current_workspace_state(shell);
return;
}
@@ -1402,8 +1389,6 @@ change_workspace(struct desktop_shell *shell, unsigned int index)
update_workspace(shell, index, from, to);
else
animate_workspace_change(shell, index, from, to);
-
- broadcast_current_workspace_state(shell);
}
static bool
@@ -1444,41 +1429,6 @@ surface_keyboard_focus_lost(struct weston_surface *surface)
}
static void
-move_surface_to_workspace(struct desktop_shell *shell,
- struct shell_surface *shsurf,
- uint32_t workspace)
-{
- struct workspace *from;
- struct workspace *to;
- struct weston_view *view;
-
- if (workspace == shell->workspaces.current)
- return;
-
- view = get_default_view(shsurf->surface);
- if (!view)
- return;
-
- assert(weston_surface_get_main_surface(view->surface) == view->surface);
-
- if (workspace >= shell->workspaces.num)
- workspace = shell->workspaces.num - 1;
-
- from = get_current_workspace(shell);
- to = get_workspace(shell, workspace);
-
- weston_layer_entry_remove(&view->layer_link);
- weston_layer_entry_insert(&to->layer.view_list, &view->layer_link);
-
- shell_surface_update_child_surface_layers(shsurf);
-
- drop_focus_state(shell, from, view->surface);
- surface_keyboard_focus_lost(view->surface);
-
- weston_view_damage_below(view);
-}
-
-static void
take_surface_to_workspace_by_seat(struct desktop_shell *shell,
struct weston_seat *seat,
unsigned int index)
@@ -1517,7 +1467,6 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
wl_list_insert(from->layer.link.prev, &to->layer.link);
reverse_workspace_change_animation(shell, index, from, to);
- broadcast_current_workspace_state(shell);
return;
}
@@ -1539,70 +1488,12 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
animate_workspace_change(shell, index, from, to);
}
- broadcast_current_workspace_state(shell);
-
state = ensure_focus_state(shell, seat);
if (state != NULL)
focus_state_set_focus(state, surface);
}
static void
-workspace_manager_move_surface(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *surface_resource,
- uint32_t workspace)
-{
- struct desktop_shell *shell = wl_resource_get_user_data(resource);
- struct weston_surface *surface =
- wl_resource_get_user_data(surface_resource);
- struct weston_surface *main_surface;
- struct shell_surface *shell_surface;
-
- main_surface = weston_surface_get_main_surface(surface);
- shell_surface = get_shell_surface(main_surface);
- if (shell_surface == NULL)
- return;
-
- move_surface_to_workspace(shell, shell_surface, workspace);
-}
-
-static const struct workspace_manager_interface workspace_manager_implementation = {
- workspace_manager_move_surface,
-};
-
-static void
-unbind_resource(struct wl_resource *resource)
-{
- wl_list_remove(wl_resource_get_link(resource));
-}
-
-static void
-bind_workspace_manager(struct wl_client *client,
- void *data, uint32_t version, uint32_t id)
-{
- struct desktop_shell *shell = data;
- struct wl_resource *resource;
-
- resource = wl_resource_create(client,
- &workspace_manager_interface, 1, id);
-
- if (resource == NULL) {
- weston_log("couldn't add workspace manager object");
- return;
- }
-
- wl_resource_set_implementation(resource,
- &workspace_manager_implementation,
- shell, unbind_resource);
- wl_list_insert(&shell->workspaces.client_list,
- wl_resource_get_link(resource));
-
- workspace_manager_send_state(resource,
- shell->workspaces.current,
- shell->workspaces.num);
-}
-
-static void
touch_move_grab_down(struct weston_touch_grab *grab, uint32_t time,
int touch_id, wl_fixed_t x, wl_fixed_t y)
{
@@ -6687,10 +6578,6 @@ module_init(struct weston_compositor *ec,
shell, bind_desktop_shell) == NULL)
return -1;
- if (wl_global_create(ec->wl_display, &workspace_manager_interface, 1,
- shell, bind_workspace_manager) == NULL)
- return -1;
-
shell->child.deathstamp = weston_compositor_get_time();
shell->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP;
diff --git a/protocol/workspaces.xml b/protocol/workspaces.xml
deleted file mode 100644
index 22f4802..0000000
--- a/protocol/workspaces.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<protocol name="workspaces">
-
- <interface name="workspace_manager" version="1">
- <description summary="workspaces manager">
- An interface for managing surfaces in workspaces.
- </description>
-
- <request name="move_surface">
- <description summary="move surface to workspace">
- Move the given surface to the specified workspace.
- </description>
- <arg name="surface" type="object" interface="wl_surface"/>
- <arg name="workspace" type="uint"/>
- </request>
-
- <event name="state">
- <description summary="workspace state">
- The current workspace state, such as current workspace and workspace
- count, has changed.
- </description>
- <arg name="current" type="uint"/>
- <arg name="count" type="uint"/>
- </event>
-
- </interface>
-
-</protocol>
--
2.4.3
More information about the wayland-devel
mailing list