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

Create and specify custom color maps #9

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Sep 15, 2023

Create and specify custom color maps

Part of the quest for transparent windows/colors. I was able to get transparency/alpha working with these changes on top of #8. See MadLittleMods/fps-aim-analyzer#2 as an example.

Part of the quest for transparent windows/colors
writeIntNative(u32, buf + 8, args.window_id);
writeIntNative(u32, buf + 12, args.visual_id);
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X11 protocol docs: https://www.x.org/releases/current/doc/xproto/x11protocol.html#requests:CreateColormap

CreateColormap
     1     78                              opcode
     1                                     alloc
          0     None
          1     All
     2     4                               request length
     4     COLORMAP                        mid
     4     WINDOW                          window
     4     VISUALID                        visual

@@ -952,7 +954,7 @@ pub const window = struct {
save_under: bool = false,
event_mask: u32 = 0,
dont_propagate: u32 = 0,
colormap: Colormap = .copy_from_parent,
colormap: NonExhaustive(Colormap) = .copy_from_parent,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are making this non-exhaustive so we can specify a custom color map ID

writeIntNative(u16, buf + 2, len >> 2);
writeIntNative(u32, buf + 4, id);
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X11 protocol docs: https://www.x.org/releases/current/doc/xproto/x11protocol.html#requests:FreeColormap

FreeColormap
     1     79                              opcode
     1                                     unused
     2     2                               request length
     4     COLORMAP                        cmap

@marler8997
Copy link
Owner

Commands look reasonable. Would be nice to add some usage of the commands to testexample.zig or maybe graphics.zig. But can always be added later.

@marler8997 marler8997 merged commit 74ffbcb into marler8997:master Sep 21, 2023
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

Successfully merging this pull request may close these issues.

2 participants