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>
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>
Print an user friendly error mesage when
the variable is not a valid directory.
krh: Edited to make message a litle more precise and added a check to
verify XDG_RUNTIME_DIR ownership and access mode.
Since we now batch up damage and only handle it at repaint time, we need
to apply it in case a buffer is destroyed so we don't lose it.
Ander found the problem, but we need to fix it in the compositor so we
don't change the behavior of the compositor.
weston_surface_update_transform() is typically called as part of the
repaint cycle so don't schedule a repaint here. There are still a couple
of places where we call weston_surface_update_transform() manually, but
they don't rely on the repaint being scheduled.
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.
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.
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>
We transform the surface damage to global damage at weston_output_repaint()
time. This way we don't touch the transform when it might not be valid
and in case of overlapping damage, we only copy pixels once for shm textures.
Expecting the link to be initialized breaks when compositor-drm.c
takes surfaces out of the list. We could fix that to also
wl_list_init() the link, but we're moving to making the surface list
local to weston_output_repaint(), rebuilt in and only valid during
weston_output_repaint() so just don't touch it instead.
If a surface is map'd and unmap'd before an output repaint occurs, it
is not added to the compositor's surface list, so the field
weston_surface::link might be invalid (the field is initialized on
weston_surface_create()), and it that case Weston will crash on the
call to wl_list_remove(&surface->link) in weston_surface_unmap().
Initialize the surface->link after the call to wl_list_remove() to make
sure a following call to wl_list_remove() won't cause a crash.
Iterate the frame_counter before calling animation->frame() because the animation might be
destroyed in this path. The first frame is now 1 (not 0) in the animation frame handlers.
A workspace is a list of top level surfaces visible at a time. New
toplevel surfaces are added to the current workspace. Default
keybindings (modifier - Up, modifier - Down, modifier - F1 up to F6) are
used for navigating between workspaces. By default a single workspace is
created.
Surfaces of inactive workspaces have their outputs NULL:ed so that frame
callbacks gets queued instead of emitted. When workspace gets visible
again surface's outputs are assigned.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
We need to update the temp grab pointer after weston_compositor_run_key_binding()
before calling the key handler because it may have installed a new grab.