Commit Graph

36 Commits

Author SHA1 Message Date
Daniel Stone
bd8a6da2f0 desktop-shell: Map input panel exactly once
When the input panel surface gets something committed to it, we have
content and thus the surface has become mapped. Do this from within the
input-panel surface committed handler.

When we want to show the input panel, this is when we map the view. Do
this exactly once as well, and make sure that we don't attempt to map
the view with an unmapped surface.

This regularises the logic to be the same as almost all the other
special surface users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-11-21 13:30:50 +00:00
Daniel Stone
bdf2019ec9 desktop-shell: Map input panel surfaces before views
Separate the concept of a surface being mapped (where it has current
content) from views being mapped (visible on a layer).

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone
ecc0d40314 desktop-shell: Use weston_view_move_to_layer() for input panels
Use our helper instead of open-coding view manipulation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Joshua Watt
617bb9afc9 Check weston_head_from_resource for NULL return
If the compositor is disabling a weston_output,
weston_head_from_resource can return NULL, so the return code must be
checked where used.

Fixes #638

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-14 13:31:06 +03:00
Derek Foreman
db51409b9a desktop-shell: Pass a weston_coord to calc_input_panel_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Derek Foreman
244dc963b9 libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:19 -05:00
Derek Foreman
59a0bd99bd libweston: Use weston_coord in surface committed handler
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman
5e353d523f libweston: Use weston_coord in struct weston_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Daniel Stone
0c69688aa2 libweston: Add weston_surface_map() wrapper
Change all instances of surface->is_mapped = true, to a specialised
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Takuro Ashie
beff0bd0f9 desktop-shell: Fix wrong initial position of input panel
When the surface type of input panel is set as an overlay panel, it's
expected to be shown at near the input cursor. But the current
implementation shows it at center-bottom on the desktop at first then
move it to the correct position while typing.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
2021-10-14 21:17:07 +09:00
Pekka Paalanen
055c1137ae libweston: make wl_output point to weston_head
The user data of a wl_resource representing a wl_output protocol object
used to be a pointer to weston_output. Now that weston_output is being
split, wl_output more accurately refers to weston_head which is a single
monitor.

Change the wl_output user data to point to weston_head.
weston_output_from_resource() is replaced with
weston_head_from_resource().

This change is not strictly necessary, but architecturally it is the
right thing to do. In the future there might appear the need to refer to
a specific head of a cloned pair, for instance.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-10 14:33:59 +03:00
Pekka Paalanen
9ffb25009c libweston: introduce weston_output_from_resource()
This is a simple wrapper for casting the user data of a wl_resource into
a struct weston_output pointer. Using the wrapper clearly marks all the
places where a wl_output protocol object is used.

Replace ALL wl_output related calls to wl_resource_get_user_data() with
a call to weston_output_from_resource().

v2: add type assert in weston_output_from_resource().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2017-07-25 16:08:48 +03:00
Quentin Glidic
82681571cf libweston: Position layers in an absolute way
Currently, layers’ order depends on the module loading order and it does
not survive runtime modifications (like shell locking/unlocking).
With this patch, modules can safely add their own layer at the expected
position in the stack, with runtime persistence.

v4 Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix three whitespace issues]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-17 16:50:18 +02:00
Quentin Glidic
2edc3d5462
libweston: Rename weston_surface::configure to ::committed
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1246
2016-08-14 09:28:50 +02:00
Jussi Kukkonen
649bbce607 include stdint.h for int32_t/uint32_t
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-26 16:26:08 -07:00
Armin Krezović
4663aca2e2 desktop-shell: update for manual surface/view mapping
This is a follow up for desktop-shell to manually
set mapped status for views/surfaces it controls

v2:

- Add manual mapping to shell_fade_create_surface()
  and shell_ensure_fullscreen_black_view()

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-01 15:29:26 +03:00
Jonas Ådahl
6d6fb61a32 desktop-shell: Rename protocol weston_desktop_shell
In the effort of going away from generic names of protocols only
relevant for weston, rename the weston desktop shell
weston_desktop_shell.

This also resets the version to 1, as there will be no prior versions
to weston_desktop_shell.

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>
2015-11-19 14:58:58 +02:00
Jonas Ådahl
b57f472c84 Use input method protocol from wayland-protocols
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 13:17:59 +02:00
Nicolas Guyomard
4845354cfa input-panel: Fix show_input_panel_surface crash when no surface has focus
Signed-off-by: Nicolas Guyomard <nicolas.guyomard@open.eurogiciel.org>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-07 17:13:17 -07:00
Derek Foreman
1281a36e3b input: Don't test keyboard/pointer/touch pointers
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.

This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-31 15:16:09 -07:00
Jon Cruz
867d50eea7 Unified multiple definitions of container_of() macro.
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:58 -07:00
Bryce Harrington
af637c25f2 *-shell: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Pekka Paalanen
8274d901f1 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-12-08 14:20:20 +02:00
Pekka Paalanen
a4bac9e0e0 desktop-shell: don't crash input-panel if no kbd focus
If a keyboard exists but it has no current focus, yet something asks the
input-panel to come up, we would crash here. Check that there is a focus
before attempting to use it.

Maybe there should not even exist a case where input-panel tries to come
up without a keyboard focus, but I am not sure there is no race where it
could happen.

In any case, this fix was brought up by the ivi-shell work, where I
suppose you can somehow hit it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Tanibata, Nobuhiko <ntanibata@jp.adit-jv.com>
2014-11-24 13:47:32 +02:00
Jasper St. Pierre
c91408f3fb Don't bother destroying resources after sending an error
An error makes the client exit, which cleans up the resources anyway.

Note (Jason Ekstrand):
This is safe for two reasons.  First, we should be handling object
destruction nicely anyway.  Second, in each of these cases, the resources
don't have any implementation or destruction set so it has absolutely no
effect on the rest of weston whether we destroy it now or later.
2014-08-08 14:57:17 -07:00
Giulio Camuffo
412e6a59eb compositor: keep track of the weston_layer a weston_view is in
This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
2014-07-23 12:34:33 -07:00
Manuel Bachmann
5082ad6b28 shell: display the input panel on the active output
We now dynamically move the input panel (i.e. virtual
keyboard) surface to the output containing the currently
focused surface.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71015

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-21 14:34:15 -07:00
Ander Conselvan de Oliveira
75c373c76c shell: Destroy a previous input panel animation when showing it again
It is possible that an input panel will be shown quickly, hidden and
shown again, before the animation for the first appeareance finished.
In that case, another animation would be created and the effect of the
two combined could cause the panel to not appear in the screen.

This patch fixes this by keeping a reference to the previous animation
and deleting it when a new one is created.
2014-04-16 22:33:48 -07:00
Manuel Bachmann
805d2f536a shell: position input panel layer above fullscreen layer
When a client calls the input panel (weston-keyboard e.g.)
and then goes fullscreen, the panel will not be hidden
anymore.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-02 10:35:26 -07:00
U. Artie Eoff
c4c7a4f921 input-panel: validate return value of get_default_view
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:04:56 -08:00
Kristian Høgsberg
d6d3b377f8 keyboard: Make debug output less verbose
The keyboard is too chatty, make it use a dbg() function for logging
which defaults to disabled.

Also drop a noisy fprintf() in input_panel_configure().
2014-01-09 23:58:14 -08:00
Kristian Høgsberg
0e45e8712a shell: Start the input panel slide slightly on the output
If a surface is not on any output, scheduling a repaint for it is a no-op.
weston_view_schedule_repaint() schedules repaints for all outputs that
overlap with the surface extents, but if the surface is completely
outside all outputs nothing will be scheduled.  Fix this for now by starting
the slide slightly into the output.
2014-01-02 01:33:42 -08:00
Kristian Høgsberg
2eebcd34fc shell: Test for surface->width == 0 to see if input-panel was unmapped
The input-panel codes tries to see determine if a buffer has not yet
been attached (or a NULL buffer has been attached), and doesn't map
the input panel surface yet in that case.  However, it test for
buffer_ref being NULL, which can happen for other reasons.  The right
test is to see if surface->width is 0, which means that either a
buffer hasn't yet been attached or a NULL buffer has been attached.

https://bugs.freedesktop.org/show_bug.cgi?id=72519
2014-01-02 01:27:38 -08:00
Kristian Høgsberg
c30c8a3db5 shell: Always set input-panel position on initial configure
If we're not currently showing the input panels, we still need to set the
panel position so that it's set when we later need to show them.  This fixes
the initial flicker of the input panel in the wrong position when we first
show it.
2014-01-02 00:45:19 -08:00
Kristian Høgsberg
677a5f5ac2 desktop-shell: Split out input-panel code 2013-12-04 11:03:24 -08:00