Commit Graph

622 Commits

Author SHA1 Message Date
Derek Foreman 280e7dd918 cosmetic: replace boolean function return values with bool
For functions that test if something is true/valid and return a 1
or 0, it makes sense to switch to bool.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 12:45:49 +02:00
Pekka Paalanen 50b6747903 compositor: send error for surface role resets
With the more accurate definition of wl_surface roles in Wayland,
enforce the restriction: a role is always set permanently, and
attempting to change it is a protocol error.

This patch is based on Jasper's patch:
http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html

The difference in this patch compared to his are:

- send role errors on the interface whose request triggers it, not on
  wl_surface

- an interface could have several requests assigning different roles,
  cannot use wl_interface as the unique key; use an arbitary string
  instead

- ensure in window-manager.c that create_shell_surface() ->
  create_common_surface() is never called with surface->configure set,
  to avoid compositor abort

- use wl_resource_post_no_memory() where appropriate instead of
  hand-rolling it with wl_resource_post_error()

Ideally we would not add weston_surface::role_name field, but use
weston_surface::configure. At the moment this is not possible though,
because at least shell.c uses several different roles with the same
configure function. Drag'n'drop uses two configure functions for the
same role. The configure hook is also reset in several places,
which is not good for role tracking.

This patch overlooks the wl_surface roles assigned in privileged
extensions: screensaver, panel, background, lock, input panel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-10-08 13:16:30 +03:00
Pekka Paalanen 641307ca21 compositor-drm: deliver frame seq for feedback
Add 'msc' field to weston_output to maintain the refresh counter, and
use it in presentation_feedback.presented.

Make compositor-drm update the per-output refresh counter with the
values reported by DRM. If the DRM reported value jumps backwards,
assume it wrapped around once.

Other backends do not update weston_output::msc, and there
presentation_feedback will always deliver refresh counter as zero.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2014-09-30 13:02:20 +03:00
Pekka Paalanen 133e439674 compositor: implement presentation_feedback
Implement the presentation.feedback request, and the
presentation_feedback protocol interface. Feedback information is
delivered to clients as the backend reports it, except the refresh
counter (MSC) which is always reported as zero.

Changes in v4:

* add 'flags' argument to 'presented' event without implementation

Changes in v5:

* remove the 'destroy' method implementation for feedback objects
  [Pekka Paalanen: do not leak struct feedback.]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2014-09-30 13:02:06 +03:00
Pekka Paalanen b5eedade36 compositor: set and use the presentation clock everywhere
Add presentation clock setters that verify the given clock actually
works. Offer an automatic choice of a software fallback clock, when a
backend has to always use clock_gettime() to approximate the
presentation time.

The DRM backend already queried the DRM about the clock id, just let the
DRM backend set the presentation clock from that.

For all other backends which do not get a timestamp from the driver,
call the software clock setter to choose a suitable clock.

Report the chosen clock via presentation.clock_id event to clients.

In finish_frame(), upgrade the argument from uint32_t milliseconds to
struct timespec which can accurately hold the presentation clock values.
This will be needed when weston_output_finish_frame() starts to send out
presentation_feedback.presented events.

While at it, replace gettimeofday() calls with clock_gettime() using the
chosen presentation clock, so we manufacture presentation timestamps
from the presentation clock when the gfx drivers cannot give us a proper
timestamp.

Rpi patch is more verbose due to not having the compositor pointer
available in rpi_flippipe_update_complete(). Explicitly carry the clock
id with flippipe so it is available in the thread.

Changes in v4:

* rpi debug build fix

v4 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2014-09-30 11:37:02 +03:00
Pekka Paalanen 31f7d78cd8 compositor: add stub implementation of presentation interface
You can bind to the global interface, and it delivers a fake clock id.
All requests on it raise an error.

Changes in v4:

* queuing methods were extractracted for a later series

[Louis-Francis Ratté-Boulianne: split queuing feature]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2014-09-30 11:37:02 +03:00
Ondřej Majerech 03db71caea compositor: Don't free an uninitialised pointer.
When backend_init returns NULL, we goto out_signals, which wants to
free(modules), but in this particular code path, modules hasn't been
initialised leading to a "Double-free or corruption" error message.
Initialising modules to NULL makes the free a no-op in this scenario.

Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
2014-09-12 09:38:39 +03:00
Derek Foreman 4b1a0a1d07 cosmetic: update comments that refer to weston_surface_update_transform()
weston_surface_update_transform() no longer exists, except in comments.

Fix that.

[Pekka Paalanen: don't lose the full comment in compositor-drm.c.]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 11:52:56 +03:00
Giulio Camuffo 00535ce6b4 compositor: fix memory corruption when removing an output
The destructor set on the wl_output resources needs the weston_output
to be allocated, because it removes the resource from its list.
So unset the destructor on all the resources when destroying an
output.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-09 14:00:20 +03:00
Ryo Munakata 03faed2074 main: don't leak option strings
[Pekka Paalanen: fix a long line]

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-09 12:21:25 +03:00
Ryo Munakata d8deff617a compositor: extract choose_default_backend and create_listening_socket
Extract these two new functions from main() to improve readability.
Refactoring only, no functioncal changes.

[Pekka Paalanen: commit message]

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-09 12:06:45 +03:00
Jason Ekstrand f83a0d44b8 Fix a copy-paste error in weston_surface_commit_state 2014-09-06 09:01:28 -07:00
Giulio Camuffo de7e2b3ce3 compositor: add an option to set the default numlock value
Add a new "numlock-on" option in the [keyboard] section of weston.ini
which, if set to true, is used to enable the numlock of the keyboards
attached at startup.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-03 15:31:31 +03:00
Pekka Paalanen 23ade621e7 compositor: leave no zombie behind
When SIGCHLD fires, we may have more than one zombie to be collected.
Run waitpid() in a loop until no more zombies are found, and clean them
all up.

It looks like the SIGCHLD signalfd does not trigger again for remaining
zombies, so we need the loop.

This works around a crash in text_backend_notified_destroy, which ends
up using stale input_method.client if the sigchld handler is not called.
The crash could be triggered by removing both weston-desktop-shell and
weston-keyboard, so that both would try to respawn and give up, and then
quitting Weston.

Cc: rawoul@gmail.com
Cc: Boyan Ding <stu_dby@126.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2014-08-28 10:15:46 +03:00
Pekka Paalanen 9c1ac7b220 compositor: add weston_client_start()
weston_client_start() is a new wrapper around weston_client_launch(),
that does the process tracking on its own, and logs the process exit
status.

When users of weston_client_start() want to know when the process exits,
they should hook into the wl_client destroy signal. This works for cases
where the client is not expected to disconnect without exiting.

As wl_client destructor and the sigchld handler run in arbitary order,
it is usually difficult for users to maintain both struct weston_process
and a struct wl_client pointer. You would need to wait for both
destructor and handler to have run, before attempting to respawn the
client.

This new function relieves the caller from the burden of maintaining the
struct weston_process, assuming the caller is only interested in client
disconnects.

Cc: Boyan Ding <stu_dby@126.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2014-08-28 10:15:10 +03:00
Jonny Lamb 66a41a06e7 compositor: fetch repeat info from weston.ini 2014-08-15 15:39:47 +03:00
Jasper St. Pierre 0013a29d5e Use the named SINCE_VERSION defines for version checks
To make our code more clear.
2014-08-08 14:56:57 -07:00
Jasper St. Pierre e2f0f84b08 compositor: Use libwayland to find a good default display for us 2014-08-05 13:06:12 -07:00
Pekka Paalanen 661de3a6a7 compositor: ignore unmapped sub-surfaces for view_list
It looks like that in the great conversion introducing weston_view, one
conditional was forgotten from the code that builds the global flat list
of views. Sub-surfaces are added to the view list specially, as they are
not governed by their presence in a layer's view list, and therefore
need an explicit check for mappedness.

The bug, missing the explicit check, caused sub-surfaces to enter the
global view_list regardless of their state. This lead to the pointer
focus picking code processing them, and as the input region defaults to
infinite, picking these unmapped surfaces. Clients then get confused
about the wl_pointer.enter events with unexpected wl_surface.

To trigger this issue, it is enough to just create one additional
wl_surface and make it a sub-surface of a main surface that is or gets
mapped. Literally, just a wl_subsomcpositor_get_subsurface() call is
enough. At some point later, the unmapped sub-surface will get pointer
focus, depending on view stacking order.

Fix the issue by adding a is_mapped check when building the view_list.

Note, that 95ec0f95aa accidentally also
prevents this bug from happening, because it adds a test against the
transform.masked_boundingbox in weston_compositor_pick_view().

Reported-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2014-07-29 17:35:14 +03:00
Pekka Paalanen eb3cf22018 compositor: quick fix for sub-surface mapping
If a client does this:
1. create a main window and map it
2. create a wl_surface, and make it a sub-surface of the main window
3. set the sub-surface to desync
4. commit content to the sub-surface to map it

Then step 4 should cause the sub-surface to become mapped. However,
Weston fails to schedule a repaint in that case, so the sub-surface will
not appear until something else causes a repaint on that output, e.g.
the main window.

A quick and dirty fix is to set the output mask for the surface in
Weston, which allows the repaint to be scheduled. This patch implements
that, and might only work right on single-output systems.

A proper fix would involve rewriting the whole "is surface mapped"
mechanism in Weston, to not rely on output assignments but to have a
separate flag for "mapped", and figuring out how to schedule repaints
for the right outputs.

Following is the actual protocol sequence used to trigger the problem:

[3224648.125]  -> wl_compositor@4.create_surface(new id wl_surface@3)
[3224648.206]  -> xdg_shell@7.get_xdg_surface(new id xdg_surface@8, wl_surface@3)
[3224648.311]  -> xdg_surface@8.set_title("simple-shm")
[3224648.378]  -> wl_surface@3.damage(0, 0, 250, 250)
[3224649.888]  -> wl_shm@6.create_pool(new id wl_shm_pool@9, fd 6, 250000)
[3224650.031]  -> wl_shm_pool@9.create_buffer(new id wl_buffer@10, 0, 250, 250, 1000, 1)
[3224650.244]  -> wl_shm_pool@9.destroy()
[3224651.975]  -> wl_surface@3.attach(wl_buffer@10, 0, 0)
[3224652.100]  -> wl_surface@3.damage(20, 20, 210, 210)
[3224652.243]  -> wl_surface@3.frame(new id wl_callback@11)
[3224652.317]  -> wl_surface@3.commit()
[3228652.535]  -> wl_compositor@4.create_surface(new id wl_surface@12)
[3228652.610]  -> wl_subcompositor@5.get_subsurface(new id wl_subsurface@13, wl_surface@12, wl_surface@3)
[3228652.644]  -> wl_subsurface@13.set_desync()
[3228652.659]  -> wl_subsurface@13.set_position(100, 100)
[3228654.090]  -> wl_shm@6.create_pool(new id wl_shm_pool@14, fd 6, 250000)
[3228654.140]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@15, 0, 250, 250, 1000, 1)
[3228654.180]  -> wl_shm_pool@14.destroy()
[3228654.408]  -> wl_surface@12.attach(wl_buffer@15, 0, 0)
[3228654.436]  -> wl_surface@12.damage(0, 0, 250, 250)
[3228654.462]  -> wl_surface@12.commit()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: George Kiagiadakis <george.kiagiadakis@collabora.com>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
2014-07-25 15:08:06 +03:00
Giulio Camuffo 95ec0f95aa compositor: add a masking mechanism to weston_layer
this adds a mechanism to mask the views belonging to a layer
to an arbitrary rect, in the global space. The parts that don't fit
in that rect will be clipped away.
Supported by the gl and pixman renderer only for now.
2014-07-23 12:34:33 -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
Jason Ekstrand 7b98207667 Create a weston_surface_state structure for storing pending surface state and move the surface commit logic into weston_surface_commit_state
This new structure is used for both weston_surface.pending and
weston_subsurface.cached.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-07 09:12:57 -07:00
Jason Ekstrand 108865de88 Move weston_frame_callback above weston_surface_create
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-07 09:12:32 -07:00
Jason Ekstrand ef5400843f Use pixman_region32_clear instead of our own empty_region
This requires pixman 0.25.2

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-07-05 01:03:55 -07:00
George Kiagiadakis 8f9e87ff47 compositor: update the surface size when there is a size change without a buffer attach
This fixes at least the case where you want to do wl_viewport.set_destination
to resize the surface but without attaching new content in it.
2014-06-19 10:04:18 -07:00
Srivardhan Hebbar ba2a36d5c5 weston: Fix memleak issue in compositor.c
Based on a previous patch by Hardening <rdp.effort@gmail.com>.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
2014-06-18 17:14:40 -07:00
George Kiagiadakis ed04d38f6a compositor: unmap subsurface views before destroying the subsurfaces
This is to avoid recursing into weston_compositor_build_view_list()
and therefore fix crashing when destroying a stack of visible subsurfaces
due to weston_compositor_build_view_list() being called recursively
and corrupting the lists it works on.

https://bugs.freedesktop.org/show_bug.cgi?id=79684
2014-06-18 11:22:27 -07:00
Jonny Lamb a55f139d3c compositor: raise errors when bad scale or transform values are used 2014-06-03 09:19:20 +03:00
Pekka Paalanen 588bee10de compositor: add --no-config command line option
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>
2014-05-09 15:00:01 -07:00
Neil Roberts 6c3b01f81e Apply the zoom transformation before the output transformation
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
2014-05-06 15:36:55 -07:00
Neil Roberts eb5a200807 Take into account the zoom when applying the output transform
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
2014-05-01 09:07:51 -07:00
Neil Roberts 1e40a7ec7a Simply the matrix calculation for zooming
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.
2014-04-25 15:18:37 -07:00
Jason Ekstrand d0cebc36fb Use the correct width/height when transforming surfaces with viewports.
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>
2014-04-25 13:24:57 -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
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
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 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 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
Giulio Camuffo c6ab3d52f5 compositor: let the shells create the screenshooter 2014-04-02 11:39:19 -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
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
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
Pekka Paalanen 260ba38fff compositor: buffer can be non-NULL only if newly_attached
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>
2014-04-01 16:46:40 -07:00