Commit Graph

21 Commits

Author SHA1 Message Date
Elf M. Sternberg e8bd037f61 Got the same functionality out of Rust, only prettier, and learned an important lesson about how much more Rust cares that the info you handled is, in fact, *fully* handled. 2022-04-18 17:26:10 -07:00
Elf M. Sternberg 0af01c5e0d Added showing the Output name along with the details (if any). 2022-04-18 16:01:41 -07:00
Elf M. Sternberg f60e935ffe This is a port of the C++ version of the XCB RandR reader.
I really, *really* like the way the Rust library is built and managed. It does a
really good job of emulating the XCB RandR macro found in KDE's Plasma and
libkscreen. The port was straightforward and my worries about memory management
were completely unfounded.
2022-04-15 19:52:53 -07:00
Elf M. Sternberg f821d87ba3 Added a lot of commentary into CMakeList.
This is just that I added a lot of comments to each new command in the CMakeList
file, because if I ever have to re-use this obscure and infrequently used skill,
I'll have a record written in my own words.
2022-04-15 15:10:36 -07:00
Elf M. Sternberg 0e6fb46b96 Moving the 'learning xcb reading' into its own folder.
This matches the learning process that I describe in rigged_regex.  Step by
step, recording everything multiple times and in multiple ways, so that all the
learning that I care about is preserved.  There's XCB in here, and some C++
(mostly around `unique_ptr`).
2022-04-15 14:41:03 -07:00
Elf M. Sternberg e0e59f8d9d Keeping up-to-date, and preparing for some basic CLI stuff with
a simple CXXOpts handler that had an API I thought was somewhat
readable.
2022-03-31 15:38:18 -07:00
Elf M. Sternberg a8009bdedb Friggin' Github Flavored Markdown 2022-02-27 11:07:37 -08:00
Elf M. Sternberg 213dab0a97 Friggin' Github Flavored Markdown 2022-02-27 11:07:06 -08:00
Elf M. Sternberg e6d836b005 Friggin' Github Flavored Markdown 2022-02-27 11:06:33 -08:00
Elf M. Sternberg 9c7c7b9914 Added mucho documentation. 2022-02-27 11:02:21 -08:00
Elf M. Sternberg 03f0fc82b3 Added the rotation parameter to the display. C++ makes lookup tables
really effing annoying.
2022-02-25 07:47:38 -08:00
Elf M. Sternberg 66b3458bc9 Don't need two licenses. 2022-02-24 17:13:31 -08:00
Elf M. Sternberg a97a52c9a5 Fixed a typo in the Journal 2022-02-24 17:12:52 -08:00
Elf M. Sternberg abdc9f184f Fixed attribution in the journal. 2022-02-24 17:11:01 -08:00
Elf M. Sternberg cf73c5ddfd Changed the color on the Xorg logo to the lighter background. 2022-02-24 17:07:06 -08:00
Elf M. Sternberg fad050d278 Different logo. 2022-02-24 17:05:40 -08:00
Elf M. Sternberg 823ca35e0c Added README and LICENSE files.
In preparation for putting it up on Github.
2022-02-24 17:03:29 -08:00
Elf M. Sternberg 2cd9b268a8 Innteresting. It seems that the `output` collection is much more
reliable as a source of truth about which monitors and screens are
actually in use.  Each one comes with its own collection of `crtc`,
but you can just skip the ones that return `null`, giving you a
reliable list of the "active and visible" screens that the user is
currently looking at.  Excellent!  This means that I'm one step closer
to having a viable solution!

I also discovered the [xcb_util](https://xcb.freedesktop.org/XcbUtil/)
library of helpful utilities has a function called
`xcb_aux_get_screen` for getting the root screen because everyone was
weirded out by that list traversal algorithm.

The source code to [xedgewarp](https://github.com/Airblader/xedgewarp)
was invaluable in revealing these secrets to me.

So far this little toy compiles down to only 35KB, and that includes
using `std::cout` and `std::vector`!  I wonder how big the Rust
version will be.  Yeah, yeah, I know, it cheats by having lots of
itself hidden in the kernel.

Next up: Actually knowing what the rotation status is.
2022-02-24 15:59:43 -08:00
Elf M. Sternberg 8a700005c3 I consider Makefiles documentation, and this will help remind me that
I don't want to build in the root, but in a build subdirectory.  It
also provides a nice and easy `make clean` method.
2022-02-17 18:31:41 -08:00
Elf M. Sternberg bafa8bfd23 In this commit, we learned about X11 iterators, which iterate through
monstrous things allocated in memory that you just have to "know" are
of a certain structure.  In this case, we used `xcb_screen_next` to
say that we want the first (and all) screens attached to our current
X11 session.  And we used
`xcb_setup_roots_iterator(xcb_get_setup(connection))` to initialize
our iterator to our connection object in local memory.

Other things we've learned along the way: the file description that
represents our connection can be a TCP/IP socket or a Unix Domain
socket (a filesystem socket, named or not), and the only way to know
which is to find if there's a hostname before the colon ':' in the
display name of the server.  Not sure how that's going to work.

Also, found a really good reference: [Basic Graphics Tutorial with
XCB](https://www.x.org/releases/X11R7.6/doc/libxcb/tutorial/index.html).
It doesn't cover our specific use-case, but it's worth looking into.
2022-02-17 18:25:49 -08:00
Elf M. Sternberg 59a0c6acbf Initial commit: XRandR connects to the server via XCB.
I really need to start two cheatsheets for this: one for CMake,
and one for XCB.
2022-02-17 07:01:34 -08:00