2018-10-04 05:14:51 +08:00
|
|
|
// SPDX-License-Identifier: MIT
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/*
|
|
|
|
* Compton - a compositor for X11
|
|
|
|
*
|
|
|
|
* Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011-2013, Christopher Jeffrey
|
2018-10-04 05:14:51 +08:00
|
|
|
* Copyright (c) 2018, Yuxuan Shui <yshuiv7@gmail.com>
|
|
|
|
*
|
2018-10-04 05:24:12 +08:00
|
|
|
* See LICENSE-mit for more information.
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-08-22 19:58:49 +08:00
|
|
|
#pragma once
|
2013-01-24 13:38:03 +08:00
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Options ===
|
|
|
|
|
|
|
|
// Debug options, enable them using -D in CFLAGS
|
2014-04-19 19:41:26 +08:00
|
|
|
// #define DEBUG_BACKTRACE 1
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// #define DEBUG_REPAINT 1
|
|
|
|
// #define DEBUG_EVENTS 1
|
|
|
|
// #define DEBUG_RESTACK 1
|
|
|
|
// #define DEBUG_WINTYPE 1
|
|
|
|
// #define DEBUG_CLIENTWIN 1
|
|
|
|
// #define DEBUG_WINDATA 1
|
|
|
|
// #define DEBUG_WINMATCH 1
|
|
|
|
// #define DEBUG_REDIR 1
|
|
|
|
// #define DEBUG_ALLOC_REG 1
|
|
|
|
// #define DEBUG_FRAME 1
|
|
|
|
// #define DEBUG_LEADER 1
|
2013-01-24 13:38:03 +08:00
|
|
|
// #define DEBUG_C2 1
|
2013-05-20 18:04:40 +08:00
|
|
|
// #define DEBUG_GLX 1
|
|
|
|
// #define DEBUG_GLX_GLSL 1
|
|
|
|
// #define DEBUG_GLX_ERR 1
|
|
|
|
// #define DEBUG_GLX_MARK 1
|
2013-10-21 22:17:01 +08:00
|
|
|
// #define DEBUG_GLX_PAINTREG 1
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// Whether to enable PCRE regular expression support in blacklists, enabled
|
|
|
|
// by default
|
|
|
|
// #define CONFIG_REGEX_PCRE 1
|
|
|
|
// Whether to enable JIT support of libpcre. This may cause problems on PaX
|
|
|
|
// kernels.
|
|
|
|
// #define CONFIG_REGEX_PCRE_JIT 1
|
|
|
|
// Whether to enable parsing of configuration files using libconfig.
|
|
|
|
// #define CONFIG_LIBCONFIG 1
|
|
|
|
// Whether to enable DRM VSync support
|
|
|
|
// #define CONFIG_VSYNC_DRM 1
|
2018-08-22 22:12:29 +08:00
|
|
|
// Whether to enable OpenGL support (include GLSL, FBO)
|
|
|
|
// #define CONFIG_OPENGL 1
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// Whether to enable DBus support with libdbus.
|
|
|
|
// #define CONFIG_DBUS 1
|
2018-11-08 22:53:13 +08:00
|
|
|
// Whether to enable X Sync support.
|
|
|
|
// #define CONFIG_XSYNC 1
|
|
|
|
// Whether to enable GLX Sync support.
|
|
|
|
// #define CONFIG_GLX_XSYNC 1
|
2014-03-17 23:25:34 +08:00
|
|
|
|
2013-11-09 21:38:31 +08:00
|
|
|
#ifndef COMPTON_VERSION
|
|
|
|
#define COMPTON_VERSION "unknown"
|
|
|
|
#endif
|
|
|
|
|
2014-04-19 19:41:26 +08:00
|
|
|
#if defined(DEBUG_ALLOC_REG)
|
|
|
|
#define DEBUG_BACKTRACE 1
|
|
|
|
#endif
|
|
|
|
|
2018-11-10 20:48:36 +08:00
|
|
|
#define MAX_ALPHA (255)
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Includes ===
|
|
|
|
|
|
|
|
// For some special functions
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <time.h>
|
2013-04-26 14:01:20 +08:00
|
|
|
#include <ctype.h>
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
2018-09-23 06:44:44 +08:00
|
|
|
#include <X11/Xlib-xcb.h>
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
#include <X11/Xlib.h>
|
2018-11-08 22:53:13 +08:00
|
|
|
#include <X11/extensions/sync.h>
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
2018-09-29 00:38:33 +08:00
|
|
|
#include <xcb/composite.h>
|
2018-09-24 02:10:46 +08:00
|
|
|
#include <xcb/render.h>
|
2018-09-27 23:29:51 +08:00
|
|
|
#include <xcb/damage.h>
|
2018-09-27 23:38:24 +08:00
|
|
|
#include <xcb/randr.h>
|
2018-09-29 17:29:51 +08:00
|
|
|
#include <xcb/shape.h>
|
2018-09-24 02:10:46 +08:00
|
|
|
|
2018-09-29 17:46:29 +08:00
|
|
|
#ifdef CONFIG_XINERAMA
|
|
|
|
#include <xcb/xinerama.h>
|
|
|
|
#endif
|
2018-10-03 03:22:26 +08:00
|
|
|
#include <ev.h>
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
#include <pixman.h>
|
2018-09-29 17:46:29 +08:00
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// libdbus
|
|
|
|
#ifdef CONFIG_DBUS
|
|
|
|
#include <dbus/dbus.h>
|
|
|
|
#endif
|
|
|
|
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2015-01-11 10:47:19 +08:00
|
|
|
// libGL
|
2013-03-16 22:54:43 +08:00
|
|
|
#define GL_GLEXT_PROTOTYPES
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
#include <GL/glx.h>
|
2013-04-03 10:51:37 +08:00
|
|
|
|
|
|
|
// Workarounds for missing definitions in some broken GL drivers, thanks to
|
|
|
|
// douglasp and consolers for reporting
|
|
|
|
#ifndef GL_TEXTURE_RECTANGLE
|
|
|
|
#define GL_TEXTURE_RECTANGLE 0x84F5
|
|
|
|
#endif
|
|
|
|
|
2013-04-26 14:01:20 +08:00
|
|
|
#ifndef GLX_BACK_BUFFER_AGE_EXT
|
|
|
|
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
|
|
|
|
#endif
|
|
|
|
|
2015-01-11 10:47:19 +08:00
|
|
|
#endif
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Macros ===
|
|
|
|
|
|
|
|
#define MSTR_(s) #s
|
|
|
|
#define MSTR(s) MSTR_(s)
|
|
|
|
|
2013-11-09 21:38:31 +08:00
|
|
|
/// @brief Wrapper for gcc branch prediction builtin, for likely branch.
|
|
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
|
|
|
|
|
|
/// @brief Wrapper for gcc branch prediction builtin, for unlikely branch.
|
|
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// Use #s here to prevent macro expansion
|
|
|
|
/// Macro used for shortening some debugging code.
|
|
|
|
#define CASESTRRET(s) case s: return #s
|
|
|
|
|
2014-08-03 19:40:40 +08:00
|
|
|
// X resource checker
|
|
|
|
#ifdef DEBUG_XRC
|
|
|
|
#include "xrescheck.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-21 10:10:12 +08:00
|
|
|
// FIXME This list of includes should get shorter
|
2018-10-21 09:56:50 +08:00
|
|
|
#include "types.h"
|
2018-10-21 10:10:12 +08:00
|
|
|
#include "win.h"
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
#include "x.h"
|
|
|
|
#include "region.h"
|
2018-12-16 01:53:17 +08:00
|
|
|
#include "log.h"
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Constants ===
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
/// @brief Length of generic buffers.
|
|
|
|
#define BUF_LEN 80
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
#define ROUNDED_PERCENT 0.05
|
|
|
|
#define ROUNDED_PIXELS 10
|
|
|
|
|
|
|
|
#define OPAQUE 0xffffffff
|
|
|
|
#define REGISTER_PROP "_NET_WM_CM_S"
|
|
|
|
|
|
|
|
#define TIME_MS_MAX LONG_MAX
|
|
|
|
#define FADE_DELTA_TOLERANCE 0.2
|
|
|
|
#define SWOPTI_TOLERANCE 3000
|
|
|
|
#define WIN_GET_LEADER_MAX_RECURSION 20
|
|
|
|
|
|
|
|
#define SEC_WRAP (15L * 24L * 60L * 60L)
|
|
|
|
|
|
|
|
#define NS_PER_SEC 1000000000L
|
|
|
|
#define US_PER_SEC 1000000L
|
|
|
|
#define MS_PER_SEC 1000
|
|
|
|
|
|
|
|
#define XRFILTER_CONVOLUTION "convolution"
|
2014-08-06 07:32:18 +08:00
|
|
|
#define XRFILTER_GAUSSIAN "gaussian"
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
#define XRFILTER_BINOMIAL "binomial"
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
/// @brief Maximum OpenGL FBConfig depth.
|
|
|
|
#define OPENGL_MAX_DEPTH 32
|
|
|
|
|
2013-04-26 14:01:20 +08:00
|
|
|
/// @brief Maximum OpenGL buffer age.
|
|
|
|
#define CGLX_MAX_BUFFER_AGE 5
|
|
|
|
|
2013-05-20 18:04:40 +08:00
|
|
|
/// @brief Maximum passes for blur.
|
|
|
|
#define MAX_BLUR_PASS 5
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// Window flags
|
|
|
|
|
|
|
|
// Window size is changed
|
|
|
|
#define WFLAG_SIZE_CHANGE 0x0001
|
|
|
|
// Window size/position is changed
|
|
|
|
#define WFLAG_POS_CHANGE 0x0002
|
|
|
|
// Window opacity / dim state changed
|
|
|
|
#define WFLAG_OPCT_CHANGE 0x0004
|
|
|
|
|
2018-09-28 00:14:44 +08:00
|
|
|
// xcb-render specific macros
|
|
|
|
#define XFIXED_TO_DOUBLE(value) (((double) (value)) / 65536)
|
|
|
|
#define DOUBLE_TO_XFIXED(value) ((xcb_render_fixed_t) (((double) (value)) * 65536))
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Types ===
|
|
|
|
|
|
|
|
typedef long time_ms_t;
|
2018-08-22 20:26:42 +08:00
|
|
|
typedef struct _c2_lptr c2_lptr_t;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
/// Structure representing needed window updates.
|
|
|
|
typedef struct {
|
|
|
|
bool shadow : 1;
|
|
|
|
bool fade : 1;
|
|
|
|
bool focus : 1;
|
|
|
|
bool invert_color : 1;
|
|
|
|
} win_upd_t;
|
|
|
|
|
|
|
|
typedef struct _ignore {
|
|
|
|
struct _ignore *next;
|
|
|
|
unsigned long sequence;
|
|
|
|
} ignore_t;
|
|
|
|
|
|
|
|
enum wincond_target {
|
|
|
|
CONDTGT_NAME,
|
|
|
|
CONDTGT_CLASSI,
|
|
|
|
CONDTGT_CLASSG,
|
|
|
|
CONDTGT_ROLE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wincond_type {
|
|
|
|
CONDTP_EXACT,
|
|
|
|
CONDTP_ANYWHERE,
|
|
|
|
CONDTP_FROMSTART,
|
|
|
|
CONDTP_WILDCARD,
|
|
|
|
CONDTP_REGEX_PCRE,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CONDF_IGNORECASE 0x0001
|
|
|
|
|
|
|
|
/// VSync modes.
|
|
|
|
typedef enum {
|
|
|
|
VSYNC_NONE,
|
|
|
|
VSYNC_DRM,
|
|
|
|
VSYNC_OPENGL,
|
2013-01-30 13:41:08 +08:00
|
|
|
VSYNC_OPENGL_OML,
|
2013-03-15 23:16:23 +08:00
|
|
|
VSYNC_OPENGL_SWC,
|
2013-03-23 22:06:41 +08:00
|
|
|
VSYNC_OPENGL_MSWC,
|
2013-01-24 13:38:03 +08:00
|
|
|
NUM_VSYNC,
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
} vsync_t;
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
/// @brief Possible backends of compton.
|
|
|
|
enum backend {
|
|
|
|
BKEND_XRENDER,
|
|
|
|
BKEND_GLX,
|
2013-12-24 07:46:48 +08:00
|
|
|
BKEND_XR_GLX_HYBRID,
|
2013-03-16 22:54:43 +08:00
|
|
|
NUM_BKEND,
|
2013-03-15 23:16:23 +08:00
|
|
|
};
|
|
|
|
|
2013-04-21 22:30:22 +08:00
|
|
|
/// @brief Possible swap methods.
|
2013-04-26 14:01:20 +08:00
|
|
|
enum {
|
|
|
|
SWAPM_BUFFER_AGE = -1,
|
|
|
|
SWAPM_UNDEFINED = 0,
|
|
|
|
SWAPM_COPY = 1,
|
|
|
|
SWAPM_EXCHANGE = 2,
|
2013-04-21 22:30:22 +08:00
|
|
|
};
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
typedef struct _glx_texture glx_texture_t;
|
|
|
|
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-03-17 23:25:34 +08:00
|
|
|
#ifdef DEBUG_GLX_DEBUG_CONTEXT
|
|
|
|
typedef GLXContext (*f_glXCreateContextAttribsARB) (Display *dpy,
|
|
|
|
GLXFBConfig config, GLXContext share_context, Bool direct,
|
|
|
|
const int *attrib_list);
|
|
|
|
typedef void (*GLDEBUGPROC) (GLenum source, GLenum type,
|
|
|
|
GLuint id, GLenum severity, GLsizei length, const GLchar* message,
|
|
|
|
GLvoid* userParam);
|
|
|
|
typedef void (*f_DebugMessageCallback) (GLDEBUGPROC, void *userParam);
|
|
|
|
#endif
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
typedef int (*f_WaitVideoSync) (int, int, unsigned *);
|
|
|
|
typedef int (*f_GetVideoSync) (unsigned *);
|
2013-01-30 13:41:08 +08:00
|
|
|
|
|
|
|
typedef Bool (*f_GetSyncValuesOML) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);
|
|
|
|
typedef Bool (*f_WaitForMscOML) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc);
|
2013-03-01 12:41:16 +08:00
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
typedef int (*f_SwapIntervalSGI) (int interval);
|
2013-03-23 22:06:41 +08:00
|
|
|
typedef int (*f_SwapIntervalMESA) (unsigned int interval);
|
2013-03-15 23:16:23 +08:00
|
|
|
|
2013-03-01 12:41:16 +08:00
|
|
|
typedef void (*f_BindTexImageEXT) (Display *display, GLXDrawable drawable, int buffer, const int *attrib_list);
|
|
|
|
typedef void (*f_ReleaseTexImageEXT) (Display *display, GLXDrawable drawable, int buffer);
|
|
|
|
|
2018-11-08 22:53:13 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-03-17 23:25:34 +08:00
|
|
|
// Looks like duplicate typedef of the same type is safe?
|
|
|
|
typedef int64_t GLint64;
|
|
|
|
typedef uint64_t GLuint64;
|
|
|
|
typedef struct __GLsync *GLsync;
|
|
|
|
|
|
|
|
#ifndef GL_SYNC_FLUSH_COMMANDS_BIT
|
|
|
|
#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_TIMEOUT_IGNORED
|
|
|
|
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_ALREADY_SIGNALED
|
|
|
|
#define GL_ALREADY_SIGNALED 0x911A
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_TIMEOUT_EXPIRED
|
|
|
|
#define GL_TIMEOUT_EXPIRED 0x911B
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_CONDITION_SATISFIED
|
|
|
|
#define GL_CONDITION_SATISFIED 0x911C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_WAIT_FAILED
|
|
|
|
#define GL_WAIT_FAILED 0x911D
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef GLsync (*f_FenceSync) (GLenum condition, GLbitfield flags);
|
|
|
|
typedef GLboolean (*f_IsSync) (GLsync sync);
|
|
|
|
typedef void (*f_DeleteSync) (GLsync sync);
|
|
|
|
typedef GLenum (*f_ClientWaitSync) (GLsync sync, GLbitfield flags,
|
|
|
|
GLuint64 timeout);
|
|
|
|
typedef void (*f_WaitSync) (GLsync sync, GLbitfield flags,
|
|
|
|
GLuint64 timeout);
|
|
|
|
typedef GLsync (*f_ImportSyncEXT) (GLenum external_sync_type,
|
|
|
|
GLintptr external_sync, GLbitfield flags);
|
|
|
|
#endif
|
|
|
|
|
2013-05-12 18:21:16 +08:00
|
|
|
#ifdef DEBUG_GLX_MARK
|
|
|
|
typedef void (*f_StringMarkerGREMEDY) (GLsizei len, const void *string);
|
|
|
|
typedef void (*f_FrameTerminatorGREMEDY) (void);
|
|
|
|
#endif
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
/// @brief Wrapper of a GLX FBConfig.
|
|
|
|
typedef struct {
|
2013-03-01 12:41:16 +08:00
|
|
|
GLXFBConfig cfg;
|
2013-03-15 23:16:23 +08:00
|
|
|
GLint texture_fmt;
|
|
|
|
GLint texture_tgts;
|
|
|
|
bool y_inverted;
|
|
|
|
} glx_fbconfig_t;
|
|
|
|
|
|
|
|
/// @brief Wrapper of a binded GLX texture.
|
|
|
|
struct _glx_texture {
|
|
|
|
GLuint texture;
|
|
|
|
GLXPixmap glpixmap;
|
2018-10-01 03:53:52 +08:00
|
|
|
xcb_pixmap_t pixmap;
|
2013-03-19 20:58:55 +08:00
|
|
|
GLenum target;
|
2013-03-18 11:48:28 +08:00
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
|
|
|
unsigned depth;
|
2013-03-01 12:41:16 +08:00
|
|
|
bool y_inverted;
|
|
|
|
};
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2013-05-20 18:04:40 +08:00
|
|
|
typedef struct {
|
|
|
|
/// Fragment shader for blur.
|
|
|
|
GLuint frag_shader;
|
|
|
|
/// GLSL program for blur.
|
|
|
|
GLuint prog;
|
|
|
|
/// Location of uniform "offset_x" in blur GLSL program.
|
|
|
|
GLint unifm_offset_x;
|
|
|
|
/// Location of uniform "offset_y" in blur GLSL program.
|
|
|
|
GLint unifm_offset_y;
|
|
|
|
/// Location of uniform "factor_center" in blur GLSL program.
|
|
|
|
GLint unifm_factor_center;
|
|
|
|
} glx_blur_pass_t;
|
|
|
|
|
2014-05-16 15:18:17 +08:00
|
|
|
typedef struct {
|
|
|
|
/// GLSL program.
|
|
|
|
GLuint prog;
|
|
|
|
/// Location of uniform "opacity" in window GLSL program.
|
|
|
|
GLint unifm_opacity;
|
|
|
|
/// Location of uniform "invert_color" in blur GLSL program.
|
|
|
|
GLint unifm_invert_color;
|
|
|
|
/// Location of uniform "tex" in window GLSL program.
|
|
|
|
GLint unifm_tex;
|
|
|
|
} glx_prog_main_t;
|
|
|
|
|
|
|
|
#define GLX_PROG_MAIN_INIT { \
|
|
|
|
.prog = 0, \
|
|
|
|
.unifm_opacity = -1, \
|
|
|
|
.unifm_invert_color = -1, \
|
|
|
|
.unifm_tex = -1, \
|
|
|
|
}
|
|
|
|
|
2014-07-28 12:50:15 +08:00
|
|
|
#endif
|
2018-09-30 05:47:12 +08:00
|
|
|
#else
|
|
|
|
typedef uint32_t glx_prog_main_t;
|
2013-05-20 18:04:40 +08:00
|
|
|
#endif
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
#define PAINT_INIT { .pixmap = None, .pict = None }
|
|
|
|
|
2018-10-21 09:58:37 +08:00
|
|
|
typedef struct conv {
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
int size;
|
2018-12-09 10:04:00 +08:00
|
|
|
double data[];
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
} conv;
|
|
|
|
|
|
|
|
/// Linked list type of atoms.
|
|
|
|
typedef struct _latom {
|
|
|
|
Atom atom;
|
|
|
|
struct _latom *next;
|
|
|
|
} latom_t;
|
|
|
|
|
2013-04-06 20:21:38 +08:00
|
|
|
#define REG_DATA_INIT { NULL, 0 }
|
|
|
|
|
2018-12-04 21:44:16 +08:00
|
|
|
typedef struct win_option_mask {
|
|
|
|
bool shadow: 1;
|
|
|
|
bool fade: 1;
|
|
|
|
bool focus: 1;
|
|
|
|
bool full_shadow: 1;
|
|
|
|
bool redir_ignore: 1;
|
|
|
|
bool opacity: 1;
|
|
|
|
} win_option_mask_t;
|
|
|
|
|
|
|
|
typedef struct win_option {
|
|
|
|
bool shadow;
|
|
|
|
bool fade;
|
|
|
|
bool focus;
|
|
|
|
bool full_shadow;
|
|
|
|
bool redir_ignore;
|
|
|
|
double opacity;
|
|
|
|
} win_option_t;
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Structure representing all options.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
typedef struct options_t {
|
2018-10-22 06:56:53 +08:00
|
|
|
// === Debugging ===
|
|
|
|
bool monitor_repaint;
|
2018-11-04 06:15:38 +08:00
|
|
|
bool print_diagnostics;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === General ===
|
Feature #16: Advanced window matching
- Add advanced window matching system, capable of matching against
arbitrary window properties as well as a series of internal
properties, with 4 additional operators (>, <, >=, <=) useful for
integer targets, and support of logical operators. The old matching
system is removed, but compatibility with the format is retained.
- As the new matching system is pretty complicated, and I have no past
experience in writing a parser, it's pretty possible that bugs are
present. It also has inferior performance, but I hope it doesn't
matter on modern CPUs.
- It's possible to disable matching system at compile time with NO_C2=1
now.
- Add ps->o.config_file to track which config file we have actually
read. Queryable via D-Bus.
- Parse -d in first pass in get_cfg() as c2 needs to query X to get
atoms during condition parsing.
- Fix a bug in wid_get_prop_adv() that 0 == rformat is not handled
correctly.
- Fix incompatibility with FreeBSD sed in dbus-examples/cdbus-driver.sh
.
- Add recipe to generate .clang_complete in Makefile, used by Vim
clang_complete plugin.
- Add DEBUG_C2 for debugging condition string parsing. DEBUG_WINMATCH is
still used for match debugging.
- Rename win_on_wdata_change() to win_on_factor_change().
- Extra malloc() failure checks. Add const to matching cache members in
session_t. Code clean-up. Documentation update.
2013-01-28 21:39:38 +08:00
|
|
|
/// The configuration file we used.
|
|
|
|
char *config_file;
|
2013-11-09 21:38:31 +08:00
|
|
|
/// Path to write PID to.
|
|
|
|
char *write_pid_path;
|
2013-01-24 13:38:03 +08:00
|
|
|
/// The display name we used. NULL means we are using the value of the
|
|
|
|
/// <code>DISPLAY</code> environment variable.
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
char *display;
|
2013-11-09 21:38:31 +08:00
|
|
|
/// Safe representation of display name.
|
|
|
|
char *display_repr;
|
2013-03-15 23:16:23 +08:00
|
|
|
/// The backend in use.
|
|
|
|
enum backend backend;
|
2018-11-08 22:53:13 +08:00
|
|
|
/// Whether to sync X drawing to avoid certain delay issues with
|
|
|
|
/// GLX backend.
|
|
|
|
bool xrender_sync;
|
|
|
|
/// Whether to sync X drawing with X Sync fence.
|
|
|
|
bool xrender_sync_fence;
|
2013-04-05 21:05:19 +08:00
|
|
|
/// Whether to avoid using stencil buffer under GLX backend. Might be
|
|
|
|
/// unsafe.
|
2013-03-17 12:14:00 +08:00
|
|
|
bool glx_no_stencil;
|
2013-04-05 21:05:19 +08:00
|
|
|
/// Whether to avoid rebinding pixmap on window damage.
|
|
|
|
bool glx_no_rebind_pixmap;
|
2013-04-21 22:30:22 +08:00
|
|
|
/// GLX swap method we assume OpenGL uses.
|
2013-04-26 14:01:20 +08:00
|
|
|
int glx_swap_method;
|
2013-05-08 22:44:36 +08:00
|
|
|
/// Whether to use GL_EXT_gpu_shader4 to (hopefully) accelerates blurring.
|
|
|
|
bool glx_use_gpushader4;
|
2014-05-16 15:18:17 +08:00
|
|
|
/// Custom fragment shader for painting windows, as a string.
|
|
|
|
char *glx_fshader_win_str;
|
|
|
|
/// Custom GLX program used for painting window.
|
|
|
|
glx_prog_main_t glx_prog_win;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether to fork to background.
|
|
|
|
bool fork_after_register;
|
|
|
|
/// Whether to detect rounded corners.
|
|
|
|
bool detect_rounded_corners;
|
2014-05-16 15:18:17 +08:00
|
|
|
/// Force painting of window content with blending.
|
|
|
|
bool force_win_blend;
|
2013-04-27 11:43:11 +08:00
|
|
|
/// Resize damage for a specific number of pixels.
|
|
|
|
int resize_damage;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether to unredirect all windows if a full-screen opaque window
|
|
|
|
/// is detected.
|
|
|
|
bool unredir_if_possible;
|
2013-09-04 22:00:51 +08:00
|
|
|
/// List of conditions of windows to ignore as a full-screen window
|
|
|
|
/// when determining if a window could be unredirected.
|
|
|
|
c2_lptr_t *unredir_if_possible_blacklist;
|
|
|
|
/// Delay before unredirecting screen.
|
|
|
|
time_ms_t unredir_if_possible_delay;
|
2013-07-26 12:52:16 +08:00
|
|
|
/// Forced redirection setting through D-Bus.
|
|
|
|
switch_t redirected_force;
|
2013-07-30 22:24:11 +08:00
|
|
|
/// Whether to stop painting. Controlled through D-Bus.
|
|
|
|
switch_t stoppaint_force;
|
2014-07-28 12:50:15 +08:00
|
|
|
/// Whether to re-redirect screen on root size change.
|
|
|
|
bool reredir_on_root_change;
|
|
|
|
/// Whether to reinitialize GLX on root size change.
|
|
|
|
bool glx_reinit_on_root_change;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether to enable D-Bus support.
|
|
|
|
bool dbus;
|
|
|
|
/// Path to log file.
|
|
|
|
char *logpath;
|
2013-03-19 20:58:55 +08:00
|
|
|
/// Number of cycles to paint in benchmark mode. 0 for disabled.
|
|
|
|
int benchmark;
|
|
|
|
/// Window to constantly repaint in benchmark mode. 0 for full-screen.
|
|
|
|
Window benchmark_wid;
|
2013-06-19 19:36:48 +08:00
|
|
|
/// A list of conditions of windows not to paint.
|
|
|
|
c2_lptr_t *paint_blacklist;
|
2018-09-29 00:38:33 +08:00
|
|
|
/// Whether to avoid using xcb_composite_name_window_pixmap(), for debugging.
|
2014-09-07 16:05:14 +08:00
|
|
|
bool no_name_pixmap;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether to work under synchronized mode for debugging.
|
|
|
|
bool synchronize;
|
2014-04-19 19:41:26 +08:00
|
|
|
/// Whether to show all X errors.
|
|
|
|
bool show_all_xerrors;
|
2014-07-13 09:34:38 +08:00
|
|
|
/// Whether to avoid acquiring X Selection.
|
|
|
|
bool no_x_selection;
|
2018-12-04 21:44:16 +08:00
|
|
|
/// Window type option override.
|
|
|
|
win_option_t wintype_option[NUM_WINTYPES];
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === VSync & software optimization ===
|
|
|
|
/// User-specified refresh rate.
|
|
|
|
int refresh_rate;
|
|
|
|
/// Whether to enable refresh-rate-based software optimization.
|
|
|
|
bool sw_opti;
|
|
|
|
/// VSync method to use;
|
|
|
|
vsync_t vsync;
|
|
|
|
/// Whether to do VSync aggressively.
|
|
|
|
bool vsync_aggressive;
|
2013-12-26 20:43:06 +08:00
|
|
|
/// Whether to use glFinish() instead of glFlush() for (possibly) better
|
|
|
|
/// VSync yet probably higher CPU usage.
|
|
|
|
bool vsync_use_glfinish;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Shadow ===
|
|
|
|
/// Red, green and blue tone of the shadow.
|
|
|
|
double shadow_red, shadow_green, shadow_blue;
|
|
|
|
int shadow_radius;
|
|
|
|
int shadow_offset_x, shadow_offset_y;
|
|
|
|
double shadow_opacity;
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
/// argument string to shadow-exclude-reg option
|
|
|
|
char *shadow_exclude_reg_str;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Shadow blacklist. A linked list of conditions.
|
Feature #16: Advanced window matching
- Add advanced window matching system, capable of matching against
arbitrary window properties as well as a series of internal
properties, with 4 additional operators (>, <, >=, <=) useful for
integer targets, and support of logical operators. The old matching
system is removed, but compatibility with the format is retained.
- As the new matching system is pretty complicated, and I have no past
experience in writing a parser, it's pretty possible that bugs are
present. It also has inferior performance, but I hope it doesn't
matter on modern CPUs.
- It's possible to disable matching system at compile time with NO_C2=1
now.
- Add ps->o.config_file to track which config file we have actually
read. Queryable via D-Bus.
- Parse -d in first pass in get_cfg() as c2 needs to query X to get
atoms during condition parsing.
- Fix a bug in wid_get_prop_adv() that 0 == rformat is not handled
correctly.
- Fix incompatibility with FreeBSD sed in dbus-examples/cdbus-driver.sh
.
- Add recipe to generate .clang_complete in Makefile, used by Vim
clang_complete plugin.
- Add DEBUG_C2 for debugging condition string parsing. DEBUG_WINMATCH is
still used for match debugging.
- Rename win_on_wdata_change() to win_on_factor_change().
- Extra malloc() failure checks. Add const to matching cache members in
session_t. Code clean-up. Documentation update.
2013-01-28 21:39:38 +08:00
|
|
|
c2_lptr_t *shadow_blacklist;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether bounding-shaped window should be ignored.
|
|
|
|
bool shadow_ignore_shaped;
|
|
|
|
/// Whether to respect _COMPTON_SHADOW.
|
|
|
|
bool respect_prop_shadow;
|
2013-08-22 21:15:04 +08:00
|
|
|
/// Whether to crop shadow to the very Xinerama screen.
|
|
|
|
bool xinerama_shadow_crop;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Fading ===
|
|
|
|
/// How much to fade in in a single fading step.
|
|
|
|
opacity_t fade_in_step;
|
|
|
|
/// How much to fade out in a single fading step.
|
|
|
|
opacity_t fade_out_step;
|
|
|
|
/// Fading time delta. In milliseconds.
|
|
|
|
time_ms_t fade_delta;
|
|
|
|
/// Whether to disable fading on window open/close.
|
|
|
|
bool no_fading_openclose;
|
2014-05-16 15:18:17 +08:00
|
|
|
/// Whether to disable fading on ARGB managed destroyed windows.
|
|
|
|
bool no_fading_destroyed_argb;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Fading blacklist. A linked list of conditions.
|
Feature #16: Advanced window matching
- Add advanced window matching system, capable of matching against
arbitrary window properties as well as a series of internal
properties, with 4 additional operators (>, <, >=, <=) useful for
integer targets, and support of logical operators. The old matching
system is removed, but compatibility with the format is retained.
- As the new matching system is pretty complicated, and I have no past
experience in writing a parser, it's pretty possible that bugs are
present. It also has inferior performance, but I hope it doesn't
matter on modern CPUs.
- It's possible to disable matching system at compile time with NO_C2=1
now.
- Add ps->o.config_file to track which config file we have actually
read. Queryable via D-Bus.
- Parse -d in first pass in get_cfg() as c2 needs to query X to get
atoms during condition parsing.
- Fix a bug in wid_get_prop_adv() that 0 == rformat is not handled
correctly.
- Fix incompatibility with FreeBSD sed in dbus-examples/cdbus-driver.sh
.
- Add recipe to generate .clang_complete in Makefile, used by Vim
clang_complete plugin.
- Add DEBUG_C2 for debugging condition string parsing. DEBUG_WINMATCH is
still used for match debugging.
- Rename win_on_wdata_change() to win_on_factor_change().
- Extra malloc() failure checks. Add const to matching cache members in
session_t. Code clean-up. Documentation update.
2013-01-28 21:39:38 +08:00
|
|
|
c2_lptr_t *fade_blacklist;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Opacity ===
|
|
|
|
/// Default opacity for inactive windows.
|
|
|
|
/// 32-bit integer with the format of _NET_WM_OPACITY. 0 stands for
|
|
|
|
/// not enabled, default.
|
|
|
|
opacity_t inactive_opacity;
|
2013-03-30 11:46:32 +08:00
|
|
|
/// Default opacity for inactive windows.
|
|
|
|
opacity_t active_opacity;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether inactive_opacity overrides the opacity set by window
|
|
|
|
/// attributes.
|
|
|
|
bool inactive_opacity_override;
|
|
|
|
/// Frame opacity. Relative to window opacity, also affects shadow
|
|
|
|
/// opacity.
|
|
|
|
double frame_opacity;
|
|
|
|
/// Whether to detect _NET_WM_OPACITY on client windows. Used on window
|
|
|
|
/// managers that don't pass _NET_WM_OPACITY to frame windows.
|
|
|
|
bool detect_client_opacity;
|
|
|
|
|
|
|
|
// === Other window processing ===
|
|
|
|
/// Whether to blur background of semi-transparent / ARGB windows.
|
|
|
|
bool blur_background;
|
|
|
|
/// Whether to blur background when the window frame is not opaque.
|
|
|
|
/// Implies blur_background.
|
|
|
|
bool blur_background_frame;
|
|
|
|
/// Whether to use fixed blur strength instead of adjusting according
|
|
|
|
/// to window opacity.
|
|
|
|
bool blur_background_fixed;
|
2013-03-23 22:06:41 +08:00
|
|
|
/// Background blur blacklist. A linked list of conditions.
|
|
|
|
c2_lptr_t *blur_background_blacklist;
|
2013-04-25 22:23:35 +08:00
|
|
|
/// Blur convolution kernel.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_fixed_t *blur_kerns[MAX_BLUR_PASS];
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// How much to dim an inactive window. 0.0 - 1.0, 0 to disable.
|
|
|
|
double inactive_dim;
|
|
|
|
/// Whether to use fixed inactive dim opacity, instead of deciding
|
|
|
|
/// based on window opacity.
|
|
|
|
bool inactive_dim_fixed;
|
|
|
|
/// Conditions of windows to have inverted colors.
|
Feature #16: Advanced window matching
- Add advanced window matching system, capable of matching against
arbitrary window properties as well as a series of internal
properties, with 4 additional operators (>, <, >=, <=) useful for
integer targets, and support of logical operators. The old matching
system is removed, but compatibility with the format is retained.
- As the new matching system is pretty complicated, and I have no past
experience in writing a parser, it's pretty possible that bugs are
present. It also has inferior performance, but I hope it doesn't
matter on modern CPUs.
- It's possible to disable matching system at compile time with NO_C2=1
now.
- Add ps->o.config_file to track which config file we have actually
read. Queryable via D-Bus.
- Parse -d in first pass in get_cfg() as c2 needs to query X to get
atoms during condition parsing.
- Fix a bug in wid_get_prop_adv() that 0 == rformat is not handled
correctly.
- Fix incompatibility with FreeBSD sed in dbus-examples/cdbus-driver.sh
.
- Add recipe to generate .clang_complete in Makefile, used by Vim
clang_complete plugin.
- Add DEBUG_C2 for debugging condition string parsing. DEBUG_WINMATCH is
still used for match debugging.
- Rename win_on_wdata_change() to win_on_factor_change().
- Extra malloc() failure checks. Add const to matching cache members in
session_t. Code clean-up. Documentation update.
2013-01-28 21:39:38 +08:00
|
|
|
c2_lptr_t *invert_color_list;
|
2013-05-21 09:18:41 +08:00
|
|
|
/// Rules to change window opacity.
|
|
|
|
c2_lptr_t *opacity_rules;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Focus related ===
|
2014-05-16 15:18:17 +08:00
|
|
|
/// Whether to try to detect WM windows and mark them as focused.
|
|
|
|
bool mark_wmwin_focused;
|
|
|
|
/// Whether to mark override-redirect windows as focused.
|
|
|
|
bool mark_ovredir_focused;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether to use EWMH _NET_ACTIVE_WINDOW to find active window.
|
|
|
|
bool use_ewmh_active_win;
|
|
|
|
/// A list of windows always to be considered focused.
|
Feature #16: Advanced window matching
- Add advanced window matching system, capable of matching against
arbitrary window properties as well as a series of internal
properties, with 4 additional operators (>, <, >=, <=) useful for
integer targets, and support of logical operators. The old matching
system is removed, but compatibility with the format is retained.
- As the new matching system is pretty complicated, and I have no past
experience in writing a parser, it's pretty possible that bugs are
present. It also has inferior performance, but I hope it doesn't
matter on modern CPUs.
- It's possible to disable matching system at compile time with NO_C2=1
now.
- Add ps->o.config_file to track which config file we have actually
read. Queryable via D-Bus.
- Parse -d in first pass in get_cfg() as c2 needs to query X to get
atoms during condition parsing.
- Fix a bug in wid_get_prop_adv() that 0 == rformat is not handled
correctly.
- Fix incompatibility with FreeBSD sed in dbus-examples/cdbus-driver.sh
.
- Add recipe to generate .clang_complete in Makefile, used by Vim
clang_complete plugin.
- Add DEBUG_C2 for debugging condition string parsing. DEBUG_WINMATCH is
still used for match debugging.
- Rename win_on_wdata_change() to win_on_factor_change().
- Extra malloc() failure checks. Add const to matching cache members in
session_t. Code clean-up. Documentation update.
2013-01-28 21:39:38 +08:00
|
|
|
c2_lptr_t *focus_blacklist;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether to do window grouping with <code>WM_TRANSIENT_FOR</code>.
|
|
|
|
bool detect_transient;
|
|
|
|
/// Whether to do window grouping with <code>WM_CLIENT_LEADER</code>.
|
|
|
|
bool detect_client_leader;
|
|
|
|
|
|
|
|
// === Calculated ===
|
|
|
|
/// Whether compton needs to track focus changes.
|
|
|
|
bool track_focus;
|
|
|
|
/// Whether compton needs to track window name and class.
|
|
|
|
bool track_wdata;
|
|
|
|
/// Whether compton needs to track window leaders.
|
|
|
|
bool track_leader;
|
|
|
|
} options_t;
|
|
|
|
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-07-28 12:50:15 +08:00
|
|
|
/// Structure containing GLX-dependent data for a compton session.
|
|
|
|
typedef struct {
|
|
|
|
// === OpenGL related ===
|
|
|
|
/// GLX context.
|
|
|
|
GLXContext context;
|
|
|
|
/// Whether we have GL_ARB_texture_non_power_of_two.
|
|
|
|
bool has_texture_non_power_of_two;
|
|
|
|
/// Pointer to glXGetVideoSyncSGI function.
|
|
|
|
f_GetVideoSync glXGetVideoSyncSGI;
|
|
|
|
/// Pointer to glXWaitVideoSyncSGI function.
|
|
|
|
f_WaitVideoSync glXWaitVideoSyncSGI;
|
|
|
|
/// Pointer to glXGetSyncValuesOML function.
|
|
|
|
f_GetSyncValuesOML glXGetSyncValuesOML;
|
|
|
|
/// Pointer to glXWaitForMscOML function.
|
|
|
|
f_WaitForMscOML glXWaitForMscOML;
|
|
|
|
/// Pointer to glXSwapIntervalSGI function.
|
|
|
|
f_SwapIntervalSGI glXSwapIntervalProc;
|
|
|
|
/// Pointer to glXSwapIntervalMESA function.
|
|
|
|
f_SwapIntervalMESA glXSwapIntervalMESAProc;
|
|
|
|
/// Pointer to glXBindTexImageEXT function.
|
|
|
|
f_BindTexImageEXT glXBindTexImageProc;
|
|
|
|
/// Pointer to glXReleaseTexImageEXT function.
|
|
|
|
f_ReleaseTexImageEXT glXReleaseTexImageProc;
|
|
|
|
/// Pointer to the glFenceSync() function.
|
|
|
|
f_FenceSync glFenceSyncProc;
|
|
|
|
/// Pointer to the glIsSync() function.
|
|
|
|
f_IsSync glIsSyncProc;
|
|
|
|
/// Pointer to the glDeleteSync() function.
|
|
|
|
f_DeleteSync glDeleteSyncProc;
|
|
|
|
/// Pointer to the glClientWaitSync() function.
|
|
|
|
f_ClientWaitSync glClientWaitSyncProc;
|
|
|
|
/// Pointer to the glWaitSync() function.
|
|
|
|
f_WaitSync glWaitSyncProc;
|
|
|
|
/// Pointer to the glImportSyncEXT() function.
|
|
|
|
f_ImportSyncEXT glImportSyncEXT;
|
|
|
|
#ifdef DEBUG_GLX_MARK
|
|
|
|
/// Pointer to StringMarkerGREMEDY function.
|
|
|
|
f_StringMarkerGREMEDY glStringMarkerGREMEDY;
|
|
|
|
/// Pointer to FrameTerminatorGREMEDY function.
|
|
|
|
f_FrameTerminatorGREMEDY glFrameTerminatorGREMEDY;
|
|
|
|
#endif
|
|
|
|
/// Current GLX Z value.
|
|
|
|
int z;
|
|
|
|
/// FBConfig-s for GLX pixmap of different depths.
|
|
|
|
glx_fbconfig_t *fbconfigs[OPENGL_MAX_DEPTH + 1];
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-07-28 12:50:15 +08:00
|
|
|
glx_blur_pass_t blur_passes[MAX_BLUR_PASS];
|
|
|
|
#endif
|
|
|
|
} glx_session_t;
|
|
|
|
|
|
|
|
#define CGLX_SESSION_INIT { .context = NULL }
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Structure containing all necessary data for a compton session.
|
2018-08-22 20:26:42 +08:00
|
|
|
typedef struct session {
|
2018-11-27 08:32:08 +08:00
|
|
|
// === Event handlers ===
|
2018-10-03 03:22:26 +08:00
|
|
|
/// ev_io for X connection
|
|
|
|
ev_io xiow;
|
2018-11-27 08:32:08 +08:00
|
|
|
/// Timeout for delayed unredirection.
|
|
|
|
ev_timer unredir_timer;
|
|
|
|
/// Timer for fading
|
|
|
|
ev_timer fade_timer;
|
|
|
|
/// Timer for delayed drawing, right now only used by
|
|
|
|
/// swopti
|
|
|
|
ev_timer delayed_draw_timer;
|
|
|
|
/// Use an ev_idle callback for drawing
|
|
|
|
/// So we only start drawing when events are processed
|
|
|
|
ev_idle draw_idle;
|
|
|
|
/// Called everytime we have timeouts or new data on socket,
|
|
|
|
/// so we can be sure if xcb read from X socket at anytime during event
|
|
|
|
/// handling, we will not left any event unhandled in the queue
|
|
|
|
ev_prepare event_check;
|
|
|
|
/// Signal handler for SIGUSR1
|
|
|
|
ev_signal usr1_signal;
|
2018-10-03 03:22:26 +08:00
|
|
|
/// libev mainloop
|
|
|
|
struct ev_loop *loop;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Display related ===
|
|
|
|
/// Display in use.
|
|
|
|
Display *dpy;
|
|
|
|
/// Default screen.
|
|
|
|
int scr;
|
2018-10-03 21:27:48 +08:00
|
|
|
/// XCB connection.
|
|
|
|
xcb_connection_t *c;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Default visual.
|
2018-09-24 02:10:46 +08:00
|
|
|
xcb_visualid_t vis;
|
|
|
|
/// Pict formats info
|
|
|
|
xcb_render_query_pict_formats_reply_t *pictfmts;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Default depth.
|
|
|
|
int depth;
|
|
|
|
/// Root window.
|
|
|
|
Window root;
|
|
|
|
/// Height of root window.
|
|
|
|
int root_height;
|
|
|
|
/// Width of root window.
|
|
|
|
int root_width;
|
|
|
|
// Damage of root window.
|
|
|
|
// Damage root_damage;
|
|
|
|
/// X Composite overlay window. Used if <code>--paint-on-overlay</code>.
|
|
|
|
Window overlay;
|
2013-03-15 23:16:23 +08:00
|
|
|
/// Whether the root tile is filled by compton.
|
|
|
|
bool root_tile_fill;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Picture of the root window background.
|
2013-03-15 23:16:23 +08:00
|
|
|
paint_t root_tile_paint;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// A region of the size of the screen.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
region_t screen_reg;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Picture of root window. Destination of painting in no-DBE painting
|
|
|
|
/// mode.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_picture_t root_picture;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// A Picture acting as the painting target.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_picture_t tgt_picture;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Temporary buffer to paint to before sending to display.
|
2013-12-10 22:06:02 +08:00
|
|
|
paint_t tgt_buffer;
|
2018-11-08 22:53:13 +08:00
|
|
|
XSyncFence tgt_buffer_fence;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Window ID of the window we register as a symbol.
|
|
|
|
Window reg_win;
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-07-28 12:50:15 +08:00
|
|
|
/// Pointer to GLX data.
|
|
|
|
glx_session_t *psglx;
|
|
|
|
#endif
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Operation related ===
|
|
|
|
/// Program options.
|
|
|
|
options_t o;
|
2013-09-04 22:00:51 +08:00
|
|
|
/// Whether we have hit unredirection timeout.
|
|
|
|
bool tmout_unredir_hit;
|
2018-10-03 03:22:26 +08:00
|
|
|
/// Whether we need to redraw the screen
|
|
|
|
bool redraw_needed;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether the program is idling. I.e. no fading, no potential window
|
|
|
|
/// changes.
|
2018-10-03 03:22:26 +08:00
|
|
|
bool fade_running;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Program start time.
|
|
|
|
struct timeval time_start;
|
|
|
|
/// The region needs to painted on next paint.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
region_t all_damage;
|
2013-04-21 22:30:22 +08:00
|
|
|
/// The region damaged on the last paint.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
region_t all_damage_last[CGLX_MAX_BUFFER_AGE];
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether all windows are currently redirected.
|
|
|
|
bool redirected;
|
|
|
|
/// Pre-generated alpha pictures.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_picture_t *alpha_picts;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Time of last fading. In milliseconds.
|
|
|
|
time_ms_t fade_time;
|
|
|
|
/// Head pointer of the error ignore linked list.
|
|
|
|
ignore_t *ignore_head;
|
|
|
|
/// Pointer to the <code>next</code> member of tail element of the error
|
|
|
|
/// ignore linked list.
|
|
|
|
ignore_t **ignore_tail;
|
2013-05-20 18:04:40 +08:00
|
|
|
// Cached blur convolution kernels.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_fixed_t *blur_kerns_cache[MAX_BLUR_PASS];
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Reset program after next paint.
|
|
|
|
bool reset;
|
2018-10-03 03:22:26 +08:00
|
|
|
/// If compton should quit
|
|
|
|
bool quit;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Expose event related ===
|
|
|
|
/// Pointer to an array of <code>XRectangle</code>-s of exposed region.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
/// XXX why do we need this array?
|
|
|
|
rect_t *expose_rects;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Number of <code>XRectangle</code>-s in <code>expose_rects</code>.
|
|
|
|
int size_expose;
|
|
|
|
/// Index of the next free slot in <code>expose_rects</code>.
|
|
|
|
int n_expose;
|
|
|
|
|
|
|
|
// === Window related ===
|
|
|
|
/// Linked list of all windows.
|
2018-08-22 20:26:42 +08:00
|
|
|
win *list;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Pointer to <code>win</code> of current active window. Used by
|
|
|
|
/// EWMH <code>_NET_ACTIVE_WINDOW</code> focus detection. In theory,
|
|
|
|
/// it's more reliable to store the window ID directly here, just in
|
|
|
|
/// case the WM does something extraordinary, but caching the pointer
|
|
|
|
/// means another layer of complexity.
|
2018-08-22 20:26:42 +08:00
|
|
|
win *active_win;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Window ID of leader window of currently active window. Used for
|
|
|
|
/// subsidiary window detection.
|
|
|
|
Window active_leader;
|
|
|
|
|
|
|
|
// === Shadow/dimming related ===
|
|
|
|
/// 1x1 black Picture.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_picture_t black_picture;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// 1x1 Picture of the shadow color.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_picture_t cshadow_picture;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// 1x1 white Picture.
|
2018-09-28 00:14:44 +08:00
|
|
|
xcb_render_picture_t white_picture;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Gaussian map of shadow.
|
|
|
|
conv *gaussian_map;
|
|
|
|
// for shadow precomputation
|
|
|
|
/// Shadow depth on one side.
|
|
|
|
int cgsize;
|
|
|
|
/// Pre-computed color table for corners of shadow.
|
|
|
|
unsigned char *shadow_corner;
|
|
|
|
/// Pre-computed color table for a side of shadow.
|
|
|
|
unsigned char *shadow_top;
|
2013-06-09 17:06:35 +08:00
|
|
|
/// A region in which shadow is not painted on.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
region_t shadow_exclude_reg;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === Software-optimization-related ===
|
|
|
|
/// Currently used refresh rate.
|
|
|
|
short refresh_rate;
|
|
|
|
/// Interval between refresh in nanoseconds.
|
|
|
|
long refresh_intv;
|
|
|
|
/// Nanosecond offset of the first painting.
|
|
|
|
long paint_tm_offset;
|
|
|
|
|
2013-01-24 13:38:03 +08:00
|
|
|
#ifdef CONFIG_VSYNC_DRM
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === DRM VSync related ===
|
|
|
|
/// File descriptor of DRI device file. Used for DRM VSync.
|
|
|
|
int drm_fd;
|
2013-01-24 13:38:03 +08:00
|
|
|
#endif
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
// === X extension related ===
|
|
|
|
/// Event base number for X Fixes extension.
|
|
|
|
int xfixes_event;
|
|
|
|
/// Error base number for X Fixes extension.
|
|
|
|
int xfixes_error;
|
|
|
|
/// Event base number for X Damage extension.
|
|
|
|
int damage_event;
|
|
|
|
/// Error base number for X Damage extension.
|
|
|
|
int damage_error;
|
|
|
|
/// Event base number for X Render extension.
|
|
|
|
int render_event;
|
|
|
|
/// Error base number for X Render extension.
|
|
|
|
int render_error;
|
|
|
|
/// Event base number for X Composite extension.
|
|
|
|
int composite_event;
|
|
|
|
/// Error base number for X Composite extension.
|
|
|
|
int composite_error;
|
|
|
|
/// Major opcode for X Composite extension.
|
|
|
|
int composite_opcode;
|
|
|
|
/// Whether X Composite NameWindowPixmap is available. Aka if X
|
|
|
|
/// Composite version >= 0.2.
|
|
|
|
bool has_name_pixmap;
|
|
|
|
/// Whether X Shape extension exists.
|
|
|
|
bool shape_exists;
|
|
|
|
/// Event base number for X Shape extension.
|
|
|
|
int shape_event;
|
|
|
|
/// Error base number for X Shape extension.
|
|
|
|
int shape_error;
|
|
|
|
/// Whether X RandR extension exists.
|
|
|
|
bool randr_exists;
|
|
|
|
/// Event base number for X RandR extension.
|
|
|
|
int randr_event;
|
|
|
|
/// Error base number for X RandR extension.
|
|
|
|
int randr_error;
|
2018-11-04 06:15:38 +08:00
|
|
|
/// Whether X Present extension exists.
|
|
|
|
bool present_exists;
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether X GLX extension exists.
|
|
|
|
bool glx_exists;
|
|
|
|
/// Event base number for X GLX extension.
|
|
|
|
int glx_event;
|
|
|
|
/// Error base number for X GLX extension.
|
|
|
|
int glx_error;
|
2013-01-24 13:38:03 +08:00
|
|
|
#endif
|
2013-08-22 21:15:04 +08:00
|
|
|
#ifdef CONFIG_XINERAMA
|
|
|
|
/// Whether X Xinerama extension exists.
|
|
|
|
bool xinerama_exists;
|
|
|
|
/// Xinerama screen info.
|
2018-09-29 17:46:29 +08:00
|
|
|
xcb_xinerama_query_screens_reply_t *xinerama_scrs;
|
2013-08-22 21:15:04 +08:00
|
|
|
/// Xinerama screen regions.
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
region_t *xinerama_scr_regs;
|
2013-08-22 21:15:04 +08:00
|
|
|
/// Number of Xinerama screens.
|
|
|
|
int xinerama_nscrs;
|
|
|
|
#endif
|
2018-11-08 22:53:13 +08:00
|
|
|
/// Whether X Sync extension exists.
|
|
|
|
bool xsync_exists;
|
|
|
|
/// Event base number for X Sync extension.
|
|
|
|
int xsync_event;
|
|
|
|
/// Error base number for X Sync extension.
|
|
|
|
int xsync_error;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/// Whether X Render convolution filter exists.
|
|
|
|
bool xrfilter_convolution_exists;
|
|
|
|
|
|
|
|
// === Atoms ===
|
|
|
|
/// Atom of property <code>_NET_WM_OPACITY</code>.
|
|
|
|
Atom atom_opacity;
|
|
|
|
/// Atom of <code>_NET_FRAME_EXTENTS</code>.
|
|
|
|
Atom atom_frame_extents;
|
|
|
|
/// Property atom to identify top-level frame window. Currently
|
|
|
|
/// <code>WM_STATE</code>.
|
|
|
|
Atom atom_client;
|
|
|
|
/// Atom of property <code>WM_NAME</code>.
|
|
|
|
Atom atom_name;
|
|
|
|
/// Atom of property <code>_NET_WM_NAME</code>.
|
|
|
|
Atom atom_name_ewmh;
|
|
|
|
/// Atom of property <code>WM_CLASS</code>.
|
|
|
|
Atom atom_class;
|
|
|
|
/// Atom of property <code>WM_WINDOW_ROLE</code>.
|
|
|
|
Atom atom_role;
|
|
|
|
/// Atom of property <code>WM_TRANSIENT_FOR</code>.
|
|
|
|
Atom atom_transient;
|
|
|
|
/// Atom of property <code>WM_CLIENT_LEADER</code>.
|
|
|
|
Atom atom_client_leader;
|
|
|
|
/// Atom of property <code>_NET_ACTIVE_WINDOW</code>.
|
|
|
|
Atom atom_ewmh_active_win;
|
|
|
|
/// Atom of property <code>_COMPTON_SHADOW</code>.
|
|
|
|
Atom atom_compton_shadow;
|
|
|
|
/// Atom of property <code>_NET_WM_WINDOW_TYPE</code>.
|
|
|
|
Atom atom_win_type;
|
|
|
|
/// Array of atoms of all possible window types.
|
|
|
|
Atom atoms_wintypes[NUM_WINTYPES];
|
|
|
|
/// Linked list of additional atoms to track.
|
|
|
|
latom_t *track_atom_lst;
|
|
|
|
|
|
|
|
#ifdef CONFIG_DBUS
|
|
|
|
// === DBus related ===
|
|
|
|
// DBus connection.
|
|
|
|
DBusConnection *dbus_conn;
|
|
|
|
// DBus service name.
|
|
|
|
char *dbus_service;
|
|
|
|
#endif
|
|
|
|
} session_t;
|
|
|
|
|
|
|
|
/// Temporary structure used for communication between
|
|
|
|
/// <code>get_cfg()</code> and <code>parse_config()</code>.
|
|
|
|
struct options_tmp {
|
|
|
|
bool no_dock_shadow;
|
|
|
|
bool no_dnd_shadow;
|
|
|
|
double menu_opacity;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Enumeration for window event hints.
|
|
|
|
typedef enum {
|
|
|
|
WIN_EVMODE_UNKNOWN,
|
|
|
|
WIN_EVMODE_FRAME,
|
|
|
|
WIN_EVMODE_CLIENT
|
|
|
|
} win_evmode_t;
|
|
|
|
|
2013-01-24 13:38:03 +08:00
|
|
|
extern const char * const WINTYPES[NUM_WINTYPES];
|
2013-04-21 22:30:22 +08:00
|
|
|
extern const char * const VSYNC_STRS[NUM_VSYNC + 1];
|
|
|
|
extern const char * const BACKEND_STRS[NUM_BKEND + 1];
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
extern session_t *ps_g;
|
|
|
|
|
|
|
|
// == Debugging code ==
|
|
|
|
static inline void
|
|
|
|
print_timestamp(session_t *ps);
|
|
|
|
|
2018-09-30 15:31:22 +08:00
|
|
|
void
|
|
|
|
ev_xcb_error(session_t *ps, xcb_generic_error_t *err);
|
|
|
|
|
2014-04-19 19:41:26 +08:00
|
|
|
#ifdef DEBUG_BACKTRACE
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
#include <execinfo.h>
|
2014-04-19 19:41:26 +08:00
|
|
|
#define BACKTRACE_SIZE 25
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
|
|
|
/**
|
2014-04-19 19:41:26 +08:00
|
|
|
* Print current backtrace.
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
*
|
|
|
|
* Stolen from glibc manual.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
print_backtrace(void) {
|
|
|
|
void *array[BACKTRACE_SIZE];
|
|
|
|
size_t size;
|
|
|
|
char **strings;
|
|
|
|
|
|
|
|
size = backtrace(array, BACKTRACE_SIZE);
|
|
|
|
strings = backtrace_symbols(array, size);
|
|
|
|
|
2014-04-19 19:41:26 +08:00
|
|
|
for (size_t i = 0; i < size; i++)
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
printf ("%s\n", strings[i]);
|
|
|
|
|
|
|
|
free(strings);
|
|
|
|
}
|
|
|
|
|
2014-04-19 19:41:26 +08:00
|
|
|
#endif
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
// === Functions ===
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return whether a struct timeval value is empty.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
timeval_isempty(struct timeval *ptv) {
|
|
|
|
if (!ptv)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return ptv->tv_sec <= 0 && ptv->tv_usec <= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare a struct timeval with a time in milliseconds.
|
|
|
|
*
|
|
|
|
* @return > 0 if ptv > ms, 0 if ptv == 0, -1 if ptv < ms
|
|
|
|
*/
|
|
|
|
static inline int
|
|
|
|
timeval_ms_cmp(struct timeval *ptv, time_ms_t ms) {
|
|
|
|
assert(ptv);
|
|
|
|
|
|
|
|
// We use those if statement instead of a - expression because of possible
|
|
|
|
// truncation problem from long to int.
|
|
|
|
{
|
|
|
|
long sec = ms / MS_PER_SEC;
|
|
|
|
if (ptv->tv_sec > sec)
|
|
|
|
return 1;
|
|
|
|
if (ptv->tv_sec < sec)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
long usec = ms % MS_PER_SEC * (US_PER_SEC / MS_PER_SEC);
|
|
|
|
if (ptv->tv_usec > usec)
|
|
|
|
return 1;
|
|
|
|
if (ptv->tv_usec < usec)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subtracting two struct timeval values.
|
|
|
|
*
|
|
|
|
* Taken from glibc manual.
|
|
|
|
*
|
|
|
|
* Subtract the `struct timeval' values X and Y,
|
|
|
|
* storing the result in RESULT.
|
|
|
|
* Return 1 if the difference is negative, otherwise 0.
|
|
|
|
*/
|
|
|
|
static inline int
|
|
|
|
timeval_subtract(struct timeval *result,
|
|
|
|
struct timeval *x,
|
|
|
|
struct timeval *y) {
|
|
|
|
/* Perform the carry for the later subtraction by updating y. */
|
|
|
|
if (x->tv_usec < y->tv_usec) {
|
|
|
|
long nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
|
|
|
y->tv_usec -= 1000000 * nsec;
|
|
|
|
y->tv_sec += nsec;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x->tv_usec - y->tv_usec > 1000000) {
|
|
|
|
long nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
|
|
|
y->tv_usec += 1000000 * nsec;
|
|
|
|
y->tv_sec -= nsec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the time remaining to wait.
|
|
|
|
tv_usec is certainly positive. */
|
|
|
|
result->tv_sec = x->tv_sec - y->tv_sec;
|
|
|
|
result->tv_usec = x->tv_usec - y->tv_usec;
|
|
|
|
|
|
|
|
/* Return 1 if result is negative. */
|
|
|
|
return x->tv_sec < y->tv_sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subtracting two struct timespec values.
|
|
|
|
*
|
|
|
|
* Taken from glibc manual.
|
|
|
|
*
|
|
|
|
* Subtract the `struct timespec' values X and Y,
|
|
|
|
* storing the result in RESULT.
|
|
|
|
* Return 1 if the difference is negative, otherwise 0.
|
|
|
|
*/
|
|
|
|
static inline int
|
|
|
|
timespec_subtract(struct timespec *result,
|
|
|
|
struct timespec *x,
|
|
|
|
struct timespec *y) {
|
|
|
|
/* Perform the carry for the later subtraction by updating y. */
|
|
|
|
if (x->tv_nsec < y->tv_nsec) {
|
|
|
|
long nsec = (y->tv_nsec - x->tv_nsec) / NS_PER_SEC + 1;
|
|
|
|
y->tv_nsec -= NS_PER_SEC * nsec;
|
|
|
|
y->tv_sec += nsec;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x->tv_nsec - y->tv_nsec > NS_PER_SEC) {
|
|
|
|
long nsec = (x->tv_nsec - y->tv_nsec) / NS_PER_SEC;
|
|
|
|
y->tv_nsec += NS_PER_SEC * nsec;
|
|
|
|
y->tv_sec -= nsec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the time remaining to wait.
|
|
|
|
tv_nsec is certainly positive. */
|
|
|
|
result->tv_sec = x->tv_sec - y->tv_sec;
|
|
|
|
result->tv_nsec = x->tv_nsec - y->tv_nsec;
|
|
|
|
|
|
|
|
/* Return 1 if result is negative. */
|
|
|
|
return x->tv_sec < y->tv_sec;
|
|
|
|
}
|
|
|
|
|
2018-09-07 02:17:26 +08:00
|
|
|
static inline double
|
|
|
|
get_opacity_percent(win *w) {
|
|
|
|
return ((double) w->opacity) / OPAQUE;
|
|
|
|
}
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/**
|
|
|
|
* Get current time in struct timeval.
|
|
|
|
*/
|
2015-09-06 22:32:52 +08:00
|
|
|
static inline struct timeval
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
get_time_timeval(void) {
|
|
|
|
struct timeval tv = { 0, 0 };
|
|
|
|
|
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
|
|
|
|
// Return a time of all 0 if the call fails
|
|
|
|
return tv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get current time in struct timespec.
|
|
|
|
*
|
|
|
|
* Note its starting time is unspecified.
|
|
|
|
*/
|
2015-09-06 22:32:52 +08:00
|
|
|
static inline struct timespec
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
get_time_timespec(void) {
|
|
|
|
struct timespec tm = { 0, 0 };
|
|
|
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &tm);
|
|
|
|
|
|
|
|
// Return a time of all 0 if the call fails
|
|
|
|
return tm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print time passed since program starts execution.
|
|
|
|
*
|
|
|
|
* Used for debugging.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
print_timestamp(session_t *ps) {
|
|
|
|
struct timeval tm, diff;
|
|
|
|
|
|
|
|
if (gettimeofday(&tm, NULL)) return;
|
|
|
|
|
|
|
|
timeval_subtract(&diff, &tm, &ps->time_start);
|
2018-10-03 03:22:26 +08:00
|
|
|
fprintf(stderr, "[ %5ld.%06ld ] ", diff.tv_sec, diff.tv_usec);
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
}
|
|
|
|
|
2013-01-31 22:53:44 +08:00
|
|
|
/**
|
|
|
|
* Parse a VSync option argument.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
parse_vsync(session_t *ps, const char *str) {
|
2013-04-21 22:30:22 +08:00
|
|
|
for (vsync_t i = 0; VSYNC_STRS[i]; ++i)
|
2013-01-31 22:53:44 +08:00
|
|
|
if (!strcasecmp(str, VSYNC_STRS[i])) {
|
|
|
|
ps->o.vsync = i;
|
|
|
|
return true;
|
|
|
|
}
|
2013-04-21 22:30:22 +08:00
|
|
|
|
2013-01-31 22:53:44 +08:00
|
|
|
printf_errf("(\"%s\"): Invalid vsync argument.", str);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-16 22:54:43 +08:00
|
|
|
/**
|
|
|
|
* Parse a backend option argument.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
parse_backend(session_t *ps, const char *str) {
|
2013-04-21 22:30:22 +08:00
|
|
|
for (enum backend i = 0; BACKEND_STRS[i]; ++i)
|
2013-03-16 22:54:43 +08:00
|
|
|
if (!strcasecmp(str, BACKEND_STRS[i])) {
|
|
|
|
ps->o.backend = i;
|
|
|
|
return true;
|
|
|
|
}
|
2013-12-24 07:46:48 +08:00
|
|
|
// Keep compatibility with an old revision containing a spelling mistake...
|
|
|
|
if (!strcasecmp(str, "xr_glx_hybird")) {
|
|
|
|
ps->o.backend = BKEND_XR_GLX_HYBRID;
|
|
|
|
return true;
|
|
|
|
}
|
2014-03-11 07:22:23 +08:00
|
|
|
// cju wants to use dashes
|
|
|
|
if (!strcasecmp(str, "xr-glx-hybrid")) {
|
|
|
|
ps->o.backend = BKEND_XR_GLX_HYBRID;
|
|
|
|
return true;
|
|
|
|
}
|
2013-03-16 22:54:43 +08:00
|
|
|
printf_errf("(\"%s\"): Invalid backend argument.", str);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-21 22:30:22 +08:00
|
|
|
/**
|
|
|
|
* Parse a glx_swap_method option argument.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
parse_glx_swap_method(session_t *ps, const char *str) {
|
2013-04-26 14:01:20 +08:00
|
|
|
// Parse alias
|
|
|
|
if (!strcmp("undefined", str)) {
|
|
|
|
ps->o.glx_swap_method = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp("copy", str)) {
|
|
|
|
ps->o.glx_swap_method = 1;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp("exchange", str)) {
|
|
|
|
ps->o.glx_swap_method = 2;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp("buffer-age", str)) {
|
|
|
|
ps->o.glx_swap_method = -1;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse number
|
|
|
|
{
|
|
|
|
char *pc = NULL;
|
|
|
|
int age = strtol(str, &pc, 0);
|
|
|
|
if (!pc || str == pc) {
|
|
|
|
printf_errf("(\"%s\"): Invalid number.", str);
|
|
|
|
return false;
|
2013-04-21 22:30:22 +08:00
|
|
|
}
|
2013-04-26 14:01:20 +08:00
|
|
|
|
|
|
|
for (; *pc; ++pc)
|
|
|
|
if (!isspace(*pc)) {
|
|
|
|
printf_errf("(\"%s\"): Trailing characters.", str);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (age > CGLX_MAX_BUFFER_AGE + 1 || age < -1) {
|
|
|
|
printf_errf("(\"%s\"): Number too large / too small.", str);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ps->o.glx_swap_method = age;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2013-04-21 22:30:22 +08:00
|
|
|
}
|
|
|
|
|
2013-04-05 21:05:19 +08:00
|
|
|
/**
|
|
|
|
* Wrapper of XFree() for convenience.
|
|
|
|
*
|
|
|
|
* Because a NULL pointer cannot be passed to XFree(), its man page says.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
cxfree(void *data) {
|
|
|
|
if (data)
|
|
|
|
XFree(data);
|
|
|
|
}
|
|
|
|
|
2018-10-15 07:38:21 +08:00
|
|
|
_Noreturn static inline void
|
2018-10-03 20:38:59 +08:00
|
|
|
die(const char *msg) {
|
|
|
|
puts(msg);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2013-01-24 13:38:03 +08:00
|
|
|
/**
|
|
|
|
* Wrapper of XInternAtom() for convenience.
|
|
|
|
*/
|
2018-10-03 20:38:59 +08:00
|
|
|
static inline xcb_atom_t
|
2013-01-24 13:38:03 +08:00
|
|
|
get_atom(session_t *ps, const char *atom_name) {
|
2018-10-03 20:38:59 +08:00
|
|
|
xcb_intern_atom_reply_t *reply =
|
2018-10-03 21:27:48 +08:00
|
|
|
xcb_intern_atom_reply(ps->c,
|
|
|
|
xcb_intern_atom(ps->c, False, strlen(atom_name), atom_name),
|
2018-10-03 20:38:59 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
xcb_atom_t atom = XCB_NONE;
|
|
|
|
if (reply) {
|
|
|
|
atom = reply->atom;
|
|
|
|
free(reply);
|
|
|
|
} else
|
|
|
|
die("Failed to intern atoms, bail out");
|
|
|
|
return atom;
|
2013-01-24 13:38:03 +08:00
|
|
|
}
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
/**
|
|
|
|
* Return the painting target window.
|
|
|
|
*/
|
|
|
|
static inline Window
|
|
|
|
get_tgt_window(session_t *ps) {
|
2018-11-03 22:04:18 +08:00
|
|
|
return ps->overlay != XCB_NONE ? ps->overlay: ps->root;
|
2013-03-15 23:16:23 +08:00
|
|
|
}
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/**
|
|
|
|
* Find a window from window id in window linked list of the session.
|
|
|
|
*/
|
|
|
|
static inline win *
|
|
|
|
find_win(session_t *ps, Window id) {
|
|
|
|
if (!id)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
win *w;
|
|
|
|
|
|
|
|
for (w = ps->list; w; w = w->next) {
|
|
|
|
if (w->id == id && !w->destroyed)
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find out the WM frame of a client window using existing data.
|
|
|
|
*
|
|
|
|
* @param id window ID
|
2018-08-22 20:26:42 +08:00
|
|
|
* @return struct win object of the found window, NULL if not found
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
*/
|
|
|
|
static inline win *
|
|
|
|
find_toplevel(session_t *ps, Window id) {
|
|
|
|
if (!id)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (win *w = ps->list; w; w = w->next) {
|
|
|
|
if (w->client_win == id && !w->destroyed)
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-12-10 22:06:02 +08:00
|
|
|
/**
|
|
|
|
* Check if current backend uses GLX.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
bkend_use_glx(session_t *ps) {
|
|
|
|
return BKEND_GLX == ps->o.backend
|
2013-12-24 07:46:48 +08:00
|
|
|
|| BKEND_XR_GLX_HYBRID == ps->o.backend;
|
2013-12-10 22:06:02 +08:00
|
|
|
}
|
|
|
|
|
2014-07-28 12:50:15 +08:00
|
|
|
/**
|
|
|
|
* Check if there's a GLX context.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
glx_has_context(session_t *ps) {
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-07-28 12:50:15 +08:00
|
|
|
return ps->psglx && ps->psglx->context;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-09-18 21:50:57 +08:00
|
|
|
/**
|
|
|
|
* Check if a window is really focused.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
win_is_focused_real(session_t *ps, const win *w) {
|
2018-11-05 02:54:04 +08:00
|
|
|
return w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->active_win == w;
|
2013-09-18 21:50:57 +08:00
|
|
|
}
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
/**
|
|
|
|
* Find out the currently focused window.
|
|
|
|
*
|
2018-08-22 20:26:42 +08:00
|
|
|
* @return struct win object of the found window, NULL if not found
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
*/
|
|
|
|
static inline win *
|
|
|
|
find_focused(session_t *ps) {
|
2013-09-18 21:50:57 +08:00
|
|
|
if (!ps->o.track_focus) return NULL;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
|
2013-09-18 21:50:57 +08:00
|
|
|
if (ps->active_win && win_is_focused_real(ps, ps->active_win))
|
|
|
|
return ps->active_win;
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-03-11 07:22:23 +08:00
|
|
|
/**
|
|
|
|
* Free all regions in ps->all_damage_last .
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
free_all_damage_last(session_t *ps) {
|
|
|
|
for (int i = 0; i < CGLX_MAX_BUFFER_AGE; ++i)
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
pixman_region32_clear(&ps->all_damage_last[i]);
|
2014-03-11 07:22:23 +08:00
|
|
|
}
|
|
|
|
|
2018-11-08 22:53:13 +08:00
|
|
|
/**
|
|
|
|
* Free a XSync fence.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
free_fence(session_t *ps, XSyncFence *pfence) {
|
|
|
|
if (*pfence)
|
|
|
|
XSyncDestroyFence(ps->dpy, *pfence);
|
|
|
|
*pfence = None;
|
|
|
|
}
|
|
|
|
|
2013-03-21 13:05:56 +08:00
|
|
|
/**
|
|
|
|
* Check if a rectangle includes the whole screen.
|
|
|
|
*/
|
|
|
|
static inline bool
|
2018-10-13 06:15:41 +08:00
|
|
|
rect_is_fullscreen(session_t *ps, int x, int y, int wid, int hei) {
|
2018-08-22 21:25:40 +08:00
|
|
|
return (x <= 0 && y <= 0 &&
|
2018-10-13 06:15:41 +08:00
|
|
|
(x + wid) >= ps->root_width &&
|
|
|
|
(y + hei) >= ps->root_height);
|
2013-03-21 13:05:56 +08:00
|
|
|
}
|
|
|
|
|
2018-09-07 02:17:26 +08:00
|
|
|
static void
|
|
|
|
set_ignore(session_t *ps, unsigned long sequence) {
|
|
|
|
if (ps->o.show_all_xerrors)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ignore_t *i = malloc(sizeof(ignore_t));
|
|
|
|
if (!i) return;
|
|
|
|
|
|
|
|
i->sequence = sequence;
|
|
|
|
i->next = 0;
|
|
|
|
*ps->ignore_tail = i;
|
|
|
|
ps->ignore_tail = &i->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ignore X errors caused by next X request.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
set_ignore_next(session_t *ps) {
|
|
|
|
set_ignore(ps, NextRequest(ps->dpy));
|
|
|
|
}
|
|
|
|
|
2018-09-29 17:18:09 +08:00
|
|
|
/**
|
|
|
|
* Ignore X errors caused by given X request.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
set_ignore_cookie(session_t *ps, xcb_void_cookie_t cookie) {
|
|
|
|
set_ignore(ps, cookie.sequence);
|
|
|
|
}
|
|
|
|
|
2013-06-19 19:36:48 +08:00
|
|
|
/**
|
|
|
|
* Check if a window is a fullscreen window.
|
|
|
|
*
|
|
|
|
* It's not using w->border_size for performance measures.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
win_is_fullscreen(session_t *ps, const win *w) {
|
2018-09-24 02:10:46 +08:00
|
|
|
return rect_is_fullscreen(ps, w->g.x, w->g.y, w->widthb, w->heightb)
|
2014-04-21 22:45:27 +08:00
|
|
|
&& (!w->bounding_shaped || w->rounded_corners);
|
2013-06-19 19:36:48 +08:00
|
|
|
}
|
|
|
|
|
2014-05-16 15:18:17 +08:00
|
|
|
/**
|
|
|
|
* Check if a window will be painted solid.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
win_is_solid(session_t *ps, const win *w) {
|
|
|
|
return WMODE_SOLID == w->mode && !ps->o.force_win_blend;
|
|
|
|
}
|
|
|
|
|
2013-01-24 13:38:03 +08:00
|
|
|
/**
|
|
|
|
* Determine if a window has a specific property.
|
|
|
|
*
|
|
|
|
* @param ps current session
|
|
|
|
* @param w window to check
|
|
|
|
* @param atom atom of property to check
|
|
|
|
* @return 1 if it has the attribute, 0 otherwise
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
wid_has_prop(const session_t *ps, Window w, Atom atom) {
|
|
|
|
Atom type = None;
|
|
|
|
int format;
|
|
|
|
unsigned long nitems, after;
|
|
|
|
unsigned char *data;
|
|
|
|
|
|
|
|
if (Success == XGetWindowProperty(ps->dpy, w, atom, 0, 0, False,
|
|
|
|
AnyPropertyType, &type, &format, &nitems, &after, &data)) {
|
2013-04-05 21:05:19 +08:00
|
|
|
cxfree(data);
|
2013-01-24 13:38:03 +08:00
|
|
|
if (type) return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the numeric property value from a win_prop_t.
|
|
|
|
*/
|
|
|
|
static inline long
|
|
|
|
winprop_get_int(winprop_t prop) {
|
|
|
|
long tgt = 0;
|
|
|
|
|
|
|
|
if (!prop.nitems)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (prop.format) {
|
2018-11-01 19:12:20 +08:00
|
|
|
case 8: tgt = *(prop.p8); break;
|
|
|
|
case 16: tgt = *(prop.p16); break;
|
|
|
|
case 32: tgt = *(prop.p32); break;
|
2013-01-24 13:38:03 +08:00
|
|
|
default: assert(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return tgt;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
wid_get_text_prop(session_t *ps, Window wid, Atom prop,
|
|
|
|
char ***pstrlst, int *pnstr);
|
|
|
|
|
|
|
|
void
|
|
|
|
force_repaint(session_t *ps);
|
|
|
|
|
2013-01-31 22:53:44 +08:00
|
|
|
bool
|
|
|
|
vsync_init(session_t *ps);
|
|
|
|
|
2013-05-20 18:04:40 +08:00
|
|
|
void
|
|
|
|
vsync_deinit(session_t *ps);
|
|
|
|
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2013-03-15 23:16:23 +08:00
|
|
|
/** @name GLX
|
|
|
|
*/
|
|
|
|
///@{
|
|
|
|
|
2013-05-20 18:04:40 +08:00
|
|
|
/**
|
|
|
|
* Free a GLX texture.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
free_texture_r(session_t *ps, GLuint *ptexture) {
|
|
|
|
if (*ptexture) {
|
2014-07-28 12:50:15 +08:00
|
|
|
assert(glx_has_context(ps));
|
2013-05-20 18:04:40 +08:00
|
|
|
glDeleteTextures(1, ptexture);
|
|
|
|
*ptexture = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free a GLX Framebuffer object.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
free_glx_fbo(session_t *ps, GLuint *pfbo) {
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2013-05-20 18:04:40 +08:00
|
|
|
if (*pfbo) {
|
|
|
|
glDeleteFramebuffers(1, pfbo);
|
|
|
|
*pfbo = 0;
|
|
|
|
}
|
2013-03-15 23:16:23 +08:00
|
|
|
#endif
|
2013-05-20 18:04:40 +08:00
|
|
|
assert(!*pfbo);
|
|
|
|
}
|
|
|
|
|
2018-08-22 22:12:29 +08:00
|
|
|
#ifdef CONFIG_OPENGL
|
2013-05-20 18:04:40 +08:00
|
|
|
/**
|
|
|
|
* Free data in glx_blur_cache_t on resize.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
free_glx_bc_resize(session_t *ps, glx_blur_cache_t *pbc) {
|
|
|
|
free_texture_r(ps, &pbc->textures[0]);
|
|
|
|
free_texture_r(ps, &pbc->textures[1]);
|
|
|
|
pbc->width = 0;
|
|
|
|
pbc->height = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free a glx_blur_cache_t
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
free_glx_bc(session_t *ps, glx_blur_cache_t *pbc) {
|
|
|
|
free_glx_fbo(ps, &pbc->fbo);
|
|
|
|
free_glx_bc_resize(ps, pbc);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-05-12 18:21:16 +08:00
|
|
|
/**
|
|
|
|
* Add a OpenGL debugging marker.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
glx_mark_(session_t *ps, const char *func, XID xid, bool start) {
|
|
|
|
#ifdef DEBUG_GLX_MARK
|
2014-07-28 12:50:15 +08:00
|
|
|
if (glx_has_context(ps) && ps->psglx->glStringMarkerGREMEDY) {
|
2013-05-12 18:21:16 +08:00
|
|
|
if (!func) func = "(unknown)";
|
|
|
|
const char *postfix = (start ? " (start)": " (end)");
|
|
|
|
char *str = malloc((strlen(func) + 12 + 2
|
|
|
|
+ strlen(postfix) + 5) * sizeof(char));
|
|
|
|
strcpy(str, func);
|
|
|
|
sprintf(str + strlen(str), "(%#010lx)%s", xid, postfix);
|
2014-07-28 12:50:15 +08:00
|
|
|
ps->psglx->glStringMarkerGREMEDY(strlen(str), str);
|
2013-05-12 18:21:16 +08:00
|
|
|
free(str);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#define glx_mark(ps, xid, start) glx_mark_(ps, __func__, xid, start)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a OpenGL debugging marker.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
glx_mark_frame(session_t *ps) {
|
|
|
|
#ifdef DEBUG_GLX_MARK
|
2014-07-28 12:50:15 +08:00
|
|
|
if (glx_has_context(ps) && ps->psglx->glFrameTerminatorGREMEDY)
|
|
|
|
ps->psglx->glFrameTerminatorGREMEDY();
|
2013-05-12 18:21:16 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
///@}
|
|
|
|
|
2018-11-08 22:53:13 +08:00
|
|
|
/**
|
|
|
|
* Synchronizes a X Render drawable to ensure all pending painting requests
|
|
|
|
* are completed.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
xr_sync(session_t *ps, Drawable d, XSyncFence *pfence) {
|
|
|
|
if (!ps->o.xrender_sync)
|
|
|
|
return;
|
|
|
|
|
|
|
|
x_sync(ps->c);
|
|
|
|
if (ps->o.xrender_sync_fence && ps->xsync_exists) {
|
|
|
|
// TODO: If everybody just follows the rules stated in X Sync prototype,
|
|
|
|
// we need only one fence per screen, but let's stay a bit cautious right
|
|
|
|
// now
|
|
|
|
XSyncFence tmp_fence = None;
|
|
|
|
if (!pfence)
|
|
|
|
pfence = &tmp_fence;
|
|
|
|
assert(pfence);
|
|
|
|
if (!*pfence)
|
|
|
|
*pfence = XSyncCreateFence(ps->dpy, d, False);
|
|
|
|
if (*pfence) {
|
|
|
|
Bool __attribute__((unused)) triggered = False;
|
|
|
|
/* if (XSyncQueryFence(ps->dpy, *pfence, &triggered) && triggered)
|
|
|
|
XSyncResetFence(ps->dpy, *pfence); */
|
|
|
|
// The fence may fail to be created (e.g. because of died drawable)
|
|
|
|
assert(!XSyncQueryFence(ps->dpy, *pfence, &triggered) || !triggered);
|
|
|
|
XSyncTriggerFence(ps->dpy, *pfence);
|
|
|
|
XSyncAwaitFence(ps->dpy, pfence, 1);
|
|
|
|
assert(!XSyncQueryFence(ps->dpy, *pfence, &triggered) || triggered);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf_errf("(%#010lx): Failed to create X Sync fence.", d);
|
|
|
|
}
|
|
|
|
free_fence(ps, &tmp_fence);
|
|
|
|
if (*pfence)
|
|
|
|
XSyncResetFence(ps->dpy, *pfence);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-15 23:16:23 +08:00
|
|
|
/** @name DBus handling
|
|
|
|
*/
|
|
|
|
///@{
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
#ifdef CONFIG_DBUS
|
|
|
|
/** @name DBus handling
|
|
|
|
*/
|
|
|
|
///@{
|
|
|
|
bool
|
|
|
|
cdbus_init(session_t *ps);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_destroy(session_t *ps);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_loop(session_t *ps);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_ev_win_added(session_t *ps, win *w);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_ev_win_destroyed(session_t *ps, win *w);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_ev_win_mapped(session_t *ps, win *w);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_ev_win_unmapped(session_t *ps, win *w);
|
2013-03-30 11:46:32 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_ev_win_focusout(session_t *ps, win *w);
|
|
|
|
|
|
|
|
void
|
|
|
|
cdbus_ev_win_focusin(session_t *ps, win *w);
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
//!@}
|
|
|
|
|
|
|
|
/** @name DBus hooks
|
|
|
|
*/
|
|
|
|
///@{
|
|
|
|
void
|
|
|
|
win_set_shadow_force(session_t *ps, win *w, switch_t val);
|
|
|
|
|
2013-05-20 18:04:40 +08:00
|
|
|
void
|
|
|
|
win_set_fade_force(session_t *ps, win *w, switch_t val);
|
|
|
|
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
void
|
|
|
|
win_set_focused_force(session_t *ps, win *w, switch_t val);
|
|
|
|
|
|
|
|
void
|
|
|
|
win_set_invert_color_force(session_t *ps, win *w, switch_t val);
|
2013-03-10 18:45:54 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
opts_init_track_focus(session_t *ps);
|
2013-05-20 18:04:40 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
opts_set_no_fading_openclose(session_t *ps, bool newval);
|
Feature #80: D-Bus support
- Add D-Bus support. Currently 7 methods are available: "reset" (same as
SIGUSR1), "list_win" (list the windows compton manages), "win_get"
(get a property of the window), "win_set" (set a property of the
window), "find_win" (find window based on client window / focus),
"opts_get" (get the value of a compton option), and "opts_set" (set
the value of a compton option), together with 4 signals: "win_added",
"win_destroyed", "win_mapped", "win_unmapped".
- D-Bus support depends on libdbus.
- As there are many items and my time is tight, no much tests are done.
Bugs to be expected.
- Create a new header file `common.h` that contains shared content.
- Fix some bugs in timeout handling.
- Update file headers in all source files.
- Re-enable --unredir-if-possible on multi-screen set-ups, as the user
could turn if off manually anyway.
- Check if the window is mapped in `repair_win()`.
- Add ps->track_atom_lst and its handlers, to prepare for the new
condition format.
- Known issue 1: "win_get", "win_set", "opts_get", "opts_set" support a
very limited number of targets only. New ones will be added gradually.
- Known issue 2: Accidental drop of D-Bus connection is not handled.
- Known issue 3: Introspection does not reveal all available methods,
because some methods have unpredictable prototypes. Still hesitating
about what to do...
- Known issue 4: Error handling is not finished yet. Compton does not
always reply with the correct error message (but it does print out the
correct error message, usually).
2013-01-19 20:20:27 +08:00
|
|
|
//!@}
|
|
|
|
#endif
|
2013-01-24 13:38:03 +08:00
|
|
|
|
2014-09-07 18:58:09 +08:00
|
|
|
/**
|
|
|
|
* @brief Dump the given data to a file.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
write_binary_data(const char *path, const unsigned char *data, int length) {
|
|
|
|
if (!data)
|
|
|
|
return false;
|
|
|
|
FILE *f = fopen(path, "wb");
|
|
|
|
if (!f) {
|
|
|
|
printf_errf("(\"%s\"): Failed to open file for writing.", path);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int wrote_len = fwrite(data, sizeof(unsigned char), length, f);
|
|
|
|
fclose(f);
|
|
|
|
if (wrote_len != length) {
|
|
|
|
printf_errf("(\"%s\"): Failed to write all blocks: %d / %d", path,
|
|
|
|
wrote_len, length);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-03-18 11:48:28 +08:00
|
|
|
/**
|
|
|
|
* @brief Dump raw bytes in HEX format.
|
|
|
|
*
|
|
|
|
* @param data pointer to raw data
|
|
|
|
* @param len length of data
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
hexdump(const char *data, int len) {
|
|
|
|
static const int BYTE_PER_LN = 16;
|
|
|
|
|
|
|
|
if (len <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Print header
|
|
|
|
printf("%10s:", "Offset");
|
|
|
|
for (int i = 0; i < BYTE_PER_LN; ++i)
|
|
|
|
printf(" %2d", i);
|
|
|
|
putchar('\n');
|
|
|
|
|
|
|
|
// Dump content
|
|
|
|
for (int offset = 0; offset < len; ++offset) {
|
|
|
|
if (!(offset % BYTE_PER_LN))
|
|
|
|
printf("0x%08x:", offset);
|
|
|
|
|
|
|
|
printf(" %02hhx", data[offset]);
|
|
|
|
|
|
|
|
if ((BYTE_PER_LN - 1) == offset % BYTE_PER_LN)
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
if (len % BYTE_PER_LN)
|
|
|
|
putchar('\n');
|
|
|
|
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
2018-08-22 19:58:49 +08:00
|
|
|
/**
|
|
|
|
* Set a <code>bool</code> array of all wintypes to true.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
wintype_arr_enable(bool arr[]) {
|
|
|
|
wintype_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_WINTYPES; ++i) {
|
|
|
|
arr[i] = true;
|
|
|
|
}
|
|
|
|
}
|