text: Add output argument to set_toplevel

Allow to specify an output for a toplevel  input panel surface.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
This commit is contained in:
Jan Arne Petersen
2013-04-18 16:47:29 +02:00
committed by Kristian Høgsberg
parent 14da96bf81
commit 7cd29e199a
3 changed files with 27 additions and 28 deletions
+16 -12
View File
@@ -79,6 +79,7 @@ struct input_panel_surface {
struct weston_surface *surface;
struct wl_listener surface_destroy_listener;
struct weston_output *output;
uint32_t panel;
};
@@ -3056,9 +3057,8 @@ show_input_panels(struct wl_listener *listener, void *data)
wl_list_for_each_safe(surface, next,
&shell->input_panel.surfaces, link) {
ws = surface->surface;
if (!weston_surface_is_mapped(ws)) {
if (!ws->buffer_ref.buffer)
continue;
}
wl_list_insert(&shell->input_panel_layer.surface_list,
&ws->layer_link);
weston_surface_geometry_dirty(ws);
@@ -3526,31 +3526,29 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy, in
if (!shell->showing_input_panels)
return;
wl_list_insert(&shell->input_panel_layer.surface_list,
&surface->layer_link);
weston_surface_geometry_dirty(surface);
weston_surface_update_transform(surface);
show_surface = 1;
}
mode = surface->output->current;
fprintf(stderr, "%s panel: %d, output: %p\n", __FUNCTION__, ip_surface->panel, ip_surface->output);
if (ip_surface->panel) {
x = shell->text_input.surface->geometry.x + shell->text_input.cursor_rectangle.x2;
y = shell->text_input.surface->geometry.y + shell->text_input.cursor_rectangle.y2;
} else {
x = surface->output->x + (mode->width - width) / 2;
y = surface->output->y + mode->height - height;
}
mode = ip_surface->output->current;
/* Don't map the input panel here, wait for
* show_input_panels signal. */
x = ip_surface->output->x + (mode->width - width) / 2;
y = ip_surface->output->y + mode->height - height;
}
weston_surface_configure(surface,
x, y,
width, height);
if (show_surface) {
wl_list_insert(&shell->input_panel_layer.surface_list,
&surface->layer_link);
weston_surface_update_transform(surface);
weston_surface_damage(surface);
weston_slide_run(surface, surface->geometry.height, 0, NULL, NULL);
}
@@ -3622,6 +3620,7 @@ create_input_panel_surface(struct desktop_shell *shell,
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 = resource->data;
@@ -3630,7 +3629,12 @@ input_panel_surface_set_toplevel(struct wl_client *client,
wl_list_insert(&shell->input_panel.surfaces,
&input_panel_surface->link);
input_panel_surface->output = output_resource->data;
input_panel_surface->panel = 0;
fprintf(stderr, "%s panel: %d, output: %p\n", __FUNCTION__,
input_panel_surface->panel,
input_panel_surface->output);
}
static void