Improvement #41: Enable/disable redirection through D-Bus
- Add "redirected_force" to D-Bus opts_get to forcefully redirect/unredirect windows. - Add D-Bus method "repaint", to, namely, repaint the screen.
This commit is contained in:
parent
b1e0ef8ecd
commit
b46deb5162
|
@ -51,3 +51,13 @@ dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_get" stri
|
||||||
sleep 3
|
sleep 3
|
||||||
dbus-send --print-reply --dest="$service" "$object" "${interface}.reset"
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.reset"
|
||||||
|
|
||||||
|
# Undirect window
|
||||||
|
sleep 3
|
||||||
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:redirected_force uint16:0
|
||||||
|
|
||||||
|
# Revert back to auto
|
||||||
|
sleep 3
|
||||||
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:redirected_force uint16:2
|
||||||
|
|
||||||
|
# Force repaint
|
||||||
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.repaint"
|
||||||
|
|
|
@ -460,6 +460,8 @@ typedef struct {
|
||||||
/// Whether to unredirect all windows if a full-screen opaque window
|
/// Whether to unredirect all windows if a full-screen opaque window
|
||||||
/// is detected.
|
/// is detected.
|
||||||
bool unredir_if_possible;
|
bool unredir_if_possible;
|
||||||
|
/// Forced redirection setting through D-Bus.
|
||||||
|
switch_t redirected_force;
|
||||||
/// Whether to enable D-Bus support.
|
/// Whether to enable D-Bus support.
|
||||||
bool dbus;
|
bool dbus;
|
||||||
/// Path to log file.
|
/// Path to log file.
|
||||||
|
@ -647,9 +649,6 @@ typedef struct {
|
||||||
XserverRegion all_damage_last[CGLX_MAX_BUFFER_AGE];
|
XserverRegion all_damage_last[CGLX_MAX_BUFFER_AGE];
|
||||||
/// Whether all windows are currently redirected.
|
/// Whether all windows are currently redirected.
|
||||||
bool redirected;
|
bool redirected;
|
||||||
/// Whether there's a highest full-screen window, and all windows could
|
|
||||||
/// be unredirected.
|
|
||||||
bool unredir_possible;
|
|
||||||
/// Pre-generated alpha pictures.
|
/// Pre-generated alpha pictures.
|
||||||
Picture *alpha_picts;
|
Picture *alpha_picts;
|
||||||
/// Whether all reg_ignore of windows should expire in this paint.
|
/// Whether all reg_ignore of windows should expire in this paint.
|
||||||
|
|
|
@ -1076,7 +1076,7 @@ get_alpha_pict_o(session_t *ps, opacity_t o) {
|
||||||
static win *
|
static win *
|
||||||
paint_preprocess(session_t *ps, win *list) {
|
paint_preprocess(session_t *ps, win *list) {
|
||||||
// Initialize unredir_possible
|
// Initialize unredir_possible
|
||||||
ps->unredir_possible = false;
|
bool unredir_possible = false;
|
||||||
|
|
||||||
win *w;
|
win *w;
|
||||||
win *t = NULL, *next = NULL;
|
win *t = NULL, *next = NULL;
|
||||||
|
@ -1229,13 +1229,13 @@ paint_preprocess(session_t *ps, win *list) {
|
||||||
|
|
||||||
last_reg_ignore = w->reg_ignore;
|
last_reg_ignore = w->reg_ignore;
|
||||||
|
|
||||||
if (is_highest && to_paint) {
|
if (ps->o.unredir_if_possible && is_highest && to_paint) {
|
||||||
is_highest = false;
|
is_highest = false;
|
||||||
// Disable unredirection for multi-screen setups
|
// Disable unredirection for multi-screen setups
|
||||||
if (WMODE_SOLID == w->mode
|
if (WMODE_SOLID == w->mode
|
||||||
&& (!w->frame_opacity || !win_has_frame(w))
|
&& (!w->frame_opacity || !win_has_frame(w))
|
||||||
&& win_is_fullscreen(ps, w))
|
&& win_is_fullscreen(ps, w))
|
||||||
ps->unredir_possible = true;
|
unredir_possible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset flags
|
// Reset flags
|
||||||
|
@ -1259,12 +1259,13 @@ paint_preprocess(session_t *ps, win *list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If possible, unredirect all windows and stop painting
|
// If possible, unredirect all windows and stop painting
|
||||||
if (ps->o.unredir_if_possible && ps->unredir_possible) {
|
if (UNSET != ps->o.redirected_force)
|
||||||
|
unredir_possible = !ps->o.redirected_force;
|
||||||
|
|
||||||
|
if (unredir_possible)
|
||||||
redir_stop(ps);
|
redir_stop(ps);
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
redir_start(ps);
|
redir_start(ps);
|
||||||
}
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -6365,6 +6366,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
|
||||||
.paint_on_overlay = false,
|
.paint_on_overlay = false,
|
||||||
.resize_damage = 0,
|
.resize_damage = 0,
|
||||||
.unredir_if_possible = false,
|
.unredir_if_possible = false,
|
||||||
|
.redirected_force = UNSET,
|
||||||
.dbus = false,
|
.dbus = false,
|
||||||
.benchmark = 0,
|
.benchmark = 0,
|
||||||
.benchmark_wid = None,
|
.benchmark_wid = None,
|
||||||
|
@ -6435,7 +6437,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
|
||||||
.all_damage_last = { None },
|
.all_damage_last = { None },
|
||||||
.time_start = { 0, 0 },
|
.time_start = { 0, 0 },
|
||||||
.redirected = false,
|
.redirected = false,
|
||||||
.unredir_possible = false,
|
|
||||||
.alpha_picts = NULL,
|
.alpha_picts = NULL,
|
||||||
.reg_ignore_expire = false,
|
.reg_ignore_expire = false,
|
||||||
.idling = false,
|
.idling = false,
|
||||||
|
|
18
src/dbus.c
18
src/dbus.c
|
@ -582,6 +582,12 @@ cdbus_process(session_t *ps, DBusMessage *msg) {
|
||||||
cdbus_reply_bool(ps, msg, true);
|
cdbus_reply_bool(ps, msg, true);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
else if (cdbus_m_ismethod("repaint")) {
|
||||||
|
force_repaint(ps);
|
||||||
|
if (!dbus_message_get_no_reply(msg))
|
||||||
|
cdbus_reply_bool(ps, msg, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
else if (cdbus_m_ismethod("list_win")) {
|
else if (cdbus_m_ismethod("list_win")) {
|
||||||
success = cdbus_process_list_win(ps, msg);
|
success = cdbus_process_list_win(ps, msg);
|
||||||
}
|
}
|
||||||
|
@ -892,6 +898,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) {
|
||||||
cdbus_m_opts_get_do(detect_rounded_corners, cdbus_reply_bool);
|
cdbus_m_opts_get_do(detect_rounded_corners, cdbus_reply_bool);
|
||||||
cdbus_m_opts_get_do(paint_on_overlay, cdbus_reply_bool);
|
cdbus_m_opts_get_do(paint_on_overlay, cdbus_reply_bool);
|
||||||
cdbus_m_opts_get_do(unredir_if_possible, cdbus_reply_bool);
|
cdbus_m_opts_get_do(unredir_if_possible, cdbus_reply_bool);
|
||||||
|
cdbus_m_opts_get_do(redirected_force, cdbus_reply_enum);
|
||||||
cdbus_m_opts_get_do(logpath, cdbus_reply_string);
|
cdbus_m_opts_get_do(logpath, cdbus_reply_string);
|
||||||
cdbus_m_opts_get_do(synchronize, cdbus_reply_bool);
|
cdbus_m_opts_get_do(synchronize, cdbus_reply_bool);
|
||||||
|
|
||||||
|
@ -1064,6 +1071,16 @@ cdbus_process_opts_set(session_t *ps, DBusMessage *msg) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// redirected_force
|
||||||
|
if (!strcmp("redirected_force", target)) {
|
||||||
|
cdbus_enum_t val = UNSET;
|
||||||
|
if (!cdbus_msg_get_arg(msg, 1, CDBUS_TYPE_ENUM, &val))
|
||||||
|
return false;
|
||||||
|
ps->o.redirected_force = val;
|
||||||
|
force_repaint(ps);
|
||||||
|
goto cdbus_process_opts_set_success;
|
||||||
|
}
|
||||||
|
|
||||||
#undef cdbus_m_opts_set_do
|
#undef cdbus_m_opts_set_do
|
||||||
|
|
||||||
printf_errf("(): " CDBUS_ERROR_BADTGT_S, target);
|
printf_errf("(): " CDBUS_ERROR_BADTGT_S, target);
|
||||||
|
@ -1117,6 +1134,7 @@ cdbus_process_introspect(session_t *ps, DBusMessage *msg) {
|
||||||
" <arg name='wid' type='" CDBUS_TYPE_WINDOW_STR "'/>\n"
|
" <arg name='wid' type='" CDBUS_TYPE_WINDOW_STR "'/>\n"
|
||||||
" </signal>\n"
|
" </signal>\n"
|
||||||
" <method name='reset' />\n"
|
" <method name='reset' />\n"
|
||||||
|
" <method name='repaint' />\n"
|
||||||
" </interface>\n"
|
" </interface>\n"
|
||||||
"</node>\n";
|
"</node>\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue