Commit Graph

1768 Commits

Author SHA1 Message Date
Kristian Høgsberg
546a812004 compositor-wayland: Add window border 2012-02-07 11:02:59 -05:00
Kristian Høgsberg
2e28b10a3f compositor-wayland: Add display sub-option for wayland backend
This lets us launch the compositor on a separate wayland socket that
what we're listening on.
2012-02-07 09:57:25 -05:00
Kristian Høgsberg
d11d944435 compositor-wayland: Hide cursor for compositor surfaces 2012-02-07 09:56:51 -05:00
Kristian Høgsberg
cdd61d0168 compositor-wayland: Destroy wl_callback in callback function 2012-02-07 09:56:15 -05:00
Kristian Høgsberg
eb764841a5 compositor: Drop setuid when launching clients 2012-02-07 09:52:40 -05:00
Pekka Paalanen
938269af21 compositor: simple menu transform
Transform a menu popup the same as its parent surface.

The parent's transformation is snapshotted at the popup map() time, and
does not follow further parent motion.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-07 14:19:01 +02:00
Pekka Paalanen
44ab69cfa3 compositor: add weston_surface transformation doc
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-07 13:18:00 +02:00
Pekka Paalanen
9f9aa1be50 compositor: fix transformed opaque surface repainting
Computing the real maximal opaque screen aligned rectangle of a
transformed surface is hard. Let's drop the opaque optimisation
instead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-06 16:26:57 +02:00
Pekka Paalanen
ddae03cf9b compositor: q&d solution for surface drift
When a transformed (rotated) surface is continuously resized from its
top-left corner, its location will drift. This is due to accumulating
rounding errors in transforming an offset from surface-local to global
coordinates in surface_attach().

Diminish the drift down to unobservable level by changing the
weston_surface global position from integer to float.

The offset transformation is now done without rounding. To preserve the
precision, wl_shell::configure() interface must use floats, and so does
weston_surface_configure(), too.

The con of this patch is that it adds inconsistency to the surface
position coordinates: sometimes they are floats, sometimes integers.
2012-02-06 14:54:20 +02:00
Pekka Paalanen
c7b45f68e6 compositor: clear surface damage on draw
Commit a0d6dc4f26 lost one line of code in
the refactoring, and so did not reset the surface damage on repaint
anymore. This causes damage to only accumulate, leading to a full
display redraw every cycle and hiding damage tracking issues.

Put the damage clear back.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-06 12:20:02 +02:00
Pekka Paalanen
f55f544e4f compositor: fix and simplify shader uniform handling
The uniform location variables should be signed, according to the OpenGL
ES 2 specification. Moreover, GL_NONE, i.e. 0, is not an invalid nor
special location; it is actually used as a valid uniform location.

Change struct weston_shader uniform members to signed.

Stop using 0 for identifying a non-existing uniform, use -1 instead.
Furthermore, as the spec says a) glGetUniformLocation() will return -1
for non-active/existing uniforms, and b) glUniform*() function will
simply ignore all calls with location -1, we can simplify the code. We
don't have to avoid locating uniforms that don't exist, and we don't
need to test for them in weston_surface_draw() either.

Remove the micro-optimisation that avoids setting 'alpha' uniform if it
has not changed, in the name of simplification.

Unify shader creation by dropping init_solid_shader(), and calling
weston_shader_init() instead. The downside is that we compile the vertex
shader twice at startup now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-02 16:49:05 +02:00
Kristian Høgsberg
0452abc820 compositor: Don't just update uniforms when we change shaders
The uniforms change from surface to surface or output to output, so always
set them.
2012-01-31 15:38:43 -05:00
Pekka Paalanen
a4f80f34e2 compositor: handle attach request in surface-local coordinates
The x, y offsets in attach request are in surface-local coordinates, as
that is the only coordinate system the clients know about. The offset
must be transformed to global coordinate system to be applied properly.

This approximately fixes the top-left resizing of transformed surfaces.
However, it suffers from drift due to accumulating rounding errors in
continuous resizing.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 13:12:11 +02:00
Pekka Paalanen
5c97ae7b82 shell: fix resize for transformed surfaces
This fixes the resize pointer motion vs. surface size mismatch for
right/bottom direction resizes. Top/left resizes need further fixes in
surface motion.

Additionally there is some clean-up in weston_surface_resize() to
eliminate a failure path, and fixing the Weston resize binding's resize
direction heuristic to follow transformations.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 13:12:11 +02:00
Pekka Paalanen
7b3bd3d8b6 shell: fix move of transformed surfaces
In the stack of transformations, change the rotation to be applied
to the surface before the absolute positioning. Doing so avoids having
to undo and redo the absolute positioning, and we can simply use the
surface center in local coordinates as the origin.

This fixes the surface move. Before, the surface moved along the surface
local axis, but the user expects it to move along the global axis with
the pointer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 13:12:11 +02:00
Kristian Høgsberg
d1e8625df2 compositor: Allow attaching null buffer
Attaching a null buffer is allowed and takes the surface back to the
unattached state it starts in.
2012-01-30 09:10:17 -05:00
Kristian Høgsberg
765e27b9e2 shell: Rotate relative to current rotation
This avoids the surface jumping around when you start rotating it.
2012-01-27 13:36:13 -05:00
Kristian Høgsberg
18c93009c1 compositor: Only set surface geometry through weston_surface_configure()
There are too many things to keep track of now, so let's require going
through this.
2012-01-27 11:58:31 -05:00
Kristian Høgsberg
0c356e1510 compositor: Link to libm 2012-01-27 11:57:28 -05:00
Pekka Paalanen
d581a8fcc8 Collabora copyright updates
which I forgot to add while working on these files.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:26:17 +02:00
Pekka Paalanen
15d60efee9 compositor: make overlap computation use the boundingbox
This makes the overlap to account for surface transformations.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
2267d45f7c compositor: use bounding box for damage regions
Change weston_surface_damage*() functions to use the full surface
bounding box or call surface_compute_bbox() to find the bounding box for
an arbitrary rectangle.

This should fix all rendering artifacts for non-opaque (i.e. ARGB)
transformed surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
45f3e405c6 compositor: weston_surface_assign_output() to use bounding box
Use the bounding box to compute an approximation of which output
contains most of the surface.

Move the region32 init outside the loop, and fini it, too.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
3bfcd4d907 compositor: weston_output_set_cursor() to use bounding box
If we ever have transformed cursor surfaces, we would better use the
bounding box to check if it is on the given output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
a9f8a21c75 compositor: weston_surface_draw() to use bounding box
Use the proper bounding box in clipping the surface repaint area. Fixes
excessive clipping for transformed surfaces.

Also don't leak the region32 on early return.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
60921e5787 compositor: move weston_surface::width,height into geometry
weston_surface::transform.boundingbox depends on width and height, and
therefore geometry.dirty flag, so move width and height into geometry.

Fix all users and check that the dirty flag is set.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
6720d8f3bd compositor: add weston_surface bounding box
Compute a surface bounding box, especially for transformed surfaces, for
which one cannot simply use x,y,width,height.

The bounding box depends on width and height, so these are now under the
geometry.dirty flag.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
7377204315 compositor: fix zoom origin
Now that we can insert a transformation before the surface position
translation, we can drop geometry.x,y from the zoom transformation. That
was just undoing and redoing the position translation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
f1f5b36aeb compositor-drm: do not scan out transformed surfaces
Not sure this check belongs here, but as the position checks are here
too, I added this. Just so we don't forget.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
ba3cf95c0e compositor: move weston_surface::x,y into geometry
weston_surface::transform.position depends on x,y, and therefore the
dirty flag, so move x and y into geometry.

Also add the missing dirty flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
cd40362bba compositor: make position a surface transformation
Put the surface translation (absolute position) into the surface
transformations list. This allows to set additional transformations
before and after the global translation.

Having the translation cached, changing the surface x,y now requires to
set the geometry.dirty flag.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
0e151bb487 compositor: honour repaint regions with transformed surfaces
Previously, if a surface was transformed, it repainted as a whole,
regardless of the computed repaint region. As damage regions determine
repaint regions and whether a surface is considered for drawing at all,
this lead to disappearing surfaces if all surfaces were considered
transformed. Also transparent transformed surfaces were redrawn without
the surfaces below being properly redrawn, leading to alpha-saturation.

Fix that by making texture_region() use the proper global-to-surface
coordinate transformation for texture coordinates. This makes it
possible to call texture_region() also for transformed surfaces.

As texture coordinates may now lie outside the valid texture image, the
fragment shader is modified to check the fragment texture coordinates.

The special path texture_transformed_surface() is no longer used and is
removed.

This change fixes many of the rendering artifacts related to transformed
surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
3df327f4c9 compositor: disable attrib arrays after use
Not strictly necessary right now, but nice to clean up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
74abeac2f6 compositor: remove unused *_uniform members
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
e0f3cb25e8 compositor: rewrite draw and input coordinate transformations
For unifying the coordinate system handling, introduce functions for
converting explicitly between the global and the surface local
coordinate systems.

Use these functions in the input path, replacing
weston_surface_transform().

In the draw path, rewrite transform_vertex() to take in surface local
coordinates.

As shell now uses the new functions, the rotation origin is properly
placed in the middle of the surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
bc0b7e7756 compositor: restructure weston_surface::transform
Separate mutable data and cached immutable data in struct
weston_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
7ae02130bd compositor: handle non-invertible surface transformations
Detect a non-invertible surface total transformation, disable it, and
warn about it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
460099f143 shell: add key binding for rotating a surface
Add the key binding Super+Alt+MouseLeftButton to start rotating a
surface by dragging. The rotation is removed, when the drag is near the
rotation origin.

Rotated surface are a stress test for input event coordinate
transformations, damage region tracking, draw transformations, and
window move and resize orientation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen
2a5ceccd57 compositor: apply full transformation to input coordinates
When converting input coordinates from global to surface-local system,
apply the full inverse surface transformation instead of just
translation.

Move weston_surface_update_transform() implementation realier in the
file, no changes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:55:27 +02:00
Pekka Paalanen
d1f0ab6343 compositor: simplify the matrix inversion API
The compositor will likely do an order of magnitude less matrix
inversions than point transformations with an inverse, hence we do not
really need the optimised path for single-shot invert-and-transform.

Expose only the computing of the explicit inverse matrix in the API.

However, the matrix inversion tests need access to the internal
functions. Designate a unit test build by #defining UNIT_TEST, and
export the internal functions in that case.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
1ef94c8742 update git ignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
4520d5cafb tests: add matrix-test
Add a new directory tests/ for unit test applications. This directory
will be built only if --enable-tests is given to ./configure.

Add matrix-test application. It excercises especially the
weston_matrix_invert() and weston_matrix_inverse_transform() functions.
It has one test for correctness and precision, and other tests for
measuring the speed of various matrix operations.

For the record, the correctness test prints:

a random matrix:
   1.112418e-02   2.628150e+00   8.205844e+02  -1.147526e-04
   4.943677e-04  -1.117819e-04  -9.158849e-06   3.678122e-02
   7.915063e-03  -3.093254e-04  -4.376583e+02   3.424706e-02
  -2.504038e+02   2.481788e+03  -7.545445e+01   1.752909e-03

The matrix multiplied by its inverse, error:
   0.000000e+00  -0.000000e+00  -0.000000e+00  -0.000000e+00
   0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
  -0.000000e+00  -0.000000e+00   0.000000e+00  -0.000000e+00
   0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
max abs error: 0, original determinant 11595.2

Running a test loop for 10 seconds...
test fail, det: -0.00464805, error sup: inf
test fail, det: -0.0424053, error sup: 1.30787e-06
test fail, det: 5.15191, error sup: 1.15956e-06
tests: 6791767 ok, 1 not invertible but ok, 3 failed.
Total: 6791771 iterations.

These results are expected with the current precision thresholds in
src/matrix.c and tests/matrix-test.c. The random number generator is
seeded with a constant, so the random numbers should be the same on
every run. Machine speed and scheduling affect how many iterations are
run.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
75b47ec45d compositor: implement inverse matrix transformation
Implement 4x4 matrix inversion based on LU-decomposition with partial
pivoting.

Instead of simply computing the inverse matrix explicitly, introduce the
type struct weston_inverse_matrix for storing the LU-decomposition and
the permutation from pivoting. Using doubles, this struct has greater
precision than struct weston_matrix.

If you need only few (less than 5, presumably) multiplications with the
inverse matrix, is it cheaper to use weston_inverse_matrix, and not
compute the inverse matrix explicitly into a weston_matrix.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
061b7471f1 compositor: drop inverse matrix from weston_transform
Remove the inverse matrix member from struct weston_transform. It is
easier (and probably faster, too) to create and store only forward
transformation matrices in a list, multiply them once, and then invert
the final matrix, rather than creating both forward and inverse
matrices, and multiplying both.

Add a stub for the 4x4 matrix inversion function.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
668ca37b19 compositor: move matrix code to separate files
Move matrix code to separate files to allow writing unit tests for it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
daaf01b3e1 util: document matrices
Add comments explaining the matrix storage and multiplication, so that
no-one else needs to decipher them again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen
c61eca6002 compositor: implement a stack of surface transformations
Having at most one transformation object attached to a surface is not
enough anymore. If we have a surface that needs to be scaled to
fullscreen, and then we have the zoom animation, we already need two
transformations combined.

Implement support for multiple transformations by adding a transformation
list. The final transformation is the ordered composite of those in the
list. To avoid traversing the list every single time, add a dirty flag,
and cache the final transformation.

The existing transformation users (only zoom) are converted.

Note: surface drawing should honour all kinds of transformations, but
not damage region code nor input event translating code take
transformations into account, AFAICT. Therefore anything but translation
will probably behave badly until they are fixed.

Cc: Juan Zhao <juan.j.zhao@linux.intel.com>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:43:49 +02:00
Kristian Høgsberg
681f9f4149 compositor: Keep fade surface around while we're fading
This removes more special cases from weston_output_repaint() and we
avoid creating and destroying the surface for each animation frame.
We gain another special case in weston_compositor_top(), but that's
less of a problem, and we'll fix that later.
2012-01-26 10:59:33 -05:00
Kristian Høgsberg
607c1a769d compositor: Use weston_surface_create for creating solid color fade surface 2012-01-26 10:47:11 -05:00
Kristian Høgsberg
bbeefb0189 compositor: Create surfaces neutral, select shader later
We only setup the shader and create the texture once we attach a buffer
or set a color.
2012-01-26 10:00:23 -05:00
Kristian Høgsberg
46e64ee3e1 compositor: Drop unused saved_texture surface field 2012-01-26 09:28:42 -05:00
Kristian Høgsberg
2200d70e56 compositor: Clear repaint_scheduled when an idle repaint is cancelled
We don't hit this case often, but if we did, the compositor would get stuck
thinking a repaint was already scheduled.
2012-01-26 08:47:04 -05:00
Kristian Høgsberg
30c018be3a compositor: Combine repaint and weston_output_repaint
Fewer repaint functions is better.
2012-01-26 08:40:37 -05:00
Kristian Høgsberg
a82c4860a1 compositor: Compute overlapped early and base hw cursor decision on that 2012-01-26 01:03:58 -05:00
Kristian Høgsberg
9f404b7ac8 compositor: Move tracking of scanout buffers to compositor-drm 2012-01-26 00:11:01 -05:00
Kristian Høgsberg
5f5e42ef50 compositor: Remove prepare_scanout_surface callout
For the drm backend, we just refactor setup_scanout_surface into
drm_output_prepare_scanout_surface and call it from drm_output_repaint.
2012-01-25 23:59:44 -05:00
Kristian Høgsberg
06cf6b0238 compositor: Pull prepare_render and present callouts into repaint
This dramatically simplifies the backend repaint abstractions and paves
the way for moving overlay and cursor setup into the backend.
2012-01-25 23:47:45 -05:00
Kristian Høgsberg
68c479af05 compositor: Move repaint loop into a backend function
We've trimmed down the actual repaint loop to just iterating through the
surface list and calling weston_surface_draw(), so we push that to the
backend without too much code duplication.
2012-01-25 23:32:28 -05:00
Kristian Høgsberg
32cdc384f4 compositor: Insert the fade surface in the surface list
This lets us repaint it in the repaint loop instead of the fade_output()
special case.
2012-01-25 23:16:38 -05:00
Kristian Høgsberg
0763262e3d compositor: Move shader setup to weston_surface_draw() 2012-01-25 23:02:06 -05:00
Kristian Høgsberg
765bcdf1fa compositor: Compute whether or not a surface is overlapped 2012-01-25 22:20:30 -05:00
Kristian Høgsberg
ee324c20ed compositor: Remove special casing of fullscreen surfaces
This was supposed to draw black borders around a fullscreen surface that
was smaller than the output.  We don't want to special case that in the
repaint loop, but may use a different shader or such.  And we want the
surface to have an opaque region that covers the output so that that
will eliminate overdraw of lower surfaces.
2012-01-25 22:09:10 -05:00
Kristian Høgsberg
a0d6dc4f26 compositor: Do the per surface clip region math in weston_surface_draw() 2012-01-25 22:02:00 -05:00
Kristian Høgsberg
ac58741940 compositor: Assign surface damage before setting up scanout buffers 2012-01-25 21:48:26 -05:00
Kristian Høgsberg
6af8eb9c7f desktop-shell: Build in sensible defaults
This adds a default background pattern and a terminal launcher in case
we don't have a config file.
2012-01-25 20:53:08 -05:00
Kristian Høgsberg
bcecca49b8 Revert "weston: Drop priviledges early, and seteuid when needed"
This reverts commit fc6ccb868f.

We still need root permissions for drmDrop/SetMaster.  Without
integration with ConsoleKit or systemd we also don't have access
to /dev/dri/cardX in the case where we open a new VT.
2012-01-24 12:41:19 -05:00
Benjamin Franzke
fc6ccb868f weston: Drop priviledges early, and seteuid when needed 2012-01-24 11:26:41 -05:00
Benjamin Franzke
ef548fd3ca setuid: Operate relative to $(DESTDIR) 2012-01-24 11:25:16 -05:00
Tiago Vignatti
a12d6113ce evdev: fix uninitialised pointer value
==30224== Conditional jump or move depends on uninitialised value(s)
==30224==    at 0x40EE3A0: evdev_flush_motion (evdev.c:284)
==30224==    by 0x40EE6DC: evdev_input_device_data (evdev.c:352)
==30224==    by 0x4034710: wl_event_source_fd_dispatch (event-loop.c:76)
==30224==    by 0x4035171: wl_event_loop_dispatch (event-loop.c:462)
==30224==    by 0x4032F76: wl_display_run (wayland-server.c:785)
==30224==    by 0x8050972: main (compositor.c:2183)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-01-20 13:35:27 -05:00
Kristian Høgsberg
44d4de656b configure: Add --enable-setuid-install
This adds support for installing the compositor setuid.
2012-01-19 13:32:17 -05:00
Pekka Paalanen
8423a89d41 compositor: initialise segv_action.sa_mask
Valgrind complained sa_mask member is not initialised, fix that.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 10:19:02 -05:00
Pekka Paalanen
cb108439d2 shell: deal with weston_compositor_pick_surface() = NULL
I could crash Weston by trying to open another menu from a panel while
one menu from it was already showing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
440		if (surface->resource.client == client) {
(gdb) bt
 0  0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
 1  0x0000000000406977 in weston_device_repick (device=0x70b4e0, time=4130706528) at compositor.c:360
 2  0x0000000000406a36 in weston_compositor_repick (compositor=0x619960) at compositor.c:382
 3  0x0000000000406ac8 in destroy_surface (resource=0x6fc6f0) at compositor.c:397
 4  0x00007ffff7bd33d8 in destroy_resource (element=0x6fc6f0, data=0x7fffffffd9fc) at wayland-server.c:355
 5  0x00007ffff7bd8d98 in for_each_helper (entries=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:264
 6  0x00007ffff7bd8dd4 in wl_map_for_each (map=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:270
 7  0x00007ffff7bd34dc in wl_client_destroy (client=0x7577d0) at wayland-server.c:385
 8  0x00007ffff7bd2e36 in wl_client_connection_data (fd=17, mask=1, data=0x7577d0) at wayland-server.c:187
 9  0x00007ffff7bd5bde in wl_event_source_fd_dispatch (source=0x74cda0, ep=0x7fffffffdae0) at event-loop.c:76
 10 0x00007ffff7bd665b in wl_event_loop_dispatch (loop=0x618900, timeout=-1) at event-loop.c:462
 11 0x00007ffff7bd42a9 in wl_display_run (display=0x6188b0) at wayland-server.c:785
 12 0x000000000040b1e1 in main (argc=1, argv=0x7fffffffdef8) at compositor.c:2182

Modify popup_grab_focus() to deal with a NULL surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 10:18:49 -05:00
Kristian Høgsberg
90b53815ba compositor: Flush surface damage to surface below on destroy
When we destroy a surface, we damage the surface below so that the area
exposed by the disappearing surface will be repainted.  However, if that
surface also is destroyed, the damage information is lost and we fail to
repaint that area.

This commit introduces weston_surface_flush_damage(), which flushes the
surface damage the the surface below when a surface is destroyed.  When
multiple surfaces are destroyed at the same time, the damage now accumulates
and sinks down through the surface stack as it should.
2012-01-18 21:41:37 -05:00
Kristian Høgsberg
6916d9cb6f drm: Don't print warning if cursor stride isn't right
gbm_bo_create_from_egl_image() should catch this based on the
GBM_BO_USE_CURSOR_64X64 flag.  It currently doesn't so we end up with
a cursor buffer with invalid stride.
2012-01-18 15:21:28 -05:00
Kristian Høgsberg
08fcbf0f3d tty: Use SIGUSR1 for both enter and leave signals
Now that we track has_vt, we can use the same handler for both enter and leave.
2012-01-18 12:42:16 -05:00
Kristian Høgsberg
62d2774956 tty: Switch back to launch tty if we switched away 2012-01-18 12:38:33 -05:00
Kristian Høgsberg
34f80ff813 drm: Cancel any scheduled repaints in the leave vt handler
If we don't cancel the repaint, we end up pointlessly redrawing the output.
What's worse is that pageflipping to the new buffer eventually fails and
we miss the finish_frame callback, leaving the compositor stuck when we
re-enter the vt.
2012-01-18 11:50:31 -05:00
Kristian Høgsberg
835cd49772 drm: Reset kms mode on vt enter
Normally the repaint will trigger a pageflip, which flips back to our
fb, but that doesn't work if the kms output has been turned off or
set to a different mode.
2012-01-18 11:48:46 -05:00
Kristian Høgsberg
54f14c3c3e drm: Complain if pageflip fails
We still don't handle the error in any way, but there's not much we can do.
It's typically a case of not having drm master."
2012-01-18 11:47:41 -05:00
Kristian Høgsberg
f03a616c21 shell: Set desktop-shell deathstamp at initial launch
Timestamp 0 is a valid timestamp and we can't use that as an uninitialized
timestamp.
2012-01-17 11:07:42 -05:00
Pekka Paalanen
4d733ee246 shell: respawn desktop-shell if it dies
If the desktop-shell client goes away for any reason, respawn it. To
avoid harmful looping, limit the respawning to 5 times within 30
seconds, and then give up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-17 10:58:52 -05:00
Kristian Høgsberg
39d908e63a tty: Open a new vt if not running on a VT
This is typically when launcing from a pty such as an X (or Wayland)
terminal or from an ssh session.  Opening a new vt typically requires root
priviledges, so weston must be setuid root or laucnhed as root for this
to work.
2012-01-16 22:44:34 -05:00
Kristian Høgsberg
0690da60d4 compositor: Install a SEGV handler to try and clean up the VT if we crash 2012-01-16 11:54:30 -05:00
Kristian Høgsberg
353e57f908 tty: Fix order of VT ack/release ioctls and the vt handler
We can only set up once we've acquired the VT and we shouldn't release the
VT until we've cleaned up.  Before we would release the VT first, and then
race to drop drm master as X tried to get drm master.  Which would kill X.
2012-01-16 10:57:14 -05:00
Kristian Høgsberg
23a47a80e2 evdev: Drop noisy debug messages on vt swtich 2012-01-16 10:54:07 -05:00
Kristian Høgsberg
a018fb0dbf compositor-drm: Exit if we failed to get drm master
We can do anything without drm master.  Also log an error in case we
fail to drop it, which will be trouble for whoever we're switching to.
2012-01-16 10:53:01 -05:00
Kristian Høgsberg
5743010af0 xserver: Create WM window, handle client messages 2012-01-15 22:16:11 -05:00
Olivier Le Thanh Duong
643eac56e7 evdev: Correct warning on missing input device 2012-01-15 16:20:49 -05:00
Kristian Høgsberg
de13448c92 xserver: Just dup fd instead of two fcntls to get a non-O_CLOEXEC fd
Yeah, it's the same number of lines of code, but this actually checks
the error return.
2012-01-15 16:05:43 -05:00
Kristian Høgsberg
1760ebb236 xserver: Set DISPLAY for clients launched by the compositor 2012-01-15 16:04:33 -05:00
Kristian Høgsberg
ea093d4883 xserver: Don't set -logfile option, only available to root user 2012-01-15 15:51:12 -05:00
Kristian Høgsberg
92734c5673 tty: Leave tty in KD_GRAPHICS mode during vt switches
Part of the point of KD_GRAPHICS mode is that the kernel doesn't try
to restore the VT contents when we switch bach, but leaves that
to the user mode process.  This avoids ugly flicker of text mode contents
before the compositor takes over.
2012-01-15 15:25:06 -05:00
Kristian Høgsberg
c5b9ddb610 compositor-drm: Fail, and fail early if we can't set up the tty
Typically a permissions problem.  Weston should be setuid root or
be launched by a setuid helper.
2012-01-15 15:25:05 -05:00
Kristian Høgsberg
00513ab7cc tty: Close tty fd on exit 2012-01-15 15:25:05 -05:00
Kristian Høgsberg
1201b75bec tty: If no tty option is given, use stdin and make sure it's a vt 2012-01-15 15:25:01 -05:00
Kristian Høgsberg
8e81df4503 Use new format codes 2012-01-11 14:24:46 -05:00
Kristian Høgsberg
249713bbe0 Remove redundant glTexImage2D() call
When we later upload the cursor image with glTexImage2D(), that will unbind
the image just fine.  No need for a NULL upload.  Except that that doesn't
currently happen with mesa drivers, but the NULL upload is redundant either
way.
2012-01-06 15:24:59 -05:00
Kristian Høgsberg
c5e2376d3f compositor: Damage below before attaching new buffer 2012-01-06 14:37:19 -05:00
Kristian Høgsberg
b3cca0a411 shell: Start implementing the popup surface type
This lands the basic behavior of the popup surface type, but there are still
a number of details to be worked out.  Mainly there's a hardcoded timeout
to handle the case of releasing the popup button outside any of the
client windows, which triggers popup_end if it happens after the timeout.
Maybe we just need to add that as an argument, or we could add a new event
that fires in this case to let the client decide whether it ends the popup
or not.
2012-01-06 11:41:55 -05:00
Kristian Høgsberg
dade64968c Move wl_data_device implementation to wayland-server 2012-01-06 11:28:53 -05:00
Kristian Høgsberg
faf1fee64f Move default grab implementation to wayland-server 2012-01-05 11:00:01 -05:00
Kristian Høgsberg
9ddb826077 Use new grab api 2012-01-05 11:00:01 -05:00
Rob Bradford
0b17b8ec01 compositor: Don't try and destroy old pointer surface if it empty
If attach was called on wl_input_device with a nil buffer twice then the
second call would cause a segfault.
2012-01-05 10:59:44 -05:00
Pekka Paalanen
b07876d23a evdev: warn about missing input devices
Usually there should be at least one input device, when Weston starts
up, or is reactivated by a VT switch. Add a nice warning, in case there
are no input devices.

This is to give a clue to users who happen to try Weston on DRM, and
do not get any response.

Add also a message to another failure case, that may lead to missing
input devices.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-05 16:50:00 +02:00
Pekka Paalanen
c0444e3ad6 compositor: force fade-in on start
Weston initialises to faded-out state, which means all outputs are just
black, even if they render fine.

Previously the fade-in was triggered probably by some random input
event, since Weston was not guaranteed to wake up. Especially with the
drm backend, and the usual problem of not having permissions to input
devices, Weston would not fade in at all and appear broken.

Force Weston to fade in right after initialisation. This show that at
least rendering works, if it does not respond to any input.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-05 16:49:54 +02:00
Pekka Paalanen
61b5c67268 shell: free memory on move/resize error paths
Memory leaks noticed by Valgrind, when wl_input_device_update_grab()
fails.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-05 09:10:49 +02:00
Kristian Høgsberg
8600040236 compositor-x11: Just a few more weston renames 2012-01-03 23:24:14 -05:00
Kristian Høgsberg
e7126ef537 x11: Dont claim the X11 selection when we set the proxy Wayland selection 2012-01-03 23:01:47 -05:00
Kristian Høgsberg
a33d0c38d2 data-device: Use a listener list to decouple the x11 selection bridge 2012-01-03 23:01:47 -05:00
Kristian Høgsberg
f9b0844e59 x11: Initialize wm->incr when converting the TARGETS target 2012-01-03 23:01:47 -05:00
Kristian Høgsberg
300deba3be x11: Handle non-existing properties correctly
Don't try to read out ATOM or WINDOW values if there is no such property.
2012-01-03 23:01:40 -05:00
Kristian Høgsberg
db9bf1e818 data-device: Fix a few bugs in the commit to drop ref-counting
Did not test that change.
2012-01-03 22:43:36 -05:00
Kristian Høgsberg
9724b51750 More weston rename fixes 2012-01-03 14:35:49 -05:00
Kristian Høgsberg
82d9ee929b data-device: Handle source going away instead of ref-counting it
We have to deal with the data source going away.  Even if we have a
reference to the server side data source, we can't do anything if the
client that provided the source went away.  So just NULL the offers
source pointer in the destroy callback for the source.
2012-01-03 14:11:18 -05:00
Kristian Høgsberg
cb78447a0e Fix a few missing wlsc->weston renames 2012-01-03 11:40:25 -05:00
Kristian Høgsberg
3466bc8042 Merge remote-tracking branch 'pq/compositor-dtors-v1'
This collided with the big weston rename, but git did a good job of fixing
most cases.

Conflicts:
	compositor/compositor.h
	src/compositor-x11.c
	src/compositor.c
	src/screenshooter.c
	src/util.c
2012-01-03 11:36:37 -05:00
Kristian Høgsberg
f6a5f7def3 Fix distcheck 2012-01-03 11:04:09 -05:00
Kristian Høgsberg
8334bc1ef9 Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.

1) Initially, we had one big repository with protocol code, sample
compositor and sample clients.  We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code.  At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message.  The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.

2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor.  Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example.  Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.

We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 11:04:04 -05:00