platform/upstream/weston.git
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.

12 years agoRemove stale comment
Kristian Høgsberg [Thu, 8 Dec 2011 15:24:25 +0000 (10:24 -0500)]
Remove stale comment

12 years agocompositor: Use dup instead of fcntl to get a non-CLOEXEC fd
Kristian Høgsberg [Thu, 8 Dec 2011 15:19:40 +0000 (10:19 -0500)]
compositor: Use dup instead of fcntl to get a non-CLOEXEC fd

One less syscall and error path to check, and feels like a cleaner approach.
The commit adds two lines, but that's because we actually handle the
potential error now.

12 years agoUpdate .gitignores
Pekka Paalanen [Fri, 2 Dec 2011 08:23:55 +0000 (10:23 +0200)]
Update .gitignores

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: reset signal mask for children
Pekka Paalanen [Thu, 8 Dec 2011 08:44:56 +0000 (10:44 +0200)]
compositor: reset signal mask for children

The signal mask is inherited over fork() and exec(), we need to
explicitly reset it.

This allows the children to receive the signals the compositor itself
has blocked, for example SIGINT and SIGTERM.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: refactor client forking code
Pekka Paalanen [Fri, 2 Dec 2011 13:30:21 +0000 (15:30 +0200)]
compositor: refactor client forking code

shell.c and tablet-shell.c had almost the same code for forking their
special shell client. Generalise this code and put it into
wlsc_client_launch() in compositor.c.

Improve error cleanup and reporting in wlsc_client_launch().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: add option to not use locking
Pekka Paalanen [Thu, 8 Dec 2011 08:06:53 +0000 (10:06 +0200)]
desktop-shell: add option to not use locking

Add an option to the desktop-shell ini file that defines whether screen
locking is used or not.

Useful for testing screensaver interactions without a lock surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoconfigparser: rename BOOL, document types
Pekka Paalanen [Thu, 8 Dec 2011 07:24:24 +0000 (09:24 +0200)]
configparser: rename BOOL, document types

Rename CONFIG_KEY_BOOL to CONFIG_KEY_BOOLEAN, just like
CONFIG_KEY_INTEGER is not CONFIG_KEY_INT, for consistency.

Document the types expected for the void* and name the enum in the
header, so it is clear what config_key::type means.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agomove config parser to a convenience library
Pekka Paalanen [Mon, 5 Dec 2011 13:58:11 +0000 (15:58 +0200)]
move config parser to a convenience library

Create a new directory for convenience librariers that can be shared
between compositor components and clients.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: no need to unset WAYLAND_SOCKET
Pekka Paalanen [Wed, 7 Dec 2011 06:47:49 +0000 (08:47 +0200)]
desktop-shell: no need to unset WAYLAND_SOCKET

As of commit "client: unset WAYLAND_SOCKET env variable",
58bb064afa3bfc706e3b30dd170804235aa272ea, in the Wayland core, the
Wayland library will unset the environment variable automatically.

No need to explicitly unset it again here.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor-tty: Fix ioctl error handling
David Herrmann [Fri, 2 Dec 2011 15:16:40 +0000 (16:16 +0100)]
compositor-tty: Fix ioctl error handling

(!x < 0) is always false and doesn't make sense here. Looks like a typo so
remove the negation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocompositor: Move a few more utils to util.c
Kristian Høgsberg [Sun, 4 Dec 2011 20:47:16 +0000 (15:47 -0500)]
compositor: Move a few more utils to util.c

12 years agodesktop-shell: Animate surface mapping
Kristian Høgsberg [Sun, 4 Dec 2011 20:32:59 +0000 (15:32 -0500)]
desktop-shell: Animate surface mapping

12 years agocompositor: Split the animation code out of tablet-shell
Kristian Høgsberg [Sun, 4 Dec 2011 20:20:19 +0000 (15:20 -0500)]
compositor: Split the animation code out of tablet-shell

Upside: we can now reuse this.  Downside: we now have a util.c file.

12 years agoshell: forbid multiple wl_shell_surface objects
Pekka Paalanen [Tue, 29 Nov 2011 14:05:28 +0000 (16:05 +0200)]
shell: forbid multiple wl_shell_surface objects

Do not allow multiple wl_shell_surface objects to be created for a
wl_surface object.

Multiple shell_surface objects would confuse the compositor as they
contain separate instances of the shell-private data.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: rename shell_create_shell_surface
Pekka Paalanen [Tue, 29 Nov 2011 13:49:31 +0000 (15:49 +0200)]
shell: rename shell_create_shell_surface

Leftovers from an intermediate patch set, the proper function name is
shell_get_shell_surface. Cosmetic change.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: do not crash without wl_shell
Pekka Paalanen [Tue, 29 Nov 2011 08:25:08 +0000 (10:25 +0200)]
window: do not crash without wl_shell

Since it is the desktop-shell plugin in the compositor that offers both
wl_shell global interface and wl_shell_surface interface, those are not
available on the tablet-shell plugin.

The tablet-shell client uses the toytoolkit, so toytoolkit must work
somehow even without wl_shell.

Turn all operations in toytoolkit that would require wl_shell or
wl_shell_surface into no-ops.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: check for missing wl_shell_surface
Pekka Paalanen [Mon, 28 Nov 2011 13:34:13 +0000 (15:34 +0200)]
shell: check for missing wl_shell_surface

get_shell_surface() returns NULL, if the client has not created or has
destroyed the wl_shell_surface object.

All but one use of get_shell_surface() just retrieve the surface type,
so just fall back to SHELL_SURFACE_NORMAL there.

Resize hot-key binding really needs the wl_shell_surface object, as that
is the only way to send configure events. For surfaces without a
wl_shell_surface, simply do not resize them.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: eliminate wlsc_surface::shell_priv
Pekka Paalanen [Mon, 28 Nov 2011 13:12:34 +0000 (15:12 +0200)]
compositor: eliminate wlsc_surface::shell_priv

Remove shell_priv member from wlsc_surface, and replace it by a search
through the wl_surface destroy_listener_list.

This technique avoids any "extension" members in the wlsc_surface
structure.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: update protocol and client to wl_shell_surface
Pekka Paalanen [Mon, 28 Nov 2011 12:11:15 +0000 (14:11 +0200)]
desktop-shell: update protocol and client to wl_shell_surface

Change desktop-shell protocol to use wl_shell_surface instead of
wl_surface.

Adapt the desktop-shell client and the shell plugin.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowl_shell_surface adaptation
Pekka Paalanen [Fri, 25 Nov 2011 10:09:16 +0000 (12:09 +0200)]
wl_shell_surface adaptation

Protocol changes in Wayland core introduced a new interface
wl_shell_surface, and moved all wl_shell surface methods into it. Adapt
the compositor and its Wayland backend, shell plugin, and all clients to
the new interface.

Depends on the Wayland core commit "protocol: introduce wl_shell_surface"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoevdev: Silence warning
Kristian Høgsberg [Fri, 2 Dec 2011 11:39:02 +0000 (06:39 -0500)]
evdev: Silence warning

12 years agowindow: fix segfault in window_handle_key()
Pekka Paalanen [Mon, 28 Nov 2011 14:13:57 +0000 (16:13 +0200)]
window: fix segfault in window_handle_key()

When a window destroyed, if any input had the window in keyboard
focus, the keyboard focus is reset to NULL. A new keyboard focus is set
only, if the user clicks something. If the user presses a key instead of
clicking, the key press event is sent to the client which has NULL
keyboard focus, triggering a segfault in window_handle_key().

Fix the segfault by ignoring the key event, if there is no target
window.

I triggered this segfault by clicking the unlock dialog away, and then
pressing a key.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: fix resume_desktop for zero clients
Pekka Paalanen [Fri, 25 Nov 2011 14:07:52 +0000 (16:07 +0200)]
shell: fix resume_desktop for zero clients

Fix two bugs:

- if there are no backgrounds at all, the background pointer would have
  been bogus. Lead to a segfault.

- if the hidden_surface_list is empty, wl_list_insert_list() would
  corrupt the list. Lead to a hang in pick_surface().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add a comment about wlsc_surface::output
Pekka Paalanen [Thu, 24 Nov 2011 13:05:07 +0000 (15:05 +0200)]
compositor: add a comment about wlsc_surface::output

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agotablet-shell: Add more interesting lock and home screens
Kristian Høgsberg [Sun, 27 Nov 2011 04:38:41 +0000 (23:38 -0500)]
tablet-shell: Add more interesting lock and home screens

12 years agotablet-shell: Add a stub tablet-shell client
Kristian Høgsberg [Sat, 26 Nov 2011 22:36:23 +0000 (17:36 -0500)]
tablet-shell: Add a stub tablet-shell client

For a start, this is just to we can run and test the corresponding
compositor plugin and keep it from bit-rotting.

12 years agowindow.c: Cache outputs
Kristian Høgsberg [Sat, 26 Nov 2011 22:27:37 +0000 (17:27 -0500)]
window.c: Cache outputs