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

前端 未结 4 487
庸人自扰
庸人自扰 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:54

    Depends:

    • If you're hardcore and you want to use Xlib, have a look at XDisplayWidth() and XDisplayHeight().
    • If you use Qt4 (my preference), try
       QApplication::desktop()->screenGeometry() 
      (see http://doc.qt.digia.com/4.0/qdesktopwidget.html )
    • Or in Gtk, see http://library.gnome.org/devel/gdk/stable/GdkScreen.html

提交回复
热议问题