Commit Graph

5633 Commits

Author SHA1 Message Date
Bryce Harrington
fe0410b0cc gl: Don't declare variables in for loop
Fixes compilation error introduced by 43cea54c:

  libweston/gl-renderer.c:2862:2: error: ‘for’ loop initial declarations
  are only allowed in C99 mode
    for (unsigned i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint);
    i++) {
    ^

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:04:40 +00:00
Armin Krezović
3447619a3a compositor-wayland: Port to xdg-shell-v6
v2:

 - Keep wl_shell code around until xdg_shell is declared stable.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:00:19 +00:00
Vincent ABRIOU
e5732c7866 gl-renderer: add support of WL_SHM_FORMAT_YUYV
This patch allow gl-renderer to accept WL_SHM_FORMAT_YUYV buffers.
This is the pixel format supported by most of the USB webcams.

v2:
 - fix hsub Vs vsub inversion

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 17:47:13 +00:00
Armin Krezović
225bf9dff1 compositor-x11: Move vfunc setting from set_size to enable
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:50:20 +00:00
Armin Krezović
2e66252582 compositor-wayland: Destroy shm buffers on output disable
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:49 +00:00
Armin Krezović
78895c5fd8 compositor-wayland: Properly clean up on backend destroy
Also remove a wrong XXX comment.

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:46 +00:00
Armin Krezović
f054d35aad compositor-wayland: Simplify fullscreen output surface handling
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:42 +00:00
Armin Krezović
f16de17054 compositor-wayland: Move vfunc setting from set_size to enable
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:38 +00:00
Silvan Jegen
e31d95f262 weston-editor: Free preferred_language in text_entry_destroy
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:12:08 +00:00
Emil Velikov
5e604082d1 clients/nested-client: call eglTerminate/eglReleaseThread at exit
Do a minimalistic teardown at program exist.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:32 +00:00
Emil Velikov
a69b870e1d tests/buffer-count-test: teardown after the test
Might be a bit of an overkill, but still. One should cleanup after
themselves.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:29 +00:00
Emil Velikov
02639554e7 gl-renderer: use weston_platform_destroy_egl_surface wrapper
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:26 +00:00
Emil Velikov
050e5d00da clients/window: use weston_platform_destroy_egl_surface wrapper
v2: Use correct (destroy) API (Dan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:22 +00:00
Emil Velikov
0050536702 clients/subsurfaces: use weston_platform_destroy_egl_surface wrapper
... over a direct eglDestroySurface call. Provides symmetry in the
create/destroy paths.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:19 +00:00
Emil Velikov
903cb5727b clients/simple-egl: use weston_platform_destroy_egl_surface wrapper
... over a direct eglDestroySurface call. Provides symmetry in the
create/destroy paths.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:16 +00:00
Emil Velikov
915ee13278 clients/nested-client: destroy the EGL surface during teardown
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:10 +00:00
Emil Velikov
3612be2302 shared/platform.h: introduce weston_platform_destroy_egl_surface()
Introduce the weston_platform_destroy_egl_surface() wrapper to
complement the weston_platform_create_egl_surface() one.

We'll use the former with the next patches trhoughout weston to
consistently destroy the surface as needed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:05 +00:00
Emil Velikov
43cea54c90 gl-renderer: add support for EGL_KHR_swap_buffers_with_damage
Extension is identical to the EXT one, yet we need to check for the KHR
abbreviated extension name + entry-point.

v2: s/foo/swap_damage_ext_to_entrypoint/ (Eric, Daniel)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:31:29 +00:00
Emil Velikov
c77d30c516 simple-egl: add support for EGL_KHR_swap_buffers_with_damage
Functionally identical to the EXT version of the extension.

v2: s/foo/swap_damage_ext_to_entrypoint/ (Eric, Daniel)
v3: do the above sed for real (Frank)

[daniels: Fixed signed vs. unsigned warning.]

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:31:15 +00:00
Quentin Glidic
46dc9b440b libweston: Move text_backend_* to weston.h
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:03:20 +00:00
Dima Ryazanov
c3b63728b4 Ignore the OSC code for desktop notifications
In Fedora, bash is configured to display a desktop notification when a command
finishes (and the terminal is not focused). weston-terminal complains about it;
let's silence it.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2016-11-21 09:54:51 +00:00
Ryo Munakata
08f09e2012 libweston: remove unused function declaration of weston_compositor_top
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 09:48:12 +00:00
Daniel Stone
08a35d307f xwayland: Fix X11 lock file size confusion
The X11 lock file was somewhat opaque. Into a sized array of 16
characters, we previously read 11 bytes. 61beda653b fixed the parsing of
this input to ensure that we only considered the first 10 bytes: this
has the effect of culling a LF byte at the end of the string.

This commit more explicitly NULLs the entire string before reading, and
trims trailing LF characters only.

It also adds some documentation by way of resizing pid, an explicit size
check on snprintf's return, and comments.

Verified manually that it emits lock files with a trailing \n, as Xorg
does. Also verified manually that it ignores misformatted lock files,
but accepts either \n or \0 in the trailing position.

Related Mutter issue: https://bugzilla.gnome.org/show_bug.cgi?id=774613

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-11-21 09:47:25 +00:00
Daniel Stone
97863d6f0d text-input: Clear out context->input pointer
If we destroy the text_input (e.g. due to surface deactivation) whilst
the IM manager (the client holding the input_method_context resource,
usually weston-keyboard) sends an event, we can hit a segfault in
text-backend. This is because we free the text_input structure, but
don't actually clear the context->input structure even when we send the
deactivate event.

This is clearly intended to be catered for, since context->input is
always checked for NULL before we relay any events.

This is enough to fix one cause of text-test failing, but it's
ultimately error-prone until we have a no-op test-shell; there is still
a race where weston-desktop-shell can launch weston-keyboard before
text-test manages to bind zwp_text_input_manager.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Maniphest Tasks: https://phabricator.freedesktop.org/T7615
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-18 15:42:42 +02:00
Tom Hochstein
e7fff215ad xwayland: Fix crash when run with no input device
Starting an xterm with no input device led to a crash
because weston_wm_pick_seat() was returning garbage and
weston_wm_selection_init() was trying to use the garbage.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-11-16 16:44:20 +00:00
Pekka Paalanen
61beda653b xwayland: fix lock file parsing
Patch 139fcabe7c "xwayland: Improve error
checking for strtol call" caused a regression in the X11 unix socket
lock file parsing. Before that patch, only the first 10 characters were
considered for parsing. After the patch, the newline as the 11th
character caused strtol() to stop parsing at the 10th character which
was then considered an error as not the whole input was consumed.

The effect of the regression was that no X11 lock files were ever deemed
stale, hence stale lock files were never removed. Up till now, I have
accumulated 37 lock files, and Weston complaining for each of them on
every start it cannot parse them.

Fix this by terminating the string at the expected newline character.

Also, it looks like 'pid' was being used uninitialized, risking strtol()
reading past the end of the array. This patch fixes that too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 16:24:15 +00:00
Dima Ryazanov
9b1f8ef7bc Get rid of the window_create_menu function
It's currently unused, and there's actually no way to use it correctly.

The caller cannot free the menu that was created:
- the function only returns the window, not the menu
- there's no public API to destroy a menu object

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 16:08:05 +00:00
Quentin Glidic
c0271533d0 terminal: Silence maybe-uninitialized warning
clients/terminal.c: In function 'redraw_handler':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]
  struct utf8_state_machine machine;
                            ^~~~~~~

clients/terminal.c: In function 'handle_char':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Warning produced by GCC 5.3 and 6.1, with -O3.

'I found it weird that the compiler wouldn’t see that, so I re-checked
the code.

I think with -O3, this specific "for" is compile-time unlooped, and
utf8_next_char inlined.  And there is *one* path that can keep
machine.state to utf8state_start, thus triggering the warning.

Without -O3, the function is globally tagged as “changing unicode”, so
no warning is produced.

[...]

Side note: I picked 0 as the default value, but maybe in this case
0xfffd would be better?'

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-11-16 15:45:48 +00:00
Olivier Fourdan
df84dbe382 input: Update keyboard serial on press and release
Other compositors such as mutter update the keyboard serial for both key
press and key release, unlike weston which updates it only on key press.

When dealing with popup windows which require a match in serials, if the
event that caused the popup to be shown is a key release, then the popup
would be dismissed.

This occurs when navigating gtk+ sub-menus using the keyboard.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=768017
2016-11-16 14:46:22 +00:00
Armin Krezović
e3bfee18df gl-renderer: Use EGL_KHR_no_config_context
This patch makes use of recently implemented
EGL_KHR_no_config_context extension in Mesa,
which superseeds EGL_MESA_configless_context.

See also (and the follow-up patch):

https://lists.freedesktop.org/archives/mesa-dev/2016-September/128510.html

v2:

 - Extend existing infrastructure for EGL_MESA_configless_context
   per suggestion from Emmanuel Gil Peyrot.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 14:46:22 +00:00
Derek Foreman
c3ded6603f clients: Fix weston-scaler source-only mode to use integer width and height
If only the source of a viewport is set, the width and height must
be integer or the protocol mandates that the compositor generate an
error.  This is because using only the source is a crop, and the
width and height become the surface size - all surface sizes must
be integer.

Weston was fixed to generate this error in bb32ccc0, however the
test app continued to use fractional co-ordinates when run as
weston-scaler -s  (which only sets the viewport source)

This leaves fractional width/height for the other cases, but uses
integer for the crop-only mode.  The descriptions in the help text
are still accurate with this change, but weston-scaler -s no longer
exits with an error.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 14:46:22 +00:00
Sjoerd Simons
be8a6d3cfb xdg-shell: validate positioner object
According to the xdg-shell v6 protocol a positioner object is only
complete if both the size and its anchor rectangle are set. Ensure the
weston clients do this and let weston be more strict on checking if a
client has done so.

This also fixes weston-terminal popups not showing up on gnome-shell
3.22.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-16 10:31:11 +08:00
Ucan, Emre (ADITG/SW1)
7da3823ae3 ivi-shell: describe members of type wl_list
I wrote comments on which list they are used with

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: fix surface_list to layer_list, add ivi_layout_transition_set::transition_list]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-09 16:00:36 +02:00
Ucan, Emre (ADITG/SW1)
606f59261d ivi-shell: clear unused struct members
I removed unused members of ivi_layout* data
structs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-09 16:00:19 +02:00
Miguel A. Vico
967b6bc637 gl-renderer: Refactor gl_renderer_output_window_create()
This change refactors gl_renderer_output_window_create() to separate out
window surface creation code from output common creation code.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: rebased and removed unused 'gr' and 'ec']
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:07:40 +02:00
Miguel A. Vico
41700e355f gl-renderer: Add <platform_attribs> param to gl_renderer_display_create
This change adds <platform_attribs> parameter to
gl_renderer_display_create() in case we ever want to pass non-NULL.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: removed notes about EGLOutput]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:44 +02:00
Miguel A. Vico
684c9f49e5 gl-renderer: Accept non-NULL empty <visual_id> arrays
This change modifies egl_choose_config() to accept a non-NULL but empty
<visual_id> array (i.e. n_ids == 0)

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:32 +02:00
Miguel A. Vico
4057cd93d6 gl-renderer: Rename <attribs> param of gl_renderer to <config_attribs>
This change renames <attribs> parameter of gl_renderer_display_create()
and gl_renderer_output_window_create() to <config_attribs> to explain
which attribs it is.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: remove notes about EGLOutput]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:10 +02:00
Miguel A. Vico
c095cde364 gl-renderer: Rename gl_renderer::output_create to output_window_create
No functional change. This patch renames gl_renderer_output_create() to
gl_renderer_output_window_create(), which is something more descriptive
of what the function does.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:01 +02:00
Miguel A. Vico
dddc670c04 gl-renderer: Rename gl_renderer_create to gl_renderer_display_create
No functional change. This patch only renames gl_renderer_create() to
gl_renderer_display_create(), which is something more descriptive of
what the function does.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:05:18 +02:00
Vincent Abriou
9c526e0e62 gl-renderer: conditionally call query_buffer while gl_renderer_attach
While gl_renderer_attach, query_buffer should be call only if the
query_buffer function exists ie when has_bind_display is true.

v2:
 - Take into account Giulio's remark. Use has_bind_display viariable to test if
   EGL_WL_bind_wayland_display extension is supported.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-03 21:23:05 +00:00
Vincent Abriou
7327d5a7a2 libweston: fix building issue when EGL support is not enabled
weston-egl-ext.h has been include in compositor-xx.c file in order to
define EGL_PLATFORM_xxx_KHR extensions used by the compositors.
But in case EGL support is not enabled, all EGL related definition must
be skipped except EGL_PLATFORM_xxx_KHR that must be still defined to
allow compositor-xx.c to build.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2016-11-01 18:30:16 +00:00
Daniel Stone
67fe3dbdd0 xwayland: Move includes to avoid deprecation warnings
compositor.h already helpfully defines WL_HIDE_DEPRECATED for us, so we
don't get warnings about wl_buffer (in particular) being deprecated when
we have wayland-server headers defining it as deprecated, and then
wayland-client headers using the type.

Move it to be before all our other includes, so we actually make use of
it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-01 17:02:38 +00:00
Daniel Stone
5b01596e3f clients: Make XKB compose support conditional
Debian Jessie's version of libxkbcommon is too old for compose support,
so rather than force people to upgrade, let's make it conditional.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-10-24 10:48:34 +01:00
Daniel Díaz
75b7197f4e Add configuration option for no input device.
As it has been discussed in the past [1], running Weston
without any input device at launch might be beneficial for
some use cases.

Certainly, it's best for the vast majority of users (and
the project) to require an input device to be present, as
to avoid frustration and hassle, but for those brave souls
that so prefer, this patch lets them run without any input
device at all.

This introduces a simple configuration in weston.ini:
  [core]
  require-input=true

True is the default, so no behavioral change is introduced.

[1] https://lists.freedesktop.org/archives/wayland-devel/2015-November/025193.html

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-10-22 15:04:58 +01:00
Giulio Camuffo
2dae4d0110
libweston-desktop: destroy wl_shell_surface after the wl_surface is destroyed
The wl_shell_surface spec says that it is destroyed automatically by the
server when the wl_surface is destroyed, and indeed it does not have a
destroy request. So, do that.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-10-14 10:52:36 +02:00
Armin Krezović
2045016d8e
compositor-wayland: Convert fullscreen flag to bool
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-10-14 10:42:17 +02:00
Bryce Harrington
c6a899dec7 simple-im: Rename source file to be consistent with other client tools
Except for weston-info, client source files are not prefixed "weston-".

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2016-10-12 14:03:11 -07:00
Bryce Harrington
4c66a9031c simple-im: Use the appropriate enum names to xkb calls
XKB_KEYMAP_COMPILE_NO_FLAGS and XKB_CONTEXT_NO_FLAGS are both defined as
0 so no functional change here, just improved code clarity.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2016-10-12 14:03:08 -07:00
Bryce Harrington
8224171c22 simple-im: Use returns from main() consistently
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2016-10-12 14:03:01 -07:00