profile/ivi/weston-ivi-shell.git
12 years agox11: Dont claim the X11 selection when we set the proxy Wayland selection
Kristian Høgsberg [Wed, 4 Jan 2012 04:00:12 +0000 (23:00 -0500)]
x11: Dont claim the X11 selection when we set the proxy Wayland selection

12 years agodata-device: Use a listener list to decouple the x11 selection bridge
Kristian Høgsberg [Wed, 4 Jan 2012 03:58:14 +0000 (22:58 -0500)]
data-device: Use a listener list to decouple the x11 selection bridge

12 years agox11: Initialize wm->incr when converting the TARGETS target
Kristian Høgsberg [Wed, 4 Jan 2012 03:55:25 +0000 (22:55 -0500)]
x11: Initialize wm->incr when converting the TARGETS target

12 years agox11: Handle non-existing properties correctly
Kristian Høgsberg [Wed, 4 Jan 2012 03:53:33 +0000 (22:53 -0500)]
x11: Handle non-existing properties correctly

Don't try to read out ATOM or WINDOW values if there is no such property.

12 years agodata-device: Fix a few bugs in the commit to drop ref-counting
Kristian Høgsberg [Wed, 4 Jan 2012 03:43:36 +0000 (22:43 -0500)]
data-device: Fix a few bugs in the commit to drop ref-counting

Did not test that change.

12 years agoMore weston rename fixes
Kristian Høgsberg [Tue, 3 Jan 2012 19:35:49 +0000 (14:35 -0500)]
More weston rename fixes

12 years agodata-device: Handle source going away instead of ref-counting it
Kristian Høgsberg [Tue, 3 Jan 2012 19:11:07 +0000 (14:11 -0500)]
data-device: Handle source going away instead of ref-counting it

We have to deal with the data source going away.  Even if we have a
reference to the server side data source, we can't do anything if the
client that provided the source went away.  So just NULL the offers
source pointer in the destroy callback for the source.

12 years agoFix a few missing wlsc->weston renames
Kristian Høgsberg [Tue, 3 Jan 2012 16:40:25 +0000 (11:40 -0500)]
Fix a few missing wlsc->weston renames

12 years agoMerge remote-tracking branch 'pq/compositor-dtors-v1'
Kristian Høgsberg [Tue, 3 Jan 2012 16:29:15 +0000 (11:29 -0500)]
Merge remote-tracking branch 'pq/compositor-dtors-v1'

This collided with the big weston rename, but git did a good job of fixing
most cases.

Conflicts:
compositor/compositor.h
src/compositor-x11.c
src/compositor.c
src/screenshooter.c
src/util.c

12 years agoFix distcheck
Kristian Høgsberg [Tue, 3 Jan 2012 16:02:46 +0000 (11:02 -0500)]
Fix distcheck

12 years agoRename wayland-compositor to weston
Kristian Høgsberg [Tue, 3 Jan 2012 15:29:47 +0000 (10:29 -0500)]
Rename wayland-compositor to weston

This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.

1) Initially, we had one big repository with protocol code, sample
compositor and sample clients.  We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code.  At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message.  The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.

2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor.  Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example.  Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.

We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.

12 years agocompositor-x11: improve x11_destroy()
Pekka Paalanen [Tue, 3 Jan 2012 09:58:34 +0000 (11:58 +0200)]
compositor-x11: improve x11_destroy()

Free many things we were leaking before:
- input device
- EGL resources
- xcb event source
- X Display

Fixes lots of Valgrind leaks.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor-x11: implement x11_output_destroy()
Pekka Paalanen [Tue, 3 Jan 2012 09:51:03 +0000 (11:51 +0200)]
compositor-x11: implement x11_output_destroy()

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix use after free in wlsc_zoom_frame
Pekka Paalanen [Tue, 3 Jan 2012 11:27:41 +0000 (13:27 +0200)]
compositor: fix use after free in wlsc_zoom_frame

Add the missing return statement, so the destroyed zoom object is not
used.

Found by Valgrind.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add screenshooter destructor
Pekka Paalanen [Tue, 3 Jan 2012 09:39:13 +0000 (11:39 +0200)]
compositor: add screenshooter destructor

Nothing was freeing the allocation from screenshooter_create().

Add enough boilerplate, that we can free it. Fixes a Valgrind leak.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: remove unused member from wlsc_input_device
Pekka Paalanen [Tue, 3 Jan 2012 08:26:03 +0000 (10:26 +0200)]
compositor: remove unused member from wlsc_input_device

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: free region members on surface destroy
Pekka Paalanen [Tue, 3 Jan 2012 08:23:24 +0000 (10:23 +0200)]
compositor: free region members on surface destroy

The two pixman regions of struct wlsc_surface were not being freed
properly.

Fixes some Valgrind errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add wlsc_input_device_fini()
Pekka Paalanen [Mon, 2 Jan 2012 13:31:01 +0000 (15:31 +0200)]
compositor: add wlsc_input_device_fini()

Add a function for destroying all objects allocated in
wlsc_input_device_init().

This patch depends on "server: add wl_input_device_fini()" commit in the
Wayland core.

Compositor backends could now call wlsc_input_device_fini() to fix some
memory leaks.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: more cleanup on shutdown
Pekka Paalanen [Mon, 2 Jan 2012 14:06:56 +0000 (16:06 +0200)]
compositor: more cleanup on shutdown

Free idle_source, shm, and vertices and indices arrays on compositor
shutdown.

Fixes some Valgrind errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: clean up signal event sources on exit
Pekka Paalanen [Mon, 2 Jan 2012 14:03:26 +0000 (16:03 +0200)]
compositor: clean up signal event sources on exit

Fixes some Valgrind errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: avoid scheduling rendering on shutdown
Pekka Paalanen [Tue, 3 Jan 2012 08:01:20 +0000 (10:01 +0200)]
compositor: avoid scheduling rendering on shutdown

After the compositor exits the main loop in wl_display_run(), set the
compositor state to SLEEPING. This prevents scheduling repaints, that
will never be executed.

A repaint is scheduled by calling wl_event_loop_add_idle(), which
creates an idle event source. Normally the idle event source object is
destroyed after it has been executed. However, in the shutdown case we
never dispatch events again, and the object is leaked.

This leak is triggered by shell.c destructor, which destroys the
desktop-shell client. Destroying a client ends up calling
wlsc_compositor_schedule_repaint() while destroying the client
resources, especially surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: destroy desktop_shell client on exit
Pekka Paalanen [Mon, 2 Jan 2012 14:00:24 +0000 (16:00 +0200)]
shell: destroy desktop_shell client on exit

If the compositor is shutting down while the desktop_shell still exists,
we leaked some resources by not destroying the client record.

Call wl_client_destroy() on the desktop_shell client, if it exists
during shutdown. Fixes some Valgrind errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: destroy all input binding objects on shutdown
Pekka Paalanen [Mon, 2 Jan 2012 13:47:07 +0000 (15:47 +0200)]
compositor: destroy all input binding objects on shutdown

wlsc_binding_destroy() was not being called at all. Fix the leaks by
introducing a function that destroys a whole list of bindings, instead
of individually saving an extra pointer to the binding object and
calling wlsc_binding_destroy() separately on each.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: free regions in wlsc_output_repaint()
Pekka Paalanen [Mon, 2 Jan 2012 13:42:44 +0000 (15:42 +0200)]
compositor: free regions in wlsc_output_repaint()

Some of the local pixman region objects were not being properly
destroyed before returning from the function. Destroy them, fixes
some Valgrind errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add destructors to shell plugins
Pekka Paalanen [Thu, 22 Dec 2011 11:43:43 +0000 (13:43 +0200)]
compositor: add destructors to shell plugins

Add a new wlsc_shell API function for destroying the shell plugin
object. Helps to reduce Valgrind reports.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agox11: Clear X11 selection when we can't bridge the data type
Kristian Høgsberg [Thu, 29 Dec 2011 19:16:42 +0000 (14:16 -0500)]
x11: Clear X11 selection when we can't bridge the data type

12 years agoFix WL_EVENT_WRITEABLE typo
Kristian Høgsberg [Thu, 29 Dec 2011 03:51:20 +0000 (22:51 -0500)]
Fix WL_EVENT_WRITEABLE typo

12 years agox11: Bridge Wayland selections to X11 CLIPBOARD selection
Kristian Høgsberg [Thu, 29 Dec 2011 03:29:23 +0000 (22:29 -0500)]
x11: Bridge Wayland selections to X11 CLIPBOARD selection

This is the other direction.  The selection bridge will grab the X11
CLIPBOARD selection on behalf of the Wayland client when it sets the
Wayland selection.  Right now only UTF-8 text is supported, but the
data types offered will be taken from the Wayland data source.

12 years agoterminal: Don't close fd twice
Kristian Høgsberg [Thu, 29 Dec 2011 03:04:27 +0000 (22:04 -0500)]
terminal: Don't close fd twice

12 years agox11: Handle BadWindow errors
Kristian Høgsberg [Wed, 28 Dec 2011 04:01:23 +0000 (23:01 -0500)]
x11: Handle BadWindow errors

12 years agox11: Remove destroy listener when X11 window is destroyed
Kristian Høgsberg [Wed, 28 Dec 2011 03:47:51 +0000 (22:47 -0500)]
x11: Remove destroy listener when X11 window is destroyed

12 years agox11: Store interesting window properties, dump a few more things
Kristian Høgsberg [Wed, 28 Dec 2011 02:36:41 +0000 (21:36 -0500)]
x11: Store interesting window properties, dump a few more things

12 years agox11: Improvide debugging output a bit
Kristian Høgsberg [Wed, 28 Dec 2011 01:20:46 +0000 (20:20 -0500)]
x11: Improvide debugging output a bit

12 years agox11: Remove a couple of done TODOs
Kristian Høgsberg [Tue, 27 Dec 2011 19:05:36 +0000 (14:05 -0500)]
x11: Remove a couple of done TODOs

12 years agocompositor: Pull in hash table from protocol
Kristian Høgsberg [Tue, 27 Dec 2011 19:02:40 +0000 (14:02 -0500)]
compositor: Pull in hash table from protocol

We use it in the X WM implementation, but we don't want it in the core
libraries.

12 years agox11: Bridge X11 CLIPBOARD selection to Wayland clients
Kristian Høgsberg [Tue, 27 Dec 2011 18:50:04 +0000 (13:50 -0500)]
x11: Bridge X11 CLIPBOARD selection to Wayland clients

12 years agocompositor-x11: Use ARRAY_LENGTH macro from wayland-util.h
Kristian Høgsberg [Fri, 23 Dec 2011 18:33:45 +0000 (13:33 -0500)]
compositor-x11: Use ARRAY_LENGTH macro from wayland-util.h

12 years agocompositor: Handle disappearing surfaces and input devices for touch
Kristian Høgsberg [Thu, 22 Dec 2011 19:43:09 +0000 (14:43 -0500)]
compositor: Handle disappearing surfaces and input devices for touch

12 years agoclients: Add simple-touch client for testing touch events.
Kristian Høgsberg [Thu, 22 Dec 2011 03:54:49 +0000 (22:54 -0500)]
clients: Add simple-touch client for testing touch events.

12 years agoevdev: Store positions for all touch points in the evdev device
Kristian Høgsberg [Thu, 22 Dec 2011 03:18:36 +0000 (22:18 -0500)]
evdev: Store positions for all touch points in the evdev device

We need to store all touchpoint positions so that if we just get an
ABS_MT_POSITION_X or Y event, we can pull the other coordinate from the
cache.  And we need this across invocations of evdev_input_device_data(),
so the accumulator approach doesn't work.

Instead, we go back to the approach of storing all this state in the
evdev device struct and we might as well just move the rel and abs state
there too.

12 years agocompositor: Send touch_up before clearing touch focus
Kristian Høgsberg [Wed, 21 Dec 2011 22:25:54 +0000 (17:25 -0500)]
compositor: Send touch_up before clearing touch focus

Otherwise it never gets sent.

12 years agowindow.c: Add touch event stubs
Kristian Høgsberg [Wed, 21 Dec 2011 22:14:54 +0000 (17:14 -0500)]
window.c: Add touch event stubs

Prevent window.c clients from crashing on touch events.

12 years agowindow.c: Rename input handlers to input_handle_*
Kristian Høgsberg [Wed, 21 Dec 2011 22:11:45 +0000 (17:11 -0500)]
window.c: Rename input handlers to input_handle_*

They're event handlers for the input object, not the window object.

12 years agocompositor: Send out touch events accordingly
Tiago Vignatti [Wed, 21 Dec 2011 17:34:10 +0000 (19:34 +0200)]
compositor: Send out touch events accordingly

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: Add ABS_MT_* support for direct touch devices
Tiago Vignatti [Wed, 21 Dec 2011 17:34:09 +0000 (19:34 +0200)]
evdev: Add ABS_MT_* support for direct touch devices

This adds ABS_MT_* support for direct touch devices and notifies
the compositor.  The compositor has a stub for now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agocompositor: Make surface picking not depend on an input device
Kristian Høgsberg [Wed, 21 Dec 2011 20:15:08 +0000 (15:15 -0500)]
compositor: Make surface picking not depend on an input device

12 years agowindow: destroy surfaces on display_destroy()
Pekka Paalanen [Mon, 19 Dec 2011 08:31:45 +0000 (10:31 +0200)]
window: destroy surfaces on display_destroy()

Destroy the window decoration surfaces and pointer surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: destroy all inputs on display_destroy()
Pekka Paalanen [Fri, 16 Dec 2011 10:02:09 +0000 (12:02 +0200)]
window: destroy all inputs on display_destroy()

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: destroy misc objects on display_destroy()
Pekka Paalanen [Fri, 16 Dec 2011 09:41:32 +0000 (11:41 +0200)]
window: destroy misc objects on display_destroy()

Windows are supposed to be destroyed by the application explicitly.

Deferred tasks are not supposed to be added after returning from
display_run().

Destroy remaining wl objects (except input related will be in a
following patch).

Close the epoll fd.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: destroy outputs on display_destroy()
Pekka Paalanen [Fri, 16 Dec 2011 09:35:34 +0000 (11:35 +0200)]
window: destroy outputs on display_destroy()

This will also start calling the output destroy handlers, if an
application has set any.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: destroy window surfaces and title
Pekka Paalanen [Fri, 16 Dec 2011 08:09:29 +0000 (10:09 +0200)]
window: destroy window surfaces and title

Plugs leaks from struct window in window_destroy().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: remove unused struct members
Pekka Paalanen [Fri, 16 Dec 2011 08:07:12 +0000 (10:07 +0200)]
window: remove unused struct members

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoresizor: add exit key and cleanups
Pekka Paalanen [Thu, 15 Dec 2011 13:26:29 +0000 (15:26 +0200)]
resizor: add exit key and cleanups

Make resizor quit when you press Esc key.

Call the toytoolkit cleanup functions, properly destroy window, display
and frame callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: add display_destroy()
Pekka Paalanen [Thu, 15 Dec 2011 13:20:04 +0000 (15:20 +0200)]
window: add display_destroy()

Add a function to destroy the 'struct display', supposedly with all
contained resources, that are not explicitly created by the application.

The implementation at this time is incomplete. It does clean up the
following:
- xkb structure is freed (needs new libxkbcommon from git)
- EGL resources are freed
- wl_display is flushed and destroyed

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: add display_exit()
Pekka Paalanen [Thu, 15 Dec 2011 08:14:07 +0000 (10:14 +0200)]
window: add display_exit()

Add a function, that schedules the display_run() event loop to break
out.

When display_exit() is called, processing continues as usual, until
currently waiting events and deferred tasks have been processed, and
sent requests are flushed. Then, display_run() will return.

This enables toytoolkit apps to handle their exit instead of just being
killed or call exit().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agosimple clients: flush before destroying wl_display
Pekka Paalanen [Thu, 15 Dec 2011 08:07:52 +0000 (10:07 +0200)]
simple clients: flush before destroying wl_display

Flush our pending destroy requests to the server before destroying the
wl_display.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agosimple-egl: implement destructors
Pekka Paalanen [Tue, 13 Dec 2011 12:50:25 +0000 (14:50 +0200)]
simple-egl: implement destructors

Destroy all wl objects and call EGL cleanup functions. Reduces leaks
reported by Valgrind considerably, though not to zero.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agosimple-shm: implement destructors
Pekka Paalanen [Tue, 13 Dec 2011 11:48:24 +0000 (13:48 +0200)]
simple-shm: implement destructors

Implement proper destructors that call the wayland destroy functions.

With this and the "client: fix a strdup memory leak" patch in Wayland
core, simple-shm now runs Valgrind-clean (memcheck).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agosimple clients: add signal handler for clean exit
Pekka Paalanen [Tue, 13 Dec 2011 10:09:09 +0000 (12:09 +0200)]
simple clients: add signal handler for clean exit

Add signal handler for SIGINT to simple-egl and simple-shm, so they can
be exited voluntarily, without killing them. Later we can add clean-up
code and destructors, and check with valgrind for leaks and errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix uniform handling for fade_output()
Pekka Paalanen [Tue, 20 Dec 2011 14:38:25 +0000 (16:38 +0200)]
compositor: fix uniform handling for fade_output()

fade_output() is strange in that it manufactures a wlsc_surface object
by hand, and then calls wlsc_surface_draw() on it.

Valgrind complained, that wlsc_surface_draw() accesses uninitialised
data: wlsc_surface::alpha. fade_output() forgets to set it.

Initialise surface.alpha in fade_output(). Specifically, set it to
compositor->current_alpha to deliberatly avoid the gluniform1f() call in
wlsc_surface_draw().

fade_output() binds a different GL shader program than
wlsc_surface_draw() expects. This program does not have a uniform called
"alpha", and the uniform location given in glUniform1f() is not for
this program anyway. A hint of that is the runtime error:
Mesa: User error: GL_INVALID_OPERATION in glUniform(type mismatch)

Fixing this seems to get rid of half a thousand of Valgrind errors, and
of course the Mesa user error.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoclients: Implement a toy-menu for testing the menu surface type
Kristian Høgsberg [Mon, 19 Dec 2011 20:40:10 +0000 (15:40 -0500)]
clients: Implement a toy-menu for testing the menu surface type

12 years agoresizor: Use symbolic name for BTN_RIGHT
Kristian Høgsberg [Mon, 19 Dec 2011 20:36:10 +0000 (15:36 -0500)]
resizor: Use symbolic name for BTN_RIGHT

Also, we were actually using BTN_MIDDLE before.

12 years agocompositor: Remove shell->activate callback
Kristian Høgsberg [Mon, 19 Dec 2011 20:19:54 +0000 (15:19 -0500)]
compositor: Remove shell->activate callback

It's all internal to the shell plugin now.

12 years agocompositor: Move click-to-focus and ctrl-alt-bs bindings to shell.c
Kristian Høgsberg [Mon, 19 Dec 2011 20:18:05 +0000 (15:18 -0500)]
compositor: Move click-to-focus and ctrl-alt-bs bindings to shell.c

12 years agocompositor: Move binding code to util.c
Kristian Høgsberg [Mon, 19 Dec 2011 20:16:06 +0000 (15:16 -0500)]
compositor: Move binding code to util.c

12 years agocompositor: Consolidate code for finding and running bindings
Kristian Høgsberg [Mon, 19 Dec 2011 19:59:57 +0000 (14:59 -0500)]
compositor: Consolidate code for finding and running bindings

12 years agocompositor: Make click to activate behavior a binding
Kristian Høgsberg [Mon, 19 Dec 2011 19:54:11 +0000 (14:54 -0500)]
compositor: Make click to activate behavior a binding

12 years agox11: Ignore FocusOut with mode = NotifyUngrab
Kristian Høgsberg [Mon, 19 Dec 2011 19:36:50 +0000 (14:36 -0500)]
x11: Ignore FocusOut with mode = NotifyUngrab

Not sure why we get these, but it happens for Alt-click to move a window
(metacity binding) and messes up the idle inhibit counter.
FocusOut event as a result of ungrabbing doesn't really make sense and
fortunately we can safely ignore them.

12 years agowindow: do proper Cairo device flushing
Pekka Paalanen [Mon, 19 Dec 2011 11:57:59 +0000 (13:57 +0200)]
window: do proper Cairo device flushing

The Cairo documentation tells us to always call cairo_device_flush()
before using other rendering APIs on the cairo surface, especially where
the Cairo device shares state with us (that is, EGL and GL state in this
case).

Add a call to cairo_device_flush() into display_acquire_window_surface(),
which the toytoolkit offers for switching to native (GL) rendering.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoevdev: new header file for the driver
Tiago Vignatti [Sun, 18 Dec 2011 23:14:03 +0000 (01:14 +0200)]
evdev: new header file for the driver

Besides the new header file, there's also a change in the main evdev creation
procedure for a more suggestive name (evdev_input_add_devices ->
evdev_input_create). There's no real functional changes in this commit.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agocompositor-drm: remove/add evdev devices when vt switches
Tiago Vignatti [Sun, 18 Dec 2011 22:32:48 +0000 (00:32 +0200)]
compositor-drm: remove/add evdev devices when vt switches

Reported-by: Ran Benite <ran234@gmail.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agocompositor: first destroy backend routines and then display
Tiago Vignatti [Sun, 18 Dec 2011 22:04:46 +0000 (00:04 +0200)]
compositor: first destroy backend routines and then display

I caught this when an evdev device fd was trying to trigger the main event
loop, which was already free'd and causing an invalid read.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agocompositor-drm: destroy evdev driver properly when finishing compositor
Tiago Vignatti [Sun, 18 Dec 2011 21:52:18 +0000 (23:52 +0200)]
compositor-drm: destroy evdev driver properly when finishing compositor

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: use a separate function for adding devices
Tiago Vignatti [Sun, 18 Dec 2011 14:47:15 +0000 (16:47 +0200)]
evdev: use a separate function for adding devices

Adds new function evdev_add_devices for adding udev devices. No
functional changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agocompositor: use wl_list_for_each_safe when destroying output
Tiago Vignatti [Sun, 18 Dec 2011 20:27:40 +0000 (22:27 +0200)]
compositor: use wl_list_for_each_safe when destroying output

Was causing an invalid read when the output is in fact destroyed. That's only
visible (segfault on my machine) on drm compositor because it's the only
backend trying to finish correct the compositor.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoActivate toplevel fullscreen and menu surfaces
Juan Zhao [Thu, 15 Dec 2011 16:31:51 +0000 (11:31 -0500)]
Activate toplevel fullscreen and menu surfaces

Activate the toplevel, fullscrren and menu surfaces during mapping,
so that the launched applications can get the keyboard focus without
clicking on that window.

12 years agodesktop-shell: Animate surface opacity in zoom animation as well
Kristian Høgsberg [Thu, 15 Dec 2011 16:24:25 +0000 (11:24 -0500)]
desktop-shell: Animate surface opacity in zoom animation as well

12 years agocompositor: Implement surface global alpha
Kristian Høgsberg [Wed, 14 Dec 2011 14:24:11 +0000 (09:24 -0500)]
compositor: Implement surface global alpha

Just a small tweak to the shader and we can control the overall surface alpha.

12 years agocompositor: Remove server side cursors
Kristian Høgsberg [Thu, 15 Dec 2011 14:14:34 +0000 (09:14 -0500)]
compositor: Remove server side cursors

We always expect the clients to set the cursor and attaching a NULL buffer
hides the cursor.  The cursor starts out hidden.

12 years agocompositor: let shell override idle time
Pekka Paalanen [Wed, 7 Dec 2011 14:22:00 +0000 (16:22 +0200)]
compositor: let shell override idle time

Move idle_time variable to struct wlsc_compositor, so that a shell
plugin can change it. Also store the original value from the command
line.

Add "duration" option to the desktop-shell screensaver config. This is
the time the screensaver will be visible, after idle timeout triggers
another time and blanks the screen.

Now you can have different delays to lock the screen, and switch off the
screen while a screensaver is running.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: use desktop-shell ini file for screensaver path
Pekka Paalanen [Wed, 7 Dec 2011 09:49:52 +0000 (11:49 +0200)]
shell: use desktop-shell ini file for screensaver path

Read the same configuration file in the shell plugin (desktop-shell) as
the desktop-shell client does.

Add a new section "screensaver", where "path" defines the path of the
idle animation client to be executed. Not defining "path" disables the
animation.

Idle animations are not in use by default. It must be configured in
wayland-desktop-shell.ini or launched manually.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: automatic exec and kill of wscreensaver
Pekka Paalanen [Fri, 2 Dec 2011 14:31:49 +0000 (16:31 +0200)]
shell: automatic exec and kill of wscreensaver

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add IDLE state
Pekka Paalanen [Fri, 2 Dec 2011 11:07:27 +0000 (13:07 +0200)]
compositor: add IDLE state

Add WLSC_COMPOSITOR_IDLE state to the possible compositor internal
states, and fix the drm backend to restore the previous state instead of
forcing ACTIVE.

Normally, the compositor only uses the ACTIVE and SLEEPING states. The
IDLE state is another active state, reserved for the shell, when the
shell wants to have unlock() calls on activity, but the compositor cannot
be SLEEPING.

Use the IDLE state to fix exposing the unlock dialog while a screensaver
is animating. Without this fix, is it impossible to activate the unlock
dialog without waiting for a second idle timeout that really puts the
compositor into SLEEPING.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: center the unlock dialog
Pekka Paalanen [Fri, 2 Dec 2011 08:59:17 +0000 (10:59 +0200)]
shell: center the unlock dialog

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix re-fading
Pekka Paalanen [Fri, 2 Dec 2011 08:39:49 +0000 (10:39 +0200)]
compositor: fix re-fading

Reorder code in fade_frame() to that if shell->lock() calls
wlsc_compositor_wake(), the fade animation will run again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: let screensaver wake up the compositor
Pekka Paalanen [Thu, 1 Dec 2011 14:23:57 +0000 (16:23 +0200)]
shell: let screensaver wake up the compositor

Screensavers become visible the first time only after the compositor has
gone to sleep state. Therefore, to see screensaver in the start, wake up
the compositor. After a second idle timeout, the compositor will stay
sleeping.

We could also not apply this patch. It would mean the screensavers would
be visible only with the unlock dialog, and not become visible
automatically.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: implement screensaver surface type
Pekka Paalanen [Wed, 30 Nov 2011 14:26:35 +0000 (16:26 +0200)]
shell: implement screensaver surface type

Implement the basics of screensaver surface management. Exec'ing and
killing the screensaver client is punted for later.

When a surface registered as a screensaver is mapped, it stays hidden
if the screen is not locked, or it is added to the compositor visible
surfaces list if the screen is locked.

The map() is restructured to set initial position first, and stacking
next. This allows SHELL_SURFACE_SCREENSAVER share positioning with
SHELL_SURFACE_FULLSCREEN, while show_screensaver() does its own
wlsc_surface_configure() call.

Also fix centering to the given fullscreen output, not the first output.

Another bug fix: previously configure() would call
wlsc_surface_configure() unconditionally, which assigns an output to
the surface. While the compositor is locked, if an application resizes
its window, we hit configure() and assign an output while the surface is
not in compositor->surface_list. This leads to invalid memory access on
the next call to wlsc_surface_damage_below(). Fix this by not calling
wlsc_surface_configure() for surfaces that are not visible.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: handle surface type reassignment
Pekka Paalanen [Thu, 1 Dec 2011 08:42:22 +0000 (10:42 +0200)]
shell: handle surface type reassignment

So far nothing prevented a client for registering a surface as one type
and then as another type. With some special types, this would lead to
corrupted wl_lists.

Add a function, that either resets the surface type or posts an error to
the client. In case of an error, the set type operation must be aborted.

Change the type name SHELL_SURFACE_NORMAL to SHELL_SURFACE_NONE, as
there is nothing normal in the "none" type which just means uninitialised.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowscreensaver: implement screensaver interface
Pekka Paalanen [Wed, 30 Nov 2011 12:45:47 +0000 (14:45 +0200)]
wscreensaver: implement screensaver interface

Create instances from outputs, and register the surfaces as
screensavers. Support multiple "Mode" instances.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: expose outputs to applications
Pekka Paalanen [Wed, 30 Nov 2011 08:52:38 +0000 (10:52 +0200)]
window: expose outputs to applications

Add output_configure_handler as a display property. This exposes only
configured outputs, that is the current mode info is already received,
to applications.

The handler is also called for mode changes on an existing output. This
simplifies the implementation in toytoolkit as we can defer the handler
calls from wl_output binding time to when we receive the current mode.
We do not need separate handlers for "new output" and "mode changed". A
plain "new output" handler would be problematic as the current mode is
not known yet.

Also add delete_handler hook for outputs, but that will never be called
for now, as the protocol lacks a way to signal output disconnections.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoprotocol: add screensaver interface
Pekka Paalanen [Thu, 24 Nov 2011 09:34:05 +0000 (11:34 +0200)]
protocol: add screensaver interface

Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.

When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.

The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoevdev: run flush_motion only when needed
Tiago Vignatti [Thu, 8 Dec 2011 11:20:46 +0000 (13:20 +0200)]
evdev: run flush_motion only when needed

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: send old valuator inside event frame when the other is missing
Tiago Vignatti [Thu, 8 Dec 2011 10:18:16 +0000 (12:18 +0200)]
evdev: send old valuator inside event frame when the other is missing

when a motion is being performed on ts device, only one axis can be sent
through the evdev bytestream whereas the other could be omitted. For instance:

   -------------- SYN_REPORT ------------
   type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 22208
   type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 631
   type 3 (EV_ABS), code 0 (ABS_X), value 22208
   -------------- SYN_REPORT ------------

on such case we'd have to send the compositor the old value of Y. Commit
f547bd36 introduced this bug cause it was sending zeroed coordinate and not
the old one.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agocompositor-drm: Catch errors in create_output_for_connector
David Herrmann [Thu, 8 Dec 2011 16:05:46 +0000 (17:05 +0100)]
compositor-drm: Catch errors in create_output_for_connector

We do not handle errors of gbm-buffer-creation and drm-mode-setting in
create_output_for_connectors. Correctly catch these now and free memory on error
to avoid memory leaks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocompositor-drm: Free output on error in create_output_for_connector
David Herrmann [Thu, 8 Dec 2011 16:05:45 +0000 (17:05 +0100)]
compositor-drm: Free output on error in create_output_for_connector

We currently simply return -1 on error in create_output_for_connector. This
correctly frees the output and all modes when we fail to avoid memory leaks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocompositor-drm: Fix memory leak in create_output_for_connector
David Herrmann [Thu, 8 Dec 2011 16:05:44 +0000 (17:05 +0100)]
compositor-drm: Fix memory leak in create_output_for_connector

We do not free the encoder structure on failure. Fix that.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocompositor-drm: Fix memory leak in update_outputs
David Herrmann [Thu, 8 Dec 2011 16:05:43 +0000 (17:05 +0100)]
compositor-drm: Fix memory leak in update_outputs

We need to correctly free every connector we retrieve. We currently loose them
if they are not connected.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocompositor-x11: convert (some) of X11 buttons to linux input
Tiago Vignatti [Thu, 8 Dec 2011 15:03:17 +0000 (17:03 +0200)]
compositor-x11: convert (some) of X11 buttons to linux input

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoshell: fix set_transient
Pekka Paalanen [Thu, 8 Dec 2011 14:42:33 +0000 (16:42 +0200)]
shell: fix set_transient

In the wl_shell_surface migration, I forgot to correct one cast in
shell_surface_set_transient(). 'parent_resource' is not a (struct
wlsc_surface *) but (struct shell_surface *).

This bug corrupts a wlsc_surface::output field, which later (in my
experiments) leads to a segmentation fault in surface_frame().

Fix the casts.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoUse '-' to separate words in file names
Kristian Høgsberg [Thu, 8 Dec 2011 17:44:27 +0000 (12:44 -0500)]
Use '-' to separate words in file names

Eventually we will want more functionality in the shared library and we
will rename it at that point.  Perhaps we'll name it libnih, but for now
let's stick with libconfig-parser.