Commit Graph

2556 Commits

Author SHA1 Message Date
Ander Conselvan de Oliveira ddd3e27ab8 window: Honour opaque field for windows without a frame
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.
2012-11-30 14:24:00 -05:00
Ander Conselvan de Oliveira e920941032 compositor-drm: Allow scanning out of opaque ARGB surfaces 2012-11-30 14:24:00 -05:00
Pekka Paalanen 4fbb65372e Fix build warnings from image_loader
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>
2012-11-30 14:24:00 -05:00
Ander Conselvan de Oliveira 0396ba204d compositor: Fix rendering with shm transformed buffers
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.
2012-11-30 14:15:23 -05:00
Dima Ryazanov a85292e73c Fix a crash when opening two terminal windows and closing the first one.
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.
2012-11-30 14:11:41 -05:00
Kristian Høgsberg cd1d6c8f19 compositor-x11: Link to libshared-cairo for icon loading helper
The X11 backend needs the image loader helper to load the window
icon.
2012-11-29 17:00:49 -05:00
Kristian Høgsberg 6006ecb497 configure.ac: Don't link weston to cairo or image libraries
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.
2012-11-29 13:32:11 -05:00
Scott Moreau 0ea7333392 weston.ini: Introduce core section and remove type keys.
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.
2012-11-27 20:28:08 -05:00
Scott Moreau 76d8fc8216 xwm: Fix xwm opaque region
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.
2012-11-27 17:23:42 -05:00
Pekka Paalanen a4eda73607 window: honour wl_buffer.release
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>
2012-11-27 15:57:54 -05:00
Pekka Paalanen 3cbb08944b window: fix tooltip text extents
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>
2012-11-27 15:50:53 -05:00
Pekka Paalanen b362736bb2 window: simplify window_create_surface
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:50:26 -05:00
Pekka Paalanen 9943686be3 window: convert shm path to toysurface
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>
2012-11-27 15:49:37 -05:00
Pekka Paalanen 03fc316000 window: add toysurface abstraction and port EGL path
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>
2012-11-27 15:49:34 -05:00
Kristian Høgsberg b88b68fa42 weston-simple-im: Add a few more compose sequences 2012-11-27 15:11:04 -05:00
Kristian Høgsberg 504e8f109a weston-simple-im: Fold struct keyboard_input into struct simple_im 2012-11-27 14:28:19 -05:00
Kristian Høgsberg aec12b806c weston-simple-im: Fold keyboard_input_handle_keymap() into event handler 2012-11-27 14:21:34 -05:00
Kristian Høgsberg 6aae61483b weston-simple-im: Fold keyboard_input_handle_key() into event handler 2012-11-27 14:20:31 -05:00
Kristian Høgsberg 3a3704db20 weston-simple-im: Fold keyboard_input_handle_modifiers into event handler 2012-11-27 14:18:54 -05:00
Kristian Høgsberg de318ab25f weston-simple-im: Stop using toytoolkit
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.
2012-11-27 14:18:54 -05:00
Kristian Høgsberg 79bfde20bd weston-simple-im: Use serial number from incoming events
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.
2012-11-27 13:57:27 -05:00
Kristian Høgsberg 8c03616c39 weston-simple-im: Create our own xkb_context
There's no need to use the struct display xkb_context, we can just create
out ow.  This reverts c31288daf1.
2012-11-27 13:48:09 -05:00
Kristian Høgsberg 1199b16f02 clients: Move keyboard-utils.[ch] into weston-simple-im
This is the only user of this code, so just include it in the simple im
source.
2012-11-27 13:42:04 -05:00
Kristian Høgsberg bd1e928f25 noop-renderer: Remove unused variable 2012-11-27 13:20:40 -05:00
Jan Arne Petersen e9fba2b737 text: Add simple compose input method
Add an input method listening to hardware keyboard input and generating
compose text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:19:39 -05:00
Rob Bradford 9d1d32bdd0 editor: Add support for editing text using the keyboard
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>
2012-11-27 13:19:38 -05:00
Jan Arne Petersen c31288daf1 window: Allow to get xkb context from display
Add display_get_xkb_context to get the xkb context from the display.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:19:38 -05:00
Jan Arne Petersen 257201d2cc window: Add utils for xkb keyboard input
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:14:08 -05:00
Jan Arne Petersen 337df952f8 text: Add support for forwarding key events
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>
2012-11-27 13:10:10 -05:00
Jan Arne Petersen 466b9c1047 text: Add support for grabbing the keyboard
Add support for requesting hardware input into an input method.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:09:07 -05:00
Jan Arne Petersen cd99706b61 text: Send more information with keysym events
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>
2012-11-27 13:06:21 -05:00
Jan Arne Petersen d9be93b964 text: Rename and extend text_model key event
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>
2012-11-27 13:02:26 -05:00
Jan Arne Petersen 674fd1d625 text: Start input method from configuration
Start the input method specified in the weston.ini configuration file.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 12:57:39 -05:00
Ander Conselvan de Oliveira 1b4312d326 clients: Add a client that renders transformed buffers
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.
2012-11-27 11:30:09 -05:00
Ander Conselvan de Oliveira 2908a3df0d compositor-drm: Support scan out of transformed buffers
If a client renders its buffers with the same transform as the output,
we can scan out them when fullscreen.
2012-11-27 11:30:04 -05:00
Ander Conselvan de Oliveira 012b4c78c9 compositor: Implement buffer transformation
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.
2012-11-27 11:29:31 -05:00
Pekka Paalanen 864c784b5c man: fill missing pieces to weston page
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>
2012-11-27 11:13:00 -05:00
Pekka Paalanen 424820f4bc man: add weston-drm page
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>
2012-11-27 11:12:56 -05:00
Pekka Paalanen 326529f900 gl, rpi: consolidate print_egl_error_state()
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>
2012-11-27 11:12:48 -05:00
Ander Conselvan de Oliveira 0a887728ea compositor: Move clearing of primary plane damage to the backends
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.
2012-11-23 21:33:51 -05:00
Ander Conselvan de Oliveira 7e918da36f compositor-drm: Add debug binding for toggling sprites
While at it, consolidate all the bindings we already have into one
single function.
2012-11-23 21:31:18 -05:00
Ander Conselvan de Oliveira 180f42a382 compositor-drm: Add a debug binding for toggling usage of hw cursors 2012-11-21 11:44:17 -05:00
Ander Conselvan de Oliveira 434e8f3ae1 zoom: Don't update the zoom translation if zoom level is 0
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.
2012-11-21 11:40:39 -05:00
Scott Moreau 6655e00e03 simple-egl: Reset opaque region if not fullscreen.
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.
2012-11-19 17:23:59 -05:00
Pekka Paalanen 768117f90b window: make display_create_surface() shm-only
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>
2012-11-19 16:00:01 -05:00
Pekka Paalanen 32127ca86d window: use different keys for different cairo privates
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>
2012-11-19 15:55:28 -05:00
Pekka Paalanen 0c6a34378a window: merge struct surface_data into shm_surface_data
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>
2012-11-19 15:55:26 -05:00
Pekka Paalanen f86504c881 window: remove unused MULT macro
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>
2012-11-19 15:55:24 -05:00
Pekka Paalanen a8d4c84693 window: make window_flush() private
Not called from any client.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:17 -05:00
Pekka Paalanen ce36f6dff4 window: make window_{create,set}_surface private
I do not think these are meant to be called by the applications
directly. Applications certainly do not have to call them.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:12 -05:00