neuswc

patched neuswc library (tracked)
git clone https://git.daat.foo/neuswc.git
Log | Files | Refs | README | LICENSE

decoration.patch (2801B)


      1 Subject: xdg-decoration: a mode asked for is answered, then the toplevel configured
      2 
      3 diff --git a/libswc/xdg_decoration.c b/libswc/xdg_decoration.c
      4 index c66f599..478ce4f 100644
      5 --- a/libswc/xdg_decoration.c
      6 +++ b/libswc/xdg_decoration.c
      7 @@ -23,23 +23,41 @@
      8  
      9  #include "xdg_decoration.h"
     10  #include "util.h"
     11 +#include "xdg_shell.h"
     12  
     13  #include "xdg-decoration-unstable-v1-server-protocol.h"
     14  #include <wayland-server.h>
     15  
     16  struct xdg_toplevel_decoration {
     17  	struct wl_resource *resource;
     18 +	struct wl_resource *toplevel;
     19  	struct wl_listener toplevel_destroy_listener;
     20  };
     21  
     22 +/* The mode is always the server's. A mode asked for is answered with it and
     23 + * then a configure of the toplevel, as the protocol has it: a client may
     24 + * wait for that configure to know its decoration settled before it maps. */
     25 +static void
     26 +answer_mode(struct wl_resource *resource)
     27 +{
     28 +	struct xdg_toplevel_decoration *decoration =
     29 +	    wl_resource_get_user_data(resource);
     30 +
     31 +	zxdg_toplevel_decoration_v1_send_configure(
     32 +	    resource, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
     33 +	xdg_toplevel_send_state(decoration->toplevel);
     34 +}
     35 +
     36  static void
     37  set_mode(struct wl_client *client, struct wl_resource *resource, uint32_t mode)
     38  {
     39 +	answer_mode(resource);
     40  }
     41  
     42  static void
     43  unset_mode(struct wl_client *client, struct wl_resource *resource)
     44  {
     45 +	answer_mode(resource);
     46  }
     47  
     48  static const struct zxdg_toplevel_decoration_v1_interface decoration_impl = {
     49 @@ -83,6 +101,7 @@ get_toplevel_decoration(struct wl_client *client, struct wl_resource *resource,
     50  	if (!decoration->resource) {
     51  		goto error1;
     52  	}
     53 +	decoration->toplevel = toplevel_resource;
     54  	decoration->toplevel_destroy_listener.notify = &handle_toplevel_destroy;
     55  	wl_resource_add_destroy_listener(toplevel_resource,
     56  	                                 &decoration->toplevel_destroy_listener);
     57 diff --git a/libswc/xdg_shell.c b/libswc/xdg_shell.c
     58 index 1e327ad..dd3b0ab 100644
     59 --- a/libswc/xdg_shell.c
     60 +++ b/libswc/xdg_shell.c
     61 @@ -364,6 +364,12 @@ send_state(struct xdg_toplevel *toplevel)
     62  		send_configure(toplevel, geometry->width, geometry->height);
     63  }
     64  
     65 +void
     66 +xdg_toplevel_send_state(struct wl_resource *resource)
     67 +{
     68 +	send_state(wl_resource_get_user_data(resource));
     69 +}
     70 +
     71  static void
     72  configure(struct window *window, uint32_t width, uint32_t height)
     73  {
     74 diff --git a/libswc/xdg_shell.h b/libswc/xdg_shell.h
     75 index de6997b..be00803 100644
     76 --- a/libswc/xdg_shell.h
     77 +++ b/libswc/xdg_shell.h
     78 @@ -47,4 +47,9 @@ xdg_popups_focus_changed(struct wl_client *client);
     79  struct window *
     80  xdg_toplevel_window(struct wl_resource *resource);
     81  
     82 +/* the toplevel's configure sent again as it stands: what follows a change
     83 + * the client asked for in an extension, such as its decoration mode */
     84 +void
     85 +xdg_toplevel_send_state(struct wl_resource *resource);
     86 +
     87  #endif