2016-11-02 15:22:45 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "config.hpp"
|
|
|
|
|
2016-11-30 06:46:26 -05:00
|
|
|
#if not WITH_XRANDR
|
2016-11-20 17:04:31 -05:00
|
|
|
#error "X RandR extension is disabled..."
|
2016-11-02 15:22:45 -04:00
|
|
|
#endif
|
|
|
|
|
2016-11-26 09:42:48 -05:00
|
|
|
#include <xcb/randr.h>
|
2016-11-20 17:04:31 -05:00
|
|
|
#include <xpp/proto/randr.hpp>
|
|
|
|
#include <xpp/xpp.hpp>
|
|
|
|
|
2016-11-02 15:22:45 -04:00
|
|
|
#include "common.hpp"
|
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS
|
2016-11-02 15:22:45 -04:00
|
|
|
|
2016-11-20 17:04:31 -05:00
|
|
|
class connection;
|
2016-11-26 03:38:55 -05:00
|
|
|
struct position;
|
2016-11-20 17:04:31 -05: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 15:22:45 -04:00
|
|
|
struct backlight_values {
|
2016-11-12 03:40:14 -05:00
|
|
|
uint32_t atom = 0;
|
2016-11-02 15:22:45 -04:00
|
|
|
uint32_t min = 0;
|
|
|
|
uint32_t max = 0;
|
|
|
|
uint32_t val = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct randr_output {
|
|
|
|
string name;
|
2016-11-13 05:30:27 -05:00
|
|
|
uint16_t w = 0;
|
|
|
|
uint16_t h = 0;
|
|
|
|
int16_t x = 0;
|
|
|
|
int16_t y = 0;
|
2016-11-12 14:31:39 -05:00
|
|
|
xcb_randr_output_t output;
|
2016-11-02 15:22:45 -04:00
|
|
|
backlight_values backlight;
|
2016-11-12 14:31:39 -05:00
|
|
|
|
2016-11-20 17:04:31 -05:00
|
|
|
bool match(const string& o, bool strict = false) const;
|
2016-11-26 03:38:55 -05:00
|
|
|
bool match(const position& p) const;
|
2016-11-02 15:22:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
using monitor_t = shared_ptr<randr_output>;
|
|
|
|
|
|
|
|
namespace randr_util {
|
2016-11-13 05:30:27 -05:00
|
|
|
monitor_t make_monitor(xcb_randr_output_t randr, string name, uint16_t w, uint16_t h, int16_t x, int16_t y);
|
2016-11-12 14:31:39 -05:00
|
|
|
vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only = false);
|
2016-11-02 15:22:45 -04: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 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|