Clear out the window callback when doing session recovery, and
make sure we have a valid on if we get a double commit.
This should stop a session recovery crash, and fix a small leak per
recovery.
b48781aa6c fixed multiple bugs where the
display wasn't flushed correctly, however it was a little overzealous.
Some of the flushes were added after calls that only updated internal
state, some in internal functions in which the caller was already going
to flush, and some were after wayland protocol calls that are double
buffered anyway and won't do anything until a following commit.
Also, I've removes at least one long standing flush where the recently
added flush is in a better location than the original.
in the case where a connection was not actively rendering, there was nothing
which would trigger a display flush, leading to applications potentially
deadlocking
@fix
This fixes cycles of init/shutdown/init where ecore event types would
become invalid, since they are now stored in a dynamic array rather than
a statically stored array.
The risk here is that if a module of EFL tends to init/shutdown in a
"normal" scenario then the event type array will grow in a leaking
manner. This could be fixed by resetting those event ID's only when the
loop actually exits (EFL_EVENT_DEL on the main loop). I'm not using
EFL_EVENT_DEL in this patch as this would add too many event callbacks
to the main loop object, which may result in slightly slower event calls
to it, affecting the overall performance.
This allows something that only has the Ecore_Wl2_Window (ie: something
that isn't engine code) to force dropping of all the buffers.
This should be safe to call at any time as the buffer handling logic
will properly cleanup the buffers when async render is done with them
or the compositor releases them.
This will eventually be used when a wayland client receives a
wl_output.leave events to indicate it isn't displayed on any outputs.
Coverity detected a resource leak here because we were not freeing the
malloc'd 'obo' variable.
Fixes Coverity CID1382907
Signed-off-by: Chris Michael <cp.michael@samsung.com>
commit 0cf806005e correctly fixed a
leaked buffer. However, other code was already accounting for the
leaked reference to the buffer manager, so an extra deref happened
and broke the universe - but only on hardware that no developer
has access to for testing.
Small patch to destroy our test buffer before we exit the
_ecore_wl2_buffer_test function so that we do not leak here.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We no longer allocate 3 buffers at startup, we now allocate only as needed.
Trimming the queue will come later, as there are some situations where we
might need 3 buffers and later drop down to 2 (when on a hardware plane)
Most clients will only ever need 2 buffers, so this is a reasonable RAM
savings.
We should only open this when actually testing dmabuf. Otherwise we're
just wasting time and adding an opportunity to fail shm init over
unrelated issues.
Calling this multiple times even after it fails the first time is a legit
thing now. We'll be doing that when we want to test dmabuf at connection
start.
We use immediate mode dmabuf creation at runtime, but this can result in
clients being killed with no option to fallback if the buffers can't be
consumed by the compositor.
This test should catch when a system can allocate a dmabuf buffer and the
compositor claims to accept dmabuf, but the buffer can't actually be used
for whatever reason. We'll then use wl_shm at runtime instead of dmabuf.
It does us no good to be able to allocate dmabuf capable memory if the
compositor can't handle it. This should fix failures on systems where
allocation is possible but the compositor doesn't advertise dmabuf.
There are some binds at startup that result in additional information
being sent, so we may need to call wl_display_sync() multiple times, and
only send the client a SYNC_DONE event when the final one completes.
This moves all the platform specific buffer allocation into ecore_wl2
instead of the engine.
Note that this makes an internal struct available in the header. This
will be removed shortly.
We need at least version 2 for create_immed, so don't even bind the
global if it's useless to us.
This will also stop us from trying to use dmabuf (and getting killed by
the compositor) on older compositors that don't support the version we
need - we'll just use wl_shm instead when this pointer is NULL.
Flushing should be done where it's needed now, but we still
need the rest of the idle handler as something like mesa may
have dispatched its queue, which reads all the pending wayland
events. In that case we have events to process but the fd will
not poll readable.
@fix T6250
This is really several inseparable commits mashed together, as doing this
a piece at a time would introduce broken intermediate revisions.
Double buffer incoming "configure" state from the compositor so it's held
back during asynchronous render and processed at frame completion.
Hold off on certain requests if their API has been invoked during async
render.
This should fix a lot of races, cosmetic issues, issues where weston can
kill our clients for acking configure (or not) at bad times, etc.
This adds the concept of a "false commit" that just sends a surface
commit without changing any other state.
This is intended to be used by ecore_evas to request a frame callback
from the compositor
Seems my brain missed the efl release and started tagging new API
incorrectly in the doxy.
This is all beta API that should probably only be used by other EFL
internals anyway, but I suppose it's a good idea to try to be somewhat
correct.
I broke this in commit 1bb45f6e61
We intentionally *don't* flush in window_semi_free, as this could be
when there's no compositor left to flush to (in the case of session
recovery).
We do flushes when we need them now, so we don't need this somewhat
non deterministic flush mechanism anymore.
Anything that breaks as a result of this should be fixable by adding an
ecore_wl2_display_flush() somewhere appropriate.
We had a hack in place to flush the display from an idle enterer instead
of after a surface commit. This led to a problem where the idle
enterer dispatch order was:
renderer for main canvas
wayland dispatch idle enterer
renderer for mouse cursor canvas
The surface commit for the mouse cursor was never dispatched, so the mouse
cursor animation would only update at the rate other events occurred.
By flushing at the appropriate times instead we ensure a proper update.
ref T5850
If wl_display_flush() returns a non negative number it was successful,
so we should disable the write handler then. We were theoretically always
doing an extra flush on an empty buffer.
This is mostly cosmetic as that's not a costly operation.
So because we include wayland-server.h we're told that wl_buffer is
deprecated - however clients are still expected to use it, it's only
deprecated for usage in a compositor.
Making these into void pointers shuts up the warning.
We need to include wayland-server.h since some of the code provided by
ecore_wl2 is for compositors, but some of it is also for clients...
The intent of the "configure complete" event is to indicate that the
window is configured and ready to receive buffers.
For "windows" like mouse cursors, that's immediate - let them know.
Abstract frame callbacks through ecore_wl2_window so we can add them in
multiple places without having the wayland compositor generate more than
one.
Also allows us to keep a callback registered over hide/unhide of a window
easily.
locks are not the same as modifiers, and the corresponding event flag must
be set based on whichever value(s) are set instead of yolo mixing and matching
@fix
ref T5737
with deferred surface creation the first canvas change of hints may not
be able to trigger protocol methods for size hints, so ensure that hints are
set
This patch adds support for the Window Iconify State Change event
structure and the ecore event type to support it.
'#divergence'
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As this function is not called from anywhere outside of
ecore_wl2_window.c file, this can be declared static.
NB: This patch also changes the function name to match the library
(ecore_wl2).
Signed-off-by: Chris Michael <cp.michael@samsung.com>
If we have no data device manager present, we would still like to
receive events when input devices get added or removed so these
handlers should be setup before we return from this function.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we are in the Ecore_Wl2 library, lets use a function name that
reflects this.
NB: No functional changes
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch which adds more window types to the Window Type enum.
These window types may be used by various compositors in different
ways. This patch does not add or change any functionality, it just
extends the window type enum to include the ability to specify other
types of windows.
'#divergence'
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds and sends a client-side event for when a window gets
deactivated.
'#divergence'
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds and sends a client-side event when a window gets
activated.
'#divergence'
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add and send a client-side event for when a window gets
hidden.
'#divergence'
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add and send a client-side event for when a window gets
shown.
'#divergence'
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we may have both a pointer and touch device on a given system, we
need to accurately set event->device when sending mouse move, wheel,
down, and up events. Previous code here would always try to find a
mouse device first which could potentially end up setting the wrong
event->device (if a touch device also existed).
This patch fixes the issue by comparing the window used for the event
to our focused windows (either mouse or touch) and setting the proper
event->device based on that.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit reverts support for added API functions inside Ecore_Wl2
to support setting window stacking mode as per IRC discussion with
Cedric
This reverts commit 1359fc9e5f.
Small patch to add API functions which allow getting/setting if a
window is in floating mode
"#divergence"
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add an API function which can be used to find out if a
given window is set to skip focus events.
"#divergence"
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add an API function which can be called to set if a
window should skip focus.
"#divergence"
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch just moves window related functions together in the
Ecore_Wl2_Window_Group
NB: No functional changes
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As these events will be raised to ecore_evas_wl and the handlers there
do not pass along the Ecore_Evas as 'data', we need to change the type
of variable passed along in the event struture so that
ecore_event_window_match can be called to find the Ecore_Evas.
This patch also fixes some typos discovered during compile
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds an API function which can be called to determine if
window manager rotation is supported.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add an API function which can be called to set if
window manager rotation is supported.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
When calculating output dpi, we should also be considering output
height in the calculation.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add an API function which can be called to set a buffer
transformation on a given window.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add a new API function that can be used to retrieve the
current transform value for a given output.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch which adds an API function that can be used to find the
output where a given window resides.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Some servers may need to do special animations or other effects when
an output transformation happens, so raise an event in the output
geometry callback when this happens.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
copied from libX11.
I don't understand what's going on here but this fixes input bugs such
as, e.g., holding ctrl and pressing shift affecting cursor position in
terminology
@fix
this function does not make sense within the context of wayland and seats,
since a surface does not own and is not owned by a seat, nor is there a 1:1
association between surfaces and seats
windows do not have pointers or cursors under wayland, seats do. due to
lack of multiseat support, most components simply use the "default" seat
with these functions, but this should make the corresponding code more
easily adaptable
the current (v6) xdg-shell spec reads as follows:
Client window decorations should be painted as if the window is
active. Do not assume this means that the window actually has
keyboard or pointer focus.
so this is not equivalent to receiving/losing input focus and should not
be propagated as such
@fix
in some cases (e.g,, x11 bridged selections) it is necessary to use
alternate means when transferring a selection, and so performing the
entire piped receive is not necessary. instead, extend the lifetime
of the data offer until the proxied receive has completed
@feature
in some cases it may be desired to have a drag data source without ever
initiating a drag, so ensure that it's possible to set the actions of the
source which will be passed for drag operations in this case
@feature
this seems to have been done to account for the case where no mimes were
passed, but sending null in this way is bad behavior for a client. the
spec indicates that null should be sent only when no mimes are accepted
@fix
ecore_wl2 contains a bunch of code for compositor side seat handling.
There's really no need for a client to do this, and E does the
compositor side seat stuff internally, so this code will never
be used.
This removes the unused code.
We've been immediately acking configure with the correct serial number, then
later at commit time sending an incorrect serial (generating a new one).
Remove the extra ack, and save that serial for later, and don't overwrite
it with a current serial when we get a toplevel configure.
Oddly, compositors were letting us get away with this behaviour, so this
probably looks functionally the same as before.
Summary:
The !global test is a post-condition that _ecore_wl2_global_find
provided valid data, so the code is clearer if this is kept separate
from the subsequent if chain for looking up the shell. Since this
post-condition returns from the function on error, it can stand alone.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewers: devilhorns, ManMower
Reviewed By: ManMower
Subscribers: jpeg, cedric
Differential Revision: https://phab.enlightenment.org/D4690
We need to bind a shell on reconnect, but dfb2af697 made sure
we only bind a single shell per wayland display for the life of
the display object - which lives longer than the connection.
That means when session recovery tries to reconnect it never bothers
to bind a shell, so the client can never post buffers.
ref https://phab.enlightenment.org/T5226
ref https://phab.enlightenment.org/T5005
@fix
Reverting this as apparently one source says to send a commit after
ack_configure, and another source says its wrong...
This reverts commit 1187035fe6.
Commit c6b59be1da ensured display cleanup after roundtrips, however we
cannot call the display_cleanup function After the display has been
disconnected ... oopsie. Essentially the call to the cleanup function
was in the wrong place here so fix.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to ensure we send a surface commit after sending the
ack_configure. This fixes an issue where E-WL internal windows would
not maximize.
Fixes T5192
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Commit ee52a28d04 added a roundtrip to
ensure and pending wl events were handled before we disconnected the
display. While this ensures some things like session recovery destroy
work again, it lead to an issue where the _ecore_wl2_display_cleanup
function was called BEFORE we processed pending events. This (in turn)
causes crashes due to processing of pending events that relied on
things like Ecore_Wl2_Input existing. As the display cleanup function
clears inputs & outputs, we need to defer calling that until the
display_roundtrip has dispatched and handled pending events.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As per Mike, the iterator macro already does the casting for us, so we
can cleanup the code here and not do casting, plus we can remove an
extra variable...bonus ;)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to change from while (iterator) to using the
EINA_ITERATOR_FOREACH macro...that I had forgotten about...thanks Mike
;)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds prioritizing to our wayland shell binding code so that
we only bind One shell that the compositor advertises. During the
global_add callback, the shells get added to the 'globals' hash, and
when sync is done, we will search for shells to bind based on priority
so that we can ensure we always bind to the latest supported shell.
ref T5226
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Previous commit f8f71d05cd to avoid resetting
opaque & input regions was not totally complete as it did not update
the actual values...small patch to fix that.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to avoid setting the same opaque/input regions if they
already match what is being requested.
ref T5226
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Since we only ever use One shell at a time, let's not bind all of them
as that is useless.
ref T5226
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Previous code here would store incorrect values into the
window->input rectangle. These values should be what is actually
getting set in the wl_region. This code also fixes an issue when
setting input region for transparent/alpha windows by clearing out
any pending input region (wl_surface_set_input_region(surface, null)).
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Previous code here would store incorrect values into the
window->opaque rectangle. These values should be what is actually
getting set in the wl_region. This code also fixes an issue when
setting opaque region for transparent/alpha windows by clearing out
any pending opaque region (wl_surface_set_opaque_region(surface, null)).
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We had to do some weird special case stuff when binding wl_compositor
because we implemented damage buffer before depending on a wayland
release that provided it.
Now our wayland dep is newer than damage buffer, so the test can be
more conventional.
Should have no functional change.
wl_shell does not use a surface state for activation, so we still need
to send the focus in/out for that based on keyboard enter/leave.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We should not be sending focus events based on keyboard behaviour, but
rather send them according to xdg shell activate status. This makes
our focus behaviour more "standards" compliant.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Now we must set EFL_WAYLAND_ENABLE_WWW to turn on www. (Note:
this does NOT re-enable any visual effect, it merely controls
the event infrastructure that can be used to let a client
know when its window is mapped or moving)
This wasn't really disabled properly earlier, so disable it now
for a slight performance win when dragging windows (and a major
reduction in log chatter when debugging wayland)
If the window opaque/input regions already match what is being
requested (to be set), then no need for the compositor to create
regions and set them.
@optimize
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
xdg v6 will barf if we attach a buffer to the surface before
we receive a configure - even if we attach before trying to
make a shell surface.
So we need to prevent any drawing into surfaces until we've
decided what kind of surface they'll ultimately be.
Fix T5090
This became core wayland functionality a long time ago, and we
now depend on wayland new enough to have it, so we should never
need the stale copy we had in tree.
When we are sending input events, if we have no pointer device then we
should be setting ev->dev to a touch device (as touch events are
treated as pointer events inside EFL).
NB: This allows EFL clients to get touch events in Enlightenment.
There are still some small hiccups here (can't close terminology by
pressing the 'x' in the corner, cannot scroll elm_test srollbar, etc).
Likely EFL needs to change wrt all this...perhaps adding events for
touch that are separate from pointer ?...
ref T5094
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This is a partial revert of 2bd880c6c7 which changed to use
wl_display_get_serial function. When can do that for most things,
however things like window move/resize need to use the input serial
which started the move/resize.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to create and raise a new event letting ecore_evas know
when the window has been configured. With the addition of xdg_shell v6
support, we cannot commit a surface with an existing buffer until the
surface has been configured. This patch allows us to raise an event to
ecore_evas when the surface has been configured, so we can then attach
a buffer to it.
ref T5090
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we cannot rely on window->display->serial to be accurate (it is
only set when there is input going on), we should be getting the
'serial' values here directly from a wayland function call.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
With the change to xdg_shell v6 we need to indicate that a window has
a pending configure event, and not show the window if a configure is
pending. In order to handle this, we add a flag to the window
structure and can check it inside ecore_evas.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
When we get a configure event, we should be using the current display
serial to set as the window configure serial value. Previous code
would always end up setting the window configure_serial to 0 as
win->display->serial was not getting updated.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds support (client-side) for xdg_shell version 6.
Enlightenment is currently using this version as it's desktop shell,
so we need to support it client-side also.
fixes T4998
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
The common code was skipping frame callback when no shell surface was
present - cursors aren't shell surfaces.
Add the frame callback to the common path and remove the bespoke callback
from the cursor code.
When we are freeing an Ecore_Wl2_Window, there is no need to call
ecore_wl2_window_hide anymore because inside the free function we are
destroying subsurfaces, surfaces, etc, etc so no need to even unmap
them.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch essentially makes sure that the surface gets a NULL buffer
attached to it when we are hiding.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
In order to hide a window (via wayland) we can actually assign a NULL
buffer to the surface, so there is no need to destroy the window's
wl_surface during a hide request.
Signed-off-by: Chris Michael <cp.michael@samsung.com>