When a window's buffer transformation is set, its buffers are
reallocated with the appropriate size (i.e., with width and height
swapped in case of 90 or 270 degree rotation).
Since the opaque region was set in frame_resize_handler(), if a client
created a frameless window setting the toplevel widget as opaque would
have no effect.
This patch fixes this by moving the call wl_surface_set_opaque_region()
to idle_resize(), and changing the latter function to set the whole
window as opaque if its toplevel widget has the opaque flag set.
Fix the following build warnings, and the build failures due to the
warning fixes:
CC libshared_cairo_la-image-loader.lo
image-loader.c:369:1: warning: no previous prototype for 'load_image'
CC x11_backend_la-compositor-x11.lo
compositor-x11.c: In function 'x11_output_set_icon':
compositor-x11.c:396:2: warning: implicit declaration of function 'load_image'
compositor-x11.c:396:8: warning: assignment makes pointer from integer without a cast
CC wayland_backend_la-compositor-wayland.lo
compositor-wayland.c: In function 'create_border':
compositor-wayland.c:97:2: warning: implicit declaration of function 'load_image'
compositor-wayland.c:97:8: warning: assignment makes pointer from integer without a cast
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
The implementation of buffer transformation didn't handle transformed
shm buffers properly. The partial texture upload was broken since the
damage is in surface coordinates that don't necessarily match the
buffer's coordinates. It also wouldn't handle the buffer stride
properly, resulting in incorrect rendering if it didn't match the
buffer's width.
The logic used for converting texture coordinates was generalized and
moved out of the renderer, since this conversion may be useful in other
places, such as the backends.
To reproduce, launch the terminal, open a second window using Ctrl-Shift-N,
go back to the first window, and press Ctrl-D. The terminal's master FD gets
events even after being closed, causing terminal_destroy to be called twice
on the same object.
To fix this, I'm adding a function to stop watching an FD.
We were pulling in cairo and the image loading libraries through libshared.
Split out libshared into a core libshared and a libshared-cairo that
pulls in the extra libraries.
Since a6813d288, there is no longer a "type" key in the [shell] config section.
Instead the code accepts a [core] section with a modules key, containing a
comma separated list of modules to load. This patch removes the type keys
and adds a core section in the example weston.ini config file.
Since surface.commit was introduced, opqaue regions are stored in a pending
variable that isn't used until surface.commit. Xwayland uses the surface opaque
region as a way to tell weston what region of the surface should be opaque.
However when this pending opaque region was introduced, xwm was not updated
and so we have the 'black = transparent' problem again. This patch fixes the
problem by having xwm use the pending opaque regions.
Listen for wl_buffer.release events in the shm path, and if a previously
posted buffer is still held by the server, allocate another one. The
maximum of two should be enough, since there is no point for a server to
hold more than one buffer at a time.
Buffer allocation happens as needed instead of window creation time.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
After the toysurface rewrite, windows do not have a valid Cairo surface
outside their repaint cycle, so tooltips are not getting their size
right.
Create a dummy Cairo surface only for querying text extents, so we do
not rely on any window surfaces of parent windows or otherwise.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Implement shm_surface as a sub-class of toysurface, and unify the
toysurface call sites removing most buffer type specific branching.
Do not destroy and create a surface, if the size does not change.
The resizing optimization of shm surfaces is retained, but the pool is
moved from struct window to struct shm_surface, since it does not apply
to egl_window_surface.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
We need more structure to the way we handle the backing storage in
toytoolkit, to make it possible to double-buffer the shm case properly.
The existing buffer handling is very complex with the three
different cases:
- EGLSurface backed Cairo surface with a window associated
- wl_shm backed Cairo surface with a window associated
- wl_shm backed Cairo surface without a window, as used by dnd.c
Introduce the toysurface abstraction, which defines the interface for
the both buffer handling cases that have a window associated. It also
means, that windows will not have a valid Cairo surface outside of their
repaint cycle.
Convert the EGLsurface case into toysurface for starters. For EGL-based
Cairo surfaces, the private data is no longer needed. Destroying
egl_window_surface will trigger the destruction of the cairo_surface_t,
not vice versa. This is possible because display_create_surface() is
shm-only.
The shm cases are left untouched.
As a side-effect, display_acquire_window_surface() and
display_release_window_surface() will no longer use the 'display'
argument. Instead, display will be the one inherited from the window.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Toytoolkit doesn't buy us anything in this case, we're not rendering or
handling regular input events. Just talk directly to wl_display and
look up the 'input_method' global directly.
The key events we pass through to the input_method_context has to have
a serial number that corresponds to the key event we got. The struct display
serial is updated on pointer enter/leave and keyboard events, but not the
input method keyboard events. So the display serial will never correspond
to the key event we're dealing with and we have to pass through the
serial we get from the key event.
This simple change allows you to drive the editor using the keyboard
(supporting backspace and delete and left and right arrow keys.) The idea
behind this change is to allow the testing of the interoperation between a
virtual keyboard and real one.
Signed-off-by: Rob Bradford <rob@linux.intel.com>
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Allow an input method to forward (unfiltered) key and modifier events
from the hardware keyboard to the client.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Send state and modifier from the demo keyboard with the keysym event and
take them into account in the editor example.
Add some helper functions to write and read a modifiers_map array.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Rename the key event in text_model to keysym and add serial, time and
modifiers arguments. Add a modifiers_map event to transfer an array of
0-terminated modifier names, so that a mapping of modifiers to the
modifier bit mask is possible.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
This new client, called transformed, renders a cross with the top part
red and the right green, with the same transform as the output the
surface is in.
This is based on simple-egl.
Implement the wl_surface.set_buffer_transform request. This includes
tracking the double-buffered buffer transformation parameter and making
the gl renderer able to handle transformed buffers.
Config file, WAYLAND_SOCKET, XDG_CONFIG_HOME, segfault handler.
NOTE: This is a candidate for the stable branch
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add some documentation about the DRM backend into its own man page, and
refer to it in weston(1).
Environment variable, that are reserved for backends, and currently used
only by the DRM backend, are moved to weston-drm page.
NOTE: This is a candidate for the stable branch
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Rename print_egl_error_state() to gl_renderer_print_egl_error_state()
and exports it.
Remove the copy of that function from the rpi backend, and call
the exported function instead.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Backends may move surfaces to different planes, in which case damage is
generated in the primary plane. This damage is usually passed to the
renderer, but in some cases the backend may decide to not render
anything (that's the case when drm compositor scans out a client
buffer). In that case the damage on the primary plane would be
discarded, leading to artifacts later.
This patch makes the backend's responsibility to clear the damage on
the primary plane, so that unrendered damage is kept for as long as
necessary.
On the first frame with zoom activated, the spring used for animation
will have a current value of zero. The translation calculated with that
value will be invalid (not a number). Using this value later leads to
having an invalid output matrix, so nothing is composited in the first
zoomed frame.
This problem is most evident when a sprite plane is being used. In that
case, enabling the zoom will cause the surface to be moved back to the
primary plane, but because of the bug described above, this surface
would not actually be rendered causing a quick flicker.
If simple-egl is toggled fullscreen, the opqaue region is set for the surface
but never removed after exiting fullscreen. This patch resets the opaque region
to 0 if the surface is not fullscreen and -o was not passed. This fixes the
problem introduced sometime since d7f282b84e, when this was last fixed.
Nothing uses it to create EGL-surfaces outside of window.c. This makes
refactoring the EGL-based code easier, since we do not need to support
EGL-based Cairo surfaces without an associated struct window.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
cairo_surface_t objects have a private set, either struct
shm_surface_data, or struct egl_window_surface_data. Use separate
private keys for each type to avoid mismatch.
This makes display_get_buffer_for_surface() safe, in that it won't
return garbage for an EGL-based cairo surface.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Struct surface_data was not really useful, and it definitely was not
used with EGL-based windows.
This also fixes a semantic mistake, where struct shm_surface_data was
put into cairo_surface_t private, but got out as struct surface_data
instead. Due to struct layout, however, this did not cause a real bug.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Leftovers from
commit f02a649a3c
Author: Kristian Høgsberg <krh@bitplanet.net>
Date: Mon Mar 12 01:05:25 2012 -0400
Consolidate image loading code and move to shared/
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>