Add delete_surrounding_text event in the text_model interface and the
request in the input_method_context interface. Implement it in the
example editor client and in the example keyboard so that the backspace
key works with it.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Add support of preedit-string to the example editor client. Also add a
preedit_string request to the input_method_context interface and use
that in the example weston keyboard to first create a pre-edit string
when entering keys and commit it on space.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Add support for a proper qwerty virtual keyboard layout with lowercase
and uppercase state, space and enter button.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
It makes sense to split the interfaces in a text and a input-method
protocol for now (only the text protocol needs to be used in toolkits).
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Add cursor and anchor positions as arguments to the set_surrounding_text
request. The cursor and anchor positions are relative to the surrounded
text, so it does not make sense to have that separate. Remove the
separate set_cursor_index and set_selected_text requests. Also update
the corresponding event in input-method-context and add support for it
in the weston example keyboard.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Add an input_method_context interface which is the representation of a
text_model on input_method side.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
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>
Remove the wl_surface argument from create_text_model request. The
wl_surface is specified as an argument in the activate request instead.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
When accumulating damage in the surfaces into the primary plane damage,
regions obscured by the opaque region would be excluded. This causes a
bug when a redraw of a surface is obscured by an opaque surface on
another plane. The drawing to the former surface is clipped but
its damage is never added to the primary plane and is just lost. Moving
the opaque window later reveals the not-up-to-date content below it.
The existing algorithm had some corner cases (pun!), where it failed to
produce correct vertices in the right order. This appeared only when the
surface was transformed (rotated). It also produced degenerate polygons
(3 or more vertices with zero polygon area) for non-transformed cases
where the clipping and surface rectangles were adjacent but not
overlapping.
Introduce a new algorithm for finding the boundary vertices of the
intersection of a coordinate axis aligned rectangle and an arbitrary
polygon (here a quadrilateral). The code is based on the
Sutherland-Hodgman algorithm, where a polygon is clipped by infinite
lines one at a time.
This new algorithm should always produce the correct vertices in the
clockwise winding order, and discard duplicate vertices and degenerate
polygons. It retains the fast paths of the existing algorithm for the
no-hit and non-transformed cases.
Benchmarking with earlier versions showed that the new algorithm is
a little slower (56 vs. 68 us/call) than the existing algorithm, for
the transformed case. The 'cliptest f' command before and after this
commit can be used to compare the speed of the transformed case only.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Rob Clark <rob.clark@linaro.org>
Cliptest is for controlled testing of the calculate_edges() function in
compositor.c. The function is copied verbatim into cliptest.c.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
We can now load any number of general modules, and the shell and xwayland
are just two of them. We continue to use the mechanism for testing but
custom input drivers or logging mechanisms, for example are other use cases.
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.
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.
surface_accumulate_damage() will call surface_compute_bbox() with the
extents of the surface damage region, for transformed surfaces only. If
there is no damage, surface_compute_bbox() will round up the empty
rectangle to a 1x1 rectangle. Triangles are produced for this 1x1
rectangle intersected with the surface.
The problem showed up with the triangle fan debug, where some seemingly
garbage pixels showed up relative to rotated surfaces.
Fix this by explicitly checking, that the area, for which a bounding box
is being computed for, is not zero.
Note, that the bbox will also be empty if only one of width and height
is zero. We do not paint things with zero thickness.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Rob Clark <rob.clark@linaro.org>
The intersection of two rectangles is guaranteed to be convex. Therefore
we do not need a center vertex for the triangle fan, we can simply use
the whatever first vertex the intersection polygon has. This reduces the
number of triangles, while still painting the exact same area.
While at it, emit_vertex() nested function is factored into the
for-loop, since that is the only calling site left.
Comments are updated to reflect the changes, and some unrelated comment
fixes are in repaint_region().
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Rob Clark <rob.clark@linaro.org>
- make it respect output transforms by making sure the uniforms are
up-to-date
- properly restore the current shader program, in case it was
overridden
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
weston_surface_draw() is restructured so that it will always use the
RGBX shader for opaque regions, if the surface is assigned the RGBA
shader.
Previously for opaque regions, we simply assumed, that the texture alpha
would be 1.0. If it was not (which really is an application bug), the
region would be misrendered. The RGBX shader forces the texture alpha to
1.0.
Xwayland surfaces may have bad alpha data in the opaque client area. If
blending was enabled, the bad alpha would be used with the RGBA shader.
This patch fixes rendering opaque xwayland windows with full-surface
alpha applied.
Test case: xterm, with full-surface alpha one step below 1.0. Before,
black text was fully transparent, now it is correctly only slightly
transparent.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>
Two buttons are added to the right-click menu of the window frame for
moving a surface either up or down.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
The workspace manager interface purpose is to provide clients with
control and knowledge about the current workspace state. Initially only
one function and one event exists; moving a surface and state updated
event. A workspace is represented as an index in a 1 dimensional array.
A client keeps track of the state by being broadcasted events when the
state changes, currently limited to current workspace or number of
workspaces available.
A client can send an asynchronous request to the manager asking to move
a surface to workspace identified by an index. It is up to the shell to
actually move it.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
By default, Control + Shift + Up/Down will move the currently active
surface, if any, while changing to another workspace.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>