-
Notifications
You must be signed in to change notification settings - Fork 0
/
highlight_window.h
executable file
·53 lines (43 loc) · 1.37 KB
/
highlight_window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef HIGHLIGHT_WINDOW_H
#define HIGHLIGHT_WINDOW_H
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/extensions/shape.h> // XShapeCombineRectangles -lXext
#include <stdlib.h>
#include <thread>
#include <atomic>
#include <mutex>
class HighLightWindow {
public:
HighLightWindow(Window target_window, int border_width, int border_length, unsigned int border_color);
~HighLightWindow();
void Start();
void Stop();
private:
void CreateHighlightWindow();
void HighlightWindowMoveResizeHandle();
void RedrawRectangleHandle();
void ExtendHandle(int &x, int &y, int &width, int &height);
void UpdateHighLightWindowMapState();
struct Point {
int x;
int y;
Point() : x(0), y(0) {}
Point(int x, int y) : x(x), y(y) {}
};
private:
Display *display_;
Window target_window_ = 0; // real window
Window highlight_window_ = 0;
bool is_initialized_ = false;
std::thread event_thread_;
std::atomic_bool stop_event_monitor_;
bool is_stopped_ = false;
// highlight window's attributes
int highlight_border_width_ = 6;
int highlight_border_length_ = 120;
unsigned int highlight_border_color_argb_ = 0xFF29CCA3; // argb
// highlight window cache state
bool is_highlight_window_visible_ = true;
};
#endif // HIGHLIGHT_WINDOW_H