Direct fail_on_null calls now produce output like:
[weston-info] clients/weston-info.c:714: out of memory
xmalloc, et al produce output on failure like:
[weston-info] out of memory (-1)
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
That way we'll be able to set the corresponding pointer surface to
a current DnD operation.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
The policy in weston in order to determine the chosen DnD action is
deliberately simple, and is probably the minimals that any compositor
should be doing here.
Besides honoring the set_actions requests on both wl_data_source and
wl_data_offer, weston now will emit the newly added "action" events
notifying both source and dest of the chosen action.
The "dnd" client has been updated too (although minimally), so it
notifies the compositor of a "move" action on both sides.
Changes since v8:
- Add back wl_data_offer.source_actions emission, gone during last
code shuffling. Fix nits found in review.
Changes since v7:
- Fixes spotted during review. Add client-side version checks.
Implement .action emission as specified in protocol patch v11.
Changes since v6:
- Emit errors as defined in DnD actions patch v10.
Changes since v5:
- Use enum types and values for not-a-bitfield stored values.
handle errors when finding unexpected dnd_actions values.
Changes since v4:
- Added compositor-side version checks. Spaces vs tabs fixes.
Fixed resource versioning. Initialized new weston_data_source/offer
fields.
Changes since v3:
- Put data_source.action to use in the dnd client, now updates
the dnd surface like data_source.target events do.
Changes since v2:
- Split from DnD progress notification changes.
Changes since v1:
- Updated to v2 of DnD actions protocol changes, implement
wl_data_offer.source_actions.
- Fixed coding style issues.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Weston now sends wl_data_source.dnd_drop_performed and .dnd_finished in
order to notify about the different phases of DnD.
wl_data_source.cancelled is also used as mentioned in the docs, being
emitted also on DnD when the operation is meant to fail (eg. source
and dest didn't agree on a mimetype).
The dnd demo is also fixed so the struct dnd_drag isn't leaked.
https://bugs.freedesktop.org/show_bug.cgi?id=91943https://bugs.freedesktop.org/show_bug.cgi?id=91944
Changes since v6:
- Add client-side version checks. Minor code shuffling.
Changes since v5:
- Dissociate source and offer after cancel. Updated to
apply on top of c9f8f8a7f.
Changes since v4:
- Make wl_data_offer.finish with the wrong state an error.
Changes since v3:
- Fixed wl_data_source.dnd_finished vs cancelled emission on
when interoperating with version < 3 drag destinations.
Changes since v2:
- Handle wl_data_offer.finish. Fixed commit log inconsistencies.
Added version checks. Spaces vs tabs fixes. Fixed resource
versioning.
Changes since v1:
- Updated to protocol v2.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
[jonas: only send focus wl_pointer.frame if resource supports it]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
It's just a direct call to wl_surface_damage() anyway, and the only
caller no longer exists.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
It doesn't fill a useful function and is not intended to be continued.
If there is need for workspace manipulation from clients a protocol
based on those future needs need to be properly designed.
workspaces.xml is probably not very relevant since it did the bare
minimum.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
We discard motion outside the window on the assumption it's from before
some event that caused the window to shrink. However, if we have a grab
it's likely that this motion is actually from dragging from the inside
of the window out.
This fixes a problem where drag selecting in weston terminal behaves
oddly - it doesn't update the select region while the drag is happening
outside the window.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
If we're going to ignore motion below and to the right when coming
out of maximize, we should probably also ignore it above and to
the left.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Apparently it's possible for a compositor to advertise seats with
different versions on the same connection, so this makes us more robust
against that dubious behaviour.
This also tracks the seat version we requested instead of the advertised
maximum.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This patch adds the missing calls to release when the seat has capabilities
changes. It also fixes a missing release of the touch object and a leak with
old clients.
Signed-off-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
We need to input_ungrab() on the stored input, not the one that caused
the release - otherwise bad things can happen in multi-seat environments
when a seat that didn't open the menu closes it.
To reproduce:
configure two seats
launch weston terminal
open the right click pop up
select a menu item from the other seat
The next click from the seat that opened the menu will cause a segfault.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
mesa supports EGLSwapInterval 0 now, so lets remove this hack. As a
bonus we don't conflict with the XDG shell protocol that doesn't allow
committing a null-buffer, which was a side effect of this hack.
This patch reverts e9297f8e7e. See that
commit for an explanation how this worked.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
[Pekka: added reference to the original commit]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Some animated cursor sets use very long delays, but until now we'd use the
frame callback and update the cursor at the display framerate anyway.
Now we use a timerfd to drive cursor animation if the delay is longer
than 100ms, or the old method for short delays.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It is redundant to check x*alloc's return value for null pointers, since
they are guaranteed to either return non-NULL or terminate the program.
In cases where we memset the malloc'd memory to 0, we can more
efficiently use the xzalloc() routine. zalloc looks for opportunities
to return memory chunks that have already been zero'd out, so it can
provide better performance.
This patch addresses this warning, reported by Denis Denisov:
[clients/window.c:1164] -> [clients/window.c:1166]: (warning) Possible
null pointer dereference: surface - otherwise it is redundant to check
it against null.
[clients/window.c:4513] -> [clients/window.c:4514]: (warning) Possible
null pointer dereference: surface - otherwise it is redundant to check
it against null.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Removed multiple definitions of the MIN() macro from existing
locations and unified with a single definition. Updated sources
to use the shared version.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
We have the Weston command line option '--no-config' which is meant to
prevent loading weston.ini at all. It works for Weston itself, but it
does not work for any clients that also want to read weston.ini.
To fix that, introduce a new environment variable WESTON_CONFIG_FILE.
Weston will set it to the absolute path of the config file it loads.
Clients will load the config file pointed to by WESTON_CONFIG_FILE. If
the environment variable is set but empty, no config file will be
loaded. If the variable is unset, things fall back to the default
"weston.ini".
Note, that Weston will only set WESTON_CONFIG_FILE, it never reads it.
The ability to specify a custom config file to load will be another patch.
All programs that loaded "weston.ini" are modified to honour
WESTON_CONFIG_FILE.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Certain circumstances may lead to the "force" clause in
input_set_pointer_image() being reached when the current cursor
is blank or unset. These are special cursors that don't have
images, and they need to be handled differently than image cursors.
This patch puts the special cursor handling in its own function and calls
it from both places that need it. Previously only the frame callback
handler did this correctly.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
There haven't been any ideas for flags, so we don't need a useless,
unused parameter hanging around. Any future ideas should be done with a
new request entirely.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
It doesn't serve any purpose, as it's a serial that the client gave to
the server when starting the popup, which the client already has.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
wl_display_dispatch() just dispatches events that are in
default and display queues and if there are no events,
then it will wait for them. But only dispatching
the events doesn't guarantee that we got all the global announcements,
we need to do sync too. Therefore use wl_display_roundtrip() instead
of wl_display_dispatch().
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Just changes some places where a malloc failure is unhandled
to our xmalloc function that exit()s a little more gracefully.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
When a toytoolkit client redraws, the toolkit syncs the parent and
geometry. If a client redraws often (such as the terminal drawing a huge
amount of output), this can spam the compositor with requests and may
result in the client's eventual being killed.
We don't need to send requests for changing the geometry or parent if
these haven't changed. So remember the last geometry and parent, and
update them only if needed.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83297
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This reverts the parts of commit 81ff075bf4
that touch window.c.
This brings the toytoolkit window context menus back, until someone
implements the xdg-shell equivalent in the compositor.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82972
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The experimental versioning has not been updated when it was supposed
to. Let's try to be better at it now, as xdg-shell is close to have its
first stable version.
Bump the version now to bring the world into the same exact version.
There may be some protocol changes still coming, but we try to land them
before 1.6 gets out. Those changes will bump the experimental version
again as needed.
When 1.6.0 is released, the experimental version will no longer be
bumped, and no incompatible protocol changes will be made. Xdg-shell.xml
file will move to Wayland in 1.7.0, drop the experimental versioning,
and become stable.
Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
These symbols (xkb_map_* and others) were replaced in xkbcommon with more
consistent names. See the header xkbcommon/xkbcommon-compat.h for how
the old names map to the new.
The new names have been available since the first stable xkbcommon
release (0.2.0).
Signed-off-by: Ran Benita <ran234@gmail.com>
Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.
What happens is that the client want so go maximized, so we
calculate the size that we want the window to resize to (640x480),
and then add on its margins to find the buffer size (+10 = 660x500),
and then send out a configure event for that size. The client
renders to that size, realizes that it's maximized, and then
says "oh hey, my margins are actually 0 now!", and so the compositor
has to send out another configure event.
In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.