2013-12-04 19:00:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2010-2012 Intel Corporation
|
|
|
|
* Copyright © 2011-2012 Collabora, Ltd.
|
|
|
|
* Copyright © 2013 Raspberry Pi Foundation
|
|
|
|
*
|
2015-06-11 19:55:55 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2013-12-04 19:00:19 +00:00
|
|
|
*
|
2015-06-11 19:55:55 +00:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2013-12-04 19:00:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2016-07-19 11:16:27 +00:00
|
|
|
#include <stdint.h>
|
2013-12-04 19:00:19 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "shell.h"
|
2015-11-17 08:00:30 +00:00
|
|
|
#include "input-method-unstable-v1-server-protocol.h"
|
2015-06-15 22:37:10 +00:00
|
|
|
#include "shared/helpers.h"
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
struct input_panel_surface {
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wl_signal destroy_signal;
|
|
|
|
|
|
|
|
struct desktop_shell *shell;
|
|
|
|
|
|
|
|
struct wl_list link;
|
|
|
|
struct weston_surface *surface;
|
|
|
|
struct weston_view *view;
|
|
|
|
struct wl_listener surface_destroy_listener;
|
|
|
|
|
2014-04-14 12:48:07 +00:00
|
|
|
struct weston_view_animation *anim;
|
|
|
|
|
2013-12-04 19:00:19 +00:00
|
|
|
struct weston_output *output;
|
|
|
|
uint32_t panel;
|
|
|
|
};
|
|
|
|
|
2014-04-14 12:48:07 +00:00
|
|
|
static void
|
|
|
|
input_panel_slide_done(struct weston_view_animation *animation, void *data)
|
|
|
|
{
|
|
|
|
struct input_panel_surface *ipsurf = data;
|
|
|
|
|
|
|
|
ipsurf->anim = NULL;
|
|
|
|
}
|
|
|
|
|
2021-08-17 05:39:48 +00:00
|
|
|
static int
|
2022-02-07 20:22:46 +00:00
|
|
|
calc_input_panel_position(struct input_panel_surface *ip_surface, struct weston_coord_global *out_pos)
|
2021-08-17 05:39:48 +00:00
|
|
|
{
|
|
|
|
struct desktop_shell *shell = ip_surface->shell;
|
2022-02-07 20:22:46 +00:00
|
|
|
struct weston_coord_global pos;
|
|
|
|
|
2021-08-17 05:39:48 +00:00
|
|
|
if (ip_surface->panel) {
|
|
|
|
struct weston_view *view = get_default_view(shell->text_input.surface);
|
|
|
|
if (view == NULL)
|
|
|
|
return -1;
|
2022-02-07 20:22:46 +00:00
|
|
|
pos = weston_view_get_pos_offset_global(view);
|
|
|
|
pos.c.x += shell->text_input.cursor_rectangle.x2;
|
|
|
|
pos.c.y += shell->text_input.cursor_rectangle.y2;
|
2021-08-17 05:39:48 +00:00
|
|
|
} else {
|
2022-02-07 20:22:46 +00:00
|
|
|
pos = ip_surface->output->pos;
|
|
|
|
pos.c.x += (ip_surface->output->width - ip_surface->surface->width) / 2;
|
|
|
|
pos.c.y += ip_surface->output->height - ip_surface->surface->height;
|
2021-08-17 05:39:48 +00:00
|
|
|
}
|
2022-02-07 20:22:46 +00:00
|
|
|
*out_pos = pos;
|
2021-08-17 05:39:48 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-04-14 12:48:07 +00:00
|
|
|
static void
|
|
|
|
show_input_panel_surface(struct input_panel_surface *ipsurf)
|
|
|
|
{
|
|
|
|
struct desktop_shell *shell = ipsurf->shell;
|
2014-04-17 12:04:32 +00:00
|
|
|
struct weston_seat *seat;
|
|
|
|
struct weston_surface *focus;
|
2022-11-09 19:39:08 +00:00
|
|
|
struct weston_coord_global pos;
|
2014-04-17 12:04:32 +00:00
|
|
|
|
|
|
|
wl_list_for_each(seat, &shell->compositor->seat_list, link) {
|
2015-07-31 21:55:32 +00:00
|
|
|
struct weston_keyboard *keyboard =
|
|
|
|
weston_seat_get_keyboard(seat);
|
|
|
|
|
|
|
|
if (!keyboard || !keyboard->focus)
|
2014-04-17 12:04:32 +00:00
|
|
|
continue;
|
2015-07-31 21:55:32 +00:00
|
|
|
focus = weston_surface_get_main_surface(keyboard->focus);
|
2015-10-06 15:40:28 +00:00
|
|
|
if (!focus)
|
|
|
|
continue;
|
2014-04-17 12:04:32 +00:00
|
|
|
ipsurf->output = focus->output;
|
2022-02-07 20:22:46 +00:00
|
|
|
if (calc_input_panel_position(ipsurf, &pos))
|
2021-08-17 05:39:48 +00:00
|
|
|
continue;
|
2022-02-07 20:22:46 +00:00
|
|
|
|
2022-11-09 19:39:08 +00:00
|
|
|
weston_view_set_position(ipsurf->view, pos);
|
2014-04-17 12:04:32 +00:00
|
|
|
}
|
2014-04-14 12:48:07 +00:00
|
|
|
|
2014-07-09 19:12:56 +00:00
|
|
|
weston_layer_entry_insert(&shell->input_panel_layer.view_list,
|
|
|
|
&ipsurf->view->layer_link);
|
2014-04-14 12:48:07 +00:00
|
|
|
weston_view_geometry_dirty(ipsurf->view);
|
|
|
|
weston_view_update_transform(ipsurf->view);
|
2016-06-30 04:04:29 +00:00
|
|
|
ipsurf->view->is_mapped = true;
|
2022-06-12 19:51:45 +00:00
|
|
|
weston_surface_map(ipsurf->surface);
|
2014-04-14 12:48:07 +00:00
|
|
|
weston_surface_damage(ipsurf->surface);
|
|
|
|
|
|
|
|
if (ipsurf->anim)
|
|
|
|
weston_view_animation_destroy(ipsurf->anim);
|
|
|
|
|
|
|
|
ipsurf->anim =
|
|
|
|
weston_slide_run(ipsurf->view,
|
|
|
|
ipsurf->surface->height * 0.9, 0,
|
|
|
|
input_panel_slide_done, ipsurf);
|
|
|
|
}
|
|
|
|
|
2013-12-04 19:00:19 +00:00
|
|
|
static void
|
|
|
|
show_input_panels(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
container_of(listener, struct desktop_shell,
|
|
|
|
show_input_panel_listener);
|
|
|
|
struct input_panel_surface *ipsurf, *next;
|
|
|
|
|
|
|
|
shell->text_input.surface = (struct weston_surface*)data;
|
|
|
|
|
|
|
|
if (shell->showing_input_panels)
|
|
|
|
return;
|
|
|
|
|
|
|
|
shell->showing_input_panels = true;
|
|
|
|
|
|
|
|
if (!shell->locked)
|
2016-12-17 12:40:51 +00:00
|
|
|
weston_layer_set_position(&shell->input_panel_layer,
|
|
|
|
WESTON_LAYER_POSITION_TOP_UI);
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
wl_list_for_each_safe(ipsurf, next,
|
|
|
|
&shell->input_panel.surfaces, link) {
|
2014-01-02 09:27:06 +00:00
|
|
|
if (ipsurf->surface->width == 0)
|
2013-12-04 19:00:19 +00:00
|
|
|
continue;
|
2014-04-14 12:48:07 +00:00
|
|
|
|
|
|
|
show_input_panel_surface(ipsurf);
|
2013-12-04 19:00:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
hide_input_panels(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
container_of(listener, struct desktop_shell,
|
|
|
|
hide_input_panel_listener);
|
|
|
|
struct weston_view *view, *next;
|
|
|
|
|
|
|
|
if (!shell->showing_input_panels)
|
|
|
|
return;
|
|
|
|
|
|
|
|
shell->showing_input_panels = false;
|
|
|
|
|
|
|
|
if (!shell->locked)
|
2016-12-17 12:40:51 +00:00
|
|
|
weston_layer_unset_position(&shell->input_panel_layer);
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
wl_list_for_each_safe(view, next,
|
2014-07-09 19:12:56 +00:00
|
|
|
&shell->input_panel_layer.view_list.link,
|
|
|
|
layer_link.link)
|
2013-12-04 19:00:19 +00:00
|
|
|
weston_view_unmap(view);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_input_panels(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
container_of(listener, struct desktop_shell,
|
|
|
|
update_input_panel_listener);
|
|
|
|
|
|
|
|
memcpy(&shell->text_input.cursor_rectangle, data, sizeof(pixman_box32_t));
|
|
|
|
}
|
|
|
|
|
compositor: add weston_surface_set_label_func()
When printing out logs from Weston's actions, mainly for debugging, it
can be very difficult to identify the different surfaces. Inspecting
the configure function pointer is not useful, as the configure functions
may live in modules.
Add vfunc get_label to weston_surface, which will produce a short,
human-readable description of the surface, which allows identifying it
better, rather than just looking at the surface size, for instance.
Set the label function from most parts of Weston, to identify cursors and
drag icons, and panels, backgrounds, screensavers and lock surfaces, and
the desktop shell's application surfaces.
v2: renamed 'description' to 'label', so we get
weston_surface_set_label_func().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-06 16:36:51 +00:00
|
|
|
static int
|
|
|
|
input_panel_get_label(struct weston_surface *surface, char *buf, size_t len)
|
|
|
|
{
|
|
|
|
return snprintf(buf, len, "input panel");
|
|
|
|
}
|
|
|
|
|
2013-12-04 19:00:19 +00:00
|
|
|
static void
|
2022-02-04 14:02:26 +00:00
|
|
|
input_panel_committed(struct weston_surface *surface,
|
|
|
|
struct weston_coord_surface new_origin)
|
2013-12-04 19:00:19 +00:00
|
|
|
{
|
2016-08-12 08:41:33 +00:00
|
|
|
struct input_panel_surface *ip_surface = surface->committed_private;
|
2013-12-04 19:00:19 +00:00
|
|
|
struct desktop_shell *shell = ip_surface->shell;
|
2022-11-09 19:39:08 +00:00
|
|
|
struct weston_coord_global pos;
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
if (surface->width == 0)
|
|
|
|
return;
|
|
|
|
|
2022-02-07 20:22:46 +00:00
|
|
|
if (calc_input_panel_position(ip_surface, &pos))
|
2021-08-17 05:39:48 +00:00
|
|
|
return;
|
2022-02-07 20:22:46 +00:00
|
|
|
|
2022-11-09 19:39:08 +00:00
|
|
|
weston_view_set_position(ip_surface->view, pos);
|
2013-12-04 19:00:19 +00:00
|
|
|
|
2014-04-14 12:48:07 +00:00
|
|
|
if (!weston_surface_is_mapped(surface) && shell->showing_input_panels)
|
|
|
|
show_input_panel_surface(ip_surface);
|
2013-12-04 19:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
destroy_input_panel_surface(struct input_panel_surface *input_panel_surface)
|
|
|
|
{
|
|
|
|
wl_signal_emit(&input_panel_surface->destroy_signal, input_panel_surface);
|
|
|
|
|
|
|
|
wl_list_remove(&input_panel_surface->surface_destroy_listener.link);
|
|
|
|
wl_list_remove(&input_panel_surface->link);
|
|
|
|
|
2016-08-12 08:41:33 +00:00
|
|
|
input_panel_surface->surface->committed = NULL;
|
compositor: add weston_surface_set_label_func()
When printing out logs from Weston's actions, mainly for debugging, it
can be very difficult to identify the different surfaces. Inspecting
the configure function pointer is not useful, as the configure functions
may live in modules.
Add vfunc get_label to weston_surface, which will produce a short,
human-readable description of the surface, which allows identifying it
better, rather than just looking at the surface size, for instance.
Set the label function from most parts of Weston, to identify cursors and
drag icons, and panels, backgrounds, screensavers and lock surfaces, and
the desktop shell's application surfaces.
v2: renamed 'description' to 'label', so we get
weston_surface_set_label_func().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-06 16:36:51 +00:00
|
|
|
weston_surface_set_label_func(input_panel_surface->surface, NULL);
|
2013-12-04 19:00:19 +00:00
|
|
|
weston_view_destroy(input_panel_surface->view);
|
|
|
|
|
|
|
|
free(input_panel_surface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct input_panel_surface *
|
|
|
|
get_input_panel_surface(struct weston_surface *surface)
|
|
|
|
{
|
2016-08-12 08:41:33 +00:00
|
|
|
if (surface->committed == input_panel_committed) {
|
|
|
|
return surface->committed_private;
|
2013-12-04 19:00:19 +00:00
|
|
|
} else {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
input_panel_handle_surface_destroy(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct input_panel_surface *ipsurface = container_of(listener,
|
|
|
|
struct input_panel_surface,
|
|
|
|
surface_destroy_listener);
|
|
|
|
|
|
|
|
if (ipsurface->resource) {
|
|
|
|
wl_resource_destroy(ipsurface->resource);
|
|
|
|
} else {
|
|
|
|
destroy_input_panel_surface(ipsurface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct input_panel_surface *
|
|
|
|
create_input_panel_surface(struct desktop_shell *shell,
|
|
|
|
struct weston_surface *surface)
|
|
|
|
{
|
|
|
|
struct input_panel_surface *input_panel_surface;
|
|
|
|
|
|
|
|
input_panel_surface = calloc(1, sizeof *input_panel_surface);
|
|
|
|
if (!input_panel_surface)
|
|
|
|
return NULL;
|
|
|
|
|
2016-08-12 08:41:33 +00:00
|
|
|
surface->committed = input_panel_committed;
|
|
|
|
surface->committed_private = input_panel_surface;
|
compositor: add weston_surface_set_label_func()
When printing out logs from Weston's actions, mainly for debugging, it
can be very difficult to identify the different surfaces. Inspecting
the configure function pointer is not useful, as the configure functions
may live in modules.
Add vfunc get_label to weston_surface, which will produce a short,
human-readable description of the surface, which allows identifying it
better, rather than just looking at the surface size, for instance.
Set the label function from most parts of Weston, to identify cursors and
drag icons, and panels, backgrounds, screensavers and lock surfaces, and
the desktop shell's application surfaces.
v2: renamed 'description' to 'label', so we get
weston_surface_set_label_func().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-06 16:36:51 +00:00
|
|
|
weston_surface_set_label_func(surface, input_panel_get_label);
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
input_panel_surface->shell = shell;
|
|
|
|
|
|
|
|
input_panel_surface->surface = surface;
|
|
|
|
input_panel_surface->view = weston_view_create(surface);
|
|
|
|
|
|
|
|
wl_signal_init(&input_panel_surface->destroy_signal);
|
|
|
|
input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
|
|
|
|
wl_signal_add(&surface->destroy_signal,
|
|
|
|
&input_panel_surface->surface_destroy_listener);
|
|
|
|
|
|
|
|
wl_list_init(&input_panel_surface->link);
|
|
|
|
|
|
|
|
return input_panel_surface;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
input_panel_surface_set_toplevel(struct wl_client *client,
|
|
|
|
struct wl_resource *resource,
|
|
|
|
struct wl_resource *output_resource,
|
|
|
|
uint32_t position)
|
|
|
|
{
|
|
|
|
struct input_panel_surface *input_panel_surface =
|
|
|
|
wl_resource_get_user_data(resource);
|
|
|
|
struct desktop_shell *shell = input_panel_surface->shell;
|
2017-03-27 13:31:25 +00:00
|
|
|
struct weston_head *head;
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
wl_list_insert(&shell->input_panel.surfaces,
|
|
|
|
&input_panel_surface->link);
|
|
|
|
|
2017-03-27 13:31:25 +00:00
|
|
|
head = weston_head_from_resource(output_resource);
|
|
|
|
input_panel_surface->output = head->output;
|
2013-12-04 19:00:19 +00:00
|
|
|
input_panel_surface->panel = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
input_panel_surface_set_overlay_panel(struct wl_client *client,
|
|
|
|
struct wl_resource *resource)
|
|
|
|
{
|
|
|
|
struct input_panel_surface *input_panel_surface =
|
|
|
|
wl_resource_get_user_data(resource);
|
|
|
|
struct desktop_shell *shell = input_panel_surface->shell;
|
|
|
|
|
|
|
|
wl_list_insert(&shell->input_panel.surfaces,
|
|
|
|
&input_panel_surface->link);
|
|
|
|
|
|
|
|
input_panel_surface->panel = 1;
|
|
|
|
}
|
|
|
|
|
2015-11-17 08:00:30 +00:00
|
|
|
static const struct zwp_input_panel_surface_v1_interface input_panel_surface_implementation = {
|
2013-12-04 19:00:19 +00:00
|
|
|
input_panel_surface_set_toplevel,
|
|
|
|
input_panel_surface_set_overlay_panel
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
destroy_input_panel_surface_resource(struct wl_resource *resource)
|
|
|
|
{
|
|
|
|
struct input_panel_surface *ipsurf =
|
|
|
|
wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
destroy_input_panel_surface(ipsurf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
input_panel_get_input_panel_surface(struct wl_client *client,
|
|
|
|
struct wl_resource *resource,
|
|
|
|
uint32_t id,
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
{
|
|
|
|
struct weston_surface *surface =
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
|
|
|
struct input_panel_surface *ipsurf;
|
|
|
|
|
|
|
|
if (get_input_panel_surface(surface)) {
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
"wl_input_panel::get_input_panel_surface already requested");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ipsurf = create_input_panel_surface(shell, surface);
|
|
|
|
if (!ipsurf) {
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
2016-08-12 08:41:33 +00:00
|
|
|
"surface->committed already set");
|
2013-12-04 19:00:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ipsurf->resource =
|
|
|
|
wl_resource_create(client,
|
2015-11-17 08:00:30 +00:00
|
|
|
&zwp_input_panel_surface_v1_interface,
|
|
|
|
1,
|
|
|
|
id);
|
2013-12-04 19:00:19 +00:00
|
|
|
wl_resource_set_implementation(ipsurf->resource,
|
|
|
|
&input_panel_surface_implementation,
|
|
|
|
ipsurf,
|
|
|
|
destroy_input_panel_surface_resource);
|
|
|
|
}
|
|
|
|
|
2015-11-17 08:00:30 +00:00
|
|
|
static const struct zwp_input_panel_v1_interface input_panel_implementation = {
|
2013-12-04 19:00:19 +00:00
|
|
|
input_panel_get_input_panel_surface
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
unbind_input_panel(struct wl_resource *resource)
|
|
|
|
{
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
shell->input_panel.binding = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bind_input_panel(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,
|
2015-11-17 08:00:30 +00:00
|
|
|
&zwp_input_panel_v1_interface, 1, id);
|
2013-12-04 19:00:19 +00:00
|
|
|
|
|
|
|
if (shell->input_panel.binding == NULL) {
|
|
|
|
wl_resource_set_implementation(resource,
|
|
|
|
&input_panel_implementation,
|
|
|
|
shell, unbind_input_panel);
|
|
|
|
shell->input_panel.binding = resource;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
"interface object already bound");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
input_panel_destroy(struct desktop_shell *shell)
|
|
|
|
{
|
|
|
|
wl_list_remove(&shell->show_input_panel_listener.link);
|
|
|
|
wl_list_remove(&shell->hide_input_panel_listener.link);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
input_panel_setup(struct desktop_shell *shell)
|
|
|
|
{
|
|
|
|
struct weston_compositor *ec = shell->compositor;
|
|
|
|
|
|
|
|
shell->show_input_panel_listener.notify = show_input_panels;
|
|
|
|
wl_signal_add(&ec->show_input_panel_signal,
|
|
|
|
&shell->show_input_panel_listener);
|
|
|
|
shell->hide_input_panel_listener.notify = hide_input_panels;
|
|
|
|
wl_signal_add(&ec->hide_input_panel_signal,
|
|
|
|
&shell->hide_input_panel_listener);
|
|
|
|
shell->update_input_panel_listener.notify = update_input_panels;
|
|
|
|
wl_signal_add(&ec->update_input_panel_signal,
|
|
|
|
&shell->update_input_panel_listener);
|
|
|
|
|
|
|
|
wl_list_init(&shell->input_panel.surfaces);
|
|
|
|
|
|
|
|
if (wl_global_create(shell->compositor->wl_display,
|
2015-11-17 08:00:30 +00:00
|
|
|
&zwp_input_panel_v1_interface, 1,
|
2013-12-04 19:00:19 +00:00
|
|
|
shell, bind_input_panel) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|