aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-02 06:19:34 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-02 06:19:34 +0200
commit93da082d32ce3a4892fcd88f460ceab9186fa1ef (patch)
treea4d10086cbf125710b752dfaad345efacd521aad /src
parent548dae6699b6409d27c19151f3e7ddd11022cb37 (diff)
Always use transparent background, only take screenshot if no compositor
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 45f8693..581d656 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -223,7 +223,7 @@ int main(int argc, char **argv) {
window_create_params.hidden = true;
//window_create_params.override_redirect = true;
window_create_params.background_color = bg_color;
- window_create_params.support_alpha = is_compositor_running(display, 0);
+ window_create_params.support_alpha = true;
window_create_params.window_type = MGL_WINDOW_TYPE_DIALOG;
mgl::Window window;
@@ -268,19 +268,18 @@ int main(int argc, char **argv) {
if(!stream_button_texture.load_from_file((program_root_dir + "images/stream.png").c_str()))
startup_error("failed to load texture: images/stream.png");
- // TODO: Only do these things if no compositor (with argb support) is running.
// TODO: Get size from monitor, get region specific to the monitor
- XImage *img = XGetImage(display, DefaultRootWindow(display), window_pos.x, window_pos.y, window_size.x, window_size.y, AllPlanes, ZPixmap);
- if(!img) {
- fprintf(stderr, "Error: failed to take a screenshot\n");
- exit(1);
- }
-
mgl::Texture screenshot_texture;
- if(!window_create_params.support_alpha) {
- screenshot_texture = texture_from_ximage(img);
- XDestroyImage(img);
- img = NULL;
+ if(!is_compositor_running(display, 0)) {
+ XImage *img = XGetImage(display, DefaultRootWindow(display), window_pos.x, window_pos.y, window_size.x, window_size.y, AllPlanes, ZPixmap);
+ if(!img)
+ fprintf(stderr, "Error: failed to take a screenshot\n");
+
+ if(img) {
+ screenshot_texture = texture_from_ximage(img);
+ XDestroyImage(img);
+ img = NULL;
+ }
}
mgl::Sprite screenshot_sprite;