polybar-dwm/include/x11/extensions/randr.hpp

59 lines
1.4 KiB
C++
Raw Normal View History

2016-11-02 19:22:45 +00:00
#pragma once
2017-01-11 02:07:28 +00:00
#include "settings.hpp"
2016-11-02 19:22:45 +00:00
#if not WITH_XRANDR
2016-11-20 22:04:31 +00:00
#error "X RandR extension is disabled..."
2016-11-02 19:22:45 +00:00
#endif
2016-11-26 14:42:48 +00:00
#include <xcb/randr.h>
2016-11-20 22:04:31 +00:00
#include <xpp/proto/randr.hpp>
2016-11-02 19:22:45 +00:00
#include "common.hpp"
2016-11-19 05:22:44 +00:00
POLYBAR_NS
2016-11-02 19:22:45 +00:00
2016-11-20 22:04:31 +00:00
class connection;
2016-11-26 08:38:55 +00:00
struct position;
2016-11-20 22:04:31 +00:00
namespace evt {
using randr_notify = xpp::randr::event::notify<connection&>;
using randr_screen_change_notify = xpp::randr::event::screen_change_notify<connection&>;
}
2016-11-02 19:22:45 +00:00
struct backlight_values {
2017-01-19 10:11:28 +00:00
unsigned int atom{0};
double min{0.0};
double max{0.0};
double val{0.0};
2016-11-02 19:22:45 +00:00
};
struct randr_output {
string name;
2017-01-19 10:11:28 +00:00
unsigned short int w{0U};
unsigned short int h{0U};
short int x{0};
short int y{0};
xcb_randr_output_t output;
2016-11-02 19:22:45 +00:00
backlight_values backlight;
2016-11-20 22:04:31 +00:00
bool match(const string& o, bool strict = false) const;
2016-11-26 08:38:55 +00:00
bool match(const position& p) const;
2016-11-02 19:22:45 +00:00
};
using monitor_t = shared_ptr<randr_output>;
namespace randr_util {
2016-12-21 13:55:19 +00:00
void query_extension(connection& conn);
bool check_monitor_support();
2017-01-19 10:11:28 +00:00
monitor_t make_monitor(xcb_randr_output_t randr, string name, unsigned short int w, unsigned short int h, short int x, short int y);
vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only = false, bool realloc = false);
2016-11-02 19:22:45 +00:00
void get_backlight_range(connection& conn, const monitor_t& mon, backlight_values& dst);
void get_backlight_value(connection& conn, const monitor_t& mon, backlight_values& dst);
}
2016-11-19 05:22:44 +00:00
POLYBAR_NS_END