Commit Graph

373 Commits

Author SHA1 Message Date
Kristian Høgsberg 16333ab0ab compositor: Remove compositor->seat
Get rid of this quick-and-dirty assumption.
2012-08-10 10:08:21 -04:00
Kristian Høgsberg 99fd1015d0 compositor: Drop output->flags
All outputs are EGLSurface based so we can drop this detail now.
2012-08-10 09:58:02 -04:00
Pekka Paalanen d525b564ae compositor: format check for weston_log arguments
Add gcc format check attribute to the weston_log() and
weston_log_continue() functions.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-09 10:27:28 -04:00
Kristian Høgsberg 982387011f compositor: Add weston_surface_schedule_repaint() for limited repaint
In cases where we know the surface bounding box doesn't change in the
next frame, we can limit redraws to only the outputs the surface is
currently on.  We could do even better by forcing the transform
update so we know where the surface will be in the next frame, but
this is a much simpler first step.
2012-08-03 16:36:52 -04:00
Kristian Høgsberg 79af73e313 compositor-drm: Disable planes when zoomed or capturing
When the entire output is transformed or we're capturing the output
for screenshot or video, disable all output specific overlays
(drm planes, hw cursors etc) and move all surfaces into the primary
plane.
2012-08-03 16:33:42 -04:00
Kristian Høgsberg 65a11e1039 compositor: Accumulate damage per plane
When we analyze and accumulate damage prior to repainting, we need to
accumulate damage per plane, so that whatever damage a surface
contributes is accumulated in the plane that it's assigned to.  Before,
we would always accumulate damge in the primary plane, which caused
repaints in the primary plane whenever a surface in a sprite or
framebuffer was damaged.  Eliminating this repaint is a big win for
cases where we pageflip to a client surface or use a sprite overlay.

This also prepares for fixing the missing cursor updates, since we
now track damage to the cursor surface in a dedicated sprite plane.
2012-08-03 11:30:21 -04:00
Rob Bradford 0fb797596a compositor: Use uint32_t for the msecs value consistently 2012-08-02 11:06:44 -04:00
Kristian Høgsberg 64eca8949b compositor: Fold the log prototypes into compositor.h and drop log.h
We're trying to keep the API exposed by the core compositor in compositor.h
2012-08-01 00:00:57 -04:00
Pekka Paalanen 56464253c0 compositor: rework touch focus
In the wl_seat conversion, struct wl_touch got fields for the focused
surface and the client resource for the input device being focused.
However, the conversion was incomplete: the old fields
weston_seat::touch_focus* we still used by the event dispatching code,
but the new code never set them. Therefore no touch events were ever
sent.

From weston_seat, remove the fields touch_focus, touch_focus_listener,
touch_focus_resource, and touch_focus_resource_listener. They are
replaced by the corresponding fields and listeners from struct
wl_touch.

While doing this, fix touch_set_focus().

If touch_set_focus() was called first with surface A, and then with
surface B, without being called with NULL in between, it would corrupt
the destroy_signal list. It was equivalent of calling wl_signal_add()
for different signal sources with the same listener without removing in
between.

Now, touch_set_focus() first removes focus and listeners, and then
attempts to assign focus if requested. If the target client has not
subscribed for touch events, the touch focus will now be NULL.
Before this patch, the touch focus was left to the previous surface.

NOTE: this patch depends on the patch "server: add lose_touch_focus()"
for Wayland.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Kristian Høgsberg 7b884bc0de compositor: Use a minimal restore handler for crash clean up
When we hit a segv, it's often the case that we might crash again in
the attempt to clean up.  Instead we introduce a minimal restore callback
in the backend abstraction, that shuts down as simply as possible.  Then
we can call that from the segv handler, and then to aid debugging, we
raise SIGTRAP in the segv handler.  This lets us run gdb on weston from
a different vt, and if we tell gdb

  (gdb) handle SIGSEGV nostop

gdb won't stop when the segv happens but let weston clean up and switch vt,
and then stop when SIGTRAP is raised.

It's also possible to just let gdb catch the segv, and then use sysrq+k
followed by manual vt switch to get back.
2012-07-31 14:32:01 -04:00
Gwenole Beauchesne 28f59b027a compositor: handle YUV buffers.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-10 15:57:01 -04:00
Gwenole Beauchesne faf91854a8 compositor: add YUV shaders.
Add shaders for NV12 (2 planes), YUV (3 planes) and YUYV (sampled as 2 planes)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-10 15:54:17 -04:00
Gwenole Beauchesne 6d0304904c compositor: factor out RGB shader.
Simplify RGB shader code and split off common code that could be reused.
This is preparatory work for YUV shaders.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-10 15:44:33 -04:00
Gwenole Beauchesne 023f855f8d compositor: prepare for multi-planar surfaces.
Make weston_surface::texture and ::surface an array, while keeping
[0] for RGB surfaces.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-10 15:44:33 -04:00
Kristian Høgsberg 73694c832b compositor: Move repaint debug binding to mod-shift-space
Alt-space or Super-space are too likely to conflict with application
bindings.
2012-06-28 14:13:10 -04:00
Kristian Høgsberg 8150b190d6 shell: Take a wl_surface as parent for transient and popup windows 2012-06-27 10:24:22 -04:00
Kristian Høgsberg af7b1ffaf4 shell: Make panel just a wl_surface too 2012-06-27 10:24:21 -04:00
Daniel Stone 725c2c3d68 Split weston_compositor_init into base and _gl
weston_compositor_init is always called late because most
implementations can't initialise GL until fairly late in the game.
Split it into a base version with the same name, followed by
weston_compositor_init_gl which can be called later on.

This simplifies compositor-wayland, which no longer needs a separate
global handler just for wl_seat.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 11:52:08 -04:00
Daniel Stone 05d58682b3 Rename modifier_state_changed to notify_modifiers
notify_modifiers will now synchronise Weston's internal state with the
XKB state, and send a modifier event if necessary.  This eliminates the
need for update_modifier_state to have a return value at all.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 11:52:07 -04:00
Daniel Stone 1b4e11f38e notify_key: Add update_state argument
If update_state is true, then notify_key will continue to call
xkb_key_update_state to update the local state mask, as before this
commit.  Otherwise, it will rely on the compositor to manually update
the state itself, for nested compositors.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 11:52:07 -04:00
Daniel Stone abb9dcdd1f weston_xkb_info: Cache all modifier indices for X11
X11 has a set of eight modifiers which we want to represent.  Cache
their indices when we create a weston_xkb_info, so we can use this from
compositor-x11 to keep the state synchronised exactly between the host X
server and a nested Weston instance.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 11:52:06 -04:00
Daniel Stone 71c3877a40 Let wayland-server send modifier events for focus
When the focus changes, wl_keyboard_set_focus (and, as an added bonus,
wl_pointer_set_focus) will now send wl_keyboard::modifier events for us
if we store the modifier state in the right place, so we don't have to
worry about that anymore.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 11:52:05 -04:00
Daniel Stone d6da09e935 Split notify_keyboard_focus into in/out variants
Since the two functions had nothing in common but the local variables.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 11:52:05 -04:00
Kristian Høgsberg 1ce6a2a2b3 shell: Animate input panel mapping
We slide it in from below.
2012-06-21 22:34:39 -04:00
Kristian Høgsberg 414bd420fd util: Generalize surface animation code
Too much duplicated code here, and we're about to introduce another
animation.
2012-06-21 22:07:30 -04:00
Jan Arne Petersen 1f17be442e text: Add input_method and text_model interfaces 2012-06-21 16:41:09 -04:00
Jan Arne Petersen 42feced8de shell: Add support for input panels 2012-06-21 16:41:06 -04:00
Kristian Høgsberg 49952d1f12 compositor: Introduce weston_output_schedule_repaint()
This lets us schedule a repaint on just the output that needs it.
2012-06-20 00:38:20 -04:00
Kristian Høgsberg 70b8358aa0 compositor: Remove weston_read_pixels functionality
We can just do glReadPixels from the frame signal instead now.
2012-06-20 00:07:52 -04:00
Kristian Høgsberg e9d0492419 compositor: Emit frame_signal from weston_output_do_read_pixels()
This is the point where we have just finished rendering the new scene
but before we swap it to the front buffer.  At this point, the
output->previous_damage region exactly corresponds to what was just
renders, as compared to previous frame.
2012-06-19 23:54:26 -04:00
Kristian Høgsberg d553bfc127 compositor: Track which plane a surface is on
We start tracking which hardware plane a surface is displayed on, which
lets us avoid generating damage when a hardware overlay/cursor is moved
around.
2012-06-18 22:37:35 -04:00
Kristian Høgsberg 4ff5a7408a compositor: Don't export weston_compositor_repick()
Picking is tied into the repaint loop and shouldn't happen outside
weston_output_repaint(), so don't export weston_compositor_repick().
2012-06-18 16:48:27 -04:00
Kristian Høgsberg 362b672111 Rename weston_compositor EGLDisplay member to egl_display
EGLDisplay is helpfully typedeffed as void *, which means that you won't
get conflicting-pointer-type warnings if you accidentally confuse it
with weston_compositor::wl_display.  Rename it to make it more clear
which display you're dealing with, and also rename compositor-wayland's
parent.display member to parent.wl_display.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-18 15:13:51 -04:00
Scott Moreau 429490df1a Move zoom code to its own file. 2012-06-18 11:07:07 -04:00
Scott Moreau 8dacaaba1b Animate transitions for zoom focus point change.
Handle the transition when focus changes from text cursor to
mouse pointer or vice versa.
2012-06-18 11:07:03 -04:00
Ander Conselvan de Oliveira 37ffc3c14b compositor: Track pointer image protocol change
The request pointer.attach was replaced with pointer.set_cursor that
lets a client set the cursor surface for a given pointer.
2012-06-15 10:59:41 -04:00
Jonas Ådahl db7737609c compositor: Buffer all frame callbacks in 'weston_surface'
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-06-12 20:20:14 -04:00
Scott Moreau e6603981da Implement animated transitions for zoom in/out. 2012-06-11 23:45:25 -04:00
Scott Moreau d64cf21246 Add frame_counter to weston_animation. 2012-06-11 09:33:06 -04:00
Scott Moreau 9d1b1125fd Move animation_list to weston_output. 2012-06-11 09:32:47 -04:00
Kristian Høgsberg b2af93ef8c compositor: Drop weston_surface_to_global()
Just always call weston_surface_to_global_float() instead.
2012-06-07 20:10:23 -04:00
Kristian Høgsberg 361039820b compositor: Drop brightness and saturation features in the shader 2012-06-05 10:15:56 -04:00
Scott Moreau ae71220fc9 Convert text cursor position protocol to use fixed types. 2012-06-04 11:07:50 -04:00
Kristian Høgsberg a7ceafff9c compositor: Add a clipboard manager
We use the selection signal to get a callback when somebody sets a
selection (including the X server proxy) and then copy the contents
of the first mime type.  If the selection is cleared (when the client
dies), we set a new selection with that contents.
2012-06-03 22:54:36 -04:00
Daniel Stone b7452fe313 Add support for wl_keyboard::keymap events
These keymap events communicate the keymap from the compositor to the
clients via fd passing, rather than having the clients separately
compile a map.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-01 11:14:51 -04:00
Daniel Stone c1be8e59de Pass config_file through to weston_compositor_init
This allows us to do config parsing there.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-01 11:14:38 -04:00
Daniel Stone baf4359285 Pass argc and argv through to weston_compositor_init
Allowing it to do option parsing as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-01 11:14:28 -04:00
Daniel Stone bb1df6a7c1 Add keymap argument to weston_seat_init_keyboard
This allows backends to generate their own keymaps and pass them in for
use rather than always forcing a single global keymap, which is
particularly useful for nested compositors.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:50:42 -04:00
Daniel Stone d65b909778 Move keymaps to weston_seat
In practice this doesn't mean much right now, since they all just take
an extra reference on the global keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:49:54 -04:00
Daniel Stone e379da9532 Separate out weston_xkb_info struct
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:49:09 -04:00
Daniel Stone 74419a2237 Split weston_seat_init up into pointer/keyboard/touch
So we don't unnecessarily advertise interfaces the seat doesn't support.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:47:41 -04:00
Daniel Stone 0c1e46eb18 Use wl_fixed_t for axis bindings
In preparation for axis values being wl_fixed_t in the protocol as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:45:20 -04:00
Daniel Stone 325fc2d53a Split bindings into separate key/button/axis bindings
Rather than attempting to have the one handler prototype everywhere.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:45:16 -04:00
Daniel Stone 878f0b77a8 Convert notify_axis to wl_fixed_t
In preparation for the rest of the axis code changing.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:45:08 -04:00
Daniel Stone c9785eacca Use enum wl_keyboard_key_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_keyboard_key_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:43:03 -04:00
Daniel Stone 4dbadb1556 Use enum wl_pointer_button_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:42:47 -04:00
Daniel Stone 8c8164faeb Add core LED handling
Similar to how we deal with modifiers, also add LED handling to the core
input code, with a callout into the backends to update them when they
change.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:38:50 -04:00
Daniel Stone e3f15edc2f Do binding modifier lookup on XKB state, not physical keys
When we update the modifier_state used for Weston bindings, derive this
from the XKB modifier state, rather than a hardcoded mapping of physical
keys to modifier state.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:38:10 -04:00
Daniel Stone 994679a20e Move xkb_state object to weston_seat
As we need to keep a separate state for every seat (i.e. keyboard
interface) rather than a compositor-global state.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:28:32 -04:00
Daniel Stone 496ca17a77 Convert Weston modifier #defines to an enum
To avoid any possible collision between the disparate XKB and Weston
modifier namespaces.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:28:23 -04:00
Daniel Stone 351eb61fbc Support wl_keyboard::modifiers event
This event lets the compositor inform clients of the canonical keyboard
modifier/group state.  Make sure we send it at appropriate moments from
the compositor, and listen for it in clients as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:27:47 -04:00
Scott Moreau 7a1b32a198 Implement text cursor position protocol.
Here we create a new client/compositor interface in weston to allow
clients to report their x/y cursor position to the compositor. These
values are then used to center the zoom area on this point. This
is useful for everyone, especially people who are visually impaired.
2012-05-31 13:10:22 -04:00
Kristian Høgsberg 5fb70bf301 Add screen recorder tool
This commit adds a new, built-in screen recorder tool.  The tool UI is
still very simple, start with mod-r and stop it again with mod-r.
The recording is written to capture.wcap, in a simple run-length encoded
adhoc format.  The wcap-decode tool can be used to extract a single frame
from the capture, for now, but the plan is to hook this up to libvpx and
generate webm output.
2012-05-24 12:29:46 -04:00
Kristian Høgsberg c1693f209a xwm: Implement resizing by frame borders 2012-05-22 16:56:23 -04:00
Kristian Høgsberg a61ca06b49 xwm: Add window resize support 2012-05-22 16:05:52 -04:00
Scott Moreau 850ca42b9b Restructure output zoom.
A quick clean-up of zoom to prepare for the other patches in this series.
2012-05-22 12:58:47 -04:00
Kristian Høgsberg 45ba869ff3 shell: Make create_shell_surface() just return the shsurf 2012-05-21 17:03:16 -04:00
Kristian Høgsberg a416fa15d5 xwm: Switch alpha, brightness and saturation to GLfloat 2012-05-21 17:03:06 -04:00
Tiago Vignatti 491bac19c7 shell: Expose set_transient in shell interface 2012-05-18 16:37:43 -04:00
Kristian Høgsberg 938b8fa3c2 shell: Expose surface move functionality in shell interface 2012-05-18 13:47:15 -04:00
Kristian Høgsberg d6ad122d9a compositor: Disable blending for WL_SHM_FORMAT_XRGB8888 surface
Will it blend?  No.
2012-05-17 11:11:15 -04:00
Kristian Høgsberg 0b0c2bb3e9 compositor: Add opaque rect shader feature
This lets us mark a rectangle in a texture and force the alpha to one
inside.  This is useful for textures coming from X windows, where the X
window part is xRGB, that is 32 bit RGB with an undefined alpha channel
and the decorations are rendered with a well-defined alpha channel.
2012-05-16 16:00:41 -04:00
Daniel Stone 37816df646 Convert wl_input_device to wl_seat (and friends)
wl_input_device has been both renamed and split.  wl_seat is now a
virtual object representing a group of logically related input devices
with related focus.

It now only generates one event: to let clients know that it has new
capabilities.  It takes requests which hand back objects for the
wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all
provide the old input interface, just under different names.

This commit tracks these changes in weston and the clients, as well as
similar renames (e.g. weston_input_device -> weston_seat).  Some other
changes were necessary, e.g. renaming the name for the visible mouse
sprite from 'pointer' to 'cursor' so as to not conflict.

For simplicity, every seat is always exposed with all three interfaces,
although this will change as time goes on.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-16 15:29:06 -04:00
Kristian Høgsberg c2d16000b9 compositor: Remove a few leftover screenshooter declarations 2012-05-14 15:23:57 -04:00
Kristian Høgsberg e11bbe4cc8 compositor: Use wl_fixed_t for incoming input events
This changes notify_motion, notify_pointer_focus and notify_touch to take
wl_fixed_t types for input coordinates.
2012-05-09 12:19:04 -04:00
Daniel Stone d42f457b66 Load an XKB keymap and state in the compositor
Not used yet, but will be in future commits.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 16:04:24 -04:00
Daniel Stone 855028fec9 Add xkb_names member plus config + X11 support
Add an xkb_names member to the base compositor info which contains the
RMLVO to use when building an XKB keymap.  Add support for filling this
from the config file or from the underlying X11 server, with the usual
defaults.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 16:02:48 -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
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 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
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
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
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
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 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
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 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
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 eae5de7609 Follow wayland change to serial numbers 2012-04-11 22:42:15 -04: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
Kristian Høgsberg 5d1c0c58ad drm: Add vt switch keybindings 2012-04-10 00:35:09 -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 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
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 3448616bc3 Remove weston_shell map and configure function pointers 2012-03-29 13:08:32 -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 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 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 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
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
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 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
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 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
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 6ddcdaeb98 compositor: Store opaque clip for previous frame in weston_surface 2012-03-01 12:47:23 -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
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
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 66617bb19d compositor: Remove unused compositor vfunc create_cursor_image 2012-02-23 21:29:55 -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 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 5e7e6f2a22 compositor: Implement opqaue and input regions 2012-02-23 16:14:27 -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 1cbf3262dd compositor: Move fullscreen_output to shell_surface 2012-02-17 23:49:07 -05:00
Kristian Høgsberg 101cb6560c compositor: Get rid of surface->visual 2012-02-17 10:45:16 -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
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
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
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
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
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 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 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 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
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 60921e5787 compositor: move weston_surface::width,height into geometry
weston_surface::transform.boundingbox depends on width and height, and
therefore geometry.dirty flag, so move width and height into geometry.

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

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

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

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

Also add the missing dirty flags.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Add a stub for the 4x4 matrix inversion function.

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

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

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

The existing transformation users (only zoom) are converted.

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

Cc: Juan Zhao <juan.j.zhao@linux.intel.com>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:43:49 +02:00
Kristian Høgsberg 681f9f4149 compositor: Keep fade surface around while we're fading
This removes more special cases from weston_output_repaint() and we
avoid creating and destroying the surface for each animation frame.
We gain another special case in weston_compositor_top(), but that's
less of a problem, and we'll fix that later.
2012-01-26 10:59:33 -05:00
Kristian Høgsberg 46e64ee3e1 compositor: Drop unused saved_texture surface field 2012-01-26 09:28:42 -05:00
Kristian Høgsberg a82c4860a1 compositor: Compute overlapped early and base hw cursor decision on that 2012-01-26 01:03:58 -05:00
Kristian Høgsberg 9f404b7ac8 compositor: Move tracking of scanout buffers to compositor-drm 2012-01-26 00:11:01 -05:00
Kristian Høgsberg 5f5e42ef50 compositor: Remove prepare_scanout_surface callout
For the drm backend, we just refactor setup_scanout_surface into
drm_output_prepare_scanout_surface and call it from drm_output_repaint.
2012-01-25 23:59:44 -05:00
Kristian Høgsberg 06cf6b0238 compositor: Pull prepare_render and present callouts into repaint
This dramatically simplifies the backend repaint abstractions and paves
the way for moving overlay and cursor setup into the backend.
2012-01-25 23:47:45 -05:00
Kristian Høgsberg 68c479af05 compositor: Move repaint loop into a backend function
We've trimmed down the actual repaint loop to just iterating through the
surface list and calling weston_surface_draw(), so we push that to the
backend without too much code duplication.
2012-01-25 23:32:28 -05:00
Kristian Høgsberg 0763262e3d compositor: Move shader setup to weston_surface_draw() 2012-01-25 23:02:06 -05:00
Kristian Høgsberg 765bcdf1fa compositor: Compute whether or not a surface is overlapped 2012-01-25 22:20:30 -05:00
Kristian Høgsberg 8e81df4503 Use new format codes 2012-01-11 14:24:46 -05:00
Kristian Høgsberg dade64968c Move wl_data_device implementation to wayland-server 2012-01-06 11:28:53 -05:00
Kristian Høgsberg 9ddb826077 Use new grab api 2012-01-05 11:00:01 -05:00
Kristian Høgsberg a33d0c38d2 data-device: Use a listener list to decouple the x11 selection bridge 2012-01-03 23:01:47 -05:00
Kristian Høgsberg 82d9ee929b data-device: Handle source going away instead of ref-counting it
We have to deal with the data source going away.  Even if we have a
reference to the server side data source, we can't do anything if the
client that provided the source went away.  So just NULL the offers
source pointer in the destroy callback for the source.
2012-01-03 14:11:18 -05:00
Kristian Høgsberg 3466bc8042 Merge remote-tracking branch 'pq/compositor-dtors-v1'
This collided with the big weston rename, but git did a good job of fixing
most cases.

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

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

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

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