Commit graph

3977 commits

Author SHA1 Message Date
Kristian Høgsberg ba83db216c xwayland: Clean up unpaired surfaces 2014-04-07 10:16:19 -07:00
Mariusz Ceier d7fb309dd0 Don't include xserver-server-protocol.h
It was removed in 757d8aff27,
along with xserver protocol.

Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
2014-04-07 09:46:27 -07:00
Manuel Bachmann 9c4ab6612f Fix on-the-fly transparency changes in pixman-renderer
This fixes :
- leaking the mask used to simulate transparency ;
- code style (definitions moved up, use of brackets) ;
- applying an opaque region when transparency is
 wanted (shound not happen).

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-07 09:34:00 -07:00
Neil Roberts 4d085e709d gl-renderer: Keep track of the GL format used for SHM buffers
If the client attaches a new SHM buffer with a different format from a
previous one then we ought to trigger a full upload so that GL can
allocate a new texture. Otherwise Weston would technically be doing
invalid operations because it would call glTexSubImage2D with a
different format from the one specified in glTexImage2D. Presumably it
would also mean GL would have to convert the buffer as it copies the
sub-region in which isn't ideal.

This patch makes it decide the GL format when the buffer is attached
instead of when processing the damage and it will set
needs_full_upload if it is different from what it used before.
2014-04-07 09:26:20 -07:00
Neil Roberts 40d02288cb nested: Disable cairo on the subsurfaces
The subsurface widgets on the nested example aren't using Cairo to
render so we should turn it off to prevent the toy toolkit from
creating a redundant extra surface for it. This is particularly
important since Mesa commit 6c9d6898fdfd7e2 because the surface that
the toolkit tries to create is zero-sized and that patch prevents that
from working. This was causing weston-nested to crash.
2014-04-06 23:00:37 -07:00
Manuel Bachmann b1fff418a3 Support on-the-fly transparency changes in pixman renderer
When the alpha channel of a surface is changed and the surface
refreshed, pixman renderer will now apply a mask corresponding
to the alpha channel value.

This allows visual effects like shell fade in, shell fade out,
window switching, to work when using pixman renderer.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-06 22:48:34 -07:00
Bryan Cain a46b946cb3 shell: Fix segfault from trying to access a destroyed popup shell surface
The shell_destroy_shell_surface function only set the backing resource to
NULL, leaving an unusable surface in the popup_grab list until the surface's
fading animation finished and it could be freed. This caused a segfault if
the shell tried to forcibly break the grab during that time interval due to
the compositor losing the keyboard focus.

https://bugs.freedesktop.org/show_bug.cgi?id=77072
2014-04-06 22:47:26 -07:00
Jason Ekstrand fdc3e4c3f4 compositor-rdp: Remove unneeded client->Close call
The client->Close call is unneeded as that is already implied by returning
FALSE.
2014-04-06 22:41:59 -07:00
Neil Roberts 39a443ff9b Always use glTexImage2D instead of glTexSubImage2D for first upload
Previously when uploading SHM data we would initialise the texture
with glTexImage2D and NULL data when the buffer is attached. Then if
the GL_EXT_unpack_subimage extension is available we would always use
glTexSubImage2D to upload the data. The problem with that is that the
first glTexImage2D was always setting the internal format to
GL_BGRA_EXT and then if a 16-bit texture is used we would later call
glTexSubImage2D with a data format of GL_RGBA. Under GLES2 the
internal format must always match the data format so this is
technically invalid.

This patch makes it so that it always calls glTexImage2D when flushing
the damage for the first time. That way it will use the right internal
format and we don't need to call glTexImage2D with NULL data.

https://bugs.freedesktop.org/show_bug.cgi?id=75251
2014-04-06 22:40:34 -07:00
Pekka Paalanen e931721aa1 compositor: wl_viewport destination 1x1 min
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>
2014-04-06 22:38:24 -07:00
Pekka Paalanen 2c8b5f534b protocol: unify wl_viewport src and dst size rules
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>
2014-04-06 22:38:15 -07:00
Manuel Bachmann cd186fbfaf toytoolkit: match parent surface type when adding a subsurface
When adding a subsurface (to display a tooltip) in toytoolkit,
we now get the parent window surface type (SHM or EGL) and
define the new surface type as the same.

This fixes crashes with tooltips in cases like having
Cairo-EGL available but running the X11 compositor.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-06 22:37:45 -07:00
Jason Ekstrand 27efc06530 screen-share: re-enable planes when finished 2014-04-06 22:37:01 -07:00
Kristian Høgsberg 757d8aff27 xwayland: Use new Xwayland DDX 2014-04-06 22:32:24 -07:00
Kristian Høgsberg f03a04afac compositor: Add create_surface_signal
This signal is emitted when a client creates a surface, not for internal
surfaces.
2014-04-06 22:22:04 -07:00
Jason Ekstrand 47928d8715 Add a screen sharing plugin
This adds a plugin called screen-share.so.  If the screen-share.so module
is imported, it will add the CTRL+ALT+s keybinding to start a screen
sharing session.  If you press CTRL+ALT+S, weston will spawn another copy
of weston, this time with the RDP backend, and mirrors the current screen
to it and adds any seats from RDP as aditional seats.  The current screen
is defined as the one with the mouse pointer.  Currently the CTRL+ALT+s
keybinding is hardcoded as the only way to activate screen sharing.  If, at
some point, shells want more control over the screen sharing process, the
API's should be easy to update and export to make this possible.

For security, the command and path to weston is currently hard-coded.  It
would not take much aditional code to make this configurable or to allow a
shell to launch other screen-sharing programs.  However, handling those
security issues is outside the scope of this patch so it is hard-coded for
now.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:28:09 -07:00
Hardening f34cd2c676 compositor-rdp: Add an option to disable client initiated resizes
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>
2014-04-02 21:27:49 -07:00
Jason Ekstrand 701f636293 gl-renderer: Fix read_pixels in the case where we have output borders
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:27:46 -07:00
Jason Ekstrand 923bfe6f1f Add support for running with a primary client
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>
2014-04-02 21:27:30 -07:00
Jason Ekstrand b7d9f2eb2f compositor-wayland: Properly handle running inside a compositor that does not provide keymaps
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:27:26 -07:00
Jason Ekstrand cf40a13820 Automatically select the wayland backend if WAYLAND_SOCKET is set
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:27:06 -07:00
Jason Ekstrand e4ca8b0bdd compositor-wayland: Add a --sprawl option
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>
2014-04-02 21:27:02 -07:00
Jason Ekstrand 53ee0dcca4 compositor-wayland: Add support for running on top of wl_fullscreen_shell
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:39 -07:00
Jason Ekstrand 7a17d42fb3 weston-fullscreen: Add cursor drawing support and properly handle WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:35 -07:00
Jason Ekstrand 2bb72fe6fb weston-fullscreen: Add wl_fullscreen_shell support
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:31 -07:00
Jason Ekstrand a669bd5e00 toytoolkit: Don't crash if wl_data_device_manager is not present
This is primaraly to get weston-fullscreen to run on compositors that lack
copy-paste support.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:20 -07:00
Jason Ekstrand 738715d628 toytoolkit: Expose output make and model
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:16 -07:00
Jason Ekstrand ce97a6b184 toytoolkit: Only require xdg_shell if the window is not custom
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:11 -07:00
Jason Ekstrand 428c24e25e simple-shm: Add wl_fullscreen_shell support
This makes simple-shm act like a very simple fullscreen shell client.  This
is the kind of interaction one would expect out of a boot splash screen or
similar.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:26:00 -07:00
Jason Ekstrand 946a9489bf Add a wl_fullscreen_shell implementation
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:25:56 -07:00
Jason Ekstrand 9fc7151991 Add possible capabilities CURSOR_PLANE and ARBITRARY_MODE
The CURSOR_PLANE capability indicates that the backend has a concept of a
cursor plane and can handle a cursor without compositing.  This is currently
only advertised by the DRM backend.

The ARBITRARY_MODE flag specifies that the backend is capable of switching to
virtually any resolution.  This is currently only advertised in the RDP
backend.  While it's a bit buggy right now, it should be capable of this.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:25:27 -07:00
Jason Ekstrand a4ab5422e9 Add a signal for when a seat updates its capabilities
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:24:42 -07:00
Jason Ekstrand 27e1167957 Generate/build the fullscreen shell protocol files
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:24:39 -07:00
Jason Ekstrand ca6f73b636 Add a fullscreen shell protocol
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-02 21:24:34 -07:00
Giulio Camuffo c6ab3d52f5 compositor: let the shells create the screenshooter 2014-04-02 11:39:19 -07:00
Giulio Camuffo e9022e79c8 compositor: add an exported function to take a screenshot of an output
This allows other screenshooter protocols to use the same code to copy
the screen to a buffer.
2014-04-02 11:27:42 -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
Manuel Bachmann c1ae2e817e compositor: use Mod-Tab to show/raise minimized surfaces
Temporarily show minimized surfaces when switching between
surfaces with the keyboard. If the final selected one was
minimized, it will be restored.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-02 10:27:27 -07:00
Manuel Bachmann 50c87dbd95 compositor: implement xdg_surface_set_minimized()
We now handle the client-side xdg_surface_set_minimized()
call, and eventually hide the target surface by moving it
to a dedicated layer.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-02 10:27:13 -07:00
Giulio Camuffo e058cd13e8 compositor: export weston_buffer_from_resource()
This is needed to allow shell plugins to implement their own
screenshooter.
2014-04-02 09:13:45 -07:00
Giulio Camuffo 0ea14f51e5 xdg-shell: rename the xdg_surface.delete event to close.
'close' is more consistent with the purpose of the event than
'delete', and it is also c++ friendly, since 'delete' is a keyword.

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-04-01 16:46:41 -07:00
Bryce W. Harrington a093502891 compositor: Use weston_log rather than perror for error messages
weston_log() seems to be the standard elsewhere in the codebase for
errors.  These are the only two instances where perror() is used
instead, and their error messages aren't that informative anyway.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-01 16:46:41 -07:00
Hardening fb24eaac03 Make RDP backend supports arbitrary modes
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 (.
2014-04-01 16:46:41 -07:00
Hardening 842a36ae4a Check return value of wl_cursor functions
This patch adds checks for themes and cursors returned by wl_cursor functions.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-01 16:46:41 -07:00
Pekka Paalanen 2d9d689427 clients/scaler: add modes to test wl_scaler version 2
This allows to test the effect of setting only source rectangle or
destination size, in addition to setting both.

In weston-scaler -h output, add descriptions on what the result in each
mode should look like.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-04-01 16:46:41 -07:00
Pekka Paalanen 0b4c535d73 protocol,compositor: split wl_viewport setters
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>
2014-04-01 16:46:40 -07:00
Pekka Paalanen f0cad4844c compositor: replace weston_buffer_viewport::viewport_set
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>
2014-04-01 16:46:40 -07:00
Pekka Paalanen 952b6c8004 compositor: reorganize struct weston_buffer_viewport
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>
2014-04-01 16:46:40 -07:00
Pekka Paalanen 7ed251c119 compositor: use surface_set_size() in one more case
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>
2014-04-01 16:46:40 -07:00
Pekka Paalanen 3c9b8024fa compositor: refactor code into weston_surface_reset_pending_buffer()
No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-04-01 16:46:40 -07:00