Commit graph

307 commits

Author SHA1 Message Date
Emmanuel Gil Peyrot 28834b6472 desktop-shell: Don’t reconfigure an already fullscreen surface
When we receive an wl_shell_surface::set_fullscreen request for a
surface that was already fullscreen, don’t do anything if the
parameters are the same as the initial request.

This prevents bogus or malicious clients from being able to always stay
on front by flooding the compositor with set_fullscreen requests after
the user has put them in the background with a mod+tab.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-19 17:52:46 -07:00
Quentin Glidic 5c20195e7a compositor.h: Add shell_interface.get_output_work_area
This will allow plugins to be aware of e.g. panels, to avoid covering
them with other surfaces.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-03 15:45:24 +03:00
Yong Bakos bbb783a957 desktop-shell: Use 'surface-local' to correct grammar
Correct the pluralization by simplifying with 'surface-local'.

See https://lists.freedesktop.org/archives/wayland-devel/2016-April/028249.html.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-29 16:33:01 -07:00
Jonas Ådahl 10257ee5d9 desktop-shell: Get rid of some unused fields
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2016-04-22 10:31:21 +08:00
Jonas Ådahl d3a3ee980d desktop-shell: Unset the shell surface owner when it goes away
On client destruction, the shell object may be destroyed before the
shell surface objects. If this happens to two surfaces of the same
client, and one surface being destroyed results in the focus being
switched to the other, this would trigger a ping event.

The ping event sending function relies on having a valid owner, and if
the shell would be destoryed prior to the shell surface, we'd crash in
this function.

Solve this by unsetting the owner pointer when the shell client goes
away and early out in the ping event sending function if the owner is
gone.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2016-04-22 10:31:21 +08:00
Giulio Camuffo 90a6fc659f input: use doubles in the interfaces to notify of input events
This patch is a further step in the wl_fixed_t internal sanitization.
It changes the notify_* functions to take doubles instead of wl_fixed_t
but does not change how these are stored in the various input structs
yet, except for weston_pointer_axis_event.
However this already allows to remove all wl_fixed_t usage in places
like the libinput or the x11 backend.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-23 14:05:09 +02:00
Derek Foreman bbde643ecd shell: Don't send extra configure events on click
The click_to_activate handler fires on every mouse click for a surface
so let's be a little quicker to early return if you're clicking on the
surface that already has activation.

This prevents (among other side effects) the sending of two xdg_configure
events for every mouse click.

This should also make having two seats with keyboards behave in the same
way as a single seat.  Previously the second seat could have a keyboard
focus on the surface and prevent some of the extra processing (including
the extra configure events) from taking place.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-16 21:55:46 -08:00
Bryce Harrington 22b1f93432 shell: Check more thoroughly for undefined surface resource
The surface can have an undefined resource in certain situations (such
as with xwayland).  So, since NULL is a valid state for this parameter,
and since the wl_resource_*, etc. calls require their parameters to be
non-NULL, make a practice of always checking the surface resource before
making wayland calls.

update v2:
  * Fix some c/p errors for pointer names
  * Drop null ptr check in add_popup_grab; probably redundant now

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-02-03 19:05:12 -08:00
Peter Hutterer 87743e9303 Support axis source, axis discrete, frame and axis stop events
[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>
2016-01-19 12:33:26 +08:00
Peter Hutterer 89b6a4931e Add a weston_pointer_axis_event
Use an event struct to pass axis events around. This helps dealing with the
upcoming axis discrete changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-01-19 10:53:16 +08:00
Bob Ham 553d12488c desktop-shell: Allow binding-modifier weston.ini option to be none
Allow the binding-modifier option in weston.ini to take a value of
"none", meaning that none of the usual Super+Tab, Super+K, Super+Fn,
etc. key bindings will be enabled.

Signed-off-by: Bob Ham <bob.ham@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 09:25:28 -06:00
Bob Ham 744e65317d desktop-shell: Make zapping configurable
Add a new boolean weston.ini option, "allow-zap" to enable or disable
the Ctrl-Alt-Backspace key combination.

Signed-off-by: Bob Ham <bob.ham@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 09:24:05 -06:00
Giulio Camuffo f05d18f3ee xwm: let the shells decide the position of X windows
The xwm used to automatically send to Xwayland the position of X windows
when that changed, using the x,y of the primary view of the surface.
This works fine for the desktop shell but less so for others.
This patch adds a 'send_position' vfunc to the weston_shell_client that
the shell will call when it wants to let Xwayland know what the position
of a window is.
The logic used by the desktop-shell for that is exactly the same the xwm
used to have.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
2015-12-18 11:48:25 -06:00
Jonas Ådahl 2cbf293b05 input: Keep per client pointer resources in their own structs
Keep all per client wl_pointer resources in a new struct called
'weston_pointer_client'. When focus changes, instead of moving a list
of resources between different lists, just change the focused pointer
client.

The intention with this is to make it easier to add wl_pointer
extensions that share the same focus as the corresponding wl_pointer.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-20 11:52:19 +08:00
Jonas Ådahl d2510105a6 input: Make pointer grab motion callbacks take an event struct
Instead of only passing absolute pointer coordinates, effectively
loosing motion event data, pass a struct that can potentially contain
different types of motion events, currently being absolute and relative.

A helper function to get resulting absolute coordinates was added for
when previous callbacks simply used the (x, y) coordinates.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-11-20 11:44:56 +08:00
Jonas Ådahl 5b0b770c2d Remove workspaces protocol
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>
2015-11-19 15:11:08 +02:00
Jonas Ådahl 6d6fb61a32 desktop-shell: Rename protocol weston_desktop_shell
In the effort of going away from generic names of protocols only
relevant for weston, rename the weston desktop shell
weston_desktop_shell.

This also resets the version to 1, as there will be no prior versions
to weston_desktop_shell.

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>
2015-11-19 14:58:58 +02:00
Jonas Ådahl 2a229338a5 Use xdg_shell protocol from wayland-protocols
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>
2015-11-19 14:49:52 +02:00
Jonas Ådahl b57f472c84 Use input method protocol from wayland-protocols
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 13:17:59 +02:00
Peter Hutterer 1118952e14 desktop-shell: use weston_pointer_send_axis
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-11-16 12:09:07 +08:00
Jonas Ådahl 0336ca0cc5 input: Pass axis events through pointer grab interfaces
Don't only send motions and buttons but also axis events through the
pointer grab interface.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-11-02 14:30:16 +08:00
Jonas Ådahl 22faea11c8 desktop-shell: Add surface_keyboard_focus_lost helper
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-11-02 14:10:01 +08:00
Jonas Ådahl cd0f1acff4 desktop-shell: Make activate_binding take a view instead of surface
In preparation for further refactoring. This patch also removes a
redundant NULL check. Since we pass views, and views will always have an
associated surface, there is no point of checking if it has.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-23 17:03:54 -07:00
Marek Chalupa 6ce78992a0 shell: fix maximizing windows on a secondary output
commit f814c5dc9 changed get_output_work_area behaviour
which broke the code for positioning maximized window.
The x position was set to 2*output->x instead of to output->x

fix https://bugs.freedesktop.org/show_bug.cgi?id=92357

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-10-09 15:24:04 -05:00
Nicolas Guyomard 4845354cfa input-panel: Fix show_input_panel_surface crash when no surface has focus
Signed-off-by: Nicolas Guyomard <nicolas.guyomard@open.eurogiciel.org>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-07 17:13:17 -07:00
Derek Foreman bdc8c721e4 cosmetic: Remove a few double semicolons
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-10-07 11:22:03 -07:00
Jonas Ådahl bc5d849c9d desktop-shell: NULL check whether a popup parent is a shell surface
get_shell_surface(parent) may return NULL if the client passed a
unassigned wl_surface or a wl_surface with a non-shell surface role
(such as cursor role).

https://bugs.freedesktop.org/show_bug.cgi?id=92316

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-10-07 11:43:59 -05:00
Ben Hummon 445e44cfb2 clients: Moving and rotating transient surfaces
Transient surfaces use child/parent surfaces for stacking order. This
change resloves an issue in which attempting to move or rotate a
toplevel transient surface can move or rotate its ancestor.
2015-10-06 15:24:28 -05:00
Derek Foreman 45a7c27f2b clients: If available, prefer top level surfaces for move or rotate
This stops us from rotating or moving pop-up menus by instead rotating
their parents.

This is easiest to see using a multi-seat configuration.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-15 06:51:15 -07:00
Derek Foreman c0c1497f99 shell: Make sure we actually have a resource in end_busy_cursor
It's actually possible to get here after the surface has been destroyed,
especially when running client apps under valgrind.

That probably shouldn't be able to segfault the compositor.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-14 11:33:31 -07:00
Derek Foreman f9318d1452 input: add a weston_pointer_clear_focus() helper function
Valgrind has shown that in at least one place (default_grab_pointer_focus)
we're testing uninitialized values coming out of weston_compositor_pick_view.

This is happening when default_grab_pointer_focus is called when there is
nothing on the view list, and during the first repaint when only the black
surface with no input region exists.

This patch adds a function to clear pointer focus and also set the sx,sy
co-ordinates to a sentinel value we shouldn't compute with.

Assertions are added to make sure any time pointer focus is set to NULL
these values are used.

weston_compositor_pick_view() now returns these values too.

Now the values are always initialized, even when no view exists, and
they're initialized in such a way that actually doing computation
with them should fail in an obvious way, but we can compare them
safely for equality.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:28:30 +01:00
Giulio Camuffo 61ed7b6bf0 input: pass the global touch coordinates to the touch grab
This makes it consistent with the pointer grab, which also gets
global coordinates and not surface relative ones, and allows to
easily filter out gestures based on compositor global hotspots.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:21:01 +01:00
Derek Foreman e4d6c83986 desktop-shell: Make resize and move functions take a pointer instead of a seat
An earlier patch made surface_resize() and surface_move() take pointers
instead of seats, this updates the weston_shell_interface resize and move to
match.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:16:14 +01:00
Derek Foreman e42d754843 desktop-shell: drop shell_client from the head of the surface list on destroy
This prevents a use after free when the surfaces are automatically cleaned
up later, as shell_client's freed node was still in the surface list.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-08-06 16:04:15 +01:00
Derek Foreman 1281a36e3b input: Don't test keyboard/pointer/touch pointers
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.

This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-31 15:16:09 -07:00
Derek Foreman 006cf67c77 desktop-shell: Check for device presence properly
We should be testing device counts, not pointers.  The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after a release.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-31 15:16:03 -07:00
Derek Foreman 60d97311be desktop-shell: Don't call wl_list_init() in the middle of a list
seat->keyboard_focus_listener.link isn't a head, it's just sometimes a
member of the focus signal list.  Calling wl_list_init() on it puts
a loop in the list.

Instead, we remove the item then init it.  That way we can call remove on
it again later even if it hasn't been re-added to a list.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-31 15:15:59 -07:00
Derek Foreman 22276a596a zoom: Store the seat that initiated a zoom
Track the seat that initiated a seat instead of picking the first one.

Previously, if there are multiple seats then any seat can adjust the zoom
level but the zoom tracks the first seat's pointer.

Now the zoom will follow the pointer of the seat that initiated the zoom.

Additionally, if there's no pointer in the first seat, starting a zoom
with the second seat will no longer crash weston.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-29 19:54:17 -07:00
Derek Foreman 25bd8a71fc zoom: Call weston_output_activate_zoom() appropriately
No longer call weston_output_update_zoom() when trying to zoom out
on an unzoomed output.

Add an assert() to make sure update_zoom is never called without an
active zoom.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-29 19:47:31 -07:00
Derek Foreman 004b4a1dc1 desktop-shell: Put monitor to sleep when idle timer expires
Removing the screensaver had the accidental side effect of disabling
DPMS display shut down.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-23 10:54:47 -07:00
Derek Foreman d8156e22f6 exposay: Fix use after free when a view is destroyed during animation
Moving the destroy listener setup allows the animation completion handler
to be called before we free any structures it needs.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-17 19:02:28 -07:00
Derek Foreman daf846e4ea exposay: Fix logic inversion when ending keyboard grabs
I flipped a ! in cee82d6286
and the exposay keyboard grab became permanent.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-17 18:59:35 -07:00
Derek Foreman 6feb0f9f55 desktop-shell: use work area instead of panel size to constrain moves
This fixes the case where an output isn't at y = 0, where the panel height
isn't correct for constraints.

It also kills a bug - moving a window with a mod-drag off the top of the
screen clamped earlier than it should.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-17 17:46:58 -07:00
Derek Foreman 612341f1a6 desktop-shell: use output position in get_output_panel_size()
The panel size calculation needs to take the output position into account
or it's only correct when the output is at 0, 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-17 17:46:54 -07:00
Derek Foreman f814c5dc9d desktop-shell: add output co-ordinates to get_output_work_area()
get_output_work_area() now returns the absolute work area including the
output's offset.

This will make math a little simpler later when we use it to constrain
window moves.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-17 17:46:49 -07:00
Derek Foreman 2217f3f738 shell: Switch middle and right mouse bindings
Currently rotate is on the right mouse button and resize is on the middle.

As fantastic as rotating windows is, it's probably nicer to have resize on
the right button, especially for anyone with only 2 buttons.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-16 19:35:19 -07:00
Derek Foreman f7b2f8b0a6 desktop-shell: Use the grabbed pointer in popup_grab_button
This should be identical to the pointer in shset->seat.

A later patch prevents direct access to seat->pointer, using the
known valid pointer in the grab will be nicer than using the
getter functions that patch introduces.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:19 -07:00
Derek Foreman 8fbebbd985 desktop-shell: Make surface_resize take a pointer instead of a seat
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:17 -07:00
Derek Foreman 74de4693b7 desktop-shell: Make surface_rotate take a pointer instead of a seat
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:07 -07:00
Derek Foreman 794fa0e031 desktop-shell: Make surface_move take a pointer instead of a seat
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:04 -07:00
Derek Foreman b7674ae4dc desktop-shell: Make surface_touch_move take a touch instead of a seat
It never actually needs the seat, and we always verify the touch pointer
before calling it, so let's just pass a touch pointer instead of having
an assumption that the seat's touch pointer has been verified.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:56 -07:00
Derek Foreman 8ae2db5b0c input: Pass the appropriate pointer type to bindings instead of a seat
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer.  However, in a binding you're
guaranteed that the seat has a device of that type.  If we pass in
that type instead of the seat, it's obvious we don't have to test it.

The bindings can still get the seat pointer via whatever->seat if they
need it.

This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:43 -07:00
Derek Foreman cee82d6286 exposay: Test keyboard presence before using keyboard pointer
We shouldn't actually use the keyboard pointer unless we check that
a keyboard is present.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:32 -07:00
Derek Foreman cf7d95a688 desktop-shell: make client_initiated a bool
Make it a bool in both surface_move() and struct weston_move_grab

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-10 17:11:33 -07:00
Mario Kleiner 492c12fb8b desktop-shell: Allow fullscreen windows to mode-switch their output.
Fix desktop-shell's activate() method to only restore the output
mode on the single output on which a shell surface gets activated.

This way toplevel fullscreen surfaces can mode-switch their output
via method WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER and that
temporary mode properly persists until the surface loses its
fullscreen status, but effects like window switching and exposay
still work in the expected way.

v2: Split into a separate patch from original patch
    "Allow restore_output_mode() to work properly.",
    as suggested by Derek Foreman.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-02 15:14:30 +03:00
Mario Kleiner 9f4d655494 desktop-shell: Allow multiple active fullscreen windows on multi-display setup.
Desktop shell demoted all fullscreen shell surfaces on all active
outputs of a multi-display setup whenever any shell surface was
activated anywhere. This made it impossible to have multiple
fullscreen windows on separate outputs active at the same
time, as creating or activating any shell surface would disable
fullscreen status for all existing fullscreen surfaces.

Make lower_fullscreen_layer() more selective, so on request it
only demotes fullscreen surfaces on a specified weston_output.

The activate() method for a specific surface will now only request
demotion of fullscreen surfaces on the target output of the activated
surface, but leave fullscreen surfaces on unrelated outputs alone.

Desktop wide acting functions like the window switcher or exposay
will still demote all fullscreen surfaces on all outputs to
implement their effect as before.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-06-30 12:12:53 -07:00
Pekka Paalanen aa9536a992 text_backend: make destructor call explicit
We used to rely on the order in which the
weston_compositor::destroy_signal callbacks happened, to not access
freed memory. Don't know when, but this broke at least with ivi-shell,
which caused crashes in random places on compositor shutdown.

Valgrind found the following:

 Invalid write of size 8
    at 0xC2EDC69: unbind_input_panel (input-panel-ivi.c:340)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3E085: for_each_helper.isra.0 (wayland-util.c:359)
    by 0x4E3E60D: wl_map_for_each (wayland-util.c:365)
    by 0x4E3BEC7: wl_client_destroy (wayland-server.c:675)
    by 0x4182F2: text_backend_notifier_destroy (text-backend.c:1047)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)
  Address 0x67ea360 is 208 bytes inside a block of size 232 free'd
    at 0x4C2A6BC: free (vg_replace_malloc.c:473)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)

 Invalid write of size 8
    at 0x4E3E0D7: wl_list_remove (wayland-util.c:57)
    by 0xC2EDEE9: destroy_input_panel_surface (input-panel-ivi.c:191)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3BC7B: wl_resource_destroy (wayland-server.c:550)
    by 0x40DB8B: wl_signal_emit (wayland-server-core.h:264)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1883)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1873)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3E085: for_each_helper.isra.0 (wayland-util.c:359)
    by 0x4E3E60D: wl_map_for_each (wayland-util.c:365)
    by 0x4E3BEC7: wl_client_destroy (wayland-server.c:675)
    by 0x4182F2: text_backend_notifier_destroy (text-backend.c:1047)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)
  Address 0x67ea370 is 224 bytes inside a block of size 232 free'd
    at 0x4C2A6BC: free (vg_replace_malloc.c:473)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)

 Invalid write of size 8
    at 0x4E3E0E7: wl_list_remove (wayland-util.c:58)
    by 0xC2EDEE9: destroy_input_panel_surface (input-panel-ivi.c:191)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3BC7B: wl_resource_destroy (wayland-server.c:550)
    by 0x40DB8B: wl_signal_emit (wayland-server-core.h:264)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1883)
    by 0x40DB8B: weston_surface_destroy (compositor.c:1873)
    by 0x4E3B6BB: destroy_resource (wayland-server.c:537)
    by 0x4E3E085: for_each_helper.isra.0 (wayland-util.c:359)
    by 0x4E3E60D: wl_map_for_each (wayland-util.c:365)
    by 0x4E3BEC7: wl_client_destroy (wayland-server.c:675)
    by 0x4182F2: text_backend_notifier_destroy (text-backend.c:1047)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)
  Address 0x67ea368 is 216 bytes inside a block of size 232 free'd
    at 0x4C2A6BC: free (vg_replace_malloc.c:473)
    by 0x4084FB: wl_signal_emit (wayland-server-core.h:264)
    by 0x4084FB: main (compositor.c:5465)

Looking at the first of these, unbind_input_panel() gets called when the
text-backend destroys its helper client which has bound to input_panel
interface. This happens after the shell's destroy_signal callback has
been called, so the shell has already been freed.

The other two errors come from
  wl_list_remove(&input_panel_surface->link);
which has gone stale when the shell was destroyed
(shell->input_panel.surfaces list).

Rather than creating even more destroy listeners and hooking them up in
spaghetti, modify text-backend to not hook up to the compositor destroy
signal. Instead, make it the text_backend_init() callers' responsibility
to also call text_backend_destroy() appropriately, before the shell goes
away.

This fixed all the above Valgrind errors, and avoid a crash with
ivi-shell when exiting Weston.

Also using desktop-shell exhibited similar Valgrind errors which are
fixed by this patch, but those didn't happen to cause any crashes AFAIK.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-06-26 09:33:54 +03:00
Pekka Paalanen b37ac4006a desktop-shell: remove screensaver support
This is a follow-up for the patch that removed weston-screensaver. The
aim is to clean up shell.c a little by removing non-essential
components. Vanilla Weston desktop is only a demo, external projects are
encouraged to create user-friendly desktop environments.

The support for launching a screensaver client and the protocol bindings
are removed. With them, all related configuration options are removed,
and the manuals are updated accordingly.

The screensaver protocol definition is left in desktop-shell.xml for
posterity.

This does not affect Weston's or desktop-shells ability to put screens
to sleep after inactivity. The inactivity timer continues to operate as
before. Also screen locking is unaffected.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-06-22 15:19:39 +03:00
Jon Cruz 867d50eea7 Unified multiple definitions of container_of() macro.
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.

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>
2015-06-15 17:11:58 -07:00
Jon Cruz d618f688d5 Moved the MIN() macro to the helper include.
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>
2015-06-15 17:11:52 -07:00
Jon Cruz 4678bab13c Remove redundant #include path component.
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>
2015-06-15 17:11:09 -07:00
Bryce Harrington af637c25f2 *-shell: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Murray Calavera 9a51cd7d10 move text_backend initialization into the shell plugin
Whether a input method is used should be the responsibility
of the shell because some shells may not want to implement
an input method at all

Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-11 12:20:46 +03:00
Pekka Paalanen 23ed5f2526 desktop-shell: do not black out with startup "none"
Do not use a black blanket surface when the startup animation is
specified to be "none". This is the final fix needed to make the
screenshot test deterministic and independent of weston-desktop-shell.

Previously, the black surface would cover all outputs until
weston-desktop-shell signalled ready. Then, depending on the set
animation, either the black surface was immediately removed (none) or a
fade-in started (fade).

Now, when there is no black surface at all for "none", the compositor
will show garbage until weston-desktop-shell gets everything up. This
may be undesireable but works for tests. To have the old "none"
behaviour back, I would propose to add a new startup-animation value
"black" for it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-05-26 15:43:02 +03:00
Derek Foreman 039e9be49d desktop-shell: destroy surfaces in an idle handler after fade out
It's possible for more than one animation to be taking place on a view at
the same time.  If one of those animations is the shell's fade out for
dying surfaces, its completion handler will trigger the surface destroy
signal, causing other animations on the animation list to remove themselves.

Since this removal occurs during the linked list walk, the compositor may
crash.

We move the actual surface destruction into an idle handler to avoid this.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-05-26 13:07:58 +03:00
Derek Foreman 3dd570e754 exposay: Don't crash if no pointer is present
If the compositor has never seen a mouse, exposay will crash because
the seat->pointer pointer is NULL.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-05-26 12:48:12 +03:00
Michael Vetter 2a18a52844 remove trailing whitespaces
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
2015-05-15 13:12:32 -07:00
Ryo Munakata 79954ec9fe desktop-shell: set the current size in the first 'resizing' configure event
Weston has sent the first 'resizing' configure event with width=height=0.
But resizing to that size doesn't make sense.
Instead, we now send the current width and height of the surface at the beginning
of resizing.

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
2015-05-08 14:17:00 -07:00
Jonas Ådahl ee45a55dea xdg-shell: Move xdg_shell.get_xdg_popup errors to xdg_shell
They are errors that may be as a result of calling get_xdg_popup on an
xdg_shell, not a result of calling a request on xdg_popup.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-05-05 14:17:11 +08:00
Jonas Ådahl 49d77d20ae xdg-shell: Require proper object tree destruction
Require all child objects to be destroyed before the parent. In other
words, all popups and surfaces created by one xdg_shell instance needs
to be destroyed before the xdg_shell object, otherwise a protocol error
is raised.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-05-05 14:17:01 +08:00
Derek Foreman 4c93c08679 touch: Make weston_touch_set_focus() take a touch instead of a seat
The other set_focus() functions take the relevant type instead of a seat
already, so this is consistent.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-05-01 12:42:52 +01:00
Dima Ryazanov 497f25de57 desktop-shell: Require a popup parent to be a shell surface
Currently, the shell crashes if the parent is not a shell surface. Instead,
send an error to the client.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-13 15:23:13 +03:00
Giulio Camuffo a8e9b41578 xwm: tell the shell the pid of the X clients
All the surfaces from all the X clients share the same wl_client so
wl_client_get_credentials can't be used to get the pid of the X
clients.
The shell may need to know the pid to be able to associate a surface
with e.g. a DBus service.

[Pekka: fixed trivial merge conflicts.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-30 16:04:57 +03:00
Manuel Bachmann dc1c3e49bb desktop-shell: remove dead unminimization code
The "set_minimized(surface, 0)" function call was never
used anywhere, and not really respecting naming
conventions.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-27 15:41:25 +02:00
Derek Foreman 70ac0edcab desktop-shell: don't allow negative values in drag resize
Now clamping width and height to a minimum of 1, 1 when drag resizing.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-18 10:34:18 -07:00
Ryo Munakata 76fb7ec272 shell,compositor-x11: Fix trivial memory leaks
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-09 09:26:46 +02:00
Pekka Paalanen 2829f7c42e compositor,shell: move debug key code to core
The code for the key binding that triggers debug key bindings, that is,
the code that makes mod+SHIFT+SPACE work, used to live in shell.c. I
want to make the debug key bindings available in ivi-shell too, so this
code should be shared. Move it to core.

The code was originally introduced in
commit c509d2b152
so update the copyright in binding.c to reflect that.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-03-02 16:56:01 +02:00
Jasper St. Pierre 5ba1e1d137 xdg-shell: Bump unstable version
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:43 +02:00
Jasper St. Pierre 084aa0b6f6 xdg-shell: Add a simple destructor request
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:23 +02:00
Jonas Ådahl 24185e2561 xdg-shell: Add invalid_parent error to xdg_popup
Send an invalid_parent error when the client tries to create a popup
with a paren that is neither a xdg_surface nor a xdg_popup.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:18 +02:00
Jasper St. Pierre da6ecd0cc5 xdg-shell: Send an error when the client uses the not-topmost popup
Either in destroy or get_xdg_popup.

[jadahl: Verify that the new popup is the top most when mapping instead
of creating. Some renaming.]

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:11 +02:00
Jasper St. Pierre 14f330c619 xdg-shell: Remove the flags from get_xdg_popup
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>
2015-02-27 14:59:05 +02:00
Jasper St. Pierre ecf2a0f1ca xdg-shell: Remove the serial from popup_done
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>
2015-02-27 14:58:57 +02:00
Jasper St. Pierre 66bc949b72 xdg-shell: Take a xdg_surface as the parent surface
There is no other valid surface that we should be using here.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:58:35 +02:00
Jonas Ådahl 01193aeb12 desktop-shell: Fix coding style of add_popup_grab
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-23 15:41:57 +02:00
Jonas Ådahl c2b101114f desktop-shell: Simplify popup_end_grab popup_done sending loop
Can just use wl_list_for_each_safe instead of dealing with pointers
ourself.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-23 15:37:22 +02:00
Jonas Ådahl bf48e21fa1 desktop-shell: Fail if get_xdg_surface is called on an xdg_surface
If a client calls xdg_shell.get_xdg_surface on a surface that is already
an xdg_surface would, prior to this patch, succeed, but cause weston to
crash later when trying to configure. This patch instead sends a role
error to the client complaining that it already is an xdg_surface.

Note that .._set_role() only fails when changing roles, not when setting
the same role twice.

The same is done for xdg_popup.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-06 17:46:05 -08:00
Giulio Camuffo 6b4b24155f xwm: support maximizing xwayland windows
This patch adds the maximize button to the window frame for the windows
which set the MWM_DECOR_MAXIMIZE hint, and it wires it with the shell
via a new method in weston_shell_interface.
Additionally, it also listens for the wm hints coming from the client,
but it doesn't support maximizing a window only vertically or horizontally.
The window will be maximized only when both directions are maximized.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-02 16:00:10 -08:00
Derek Foreman 8aeeac827f desktop-shell: Remove unnecessary type casts
Remove a few instances of casting weston_seat to weston_seat.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-02-02 15:00:18 -08:00
Derek Foreman 7ef3bed03c desktop-shell: Don't crash on zoom without a pointer in the seat
The zoom effect zooms at the seat's current pointer location.  When no
pointer is present the zoom key bindings cause a crash.

Instead, check for the absence of a pointer and log a warning.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-30 14:11:29 -08:00
Giulio Camuffo 7a8d67dedf shell: fix positioning of maximized surfaces with a custom geometry 2015-01-27 15:27:39 -08:00
Pekka Paalanen b502654b9f compositor: Implement JSON-timeline logging
Logging is activated and deactivated with the debug key binding 't'.
When activated, it creates a new log file, where it records the events.
The log file contains events and detailed object information entries in
JSON format, and is meant to be parsed in sequence from beginning to the
end.

The emitted events are mostly related to the output repaint cycle, like
when repaint begins, is submitted to GPU, and when it completes on a
vblank. This is recorded per-output. Also some per-surface events are
recorded, including when surface damage is flushed.

To reduce the log size, events refer to objects like outputs and
surfaces by id numbers. Detailed object information is emitted only as
needed: on the first object occurrence, and afterwards only if
weston_timeline_object::force_refresh asks for it.

The detailed information for surfaces includes the string returned by
weston_surface::get_label. Therefore it is important to set
weston_timeline_object::force_refresh = 1 whenever the string would
change, so that the new details get recorded.

A rudimentary parser and SVG generator can be found at:
https://github.com/ppaalanen/wesgr

The timeline logs can answer questions including:
- How does the compositor repaint cycle work timing-wise?
- When was the vblank deadline missed?
- What is the latency from surface commit to showing the new content on
  screen?
- How long does it take to process the scenegraph?

v2: weston_surface::get_description renamed to get_label.
v3: reafctor a bit into fprint_quoted_string().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-08 15:02:56 +02:00
Pekka Paalanen 8274d901f1 compositor: add weston_surface_set_label_func()
When printing out logs from Weston's actions, mainly for debugging, it
can be very difficult to identify the different surfaces.  Inspecting
the configure function pointer is not useful, as the configure functions
may live in modules.

Add vfunc get_label to weston_surface, which will produce a short,
human-readable description of the surface, which allows identifying it
better, rather than just looking at the surface size, for instance.

Set the label function from most parts of Weston, to identify cursors and
drag icons, and panels, backgrounds, screensavers and lock surfaces, and
the desktop shell's application surfaces.

v2: renamed 'description' to 'label', so we get
	weston_surface_set_label_func().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-08 14:20:20 +02:00
Pekka Paalanen a4bac9e0e0 desktop-shell: don't crash input-panel if no kbd focus
If a keyboard exists but it has no current focus, yet something asks the
input-panel to come up, we would crash here. Check that there is a focus
before attempting to use it.

Maybe there should not even exist a case where input-panel tries to come
up without a keyboard focus, but I am not sure there is no race where it
could happen.

In any case, this fix was brought up by the ivi-shell work, where I
suppose you can somehow hit it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Tanibata, Nobuhiko <ntanibata@jp.adit-jv.com>
2014-11-24 13:47:32 +02:00
Marek Chalupa e9fe467453 xwayland: fix fullscreening
set_fullscreen has been sending configure before changing the state
and xwayland windows added border to the fullscreen size.

This fixes the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83502

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-21 15:14:55 +02:00
Derek Foreman 6ae7bc982f compositor: Refactor weston_output_mode_switch()
This breaks weston_output_mode_switch() into 3 functions:
weston_output_mode_set_native()
weston_output_mode_switch_to_temporary()
weston_output_mode_switch_to_native()

Differences from previous behaviour:
SET_NATIVE didn't set current_scale (now it does)
SET_TEMPORARY could set mode and scale independently - now it can't.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 13:15:13 +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 e972b27f34 shell: don't crash on create_common_surface() failure
Noticed while reading code, that create_common_surface() may return
NULL, and callers of its direct callers check for NULL, but the
intermediate function in between would crash.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-10-01 14:58:46 +03:00
Derek Foreman 69c6273f28 shell: fix weston_output_mode_switch() usage
Calling weston_output_mode_switch() with WESTON_MODE_SWITCH_RESTORE_NATIVE
will result in the mode being set "back" to the passed in mode - so the
passed mode should be the native mode.

Additionally, weston_output_mode_switch() should be called when
output->original_mode is non-NULL (which indicates we had a temporary
mode set).  The comparison to current_mode results in a lot of
log chatter.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-22 14:38:13 +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