Commit Graph

373 Commits

Author SHA1 Message Date
Ander Conselvan de Oliveira 012b4c78c9 compositor: Implement buffer transformation
Implement the wl_surface.set_buffer_transform request. This includes
tracking the double-buffered buffer transformation parameter and making
the gl renderer able to handle transformed buffers.
2012-11-27 11:29:31 -05:00
Ander Conselvan de Oliveira b8fcca915b compositor: Move buffer damage fields from weston_output to gl-renderer
Move fields current_buffer and buffer_damage out of weston_output into
gl_output_state, since they are actually specific to the renderer.

Also bring back the previous_damage field so that the screenshooter
can get the damage for the previous frame in a renderer independent
way.
2012-11-16 19:00:03 -05:00
John Kåre Alsaker 30d2b1fd4b Move EGL and GL includes to a gles2-renderer header. 2012-11-13 17:03:47 -05:00
John Kåre Alsaker 320711db0a Move weston_compositor GL and EGL state into gles2-renderer. 2012-11-13 17:03:33 -05:00
John Kåre Alsaker 75cc571839 Move weston_surface GL and EGL state into gles2-renderer. 2012-11-13 17:03:08 -05:00
John Kåre Alsaker 4068414a32 Moved shader state into gles2-renderer. 2012-11-13 17:02:38 -05:00
John Kåre Alsaker 878f44969d compositor: Move surface color state to gles2-renderer.
This moves the surface color state into gles2-renderer. To do this it
adds two new weston_renderer functions. create_surface to be able to
create per-surface renderer state, and surface_set_color to set the
color of a surface and changes it to a color surface.
2012-11-13 17:01:59 -05:00
John Kåre Alsaker f9e710b57c screenshooter: Use the renderer function for reading out pixels
This also changes the compositor's read_format to a pixman format.
2012-11-13 17:01:02 -05:00
John Kåre Alsaker a95b2d6d41 compositor: Add a renderer function to read out pixels 2012-11-13 17:00:06 -05:00
John Kåre Alsaker 4415450ef1 Move compositor-wayland border drawing into gles2-renderer. 2012-11-13 16:59:01 -05:00
John Kåre Alsaker 1b7ad160a3 Move EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.
This moves the EGLConfig, EGLContext and EGLDisplay fields into
gles2-renderer. It also moves EGLDisplay creation and EGLConfig
selection into gles2-renderer.
2012-11-13 16:56:28 -05:00
John Kåre Alsaker 94659274b4 Move weston_output EGL state into gles2-renderer.
This introduces callbacks for output creation and destruction for the
gles2-renderer. This enables the gles2-renderer to have per-output
state. EGL surface creation is now done by the output_create callback
and the EGL surface is stored in the new per-output gles2-renderer
state. On the first output_create call, the gles2-renderer will setup
it's GL context. This is because EGL requires a EGL surface to be able
to use the GL context.
2012-11-13 16:30:27 -05:00
Pekka Paalanen bcdd579a58 gles2: update texture only if needed
When a surface is on a non-primary plane (overlay), we do not need to
keep the GL texture up-to-date, since we are not using it. Avoid calling
glTex(Sub)Image2D in that case, and accumulate the texture damage
separately.

This is especially useful for backends, that can put wl_shm buffers into
overlays.

The empty damage check has to be moved from surface_accumulate_damage()
into gles2_renderer_flush_damage(), because it really needs to check the
accumulated damage, not only the current damage. Otherwise, if a surface
migrates from a plane to the primary plane, and does not have new
damage, the texture would not be updated even for accumulated damage.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-08 16:56:26 -05:00
Ander Conselvan de Oliveira 27508c2045 gles2: Add a debug binding for highlighting shaded content
Pressing mode-shift-space s will cause the fragment shaders to be
recompiled, adding a green tint to all composited content.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira c509d2b152 compositor: Add debug key bindings infrastructure
Add the concept of debug key bindings, that are bindings that activate
debug features in the compositor. The bindings are added to a list in
the compositor, but the triggering them is left to the shell.

On the shell side, a global debug key binding is added. When the user
presses mod-shift-space, the shell will invoke the debug bindings based
on the next key press.

This also converts the debug shortcuts for repaint debugging, fan
repaint debugging and the hide overlays shortcut in compositor-drm to
use the new infrastructure.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira 11f8d403a8 Add a headless backend
Add a headless backend and a noop renderer, mainly for testing
purposes. Although no rendering is performed with this backend,
this allow some of the code paths inside Weston and shm clients
to be tested without any windowing system or any need for drm
access.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira 4bcf3a5fce compositor: Fix culling of repaints behind opaque surfaces
Culling of the repaint of a surface behind an opaque surface on the
same plane was broken by commit 547149a9 [1]. The idea of that commit
is that the damage obscured by an overlay would remain on the primary
plane damage and be repainted when the overlay moved. However, in the
case the two surfaces are on the same plane, the opaque one is not
obscured, so it ends up being repainted.

This commit adds an opaque field to struct weston_plane, that is built
incrementally when accumulating damage. The opaque region of surfaces
on the same plane are removed from the plane's damage, restoring the
previous culling behavior. But since damage behind opaque region of
other planes is maintained, the bug solved in the mentioned commit is
not regressed.

https://bugs.freedesktop.org/show_bug.cgi?id=56537
2012-10-31 13:37:01 -04:00
Kristian Høgsberg 8c31a4c025 Define our own container_of as well
Don't rely on libwayland-client/server to define this for us.
2012-10-19 23:05:37 -04:00
Kristian Høgsberg 5717b6dbf1 Stop relying on ARRAY_LENGTH being defined in wayland-util.h
Time to break a bad habit.
2012-10-19 17:12:38 -04:00
Pekka Paalanen bc10638cd9 compositor, clients: apply wl_surface.frame on commit
Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.

This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.

Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.

compositor-wayland assumes renderer->repaint_output does a commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:39:11 -04:00
Pekka Paalanen 0cbd3b5059 compositor, clients: double-buffer input region
Make input region double-buffered as specified in the new protocol.

While doing it, get rid of the undef region code, and instead use a
maximum sized real pixman region. This avoids special-casing regions
that might sometimes be undef.

As the input region is now usable by default instead of undef,
weston_surface_update_transform() does not need to reset the input
region anymore.

weston_surface_attach() no longer resets the input region on surface
size change. Therefore, also weston_seat_update_drag_surface() does not
need to reset it.

Update toytoolkit to set input region before calling wl_surface_commit()
or swapBuffers (which does commit).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:44 -04:00
Pekka Paalanen 512dde8ce9 compositor, clients: double-buffer opaque region
Make wl_surface.set_opaque_region double-buffered as required by the new
protocol. Also, do not reset the opaque region on surface size changes
anymore. Only explicit requests from the client will change the region
now.

In clients, make sure commit happens after setting the opaque region.

Mesa does not need a fix, as it never touches the opaque region.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:40 -04:00
Pekka Paalanen 8e159180cc compositor, clients: make damage double-buffered
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".

Implement double-buffering of damage in the compositor as required by
the new protocol.

Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().

Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:31 -04:00
Pekka Paalanen 5df44de6a9 compositor: make wl_surface.attach double-buffered
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".

Clients are now required to issue wl_surface.commit for the
wl_surface.attach to take effect.

While changing this, change the surface argument to
weston_surface_attach() from wl_surface into weston_surface, for
consistency.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:00 -04:00
John Kåre Alsaker 490d02a96d weston: Use float instead of GLfloat. 2012-10-04 12:27:21 -04:00
Tiago Vignatti 1d01b01318 compositor: Add kill signal
For now it's being emitted only on the desktop shell kill binding.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-10-04 11:06:37 -04:00
Kristian Høgsberg b9af479f02 compositor: Make weston_surface_assign_output() static
This is now done as part of weston_surface_update_transform().
2012-09-25 14:48:04 -04:00
Ander Conselvan de Oliveira 8ea818fb00 compositor: Generalize output previous damage into per buffer damage
This is a more generic fix for the issue solved in 4f521731 where
damage obscured by overlays could be lost in one of the output buffers
due to rapid move of a surface in an overlay plane.

This changes the renderer so it keeps track of the damage in each
buffer. Every time a new frame is drawn, the damage of the frame is
added to all the buffers and the rendered regions are cleared from
the current buffer's damage.
2012-09-14 13:40:08 -04:00
Philipp Brüschweiler b13b9ff90a text: Have only one text_model_factory
Have only one text_model_factory instead of one per seat.

This commit also introduces destruction of an input method when the
corresponding seat is removed.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:33:12 -04:00
Kristian Høgsberg 33a45f5b6d compositor: Drop unused wl_shm field 2012-09-11 14:07:19 -04:00
Kristian Høgsberg b00a9d3cb9 compositor: Make all non-backend modules use module_init() as entry point 2012-09-11 14:06:27 -04:00
Kristian Høgsberg dd1b3f4c1b compositor: Remove unused 'fbo' field from weston_compositor 2012-09-10 20:37:48 -04:00
Kristian Høgsberg 4226385e53 compositor: Destroy gles2 resource for weston_surface in gles2-renderer.c
This moves the last gles2 call out of compositor.c.
2012-09-06 21:59:33 -04:00
Kristian Høgsberg 3a0de88abf compositor: Move unbind_display call into gles2-renderer.c 2012-09-06 21:44:24 -04:00
Kristian Høgsberg fa1be023a2 compositor: Introduce a weston_renderer object
Move the gles2 render functions to vfuncs on the renderer object.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg b7b77e6f8f compositor: Move EGL/GLES2 parts of weston_surface_attach to gles2-renderer.c 2012-09-06 21:08:13 -04:00
Kristian Høgsberg b1fd2d6dd8 compositor: Move update_shm_texture() to gles2-renderer.c
We rename it flush_damage() as it's the point where we update our rendering
API source (eg, the gles2 texture) according to the accumulated damage,
if necessary.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg 25894fc920 compositor: Move gles2 initialization to gles2-renderer.h 2012-09-06 21:08:13 -04:00
Kristian Høgsberg ecf6edec1f compositor: Move surface repaint code to gles2-renderer.c 2012-09-06 21:08:12 -04:00
Kristian Høgsberg d7c172648d compositor: Consolidate output repaint logic
We move the EGL and GLES2 output repaint code into a new gles2-render.c
file.  The eglMakeCurrent, glViewPort, surface loop etc was duplicated
across all backends, but this patch moves it to a new file.
2012-09-06 21:08:12 -04:00
Pekka Paalanen 4f9c07bf11 xwayland: replace opaque_rect, fix an alpha problem
Remove weston_surface::opaque_rect completely.

Instead, set the opaque region in xwayland.

Before this patch, black text in xterm was transparent. Now it is not.

However, this patch fixes only a part of the alpha problem. If you apply
full-surface alpha with super+alt+wheel, the problem reappears. This
problem is still due to bad alpha channel contents on xwayland windows.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-04 16:14:29 -04:00
Pekka Paalanen 07c91f8371 compositor: triangle fan debug
Draw the borders of all the triangles.

v1: original
v2: add keybinding to enable/disable fan debug (super-alt-space),
    cycle colors to make it easier to see individual draws, and
    redraw undamaged region to clean up previous frames debug
    lines

Signed-off-by: Rob Clark <rob@ti.com>
2012-08-31 17:52:01 -04:00
Pekka Paalanen 6b5585be0d compositor: specialised fragment shader for RGBX
Remove the weston_surface::blend attribute, which really meant that the
texture produced valid alpha values. This was used to override the opaque
region for RGBX surfaces, which produce undefined values for alpha.

Instead, compile a new shader especially for RGBX surfaces, that
hardcodes the sampled alpha as 1.0.

Before "compositor: optimize/simplify shaders" there was a 'vec4 opaque'
in the shaders, that would cause part of the texture to be forced to
alpha=1.0. Now that is gone, and we need this replacement.

To test: launch simple-shm, and use the super+alt+mousewheel combination
to make it transparent. It should not show a light cross over the window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-31 17:51:54 -04:00
Rob Clark 0e5a2d0219 compositor: simplify shaders
Re-work how the shaders and emitted vertices work.  Rather than always
rendering clip-rect sized quads and doing transformation in tex coords
(and requiring the corresponding clipping in frag shader), instead
emit transformed vertices, clipped wrt. dirty region, and use simpler
frag shaders.  Also, split the rendering, so blended surfaces with an
opaque region have the opaque region drawn with blend disabled.  The
result is considerably fewer pixels drawn with blend enabled, and much
fewer cycles in the frag shader.

This requires having some more complex logic to figure out the vertices
of the shape which forms the intersection of the clip rect and the
transformed surface.  Which has perhaps got a few bugs or missing cases,
still (visual glitches in some cases) but at this point more or less is
starting to work.  I think it is at least far enough along to get some
initial review.

The result, on small SoC GPU (omap4/pandaboard) on 1920x1080 display,
for simple stuff like moving windows around, I get 60fps (before 30fps
or less), and pushing YUV buffers for hw decoded 1080p video goes from
~6fps to 30fps, with no drop in framerate for transformed/rotated video
surface.

v1: original
v2: check that perpendicular intersect vertex falls within bounds of
    transformed surface
v3: update w/ comments and fixes from Pekka Paalanen
v4: fix for full surface alpha from Pekka Paalanen, fix compositor-
    wayland build

Signed-off-by: Rob Clark <rob@ti.com>
2012-08-31 17:51:50 -04:00
Rob Clark e3b9591513 compositor: add support for OES_EGL_image_external
In cases where the GPU can natively handle certain YUV formats,
eglQueryWaylandBufferWL() can return the value EGL_TEXTURE_EXTERNAL_WL
and the compositor will treat the buffer as a single egl-image-external.

See:
http://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt

v1: original
v2: rename EGL_TEXTURE_EXTERNAL_OES -> EGL_TEXTURE_EXTERNAL_WL and query
    for the extension
v3: fix build without updated mesa headers, if EGL_TEXTURE_EXTERNAL_WL
    #define is missing from older mesa headers.
v4: resend without missing parts

Signed-off-by: Rob Clark <rob@ti.com>
2012-08-31 17:51:42 -04:00
Scott Moreau 1bad5db9d6 Implement output transformations.
This patch allows rotation and mirroring outputs for x11 and drm backends.
A new 'transform' key can be set in the [output] section. From the protocol:

"The flipped values correspond to an initial flip around a vertical axis
followed by rotation."

The transform key can be one of the following 8 strings:

normal
90
180
270
flipped
flipped-90
flipped-180
flipped-270
2012-08-29 14:39:13 -04:00
Scott Moreau 243f59f5bb Remove unused enum. 2012-08-16 10:23:54 -04:00
Jan Arne Petersen e829adc514 text: Assign text_model to a wl_seat
Add a wl_seat argument to the activate and deactivate requests of
text_method.

On activation a text_model gets assigned to the input_method of the
wl_seat specified in the activate request.
2012-08-10 13:00:52 -04:00
Kristian Høgsberg cb3eaae9ad compositor: Change notify_* function to take a weston_seat
Fewer indirections and derefs, and it's also more appropriate for a
backend calling into weston core to pass a weston_seat.
2012-08-10 13:00:52 -04:00
Kristian Høgsberg 05890dc621 compositor: Don't hardcode output transform when sending the event
We add a transform field to weston_output and backends can override it
when they create the output.
2012-08-10 10:09:20 -04:00
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