Useful for unit tests. If Weston finds a weston.ini during unit tests,
it will load it and all the modules it asks for. We need a way to
prevent loading arbitrary modules from the command line.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The zoom translation is just a scale and a translate. The translation
is calculated based on the coordinates of the pointer which are in
global space. Previously the calculated translation was transformed by
the output transformation so that when the zoom transform is applied
after the output transform then it will be correct. However if we just
apply the zoom transformation first then we get the same result
without the zoom code having to be aware of the output transformation.
This also fixes weston_output_transform_coordinate which was applying
the output and zoom transforms in the wrong order.
https://bugs.freedesktop.org/show_bug.cgi?id=78211
When converting output-relative coordinates (such as from an input
event) to global coordinates it now takes into account the zoom
transform. Previously this would only work for the primary pointer
because the transform doesn't affect the primary pointer position due
to that way zoom follows the mouse. Touch events and multiple pointers
were not working correctly.
https://bugs.freedesktop.org/show_bug.cgi?id=68620
In order to apply the zoom transformation to the output matrix, Weston was
doing the following:
• Create a temporary matrix to hold the translation
• Invert the translation matrix using weston_matrix_invert into
another temporary matrix
• Scale that matrix by the scale factor
• Multiply the current matrix with the temporary matrix
Using weston_matrix_invert to invert a translation matrix is over the top.
Instead we can just negate the values we pass to weston_matrix_translate.
Matrix multiplication is associative so creating a temporary matrix to hold the
scale and translation transform should be equivalent to just applying them
directly to the output matrix.
Previously, because of the wrong width/height,
weston_surface_to_buffer_* would return the wrong values when
wl_viewport was used in combination with wl_surface.set_buffer_transform.
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Ensure, that the resulting surface size is at least 1x1, even when
destination size is not set and source size is zero. Previously this
lead to zero surface size.
This can still happen due to wl_viewport.set(#, #, 0, 0, #, #) followed
by wl_viewport.set_destination(-1, -1).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Let's make the source and destination size rules consistent: neither can
have zero, {-1, -1} disables it, and other negatives are not allowed.
The sanity of allowing zero sized source rectangle as debatable. Now the
minimum becomes 1/256x1/256, and with output_scale the actual samples
may be even smaller. That should be enough.
On not allowed values, raise a protocol error. This should help catch
bugs in clients that accidentally send garbage values.
The old wl_viewport.set request remains the same, and can still produce
zero sized source rectangle.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This patch adds an option to the RDP compositor to disable
desktop resizes initiated by RDP peer. The current behaviour
is that if an incoming RDP peer suggests a resolution that is
not the current one, a mode_switch() is done and the desktop is
resized to that new resolution. This new flag allows to disable
that behaviour. If the flag is set, the new behaviour is that the
RDP peer will be instructed to resize to the size of the desktop.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
On startup weston now detects the WAYLAND_SERVER_SOCKET environment
variable. If found, weston does not create the display like normal, but
instead directly adds a client corresponding to the given fd. This,
combined with the fullscreen shell, allows a process to spawn weston and
use it as a backend.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This forces weston to create one output for every parent output. This is
enabled by default if it detects a wl_fullscreen_shell. The --sprawl
option is primarily to enable this on wl_shell.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This patch removes the extra modes parameter for the RDP compositor. And
make it support any mode that is requested (be aware that RDP client may not
support all possible modes, especially odd resolution).
This new version fixes remarks done by Jason Ekstrand. It also fixes
some missing spaces between if and (.
Bump wl_scaler and wl_viewport versions to 2. Add new requests
wl_viewport.set_source and .set_destination, which are meant to replace
wl_viewport.set request.
Now a client can set and unset just one of source rectangle and
destination size. Define the semantics when one of these is unset.
Implement these semantics changes in compositor and pixman renderer.
GL-renderer does not need changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Remove the explicit boolean variable, and use illegal width to denote
"not set".
Split the boolean into two, so we can later start having buffer.src_*
and surface.* set or not set independently. This may become useful when
the wl_viewport interface is changed to allow modifying them separately.
At the moment, both buffer.src_width and surface.width conditions are
always in sync.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Queueing in the Presentation extension requires splitting the viewport
state into buffer state and surface state. To conveniently allow
assigning only one, the other, or both, reorganize the
weston_buffer_viewport structure.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fix one left-over case that directly assigned
weston_surface::width,height, and so missed view dirtying.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
There is no need for weston_subsurface_commit_to_cache() to leave the
pending.buffer set. Reset it to NULL.
This makes pending.buffer always NULL if pending.newly_attached == 0.
IOW, pending.buffer cannot be non-NULL unless
pending.newly_attached == 1.
Therefore no need to check pending.buffer nor cached.buffer_ref.buffer
for the weston_surface_attach() calls.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Merge more code into a common function. No functional changes.
At every site where weston_surface_set_size_from_buffer() was called,
weston_surface_attach() was called first. Move all calls of
set_size_from_buffer into weston_surface_attach.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
With protocol of wl_output version 2, after the output change,
it should send done event to all clients bound to it.
Signed-off-by: Quanxian Wang <quanxian.wang@intel.com>
This was always a little iffy. At least it could have been a signal,
but we now have focus signal, so lets just use that. We lose
the ability to detect unresponsive clients at key event time, but we
could add that back by adding a key_signal.
Remove the listener for output destroy from weston_view and instead
iterate views owned by the shell in its own output destroy listener.
This simplifies the code a bit since keeping the view listening for the
destroy on the right output was a bit complicated. This also removes the
function pointer output_destroyed from weston_view. The only user for it
was desktop shell, but now this is all handled in shell.c.
Since that signal is per output, it is necessary to track in which
output a view is in so that the signal is handled properly.
Instead, add a compositor wide output moved signal, that is handled by
the shell. The shell iterates over the layers it owns to move views
appropriately.
If only the mode or the owner are wrong, do not say both are wrong.
Change the text to state that there's a problem and the current
values, and let the user figure it out.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
This fixes a regression caused by either 918f2dd4 or da75ee1d. In
particular, if a client called commit without attaching a buffer and if the
compositor had already released its reference to the buffer, then a size of
0x0 would be set on the surface. In particular, this affects the wayland
backend because it frequently sends only a frame request in order to cause
a refresh.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This seems like a better name, and will not conflict if someone later
extends wl_surface with a request scaler_set (yeah, unlikely).
This code was written by Jonny Lamb, I just diffed his branches and made
a patch for Weston.
Cc: Jonny Lamb <jonny.lamb@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Currently we destroy the renderer before the outputs are destroyed, but
that sometimes leads to an error since a reference to the renderer is
necessary in order to destroy a gl_renderer_output.
Since destroying the renderer is common among all backends, just move
that call into weston_compositor_shutdown() immediately after the
outputs being destroyed.
Remove those listeners when the output is destroyed, otherwise they'll
point to invalid data that may lead to corruption when assigning a new
output for the view.
--
This is possibly related to bug 72845. I didn't have enough equipment
to try and reproduce it.
https://bugs.freedesktop.org/show_bug.cgi?id=72845
Implements wl_surface_scaler.set by setting desired
src_{x,y,width,height} and dst_{width,height} values in the
weston_buffer_viewport struct, then altering coordinates in
weston_surface_to_buffer* functions if there is a scaler set for said
surface.
This registers the wl_scaler global object and lets clients create
wl_surface_scaler objects for surfaces. wl_surface_scaler.set is not
implemented so this doesn't really do anything useful yet.
Surfaces that are created by clients get their size automatically updated
by the attach/commit. Surfaces created directly by shells (such as black
surfaces) sometimes need to be manually resized. This function allows you
to do that while being somewhat less messy than messing with the internals
of weston_surface manually.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.
Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Previously, if a pointer was inside an output that was unplugged, it
could potentialy end up outside any valid output forever. With this
patch, the pointer is moved to the "closest" output to the pointer.
Set a flag when an output is being destroyed and use that to avoid
repainting. This allows functions that schedule an output repaint to
be called when the output is being destroyed without causing the
compositor to crash.
Use the output destroy signal to move the views in the event the output
was unplugged.
Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Previously, when an output was moved due to another output being
unplugged, the views on the first output would remain in the same
position.
This patch adds an output_move signal that the views listen too in
order to repostion themselves in the event of an unplug.
Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Instead of having the backends move the remaining outputs when one is
destroyed, let the core compositor deal with that.
Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
When destroying ouputs, they would sometimes be removed before the call
to weston_output_destory() and sometimes after, depending on the
backend. Now the output is remove withing that function so the behavior
is standard across all backends.
This has a couple of additional implications for the internal weston API:
1) weston_view_configure no longer exists. Use weston_view_set_position
instead.
2) The weston_surface.configure callback no longer takes a width and
height. If you need these, surface.width/height are set before
configure is called. If you need to know when the width/height
changes, you must track that yourself.
It’s tied too deeply into the shell’s window stacking and ordering code
to legitimately be split out into compositor.c. Inline it in the shell,
and refactor some code around it a little, tidying up the stacking
behaviour for fullscreen surfaces.
This is needed for XWayland surfaces with alpha channel, as X will be
sending crap in there that should be discarded.
This is currently done with a copy in the compositor, while we wait for
support in the VideoCore side.
Replace the two functions getting the intended surface dimensions from
the surface's buffer and buffer transformation parameters by a single
function that just set the surface size according to all the buffer
state.
The old functions were always called in pairs, and always assigned to
the surface dimension variables.
This function also deals with a NULL buffer by setting the dimensions to
zero, just like the callers used to do.
The new function has no users outside this source file, so do not export
it. This basically unexports the old functions.
Gather the variables affecting the coordinate transformations between
buffer and local coordinates into a new struct weston_buffer_viewport.
This will be more useful later, when the crop & scale extension is
implemented.