Commit Graph

4165 Commits

Author SHA1 Message Date
Jonny Lamb
0695908a9f clients: use repeat_info event details
The weston-info client prints out the values, and the values are
respected in toytoolkit when actually repeating keys..
2014-08-15 15:39:47 +03:00
Jonny Lamb
497994a459 compositor-wayland: listen to repeat_info and save values to pass on 2014-08-15 15:39:47 +03:00
Jonny Lamb
66a41a06e7 compositor: fetch repeat info from weston.ini 2014-08-15 15:39:47 +03:00
Jonas Ådahl
05e4a1f768 libinput: Add tap configuration to weston.ini
Enable by adding the following to your weston.ini:

[libinput]
enable_tap=true

This also makes weston require libinput >= 0.5.0.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-08-15 15:33:55 +03:00
Jasper St. Pierre
886b0098c3 screenshooter: Add a missing return; in an error path 2014-08-08 14:59:48 -07:00
Jasper St. Pierre
666bc9234a desktop-shell: Add a missing return; in an error path 2014-08-08 14:59:48 -07:00
Jasper St. Pierre
c91408f3fb Don't bother destroying resources after sending an error
An error makes the client exit, which cleans up the resources anyway.

Note (Jason Ekstrand):
This is safe for two reasons.  First, we should be handling object
destruction nicely anyway.  Second, in each of these cases, the resources
don't have any implementation or destruction set so it has absolutely no
effect on the rest of weston whether we destroy it now or later.
2014-08-08 14:57:17 -07: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
Giulio Camuffo
d1ceecf112 fullscreen-shell: Fix compiler warnings 2014-08-08 18:07:34 +03:00
Jonny Lamb
e84ab4ef4d desktop-shell: don't assume there's a pointer when mapping a popup 2014-08-07 16:23:10 +03:00
Jasper St. Pierre
e2f0f84b08 compositor: Use libwayland to find a good default display for us 2014-08-05 13:06:12 -07:00
Jasper St. Pierre
a177df09bf window: Don't use the frame's geometry when fullscreen
When fullscreen, we don't actually update the frame's geometry, so we
can't query it for there.
2014-08-05 12:31:04 -07:00
Jasper St. Pierre
d8c6aeb8a5 input: Send key-repeat 2014-08-05 12:31:04 -07:00
Jonny Lamb
70ee3ad47c animation: also change stop value when updating a fade target
If we're fading a view with weston_fade_run() and half way through we
want to unfade it we can use weston_fade_update() to set a new alpha
target. When the animation finishes, reset_alpha() is called which
ensures the alpha value of the view is exactly as requested.

Although weston_fade_update() was updating the spring target so the
animation would look fine, it would then reset to the alpha target
given in the first call to weston_fade_run().
2014-07-30 10:54:23 -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
Alvaro Fernando García
dce7c6e5a2 Do not assume 64x64 cursor, added support for other sizes (like in AMD Kaveri, 128x128).
Init cursor size to 64x64 if drmGetCap() fails.

Use Mesa GBM_BO_USE_CURSOR define (which removes 64x64 restriction)

Signed-off-by: Alvaro Fernando García <alvarofernandogarcia@gmail.com>
2014-07-29 00:51:41 -07: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
Jason Ekstrand
0250a740c2 xwayland: Better handle a race with X
If X windows are created and destroyed very fast sometimes the WM window
object gets created and destroyed before we get around to handling client
messages.  Failing to check that the window is still valid can result in a
segfault.
2014-07-24 13:19:13 -07:00
Jason Ekstrand
4ff4d92d7e xwayland/window-manager: Rename a variable for clerity 2014-07-24 13:16:58 -07:00
Tyler Veness
cf4c13af98 xwayland: set surface_id to 0 when client resource is found
When Xwayland requests that a wl_surface be created and the X event is
handled before the wayland requests, a surface ID is stored to
window->surface_id and the window is added to the unpaired window list. When
weston_wm_create_surface is called, the window is removed from the list and
window->surface_id is set to zero. If window->surface_id is not zero when
weston_wm_window_destroy is called, the window is assumed to be in the
unpaired window list and wl_list_remove is called. If
weston_wm_window_handle_surface_id is called and the surface has already
been created, the window is not added to the unpaired window list, but
window->surface_id isn't set to zero. When the window is destroyed, removing
the window from the list is attempted anyway and a crash occurs.

This patch stores the surface ID in a temporary variable and only assigns it
to window->surface_id when the window is added to the unpaired window list.
Otherwise window->surface_id is set to zero to maintain its use as a flag
variable.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80273
Signed-off-by: Tyler Veness <calcmogul@gmail.com>
2014-07-24 13:13:55 -07: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
Marek Chalupa
cfff312204 tests: use expect_protocol_error in tests
Turn FAIL_TESTs to TESTs. FAIL_TESTs are bad...

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-22 19:16:49 +03:00
Marek Chalupa
1740aa8c85 tests: add frame_callback_wait_nofail
With expect_protocol_error, we need a possibility to wait for a frame
without aborting the test when wl_display_dispatch returns -1;
This patch adds function frame_callback_wait_nofail that only
returns 1 or 0 (instead of aborting on error).

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-22 19:15:28 +03:00
Marek Chalupa
4d06d46ace tests: add expect_protocol_error function
This function checks if a particular protocol error came in wire.
It's usefull in the cases where we hitherto used FAIL_TEST.
The problem with FAIL_TEST is that *any* assert will pass the test,
but we want only some asserts to pass the test (i. e. we don't
want the test to pass when it, for example, can't connect to display).
FAIL_TESTs are good only for sanity testing.

The expect_protocol_error allows us to turn all FAIL_TESTs to TESTs
as will be introduced in following patches.

v2: fixed white-space error and a mistake in comment

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-22 19:14:54 +03:00
Jasper St. Pierre
e7d7468521 xdg-shell: Fix documentation
request_change_state has been folded into the configure event.
2014-07-17 14:50:51 -07:00
Jasper St. Pierre
ccf48fb4f9 shell: Replace set_margin with set_window_geometry
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.
2014-07-17 13:59:01 -07:00
Jasper St. Pierre
bd65e50875 Interpret the size in the configure event as window geometry
The size of the configure event has always been specified as in window
geometry coordinates, but it was never implemented this way.
2014-07-17 13:58:45 -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
e9d40e3ff5 Move weston_subsurface to after weston_surface
It makes more sense there.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-07 09:11:54 -07:00
Boyan Ding
9c5aedfff2 cairo-util: Set geometry_dirty in frame_set_title
Title can decide the geometry of a frame because it may affect the
existence of titlebar, so setting geometry_dirty in frame_set_title for
potential change.

Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-07-05 01:05:07 -07:00
Boyan Ding
c4902124f9 cairo-util: Fix geometry for frames with buttons but without title
There exist frames which have buttons without title such as a simple
X application piped through xwayland which doesn't specify a title.
We draw the title bar with buttons, but hide it under the window
because geometry thinks a window needs titlebar only if it has title.

This patch change the condition, making it titlebar is needed if a
frame has title or has button(s), which makes more sense.

Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-07-05 01:05:06 -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
Boyan Ding
32abdbbad9 shell: fix segfault in fullscreen binding
Commit 9aa8ce69 forgot to set shsurf->fullscreen_output in
fullscreen_binding(), causing segfault when fullscreening using key
bindings. This patch fixes that.

https://bugs.freedesktop.org/show_bug.cgi?id=79828
Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-06-25 19:59:26 -07:00
Andrew Wedgbury
dfd9d0de96 screen-share: Allow fullscreen shell command to be configured
I've updated this based on comments, simplifying the command handling.

Currently the screen-share module uses a hard-coded command to start the
fullscreen shell server. This patch causes the module to read the command from
the weston config file (from the "command" key in the "screen-share" section).
The default value remains the same (i.e. to run weston with the RDP backend and
fullscreen shell), but is now located in the weston config file.

As well as allowing the arguments to the fullscreen shell server to be changed,
this also permits an alternative fullscreen shell server to be used if required,
without needing to recompile. Since the command is run as the user running
weston, this should not pose any additional security risk.

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
2014-06-25 09:05:39 -07:00
Jason Ekstrand
8202d72054 data-device: Clean up the logic in start_drag
Previoiusly, we had a mess of logic that was repeated with one of the
repeats negated.  Not only was this unnecisaraly confusing, but it
segfaulted and one of the negations was wrong.  This cleans the whole mess
up and should fix bug #79725.
2014-06-25 09:05:26 -07:00
Arnout Engelen
7da71eec40 Better error message when exec'ing Xwayland fails 2014-06-25 15:52:35 +03:00
Peter Hutterer
3b843d3a61 Require libinput 0.4.0
No functional changes, just adjusting for API changes in libinput:
- libinput_destroy() replaced by libinput_unref()
- log functions now take a libinput context, userdata is gone
- udev seat creation is now libinput_udev_create_context() and
  libinput_udev_assign_seat()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 08:46:35 +02:00
Jason Ekstrand
671a1442a7 Change the defacto output transform from flipped-270 to flipped-90
It turns out that flipped-270 is the second-simplest transformation besides
normal because it is a direct swapping of the x and y axes.  Having that as
the default encourages people to use flipped-270 as the default test for "I
want to try this with a transform".  Unfortunately, because flipped-270 is
so simple, it is really easy to have something that works for normal,
flipped-270, and nothing else.  This encourages people to test with a
transform thats actually "hard".
2014-06-24 11:10:28 -07:00
Jason Ekstrand
76f623605f Fix a comment 2014-06-24 11:10:02 -07:00
vivek
31732f7c68 Clients: Fix memleak issues in various clients of weston
In many clients of weston, Display was not being destroyed so added it.
Also destroy windows, widgets which were not being destroyed.

Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-06-24 10:22:43 -07:00
Boyan Ding
1478ea54ca xdg-shell: Fix a typo in description
Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-06-24 10:19:03 -07:00
Emilio Pozuelo Monfort
5872b6821b desktop-shell: Don't assume there is a pointer when resizing
Fixes a crash on touch devices without a pointer, when touching
the window frame of a client.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2014-06-23 13:41:30 -07:00
Srivardhan Hebbar
28ee518305 weston-build: Fix aclocal error during autogen.sh
This is a fix to the following bug:
https://bugs.freedesktop.org/show_bug.cgi?id=80214

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
2014-06-21 10:33:21 -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
Thierry Reding
6ac60c1791 compositor-wayland: Fix compiler warning
sizeof returns size_t, for which the correct printf specifier is %zu.
Fixes the following warning when building for ARMv7.

	src/compositor-wayland.c: In function 'wayland_output_get_shm_buffer':
	src/compositor-wayland.c:260:3: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'unsigned int' [-Wformat=]
	   weston_log("could not zalloc %ld memory for sb: %m\n", sizeof *sb);
	   ^

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-18 17:14:40 -07:00
Thierry Reding
0e6d9a771a build: Silence libtoolize warnings
When running the autogen.sh script, libtoolize complains thusly:

	libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
	libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
	libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

Silence the warnings by following libtoolize's advice.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-18 17:14:40 -07:00
Jonny Lamb
7e7d485164 desktop-shell: make background applications less dark 2014-06-18 17:14:40 -07:00