Re: xfwm4-wayland: use wlr-scene API

2023-04-04 Thread adlo
If I use my View struct (src/wayland/view.h), everything is fine. But if I try 
to copy the contents of the View struct into the Client struct (src/client.h) 
and use the Client struct to hold data about my view instead of the View 
struct, so every instance of View is replaced with Client, my compositor 
segfaults at src/wayland/xdg_shell.c line 170 when I close the last window on 
the screen. (I think it was that line, I don't have the backtrace to hand.)

I did some experimentation and copied my entire View struct into client.h and 
it still seemed to work. I think it also starts working if I make the Client 
struct smaller. So I think maybe it's got something to do with the size of the 
struct.

What's going on?

Regards
adlo

> On 31 Mar 2023, at 12:44, adlo  wrote:
> I have rewritten my Wayland port of xfwm4 for the third or fourth time.
> 
> I kept adding thousands of lines of code and then scrapping it, so the
> commit history was getting full of scrapped code, so I decided to reset
> to master and start from scratch.
> 
> I have created a new wayland-2 branch. At some point I may rename this
> branch to wayland and rename the old wayland branch to wayland-old or
> something.
> 
> My compositor now uses the wlr-scene API, which handles a lot of the
> low-level stuff for you, such as rendering and damage tracking, which
> makes the code much simpler to write and more easily maintainable.
> 
> I have now moved the Wayland compositor code into the original xfwm4
> binary, so the Wayland compositor and X11 version are now in one
> binary.
> 
> You can run the Wayland compositor with the command xfwm4 --wayland
> 
> You can find the repo here:
> https://github.com/adlocode/xfwm4/tree/wayland-2
> 
> Regards
> adlo


Re: xfwm4-wayland: use wlr-scene API

2023-04-04 Thread adlo
Correction: the View struct is in src/wayland/output.h, not view.h

> On 4 Apr 2023, at 08:07, adlo  wrote:
> 
> If I use my View struct (src/wayland/view.h), everything is fine. But if I 
> try to copy the contents of the View struct into the Client struct 
> (src/client.h) and use the Client struct to hold data about my view instead 
> of the View struct, so every instance of View is replaced with Client, my 
> compositor segfaults at src/wayland/xdg_shell.c line 170 when I close the 
> last window on the screen. (I think it was that line, I don't have the 
> backtrace to hand.)
> 
> I did some experimentation and copied my entire View struct into client.h and 
> it still seemed to work. I think it also starts working if I make the Client 
> struct smaller. So I think maybe it's got something to do with the size of 
> the struct.
> 
> What's going on?
> 
> Regards
> adlo
> 
>> On 31 Mar 2023, at 12:44, adlo  wrote:
>> I have rewritten my Wayland port of xfwm4 for the third or fourth time.
>> 
>> I kept adding thousands of lines of code and then scrapping it, so the
>> commit history was getting full of scrapped code, so I decided to reset
>> to master and start from scratch.
>> 
>> I have created a new wayland-2 branch. At some point I may rename this
>> branch to wayland and rename the old wayland branch to wayland-old or
>> something.
>> 
>> My compositor now uses the wlr-scene API, which handles a lot of the
>> low-level stuff for you, such as rendering and damage tracking, which
>> makes the code much simpler to write and more easily maintainable.
>> 
>> I have now moved the Wayland compositor code into the original xfwm4
>> binary, so the Wayland compositor and X11 version are now in one
>> binary.
>> 
>> You can run the Wayland compositor with the command xfwm4 --wayland
>> 
>> You can find the repo here:
>> https://github.com/adlocode/xfwm4/tree/wayland-2
>> 
>> Regards
>> adlo


[ANNOUNCE] wayland 1.22.0

2023-04-04 Thread Simon Ser
This is the official release for Wayland 1.22.

This new release adds explicit events for the preferred buffer scale
and transform, adds an event to indicate the pointer's physical scroll
direction, adds a few new convenience functions, and includes various
spec clarifications and bug fixes.

Commit history since RC1 below.

Simon Ser (1):
  build: bump to version 1.22.0 for the official release

git tag: 1.22.0

https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.22.0/downloads/wayland-1.22.0.tar.xz
SHA256: 1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842  
wayland-1.22.0.tar.xz
SHA512: 
fb1974efc8433e97254eb83fe28974198f2b4d8246418eb3d34ce657055461e0c97bc06dd52e5066ae91bbe05bac611dc49a0937ba226ac6388d5a47241efb12
  wayland-1.22.0.tar.xz
PGP:
https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.22.0/downloads/wayland-1.22.0.tar.xz.sig


Wayland client, cleanup on exit

2023-04-04 Thread Guillermo Rodriguez
Hi all,

Is it necessary to explicitly clean up and release any resources before
exit in a Wayland client? Does that happen automatically if the process
simply exits (in the same way that other resources such as memory or fds
are automatically released) ?

Thank you,

Guillermo


Re: Wayland client, cleanup on exit

2023-04-04 Thread Simon Ser
Hi,

On Tuesday, April 4th, 2023 at 12:16, Guillermo Rodriguez 
 wrote:

> Is it necessary to explicitly clean up and release any resources
> before exit in a Wayland client? Does that happen automatically if
> the process simply exits (in the same way that other resources such
> as memory or fds are automatically released) ?

If you don't explicitly cleanup resources allocated by libwayland, it's
fine: the process won't leak any. IOW, resources allocated in a Wayland
client are cleaned up by the OS as usual.

Some people still prefer to explicitly clean up, e.g. to use tools like
ASan/Valgrind.

Simon


Re: Wayland client, cleanup on exit

2023-04-04 Thread Guillermo Rodriguez Garcia
Hello,

El mar, 4 abr 2023 a las 12:33, Simon Ser () escribió:

> Hi,
>
> On Tuesday, April 4th, 2023 at 12:16, Guillermo Rodriguez <
> guillerodriguez@gmail.com> wrote:
>
> > Is it necessary to explicitly clean up and release any resources
> > before exit in a Wayland client? Does that happen automatically if
> > the process simply exits (in the same way that other resources such
> > as memory or fds are automatically released) ?
>
> If you don't explicitly cleanup resources allocated by libwayland, it's
> fine: the process won't leak any. IOW, resources allocated in a Wayland
> client are cleaned up by the OS as usual.
>
>
Thank you, this is very useful!

One further question: before posting this here, I was trying to verify this
by myself, and was wondering whether there is some sort of tool that can be
used to monitor resources currently in use in a Wayland server. Does such a
tool exist?

Thanks,

Guillermo Rodriguez Garcia
guille.rodrig...@gmail.com


Re: Wayland client, cleanup on exit

2023-04-04 Thread Simon Ser
On Tuesday, April 4th, 2023 at 12:46, Guillermo Rodriguez Garcia 
 wrote:

> One further question: before posting this here, I was trying to verify
> this by myself, and was wondering whether there is some sort of tool
> that can be used to monitor resources currently in use in a Wayland
> server. Does such a tool exist?

I'm not aware of any. There is wlhax [1] which can be used to track
which protocol objects are alive for a given client. There is the
standard tooling to monitor allocated memory for a process. But I don't
know of any tool to monitor Wayland objects in a server specifically.

[1]: https://git.sr.ht/~kennylevinsen/wlhax


Re: Wayland client, cleanup on exit

2023-04-04 Thread Guillermo Rodriguez
El mar, 4 abr 2023 a las 12:53, Simon Ser () escribió:

> On Tuesday, April 4th, 2023 at 12:46, Guillermo Rodriguez Garcia <
> guille.rodrig...@gmail.com> wrote:
>
> > One further question: before posting this here, I was trying to verify
> > this by myself, and was wondering whether there is some sort of tool
> > that can be used to monitor resources currently in use in a Wayland
> > server. Does such a tool exist?
>
> I'm not aware of any. There is wlhax [1] which can be used to track
> which protocol objects are alive for a given client. There is the
> standard tooling to monitor allocated memory for a process. But I don't
> know of any tool to monitor Wayland objects in a server specifically.
>
> [1]: https://git.sr.ht/~kennylevinsen/wlhax


Thank you for the pointer! This is nice.

Out of curiosity, for objects that are only released when a client
disconnects (such as wl_registry), how does the Wayland server know how to
release this if the client does not disconnect explicitly. in other words
how is the resource leak on the server side avoided if the client just
exits and the OS cleans up?

Thanks again,

Guillermo Rodriguez Garcia
guille.rodrig...@gmail.com


Re: Wayland client, cleanup on exit

2023-04-04 Thread Simon Ser
On Tuesday, April 4th, 2023 at 13:26, Guillermo Rodriguez 
 wrote:

> Out of curiosity, for objects that are only released when a client
> disconnects (such as wl_registry), how does the Wayland server know
> how to release this if the client does not disconnect explicitly. in
> other words how is the resource leak on the server side avoided if the
> client just exits and the OS cleans up?

libwayland-server notices that the socket is disconnected and cleans up
all Wayland objects belonging to it.


Re: Wayland client, cleanup on exit

2023-04-04 Thread Guillermo Rodriguez
El mar, 4 abr 2023 a las 13:28, Simon Ser () escribió:

> On Tuesday, April 4th, 2023 at 13:26, Guillermo Rodriguez <
> guillerodriguez@gmail.com> wrote:
>
> > Out of curiosity, for objects that are only released when a client
> > disconnects (such as wl_registry), how does the Wayland server know
> > how to release this if the client does not disconnect explicitly. in
> > other words how is the resource leak on the server side avoided if the
> > client just exits and the OS cleans up?
>
> libwayland-server notices that the socket is disconnected and cleans up
> all Wayland objects belonging to it.
>

Understood, thank you!

BR,

Guillermo Rodriguez Garcia
guille.rodrig...@gmail.com