This way we map the surface if it currently isn't mapped and avoid
duplicating some of the code already in pointer_cursor_surface_configure().
Without this, the cursor code relied on a wl_surface.attach() to show the
new pointer surface. If we're not changing the cursor buffer, we don't
get that, but we still need to map the cursor.
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.
When accumulating damage in the repaint loop, the opaque region of
surfaces in other planes is added to the overall opaque region. This
causes surface->clip to contain the areas obscured by surfaces in
other planes. Change it to contain only the opaque region of surfaces
in the primary plane
This fixes a bug where moving a window that was just moved from the
primary plane to another would leave artifacts on the screen. The
problem was that the damage generated by weston_surface_move_to_plane()
would be clipped on weston_surface_redraw(), leaving the contets below
it unchanged. Moving the overlaid surface would no longer generate
damage on the primary plane, so the contents would remain unchanged
(i.e. wrong) indefinitely.
compositor.c: In function ‘log_extensions’:
compositor.c:3085:7: warning: field precision should have type ‘int’,
but argument 2 has type ‘long int’
compositor.c:3087:4: warning: field precision should have type ‘int’,
but argument 2 has type ‘long int’
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Commit 982387011 causes a bug where starting weston results in a black screen
(if no clients are immediately started). The problem is that the offending
commit causes the compositor to not damage if a surface has an empty output
mask, which is the case for the fade surface, which is created by the
compositor. This patch updates the surface output_mask unconditionally,
and only skips sending out the events if there no client.
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.
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.
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.
This backend has not seen even build testing for months, presumably does
not even compile, and is starting to hinder development a little.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Benjamin Franzke <benjaminfranzke@googlemail.com>
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>
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.
Simply exit(1)'ing the program will leave the VT unusable, since
DRM backend's clean-up does not run.
After a backend has been initialised, prefer jumping to clean-up instead
of directly exiting.
This fixes the case where 'weston-launch -- -i 5' would leave the
console unusable.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Reported by Dima Ryazanov <dima@gmail.com> in
<1341937691-26234-1-git-send-email-dima@gmail.com> but we also need to
destroy callbacks when the surface is destroyed normally.
surface->damage is for when the contents of the surface changes. Instead,
use weston_surface_damage_below() to repaint the damaged area. We avoid
unecessary uploading shm and hw cursor contents this way.
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>
Make weston_surface::texture and ::surface an array, while keeping
[0] for RGB surfaces.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Otherwise a surface.attach request might cause the input region to be
reset to the default value (the entire surface) causing it to receive
focus.
Tiago ran into this problem with xwayland.
When calling glTexSubImage2D for sub image updates for SHM surfaces the
changed rectangle was being wrongly calculated. This resulted in interesting
redraw artefacts for clients using SHM.
This happens when vt-switching away from the compositor (drm) or
giving keyboard focus to a different X window. Release the modifiers
so we don't get stuck modifiers. We'll update with the new keys down
when we come back.
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>
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>
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>
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>
This is mainly for X11's benefit; the common case is using Logo+S to
take a screenshot, where GNOME Shell has grabbed Logo, and replays the
event down to the nested compositor after S is pressed. This means we
get an enter event with both Logo and S down, and even if Shell delivers
the key press event for S (which isn't mandatory, and not all window
managers do), then we never run the binding since notify_key realises
that S is already down and exits early.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>