diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-07-02 15:19:48 +0000 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-07-02 15:19:48 +0000 |
| commit | 8276d1d92f51db00afeb1a62a4a9a752bf5f4193 (patch) | |
| tree | deaa73c35ef6f54b49686c87aa799f64563a8493 | |
| parent | a72016ab08dcd616f67e6719462f34e5160e8f96 (diff) | |
| download | graynard-8276d1d92f51db00afeb1a62a4a9a752bf5f4193.tar.gz graynard-8276d1d92f51db00afeb1a62a4a9a752bf5f4193.zip | |
delete slides
| -rw-r--r-- | shell/shell-helper.c | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/shell/shell-helper.c b/shell/shell-helper.c index 111d483..5830379 100644 --- a/shell/shell-helper.c +++ b/shell/shell-helper.c @@ -32,8 +32,6 @@ struct shell_helper { struct wl_listener destroy_listener; struct weston_layer *panel_layer; - - struct wl_list slide_list; }; static void @@ -162,167 +160,10 @@ enum SlideRequest { SLIDE_REQUEST_BACK }; -struct slide { - struct weston_surface *surface; - struct weston_view *view; - int x; - int y; - - enum SlideState state; - enum SlideRequest request; - - struct weston_transform transform; - - struct wl_list link; -}; - -static void slide_back(struct slide *slide); - -static void -slide_done_cb(struct weston_view_animation *animation, void *data) -{ - struct slide *slide = data; - - slide->state = SLIDE_STATE_OUT; - - wl_list_insert(&slide->view->transform.position.link, - &slide->transform.link); - weston_matrix_init(&slide->transform.matrix); - weston_matrix_translate(&slide->transform.matrix, - slide->x, - slide->y, - 0); - - weston_view_geometry_dirty(slide->view); - weston_compositor_schedule_repaint(slide->surface->compositor); - - if (slide->request == SLIDE_REQUEST_BACK) { - slide->request = SLIDE_REQUEST_NONE; - slide_back(slide); - } -} - -static void -slide_out(struct slide *slide) -{ - assert(slide->state == SLIDE_STATE_NONE || slide->state == SLIDE_STATE_BACK); - - slide->state = SLIDE_STATE_SLIDING_OUT; - - weston_move_scale_run(slide->view, slide->x, slide->y, - 1.0, 1.0, 0, - slide_done_cb, slide); -} - -static void -slide_back_done_cb(struct weston_view_animation *animation, void *data) -{ - struct slide *slide = data; - - slide->state = SLIDE_STATE_BACK; - - wl_list_remove(&slide->transform.link); - weston_view_geometry_dirty(slide->view); - - if (slide->request == SLIDE_REQUEST_OUT) { - slide->request = SLIDE_REQUEST_NONE; - slide_out(slide); - } else { - wl_list_remove(&slide->link); - free(slide); - } -} - -static void -slide_back(struct slide *slide) -{ - assert(slide->state == SLIDE_STATE_OUT); - - slide->state = SLIDE_STATE_SLIDING_BACK; - - weston_move_scale_run(slide->view, -slide->x, -slide->y, - 1.0, 1.0, 0, - slide_back_done_cb, slide); -} - -static void -shell_helper_slide_surface(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *surface_resource, - int32_t x, - int32_t y) -{ - struct shell_helper *helper = wl_resource_get_user_data(resource); - struct weston_surface *surface = - wl_resource_get_user_data(surface_resource); - struct weston_view *view; - struct slide *slide; - - wl_list_for_each(slide, &helper->slide_list, link) { - if (slide->surface == surface) { - if (slide->state == SLIDE_STATE_SLIDING_BACK) - slide->request = SLIDE_REQUEST_OUT; - return; - } - } - - view = container_of(surface->views.next, struct weston_view, surface_link); - - if (!view) - return; - - slide = malloc(sizeof *slide); - if (!slide) - return; - - slide->surface = surface; - slide->view = view; - slide->x = x; - slide->y = y; - - slide->state = SLIDE_STATE_NONE; - slide->request = SLIDE_REQUEST_NONE; - - wl_list_insert(&helper->slide_list, - &slide->link); - - slide_out(slide); -} - -static void -shell_helper_slide_surface_back(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *surface_resource) -{ - struct shell_helper *helper = wl_resource_get_user_data(resource); - struct weston_surface *surface = - wl_resource_get_user_data(surface_resource); - struct weston_view *view; - int found = 0; - struct slide *slide; - - wl_list_for_each(slide, &helper->slide_list, link) { - if (slide->surface == surface) { - found = 1; - break; - } - } - - if (!found || slide->state == SLIDE_STATE_SLIDING_BACK) - return; - - if (slide->state == SLIDE_STATE_SLIDING_OUT) - slide->request = SLIDE_REQUEST_BACK; - else - slide_back(slide); -} - static const struct shell_helper_interface helper_implementation = { shell_helper_move_surface, shell_helper_add_surface_to_layer, shell_helper_set_panel, - shell_helper_slide_surface, - shell_helper_slide_surface_back }; static void @@ -359,8 +200,6 @@ module_init(struct weston_compositor *ec, helper->compositor = ec; helper->panel_layer = NULL; - wl_list_init(&helper->slide_list); - helper->destroy_listener.notify = helper_destroy; wl_signal_add(&ec->destroy_signal, &helper->destroy_listener); |
