Remove workspaces protocol

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@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Jonas Ådahl 9 years ago committed by Pekka Paalanen
parent cf1efd2ab7
commit 5b0b770c2d
  1. 7
      Makefile.am
  2. 58
      clients/window.c
  3. 113
      desktop-shell/shell.c
  4. 27
      protocol/workspaces.xml

@ -121,8 +121,6 @@ nodist_weston_SOURCES = \
protocol/text-input-unstable-v1-server-protocol.h \ protocol/text-input-unstable-v1-server-protocol.h \
protocol/input-method-unstable-v1-protocol.c \ protocol/input-method-unstable-v1-protocol.c \
protocol/input-method-unstable-v1-server-protocol.h \ 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-protocol.c \
protocol/presentation_timing-server-protocol.h \ protocol/presentation_timing-server-protocol.h \
protocol/scaler-protocol.c \ protocol/scaler-protocol.c \
@ -552,8 +550,6 @@ nodist_libtoytoolkit_la_SOURCES = \
protocol/text-cursor-position-client-protocol.h \ protocol/text-cursor-position-client-protocol.h \
protocol/scaler-protocol.c \ protocol/scaler-protocol.c \
protocol/scaler-client-protocol.h \ protocol/scaler-client-protocol.h \
protocol/workspaces-protocol.c \
protocol/workspaces-client-protocol.h \
protocol/presentation_timing-protocol.c \ protocol/presentation_timing-protocol.c \
protocol/presentation_timing-client-protocol.h \ protocol/presentation_timing-client-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c \ protocol/xdg-shell-unstable-v5-protocol.c \
@ -761,8 +757,6 @@ BUILT_SOURCES += \
protocol/weston-desktop-shell-protocol.c \ protocol/weston-desktop-shell-protocol.c \
protocol/scaler-client-protocol.h \ protocol/scaler-client-protocol.h \
protocol/scaler-protocol.c \ 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-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \ protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c \ protocol/xdg-shell-unstable-v5-protocol.c \
@ -1342,7 +1336,6 @@ BUILT_SOURCES += \
EXTRA_DIST += \ EXTRA_DIST += \
protocol/weston-desktop-shell.xml \ protocol/weston-desktop-shell.xml \
protocol/weston-screenshooter.xml \ protocol/weston-screenshooter.xml \
protocol/workspaces.xml \
protocol/text-cursor-position.xml \ protocol/text-cursor-position.xml \
protocol/weston-test.xml \ protocol/weston-test.xml \
protocol/presentation_timing.xml \ protocol/presentation_timing.xml \

@ -70,7 +70,6 @@ typedef void *EGLContext;
#include "shared/helpers.h" #include "shared/helpers.h"
#include "xdg-shell-unstable-v5-client-protocol.h" #include "xdg-shell-unstable-v5-client-protocol.h"
#include "text-cursor-position-client-protocol.h" #include "text-cursor-position-client-protocol.h"
#include "workspaces-client-protocol.h"
#include "shared/os-compatibility.h" #include "shared/os-compatibility.h"
#include "window.h" #include "window.h"
@ -96,7 +95,6 @@ struct display {
struct wl_shm *shm; struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager; struct wl_data_device_manager *data_device_manager;
struct text_cursor_position *text_cursor_position; struct text_cursor_position *text_cursor_position;
struct workspace_manager *workspace_manager;
struct xdg_shell *xdg_shell; struct xdg_shell *xdg_shell;
struct ivi_application *ivi_application; /* ivi style shell */ struct ivi_application *ivi_application; /* ivi style shell */
EGLDisplay dpy; EGLDisplay dpy;
@ -132,9 +130,6 @@ struct display {
struct xkb_context *xkb_context; struct xkb_context *xkb_context;
uint32_t workspace;
uint32_t workspace_count;
/* A hack to get text extents for tooltips */ /* A hack to get text extents for tooltips */
cairo_surface_t *dummy_surface; cairo_surface_t *dummy_surface;
void *dummy_surface_data; void *dummy_surface_data;
@ -2129,22 +2124,6 @@ widget_set_tooltip(struct widget *parent, char *entry, float x, float y)
return 0; return 0;
} }
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 static void
frame_resize_handler(struct widget *widget, frame_resize_handler(struct widget *widget,
int32_t width, int32_t height, void *data) int32_t width, int32_t height, void *data)
@ -2272,29 +2251,12 @@ static void
frame_menu_func(void *data, struct input *input, int index) frame_menu_func(void *data, struct input *input, int index)
{ {
struct window *window = data; struct window *window = data;
struct display *display;
switch (index) { switch (index) {
case 0: /* close */ case 0: /* close */
window_close(window); window_close(window);
break; break;
case 1: /* move to workspace above */ case 1: /* fullscreen */
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 */
/* we don't have a way to get out of fullscreen for now */ /* we don't have a way to get out of fullscreen for now */
if (window->fullscreen_handler) if (window->fullscreen_handler)
window->fullscreen_handler(window, window->user_data); window->fullscreen_handler(window, window->user_data);
@ -2311,7 +2273,6 @@ window_show_frame_menu(struct window *window,
static const char *entries[] = { static const char *entries[] = {
"Close", "Close",
"Move to workspace above", "Move to workspace below",
"Fullscreen" "Fullscreen"
}; };
@ -5311,18 +5272,6 @@ input_destroy(struct input *input)
free(input); free(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 static void
shm_format(void *data, struct wl_shm *wl_shm, uint32_t format) shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
{ {
@ -5390,8 +5339,6 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->text_cursor_position = d->text_cursor_position =
wl_registry_bind(registry, id, wl_registry_bind(registry, id,
&text_cursor_position_interface, 1); &text_cursor_position_interface, 1);
} else if (strcmp(interface, "workspace_manager") == 0) {
init_workspace_manager(d, id);
} else if (strcmp(interface, "wl_subcompositor") == 0) { } else if (strcmp(interface, "wl_subcompositor") == 0) {
d->subcompositor = d->subcompositor =
wl_registry_bind(registry, id, 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->output_list);
wl_list_init(&d->global_list); wl_list_init(&d->global_list);
d->workspace = 0;
d->workspace_count = 1;
d->registry = wl_display_get_registry(d->display); d->registry = wl_display_get_registry(d->display);
wl_registry_add_listener(d->registry, &registry_listener, d); wl_registry_add_listener(d->registry, &registry_listener, d);

@ -37,7 +37,6 @@
#include "shell.h" #include "shell.h"
#include "weston-desktop-shell-server-protocol.h" #include "weston-desktop-shell-server-protocol.h"
#include "workspaces-server-protocol.h"
#include "shared/config-parser.h" #include "shared/config-parser.h"
#include "shared/helpers.h" #include "shared/helpers.h"
#include "xdg-shell-unstable-v5-server-protocol.h" #include "xdg-shell-unstable-v5-server-protocol.h"
@ -1183,17 +1182,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 static void
reverse_workspace_change_animation(struct desktop_shell *shell, reverse_workspace_change_animation(struct desktop_shell *shell,
unsigned int index, unsigned int index,
@ -1375,7 +1363,6 @@ change_workspace(struct desktop_shell *shell, unsigned int index)
shell->workspaces.anim_to == from) { shell->workspaces.anim_to == from) {
restore_focus_state(shell, to); restore_focus_state(shell, to);
reverse_workspace_change_animation(shell, index, from, to); reverse_workspace_change_animation(shell, index, from, to);
broadcast_current_workspace_state(shell);
return; return;
} }
@ -1402,8 +1389,6 @@ change_workspace(struct desktop_shell *shell, unsigned int index)
update_workspace(shell, index, from, to); update_workspace(shell, index, from, to);
else else
animate_workspace_change(shell, index, from, to); animate_workspace_change(shell, index, from, to);
broadcast_current_workspace_state(shell);
} }
static bool static bool
@ -1443,41 +1428,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 static void
take_surface_to_workspace_by_seat(struct desktop_shell *shell, take_surface_to_workspace_by_seat(struct desktop_shell *shell,
struct weston_seat *seat, struct weston_seat *seat,
@ -1517,7 +1467,6 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
wl_list_insert(from->layer.link.prev, &to->layer.link); wl_list_insert(from->layer.link.prev, &to->layer.link);
reverse_workspace_change_animation(shell, index, from, to); reverse_workspace_change_animation(shell, index, from, to);
broadcast_current_workspace_state(shell);
return; return;
} }
@ -1539,69 +1488,11 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
animate_workspace_change(shell, index, from, to); animate_workspace_change(shell, index, from, to);
} }
broadcast_current_workspace_state(shell);
state = ensure_focus_state(shell, seat); state = ensure_focus_state(shell, seat);
if (state != NULL) if (state != NULL)
focus_state_set_focus(state, surface); 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 static void
touch_move_grab_down(struct weston_touch_grab *grab, uint32_t time, touch_move_grab_down(struct weston_touch_grab *grab, uint32_t time,
int touch_id, wl_fixed_t x, wl_fixed_t y) 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) shell, bind_desktop_shell) == NULL)
return -1; 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->child.deathstamp = weston_compositor_get_time();
shell->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP; shell->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP;

@ -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>
Loading…
Cancel
Save