summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2013-07-26 12:52:16 +0800
committerRichard Grenville <pyxlcy@gmail.com>2013-07-26 13:02:06 +0800
commit4f92672534b2ebb83616de98b40fb79761c0c2ac (patch)
tree46aa3bd831a5b8b1a40be17e4fc1a46c56c0aaad
parentbd40b36f01e2f114b0647ec7365550fb9f610326 (diff)
downloadtdebase-4f92672534b2ebb83616de98b40fb79761c0c2ac.tar.gz
tdebase-4f92672534b2ebb83616de98b40fb79761c0c2ac.zip
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.
-rw-r--r--common.h5
-rw-r--r--compton.c17
-rw-r--r--dbus.c18
3 files changed, 29 insertions, 11 deletions
diff --git a/common.h b/common.h
index d3bc58023..e439af4a7 100644
--- a/common.h
+++ b/common.h
@@ -460,6 +460,8 @@ typedef struct {
/// Whether to unredirect all windows if a full-screen opaque window
/// is detected.
bool unredir_if_possible;
+ /// Forced redirection setting through D-Bus.
+ switch_t redirected_force;
/// Whether to enable D-Bus support.
bool dbus;
/// Path to log file.
@@ -647,9 +649,6 @@ typedef struct {
XserverRegion all_damage_last[CGLX_MAX_BUFFER_AGE];
/// Whether all windows are currently redirected.
bool redirected;
- /// Whether there's a highest full-screen window, and all windows could
- /// be unredirected.
- bool unredir_possible;
/// Pre-generated alpha pictures.
Picture *alpha_picts;
/// Whether all reg_ignore of windows should expire in this paint.
diff --git a/compton.c b/compton.c
index 0f578791f..4cbeae7fa 100644
--- a/compton.c
+++ b/compton.c
@@ -1076,7 +1076,7 @@ get_alpha_pict_o(session_t *ps, opacity_t o) {
static win *
paint_preprocess(session_t *ps, win *list) {
// Initialize unredir_possible
- ps->unredir_possible = false;
+ bool unredir_possible = false;
win *w;
win *t = NULL, *next = NULL;
@@ -1229,13 +1229,13 @@ paint_preprocess(session_t *ps, win *list) {
last_reg_ignore = w->reg_ignore;
- if (is_highest && to_paint) {
+ if (ps->o.unredir_if_possible && is_highest && to_paint) {
is_highest = false;
// Disable unredirection for multi-screen setups
if (WMODE_SOLID == w->mode
&& (!w->frame_opacity || !win_has_frame(w))
&& win_is_fullscreen(ps, w))
- ps->unredir_possible = true;
+ unredir_possible = true;
}
// Reset flags
@@ -1259,12 +1259,13 @@ paint_preprocess(session_t *ps, win *list) {
}
// 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);
- }
- else {
+ else
redir_start(ps);
- }
return t;
}
@@ -6365,6 +6366,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
.paint_on_overlay = false,
.resize_damage = 0,
.unredir_if_possible = false,
+ .redirected_force = UNSET,
.dbus = false,
.benchmark = 0,
.benchmark_wid = None,
@@ -6435,7 +6437,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
.all_damage_last = { None },
.time_start = { 0, 0 },
.redirected = false,
- .unredir_possible = false,
.alpha_picts = NULL,
.reg_ignore_expire = false,
.idling = false,
diff --git a/dbus.c b/dbus.c
index f2b019aa3..2d9a86bd2 100644
--- a/dbus.c
+++ b/dbus.c
@@ -582,6 +582,12 @@ cdbus_process(session_t *ps, DBusMessage *msg) {
cdbus_reply_bool(ps, msg, 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")) {
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(paint_on_overlay, 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(synchronize, cdbus_reply_bool);
@@ -1064,6 +1071,16 @@ cdbus_process_opts_set(session_t *ps, DBusMessage *msg) {
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
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"
" </signal>\n"
" <method name='reset' />\n"
+ " <method name='repaint' />\n"
" </interface>\n"
"</node>\n";