1. 15 Oct, 2012 25 commits
  2. 11 Oct, 2012 15 commits
    • Kristian Høgsberg's avatar
      client: Discard proxies with no implementation at dispatch time · 18495347
      Kristian Høgsberg authored
      We need to queue up events even if a proxy doesn't have an implementation
      (listener).  In case of server created new objects, the client haven't
      had a chance to set the listener when the first events to the new object
      come in.  So now we always queue up events and discard them at
      dispatch time if they don't have a listener at that point.
    • Kristian Høgsberg's avatar
      client: Don't forget to init and destroy mutex · d4cc1cd0
      Kristian Høgsberg authored
      These chunks were dropped at some point, thanks to David Herrmann for
      spotting the omission.
    • Kristian Høgsberg's avatar
      connection: Print object id for new-id arguments in deubug output · 9272fb8f
      Kristian Høgsberg authored
      We can't use the same behaviour in both the client and the server.  In the
      client this is a wl_proxy pointer in the server it's a pointer to the
      uint32_t object id.  This doesn't fix the problem, but it's a slightly
      more useful default, since we typically use WAYLAND_DEBUG on the client.
    • Ander Conselvan de Oliveira's avatar
      client: Fix double locking bug · ff4afd6c
      Ander Conselvan de Oliveira authored
      The function wl_proxy_create_for_id() would try to acquire the display
      lock, but the only call path leading to it would call it with the lock
      already acquired.
      This patch removes the attempt to acquire the lock and makes the
      function static. It was exported before because client had to create
      proxy's manually when the server sent a new object id, but since commit
      9de9e39f [1] this is no longer necessary.
      [1] commit 9de9e39f
          Author: Kristian Høgsberg <krh@bitplanet.net>
          Date:   Thu Jun 28 22:01:58 2012 -0400
              Allocate client proxy automatically for new objects
      v2: Change the right function. Previous patch changed wl_proxy_create()
          instead of wl_proxy_create_for_id().
    • Pekka Paalanen's avatar
      protocol: clarify multiple wl_surface.attach · eb5fae32
      Pekka Paalanen authored
      Explicitly say what happens with the wl_buffer.release event, if you
      attach several wl_buffers without a commit in between.
      Reported-by: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    • Ander Conselvan de Oliveira's avatar
      data-device: Don't fake an attach event on drag icon surface · 0a27ce1f
      Ander Conselvan de Oliveira authored
      Emit a new drag icon signal instead and let the compositor handle the
      unmapping of the icon surface.
    • Pekka Paalanen's avatar
      protocol: fix clarification of input region on drags and pointers · ae8d4b59
      Pekka Paalanen authored
      The previous clarification did not follow the current implementation in
      Weston, where when a surface stops being a cursor or an icon, it becomes
      a plain unmapped surface again.
      Rewrite the related paragraphs, and fix some typos while at it.
      For start drag, make it explicit of which surface argument we are
      talking about.
      Make the input region undefined when the use ends. Most likely no-one
      will re-use these surfaces for anything else than the same use case, so
      leave some slack for the implementations to avoid useless work on
      resetting the regions.
      Reported-by: default avatarAnder Conselvan de Oliveira <conselvan2@gmail.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    • Pekka Paalanen's avatar
      protocol: elaborate on wl_buffer · e09ac645
      Pekka Paalanen authored
      Spell out exactly when a client may re-use a wl_buffer or its backing
      storage. Mention the optimization for GL-compositor with wl_shm-clients.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    • Pekka Paalanen's avatar
      protocol: wl_surface.frame needs wl_surface.commit · a4fd9e65
      Pekka Paalanen authored
      Clarify, when frame request takes effect.
      Explain when to send/receive the callback.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    • Pekka Paalanen's avatar
      protocol: clarify input region on drags and pointers · b61c0f47
      Pekka Paalanen authored
      Drag icon and cursor surfaces must never receive input, so their input
      region is always empty.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    • Pekka Paalanen's avatar
      protocol: double-buffered state for wl_surface · 39624020
      Pekka Paalanen authored
      This change breaks the protocol.
      The current protocol is racy in that updates to surface content and
      surface state (e.g. damage, input and opaque regions) are not guaranteed
      to happen at the same time. Due to protocol buffering and handling
      practices, the issues are very hard to trigger.
      Committing damage to a surface at arbitrary times makes it hard to
      track when the wl_buffer is being read by the server, and when it is
      safe to overwrite (the case of wl_shm with a single buffer reused
      This protocol change introduces the concept of double-buffered state.
      Such state is accumulated and cached in the server, unused, until the
      final commit request. The surface will receive its new content and apply
      its new state atomically.
      A wl_surface.commit request is added to the protocol. This is thought to
      be more clear, than having wl_surface.attach committing implicitly, and
      then having another request to commit without attaching, as would be
      required for a GL app that wants to change e.g. input region without
      When these changes are implemented, clients do not have to worry about
      ordering damage vs. input region vs. attach vs. ... anymore. Clients set
      the state in any order they want, and kick it all in with a commit.
      The interactions between wl_surface.attach, (wl_surface.commit,)
      wl_buffer.release, and wl_buffer.destroy have been undocumented. Only
      careful inspection of the compositor code has told when a wl_buffer is
      free for re-use, especially for wl_shm and wrt. wl_surface.damage.
      Try to clarify how it all should work, and what happens if the wl_buffer
      gets destroyed.
      An additional minor fix: allow NULL argument to
      wl_surface.set_opaque_region. The wording in the documentation already
      implied that a nil region is allowed.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    • Kristian Høgsberg's avatar
      Fix typecheck in case of multiple instances of type meta data · 4f9cf6ec
      Kristian Høgsberg authored
      In most cases the pointer equality test is sufficient.  However, in
      some cases, depending on how things are split across shared objects,
      we can end up with multiple instances of the interface metadata
      constants.  So if the pointers match, the interfaces are equal, if
      they don't match we have to compare the interface names.
    • Ander Conselvan de Oliveira's avatar
      doc: Update drag and drop section and add info about selections · e0680250
      Ander Conselvan de Oliveira authored
      Replace the outdated section about drag and drop support with a
      rewritten section covering the data source/offer mechanism and
      wl_data_device, explaining how selection and drag ang drop works.
    • Kristian Høgsberg's avatar
      connection: Move object lookup out of wl_connection_demarshal() · 5d2b32b1
      Kristian Høgsberg authored
      On the client side where we queue up multiple events before dispatching, we
      need to look up the receiving proxy and argument proxies immediately before
      calling the handler.  Between queueing up multiple events and eventually
      invoking the handler, previous handlers may have destroyed some of the
    • Kristian Høgsberg's avatar
      Split the global registry into its own wl_registry object · 9fe75537
      Kristian Høgsberg authored
      The only way to make the global object listener interface thread safe is to
      make it its own interface and make different listeners different wl_proxies.
      The core of the problem is the callback we do when a global show up or
      disappears, which we can't do with a lock held.  On the other hand we can't
      iterate the global list or the listener list without a lock held as new
      globals or listeners may come and go during the iteration.
      Making a copy of the list under the lock and then iterating after dropping
      the lock wont work either.  In case of the listener list, once we drop the
      lock another thread may unregister a listener and destroy the callbackk
      data, which means that when we eventually call that listener we'll pass it
      free memory and break everything.
      We did already solve the thread-safe callback problem, however.  It's what
      we do for all protocol events.  So we can just make the global registry
      functionality its own new interface and give each thread its own proxy.
      That way, the thread will do its own callbacks (with no locks held) and
      destroy the proxy when it's no longer interested in wl_registry events.