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:
committed by
Kristian Høgsberg
parent
14da96bf81
commit
7cd29e199a
+9
-15
@@ -39,6 +39,7 @@ struct virtual_keyboard {
|
|||||||
struct input_method *input_method;
|
struct input_method *input_method;
|
||||||
struct input_method_context *context;
|
struct input_method_context *context;
|
||||||
struct display *display;
|
struct display *display;
|
||||||
|
struct output *output;
|
||||||
char *preedit_string;
|
char *preedit_string;
|
||||||
uint32_t preedit_style;
|
uint32_t preedit_style;
|
||||||
struct {
|
struct {
|
||||||
@@ -795,27 +796,18 @@ keyboard_create(struct output *output, struct virtual_keyboard *virtual_keyboard
|
|||||||
ips = input_panel_get_input_panel_surface(virtual_keyboard->input_panel,
|
ips = input_panel_get_input_panel_surface(virtual_keyboard->input_panel,
|
||||||
window_get_wl_surface(keyboard->window));
|
window_get_wl_surface(keyboard->window));
|
||||||
|
|
||||||
input_panel_surface_set_toplevel(ips, INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
|
input_panel_surface_set_toplevel(ips,
|
||||||
}
|
output_get_wl_output(output),
|
||||||
|
INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
|
||||||
|
|
||||||
static void
|
fprintf(stderr, "%s, %p\n", __FUNCTION__, output_get_wl_output(output));
|
||||||
handle_output_configure(struct output *output, void *data)
|
|
||||||
{
|
|
||||||
struct virtual_keyboard *virtual_keyboard = data;
|
|
||||||
|
|
||||||
/* skip existing outputs */
|
|
||||||
if (output_get_user_data(output))
|
|
||||||
return;
|
|
||||||
|
|
||||||
output_set_user_data(output, virtual_keyboard);
|
|
||||||
|
|
||||||
keyboard_create(output, virtual_keyboard);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct virtual_keyboard virtual_keyboard;
|
struct virtual_keyboard virtual_keyboard;
|
||||||
|
struct output *output;
|
||||||
|
|
||||||
memset(&virtual_keyboard, 0, sizeof virtual_keyboard);
|
memset(&virtual_keyboard, 0, sizeof virtual_keyboard);
|
||||||
|
|
||||||
@@ -827,7 +819,9 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
display_set_user_data(virtual_keyboard.display, &virtual_keyboard);
|
display_set_user_data(virtual_keyboard.display, &virtual_keyboard);
|
||||||
display_set_global_handler(virtual_keyboard.display, global_handler);
|
display_set_global_handler(virtual_keyboard.display, global_handler);
|
||||||
display_set_output_configure_handler(virtual_keyboard.display, handle_output_configure);
|
|
||||||
|
output = display_get_output(virtual_keyboard.display);
|
||||||
|
keyboard_create(output, &virtual_keyboard);
|
||||||
|
|
||||||
display_run(virtual_keyboard.display);
|
display_run(virtual_keyboard.display);
|
||||||
|
|
||||||
|
|||||||
@@ -208,6 +208,7 @@
|
|||||||
<description summary="set the surface type as a keyboard">
|
<description summary="set the surface type as a keyboard">
|
||||||
A keybaord surface is only shown, when a text model is active
|
A keybaord surface is only shown, when a text model is active
|
||||||
</description>
|
</description>
|
||||||
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
<arg name="position" type="uint"/>
|
<arg name="position" type="uint"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
|||||||
+16
-12
@@ -79,6 +79,7 @@ struct input_panel_surface {
|
|||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct wl_listener surface_destroy_listener;
|
struct wl_listener surface_destroy_listener;
|
||||||
|
|
||||||
|
struct weston_output *output;
|
||||||
uint32_t panel;
|
uint32_t panel;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3056,9 +3057,8 @@ show_input_panels(struct wl_listener *listener, void *data)
|
|||||||
wl_list_for_each_safe(surface, next,
|
wl_list_for_each_safe(surface, next,
|
||||||
&shell->input_panel.surfaces, link) {
|
&shell->input_panel.surfaces, link) {
|
||||||
ws = surface->surface;
|
ws = surface->surface;
|
||||||
if (!weston_surface_is_mapped(ws)) {
|
if (!ws->buffer_ref.buffer)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
wl_list_insert(&shell->input_panel_layer.surface_list,
|
wl_list_insert(&shell->input_panel_layer.surface_list,
|
||||||
&ws->layer_link);
|
&ws->layer_link);
|
||||||
weston_surface_geometry_dirty(ws);
|
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)
|
if (!shell->showing_input_panels)
|
||||||
return;
|
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;
|
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) {
|
if (ip_surface->panel) {
|
||||||
x = shell->text_input.surface->geometry.x + shell->text_input.cursor_rectangle.x2;
|
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;
|
y = shell->text_input.surface->geometry.y + shell->text_input.cursor_rectangle.y2;
|
||||||
} else {
|
} else {
|
||||||
x = surface->output->x + (mode->width - width) / 2;
|
mode = ip_surface->output->current;
|
||||||
y = surface->output->y + mode->height - height;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't map the input panel here, wait for
|
x = ip_surface->output->x + (mode->width - width) / 2;
|
||||||
* show_input_panels signal. */
|
y = ip_surface->output->y + mode->height - height;
|
||||||
|
}
|
||||||
|
|
||||||
weston_surface_configure(surface,
|
weston_surface_configure(surface,
|
||||||
x, y,
|
x, y,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
if (show_surface) {
|
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_surface_damage(surface);
|
||||||
weston_slide_run(surface, surface->geometry.height, 0, NULL, NULL);
|
weston_slide_run(surface, surface->geometry.height, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
@@ -3622,6 +3620,7 @@ create_input_panel_surface(struct desktop_shell *shell,
|
|||||||
static void
|
static void
|
||||||
input_panel_surface_set_toplevel(struct wl_client *client,
|
input_panel_surface_set_toplevel(struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
|
struct wl_resource *output_resource,
|
||||||
uint32_t position)
|
uint32_t position)
|
||||||
{
|
{
|
||||||
struct input_panel_surface *input_panel_surface = resource->data;
|
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,
|
wl_list_insert(&shell->input_panel.surfaces,
|
||||||
&input_panel_surface->link);
|
&input_panel_surface->link);
|
||||||
|
|
||||||
|
input_panel_surface->output = output_resource->data;
|
||||||
input_panel_surface->panel = 0;
|
input_panel_surface->panel = 0;
|
||||||
|
|
||||||
|
fprintf(stderr, "%s panel: %d, output: %p\n", __FUNCTION__,
|
||||||
|
input_panel_surface->panel,
|
||||||
|
input_panel_surface->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user