profile/ivi/wayland.git
12 years agoserver: use the event sending wrappers
Pekka Paalanen [Fri, 2 Mar 2012 15:08:59 +0000 (17:08 +0200)]
server: use the event sending wrappers

This exposes some type mismatches that are fixed in the next commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoscanner: emit event wrapper functions for server
Pekka Paalanen [Fri, 2 Mar 2012 13:16:33 +0000 (15:16 +0200)]
scanner: emit event wrapper functions for server

Generate typed wrapper functions for sending events in a server.

This allows compile time type checking, unlike the existing method of
calling the variadic function wl_resource_post_event().

The stuff in wayland-server.h had to be slightly reordered to have all
(forward) declarations before use.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowayland-server: Destroy resource before sending out delete_id event
Kristian Høgsberg [Fri, 2 Mar 2012 03:46:07 +0000 (22:46 -0500)]
wayland-server: Destroy resource before sending out delete_id event

In some cases, we send out events from the resource destructor and
those need to go out before we recycle the object ID.

12 years agoFix server crash when a client dies during a drag with an icon
Ander Conselvan de Oliveira [Thu, 1 Mar 2012 12:09:42 +0000 (14:09 +0200)]
Fix server crash when a client dies during a drag with an icon

If a client dies during a drag that it started using an icon surface,
the server could crash because the icon surface is not valid anymore.

Fix this by using a destroy listener to reset device->drag_surface to
nil when the surface is destroyed.

12 years agoFix wl_data_offer source destroy listener
Ander Conselvan de Oliveira [Thu, 1 Mar 2012 12:09:41 +0000 (14:09 +0200)]
Fix wl_data_offer source destroy listener

The listener function implementation was getting a wrong pointer to the
wl_data_offer object because the resource parameter is actually the
data source and not the data offer.

12 years agoconfigure.ac: Fix test-for-empty bug
Kristian Høgsberg [Wed, 29 Feb 2012 17:49:25 +0000 (12:49 -0500)]
configure.ac: Fix test-for-empty bug

From Gaetan Nadon:

./configure: line 11662: test: !=: unary operator expected
AM_CONDITIONAL([HAVE_XSLTPROC], [test $XSLTPROC != ""])
AM_CONDITIONAL([HAVE_PUBLICAN], [test $PUBLICAN != ""])

It shows up when you do not have publican. The usual "testing for blank" bug.

12 years agoprotocol: Clarify the documentation for the fullscreen protocol
Rob Bradford [Tue, 28 Feb 2012 16:48:26 +0000 (16:48 +0000)]
protocol: Clarify the documentation for the fullscreen protocol

12 years agoMerge remote-tracking branch 'whot/publican'
Kristian Høgsberg [Wed, 29 Feb 2012 16:54:36 +0000 (11:54 -0500)]
Merge remote-tracking branch 'whot/publican'

12 years agoDon't block when flushing a full protocol buffer
Kristian Høgsberg [Wed, 29 Feb 2012 16:07:48 +0000 (11:07 -0500)]
Don't block when flushing a full protocol buffer

In case the client isn't responding, this will block the compositor.
Instead we flush with MSG_DONTWAIT, which lets us fill up the kernel buffer
as much as we can (after not returning EPOLLOUT anymore it still can take
80k more), and then disconnect the client if we get EAGAIN.

12 years agoHack up distcheck for publican
Peter Hutterer [Wed, 29 Feb 2012 01:49:16 +0000 (11:49 +1000)]
Hack up distcheck for publican

Publican requires a read-write source tree, see
http://bugzilla.redhat.com/show_bug.cgi?id=798484

And it currently cannot build out-of-tree, so we need to copy the sources
into the _build tree and generate Protocol.xml into that tree too (we'd have
to do this anyway since automake creates a read-only source tree, so we
can't just link).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoGenerate the docbook description for the protocol from wayland.xml
Peter Hutterer [Fri, 24 Feb 2012 07:31:51 +0000 (17:31 +1000)]
Generate the docbook description for the protocol from wayland.xml

Convert the wayland.xml protocol description to a docbook-compatible format
and hook it up to the publican sources.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoHook up autotools for publican
Peter Hutterer [Thu, 23 Feb 2012 23:42:05 +0000 (09:42 +1000)]
Hook up autotools for publican

automake doesn't seem to provide a sensible method to install a directory of
stuff in $(docdir). Do it manually then.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agodoc: Comment out some of the default chapters
Peter Hutterer [Tue, 28 Feb 2012 22:42:26 +0000 (08:42 +1000)]
doc: Comment out some of the default chapters

I'll leave them in for now as a template for how things looked originally,
this can be removed later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agodoc: Add architecture from the website
Peter Hutterer [Fri, 24 Feb 2012 01:01:39 +0000 (11:01 +1000)]
doc: Add architecture from the website

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agodoc: Fix up title page with logo and author information
Peter Hutterer [Thu, 23 Feb 2012 23:47:44 +0000 (09:47 +1000)]
doc: Fix up title page with logo and author information

Abstract taken from http://wayland.freedesktop.org

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agodoc: add publican-created doctree
Peter Hutterer [Thu, 23 Feb 2012 23:37:02 +0000 (09:37 +1000)]
doc: add publican-created doctree

$> publican create --name=Wayland
unmodified otherwise

To build the tree to target formats, use
$> publican build --langs=en-US --formats=html,pdf

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoprotocol: fix make distcheck
Peter Hutterer [Wed, 29 Feb 2012 00:40:53 +0000 (10:40 +1000)]
protocol: fix make distcheck

Distribute all source files that we need for buildling.
Plus, remove the html file on make clean.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoUpdate TODO
Kristian Høgsberg [Tue, 28 Feb 2012 21:42:17 +0000 (16:42 -0500)]
Update TODO

12 years agoAllow update function to not be set in wl_display_get_fd
Samuel Rødal [Mon, 27 Feb 2012 15:57:42 +0000 (16:57 +0100)]
Allow update function to not be set in wl_display_get_fd

Ignore previous patch, here's the correct version.

From 4e1bedaaf05b576f5191f8fe3a34904ab9707414 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com>
Date: Mon, 27 Feb 2012 15:17:20 +0100
Subject: [PATCH] Allow update function to not be set in wl_display_get_fd

The same check is done in connection_update, and now with
wl_display_flush() there's less need for the client to need to know the
connection mask.

12 years agoRename client side wl_display_destroy() to wl_display_disconnect()
Samuel Rødal [Mon, 27 Feb 2012 16:10:03 +0000 (17:10 +0100)]
Rename client side wl_display_destroy() to wl_display_disconnect()

This avoids the clash with the wayland-server version with the same
name, and allows linking against both wayland-client and wayland-server
at the same time, which can be useful for unit testing purposes as
well as for nested compositing.

Without this there will be crashes as the wrong wl_display_destroy()
is called.

12 years agoutil: Comments before wl_list were a bit off, fixed the example usage.
Üstün Ergenoğlu [Sat, 25 Feb 2012 10:56:32 +0000 (12:56 +0200)]
util: Comments before wl_list were a bit off, fixed the example usage.

Signed-off-by: Üstün Ergenoğlu <ego@ustun.fi>
12 years agoprotocol.xsl: Rename stylesheet to wayland-protocol.css
Kristian Høgsberg [Thu, 23 Feb 2012 21:41:46 +0000 (16:41 -0500)]
protocol.xsl: Rename stylesheet to wayland-protocol.css

Otherwise it clashes with the website stylesheet.

12 years agoprotocol: add xslt stylesheet to prettify the protocol
Peter Hutterer [Thu, 23 Feb 2012 05:58:37 +0000 (15:58 +1000)]
protocol: add xslt stylesheet to prettify the protocol

Includes rudimentary styling only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoprotocol: fix missing hyphenation for "client-created"
Peter Hutterer [Thu, 23 Feb 2012 05:55:41 +0000 (15:55 +1000)]
protocol: fix missing hyphenation for "client-created"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoscanner: Remove unused variable 'len'
Peter Hutterer [Thu, 23 Feb 2012 05:55:40 +0000 (15:55 +1000)]
scanner: Remove unused variable 'len'

scanner.c: In function ‘desc_dump’:
scanner.c:142:42: warning: unused variable ‘len’ [-Wunused-variable]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agospec: padding bytes are undefined, state so
Peter Hutterer [Thu, 23 Feb 2012 05:55:39 +0000 (15:55 +1000)]
spec: padding bytes are undefined, state so

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agospec: typo and wording fixes
Peter Hutterer [Thu, 23 Feb 2012 05:55:38 +0000 (15:55 +1000)]
spec: typo and wording fixes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
12 years agoFix compilation: uid_t, gid_t and pid_t are defined in sys/types.h
Thiago Macieira [Thu, 23 Feb 2012 18:50:37 +0000 (19:50 +0100)]
Fix compilation: uid_t, gid_t and pid_t are defined in sys/types.h

This error shows up in third-party code when including
wayland-server.h.

12 years agoAdd wl_region and surface requests to set opaque and input regions
Kristian Høgsberg [Thu, 23 Feb 2012 19:50:06 +0000 (14:50 -0500)]
Add wl_region and surface requests to set opaque and input regions

12 years agoSplit pointer_focus and keyboard_focus into enter and leave events
Kristian Høgsberg [Sat, 18 Feb 2012 06:25:44 +0000 (01:25 -0500)]
Split pointer_focus and keyboard_focus into enter and leave events

12 years agoserver: Implement wl_keyboard_grab_interface.
Scott Moreau [Sat, 18 Feb 2012 12:05:28 +0000 (05:05 -0700)]
server: Implement wl_keyboard_grab_interface.

12 years agoserver: Rename wl_grab_interface.
Scott Moreau [Sat, 18 Feb 2012 12:05:27 +0000 (05:05 -0700)]
server: Rename wl_grab_interface.

In order to separate pointer and keyboard grabs, we need to
introduce a keyboard grab interface but first we must rename
some generic types to denote which device is holding the grab.

Type renames:

wl_grab_interface -> wl_pointer_grab_interface
wl_grab -> wl_pointer_grab
wl_input_device_start_grab -> wl_input_device_start_pointer_grab
wl_input_device_end_grab -> wl_input_device_end_pointer_grab

12 years agoAdd wl_client_get_credentials() to get unix credentials for client
Kristian Høgsberg [Sat, 18 Feb 2012 05:29:25 +0000 (00:29 -0500)]
Add wl_client_get_credentials() to get unix credentials for client

12 years agoprotocol: remove absolute coordinates from pointer
Pekka Paalanen [Tue, 14 Feb 2012 09:00:12 +0000 (11:00 +0200)]
protocol: remove absolute coordinates from pointer

Remove the absolute coordinate fields from the pointer motion and
pointer_focus events. Clients are not supposed to see any global
coordinates.

Fix wayland-server code accordingly. wayland-client code is unaffected.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodata_device: get rid of attach request
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 15:02:52 +0000 (17:02 +0200)]
data_device: get rid of attach request

In the effort to make everything a regular surface, remove
data_device.attach request. To maintan the functionality, add
an icon surface parameter to data_device.start_drag.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
12 years agoAdd fullscreen protocol
Juan Zhao [Tue, 7 Feb 2012 05:39:36 +0000 (13:39 +0800)]
Add fullscreen protocol

Map the surface as a fullscreen surface. On the output the
surface is assigned to. The client can use different fulllscreen
method to fix the size mismatch issue: default, scale, driver
and fill.

Hints to indicate compositor how to deal with this fullscreen surface.

"default" means the client has no preference on fullscreen
          behavior, policies are determined by compositor.
"scale"   means the client prefers scaling by the compositor.
          Scaling would always preserve surface's aspect ratio.
          And the surface is centered.
"driver"  means the client wants to switch video mode to the
          smallest mode that can fit the client buffer. If the
          sizes do not match, black borders are added. And the
          framerate parameter is used for "driver" method,
          to indicate the preferred framerate. framerate=0 means
          that the app does not care about framerate
"fill"    means the client wants to add blackborders to the
          surface. This would be preferring 1:1 pixel mapping
          in the monitor native video mode. The surface is
          centered.

12 years agoAdd maximized protocol
Juan Zhao [Tue, 7 Feb 2012 01:38:10 +0000 (09:38 +0800)]
Add maximized protocol

A request from the client to ask the compositor to maximize the surface.
The compositor will reply with a configure event telling
the expected new surface size.  The operation is completed on the
next buffer attach to this surface.

A maximized client will fill the fullscreen of the output it is bound
to, except the panel area. This is the main difference between
a maximized shell surface and a fullscreen shell surface.

12 years agoUse dist-xz for tarballs
Kristian Høgsberg [Thu, 9 Feb 2012 16:15:33 +0000 (11:15 -0500)]
Use dist-xz for tarballs

12 years agoSet version to 'master' on git master branch
Kristian Høgsberg [Thu, 9 Feb 2012 16:12:18 +0000 (11:12 -0500)]
Set version to 'master' on git master branch

12 years agoscanner: don't print new line when no descriptions are provided
Tiago Vignatti [Tue, 24 Jan 2012 16:30:13 +0000 (18:30 +0200)]
scanner: don't print new line when no descriptions are provided

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoprotocol: fix typo
Tiago Vignatti [Tue, 24 Jan 2012 15:49:28 +0000 (17:49 +0200)]
protocol: fix typo

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agospec: fix typo
Tiago Vignatti [Tue, 24 Jan 2012 14:11:33 +0000 (16:11 +0200)]
spec: fix typo

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoDrop warning when we receive an event for zombie objects
Kristian Høgsberg [Thu, 9 Feb 2012 13:28:21 +0000 (08:28 -0500)]
Drop warning when we receive an event for zombie objects

Business as usual, but the message is confusing.

12 years agowayland-util.h: Avoid un-namespaced _container_of
Kristian Høgsberg [Tue, 24 Jan 2012 14:52:25 +0000 (09:52 -0500)]
wayland-util.h: Avoid un-namespaced _container_of

Yes, there are worse offenders in that file, but this one isn't used in
the code and it makes Xorg angry.

12 years agospec: list core interfaces with short descriptions
Jesse Barnes [Wed, 18 Jan 2012 18:06:02 +0000 (10:06 -0800)]
spec: list core interfaces with short descriptions

Plus fix up misc. grammar.

12 years agospec: update high level description, add diagrams
Jesse Barnes [Wed, 18 Jan 2012 17:33:34 +0000 (09:33 -0800)]
spec: update high level description, add diagrams

Add diagrams from the Wayland architecture page and add some more high
level text describing X limitations and Wayland architecture.

12 years agoscanner: allow summary attributes in args and <description> in <protocol>
Jesse Barnes [Thu, 19 Jan 2012 22:13:36 +0000 (14:13 -0800)]
scanner: allow summary attributes in args and <description> in <protocol>

Add support for arg summaries for use by detailed structure element
descriptions.

12 years agoprotocol: Convert comments to new documentation tags
Kristian Høgsberg [Thu, 19 Jan 2012 00:17:23 +0000 (19:17 -0500)]
protocol: Convert comments to new documentation tags

12 years agoscanner: Support documentation elements
Jesse Barnes [Wed, 18 Jan 2012 22:09:47 +0000 (14:09 -0800)]
scanner: Support documentation elements

On Wed, 18 Jan 2012 12:29:37 -0800
"Kristensen, Kristian H" <kristian.h.kristensen@intel.com> wrote:
> Yeah, that looks good.  I was thinking of a separate <description> tag
> to avoid stuffing too much into an attribute.

How does this look?  It adds a summary attribute to atomic elements,
and a <description> tag with a summary for others.  Spits out enum
documentation like this:

/**
 * wl_display_error - global error values
 * @WL_DISPLAY_ERROR_INVALID_OBJECT: server couldn't find object
 * @WL_DISPLAY_ERROR_INVALID_METHOD: method doesn't exist on the specified interface
 * @WL_DISPLAY_ERROR_NO_MEMORY: server is out of memory
 *
 * These errors are global and can be emitted in response to any server request.
 */
enum wl_display_error {
WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
WL_DISPLAY_ERROR_INVALID_METHOD = 1,
WL_DISPLAY_ERROR_NO_MEMORY = 2,
};

and structure documentation like this:

/**
 * wl_display - core global object
 * @bind: bind an object to the display
 * @sync: (none)
 *
 * The core global object. This is a special singleton object. It is used for
 * internal wayland protocol features.
 */
struct wl_display_interface {
void (*bind)(struct wl_client *client,
     struct wl_resource *resource,
     uint32_t name,
     const char *interface,
     uint32_t version,
     uint32_t id);
void (*sync)(struct wl_client *client,
     struct wl_resource *resource,
     uint32_t callback);
};

12 years agoFix 'make dist' as connection.h no longer exists
Richard Hughes [Fri, 13 Jan 2012 09:20:48 +0000 (09:20 +0000)]
Fix 'make dist' as connection.h no longer exists

12 years agoserver: In default grab, update focus resource after sending release
Neil Roberts [Thu, 12 Jan 2012 15:48:02 +0000 (15:48 +0000)]
server: In default grab, update focus resource after sending release

The default grab implementation in wayland-server was updating the
focus resource before sending the button event. This would cause the
button release to be dropped from the implicit grab if the pointer is
moved away from the focus surface. This patch just swaps the order
around.

12 years agoshm: Drop non-premul format, use less ambiguous ARGB8888 naming convention
Kristian Høgsberg [Wed, 11 Jan 2012 19:19:50 +0000 (14:19 -0500)]
shm: Drop non-premul format, use less ambiguous ARGB8888 naming convention

This also matches the new wl_drm format names.

12 years agoAdd new wl_shell popup surface type
Kristian Høgsberg [Thu, 5 Jan 2012 13:50:25 +0000 (08:50 -0500)]
Add new wl_shell popup surface type

12 years agoMove data device implementation into wayland-server
Kristian Høgsberg [Thu, 5 Jan 2012 02:40:21 +0000 (21:40 -0500)]
Move data device implementation into wayland-server

12 years agoMove default grab implementation to wayland-server
Kristian Høgsberg [Thu, 5 Jan 2012 02:29:17 +0000 (21:29 -0500)]
Move default grab implementation to wayland-server

12 years agoNew grab API
Kristian Høgsberg [Thu, 5 Jan 2012 02:27:26 +0000 (21:27 -0500)]
New grab API

This commit changes the way struct wl_grab works in a couple of ways:

 - The grab itself now decides when it ends instead of hardcoding button
   up as the terminating event.  We remove the end vfunc since a grab now
   always know when it ends and can just clean up at that point.

 - We add a new focus vfunc that is invoked every time the pointer enters
   a new surface, regardless of any grabs.  The callback receives the
   surface and the surface-relative pointer coordinates.  The callback lets
   a grab send enter/leave events and change the grab focus.

 - The grab has a focus surface, wich determines the coordinate space
   for the motion callback coordinates.

 - The input device always tracks the current surface, ie the surface that
   currently contains the pointer, and coordinates relative to that surface.

With these changes, we will be able to pull the core input event delivery
and the drag and drop grab into the core wayland-server library.

12 years agoserver: Allocate server ID for when resource->object.id is 0
Kristian Høgsberg [Wed, 4 Jan 2012 14:13:27 +0000 (09:13 -0500)]
server: Allocate server ID for when resource->object.id is 0

12 years agoserver: remove wl_display::callback_list as unused
Pekka Paalanen [Tue, 3 Jan 2012 14:32:41 +0000 (16:32 +0200)]
server: remove wl_display::callback_list as unused

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoserver: add wl_input_device_release()
Pekka Paalanen [Tue, 3 Jan 2012 14:32:40 +0000 (16:32 +0200)]
server: add wl_input_device_release()

Add a clean-up function for destroying all objects created in
wl_input_device_init(). Can be used to fix memory leaks reported by
Valgrind in the demos.

The init function was also missing an explicit initialisation of the
'keys' array. Add the explicit array init, although it is redundant with
the zeroing of the whole struct.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
krh: Edited to rename function to *_release()

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

12 years agoDrop unused hash table
Kristian Høgsberg [Tue, 27 Dec 2011 18:53:59 +0000 (13:53 -0500)]
Drop unused hash table

We now just use a table for looking up object IDs so we should drop the
hash table.

12 years agoRename all instances of typeof
Kristian Høgsberg [Thu, 22 Dec 2011 20:32:37 +0000 (15:32 -0500)]
Rename all instances of typeof

12 years agoUse __typeof__ instead of typeof
Kristian Høgsberg [Thu, 22 Dec 2011 20:23:54 +0000 (15:23 -0500)]
Use __typeof__ instead of typeof

Thiago Macieira compiles with -std=c++11.

12 years agoserver: destroy the socket event source on display destroy
Pekka Paalanen [Thu, 22 Dec 2011 14:52:37 +0000 (16:52 +0200)]
server: destroy the socket event source on display destroy

On wl_display_add_socket(), the listening socket fd is added to the
event loop. However, wl_event_source object is not stored and hence
cannot be freed, resulting in a minor leak.

Store wl_event_source pointer in struct wl_socket so we can track it,
and destroy it on wl_display_destroy(). The event loop itself must be
destroyed after destroying the event sources linked to it.

Fixes a Valgrind reported memory leak.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoprotocol: update touch_down with focus surface
Tiago Vignatti [Wed, 21 Dec 2011 17:34:08 +0000 (19:34 +0200)]
protocol: update touch_down with focus surface

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoprotocol: Add a bit of documentation
Kristian Høgsberg [Mon, 19 Dec 2011 18:15:06 +0000 (13:15 -0500)]
protocol: Add a bit of documentation

12 years agoconnection: Fix printf format warnings
Kristian Høgsberg [Sat, 17 Dec 2011 21:05:44 +0000 (16:05 -0500)]
connection: Fix printf format warnings

12 years agoIncrease closure buffer size and fail gracefully for too big closures.
Laszlo Agocs [Fri, 16 Dec 2011 08:29:36 +0000 (10:29 +0200)]
Increase closure buffer size and fail gracefully for too big closures.

Buffer size changed from 256 to 1024 bytes. Marshalling will now stop
if the buffer is not big enough.

12 years agoRemoved superfluous call to wl_copy_connection
Andy Nichols [Thu, 24 Nov 2011 09:19:18 +0000 (10:19 +0100)]
Removed superfluous call to wl_copy_connection

The only purpose those code seems to serve is to introduce a buffer
overflow when events contain more than 128 bytes of data.

12 years agoMake wl_list_for_each* work for c++
Jørgen Lind [Tue, 13 Dec 2011 21:01:34 +0000 (22:01 +0100)]
Make wl_list_for_each* work for c++

12 years agoclient: fix a strdup memory leak
Pekka Paalanen [Tue, 13 Dec 2011 12:53:54 +0000 (14:53 +0200)]
client: fix a strdup memory leak

Memory leak found by valgrinding simple-shm client.
struct wl_global::interface is a strdup()'d string that was never freed.

Make a function for freeing a wl_global, and use it.

krh: Edit to name wl_global destructor wl_global_destroy.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoclient: unset WAYLAND_SOCKET env variable
Pekka Paalanen [Mon, 5 Dec 2011 08:04:37 +0000 (10:04 +0200)]
client: unset WAYLAND_SOCKET env variable

WAYLAND_SOCKET contains a file descriptor that is an open connection to
a Wayland server. It is private to us, and makes no sense to relay the
same value (or any value) to our child processes.

Unset the environment variable to prevent it from being accidentally
relayed to other processes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoserver: do not send delete_id to a dead client
Pekka Paalanen [Tue, 29 Nov 2011 12:32:32 +0000 (14:32 +0200)]
server: do not send delete_id to a dead client

During client tear-down, all objects are destroyed in id order.
Therefore the display object is destroyed first.

If the destroy listeners of any object destroy another object by calling
wl_resoruce_destroy(), we try to send a delete_id event to the client.
This leads to a segmentation fault without a display object.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoprotocol: introduce wl_shell_surface
Pekka Paalanen [Thu, 24 Nov 2011 14:19:03 +0000 (16:19 +0200)]
protocol: introduce wl_shell_surface

Requests like 'move' and 'set_toplevel' are really methods of a surface,
not methods of a global shell object. Move all these methods to a new
interface, wl_shell_surface.

The global object wl_shell will contain only 'get_shell_surface'
request, which creates and associates a wl_shell_surface object to a
given wl_surface object.

This will also give the shell plugin (if you look at the demo
compositor) means to store per-surface private data in a natural way.

Due to a limitation in delete_id event handling on client side, the
client must destroy its wl_shell_surface object before destroying the
wl_surface object. Otherwise it may just leak an id.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoserver: document wl_resource_post_event() arguments
Pekka Paalanen [Mon, 28 Nov 2011 10:23:32 +0000 (12:23 +0200)]
server: document wl_resource_post_event() arguments

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoutil: clear pointers on wl_list_remove()
Pekka Paalanen [Wed, 9 Nov 2011 14:27:07 +0000 (16:27 +0200)]
util: clear pointers on wl_list_remove()

Set the next and prev pointers of the removed list element to NULL. This
will catch programming errors that would use invalid list pointers,
double-remove for instance.

It also helps debugging, making it easy to see in gdb if an object is
not in a list.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoserver: no errors to a dead client
Pekka Paalanen [Mon, 28 Nov 2011 07:47:15 +0000 (09:47 +0200)]
server: no errors to a dead client

Do not try to send errors to an already dead client, while in the
middle of cleanup.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoNew drag and drop / selection protocol
Kristian Høgsberg [Tue, 15 Nov 2011 13:58:34 +0000 (08:58 -0500)]
New drag and drop / selection protocol

This commit brings a big change to the DND and copy/paste interfaces.
Most importantly the functionality is now independent of wl_shell.
The wl_shell interface is intended for desktop style UI interaction and
an optional and experimental interface.

The new interface also allows receiving the DND data multiple times or
multiple times during the drag, and the mechanism for offering and receiving
data is now shared between DND and selections.

12 years agoserver: Stop special casing the compositor
Kristian Høgsberg [Wed, 23 Nov 2011 15:34:50 +0000 (10:34 -0500)]
server: Stop special casing the compositor

wl_compositor_init() was just adding the global and providing a helper
bind function.  Not useful enough to warrent API.

12 years agoAdd support for server allocated object IDs
Kristian Høgsberg [Sat, 19 Nov 2011 02:59:36 +0000 (21:59 -0500)]
Add support for server allocated object IDs

We set aside a range of the object ID space for use by the server.  This
allows the server to bind an object to an ID for a client and pass that
object to the client.  The client can use the object immediately and the
server can emit events to the object immdiately.

12 years agodebug: Use unsigned for object IDs
Kristian Høgsberg [Tue, 22 Nov 2011 19:03:33 +0000 (14:03 -0500)]
debug: Use unsigned for object IDs

12 years agoscanner: Only strdup interface_name after making sure it's not NULL
Kristian Høgsberg [Sat, 19 Nov 2011 02:23:33 +0000 (21:23 -0500)]
scanner: Only strdup interface_name after making sure it's not NULL

12 years agoMove private definitions and prototypes to new wayland-private.h
Kristian Høgsberg [Fri, 18 Nov 2011 18:46:56 +0000 (13:46 -0500)]
Move private definitions and prototypes to new wayland-private.h

12 years agoFix unused variable warning
Kristian Høgsberg [Fri, 18 Nov 2011 18:11:58 +0000 (13:11 -0500)]
Fix unused variable warning

12 years agoIntroduce wl_resource_queue_event() for sending events later
Kristian Høgsberg [Thu, 17 Nov 2011 21:46:36 +0000 (16:46 -0500)]
Introduce wl_resource_queue_event() for sending events later

Some events, such as the display.delete_id, aren't very urgent and we
would like to not always send them immdiately and cause an unnecessary
context switch.  The wl_resource_queue_event() function will place the
event in the connection output buffer but not request the main loop to
poll for writable.  The effect is that the event will just sit in the
output buffer until a more important event comes around and requires
flushing.

12 years agoAdd display event to acknowledge ID deletion
Kristian Høgsberg [Wed, 16 Nov 2011 03:20:28 +0000 (22:20 -0500)]
Add display event to acknowledge ID deletion

We need to make sure the client doesn't reuse an object ID until the
server has seen the destroy request.  When a client destroys an ID
the server will now respond with the display.delete_id event, which lets
the client block reuse until it receives the event.

12 years agoutil: Add wl_list_insert_list()
Kristian Høgsberg [Tue, 15 Nov 2011 18:48:41 +0000 (13:48 -0500)]
util: Add wl_list_insert_list()

12 years agohash: Improve double hashing
Andrea Canciani [Mon, 14 Nov 2011 09:24:47 +0000 (10:24 +0100)]
hash: Improve double hashing

Instead of artificially introducing collisions in the step value by
replacing 0 with 1 (which causes the value 1 to have twice the
frequency of any other value), the step value can simply be computed
as an uniformly distributed value in the range [1, rehash], extremes
included.

This is safe because any step value smaller than the hash modulus is
co-prime with it, hence induces an orbit which includes every integer
in [0, size - 1].

12 years agoscanner: Check name == NULL for enum entries
Kristian Høgsberg [Mon, 31 Oct 2011 15:21:38 +0000 (11:21 -0400)]
scanner: Check name == NULL for enum entries

From a clang static analysis warning.

12 years agoconnection: Check object types in message parameters
Benjamin Franzke [Mon, 31 Oct 2011 10:06:35 +0000 (11:06 +0100)]
connection: Check object types in message parameters

12 years agoevent-loop: Fix idle handler dispatch corner case
Kristian Høgsberg [Sat, 29 Oct 2011 18:27:33 +0000 (14:27 -0400)]
event-loop: Fix idle handler dispatch corner case

When the last idle handler queues another idle handler, we fail to
dispatch that last handler.  The wl_list_for_each_safe loop looks up
the next pointer before running the handler, and at that point it points
to the head of the list and the loop terminates.

Instead, just loop until the list is empty.

12 years agoscanner: Fix typo in error message
Kristian Høgsberg [Mon, 24 Oct 2011 21:05:39 +0000 (17:05 -0400)]
scanner: Fix typo in error message

12 years agoprotocol: Change global_remove arg to be 'name' insteadl of 'id'
Kristian Høgsberg [Mon, 24 Oct 2011 20:05:04 +0000 (16:05 -0400)]
protocol: Change global_remove arg to be 'name' insteadl of 'id'

Consistent with global args.

12 years agoscanner: Catch more invalid attribute combinations for arg
Kristian Høgsberg [Mon, 24 Oct 2011 20:04:09 +0000 (16:04 -0400)]
scanner: Catch more invalid attribute combinations for arg

Spotted by Jakob Bornecrantz.

12 years agodebug: Print debug message when client wakes up
Kristian Høgsberg [Thu, 20 Oct 2011 19:05:11 +0000 (15:05 -0400)]
debug: Print debug message when client wakes up

This helps spot and remove extraneous round trips and context switches.

12 years agoSilence a valgrind warning
Kristian Høgsberg [Wed, 12 Oct 2011 20:30:08 +0000 (16:30 -0400)]
Silence a valgrind warning

12 years agowayland-server: Track input_device resource for focused surface
Kristian Høgsberg [Wed, 12 Oct 2011 02:19:34 +0000 (22:19 -0400)]
wayland-server: Track input_device resource for focused surface

We no long track the focused surface, but expect the compositor to set
focus when the focus changes.  We do track the resource for the input
device that corresponds to the current surface, in case that goes away.

12 years agowayland-server: Always use the display_resource for posting wl_display errors
Kristian Høgsberg [Tue, 11 Oct 2011 18:36:49 +0000 (14:36 -0400)]
wayland-server: Always use the display_resource for posting wl_display errors

12 years agowayland-server: fix resource destroy
Mathias Fiedler [Tue, 11 Oct 2011 18:23:45 +0000 (14:23 -0400)]
wayland-server: fix resource destroy

Object ID was read from freed memory.

12 years agowayland-server: fix crash on invalid resource
Mathias Fiedler [Tue, 11 Oct 2011 17:58:18 +0000 (13:58 -0400)]
wayland-server: fix crash on invalid resource

Using display_resource to post error about invalid resource.

Reviewed-by: Tiago Vignatti <tiago.vignatti@intel.com>