platform/upstream/weston.git
10 years agoterminal: use xstrdup instead to handle OOM
U. Artie Eoff [Wed, 15 Jan 2014 19:40:37 +0000 (11:40 -0800)]
terminal: use xstrdup instead to handle OOM

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agouse xzalloc wrapper instead
U. Artie Eoff [Wed, 15 Jan 2014 19:13:38 +0000 (11:13 -0800)]
use xzalloc wrapper instead

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agoclients/desktop-shell: check OOM conditions
U. Artie Eoff [Wed, 15 Jan 2014 18:59:50 +0000 (10:59 -0800)]
clients/desktop-shell: check OOM conditions

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agoscreenshooter: check for NULL malloc and fix memleaks
U. Artie Eoff [Wed, 15 Jan 2014 17:36:00 +0000 (09:36 -0800)]
screenshooter: check for NULL malloc and fix memleaks

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agowcap-decode: remove dead code
U. Artie Eoff [Wed, 15 Jan 2014 16:52:07 +0000 (08:52 -0800)]
wcap-decode: remove dead code

Avoids leaking memory we never use.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agolog: print dummy timestamp if localtime call fails
U. Artie Eoff [Wed, 15 Jan 2014 16:24:40 +0000 (08:24 -0800)]
log: print dummy timestamp if localtime call fails

Handle the case where localtime fails (NULL) and print
something else to indicate localtime is erroneous.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agobacklight: fix backlight_path memory leak
U. Artie Eoff [Wed, 15 Jan 2014 16:12:19 +0000 (08:12 -0800)]
backlight: fix backlight_path memory leak

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agoshell: Don't start a fade animation if we don't have an output
Kristian Høgsberg [Mon, 20 Jan 2014 05:48:10 +0000 (21:48 -0800)]
shell: Don't start a fade animation if we don't have an output

When the last window of the X11 compositor is closed during a fade or
while locked, we'll try to start a fade back to the lock screen.  However,
if we closed the last window, there are no outputs left and the animation
will try to run with surface->output == NULL.

https://bugs.freedesktop.org/show_bug.cgi?id=73665

10 years agoRevert part of 17bccaed428ac1f6ec9f8e667175ad81e90508ff
Kristian Høgsberg [Sat, 18 Jan 2014 00:39:17 +0000 (16:39 -0800)]
Revert part of 17bccaed428ac1f6ec9f8e667175ad81e90508ff

Commit 17bccaed428ac1f6ec9f8e667175ad81e90508ff accidentally reverted
the fix for 73490 from 5cbc7634043707c3a0e442014910fc7f6db317e0.

10 years agoshell: Cancel popups when triggering screensaver
Kristian Høgsberg [Sat, 18 Jan 2014 00:22:50 +0000 (16:22 -0800)]
shell: Cancel popups when triggering screensaver

This is part of the fix for bug 72540.  We cancel the popup grab when the
screensaver kicks in so that the screen unlock dialog can get input events.
The bigger problem is in mesa however, where we try to allocate new buffers
as cairo-gles2 does a gratuituous (but valid) eglMakeCurrent() as we
remove the tooltip or popup-menu.

Since we removed the weston_layer with the regular surfaces, EGL blocks
waiting for a frame event that never comes.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72540

10 years agoresizor: Don't resize if maximized
Kristian Høgsberg [Fri, 17 Jan 2014 23:31:33 +0000 (15:31 -0800)]
resizor: Don't resize if maximized

https://bugs.freedesktop.org/show_bug.cgi?id=73723

10 years agoshell: Stop moving surfae after touch point 0 goes up
Kristian Høgsberg [Fri, 17 Jan 2014 23:18:10 +0000 (15:18 -0800)]
shell: Stop moving surfae after touch point 0 goes up

The grab stays alive as long as at least one touch point is down.  If touch
point 0 is lifted while other touch points are down, the surface will jump
around when touch point 0 is put down again.

This change marks the grab as inactive once touch point 0 is lifted
and then ignores touch events until all touch points eventually are
lifted and the grab terminates.

https://bugs.freedesktop.org/show_bug.cgi?id=73750

10 years agocompositor-drm: Make composite bypass work on secondary outputs
Kristian Høgsberg [Fri, 17 Jan 2014 22:22:41 +0000 (14:22 -0800)]
compositor-drm: Make composite bypass work on secondary outputs

The opaque region is in surface coordinates, which we compare to the
output region, which is in compositor coordinates.  For non-primary
outputs, that means that the output region is not located at 0,0 but
something like 1920,0 instead.  That means that the output region isn't
contained in the surface opaque region and then we decide we can't scan
out from it.

Instead, compare the surface opaque region to the output region
translated to 0,0.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=7348i5

10 years agoshell: Don't assign keyboard focus for seats without keyboard
Kristian Høgsberg [Fri, 17 Jan 2014 20:18:53 +0000 (12:18 -0800)]
shell: Don't assign keyboard focus for seats without keyboard

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73570

10 years agoFix XWayland crashes when opening popups
Axel Davy [Sun, 12 Jan 2014 14:06:05 +0000 (15:06 +0100)]
Fix XWayland crashes when opening popups

Signed-off-by: Axel Davy <axel.davy@ens.fr>
10 years agogitignore: Generated files text-client-protocol.h, text-protocol.c
Bryce W. Harrington [Wed, 15 Jan 2014 02:39:26 +0000 (02:39 +0000)]
gitignore: Generated files text-client-protocol.h, text-protocol.c

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
10 years agoCleanup stray newline in a return statement
Bryce W. Harrington [Tue, 14 Jan 2014 21:58:34 +0000 (21:58 +0000)]
Cleanup stray newline in a return statement

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
10 years agoterminal: Only set title if asprintf succeeded
Bryce W. Harrington [Tue, 14 Jan 2014 21:58:32 +0000 (21:58 +0000)]
terminal: Only set title if asprintf succeeded

Handles potential out of memory situation by skipping the title update.
This fixes the following warning:

  terminal.c: In function ‘resize_handler’:
  terminal.c:851:11: warning: ignoring return value of ‘asprintf’,
  declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
10 years agoweston.ini.man: Fix some grammar
Wieland Hoffmann [Fri, 10 Jan 2014 21:23:12 +0000 (22:23 +0100)]
weston.ini.man: Fix some grammar

10 years agoinput: Handle unplugging the output for a touchscreen device
Kristian Høgsberg [Fri, 17 Jan 2014 00:46:28 +0000 (16:46 -0800)]
input: Handle unplugging the output for a touchscreen device

A paired touch screen will stop sending events if its corresponding
output is unplugged.  An unpaired touchscreen will pick the new primary
output.

https://bugs.freedesktop.org/show_bug.cgi?id=73637

10 years agoshell: Disable exposay by default
Kristian Høgsberg [Fri, 17 Jan 2014 00:51:52 +0000 (16:51 -0800)]
shell: Disable exposay by default

Add a config file option to enable it, but leave it off by default.  Exposay
still triggers too many lock-ups or stuck grabs and triggers under X even
when the Wayland window doesn't have keyboard focus.

10 years agoshell.c: Not all seats have pointers
Kristian Høgsberg [Wed, 15 Jan 2014 19:46:38 +0000 (11:46 -0800)]
shell.c: Not all seats have pointers

Don't look up the pointer focus in ping_timeout_handler() if the
seat doesn't have a pointer.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73490

10 years agoFix XWayland transient window location.
Axel Davy [Sun, 12 Jan 2014 14:06:04 +0000 (15:06 +0100)]
Fix XWayland transient window location.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73517

Signed-off-by: Axel Davy <axel.davy@ens.fr>
10 years agoOnly update the surface size if a new buffer is attached
Jason Ekstrand [Sat, 11 Jan 2014 18:12:19 +0000 (12:12 -0600)]
Only update the surface size if a new buffer is attached

This fixes a regression caused by either 918f2dd4 or da75ee1d.  In
particular, if a client called commit without attaching a buffer and if the
compositor had already released its reference to the buffer, then a size of
0x0 would be set on the surface.  In particular, this affects the wayland
backend because it frequently sends only a frame request in order to cause
a refresh.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
10 years agotext: Set context->model to NULL when we deactivate text input
Kristian Høgsberg [Mon, 13 Jan 2014 23:06:10 +0000 (15:06 -0800)]
text: Set context->model to NULL when we deactivate text input

There's a small window between the input method (eg the on-sreen keyboard)
receiving the deactivate and destroying the context, where the keyboard may
send requests, which we forward to the destroyed input method.  Fix this
by setting the contexts model to NULL right away and then avoid sending
events if context->model is NULL.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69490

10 years agoshell: Move maximize and fullscreen bindings to mod + SHIFT
Kristian Høgsberg [Sat, 11 Jan 2014 21:10:21 +0000 (13:10 -0800)]
shell: Move maximize and fullscreen bindings to mod + SHIFT

mod + f and mod + m conflict with too many application bindings, in
particular if mod is mapped to ALT.

10 years agowindow: Properly destroy tooltip windows when parent window is destroyed 1.3.92
Kristian Høgsberg [Fri, 10 Jan 2014 08:27:35 +0000 (00:27 -0800)]
window: Properly destroy tooltip windows when parent window is destroyed

If we destroy a window with an active tooltip, we leave the tooltip
hanging around.  Call tooltip destructor when destroying a window.
This fixes the stuck tooltip observed when unplugging a monitor with
an active tooltip on the panel.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72931

10 years agoshell: Orphan child windows when a shell surface is destroyed
Kristian Høgsberg [Fri, 10 Jan 2014 08:25:30 +0000 (00:25 -0800)]
shell: Orphan child windows when a shell surface is destroyed

We now track the child surfaces of a shell surface and the child surfaces
have a pointer back to their parent.  We need to clean all this up and
NULL out the childrens parent pointers when a shell surface is destroyed.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72931

10 years agokeyboard: Make debug output less verbose
Kristian Høgsberg [Fri, 10 Jan 2014 07:55:30 +0000 (23:55 -0800)]
keyboard: Make debug output less verbose

The keyboard is too chatty, make it use a dbg() function for logging
which defaults to disabled.

Also drop a noisy fprintf() in input_panel_configure().

10 years agokeyboard: Don't strcat() into a strdup()ed string
Kristian Høgsberg [Fri, 10 Jan 2014 07:45:18 +0000 (23:45 -0800)]
keyboard: Don't strcat() into a strdup()ed string

We need to reallocate the memory to hold the entire concatenated string,
but strcat() doesn't do that.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=71750

10 years agokeyboard: Fix insert_text() string utility
Kristian Høgsberg [Fri, 10 Jan 2014 07:39:20 +0000 (23:39 -0800)]
keyboard: Fix insert_text() string utility

strncat() into a newly allocated buffer isn't well-defined.  I don't know
how this didn't crash all the time, getting blocks from malloc() with
a NUL in the first byte must be fairly common.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=71750

10 years agocompositor: Init output listeners in weston_view if it's not on any output
Kristian Høgsberg [Fri, 10 Jan 2014 06:41:48 +0000 (22:41 -0800)]
compositor: Init output listeners in weston_view if it's not on any output

If we don't add the listener back to a new output, we have to init the
list links so we can remove them unconditionally.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73415

10 years agoinput: Re-pair touch screen when monitor is plugged in
Kristian Høgsberg [Fri, 10 Jan 2014 00:41:58 +0000 (16:41 -0800)]
input: Re-pair touch screen when monitor is plugged in

https://bugs.freedesktop.org/show_bug.cgi?id=73442

10 years agoshell: Make sure we still have touch or pointer focus when moving/resizing
Kristian Høgsberg [Thu, 9 Jan 2014 23:43:17 +0000 (15:43 -0800)]
shell: Make sure we still have touch or pointer focus when moving/resizing

It's possible to touch a surface to move it and let go before we get
to common_surface_move(), in which case we don't have a touch focus
when we get there.  For pointers, we could click a surface, but have the
surface go away before we get to common_surface_move(), in which
case the button count is non-zero, but we don't have a surface.

In either case we crash, so let's add a check to make sure we still
have a focus surface before we try to move it.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73448

10 years agowestoy: Add an option to explicitly disable cairo on a widget
Neil Roberts [Thu, 19 Dec 2013 16:17:12 +0000 (16:17 +0000)]
westoy: Add an option to explicitly disable cairo on a widget

The subsurfaces example creates a subsurface widget and uses EGL to
render to it directly rather than using the cairo context from the
widget. In theory this shouldn't cause any problems because the westoy
window code lazily creates the cairo surface when an application
creates a cairo context. However commit fdca95c7 changed the behaviour
to force the lazy creation at the beginning of each surface redraw.
This ends up making the triangle surface get two attaches – one from
Cairo and one from the direct EGL.

It looks like it would be difficult to reinstate the lazy surface
creation behaviour whilst still maintaining the error handling for
surface creation because none of the redraw handlers in the example
clients are designed to cope with that. Instead, this patch adds an
explicit option on a widget to disable creating the Cairo surface and
the subsurface example now uses that.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72854

10 years agoinput: Ignore touch up events if num_tp is 0
Kristian Høgsberg [Thu, 9 Jan 2014 06:29:20 +0000 (22:29 -0800)]
input: Ignore touch up events if num_tp is 0

This can happen if we start out with one or more fingers on the touch
screen, in which case we didn't get the corresponding down event.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73367

10 years agoshell: run surface bindings only when focus surface is not NULL
Rafal Mielniczuk [Sun, 5 Jan 2014 19:04:59 +0000 (20:04 +0100)]
shell: run surface bindings only when focus surface is not NULL

This fixes the crash when move, rotate or resize binding is activated
while exposay effect is active.

Steps to reproduce:
- activate exposay
- try to rotate the surface with mod + right mouse button
- crash

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72885

10 years agocompositor-drm: consider the best mode of the mode_list as an option
Fabien DESSENNE [Thu, 12 Dec 2013 16:13:56 +0000 (17:13 +0100)]
compositor-drm: consider the best mode of the mode_list as an option

This patch fixes an issue where Weston using the DRM backend, cannot start
the display. This happens in the following context:
- no video mode is set before weston starts (eg no "/dev/fb" set up)
- weston is not configured with any default video mode (nothing from
  weston.ini nor command line)
- the DRM driver provides with a list of supported modes, but none of them
  is marked as PREFERRED (which is not a usual case, but it happens)
In that case, according to the current implementation, the DRM compositor
fails to set a video mode.
This fix lets the DRM compositor selects a video mode (the best one of the
list, which is the first) from the ones provided by the driver.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
10 years agoinput: Don't leak the initial keymap
Rui Matos [Thu, 24 Oct 2013 17:28:41 +0000 (19:28 +0200)]
input: Don't leak the initial keymap

weston_xkb_info_create() takes ownership of the xkb_keymap instance so
we should drop our reference or we would leak it later if the keymap
was changed.

10 years agoprotocol: rename wl_surface_scaler to wl_viewport
Pekka Paalanen [Wed, 8 Jan 2014 13:39:17 +0000 (15:39 +0200)]
protocol: rename wl_surface_scaler to wl_viewport

This seems like a better name, and will not conflict if someone later
extends wl_surface with a request scaler_set (yeah, unlikely).

This code was written by Jonny Lamb, I just diffed his branches and made
a patch for Weston.

Cc: Jonny Lamb <jonny.lamb@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agotests: fix build on rpi with EGL
Pekka Paalanen [Wed, 8 Jan 2014 13:39:19 +0000 (15:39 +0200)]
tests: fix build on rpi with EGL

This patch fixes the compiler errors:

  CC     weston_test_la-weston-test.lo
weston-test.c:34:21: fatal error: EGL/egl.h: No such file or directory

  CC     buffer-count-test.o
buffer-count-test.c:30:21: fatal error: EGL/egl.h: No such file or directory

On rpi, the EGL headers are not in the standard path.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoscreenshooter: silence a warning
Pekka Paalanen [Wed, 8 Jan 2014 13:39:18 +0000 (15:39 +0200)]
screenshooter: silence a warning

screenshooter.c: In function ‘recorder_binding’:
screenshooter.c:509:5: warning: ‘listener’ may be used uninitialized in
this function [-Wuninitialized]

This was not really a problem so far, because the variable was
uninitialized only in the case where Weston had no outputs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agotests: Only run buffer-count test on Mesa >= 10.1
Pekka Paalanen [Wed, 8 Jan 2014 14:05:34 +0000 (16:05 +0200)]
tests: Only run buffer-count test on Mesa >= 10.1

Comment #2 in the bug report says Mesa 10.0 branch does not have the
fix, and indeed buffer-count test fails on Mesa 10.0.1. Fix the test to
require Mesa 10.1 or later.

Now I correctly get:
mesa version too old (OpenGL ES 3.0 Mesa 10.0.1 (git-12484d2))

https://bugs.freedesktop.org/show_bug.cgi?id=72835

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoinput: Remap touch point IDs from multiple touch screens to not overlap
Kristian Høgsberg [Thu, 9 Jan 2014 00:21:24 +0000 (16:21 -0800)]
input: Remap touch point IDs from multiple touch screens to not overlap

With multiple touch screens on one seat, the touch points IDs from the
different evdev devices may overlap.  We have to remap the IDs we forward
to core weston so that the touch points all have unique IDs within the seat.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73003

10 years agoexposay: set an alpha on fullscreen surfaces
Emilio Pozuelo Monfort [Tue, 7 Jan 2014 15:41:40 +0000 (16:41 +0100)]
exposay: set an alpha on fullscreen surfaces

This makes the desktop background actually draw when there is
a fullscreen surface and we go to exposay.

10 years agoexposay: fix infinite loop with fullscreen surfaces
Emilio Pozuelo Monfort [Tue, 7 Jan 2014 15:41:39 +0000 (16:41 +0100)]
exposay: fix infinite loop with fullscreen surfaces

We were calling exposay_highlight_surface() inside a wl_list_for_each
loop for a layer, but exposay_highlight_surface() calls activate()
which calls shell_surface_update_layer(), which removes the surface
from its layer and reinserts it, causing an infinite loop.

Call exposay_highlight_surface() outside the for_each to avoid this.

https://bugs.freedesktop.org/show_bug.cgi?id=72404

10 years agokeyboard: Handle touch up event
Kristian Høgsberg [Tue, 7 Jan 2014 20:57:59 +0000 (12:57 -0800)]
keyboard: Handle touch up event

This fixes arrow keys which trigger on button up.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73169

10 years agoeditor: Add missing touch-to-activate for the entries
Kristian Høgsberg [Tue, 7 Jan 2014 18:41:50 +0000 (10:41 -0800)]
editor: Add missing touch-to-activate for the entries

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72996

10 years agoclients: Fix libexec clients install
Armin K [Fri, 3 Jan 2014 23:48:55 +0000 (00:48 +0100)]
clients: Fix libexec clients install

10 years agoshell: Only assign focus on touch if there is a touch focus surface
Kristian Høgsberg [Fri, 3 Jan 2014 07:00:11 +0000 (23:00 -0800)]
shell: Only assign focus on touch if there is a touch focus surface

Similar to 7c4f6cc145daf66cd9624f1e70dd5278241f5858, if we don't have
a background image from the desktop-shell client or the touch point
for some other reason doesn't hit a surface we trigger a
segfault as we try to deref the seat->touch->focus NULL pointer.

For touch, another problem could be fudgey calibration that ends up
giving touch coordinates outside the output space.

https://bugs.freedesktop.org/show_bug.cgi?id=72839

10 years agoxwm: Handle WM_TRANSIENT_FOR
Kristian Høgsberg [Fri, 3 Jan 2014 06:40:37 +0000 (22:40 -0800)]
xwm: Handle WM_TRANSIENT_FOR

Set up X windows that are transient for another window as transient
surfaces in shell.c.  This keeps the transient windows on top of their
parent as windows are raised, lowered for fullscreened.

https://bugs.freedesktop.org/show_bug.cgi?id=69443

10 years agobuild: fix commit that changed option for installing client
Ricardo Vieira [Thu, 2 Jan 2014 23:31:14 +0000 (15:31 -0800)]
build: fix commit that changed option for installing client

Without this patch the option --enable-demo-clients-install does not
install the client demos.

10 years agoProperly free drm plane during creation of sprites
Chris Michael [Thu, 2 Jan 2014 11:39:40 +0000 (11:39 +0000)]
Properly free drm plane during creation of sprites

If we fail to allocate space for a new drm_sprite, then we should
properly call drmModeFreePlane (not free) to release the drm plane.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
10 years agoshell: Start the input panel slide slightly on the output
Kristian Høgsberg [Thu, 2 Jan 2014 09:33:42 +0000 (01:33 -0800)]
shell: Start the input panel slide slightly on the output

If a surface is not on any output, scheduling a repaint for it is a no-op.
weston_view_schedule_repaint() schedules repaints for all outputs that
overlap with the surface extents, but if the surface is completely
outside all outputs nothing will be scheduled.  Fix this for now by starting
the slide slightly into the output.

10 years agoshell: Test for surface->width == 0 to see if input-panel was unmapped
Kristian Høgsberg [Thu, 2 Jan 2014 09:27:06 +0000 (01:27 -0800)]
shell: Test for surface->width == 0 to see if input-panel was unmapped

The input-panel codes tries to see determine if a buffer has not yet
been attached (or a NULL buffer has been attached), and doesn't map
the input panel surface yet in that case.  However, it test for
buffer_ref being NULL, which can happen for other reasons.  The right
test is to see if surface->width is 0, which means that either a
buffer hasn't yet been attached or a NULL buffer has been attached.

https://bugs.freedesktop.org/show_bug.cgi?id=72519

10 years agoshell: Always set input-panel position on initial configure
Kristian Høgsberg [Thu, 2 Jan 2014 08:45:17 +0000 (00:45 -0800)]
shell: Always set input-panel position on initial configure

If we're not currently showing the input panels, we still need to set the
panel position so that it's set when we later need to show them.  This fixes
the initial flicker of the input panel in the wrong position when we first
show it.

10 years agoeditor: Add keyboard_focus handler to schedule repaint
Kristian Høgsberg [Thu, 2 Jan 2014 07:57:42 +0000 (23:57 -0800)]
editor: Add keyboard_focus handler to schedule repaint

This let the editor client repaint the frame to indicate it's active
when it receives keyboard focus.

10 years agoshell.c: Set state_changed for xwayland surfaces as well
Kristian Høgsberg [Thu, 2 Jan 2014 06:34:49 +0000 (22:34 -0800)]
shell.c: Set state_changed for xwayland surfaces as well

Fixes the problem where xwayland surfaces pop up at 0,0 always.

10 years agotests: Only run buffer-count test if we have at least mesa 10
Kristian Høgsberg [Thu, 2 Jan 2014 01:38:04 +0000 (17:38 -0800)]
tests: Only run buffer-count test if we have at least mesa 10

https://bugs.freedesktop.org/show_bug.cgi?id=72835

10 years agodesktop-shell: Remove debug code from previous commit
Kristian Høgsberg [Thu, 2 Jan 2014 00:32:09 +0000 (16:32 -0800)]
desktop-shell: Remove debug code from previous commit

10 years agoshell: Only assign focus on click if there is a pointer focus surface
Kristian Høgsberg [Thu, 2 Jan 2014 00:28:32 +0000 (16:28 -0800)]
shell: Only assign focus on click if there is a pointer focus surface

If we don't have a background image from the desktop-shell client or the
pointer for some other reason doesn't have a focus we trigger a
segfault as we try to deref the seat->pointer->focus NULL pointer.

https://bugs.freedesktop.org/show_bug.cgi?id=73066

10 years agoshell.c: Back out alt-tab functionality
Kristian Høgsberg [Wed, 1 Jan 2014 23:59:36 +0000 (15:59 -0800)]
shell.c: Back out alt-tab functionality

This is still fairly unstable, causes lockups with fullscreen and exposay,
leaves small preview surfaces on-screen if used on the same modifier as
mod-tab.  We also only need on mod-tab implementation so lets see if we
can consolidate the current and this alt-tab implementation in 1.5.

https://bugs.freedesktop.org/show_bug.cgi?id=72610

10 years agoFix the size of surfaces created in create_black_surface
Jason Ekstrand [Wed, 1 Jan 2014 21:58:57 +0000 (15:58 -0600)]
Fix the size of surfaces created in create_black_surface

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
10 years agobuild: Move clients libexec_PROGRAMS under BUILD_CLIENTS conditional
Kristian Høgsberg [Wed, 1 Jan 2014 21:28:07 +0000 (13:28 -0800)]
build: Move clients libexec_PROGRAMS under BUILD_CLIENTS conditional

All the libexec programs are only built when BUILD_CLIENTS is true,
so we can just assign libexec_PROGRAMS under the condition.  This lets us
drop most of the variable assignments and simplify it a bit.

https://bugs.freedesktop.org/show_bug.cgi?id=72812

10 years agobuild: Don't try to build weston-info if client build is disabled
Kristian Høgsberg [Wed, 1 Jan 2014 20:56:44 +0000 (12:56 -0800)]
build: Don't try to build weston-info if client build is disabled

The weston-info sources are defined conditionally in the if BUILD_CLIENTS
section, but we always added weston-info to bin_PROGRAMS.

https://bugs.freedesktop.org/show_bug.cgi?id=72812

10 years agobuild: Rename option and conditional for installing demo clients
Kristian Høgsberg [Wed, 1 Jan 2014 20:47:40 +0000 (12:47 -0800)]
build: Rename option and conditional for installing demo clients

Previously the option was --enable-demo-clients and the conditional was
ENABLE_DEMO_CLIENTS.  They control whether or not we install the demo clients
(ie all other clients than weston-terminal and weston-info).  Rename the
option and the conditional to better reflect this.

10 years agoshell: Fix up previous broken commit
Kristian Høgsberg [Wed, 1 Jan 2014 21:51:52 +0000 (13:51 -0800)]
shell: Fix up previous broken commit

10 years agoRevert "shell: Change stacking order calculation for popup surfaces"
Kristian Høgsberg [Wed, 1 Jan 2014 20:26:14 +0000 (12:26 -0800)]
Revert "shell: Change stacking order calculation for popup surfaces"

Popup windows are relative to a plain wl_surface, so that custom surfaces
can have popups.  This used for the desktop-shell panel for example.  Also,
popups should be immediately on top of their parent surface, as they
typically represent an extension of an UI element in the parent surface
such as a combo box or menu.

This reverts commit da704d97faef87520c5b055e4b5c8d1f6c8fc1be.

Conflicts:
desktop-shell/shell.c

https://bugs.freedesktop.org/show_bug.cgi?id=72547

10 years agowindow.c: Don't put buttons on frames for custom windows
Kristian Høgsberg [Tue, 31 Dec 2013 23:35:39 +0000 (15:35 -0800)]
window.c: Don't put buttons on frames for custom windows

Custom windows don't have a wl_shell_surface and can't do anything in
response to these button (except crash).  This only affects the unlock
dialog.

https://bugs.freedesktop.org/show_bug.cgi?id=72542

10 years agoshell: Set state_changed when we make a surface transient
Kristian Høgsberg [Tue, 31 Dec 2013 23:01:01 +0000 (15:01 -0800)]
shell: Set state_changed when we make a surface transient

If we don't mark the state as changed, we don't copy over next_state to
state and we fail to treat the surface as a transient.  In particular,
we give it a random intial position instead of mapping it at the given
parent relative position.

https://bugs.freedesktop.org/show_bug.cgi?id=72532

10 years agoRelease pointer and keyboard with the seat
Hardening [Sat, 21 Dec 2013 22:19:11 +0000 (23:19 +0100)]
Release pointer and keyboard with the seat

This patch fixes seat releasing during a RDP disconnection.
It does not fully fix https://bugs.freedesktop.org/show_bug.cgi?id=66830,
but makes things better.

10 years agoshell: Handle the desktop shell client destroy signal
Ander Conselvan de Oliveira [Fri, 20 Dec 2013 19:07:01 +0000 (21:07 +0200)]
shell: Handle the desktop shell client destroy signal

Set the internal pointer for the client to NULL. This fixes a
segmentation fault at shutdown, where the shell would hang up before
and cause libwayland to call wl_client_destroy(). When the shell was
destroyed later, another call to wl_client_destroy() would cause the
crash.

https://bugs.freedesktop.org/show_bug.cgi?id=72550

10 years agocompositor: Destroy renderer in weston_compositor_shutdown()
Ander Conselvan de Oliveira [Fri, 20 Dec 2013 19:07:00 +0000 (21:07 +0200)]
compositor: Destroy renderer in weston_compositor_shutdown()

Currently we destroy the renderer before the outputs are destroyed, but
that sometimes leads to an error since a reference to the renderer is
necessary in order to destroy a gl_renderer_output.

Since destroying the renderer is common among all backends, just move
that call into weston_compositor_shutdown() immediately after the
outputs being destroyed.

10 years agopixman: Destroy pixman images when underlying buffer is destroyed
Lubomir Rintel [Thu, 12 Dec 2013 11:57:56 +0000 (12:57 +0100)]
pixman: Destroy pixman images when underlying buffer is destroyed

While the pixman image might be attached, the underlying buffer might be
already gone under certain circumstances. This is easily reproduced by
attempting to resize gnome-terminal on a fbdev backend.

$ WAYLAND_DEBUG=1 strace -emunmap weston --backend=fbdev-backend.so
...
[1524826.942] wl_shm@7.create_pool(new id wl_shm_pool@23, fd 40, 1563540)
[1524827.315] wl_shm_pool@23.create_buffer(new id wl_buffer@24, 0, 759, 515, 3036, 0)
...
[1524829.488] wl_surface@14.attach(wl_buffer@24, 0, 0)
[1524829.766] wl_surface@14.set_buffer_scale(1)
[1524829.904] wl_surface@14.damage(0, 0, 759, 515)
[1524830.248] wl_surface@14.frame(new id wl_callback@25)
[1524830.450] wl_surface@14.commit()
...
[1524846.706] wl_shm@7.create_pool(new id wl_shm_pool@26, fd 40, 1545000)
[1524847.215] wl_shm_pool@26.create_buffer(new id wl_buffer@27, 0, 750, 515, 3000, 0)
[1524847.735] wl_buffer@24.destroy()
[1524847.953]  -> wl_display@1.delete_id(24)
[1524848.144] wl_shm_pool@23.destroy()
munmap(0xb5b2e000, 1563540)             = 0
[1524849.021]  -> wl_display@1.delete_id(23)
[1524849.425] wl_surface@14.attach(wl_buffer@27, 0, 0)
[1524849.730] wl_surface@14.set_buffer_scale(1)
[1524849.821] wl_surface@14.damage(0, 0, 750, 515)
<No commit yet, so drawing is attempted from older buffer that used to be
 attached to the surface, which happens to come from a destroyed pool,
 resulting it an invalid read from address 0xb5b2e000>

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
10 years agocompositor: Clean up view output move and destroy listeners
Ander Conselvan de Oliveira [Thu, 19 Dec 2013 16:34:28 +0000 (18:34 +0200)]
compositor: Clean up view output move and destroy listeners

Remove those listeners when the output is destroyed, otherwise they'll
point to invalid data that may lead to corruption when assigning a new
output for the view.

--
This is possibly related to bug 72845. I didn't have enough equipment
to try and reproduce it.

https://bugs.freedesktop.org/show_bug.cgi?id=72845

10 years agocompositor-x11: Set the name field on weston_outputs
Ander Conselvan de Oliveira [Wed, 18 Dec 2013 17:51:40 +0000 (19:51 +0200)]
compositor-x11: Set the name field on weston_outputs

That way log messages referencing the output are more informative.

10 years agoscreenshooter: Choose output to record from based on keyboard focus
Ander Conselvan de Oliveira [Wed, 18 Dec 2013 17:51:39 +0000 (19:51 +0200)]
screenshooter: Choose output to record from based on keyboard focus

Record from the output of the surface that has keyboard focus for the
seat used to activate the recorder key binding. If there is no focused
surface, record from the first one.

Also, use the weston_transformed_region() to transform the damage
region of the output into the coordinates expected by read_pixels().

https://bugs.freedesktop.org/show_bug.cgi?id=71401

10 years agocompositor: Initialize output listener links
Kristian Høgsberg [Tue, 17 Dec 2013 22:58:19 +0000 (14:58 -0800)]
compositor: Initialize output listener links

Make sure the links are initialized so we can safely remove the listeners
in weston_view_unmap().

https://bugs.freedesktop.org/show_bug.cgi?id=72808

10 years agoscreenshooter: Record one extra frame when recording stops
Ander Conselvan de Oliveira [Tue, 17 Dec 2013 12:18:01 +0000 (14:18 +0200)]
screenshooter: Record one extra frame when recording stops

If the compositor hasn't been rendering for a while when the recording
stops, the time difference between the last rendered frame and that
moment won't be in the encoded video. Fix that by forcing one extra
frame to be recorded when the user presses the recorder key binding.

https://bugs.freedesktop.org/show_bug.cgi?id=71142

10 years agonested: Add EGL_WL_create_wayland_buffer_from_image compat defines
Kristian Høgsberg [Tue, 17 Dec 2013 18:40:01 +0000 (10:40 -0800)]
nested: Add EGL_WL_create_wayland_buffer_from_image compat defines

Make it possible to compile this example with EGL implementations without
this extension.

10 years agoconfigure.ac: Bump version to 1.3.91 for alpha release 1.3.91
Kristian Høgsberg [Tue, 17 Dec 2013 07:32:53 +0000 (23:32 -0800)]
configure.ac: Bump version to 1.3.91 for alpha release

10 years agoMakefile.am: Clean generated weston.ini on make clean
Kristian Høgsberg [Tue, 17 Dec 2013 07:12:46 +0000 (23:12 -0800)]
Makefile.am: Clean generated weston.ini on make clean

10 years agoclients: add scaler test app
Jonny Lamb [Tue, 26 Nov 2013 17:19:48 +0000 (18:19 +0100)]
clients: add scaler test app

This client tests the wl_scaler and wl_surface_scaler protocol
extensions by cropping and then scaling a surface to ensure it is
rendered correctly. More details in comments in the code.

10 years agopixman-renderer: implement surface scaling and cropping
Jonny Lamb [Tue, 26 Nov 2013 17:19:47 +0000 (18:19 +0100)]
pixman-renderer: implement surface scaling and cropping

The pixman renderer doesn't use the weston_surface_to_buffer*
functions to alter coordinates depending on buffer transformation,
buffer scaling, and surface scaler (wl_surface_scaler).
pixman_transform_scale() is used instead to perform said
transformations without having to modify each coordinate.

10 years agocompositor: transform surface coordinates if a surface scaler is used
Jonny Lamb [Tue, 26 Nov 2013 17:19:46 +0000 (18:19 +0100)]
compositor: transform surface coordinates if a surface scaler is used

Implements wl_surface_scaler.set by setting desired
src_{x,y,width,height} and dst_{width,height} values in the
weston_buffer_viewport struct, then altering coordinates in
weston_surface_to_buffer* functions if there is a scaler set for said
surface.

10 years agocompositor: add stub scaler resources
Jonny Lamb [Tue, 26 Nov 2013 17:19:45 +0000 (18:19 +0100)]
compositor: add stub scaler resources

This registers the wl_scaler global object and lets clients create
wl_surface_scaler objects for surfaces. wl_surface_scaler.set is not
implemented so this doesn't really do anything useful yet.

10 years agoprotocol: crop & scale RFC v3
Pekka Paalanen [Tue, 26 Nov 2013 17:19:44 +0000 (18:19 +0100)]
protocol: crop & scale RFC v3

Add cropping and scaling to wl_surface.

Add a global factory interface wl_scaler, which creates
wl_scaler_surface objects tied to a given wl_surface. The
wl_scaler_surface object can be used to set a cropping and scaling
transformation to change how a wl_buffer maps to wl_surface contents.

Changes in v2:

Take into account buffer_transform and buffer_scale, and try to explain
more clearly how the coordinate transformations work and what their
order is. Add, that crop and scale state is double-buffered. Explain
missing dst_x, dst_y.  Clarify that undefined content still is some
content, but NULL buffer implies no content nor size.

Changes in v3:

Disallow zero values for dst_width and dst_height.

Open issues:

Should this be a separate interface like here, or just a wl_surface
request?

If we keep this as a separate interface, rename wl_surface_scaler to
wl_viewport.

10 years agoAdd a weston_surface_set_size function
Jason Ekstrand [Thu, 5 Dec 2013 02:32:03 +0000 (20:32 -0600)]
Add a weston_surface_set_size function

Surfaces that are created by clients get their size automatically updated
by the attach/commit.  Surfaces created directly by shells (such as black
surfaces) sometimes need to be manually resized.  This function allows you
to do that while being somewhat less messy than messing with the internals
of weston_surface manually.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
10 years agoshell: Reset fullscreen and maximized state on output unplug
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:58 +0000 (22:10 +0200)]
shell: Reset fullscreen and maximized state on output unplug

When a view is moved to another output because its current output was
unplugged, remove the fullscreen and maximized state.

10 years agodesktop-shell: Invalidate saved position when output is destroyed
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:57 +0000 (22:10 +0200)]
desktop-shell: Invalidate saved position when output is destroyed

If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor: Make pointers visible when an output is unplugged
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:56 +0000 (22:10 +0200)]
compositor: Make pointers visible when an output is unplugged

Previously, if a pointer was inside an output that was unplugged, it
could potentialy end up outside any valid output forever. With this
patch, the pointer is moved to the "closest" output to the pointer.

10 years agocompositor: Don't repaint outputs being destroyed
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:55 +0000 (22:10 +0200)]
compositor: Don't repaint outputs being destroyed

Set a flag when an output is being destroyed and use that to avoid
repainting. This allows functions that schedule an output repaint to
be called when the output is being destroyed without causing the
compositor to crash.

10 years agocompositor: Ensure views are visible if their output was unplugged
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:54 +0000 (22:10 +0200)]
compositor: Ensure views are visible if their output was unplugged

Use the output destroy signal to move the views in the event the output
was unplugged.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor: Move views when outputs are moved
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:53 +0000 (22:10 +0200)]
compositor: Move views when outputs are moved

Previously, when an output was moved due to another output being
unplugged, the views on the first output would remain in the same
position.

This patch adds an output_move signal that the views listen too in
order to repostion themselves in the event of an unplug.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor-headless, compositor-rdp: Don't call weston_output_move()
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:52 +0000 (22:10 +0200)]
compositor-headless, compositor-rdp: Don't call weston_output_move()

The call to weston_output_move() when creating the output is
unnecessary. That is already called by wesotn_output_init().

10 years agocompositor: Move the logic of moving outputs into the core
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:51 +0000 (22:10 +0200)]
compositor: Move the logic of moving outputs into the core

Instead of having the backends move the remaining outputs when one is
destroyed, let the core compositor deal with that.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor: Remove output from list in weston_output_destroy()
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:50 +0000 (22:10 +0200)]
compositor: Remove output from list in weston_output_destroy()

When destroying ouputs, they would sometimes be removed before the call
to weston_output_destory() and sometimes after, depending on the
backend. Now the output is remove withing that function so the behavior
is standard across all backends.

10 years agocompositor-x11: Only destroy one output when the close button is pressed
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:49 +0000 (22:10 +0200)]
compositor-x11: Only destroy one output when the close button is pressed

Instead of terminating the compositor, destroy the output whose close
button was clicked and move the other outputs, as is done in the drm
backend.

10 years agoevdev: Drop joystick rejection heurstics
Kristian Høgsberg [Mon, 16 Dec 2013 23:57:53 +0000 (15:57 -0800)]
evdev: Drop joystick rejection heurstics

We now no longer add joysticks at all.  They show up as absolute motion
devices without has_button, so we don't add them as a pointer.  We may add
a keyboard for the keyboard-style keys, but that's fine.  With the previous
commit, we no longer generate spurious absolute pointer motion for the abs
axes.

https://bugs.freedesktop.org/show_bug.cgi?id=71687

10 years agoevdev: Reject absolute motion if we're not a pointer or a touch device
Kristian Høgsberg [Mon, 16 Dec 2013 23:51:22 +0000 (15:51 -0800)]
evdev: Reject absolute motion if we're not a pointer or a touch device

Some joysticks have certain buttons that acts keyboard keys.  As such,
we'll reconize them as keyboards but not pointers.  In that case, don't
send pointer motion events when we get absolute joystick events.