[PATCH weston v2 5/8] clients/window: use weston_platform_destroy_egl_surface wrapper

2016-11-18 Thread Emil Velikov
From: Emil Velikov 

v2: Use correct (destroy) API (Dan)

Signed-off-by: Emil Velikov 
---
 clients/window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clients/window.c b/clients/window.c
index 84d585e..9c2fc68 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -645,7 +645,7 @@ egl_window_surface_destroy(struct toysurface *base)
struct display *d = surface->display;
 
cairo_surface_destroy(surface->cairo_surface);
-   eglDestroySurface(d->dpy, surface->egl_surface);
+   weston_platform_destroy_egl_surface(d->dpy, surface->egl_surface);
wl_egl_window_destroy(surface->egl_window);
surface->surface = NULL;
 
-- 
2.9.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] weston-editor: Don't copy the preedit string before inserting it

2016-11-18 Thread Silvan Jegen
Hi Bryce

And thanks for the review!

On Fri, Nov 18, 2016 at 1:20 AM, Bryce Harrington  wrote:
> On Thu, Nov 17, 2016 at 09:43:05PM +0100, Silvan Jegen wrote:
>> Signed-off-by: Silvan Jegen 
>> ---
>>  clients/editor.c | 8 +---
>>  1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/clients/editor.c b/clients/editor.c
>> index 6805d8a..1ed3eec 100644
>> --- a/clients/editor.c
>> +++ b/clients/editor.c
>> @@ -944,16 +944,10 @@ text_entry_reset_preedit(struct text_entry *entry)
>>  static void
>>  text_entry_commit_and_reset(struct text_entry *entry)
>>  {
>> - char *commit = NULL;
>> -
>>   if (entry->preedit.commit)
>> - commit = strdup(entry->preedit.commit);
>> + text_entry_insert_at_cursor(entry, entry->preedit.commit, 0, 
>> 0);
>>
>>   text_entry_reset_preedit(entry);
>> - if (commit) {
>> - text_entry_insert_at_cursor(entry, commit, 0, 0);
>> - free(commit);
>> - }
>
> This essentially swaps the order of text_entry_reset_preedit() and
> text_entry_insert_at_cursor().  Does this cause any side effects?
>
> text_entry_insert_at_cursor() calls text_entry_update_layout(), which
> will behave differently if there is a preedit in effect with and without
> this patch.  I'm not super familiar with this code, but on a quick skim
> it looks like with this patch applied, any existing pre-edits will be
> applied and finalized before the reset, whereas previously the pre-edits
> would be discarded?  Am I interpreting this correctly?  If this is the

You are right. I missed that text_entry_reset_preedit() also resets
entry->preedit.text (not only preedit.commit). When I change the
function call order like this, text_entry_update_layout() will
concatenate the entry->text and the preedit.text and commit it which
results in the not-yet-committed pre-edit string being applied.


> case, and if that change of behavior is desireable, make sure the
> behavioral change (and rationale for why it's being done) is documented
> in the changelog.  If I'm not interpreting it correctly, accept my
> apologies and I look forward to your elucidation (which probably also
> would be worth referencing in the changelog entry).

I tested the change and did not notice any regression (i. e. was not
tripped up by any strange/unexpected behavior). Looking at the code
now however, text_input_leave() calls text_entry_commit_and_reset()
which would mean that the not-committed pre-edit text would get
applied when the text entry area loses focus which is almost
definitely not what one would want.

Please ignore this patch because it would result in undesirable behaviour.


Cheers,

Silvan
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland v3] util: Improve documentation of wl_argument

2016-11-18 Thread Pekka Paalanen
On Mon, 14 Nov 2016 08:32:01 +1000
Peter Hutterer  wrote:

> On Sat, Nov 12, 2016 at 10:11:21AM -0800, Yong Bakos wrote:
> > From: Yong Bakos 
> > 
> > Standardize the doxygen comment format, add clarity to the writing, decouple
> > the description from specifics of usage, add see-also's, and massage the 
> > union
> > member type comments.
> > 
> > Signed-off-by: Yong Bakos   
> 
> Reviewed-by: Peter Hutterer 
> 
> Cheers,
>Peter
> 
> > ---
> > v3: Correct spelling of marhsalling.
> > v2: Match union member type names to actual protocol-defined type names,
> > rather than their descriptions.
> >  src/wayland-util.h | 29 -
> >  1 file changed, 16 insertions(+), 13 deletions(-)


Pushed:
   2d328a4..9ac70f4  master -> master


Thanks,
pq


pgppTBKkz72Bb.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] tests: Add nullable check to wl_message_count_arrays

2016-11-18 Thread Pekka Paalanen
On Fri, 11 Nov 2016 07:08:09 -0800
Yong Bakos  wrote:

> From: Yong Bakos 
> 
> Array argument symbols in a wl_message may be nullable, but the test for
> wl_message_count_arrays did not test this. Add one more wl_message with
> nullable array arguments.
> 
> Signed-off-by: Yong Bakos 
> ---
>  tests/message-test.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/message-test.c b/tests/message-test.c
> index 389f788..4e69392 100644
> --- a/tests/message-test.c
> +++ b/tests/message-test.c
> @@ -64,7 +64,8 @@ TEST(message_count_arrays)
>   { "multiple", "aaiufaasonhaa", NULL },
>   { "leading_version", "2aaiufaasonhaa", NULL },
>   { "among_nullables", "iufsa?oa?nah", NULL },
> - { "all_mixed", "2aiufas?oa?na", NULL },
> + { "nullable", "?aiufs?a?onh?a", NULL },
> + { "all_mixed", "2?aiufas?oa?na", NULL },
>   };
>   const struct {
>   const struct wl_message *message;
> @@ -80,7 +81,8 @@ TEST(message_count_arrays)
>   { &fake_messages[5], 6 },
>   { &fake_messages[6], 6 },
>   { &fake_messages[7], 3 },
> - { &fake_messages[8], 4 }
> + { &fake_messages[8], 3 },
> + { &fake_messages[9], 4 },
>   };
>  
>   for (i = 0; i < ARRAY_LENGTH(messages); ++i) {

Pushed:
   b0cd65d..2d328a4  master -> master


Thanks,
pq


pgpKr5JJ5eomp.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland v2] tests: Test wl_interface_equal

2016-11-18 Thread Pekka Paalanen
On Tue,  8 Nov 2016 07:56:30 -0800
Yong Bakos  wrote:

> From: Yong Bakos 
> 
> The test suite did not cover wl_interface_equal, so add one test that
> specifically tests this method. Add the new test to Makefile.am.
> 
> Signed-off-by: Yong Bakos 
> ---
> v2: Remove unnecessary server header inclusion
> 
>  Makefile.am|  3 +++
>  tests/interface-test.c | 48 
>  2 files changed, 51 insertions(+)
>  create mode 100644 tests/interface-test.c
> 
> diff --git a/Makefile.am b/Makefile.am
> index 3eb6fd5..88139b7 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -151,6 +151,7 @@ TESTS =   \
>   connection-test \
>   event-loop-test \
>   fixed-test  \
> + interface-test  \
>   list-test   \
>   map-test\
>   os-wrappers-test\
> @@ -203,6 +204,8 @@ event_loop_test_SOURCES = tests/event-loop-test.c
>  event_loop_test_LDADD = libtest-runner.la
>  fixed_test_SOURCES = tests/fixed-test.c
>  fixed_test_LDADD = libtest-runner.la
> +interface_test_SOURCES = tests/interface-test.c
> +interface_test_LDADD = libtest-runner.la
>  list_test_SOURCES = tests/list-test.c
>  list_test_LDADD = libtest-runner.la
>  map_test_SOURCES = tests/map-test.c
> diff --git a/tests/interface-test.c b/tests/interface-test.c
> new file mode 100644
> index 000..29876a8
> --- /dev/null
> +++ b/tests/interface-test.c
> @@ -0,0 +1,48 @@
> +/*
> + * Copyright © 2016 Yong Bakos
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining
> + * a copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sublicense, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial
> + * portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include 
> +
> +#include "wayland-client.h"
> +#include "wayland-private.h"
> +#include "test-runner.h"
> +
> +TEST(interface_equal)
> +{
> + const struct wl_interface fake = {
> + "fake", 1, 0, NULL, 0, NULL
> + };
> + const struct wl_interface fake_registry = {
> + "wl_registry", 1, 0, NULL, 0, NULL
> + };
> + const struct wl_interface copy = wl_registry_interface;
> +
> + assert(wl_interface_equal(&wl_registry_interface,
> +   &wl_registry_interface));
> + assert(wl_interface_equal(&wl_registry_interface, ©));
> + assert(wl_interface_equal(&wl_registry_interface,
> +   &fake_registry));
> + assert(!wl_interface_equal(&wl_registry_interface, &fake));
> +}
> --
> 2.7.2

Hi,

I added one more assert to ensure that address of 'copy' really is
different from wl_registry_interface. I don't know if anything would
allow a compiler to optimize 'copy' away and just use
wl_registry_interface in its place, but I'm paranoid.

Pushed:
   aa51a83..b0cd65d  master -> master


Thanks,
pq



pgpO5_eNeN4km.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] util: Document wl_interface

2016-11-18 Thread Pekka Paalanen
On Sun,  6 Nov 2016 18:25:37 -0800
Yong Bakos  wrote:

> From: Yong Bakos 
> 
> Add doxygen comments for wl_interface.
> 
> Signed-off-by: Yong Bakos 
> ---
>  src/wayland-util.h | 52 
>  1 file changed, 52 insertions(+)
> 
> diff --git a/src/wayland-util.h b/src/wayland-util.h
> index 7b280d1..606cb6f 100644
> --- a/src/wayland-util.h
> +++ b/src/wayland-util.h
> @@ -74,12 +74,64 @@ struct wl_message {
>   const struct wl_interface **types;
>  };
>  
> +/**
> + * Protocol object interface
> + *
> + * A wl_interface describes the API of a protocol object defined in the 
> Wayland
> + * protocol specification. The protocol implementation uses a wl_interface
> + * within its marshalling machinery for encoding client requests.
> + *
> + * The `name` of a wl_interface is the name of the corresponding protocol
> + * interface, and `version` represents the version of the interface. The 
> members
> + * `method_count` and `event_count` represent the number of `methods` 
> (requests)
> + * and `events` in the respective wl_message members.
> + *
> + * For example, consider a protocol interface `foo`, marked as version `1`, 
> with
> + * two requests and one event.
> + *
> + * \code
> + * 
> + *   
> + *   
> + *   
> + * 
> + * \endcode
> + *
> + * Given two wl_message arrays `foo_requests` and `foo_events`, a 
> wl_interface
> + * for `foo` might be:
> + *
> + * \code
> + * struct wl_interface foo_interface = {
> + * "foo", 1,
> + * 2, foo_requests,
> + * 1, foo_events
> + * };
> + * \endcode
> + *
> + * \note The server side of the protocol may define interface 
> implementation
> + *   types that incorporate the term `interface` in their name. Take
> + *   care to not confuse these server-side `struct`s with a wl_interface
> + *   variable whose name also ends in `interface`. For example, while the
> + *   server may define a type `struct wl_foo_interface`, the client may
> + *   define a `struct wl_interface wl_foo_interface`.
> + *
> + * \sa wl_message
> + * \sa wl_proxy
> + * \sa  href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Interfaces";>Interfaces
> + * \sa  href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Versioning";>Versioning
> + */
>  struct wl_interface {
> + /** Interface name */
>   const char *name;
> + /** Interface version */
>   int version;
> + /** Number of methods (requests) */
>   int method_count;
> + /** Method (request) signatures */
>   const struct wl_message *methods;
> + /** Number of events */
>   int event_count;
> + /** Event signatures */
>   const struct wl_message *events;
>  };
>  

Pushed:
   aa51a83..b0cd65d  master -> master


Thanks,
pq


pgp6gTSGulqvU.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2 wayland] protocol: indentation fixes

2016-11-18 Thread Yong Bakos
On Nov 17, 2016, at 7:49 PM, Peter Hutterer  wrote:
> 
> 8 spaces changed to one tab
> 
> Signed-off-by: Peter Hutterer 
> Acked-by: Bryce Harrington 

Reviewed-by: Yong Bakos 

Cheers,
yong


> ---
> Changes to v1:
> - Rebased on top of aa51a83
> 
> protocol/wayland.xml | 100 +--
> 1 file changed, 50 insertions(+), 50 deletions(-)
> 
> diff --git a/protocol/wayland.xml b/protocol/wayland.xml
> index 8311a18..5b0d66a 100644
> --- a/protocol/wayland.xml
> +++ b/protocol/wayland.xml
> @@ -129,7 +129,7 @@
> 
>   
>   Binds a new, client-created object to the server using the
> -specified name as the identifier.
> + specified name as the identifier.
>   
>   
>   
> @@ -139,9 +139,9 @@
>   
>   Notify the client of global objects.
> 
> -The event notifies the client that a global object with
> -the given name is now available, and it implements the
> -given version of the given interface.
> + The event notifies the client that a global object with
> + the given name is now available, and it implements the
> + given version of the given interface.
>   
>   
>   
> @@ -152,10 +152,10 @@
>   
>   Notify the client of removed global objects.
> 
> -This event notifies the client that the global identified
> -by name is no longer available.  If the client bound to
> -the global using the bind request, the client should now
> -destroy that object.
> + This event notifies the client that the global identified
> + by name is no longer available.  If the client bound to
> + the global using the bind request, the client should now
> + destroy that object.
> 
>   The object remains valid and requests to the object will be
>   ignored until the client destroys it, to avoid races between
> @@ -355,7 +355,7 @@
> 
>   The pool can be used to create shared memory based buffer
>   objects.  The server will mmap size bytes of the passed file
> -descriptor, to use as backing memory for the pool.
> + descriptor, to use as backing memory for the pool.
>   
>   
>   
> @@ -915,14 +915,14 @@
> 
> 
>   
> -Create a new data source.
> + Create a new data source.
>   
>   
> 
> 
> 
>   
> -Create a new data device for a given seat.
> + Create a new data device for a given seat.
>   
>   
>   
> @@ -1308,7 +1308,7 @@
> 
> 
>   
> -These errors can be emitted in response to wl_surface requests.
> + These errors can be emitted in response to wl_surface requests.
>   
>   
>   
> @@ -1661,8 +1661,8 @@
> 
> 
>   
> -This is a bitmask of capabilities this seat has; if a member is
> -set, then it is present on the seat.
> + This is a bitmask of capabilities this seat has; if a member is
> + set, then it is present on the seat.
>   
>   
>   
> @@ -1857,7 +1857,7 @@
> 
> 
>   
> -Describes the physical state of a button that produced the button
> + Describes the physical state of a button that produced the button
>   event.
>   
>   
> @@ -1870,8 +1870,8 @@
> 
>   The location of the click is given by the last motion or
>   enter event.
> -The time argument is a timestamp with millisecond
> -granularity, with an undefined base.
> + The time argument is a timestamp with millisecond
> + granularity, with an undefined base.
>   
>   
>   
> @@ -2083,7 +2083,7 @@
>   summary="no keymap; client must understand how to interpret the 
> raw keycode"/>
>- summary="libxkbcommon compatible; to determine the xkb keycode, 
> clients must add 8 to the key event keycode"/>
> +  summary="libxkbcommon compatible; to determine the xkb keycode, 
> clients must add 8 to the key event keycode"/>
> 
> 
> 
> @@ -2129,8 +2129,8 @@
> 
>   
>   A key was pressed or released.
> -The time argument is a timestamp with millisecond
> -granularity, with an undefined base.
> + The time argument is a timestamp with millisecond
> + granularity, with an undefined base.
>   
>   
>   
> @@ -2160,23 +2160,23 @@
> 
> 
>   
> -Informs the client about the keyboard's repeat rate and delay.
> + Informs the client about the keyboard's repeat rate and delay.
> 
> -This event is sent as soon as the wl_keyboard object has been 
> created,
> -and is guaranteed to be received by the client before any key press
> -event.
> + This event is sent as soon as the wl_keyboard object has been created,
> + and is guaranteed to be received by the client before any key press
> + event.
> 
> -Negative values for either rate or delay are illegal. A rate of zero
> -will disable any repeating (

Re: [PATCH weston] text-input: Clear out context->input pointer

2016-11-18 Thread Pekka Paalanen
On Thu, 10 Nov 2016 15:47:56 +
Daniel Stone  wrote:

> If we destroy the text_input (e.g. due to surface deactivation) whilst
> the IM manager (the client holding the input_method_context resource,
> usually weston-keyboard) sends an event, we can hit a segfault in
> text-backend. This is because we free the text_input structure, but
> don't actually clear the context->input structure even when we send the
> deactivate event.
> 
> This is clearly intended to be catered for, since context->input is
> always checked for NULL before we relay any events.
> 
> This is enough to fix one cause of text-test failing, but it's
> ultimately error-prone until we have a no-op test-shell; there is still
> a race where weston-desktop-shell can launch weston-keyboard before
> text-test manages to bind zwp_text_input_manager.
> 
> Signed-off-by: Daniel Stone 
> Maniphest Tasks: https://phabricator.freedesktop.org/T7615
> ---
>  compositor/text-backend.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/compositor/text-backend.c b/compositor/text-backend.c
> index 262ba9f..bf5c45c 100644
> --- a/compositor/text-backend.c
> +++ b/compositor/text-backend.c
> @@ -132,6 +132,7 @@ deactivate_input_method(struct input_method *input_method)
>   zwp_input_method_v1_send_deactivate(
>   input_method->input_method_binding,
>   input_method->context->resource);
> + input_method->context->input = NULL;
>   }
>  
>   wl_list_remove(&input_method->link);

Pushed:
   e7fff21..97863d6  master -> master


Thanks,
pq


pgpXFrUGCQHJX.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] clients/simple-shm: remove unreachable function call

2016-11-18 Thread Ryo Munakata
window->wait_for_configure should be false after dispatching more than once.
Therefore this redraw() will never be called.

Signed-off-by: Ryo Munakata 
---
 clients/simple-shm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index 9fa2e21..04b4eff 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -547,9 +547,6 @@ main(int argc, char **argv)
wl_surface_damage(window->surface, 0, 0,
  window->width, window->height);
 
-   if (!window->wait_for_configure)
-   redraw(window, NULL, 0);
-
while (running && ret != -1)
ret = wl_display_dispatch(display->display);
 
-- 
2.10.2

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] libweston: remove unused function declaration of weston_compositor_top

2016-11-18 Thread Ryo Munakata
Signed-off-by: Ryo Munakata 
---
 libweston/compositor.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libweston/compositor.h b/libweston/compositor.h
index e00d285..4ca52f9 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1451,9 +1451,6 @@ weston_compositor_set_default_pointer_grab(struct 
weston_compositor *compositor,
 int
 weston_environment_get_fd(const char *env);
 
-struct wl_list *
-weston_compositor_top(struct weston_compositor *compositor);
-
 struct weston_surface *
 weston_surface_create(struct weston_compositor *compositor);
 
-- 
2.10.2

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel