Home > Enterprise >  Where's `CurrentTime` defined? How do I get it?
Where's `CurrentTime` defined? How do I get it?

Time:04-04

I'm trying to write a rudementary program to rotate the screen (using libXrandr). I couldn't find a lot of info about libXrandr, outside of xrandr's source code and man pages. So, I decided to analyze xrandr's source code to learn about libXrandr.

Upon writing the initialization routines, I came across XRRSetScreenConfig, that calls for a Timestamp parameter:

Status XRRSetScreenConfig (Display *dpy,
            XRRScreenConfiguration *config,
            Drawable draw,
            int size_index,
            Rotation rotation,
            Time timestamp);

I've got all the parameters figured out, except for the last one, timestamp. I looked around xrandr.c for uses of the function to point me in the right direction to what's supposed to be passed to it, and I found that a variable (?) named CurrentTime is passed in place of this parameter:

status = XRRSetScreenConfigAndRate (dpy, sc, root, (SizeID) size,
    (Rotation) (rotation | reflection),
    rate, CurrentTime);

(btw XRRSetScreenConfigAndRate has the same params as XRRSetScreenConfig, except with a couple extra parameters)

I looked around for where this variable is set, but I literally couldn't find anywhere where it's set, or even defined. Not even in Xrandr.h or its sub-includes.

So, I guess what my question is, what is CurrentTime? Is it literally just the current time in Unix time? Can I pass just a regular time_t timestamp to XRRSetScreenConfig? If not, how do I obtain a valid CurrentTime?

Any help would be greatly appreciated.

CodePudding user response:

CurrentTime is a macro defined in the X11/X.h header, which is subsequently included by X11/Xlib.h. So you can just pass in that CurrentTime in your program without worrying about where and how it is defined.

  • Related