Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting title bar #7

Open
mgord9518 opened this issue Sep 9, 2023 · 1 comment
Open

Setting title bar #7

mgord9518 opened this issue Sep 9, 2023 · 1 comment

Comments

@mgord9518
Copy link

I've been messing with zigx for a couple weeks now and I have most of the basics down but I can't figure out how to set the title for a window. Is this currently possible? I've tried looking through the source code but haven't been able to find anything.

I have no experience with plain X11 programming previous to this project, so there could be terminology I'm skimming over

@MadLittleMods
Copy link
Contributor

MadLittleMods commented Sep 9, 2023

Judging based on the libX11 docs for reference (the client library written in C), it looks like they handle setting the window title with the XStoreName(...) function. Looking at their source code, I see that XStoreName(...) calls XChangeProperty(...) and makes a xChangePropertyReq.

And searching through the X11 protocol docs, we find the ChangeProperty request type (Ctrl + F a few more times to find it in the Requests section) to find the opcode which is 18.

  ChangeProperty
+      1     18                              opcode
       1                                     mode
            0     Replace
            1     Prepend
            2     Append
       2     6+(n+p)/4                       request length
       4     WINDOW                          window
       4     ATOM                            property
       4     ATOM                            type
       1     CARD8                           format
       3                                     unused
       4     CARD32                          length of data in format units
                      (= n for format = 8)
                      (= n/2 for format = 16)
                      (= n/4 for format = 32)
       n     LISTofBYTE                      data
                      (n is a multiple of 2 for format = 16)
                      (n is a multiple of 4 for format = 32)
       p                                     unused, p=pad(n)

If we then cross-reference opcode 18 with the supported opcodes in this project via x.zig, it's not listed which means that kind of functionality isn't supported yet but could be added.

Tips/pointers to add:

Serializing the ChangeProperty type of request would need to be added to the project similar to any of the other requests in x.zig like create_pixmap/CreatePixmap as an example.

The specific "property" you want to change looks like it would be the WM_NAME atom. WM_NAME = 39 would need to be added to the list of Atom in x.zig (X11 docs for reference).


For reference, I'm also just a Zig/X11 noob so I could just as easily be off on a few things but this looked answerable based on what I have been trying to investigate on how to add transparency/alpha support for the window (32-bit color depth).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants