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.
Initializing pitch to 1 to avoid xxx/pitch errors
This won't influence the valid texture coordinate calculation, because
in that case buffer_attach will provide the correct value.
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.
Without this change, weston would crash whenever a nil buffer was
passed to input_device_attach() if the cursor sprite was not mapped.
While at it, change the unmapping code to use weston_surface_unmap().
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.
When we're repainting, there's no point in polling for input events.
We just read input events once before each repaint and send out events
as needed. The input events come with an accurate timestamp, so this
doesn't affect the timing information and client should always look at
the event timestamps if they're trying to determine pointer motion
speed or double click speed. If we go idle (stop repainting) we add the
input devices back into the primary main loop and wait for the next event.
This avoids waking up the compositor separately (one or more times per
frame) to handle input events. We also avoid updating cursor position
and other compositor state after the client has rendered its new
frame, reducing lag between what the client renders and the pointer
position.
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.
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.
We can now clip the surface bounding box against the previous frame
opaque clip, and then just union the result (visible damage) into
compositor->damage immediately.
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>
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.
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.
We just set the input region to the bounding box of the window frame
and set the opaque region to be the opaque rectangle inside the window
if the child widget is opaque.
We never want to update the transform and then damage below. Damage
below is always used to trigger a repaint where the surface used to be
so we need to record the damage before updating the transform.