2018-10-03 17:14:51 -04: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 07:20:27 -05:00
|
|
|
/*
|
|
|
|
* Compton - a compositor for X11
|
|
|
|
*
|
|
|
|
* Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011-2013, Christopher Jeffrey
|
2018-10-03 17:14:51 -04:00
|
|
|
* Copyright (c) 2018, Yuxuan Shui <yshuiv7@gmail.com>
|
|
|
|
*
|
2018-10-03 17:24:12 -04: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 07:20:27 -05:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-08-22 07:58:49 -04:00
|
|
|
#pragma once
|
2013-01-24 00:38:03 -05: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 07:20:27 -05:00
|
|
|
// === Options ===
|
|
|
|
|
|
|
|
// Debug options, enable them using -D in CFLAGS
|
|
|
|
// #define DEBUG_REPAINT 1
|
|
|
|
// #define DEBUG_EVENTS 1
|
|
|
|
// #define DEBUG_RESTACK 1
|
|
|
|
// #define DEBUG_WINMATCH 1
|
2013-01-24 00:38:03 -05:00
|
|
|
// #define DEBUG_C2 1
|
2019-02-02 17:19:15 -05:00
|
|
|
// #define DEBUG_GLX_DEBUG_CONTEXT 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 07:20:27 -05:00
|
|
|
|
2018-11-10 07:48:36 -05: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 07:20:27 -05:00
|
|
|
// === Includes ===
|
|
|
|
|
|
|
|
// For some special functions
|
2019-03-10 08:34:37 -04:00
|
|
|
#include <assert.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <inttypes.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 07:20:27 -05:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/time.h>
|
2019-03-10 08:34:37 -04:00
|
|
|
#include <time.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 07:20:27 -05:00
|
|
|
|
2018-12-30 03:00:22 -05:00
|
|
|
#include <X11/Xlib.h>
|
2019-03-10 08:34:37 -04:00
|
|
|
#include <ev.h>
|
|
|
|
#include <pixman.h>
|
2018-09-28 12:38:33 -04:00
|
|
|
#include <xcb/composite.h>
|
2018-09-27 11:29:51 -04:00
|
|
|
#include <xcb/damage.h>
|
2018-09-27 11:38:24 -04:00
|
|
|
#include <xcb/randr.h>
|
2019-03-10 08:34:37 -04:00
|
|
|
#include <xcb/render.h>
|
2018-09-29 05:29:51 -04:00
|
|
|
#include <xcb/shape.h>
|
2018-12-30 02:41:31 -05:00
|
|
|
#include <xcb/sync.h>
|
2018-09-29 05:46:29 -04:00
|
|
|
#include <xcb/xinerama.h>
|
|
|
|
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2015-01-10 21:47:19 -05:00
|
|
|
// libGL
|
2019-02-08 19:36:14 -05:00
|
|
|
#include "backend/gl/glx.h"
|
2013-04-02 22:51:37 -04: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 02:01:20 -04:00
|
|
|
#ifndef GLX_BACK_BUFFER_AGE_EXT
|
|
|
|
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
|
|
|
|
#endif
|
|
|
|
|
2015-01-10 21:47:19 -05: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 07:20:27 -05:00
|
|
|
// === Macros ===
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
#define MSTR_(s) #s
|
|
|
|
#define MSTR(s) MSTR_(s)
|
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 07:20:27 -05:00
|
|
|
|
2014-08-03 07:40:40 -04:00
|
|
|
// X resource checker
|
|
|
|
#ifdef DEBUG_XRC
|
|
|
|
#include "xrescheck.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-20 22:10:12 -04:00
|
|
|
// FIXME This list of includes should get shorter
|
2019-03-10 08:34:37 -04:00
|
|
|
#include "backend/backend.h"
|
|
|
|
#include "compiler.h"
|
2019-01-18 18:30:44 -05:00
|
|
|
#include "config.h"
|
2019-03-10 08:34:37 -04:00
|
|
|
#include "kernel.h"
|
2019-01-20 11:53:39 -05:00
|
|
|
#include "log.h"
|
2019-03-10 08:34:37 -04:00
|
|
|
#include "region.h"
|
|
|
|
#include "render.h"
|
|
|
|
#include "types.h"
|
2019-01-20 11:53:39 -05:00
|
|
|
#include "utils.h"
|
2019-03-10 08:34:37 -04:00
|
|
|
#include "win.h"
|
2019-01-20 11:53:39 -05:00
|
|
|
#include "x.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-29 23:56:00 -04: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 07:20:27 -05:00
|
|
|
// === Constants ===
|
|
|
|
|
2013-03-15 11:16:23 -04: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 07:20:27 -05:00
|
|
|
#define ROUNDED_PERCENT 0.05
|
2019-03-10 08:34:37 -04:00
|
|
|
#define ROUNDED_PIXELS 10
|
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 07:20:27 -05:00
|
|
|
|
|
|
|
#define REGISTER_PROP "_NET_WM_CM_S"
|
|
|
|
|
|
|
|
#define TIME_MS_MAX LONG_MAX
|
|
|
|
#define SWOPTI_TOLERANCE 3000
|
|
|
|
#define WIN_GET_LEADER_MAX_RECURSION 20
|
|
|
|
|
|
|
|
#define NS_PER_SEC 1000000000L
|
|
|
|
#define US_PER_SEC 1000000L
|
|
|
|
#define MS_PER_SEC 1000
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
#define XRFILTER_CONVOLUTION "convolution"
|
|
|
|
#define XRFILTER_GAUSSIAN "gaussian"
|
|
|
|
#define XRFILTER_BINOMIAL "binomial"
|
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 07:20:27 -05:00
|
|
|
|
2013-03-15 11:16:23 -04:00
|
|
|
/// @brief Maximum OpenGL FBConfig depth.
|
|
|
|
#define OPENGL_MAX_DEPTH 32
|
|
|
|
|
2013-04-26 02:01:20 -04:00
|
|
|
/// @brief Maximum OpenGL buffer age.
|
|
|
|
#define CGLX_MAX_BUFFER_AGE 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 07:20:27 -05:00
|
|
|
// Window flags
|
|
|
|
|
|
|
|
// === Types ===
|
2018-12-30 19:38:13 -05:00
|
|
|
typedef struct glx_fbconfig glx_fbconfig_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 07:20:27 -05:00
|
|
|
|
|
|
|
/// Structure representing needed window updates.
|
|
|
|
typedef struct {
|
2019-03-10 08:34:37 -04:00
|
|
|
bool shadow : 1;
|
|
|
|
bool fade : 1;
|
|
|
|
bool focus : 1;
|
|
|
|
bool invert_color : 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 07:20:27 -05:00
|
|
|
} win_upd_t;
|
|
|
|
|
|
|
|
typedef struct _ignore {
|
2019-03-10 08:34:37 -04:00
|
|
|
struct _ignore *next;
|
|
|
|
unsigned long sequence;
|
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 07:20:27 -05:00
|
|
|
} ignore_t;
|
|
|
|
|
|
|
|
enum wincond_target {
|
2019-03-10 08:34:37 -04:00
|
|
|
CONDTGT_NAME,
|
|
|
|
CONDTGT_CLASSI,
|
|
|
|
CONDTGT_CLASSG,
|
|
|
|
CONDTGT_ROLE,
|
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 07:20:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
enum wincond_type {
|
2019-03-10 08:34:37 -04:00
|
|
|
CONDTP_EXACT,
|
|
|
|
CONDTP_ANYWHERE,
|
|
|
|
CONDTP_FROMSTART,
|
|
|
|
CONDTP_WILDCARD,
|
|
|
|
CONDTP_REGEX_PCRE,
|
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 07:20:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#define CONDF_IGNORECASE 0x0001
|
|
|
|
|
2013-04-21 10:30:22 -04:00
|
|
|
/// @brief Possible swap methods.
|
2019-03-10 08:34:37 -04:00
|
|
|
enum { SWAPM_BUFFER_AGE = -1,
|
|
|
|
SWAPM_UNDEFINED = 0,
|
|
|
|
SWAPM_COPY = 1,
|
|
|
|
SWAPM_EXCHANGE = 2,
|
2013-04-21 10:30:22 -04:00
|
|
|
};
|
|
|
|
|
2013-03-15 11:16:23 -04:00
|
|
|
typedef struct _glx_texture glx_texture_t;
|
|
|
|
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-03-17 11:25:34 -04:00
|
|
|
#ifdef DEBUG_GLX_DEBUG_CONTEXT
|
2019-03-10 08:34:37 -04:00
|
|
|
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);
|
2014-03-17 11:25:34 -04:00
|
|
|
#endif
|
|
|
|
|
2018-11-08 09:53:13 -05:00
|
|
|
#ifdef CONFIG_OPENGL
|
2019-03-10 08:34:37 -04:00
|
|
|
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);
|
2014-03-17 11:25:34 -04:00
|
|
|
#endif
|
|
|
|
|
2013-03-15 11:16:23 -04:00
|
|
|
/// @brief Wrapper of a binded GLX texture.
|
|
|
|
struct _glx_texture {
|
2019-03-10 08:34:37 -04:00
|
|
|
GLuint texture;
|
|
|
|
GLXPixmap glpixmap;
|
|
|
|
xcb_pixmap_t pixmap;
|
|
|
|
GLenum target;
|
2019-03-30 05:07:21 -04:00
|
|
|
int width;
|
|
|
|
int height;
|
2019-03-10 08:34:37 -04:00
|
|
|
bool y_inverted;
|
2013-02-28 23:41:16 -05: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 07:20:27 -05:00
|
|
|
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2013-05-20 06:04:40 -04:00
|
|
|
typedef struct {
|
2019-03-10 08:34:37 -04:00
|
|
|
/// 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;
|
2013-05-20 06:04:40 -04:00
|
|
|
} glx_blur_pass_t;
|
|
|
|
|
2018-12-15 16:11:41 -05:00
|
|
|
typedef struct glx_prog_main {
|
2019-03-10 08:34:37 -04:00
|
|
|
/// 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;
|
2014-05-16 03:18:17 -04:00
|
|
|
} glx_prog_main_t;
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
#define GLX_PROG_MAIN_INIT \
|
|
|
|
{ .prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, .unifm_tex = -1, }
|
2014-05-16 03:18:17 -04:00
|
|
|
|
2014-07-28 00:50:15 -04:00
|
|
|
#endif
|
2018-09-29 17:47:12 -04:00
|
|
|
#else
|
2019-03-10 08:34:37 -04:00
|
|
|
struct glx_prog_main {};
|
2013-05-20 06:04:40 -04:00
|
|
|
#endif
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
#define PAINT_INIT \
|
|
|
|
{ .pixmap = XCB_NONE, .pict = XCB_NONE }
|
2013-03-15 11:16:23 -04: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 07:20:27 -05:00
|
|
|
/// Linked list type of atoms.
|
|
|
|
typedef struct _latom {
|
2019-03-10 08:34:37 -04:00
|
|
|
xcb_atom_t atom;
|
|
|
|
struct _latom *next;
|
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 07:20:27 -05:00
|
|
|
} latom_t;
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
#define REG_DATA_INIT \
|
|
|
|
{ NULL, 0 }
|
2013-04-06 08:21:38 -04:00
|
|
|
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2014-07-28 00:50:15 -04:00
|
|
|
/// Structure containing GLX-dependent data for a compton session.
|
|
|
|
typedef struct {
|
2019-03-10 08:34:37 -04:00
|
|
|
// === 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 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;
|
|
|
|
/// Current GLX Z value.
|
|
|
|
int z;
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2019-03-10 08:34:37 -04:00
|
|
|
glx_blur_pass_t blur_passes[MAX_BLUR_PASS];
|
2014-07-28 00:50:15 -04:00
|
|
|
#endif
|
|
|
|
} glx_session_t;
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
#define CGLX_SESSION_INIT \
|
|
|
|
{ .context = NULL }
|
2014-07-28 00:50:15 -04: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 07:20:27 -05:00
|
|
|
/// Structure containing all necessary data for a compton session.
|
2018-08-22 08:26:42 -04:00
|
|
|
typedef struct session {
|
2019-03-10 08:34:37 -04:00
|
|
|
// === Event handlers ===
|
|
|
|
/// ev_io for X connection
|
|
|
|
ev_io xiow;
|
|
|
|
/// 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;
|
|
|
|
/// Signal handler for SIGINT
|
|
|
|
ev_signal int_signal;
|
|
|
|
/// backend data
|
|
|
|
backend_t *backend_data;
|
|
|
|
/// libev mainloop
|
|
|
|
struct ev_loop *loop;
|
|
|
|
|
|
|
|
// === Display related ===
|
|
|
|
/// Display in use.
|
|
|
|
Display *dpy;
|
|
|
|
/// Default screen.
|
|
|
|
int scr;
|
|
|
|
/// XCB connection.
|
|
|
|
xcb_connection_t *c;
|
|
|
|
/// Default visual.
|
|
|
|
xcb_visualid_t vis;
|
|
|
|
/// Default depth.
|
|
|
|
int depth;
|
|
|
|
/// Root window.
|
|
|
|
xcb_window_t 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>.
|
|
|
|
xcb_window_t overlay;
|
|
|
|
/// Whether the root tile is filled by compton.
|
|
|
|
bool root_tile_fill;
|
|
|
|
/// Picture of the root window background.
|
|
|
|
paint_t root_tile_paint;
|
|
|
|
/// The backend data the root pixmap bound to
|
|
|
|
void *root_image;
|
|
|
|
/// A region of the size of the screen.
|
|
|
|
region_t screen_reg;
|
|
|
|
/// Picture of root window. Destination of painting in no-DBE painting
|
|
|
|
/// mode.
|
|
|
|
xcb_render_picture_t root_picture;
|
|
|
|
/// A Picture acting as the painting target.
|
|
|
|
xcb_render_picture_t tgt_picture;
|
|
|
|
/// Temporary buffer to paint to before sending to display.
|
|
|
|
paint_t tgt_buffer;
|
|
|
|
/// Window ID of the window we register as a symbol.
|
|
|
|
xcb_window_t reg_win;
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2019-03-10 08:34:37 -04:00
|
|
|
/// Pointer to GLX data.
|
|
|
|
glx_session_t *psglx;
|
|
|
|
/// Custom GLX program used for painting window.
|
|
|
|
// XXX should be in glx_session_t
|
|
|
|
glx_prog_main_t glx_prog_win;
|
2014-07-28 00:50:15 -04:00
|
|
|
#endif
|
2019-03-10 08:34:37 -04:00
|
|
|
/// Sync fence to sync draw operations
|
|
|
|
xcb_sync_fence_t sync_fence;
|
|
|
|
|
|
|
|
// === Operation related ===
|
2019-03-17 11:17:48 -04:00
|
|
|
/// Flags related to the root window
|
|
|
|
uint64_t root_flags;
|
2019-03-10 08:34:37 -04:00
|
|
|
/// Program options.
|
|
|
|
options_t o;
|
|
|
|
/// Whether we have hit unredirection timeout.
|
|
|
|
bool tmout_unredir_hit;
|
|
|
|
/// Whether we need to redraw the screen
|
|
|
|
bool redraw_needed;
|
|
|
|
/// Program start time.
|
|
|
|
struct timeval time_start;
|
|
|
|
/// The region needs to painted on next paint.
|
|
|
|
region_t *damage;
|
|
|
|
/// The region damaged on the last paint.
|
|
|
|
region_t *damage_ring;
|
|
|
|
/// Number of damage regions we track
|
|
|
|
int ndamage;
|
|
|
|
/// Whether all windows are currently redirected.
|
|
|
|
bool redirected;
|
|
|
|
/// Pre-generated alpha pictures.
|
|
|
|
xcb_render_picture_t *alpha_picts;
|
|
|
|
/// Time of last fading. In milliseconds.
|
2019-03-30 05:07:21 -04:00
|
|
|
long fade_time;
|
2019-03-10 08:34:37 -04:00
|
|
|
/// 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;
|
|
|
|
// Cached blur convolution kernels.
|
|
|
|
xcb_render_fixed_t *blur_kerns_cache[MAX_BLUR_PASS];
|
|
|
|
/// Reset program after next paint.
|
|
|
|
bool reset;
|
|
|
|
/// If compton should quit
|
|
|
|
bool quit;
|
|
|
|
|
|
|
|
// === Expose event related ===
|
|
|
|
/// Pointer to an array of <code>XRectangle</code>-s of exposed region.
|
|
|
|
/// XXX why do we need this array?
|
|
|
|
rect_t *expose_rects;
|
|
|
|
/// 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.
|
|
|
|
win *list;
|
|
|
|
/// 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.
|
|
|
|
win *active_win;
|
|
|
|
/// Window ID of leader window of currently active window. Used for
|
|
|
|
/// subsidiary window detection.
|
|
|
|
xcb_window_t active_leader;
|
|
|
|
|
|
|
|
// === Shadow/dimming related ===
|
|
|
|
/// 1x1 black Picture.
|
|
|
|
xcb_render_picture_t black_picture;
|
|
|
|
/// 1x1 Picture of the shadow color.
|
|
|
|
xcb_render_picture_t cshadow_picture;
|
|
|
|
/// 1x1 white Picture.
|
|
|
|
xcb_render_picture_t white_picture;
|
|
|
|
/// Gaussian map of shadow.
|
|
|
|
conv *gaussian_map;
|
|
|
|
// for shadow precomputation
|
|
|
|
/// A region in which shadow is not painted on.
|
|
|
|
region_t shadow_exclude_reg;
|
|
|
|
|
|
|
|
// === Software-optimization-related ===
|
|
|
|
/// Currently used refresh rate.
|
2019-03-30 05:07:21 -04:00
|
|
|
int refresh_rate;
|
2019-03-10 08:34:37 -04:00
|
|
|
/// Interval between refresh in nanoseconds.
|
|
|
|
long refresh_intv;
|
|
|
|
/// Nanosecond offset of the first painting.
|
|
|
|
long paint_tm_offset;
|
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 07:20:27 -05:00
|
|
|
|
2013-01-24 00:38:03 -05:00
|
|
|
#ifdef CONFIG_VSYNC_DRM
|
2019-03-10 08:34:37 -04:00
|
|
|
// === DRM VSync related ===
|
|
|
|
/// File descriptor of DRI device file. Used for DRM VSync.
|
|
|
|
int drm_fd;
|
2013-01-24 00:38:03 -05: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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04: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 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;
|
|
|
|
/// Whether X Present extension exists.
|
|
|
|
bool present_exists;
|
2018-08-22 10:12:29 -04:00
|
|
|
#ifdef CONFIG_OPENGL
|
2019-03-10 08:34:37 -04: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 00:38:03 -05:00
|
|
|
#endif
|
2019-03-10 08:34:37 -04:00
|
|
|
/// Whether X Xinerama extension exists.
|
|
|
|
bool xinerama_exists;
|
|
|
|
/// Xinerama screen info.
|
|
|
|
xcb_xinerama_query_screens_reply_t *xinerama_scrs;
|
|
|
|
/// Xinerama screen regions.
|
|
|
|
region_t *xinerama_scr_regs;
|
|
|
|
/// Number of Xinerama screens.
|
|
|
|
int xinerama_nscrs;
|
|
|
|
/// 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;
|
|
|
|
/// Whether X Render convolution filter exists.
|
|
|
|
bool xrfilter_convolution_exists;
|
|
|
|
|
|
|
|
// === Atoms ===
|
|
|
|
/// Atom of property <code>_NET_WM_OPACITY</code>.
|
|
|
|
xcb_atom_t atom_opacity;
|
|
|
|
/// Atom of <code>_NET_FRAME_EXTENTS</code>.
|
|
|
|
xcb_atom_t atom_frame_extents;
|
|
|
|
/// Property atom to identify top-level frame window. Currently
|
|
|
|
/// <code>WM_STATE</code>.
|
|
|
|
xcb_atom_t atom_client;
|
|
|
|
/// Atom of property <code>WM_NAME</code>.
|
|
|
|
xcb_atom_t atom_name;
|
|
|
|
/// Atom of property <code>_NET_WM_NAME</code>.
|
|
|
|
xcb_atom_t atom_name_ewmh;
|
|
|
|
/// Atom of property <code>WM_CLASS</code>.
|
|
|
|
xcb_atom_t atom_class;
|
|
|
|
/// Atom of property <code>WM_WINDOW_ROLE</code>.
|
|
|
|
xcb_atom_t atom_role;
|
|
|
|
/// Atom of property <code>WM_TRANSIENT_FOR</code>.
|
|
|
|
xcb_atom_t atom_transient;
|
|
|
|
/// Atom of property <code>WM_CLIENT_LEADER</code>.
|
|
|
|
xcb_atom_t atom_client_leader;
|
|
|
|
/// Atom of property <code>_NET_ACTIVE_WINDOW</code>.
|
|
|
|
xcb_atom_t atom_ewmh_active_win;
|
|
|
|
/// Atom of property <code>_COMPTON_SHADOW</code>.
|
|
|
|
xcb_atom_t atom_compton_shadow;
|
|
|
|
/// Atom of property <code>_NET_WM_WINDOW_TYPE</code>.
|
|
|
|
xcb_atom_t atom_win_type;
|
|
|
|
/// Array of atoms of all possible window types.
|
|
|
|
xcb_atom_t atoms_wintypes[NUM_WINTYPES];
|
|
|
|
/// Linked list of additional atoms to track.
|
|
|
|
latom_t *track_atom_lst;
|
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 07:20:27 -05:00
|
|
|
|
|
|
|
#ifdef CONFIG_DBUS
|
2019-03-10 08:34:37 -04:00
|
|
|
// === DBus related ===
|
|
|
|
void *dbus_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 07:20:27 -05:00
|
|
|
#endif
|
2019-03-10 10:55:17 -04:00
|
|
|
|
|
|
|
int (*vsync_wait)(session_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 07:20:27 -05:00
|
|
|
} session_t;
|
|
|
|
|
|
|
|
/// Temporary structure used for communication between
|
|
|
|
/// <code>get_cfg()</code> and <code>parse_config()</code>.
|
|
|
|
struct options_tmp {
|
2019-03-10 08:34:37 -04:00
|
|
|
bool no_dock_shadow;
|
|
|
|
bool no_dnd_shadow;
|
|
|
|
double menu_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 07:20:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Enumeration for window event hints.
|
2019-03-10 08:34:37 -04:00
|
|
|
typedef enum { WIN_EVMODE_UNKNOWN, WIN_EVMODE_FRAME, WIN_EVMODE_CLIENT } win_evmode_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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
extern const char *const WINTYPES[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 07:20:27 -05:00
|
|
|
extern session_t *ps_g;
|
|
|
|
|
|
|
|
// == Debugging code ==
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline void print_timestamp(session_t *ps);
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void ev_xcb_error(session_t *ps, xcb_generic_error_t *err);
|
2018-09-30 03:31:22 -04: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 07:20:27 -05:00
|
|
|
// === Functions ===
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return whether a struct timeval value is empty.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool timeval_isempty(struct timeval *ptv) {
|
|
|
|
if (!ptv)
|
|
|
|
return false;
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
return ptv->tv_sec <= 0 && ptv->tv_usec <= 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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare a struct timeval with a time in milliseconds.
|
|
|
|
*
|
|
|
|
* @return > 0 if ptv > ms, 0 if ptv == 0, -1 if ptv < ms
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline int timeval_ms_cmp(struct timeval *ptv, unsigned long ms) {
|
|
|
|
assert(ptv);
|
|
|
|
|
|
|
|
// We use those if statement instead of a - expression because of possible
|
|
|
|
// truncation problem from long to int.
|
2019-03-30 05:07:21 -04:00
|
|
|
auto sec = (long)(ms / MS_PER_SEC);
|
|
|
|
if (ptv->tv_sec > sec) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (ptv->tv_sec < sec) {
|
|
|
|
return -1;
|
2019-03-10 08:34:37 -04:00
|
|
|
}
|
|
|
|
|
2019-03-30 05:07:21 -04:00
|
|
|
auto usec = (long)(ms % MS_PER_SEC * (US_PER_SEC / MS_PER_SEC));
|
|
|
|
if (ptv->tv_usec > usec) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (ptv->tv_usec < usec) {
|
|
|
|
return -1;
|
2019-03-10 08:34:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2019-03-10 08:34:37 -04:00
|
|
|
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;
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2019-03-10 08:34:37 -04:00
|
|
|
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;
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get current time in struct timeval.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline struct timeval get_time_timeval(void) {
|
|
|
|
struct timeval tv = {0, 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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
gettimeofday(&tv, 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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
// Return a time of all 0 if the call fails
|
|
|
|
return tv;
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get current time in struct timespec.
|
|
|
|
*
|
|
|
|
* Note its starting time is unspecified.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline struct timespec get_time_timespec(void) {
|
|
|
|
struct timespec tm = {0, 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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
clock_gettime(CLOCK_MONOTONIC, &tm);
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
// Return a time of all 0 if the call fails
|
|
|
|
return tm;
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print time passed since program starts execution.
|
|
|
|
*
|
|
|
|
* Used for debugging.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline void print_timestamp(session_t *ps) {
|
|
|
|
struct timeval tm, diff;
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
if (gettimeofday(&tm, NULL))
|
|
|
|
return;
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
timeval_subtract(&diff, &tm, &ps->time_start);
|
|
|
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
2013-04-05 09:05:19 -04:00
|
|
|
/**
|
|
|
|
* Wrapper of XFree() for convenience.
|
|
|
|
*
|
|
|
|
* Because a NULL pointer cannot be passed to XFree(), its man page says.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline void cxfree(void *data) {
|
|
|
|
if (data)
|
|
|
|
XFree(data);
|
2013-04-05 09:05:19 -04:00
|
|
|
}
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
_Noreturn static inline void die(const char *msg) {
|
|
|
|
puts(msg);
|
|
|
|
exit(1);
|
2018-10-03 08:38:59 -04:00
|
|
|
}
|
|
|
|
|
2013-01-24 00:38:03 -05:00
|
|
|
/**
|
|
|
|
* Wrapper of XInternAtom() for convenience.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline xcb_atom_t get_atom(session_t *ps, const char *atom_name) {
|
|
|
|
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(
|
2019-03-30 05:07:21 -04:00
|
|
|
ps->c,
|
|
|
|
xcb_intern_atom(ps->c, 0, to_u16_checked(strlen(atom_name)), atom_name), NULL);
|
2019-03-10 08:34:37 -04:00
|
|
|
|
|
|
|
xcb_atom_t atom = XCB_NONE;
|
|
|
|
if (reply) {
|
|
|
|
log_debug("Atom %s is %d", atom_name, reply->atom);
|
|
|
|
atom = reply->atom;
|
|
|
|
free(reply);
|
|
|
|
} else
|
|
|
|
die("Failed to intern atoms, bail out");
|
|
|
|
return atom;
|
2013-01-24 00:38:03 -05:00
|
|
|
}
|
|
|
|
|
2013-03-15 11:16:23 -04:00
|
|
|
/**
|
|
|
|
* Return the painting target window.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline xcb_window_t get_tgt_window(session_t *ps) {
|
|
|
|
return ps->overlay != XCB_NONE ? ps->overlay : ps->root;
|
2013-03-15 11:16:23 -04: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 07:20:27 -05:00
|
|
|
/**
|
|
|
|
* Find a window from window id in window linked list of the session.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline win *find_win(session_t *ps, xcb_window_t id) {
|
|
|
|
if (!id)
|
|
|
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
for (w = ps->list; w; w = w->next) {
|
|
|
|
if (w->id == id && w->state != WSTATE_DESTROYING) {
|
|
|
|
return 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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
return 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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find out the WM frame of a client window using existing data.
|
|
|
|
*
|
|
|
|
* @param id window ID
|
2018-08-22 08:26:42 -04: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 07:20:27 -05:00
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline win *find_toplevel(session_t *ps, xcb_window_t id) {
|
|
|
|
if (!id)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (win *w = ps->list; w; w = w->next) {
|
|
|
|
if (w->client_win == id && w->state != WSTATE_DESTROYING) {
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
2013-12-10 09:06:02 -05:00
|
|
|
/**
|
|
|
|
* Check if current backend uses GLX.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool bkend_use_glx(session_t *ps) {
|
|
|
|
return BKEND_GLX == ps->o.backend || BKEND_XR_GLX_HYBRID == ps->o.backend;
|
2013-12-10 09:06:02 -05:00
|
|
|
}
|
|
|
|
|
2013-09-18 09:50:57 -04:00
|
|
|
/**
|
|
|
|
* Check if a window is really focused.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool win_is_focused_real(session_t *ps, const win *w) {
|
|
|
|
return w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->active_win == w;
|
2013-09-18 09:50:57 -04: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 07:20:27 -05:00
|
|
|
/**
|
|
|
|
* Find out the currently focused window.
|
|
|
|
*
|
2018-08-22 08:26:42 -04: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 07:20:27 -05:00
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline win *find_focused(session_t *ps) {
|
|
|
|
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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
if (ps->active_win && win_is_focused_real(ps, ps->active_win))
|
|
|
|
return ps->active_win;
|
|
|
|
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 07:20:27 -05:00
|
|
|
}
|
|
|
|
|
2013-03-21 01:05:56 -04:00
|
|
|
/**
|
|
|
|
* Check if a rectangle includes the whole screen.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool rect_is_fullscreen(session_t *ps, int x, int y, int wid, int hei) {
|
|
|
|
return (x <= 0 && y <= 0 && (x + wid) >= ps->root_width && (y + hei) >= ps->root_height);
|
2013-03-21 01:05:56 -04:00
|
|
|
}
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
static void set_ignore(session_t *ps, unsigned long sequence) {
|
|
|
|
if (ps->o.show_all_xerrors)
|
|
|
|
return;
|
2018-09-06 14:17:26 -04:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
auto i = cmalloc(ignore_t);
|
|
|
|
if (!i)
|
|
|
|
return;
|
2018-09-06 14:17:26 -04:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
i->sequence = sequence;
|
|
|
|
i->next = 0;
|
|
|
|
*ps->ignore_tail = i;
|
|
|
|
ps->ignore_tail = &i->next;
|
2018-09-06 14:17:26 -04:00
|
|
|
}
|
|
|
|
|
2018-09-29 05:18:09 -04:00
|
|
|
/**
|
|
|
|
* Ignore X errors caused by given X request.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline void set_ignore_cookie(session_t *ps, xcb_void_cookie_t cookie) {
|
|
|
|
set_ignore(ps, cookie.sequence);
|
2018-09-29 05:18:09 -04:00
|
|
|
}
|
|
|
|
|
2013-06-19 07:36:48 -04:00
|
|
|
/**
|
|
|
|
* Check if a window is a fullscreen window.
|
|
|
|
*
|
|
|
|
* It's not using w->border_size for performance measures.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool win_is_fullscreen(session_t *ps, const win *w) {
|
|
|
|
return rect_is_fullscreen(ps, w->g.x, w->g.y, w->widthb, w->heightb) &&
|
|
|
|
(!w->bounding_shaped || w->rounded_corners);
|
2013-06-19 07:36:48 -04:00
|
|
|
}
|
|
|
|
|
2014-05-16 03:18:17 -04:00
|
|
|
/**
|
|
|
|
* Check if a window will be painted solid.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool win_is_solid(session_t *ps, const win *w) {
|
|
|
|
return WMODE_SOLID == w->mode && !ps->o.force_win_blend;
|
2014-05-16 03:18:17 -04:00
|
|
|
}
|
|
|
|
|
2013-01-24 00:38:03 -05: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
|
2018-12-27 15:45:38 -05:00
|
|
|
* @return true if it has the attribute, false otherwise
|
2013-01-24 00:38:03 -05:00
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline bool wid_has_prop(const session_t *ps, xcb_window_t w, xcb_atom_t atom) {
|
|
|
|
auto r = xcb_get_property_reply(
|
|
|
|
ps->c, xcb_get_property(ps->c, 0, w, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, 0), NULL);
|
|
|
|
if (!r) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto rtype = r->type;
|
|
|
|
free(r);
|
|
|
|
|
|
|
|
if (rtype != XCB_NONE) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2013-01-24 00:38:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the numeric property value from a win_prop_t.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline long winprop_get_int(winprop_t prop) {
|
|
|
|
long tgt = 0;
|
|
|
|
|
|
|
|
if (!prop.nitems)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (prop.format) {
|
|
|
|
case 8: tgt = *(prop.p8); break;
|
|
|
|
case 16: tgt = *(prop.p16); break;
|
|
|
|
case 32: tgt = *(prop.p32); break;
|
|
|
|
default: assert(0); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return tgt;
|
2013-01-24 00:38:03 -05:00
|
|
|
}
|
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void force_repaint(session_t *ps);
|
2013-01-24 00:38:03 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
bool vsync_init(session_t *ps);
|
2013-01-31 09:53:44 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void vsync_deinit(session_t *ps);
|
2013-05-20 06:04:40 -04:00
|
|
|
|
2013-03-15 11:16:23 -04: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 07:20:27 -05:00
|
|
|
#ifdef CONFIG_DBUS
|
|
|
|
/** @name DBus hooks
|
|
|
|
*/
|
|
|
|
///@{
|
2019-03-10 08:34:37 -04:00
|
|
|
void win_set_shadow_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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void win_set_fade_force(session_t *ps, win *w, switch_t val);
|
2013-05-20 06:04:40 -04:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void win_set_focused_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 07:20:27 -05:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void win_set_invert_color_force(session_t *ps, win *w, switch_t val);
|
2013-03-10 06:45:54 -04:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
void opts_init_track_focus(session_t *ps);
|
2013-05-20 06:04:40 -04:00
|
|
|
|
2019-03-10 08:34:37 -04: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 07:20:27 -05:00
|
|
|
//!@}
|
|
|
|
#endif
|
2013-01-24 00:38:03 -05:00
|
|
|
|
2018-08-22 07:58:49 -04:00
|
|
|
/**
|
|
|
|
* Set a <code>bool</code> array of all wintypes to true.
|
|
|
|
*/
|
2019-03-10 08:34:37 -04:00
|
|
|
static inline void wintype_arr_enable(bool arr[]) {
|
|
|
|
wintype_t i;
|
2018-08-22 07:58:49 -04:00
|
|
|
|
2019-03-10 08:34:37 -04:00
|
|
|
for (i = 0; i < NUM_WINTYPES; ++i) {
|
|
|
|
arr[i] = true;
|
|
|
|
}
|
2018-08-22 07:58:49 -04:00
|
|
|
}
|