Commit Graph

542 Commits

Author SHA1 Message Date
Daniel Stone
103db7fb56 Convert wire input co-ordinates to fixed-point
To add greater precision when working with transformed surfaces and/or
high-resolution input devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:41:01 -04:00
Daniel Stone
b230a7ee58 Convert internal input co-ordinates to GLfloat
Change all client motion handlers to take GLfloat for co-ordinates,
rather than int32_t.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:40:57 -04:00
Daniel Stone
bd3489b6e1 Add fixed-point versions of weston_surface_{to, from}_global
To be used by input code, paralleling the existing integer versions.

Enlarge the surface_{to,from}_global_float input types to GLfloat to
avoid losing precision.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:40:51 -04:00
Tiago Vignatti
52e598cf51 shell: use own struct for transient surfaces
No functional changes; it's only opening space for modifications coming along
on the next commits.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-07 16:54:53 -04:00
Tiago Vignatti
70e5c9cc42 shell: fix uninitialized variable warning
and shut-up valgrind:
 Conditional jump or move depends on uninitialised value(s)
    at 0xB5AFB05: shell_surface_configure (shell.c:2162)
    by 0x407B0C: surface_attach (compositor.c:1225)
    by 0x621FA13: ffi_call_unix64
    by 0x621F434: ffi_call
    by 0x4E3D3F5: wl_closure_invoke (connection.c:758)
    by 0x4E3786C: wl_client_connection_data (wayland-server.c:255)
    by 0x4E3AA19: wl_event_source_fd_dispatch (event-loop.c:78)
    by 0x4E3B533: wl_event_loop_dispatch (event-loop.c:460)
    by 0x4E38D2C: wl_display_run (wayland-server.c:907)
    by 0x40B5DD: main (compositor.c:2748)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-07 16:54:32 -04:00
Daniel Stone
e5a0120757 Rename 'state' in axis (or ambiguous) bindings to 'value'
Since it's usually an axis value rather than a boolean, be slightly more
explicit about it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 13:03:48 -04:00
Daniel Stone
5d66371743 Change button from int to uint32_t
Since you can't really have a negative button number.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 12:57:11 -04:00
Daniel Stone
da5b93c8d7 Change key/button grab bindings to take unsigned state
'state' here meaning 'is it up or down?', obviously.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 12:54:14 -04:00
Kristian Høgsberg
8e1f77fee3 drm: Make KMS hw cursors work again 2012-05-03 11:39:35 -04:00
Ander Conselvan de Oliveira
a64b15d160 compositor-drm: alow scanning out of buffers with XRGB8888 format 2012-05-02 10:04:28 -04:00
Ander Conselvan de Oliveira
555c17ddd8 compositor-drm: refactor to avoid unnecessary allocation of KMS FBs
Currently, the drm backend will create and destroy a KMS FB for each
frame. However, the bos for a gbm surface are reused (at least with
mesa) so we can store the fb_id on it and destroy it only on the bo's
destroy callback.

To use the same path for scanning out client buffers, some refactor
was needed. Previously, the bo for the client buffer was destroyed
early so that gbm_surface_release_buffer() would not be called with
it, since at the page flip handler output->scanout_buffer can be
NULL even if the current frame is a client buffer.

This was solved by adding a drm_fb structure that holds a gbm_bo,
an fb_id, and information about the fb coming from a client buffer
or not. A drm_fb is created in such a way that it is destroyed
whenever the bo it references is destroyed. The fields current_*
and next_* in drm_output are changed into only two pointers to
drm_fb's.
2012-05-02 10:04:26 -04:00
Kristian Høgsberg
e7afd919c9 shell: Handle set_title and set_class 2012-05-02 09:47:44 -04:00
Cooper Yuan
4577adce8c Use the dummy pbuffer we create to make current 2012-04-30 14:16:46 -04:00
Ander Conselvan de Oliveira
5f5f31939d compositor-drm: call EGL cleanup functions on exit 2012-04-30 10:44:18 -04:00
Kristian Høgsberg
f7e23d5c88 shell: Always configure when surface type changes
We can drop the force_configure hack.
2012-04-27 17:51:59 -04:00
Kristian Høgsberg
7f366e7053 shell: Don't move or reconfigure surfaces until we get the new buffer
Going from fullscreen to toplevel will restore the surface position
immediately.  This will move the fullscreen surface to where the toplevel
surface was before, which will flicker for a frame of two before the
resized, non-fullscreen buffer is attached.

Instead, only change the surface geometry when we get the new buffer.
2012-04-27 17:49:40 -04:00
Alex Wu
7bcb8bd30e shell: Fix not remove rotation for fullscreen surf
Remove rotation when entering fullscreen and restore rotation when exiting.

https://bugs.freedesktop.org/show_bug.cgi?id=48906
2012-04-27 15:10:37 -04:00
Ander Conselvan de Oliveira
fb9808993b shell: allocate enough memory for shsurf->ping_timer 2012-04-27 15:06:18 -04:00
Kristian Høgsberg
a8479f1e3a Merge remote-tracking branch 'pq/simple-fixes' 2012-04-27 15:05:45 -04:00
Kristian Høgsberg
306e36185c tests: Add an initial weston integration test
The idea here is to make weston load test cases as a module and then
run test cases from within weston.
2012-04-26 09:07:13 -04:00
Scott Moreau
e17f61008c compositor: Initialize xserver variable
This variable is used unitialized if --xserver is not passed to weston.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-26 15:56:06 +03:00
Pekka Paalanen
f31ad10b77 compositor: report .so path when load_module() fails
I want to know which module is failing to load with unresolved symbols.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-26 15:44:13 +03:00
Juan Zhao
e10d279017 shell-animation: add conf option in shell
Now we can choose zoom or fade in weston.ini
to fulfill and customize the user experence easier.

Signed-off-by: Juan Zhao <juan.j.zhao@intel.com>
2012-04-25 10:38:19 -04:00
Juan Zhao
2abd07b200 animation: add fading-in animation
To ful-fill user experience, add the fading-in animation
when mapping a window.
v2: update that westom_surface_damage to repaint
    remove that transform part in fade struct

Signed-off-by: Juan Zhao <juan.j.zhao@intel.com>
2012-04-25 10:38:10 -04:00
Kristian Høgsberg
90c6f1c90e xserver: Move window property reading to set_window_id handler
This will work for override-redirect windows too.
2012-04-22 15:12:45 -04:00
Kristian Høgsberg
54094c3d42 xserver: Read window properties in map request handler 2012-04-21 23:28:34 -04:00
Kristian Høgsberg
ca535c1998 shell: Don't ping internal shell surfaces
This is a hack for now to get xserver surfaces working again.
2012-04-21 23:21:33 -04:00
Tiago Vignatti
bc052c99f9 compositor: introduce internal shell_interface
We're able now to create shell_surfaces inside Weston. This makes possible the
glue needed between shell and xserver-launcher.

On the desktop-shell, it was split the protocol part from shell_surface
specific functions to make this possible.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-21 23:21:08 -04:00
Kristian Høgsberg
b10f1e3ab0 compositor: Set pointer surface input region to empty on attach
We set up an emtpy region for the initial NULL-cursor, and then going
from no buffer to a 32x32 buffer didn't trigger the undeffing of the input
region.  So when something sets a cursor of a different size, the cursor
surface input region gets initialized and starts swallowing events.
2012-04-21 23:21:08 -04:00
Kristian Høgsberg
a4e8b33704 shell: Move binding-modifier to shell section 2012-04-20 16:48:21 -04:00
Tiago Vignatti
0b52d4810d shell: modifier bindings configurable
This patch makes the main modifier configurable.  We used to hardcode super
(windows key) for most bindings, but now that can be changed.

The change affects two key bindings: rotation moves to mod+right click
and backlight moves to from ctrl+f9/f10 to mod+f9/f10.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-20 16:38:35 -04:00
Scott Moreau
72c2372148 screenshooter: Move buffer assembly to client side 2012-04-20 16:16:05 -04:00
Scott Moreau
062be7ec93 screenshooter: Grab pixel data directly before buffer swap 2012-04-20 16:13:27 -04:00
Casey Dahlin
9074db5d62 Send surface enter/leave events
These new protocol events allow us to tell which outputs a surface is on, and
potentially update where we allocate our buffers from.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
2012-04-20 13:39:40 -04:00
Casey Dahlin
58ba1370d8 Add an id field to outputs
All outputs now have a unique integer ID, allocated from a bitfield pool in the
compositor.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
2012-04-20 13:14:29 -04:00
Casey Dahlin
96d8a75ec0 Change find_resource_for_surface to find_resource_for_client
This function has generic applications and should be made generic.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
2012-04-20 13:11:06 -04:00
Scott Moreau
9521d5e553 shell: Cleanup ping_timer code.
- Added ping_timer_destroy() to simplify cleanup.
 - Changed timeout and fade step to more realistic values.
 - Renamed ping_timeout_fade_frame() to unresponsive_fade_frame().
2012-04-19 15:12:43 -04:00
Alex Wu
adb624a297 compositor-drm: Remove an useless code line. 2012-04-19 14:52:56 -04:00
Scott Moreau
c3e54eb8f0 Dim unresponsive windows
If a client is not responding, lower the brightness and
saturation to indicate it's stalled. The surface is restored
to it's original color values if the client later becomes
responsive.
2012-04-19 12:51:01 -04:00
Scott Moreau
69367082de Install brightness and saturation variables for surface shader 2012-04-19 12:50:57 -04:00
Scott Moreau
ff1db4a4f3 Install structuring for ping-pong protocol 2012-04-19 12:50:47 -04:00
Alex Wu
bd3354b8b2 shell: Implement "driver" method of fullsceen.
Switching display mode may happen when:
1. The fullscreen surface is at top most in fullscreen layer and with
   "driver" method. Shell will switch output mode to match the surface
   size. If no matched mode found, fall back to "fill" method.
2. The top fullscreen surface is destroyed or unset. Switch back to the
   origin mode.
2012-04-17 14:38:45 -04:00
Alex Wu
b7b8bda600 compositor-drm: Add switch_mode support.
Implement switch_mode hook for drm backend.
2012-04-17 14:38:35 -04:00
Alex Wu
2dda604093 compositor: Add a switch_mode hook and a wrapper into the output.
This allow each output backend to switch the display mode. It is
useful to some applications like fullscreen game, xbmc.
2012-04-17 14:38:29 -04:00
Tiago Vignatti
314db6edef weston-launch: be more descriptive with output messages
Specially the "either" word there is essential, so users don't confuse
thinking that both steps are needed.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-17 14:10:42 -04:00
Pekka Paalanen
a1d57dba87 compositor: make GL_EXT_read_format_bgra optional
Some GL implementations do not provide GL_EXT_read_format_bgra
extension.

Set a glReadPixels format based on whether the extensions is supported
or not, and use that format in all backends.

Add RGBA->BGRA swapping copy to screenshooter to keep the shm buffer
data format as BGRA.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 15:12:17 +03:00
Pekka Paalanen
45fab0e8e6 screenshooter: refactor the copy loop
This makes it easier to later add an alternative copy loop.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 14:57:24 +03:00
Pekka Paalanen
299e58d9f8 compositor: check queryString success
During a bring-up of a new backend, it would be nice to get a real error
message, when the EGL and GL contexts have not been properly set up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 14:36:00 +03:00
Pekka Paalanen
52bfbaae14 compositor: use GL_EXT_unpack_subimage only if available
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 14:36:00 +03:00
Pekka Paalanen
2eaa11e954 compositor: add EGL_WL_bind_wayland_display definitions
This is a workaround for platforms, whose EGL headers miss the
definitions for EGL_WL_bind_wayland_display.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 14:36:00 +03:00
Pekka Paalanen
9bc1a4ef9e compositor: move libudev.h to evdev.h
Compositor core does not do anything with udev, so the header is not
needed there. Move the #include into evdev.h, from where it gets used by
compositor-drm.c, too.

Also fix the fallout:
tty.c: In function 'tty_create':
tty.c:143:2: warning: implicit declaration of function 'fstat'

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 14:33:30 +03:00
Tiago Vignatti
e4faa2ab05 compositor: init shell after xserver
This reverts a snip from commit d012e9df. On that commit, it was lost the
ability of calling X applications from desktop panel; xserver module
was setting DISPLAY only later, after panel was already launched.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-16 16:38:30 -04:00
Tiago Vignatti
be14326efd desktop-shell: use more consistent name for the main structure
wl_shell is more likely to be used for core protocol specific. Now it follows
pretty much the same style of what tablet-shell is using.

No functional changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-16 11:55:24 -04:00
Kristian Høgsberg
eb04ddb1b6 tty: Fall back to K_RAW if K_OFF is not available 2012-04-13 14:54:15 -04:00
Kristian Høgsberg
3730f36c6e shell: Tighten shell.set_popup semantics
We need to use the input device from the request, and check that the
serial matches the serial from the latest button press.
2012-04-13 12:40:18 -04:00
Kristian Høgsberg
011abc8ac6 xserver-launcher: Pass serial to wl_input_device_set_selection() 2012-04-13 11:02:21 -04:00
Kristian Høgsberg
d012e9dfa4 Make xserver-launcher a module 2012-04-12 16:16:38 -04:00
Kristian Høgsberg
02e79dc935 compositor: Add a destroy signal and turn weston_shell into signals 2012-04-12 16:16:38 -04:00
Kristian Høgsberg
27e30526db Use wl_signal mechanism
Mostly mechanical rewrite to track waylands change to struct wl_signal.
2012-04-12 16:15:56 -04:00
Kristian Høgsberg
eae5de7609 Follow wayland change to serial numbers 2012-04-11 22:42:15 -04:00
Benjamin Franzke
78db848196 compositor: Damage output in weston_output_init
So that hotplugged outputs are marked damaged initially.
2012-04-10 18:51:49 +02:00
Benjamin Franzke
b687940cd5 compositor: Remove wl_output-global on unplug
Or we would segfault when a client binds to a output thats already
destroyed.
2012-04-10 18:51:15 +02:00
Ander Conselvan de Oliveira
fe0444a9a9 shell: handle surface destruction during move, resize and rotate grabs
When the surface being moved, resized or rotated was destroyed, the
compositor would crash.

Fix this by using a destroy listener on the referenced surface. To
reduce code duplication, the surface reference and the destroy
listener is added to a new struct shell_grab.
2012-04-10 01:40:11 -04:00
Kristian Høgsberg
ba25bd7be1 weston-launcher: Fix uninitialized variable warning 2012-04-10 01:31:09 -04:00
Kristian Høgsberg
9e14091778 weston-launcher: Fix aliasing warnings 2012-04-10 01:26:18 -04:00
Kristian Høgsberg
035dd9c4de compositor: End keyboard grab when compositor loses keyboard focus 2012-04-10 00:35:15 -04:00
Kristian Høgsberg
eeb2e50a76 tty: Put console in K_OFF mode
This disables all kernel key bindings (VT switch keybindings, caps lock
etc) and disables delivery of console input.
2012-04-10 00:35:15 -04:00
Kristian Høgsberg
5d1c0c58ad drm: Add vt switch keybindings 2012-04-10 00:35:09 -04:00
Kristian Høgsberg
a00d60f6ac evdev: Get key state from kernel on vt enter
We need this to correctly initialize compositor key state, modifier state and
to send the right keys in the key enter event.
2012-04-10 00:19:40 -04:00
Kristian Høgsberg
4014a6b05b drm: Remove input devices before cancelling repaints in vt switch away
Removing the input devices will trigger events and activity that will cause
a redraw.  Do this before we put the compositor to sleep so we can cancel it
properly and avoid immediately waking the compositor again.
2012-04-10 00:08:47 -04:00
Kristian Høgsberg
e5cf741669 xserver: Return EEXIST if unlinking lockfile fails
Otherwise we'll keep trying to unlink it.
2012-04-10 00:04:57 -04:00
Kristian Høgsberg
2c76be7c1b xserver: Don't leak lockfile fd on error path 2012-04-10 00:04:57 -04:00
Kristian Høgsberg
31dd6b86c1 compositor: Don't pass output to notify_keyboard_focus
Doesn't make sense and was only used to distinguish between enter/leave.
2012-04-10 00:04:22 -04:00
Benjamin Franzke
78d3afe21c evdev: Disable the udev monitor when another vt becomes active
We dont want to receive hotplug events while being inactive.
When getting back active we enumerate all devices and would end up
with two sources for one device that may be hotplugged in the mean time.
2012-04-09 18:20:26 +02:00
Benjamin Franzke
bfeda130de Introduce weston-launch
weston-launch starts weston and provides mechanism
for weston to set/drop drm master, open a tty,
and read input devices without being root.

Execution is allowed for local-active sessions
or users in the group weston-launch.
2012-04-06 14:01:19 +02:00
Scott Moreau
80d27b7e06 screenshooter: Properly handle multiple outputs. 2012-04-04 14:28:53 -04:00
Kristian Høgsberg
32e568600f shell: Break up a few long lines 2012-04-02 22:18:58 -04:00
Alex Wu
1659daa21f shell: set black surface alpha properly in switcher_next()
Make the black surfaces semitransparent when switching surface, and
if associated fullscreen surface is chosen, make black surface opaque.
2012-04-02 22:17:04 -04:00
Alex Wu
2185843ced shell: Add fullscreen path into activate()
Use shell_stack_fullscreen() to raise fullscreen surface in activate(),
and before activate() a regular surface, move all the fullscreen
surfaces from fullscreen_layer to toplevel_layer.

Also add a void *private into struct wesont_surface since we already
have a configure() vfunc. That helps to get the associated fullscreen
surface of black surface.
2012-04-02 22:15:40 -04:00
Kristian Høgsberg
875ab9e735 Add signedness warning flag and fix fallout 2012-03-30 11:52:39 -04:00
Kristian Høgsberg
ed92f79655 Fix warnings resulting from wayland signedness fixes 2012-03-30 11:31:25 -04:00
Kristian Høgsberg
3448616bc3 Remove weston_shell map and configure function pointers 2012-03-29 13:08:32 -04:00
Kristian Høgsberg
56d23bc3ee shell: Remove obsolete workaround
Cursor surface now are properly initialized.
2012-03-29 11:35:32 -04:00
Kristian Høgsberg
dbae80e6b5 compositor: Support alpha for solid color surfaces 2012-03-29 11:34:39 -04:00
Jonas Ådahl
29a9cf0f97 tty: Improve error handling in tty_create()
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-03-28 23:03:00 -04:00
Jonas Ådahl
c97af923d9 Properly dispose event sources and event loops
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-03-28 23:00:08 -04:00
Kristian Høgsberg
b5ef591fac compositor: Stop using EGL_KHR_surfaceless_gles2
The remaining use case was making our context current before we had any
output surfaces.  We can do that now using a dummy surface, so let's stop
relying on surfaceless.
2012-03-28 22:53:49 -04:00
Kristian Høgsberg
cbcd04794c compostor-drm: Use gbm surface
Instead of using the hacks of gbm_bos, EGLImage, FBOs and surfaceless
we switch to using the new gbm surface API.  This gives us an EGL
native window type for gbm and lets us use a real EGL surface.
2012-03-28 22:29:21 -04:00
Tiago Vignatti
0a38611e7d tablet-shell: come back to life
A couple of fixes were made: Weston tablet-shell needed to use weston_layer,
so the compositor could rebuild the surface list correctly when repainting;
homescreen and locking are using the widget + window abstration of toytoolkit;
and widget_set_redraw_handler are being set for widgets redraw.

Also, it was given some basic meaning for lockscreen_button_handler, which
was completely disabled before. As a clean up, I updated the global listener
mechanism on tablet-shell client, using the regular way of registering a
handler instead wl_display_roundtrip -> wl_display_get_global.

Switcher still without code to proper work and the same for tablet-shell
clients, which are not launched.

krh: Edited to not scale down homescreen icons, use new load_cairo_surface()
for image loading.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-28 09:37:17 -04:00
Kristian Høgsberg
fb6de223b2 compositor: Use GL_EXT_unpack_subimage for texture updates 2012-03-27 17:10:20 -04:00
Kristian Høgsberg
8cbfb2a40a compositor: Rename weston_buffer_attach to weston_surface_attach
This was always an operation on the surface, not the buffer.
2012-03-27 17:05:06 -04:00
Tiago Vignatti
db4ecc61a7 evdev: reuse code for device removal
Just like device_added, now the routines to close the compositor and vt switch
leave are using the same code to remove a device.

This patch also closes properly a mtdev device, bug spotted by Christopher
Michael.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-27 16:36:54 -04:00
Ander Conselvan de Oliveira
7fb9f95dce compositor: move force_configure field to shell_surface 2012-03-27 16:36:54 -04:00
Ander Conselvan de Oliveira
093bfa3793 compositor: make surface_configure() a vfunc
This allows us to move the logic that calls shell->map() or
shell->configure() into shell while allowing it to be overriden for
surfaces that should not be handle by the shell, such as drag icons.

This patch adds a pointer function called configure to weston_surface,
moves the currsent surface_configure() code into shell and implements
a separate configure() for drag surfaces.
2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira
e11683aab2 compositor: refactor surface_attach()
surface_attach() does two things: sets up a new buffer as the contents
of the given surface and then calls into shell so it can setup the
position of the surface and map it if necessary. However we do not want
the shell to meddle with some internal surfaces such as drag surfaces.

The intention of this refactoring is to make room for making the part
that calls into shell a virtual function that the compositor can
override for these internal surfaces.

This changes weston_buffer_attach() so it handle all the logic of tying
a buffer to a surface, including unmapping it when the buffer is NULL.
The shell map() vs. configure() logic is then split into a another
function: surface_configure(). In a later commit, this function will be
turned into a function pointer in struct weston_surface.
2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira
d6ea33dfd6 compositor: use new drag icon listener for setting up drag surfaces
That way we can get rid of the call to
weston_compositor_update_drag_surfaces() on shell->map().
2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira
9390ae3ed1 compositor: make es->pitch consistent between shm and drm surfaces
For shm buffers, es->pitch is set using the stride of the buffer. If
the shell happened to set the surface width to something different than
the buffer width, the contents of the surface would be cropped on the
width during redraw. However, for non-shm surfaces, es->pitch was set to
the surface width. That caused the contents of the buffer to be scaled
on the width when the buffer was wider than the surface.

This makes the behavior on both cases the same: crop on the width and
scale on the height. (which is weird but consistent)
2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira
fbf2894812 compositor: add weston_surface_to_global_float helper 2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira
b8ab14fe04 compositor: add a weston_surface_is_mapped() helper 2012-03-27 16:36:53 -04:00
Kristian Høgsberg
f9247ddc31 compositor: Use GL_BGRA_EXT for glReadPixels in screenshooter
This needs GL_EXT_read_format_bgra.
2012-03-27 15:59:46 -04:00
Kristian Høgsberg
9629fe3206 Simplify shm buffer handling
There was a lot of code here to do a lot of work we didn't need to do.
If we damage a surface with a shm buffer attached, all we need to do
is to re-upload the damaged region to the texture.  As for drm buffers,
we don't assume anything changes on attach and only update the
regions the client tells us to update in the damage request.
2012-03-26 19:27:35 -04:00
Kristian Høgsberg
7a011eac73 compositor-drm: Check es->image, not es->buffer when looking for overlays
es->buffer can be NULL if the client destroyed the buffer, but es->image
will be non-NULL if and only if we have a buffer we might use with KMS.
2012-03-26 11:48:55 -04:00
Tiago Vignatti
9a206c4da5 config-parser: consolidate shell files into weston.ini only
The shell choice happens in the configuration file now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-25 08:49:30 -04:00
Scott Moreau
56456d6578 Secure screenshooter protocol. 2012-03-24 14:40:21 -04:00
Rafal Mielniczuk
2d7ab82d74 shell: fix matrix invertible bug in rotation handler
While activating and deactivating rotation mechanism without moving
the pointer, rotation matrix from rotate_grab object is not being
initialised and damage shell surface rotation matrix in
rotate_grab_button handler, making it invertible.

This patch initialise rotate matrix in rotate_binding
and moves surface position check to rotate_grab_motion handler.
2012-03-22 22:34:11 -04:00
Scott Moreau
a3aa9c9dd6 Add surface opacity controls. 2012-03-22 11:03:41 -06:00
Scott Moreau
1b45a79a0a Switch zoom binding to <Super>+Scroll. 2012-03-22 11:03:41 -06:00
Scott Moreau
6a3633d2bb Modify bindings for axis event detection. 2012-03-22 11:03:41 -06:00
Scott Moreau
210d079817 Hook up axis events. 2012-03-22 11:03:41 -06:00
Rob Clark
3c97b9017d drm: plane src coords are 16.16 fixed point 2012-03-22 11:58:58 -04:00
Rafal Mielniczuk
778e629b95 shell: correct position of a surface before rotating it.
How to reproduce: rotate the surface to something like 45 degrees,
resize it drastically, continue to rotate. The surface will jump
some space and the rotation point will not be in the center
of the surface.

Fix is to shift the surface position to match the rotation point
2012-03-22 10:44:27 -04:00
Kristian Høgsberg
9ab37e8c36 Revert "automake: Don't fail the build if we can't setuid."
This reverts commit e7ad5cdcd2.

If you ask for setuid install and that fails you didn't get what you
asked for and we shouldn't just silently carry on.  If installing weston
somewhere in your home directory and don't want the setuid bit set,
disable that at configure time.
2012-03-20 22:44:08 -04:00
Ander Conselvan de Oliveira
29d955685f evdev: fix input lag when processing input from output repaint
When the compositor is in a repaint cycle, input is processed only once
per frame. However, a call to evdev_input_device_data() would handle at
most 8 events at time. When there was more than 8 events pending for a
given frame, input lag would occur. This was most visible with multi
touch input.

This patch changes the evdev_input_device_data() so that it will handle
all the events available in the fd. In order to do that, the fd is put
in non-blocking mode, so that it is possible to loop on read and stop
on EAGAIN instead of blocking.
2012-03-20 22:43:57 -04:00
Kristian Høgsberg
afee221ccb compositor: Fix pointer type mismatch warnings 2012-03-20 22:43:56 -04:00
Juan Zhao
46436618d8 weston_surface: initialize pitch
Initializing pitch to 1 to avoid xxx/pitch errors
This won't influence the valid texture coordinate calculation, because
 in that case buffer_attach will provide the correct value.
2012-03-20 22:43:56 -04:00
Bill Spitzak
027b962d8c weston: don't hang in wait()
Pausing weston (with ^Z in the shell) and putting it in the background
made it hang.
2012-03-20 22:43:56 -04:00
Bill Spitzak
d273e28567 weston: Don't ask for EGL depth buffer if not needed
This makes the compositor and demo clients work on the current nouveau
nvfx driver. Obviously does not fix any clients that actually want a
depth buffer, but this does allow more people to at least try wayland.
2012-03-20 22:43:56 -04:00
Tiago Vignatti
23fdeedf82 evdev: use mtdev for multitouch devices
mtdev library translates all multitouch based devices to the slotted evdev
protocol. It provides an uniform interface for Weston, which eases mt
implementation when dealing with a big variety of devices.

Weston on drm now directly depends on such library.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-20 22:43:56 -04:00
Ander Conselvan de Oliveira
71b1d0c91d compositor: properly restore keyboard_focus in notify_keyboard_focus()
Commit f992b2fc removed the saved keyboard focus logic to fix a crash
when the saved surface is destroyed. However, setting keyboard focus to
the first surface on the list ends up trying to set the focus to the
cursor surface most of the time. The end result is a NULL keyboard
focus.

This patch restores the saved keyboard focus logic and fixes the crash
mentioned above using a destroy listener.
2012-03-20 22:43:55 -04:00
Ander Conselvan de Oliveira
96b0abd88a compositor: allow multiple input_device_attach()'s with a nil buffer
Without this change, weston would crash whenever a nil buffer was
passed to input_device_attach() if the cursor sprite was not mapped.
While at it, change the unmapping code to use weston_surface_unmap().
2012-03-20 22:43:55 -04:00
Ander Conselvan de Oliveira
e2d21e82fc compositor-wayland: use image loading code from shared/
Function weston_load_image() was deleted in f02a649a but the wayland
backend was not adapted to the new interface. This probably went
unoticed because the prototype for the missing function was not deleted
from compositor.h so the backend would compile without warnings.
2012-03-20 22:43:55 -04:00
Tiago Vignatti
5ab91ad845 compositor: use smoother range for backlight control
now it goes from 0 to 255.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-20 22:43:54 -04:00
Alex Wu
07b2606c7a shell: Fix 2 switcher crashes.
In case of no regular window, switcher will crash in switch_next()
due to "next == NULL" and in switcher_destroy() due to
"switcher->current == NULL".
2012-03-20 22:43:54 -04:00
Eric Anholt
e7ad5cdcd2 automake: Don't fail the build if we can't setuid.
The configure default is to setuid root the weston compositor.
However, if installing as non-root (say, to your prefix in homedir),
the install fails anyway, even if you didn't need setuid to run weston
in your configuration.
2012-03-13 12:39:00 -07:00
Kristian Høgsberg
f02a649a3c Consolidate image loading code and move to shared/ 2012-03-12 01:40:59 -04:00
Kristian Høgsberg
bcacef19b0 Add an option parser
On one hand, getopt (in particular the -o suboption syntax) sucks on the
server side, and on the client side we would like to avoid the glib
dependency.  We can roll out own option parser and solve both problems
and save a few lines of code total.
2012-03-12 01:28:50 -04:00
Kristian Høgsberg
22ba60e514 x11: Move the xcb fd to the input loop
This way, we handle input just before repaint, similar to the drm backend.
2012-03-12 01:28:50 -04:00
Kristian Høgsberg
aa6019e125 Fix picking crashes
The surface list is only valid after repaint, so we need to do picking and
input delivery there.
2012-03-12 01:28:50 -04:00
Rob Clark
8efbc8ee62 drm: fix issue copying supported plane formats
Originally on the first 1/4th of the plane formats were copied, leading
to problems if AR24/XR24 appears later in the list.
2012-03-12 01:16:13 -04:00
David Herrmann
6ac52db3b0 compositor-drm: use udev_device_get_property_value() helper
Udev provides a convenient helper. Use it instead of working with the
property-list directly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-11 15:55:32 -04:00
David Herrmann
d7488c2f5b compositor-drm: ignore hotplug-events from other devices
If we have multiple video devices on the system (card0, card1), we should
ignore hotplug events for cards that we do not use. This avoids calling
update_outputs() if the event was not generated by our device so we avoid
refreshing the DRM information if it didn't change.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-11 15:54:49 -04:00
Christopher Michael
eb866cd9fe drm: Fix drmModeRes leak on error paths
When creating outputs in the drm compositor, if allocating crtcs
fails, then free the drm resources. Also, if the base output list is
empty, free drm resources
2012-03-08 13:17:11 -05:00
Benjamin Franzke
0eee939d76 compositor: Fix compilation without xserver launcher 2012-03-08 13:15:02 -05:00
Ander Conselvan de Oliveira
de56c311d9 shell: don't assign output for surface of type none
If map is called with a surface of type none it will call
weston_surface_assign_output, even though the surface will
not be mapped.

This change was lost with the changes for using wl_layers.
2012-03-08 13:10:18 -05:00
Alex Wu
9c35e6b47d shell: Fix segment fault when clicking to activate a NULL pointer_focus
This can happen for instance running a toytoolkit application, launching
the popup menu and then clicking on a surface that does not belong to
the client that create the popup surface.
2012-03-08 13:08:00 -05:00
Alex Wu
aa08e2d56d shell: Fix not destroy black surface when fullscreen surface exit abnomally.
When a client with fullscreen surface displayed was aborted by Ctrl-C, the
black surface still be there. Destroy the black surface in
destroy_shell_surface().
2012-03-08 12:57:54 -05:00
Kristian Høgsberg
60c4954b8a shell: Put popups and transients on top of their parent
In other words, don't map the panel menu under the panel.
2012-03-05 20:51:34 -05:00
Kristian Høgsberg
65bec2452e drm: Disable sprites if they're broken
Current sprite implementation has a color format bug.  Disable sprites
if they don't work and avoid spamming stderr and syslog.
2012-03-05 19:57:35 -05:00
Kristian Høgsberg
7dbf5e2ea7 compositor: Only process input once per frame
When we're repainting, there's no point in polling for input events.
We just read input events once before each repaint and send out events
as needed.  The input events come with an accurate timestamp, so this
doesn't affect the timing information and client should always look at
the event timestamps if they're trying to determine pointer motion
speed or double click speed.  If we go idle (stop repainting) we add the
input devices back into the primary main loop and wait for the next event.

This avoids waking up the compositor separately (one or more times per
frame) to handle input events.  We also avoid updating cursor position
and other compositor state after the client has rendered its new
frame, reducing lag between what the client renders and the pointer
position.
2012-03-05 19:50:15 -05:00
Kristian Høgsberg
7ea10864c2 compositor: Move input devices to their own event loop
First step towards only handling input at repaint time.
2012-03-05 18:06:08 -05:00
Kristian Høgsberg
abcef3cf7a compositor: Swallow binding key for bindings that don't set up a grab
This prevents passing the key press and release to the keyboard focus client.
2012-03-05 17:47:15 -05:00
Kristian Høgsberg
d3c0275b14 Use wl_array_for_each() where possible 2012-03-04 22:35:47 -05:00
Pekka Paalanen
4ac32ab669 compositor-drm: fix libbacklight build
Bad inclusion of DRM headers, missing some system headers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-03-04 22:00:02 -05:00
Kristian Høgsberg
0b5cd0cb4c Use typesafe server-side stubs 2012-03-04 21:57:37 -05:00
Kristian Høgsberg
b41c0810ea compositor: Add a repaint debugging mechanism
Toggle on/off with Super+SPACE.
2012-03-04 14:53:40 -05:00
Kristian Høgsberg
32bed57d5a shell: Don't launch a new screensaver if the old one is still running 2012-03-01 17:33:52 -05:00
Kristian Høgsberg
525696851e compositor: Damage sprite surface on attach
Normally the client is responsible for damaging the surface after attach,
but the sprite surface is an internal surface.
2012-03-01 17:33:52 -05:00
Kristian Høgsberg
867dec7ff0 compositor: Post keyboard leave before destroying surface
We may want to move this into wayland-server.
2012-03-01 17:33:51 -05:00
Ander Conselvan de Oliveira
3e3bb3216e compositor: split drag surface update into smaller functions 2012-03-01 17:33:51 -05:00
Ander Conselvan de Oliveira
c5fb9a7de9 compositor: fix crash when a drag surface is destroyed during the drag
This can happen for instance if the client that started the drag
crashes. Weston would crash because of the invalid surface pointed by
device->drag_surface.

Fix this by reseting the drag surface to nil on a destroy listener.
2012-03-01 17:33:51 -05:00
Kristian Høgsberg
3be2ce9e49 compositor: Organize surface stack using new struct weston_layer
The surface data structure is now a list of list of surfaces.  The core
compositor defines the fade and cursor layer, and it's up to the shell to
provide more layers for the various surface types it implements.
2012-03-01 17:33:51 -05:00
Kristian Høgsberg
944236a712 compositor: Just damage compositor->damage in weston_output_damage() 2012-03-01 12:47:23 -05:00
Kristian Høgsberg
1e8321213d compositor: Implement damage_below by using the new compositor->damage
We can now clip the surface bounding box against the previous frame
opaque clip, and then just union the result (visible damage) into
compositor->damage immediately.
2012-03-01 12:47:23 -05:00
Kristian Høgsberg
6ddcdaeb98 compositor: Store opaque clip for previous frame in weston_surface 2012-03-01 12:47:23 -05:00
Alex Wu
4539b0874f shell: Add implementation of fullscreen.
Undo fullscreen in shell_unset_fullscreen(), do all the stacking order
in shell_stack_fullscreen(), and configure black surface, method in
shell_configure_fullscreen().

Signed-off-by: Alex Wu <zhiwen.wu@linux.intel.com>
Signed-off-by: Juan Zhao <juan.j.zhao@linux.intel.com>
2012-03-01 12:47:23 -05:00
Kristian Høgsberg
51cba3ca38 compositor-drm: Just pull in libbacklight source for now
libbacklight is 300 lines of code in one .c file, and we're relying on
udev changes that aren't yet upstream.  For now, let's just keep a
copy in weston and if the Xorg DDX drivers start using libbacklight and
it becomes more widely available, we'll make it an external dependency.
2012-02-29 14:23:51 -05:00
Tiago Vignatti
8e53c7f566 compositor: add dpms and backlight support
DPMS kicks in only when wscreensaver is launched, in the moment that shell
call lock() for the second time. Backlight control internals are managed by
libbacklight:

	http://cgit.freedesktop.org/~vignatti/libbacklight/

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-02-29 14:01:56 -05:00
Kristian Høgsberg
2ea094422a zoom: Don't damage_all here
Setting geometry.dirty = 1 is enough.
2012-02-29 12:52:32 -05:00
Kristian Høgsberg
9b154fa82b compositor: Insert dnd icon surface below device sprite surface 2012-02-29 12:52:32 -05:00
Kristian Høgsberg
9bc7095a78 compositor: Set an empty input region for the fade surface
Otherwise we don't set the cursor until the fade is done.
2012-02-29 12:52:32 -05:00
Ander Conselvan de Oliveira
90fbbd74cc compositor: make the input region of drag surfaces empty
With the input region changes, drag surfaces were being picked and
receiving events which led to problems on the client side.
2012-02-28 14:34:53 -05:00
Kristian Høgsberg
cacb7cd0f6 shell: Mark geometry dirty when we change surface alpha
We need to recompute the opaque region when the alpha changes.
2012-02-28 09:23:23 -05:00
Kristian Høgsberg
3b4af20100 compositor: Dont set the opaque region if we have an overall surface alpha 2012-02-28 09:23:23 -05:00
Alex Wu
8811bf9e8d compositor: Export functions and add weston_suface::force_configure for fullscreen
This will facilitate the implementation of fullscreen.

Signed-off-by: Alex Wu <zhiwen.wu@linux.intel.com>
2012-02-28 09:00:10 -05:00
Scott Moreau
c6d7f60b19 Restructure output zoom key handling.
This effectively eats the keybinding events, as we don't want them sent
to clients.
2012-02-26 13:43:11 -05:00
Kristian Høgsberg
4d7c862278 drm: Remove redundant cursor region math
We already check this in weston_output_set_cursor().
2012-02-24 11:07:43 -05:00
Kristian Høgsberg
ca14ef049d drm: Remove redundant weston_surface_update_transform() call 2012-02-23 23:07:45 -05:00
Kristian Høgsberg
d15fbe334a compositor: Remove surface overlapped attribute
We need to compute this as we assign surfaces to overlays, so that
if we assign a surface to an overlay, it isn't considered overlapping.
2012-02-23 23:06:13 -05:00
Kristian Høgsberg
d8bf90c150 Move weston_output_set_cursor into compositor-drm.c
First step towards moving hw cursor handling into compositor-drm.c a its
general overlay handling.
2012-02-23 23:03:14 -05:00
Kristian Høgsberg
85fd327f71 compositor-drm: Destroy sprites on shutdown, turn off on vt switch 2012-02-23 21:45:32 -05:00
Kristian Høgsberg
66617bb19d compositor: Remove unused compositor vfunc create_cursor_image 2012-02-23 21:29:55 -05:00
Jesse Barnes
58ef379be6 compositor-drm: Add sprite support
Add support for assigning surfaces to overlay sprites using the new
assign_planes hook.
2012-02-23 20:12:31 -05:00
Jesse Barnes
5308a5e09b compositor: add an assign_planes hook to the output
This allows each output back end to optimize drawing using overlay planes
and cursors (yet to be integrated).  If a surface is assigned to a
plane, the back end should clear its damage field so that the later
repaint code won't look at it.
2012-02-23 17:55:10 -05:00
Scott Moreau
2493be40a3 Fix pointer position clipping. 2012-02-23 17:45:56 -05:00
Scott Moreau
ccbf29dcb4 Introduce output zoom.
Ideally, we would want to use <modifier>+Scroll binding but that will have
to wait for axis events. For now we just use keybindings. Zoom in/out with
Super+Up/Down.
2012-02-23 17:45:49 -05:00
Kristian Høgsberg
4889154f5b compositor: Initialize destroy_listener_list for internal surfaces too
We use this to look up user data on the surface, so make sure the list is
always valid.
2012-02-23 17:38:33 -05:00
Kristian Høgsberg
010f98b083 window: Track and report input and opaque regions
We just set the input region to the bounding box of the window frame
and set the opaque region to be the opaque rectangle inside the window
if the child widget is opaque.
2012-02-23 17:30:54 -05:00
Kristian Høgsberg
dd631c1c36 simple-touch: Update to enter/leave changes 2012-02-23 16:20:38 -05:00
Kristian Høgsberg
5e7e6f2a22 compositor: Implement opqaue and input regions 2012-02-23 16:14:27 -05:00
Ander Conselvan de Oliveira
a2f1129d13 compositor: assign output to drag surfaces
Otherwise we endup with a surface that is mapped but with outtup nil.
2012-02-23 16:12:30 -05:00
Ander Conselvan de Oliveira
ba727bd1d9 shell: don't assign output for surface of type none
If map is called with a surface of type none it will call
weston_surface_assign_output, even though the surface will
not be mapped.
2012-02-23 16:06:06 -05:00
Kristian Høgsberg
06d58b74af Update to enter/leave events for pointer and keyboard 2012-02-23 09:59:05 -05:00
Alex Wu
88277d1422 shell: Fix never map fullscreen/transient surface.
If client send set_fullscreen/set_transient request before the first attach,
       compositor has no chance to map the surface due to "if (es->output == NULL)".

       You can pull it from git://gitorious.org/wayland-for-krh/weston.git map-bug
2012-02-22 12:33:43 -05:00
Kristian Høgsberg
31f9d0e8de compositor: Remove redundant weston_surface_damage_below() calls
In the attach case we always end up calling weston_surface_damage_below()
through weston_surface_update_transform() if and only if we need it.
2012-02-19 22:46:13 -05:00
Kristian Høgsberg
d0e2ef7779 compositor: Surface is unmapped when surface->output is NULL
surface->buffer can be NULL, which happens when a client destroys the
attached buffer.  Fixes list corruption on resize.
2012-02-19 22:15:21 -05:00
Kristian Høgsberg
0704539ec4 shell: Revive super-tab application switcher
We can do this right, now that we have keyboard grabs.
2012-02-19 21:04:08 -05:00
Kristian Høgsberg
afa264c6b6 compositor: Don't run keybindings if we have a key grab 2012-02-19 18:57:35 -05:00
Scott Moreau
ec286eb8e8 compositor: Setup for keyboard grabs. 2012-02-19 18:57:34 -05:00
Scott Moreau
447013d718 Track server changes. 2012-02-18 11:55:51 -05:00
Kristian Høgsberg
1cbf3262dd compositor: Move fullscreen_output to shell_surface 2012-02-17 23:49:07 -05:00
Kristian Høgsberg
323ee04505 compositor: Make weston_surface_damage_below_noupdate() the default
We never want to update the transform and then damage below.  Damage
below is always used to trigger a repaint where the surface used to be
so we need to record the damage before updating the transform.
2012-02-17 12:45:43 -05:00
Kristian Høgsberg
3b5ea3bc6f compositor: Move unmap logic to new function weston_surface_unmap() 2012-02-17 12:43:56 -05:00
Kristian Høgsberg
12bbf81456 compositor: Only delete surface texture if we have one 2012-02-17 12:15:27 -05:00
Kristian Høgsberg
101cb6560c compositor: Get rid of surface->visual 2012-02-17 10:45:16 -05:00
Kristian Høgsberg
6a8b553119 shell: Set geometry directly in configure
We already set half of it directly, and overwrite it in other cases, so
just skip weston_surface_configure().
2012-02-16 23:43:59 -05:00
Kristian Høgsberg
d5ae9f4f85 shell: Restore basic fullscreen functionality
This just fixes the default case.
2012-02-16 23:38:14 -05:00
Pekka Paalanen
b29f412eb8 protocol: remove absolute coordinates from pointer
This change depens on the Wayland core commit:
"protocol: remove absolute coordinates from pointer".

Remove the absolute coordinates from pointer motion and pointer_focus
events.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-16 23:19:40 -05:00
Ander Conselvan de Oliveira
30eebc7c21 compositor: implement drag'n'drop icons
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Ander Conselvan de Oliveira
e9e0515cec shell: update position of surfaces with type none on map()
Needed for implementing drag'n'drop icons. When a drag starts, the
compositor will position the top-left corner of the client supplied
icon surface at the cursor hotspot. On the first attach to that
surface, the client may want to reposition it but shell->map did not
take sx and sy parameters.

This changes shell->map interface to take sx and sy parameters and
change dekstop shell implementation to update the position of a
surface of type none according to those parameters. Since a surface
of type none won't actually be mapped, the effect of this change is
only visible for surfaces that are made visible by the compositor.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Ander Conselvan de Oliveira
d595f65fe2 compositor: add a way to disable picking of client surfaces
Surfaces like drag'n'drop icons shouldn't receive events as a normal
surface but are still created by the client so add a way for the
compositor to enable or disable the picking of a client surface.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Ander Conselvan de Oliveira
a1ff53b31a shell: don't map surfaces with type NONE
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Ander Conselvan de Oliveira
b63e3e0201 compositor: fix two crashs on surface_attach() with null buffer
The condition to return from surface_attach with a null buffer involves
es->output being non-null. However if a surface was just created this
field would be null and an attach of a null buffer would cause the
compositor to crash.

The other crash happened if surface_attach was called twice with a
null buffer after a valid buffer was attached to the surface. Since
es->buffer was not being set to NULL, surface_attach() would call
wl_list_remove(&es->buffer_destroy_listener.link) twice for the same
surface.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Kristian Høgsberg
f856fd2f93 Follow set_fullscreen protocol change 2012-02-16 23:19:38 -05:00
Juan Zhao
96879dfe52 shell: Add the set_maximized implementation 2012-02-16 16:00:02 -05:00
Pekka Paalanen
8fb8d3b1b5 compositor, shell: add and use weston_surface_set_position()
Another shorthand like weston_surface_configure().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 13:03:59 +02:00
Pekka Paalanen
d882779aa9 shell: remove two redundant statements from map()
I stared at this function for some time, and these were the only lines
I could sanely remove.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:52:24 +02:00
Tiago Vignatti
9d3935296c compositor: make functions static
I know it's hard to figure out what the shells or backends will be
using as internal API at this point but we can try to minimize the
amount of WL_EXPORT being used anyway.

[pq: redone due to my earlier changes]

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:52:24 +02:00
Tiago Vignatti
0f997016a7 shell: remove duplicated code
This clean-up seems alright, but someone with better knowledge has to
doublecheck this function. I guess there's a lot of space for clean-up
there.

[pq: looks ok, redone since did not apply after my changes]

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:52:24 +02:00
Pekka Paalanen
8980f7c7d8 shell: do not apply damage on window type set
Setting a window type is a non-visual operation, it is not supposed to
affect the rendering immediately. Therefore it does not need to apply
surface damage.

The proper surface damage is applied on an attach request following a
window type change.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:41:24 +02:00
Pekka Paalanen
f8c6aae688 compositor: remove redundant cursor damage calls
As weston_surface_update_transform() automatically applies before and
after damage on surface geometry change, we don't need to explicitly add
the same damage in motion_notify() for the cursor surface.

We still need the side-effect, that is scheduling a repaint.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:40:39 +02:00
Pekka Paalanen
cc2f868b2e compositor: round off fractions
Round off fractions from non-transformed surface position coordinates.

Transformed surface moved by a client may have non-integer position
coordinates. That is required to prevent drifting on continuous
resizing.

We can round the position to integers when the surface is not (anymore)
transformed.

This change may fix a rounding inconsistency in the opaque region setup,
where the rectangle is initialised from the coordinates without explicit
rounding operation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 10:34:04 +02:00
Pekka Paalanen
fc6d91a568 shell: replace identity calls to weston_surface_configure()
In the past, weston_surface_configure() was used to change the geometry,
apply damage, and assign an output.

Remove all calls to weston_surface_configure() that do not change the
surface geometry. Add damage calls where needed to keep the wanted
configure side-effects.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:50:27 +02:00
Pekka Paalanen
f07cb5d5f0 compositor: move output assignment to update_transform
Move the call to assign an output from weston_surface_configure() to
weston_surface_update_transform().

As update_transform takes new geometry into use, it should also reassign
the output for the surface, but only if an output was already assigned.

Add explicit assing output calls to where we relied on
weston_surface_configure() unconditionally assigning the output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:50:27 +02:00
Pekka Paalanen
730d87e6a6 compositor: move opaque tracking into transform
Move the surface opaque region setup from weston_surface_configure() to
weston_surface_update_transform(), so we have less reason to call
update_transform from configure. Opaque region depends on geometry,
after all.

Also move the opaque field from weston_surface to
weston_surface::transform to make this obvious.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
b45ac5eada compositor: clarify update_transform vs. repaint
Remove redundant weston_surface_update_transform() calls from within
output repaint paths, and add a comment that we need to rely on
surface->geometry.dirty == 0 within the repaint sub-functions.

Now that weston_surface_update_transform() does damage as needed, and
weston_output_repaint() explicitly calls update_transform, we can reduce
the updates in rotate_grab_motion() to simply scheduling a repaint. This
will guarantee that the change in rotation ends up on screen ASAP.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
9651678070 compositor: let update_transform deal damage
weston_surface_update_transform() is similar to
weston_surface_configure() in that it changes the surface region on
screen. Unlike configure, update_transform forgets to deal damage at
all, yet it is the only place where we can do damage_below() as needed.

Add a damage_below call to deal damage for the old surface region only
when needed. This uses the cached state from surface->transform to get
the old region.

Add a damage call to deal damage for the new surface region, after
updating the cached state.

Add a repaint call, since we have changed the scene and should render it
out.

This change fixes the rotation not updating the screen properly.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
1d5035c705 compositor: simplify weston_surface_damage_rectangle()
The non-transformed case looked a little odd, calling
weston_surface_to_global(), since it already tests for transform.enabled
and simply uses width, height for the box.

Streamline it, by open-coding weston_surface_to_global(), and avoiding
another call into weston_surface_update_transform(). This way it does
not look suspicious to me.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
219b982ed0 compositor: use floats in computing bounding box
In surface_compute_bbox(), call surface_to_global_float() instead of
weston_surface_to_global(). This avoids the recursion:

weston_surface_update_transform()
  weston_surface_update_transform_enable()
    surface_compute_bbox()
       weston_surface_to_global()
         weston_surface_update_transform()

which might be non-obvious when reading the code.

Computing the min and max coordinates in floats, we can have a tight
rounding margin by using floor() and ceil().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
ece8a016aa compositor: move surface_to_global_float() definition
Move surface_to_global_float() definition earlier in the file. No code
changes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
80fb08dc66 compositor: split weston_surface_update_transform()
Split two helper functions out of weston_surface_update_transform() to:
- make the code clearer
- update the bounding box properly even if transformation fails
- unify the return point

Also add a comment on what matrix.d[12] is.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
9abf393bd8 compositor: split weston_surface_damage_below()
Extract the core into a function that does not call
weston_surface_update_transform() or schedule repaint.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:55 +02:00
Pekka Paalanen
25dacab718 shell: remove excessive damage from rotating
Rotating a surface should not force a full display repaint, so remove
that.

This change exposes a bug: weston_surface_update_transform() does not
apply damage, but it does change surface geometry. While you rotate a
surface, repaints do not work.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:55 +02:00
Kristian Høgsberg
aded1f6823 compositor: Don't destroy sprite surface, just hide it 2012-02-08 16:33:57 -05:00
Kristian Høgsberg
9b8a82bf6d Merge remote-tracking branch 'pq/transform-fixes2' 2012-02-07 11:08:03 -05:00
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