How to programmatically get the resolution of a window and that of the system in Linux?

前端 未结 4 490
庸人自扰
庸人自扰 2021-02-06 00:06

I\'m trying to get the resolution of the screen as well as the resolution of a specific window (in which a program is running) on Linux system. I don\'t need to modify the resol

4条回答
  •  你的背包
    2021-02-06 00:44

    In X11, you'd need to call the Xlib's XGetWindowAttributes to get the various window info, including the size and position relative to parent. For an example of how it is used, you can google for 'xwininfo.c'.

    That said, probably you are going to use some more highlevel framework to do your window programming - and the chances are high that it already has some other primitives for this, see an example for Qt - so you might want to give a bit more background about the question.

提交回复
热议问题