summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxsacha <xsacha@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 18:34:55 +0000
committerxsacha <xsacha@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 18:34:55 +0000
commit31811f6d60a682e0c184833a09dc546f1b73ccdd (patch)
tree7aaa40952460326b56fe20c9fde6266d3be0a6b6
parentacf63cf63e411451f14ad5ae945b29267fac9a99 (diff)
downloadmarex-dev-31811f6d60a682e0c184833a09dc546f1b73ccdd.tar.gz
marex-dev-31811f6d60a682e0c184833a09dc546f1b73ccdd.tar.bz2
beryl-core: Toggle key for unredirecting or redirecting windows
git-svn-id: file:///beryl/trunk@4034 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-core/include/beryl.h27
-rw-r--r--beryl-core/src/display.c30
-rw-r--r--beryl-core/src/display_options.c21
-rw-r--r--beryl-core/src/paint.c2
-rwxr-xr-xberyl-settings/src/beryl-settings.in2
5 files changed, 67 insertions, 15 deletions
diff --git a/beryl-core/include/beryl.h b/beryl-core/include/beryl.h
index 4786e1d..905693e 100644
--- a/beryl-core/include/beryl.h
+++ b/beryl-core/include/beryl.h
@@ -574,19 +574,20 @@ typedef int CompWatchFdHandle;
#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_VERT 55
#define COMP_DISPLAY_OPTION_HIDE_SKIP_TASKBAR_WINDOWS 56
#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED 57
-#define COMP_DISPLAY_OPTION_RAISE_WINDOW 58
-#define COMP_DISPLAY_OPTION_ACTIVATE_WINDOW 59
-#define COMP_DISPLAY_OPTION_DIM_DEAD 60
-#define COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED 61
-#define COMP_DISPLAY_OPTION_EDGE_TRIGGERING_DELAY 62
-#define COMP_DISPLAY_OPTION_GENERATE_THUMBNAILS 63
-#define COMP_DISPLAY_OPTION_THUMBNAIL_SIZE 64
-#define COMP_DISPLAY_OPTION_THUMBNAIL_SMOOTH 65
-#define COMP_DISPLAY_OPTION_AUDIBLE_BELL 66
-#define COMP_DISPLAY_OPTION_MAP_ON_SHUTDOWN 67
-#define COMP_DISPLAY_OPTION_BIG_VIEWPORT_MANAGER 68
-#define COMP_DISPLAY_OPTION_FOCUS_ON_CLOSE_MODE 69
-#define COMP_DISPLAY_OPTION_NUM 70
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED 58
+#define COMP_DISPLAY_OPTION_RAISE_WINDOW 59
+#define COMP_DISPLAY_OPTION_ACTIVATE_WINDOW 60
+#define COMP_DISPLAY_OPTION_DIM_DEAD 61
+#define COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED 62
+#define COMP_DISPLAY_OPTION_EDGE_TRIGGERING_DELAY 63
+#define COMP_DISPLAY_OPTION_GENERATE_THUMBNAILS 64
+#define COMP_DISPLAY_OPTION_THUMBNAIL_SIZE 65
+#define COMP_DISPLAY_OPTION_THUMBNAIL_SMOOTH 66
+#define COMP_DISPLAY_OPTION_AUDIBLE_BELL 67
+#define COMP_DISPLAY_OPTION_MAP_ON_SHUTDOWN 68
+#define COMP_DISPLAY_OPTION_BIG_VIEWPORT_MANAGER 69
+#define COMP_DISPLAY_OPTION_FOCUS_ON_CLOSE_MODE 70
+#define COMP_DISPLAY_OPTION_NUM 71
typedef enum
{
diff --git a/beryl-core/src/display.c b/beryl-core/src/display.c
index ac52020..779742b 100644
--- a/beryl-core/src/display.c
+++ b/beryl-core/src/display.c
@@ -643,6 +643,28 @@ runCommandScreenshot(CompDisplay * d,
}
static Bool
+toggleRedirect (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
+{
+ CompWindow *w;
+ Window xid;
+
+ xid = getIntOptionNamed(option, nOption, "window", 0);
+
+ w = findTopLevelWindowAtDisplay(d, xid);
+ if (w) {
+ if (w->redirected)
+ unredirectWindow(w);
+ else
+ redirectWindow(w);
+ }
+
+ return TRUE;
+}
+
+
+static Bool
runCommandWindowScreenshot(CompDisplay * d,
CompAction * action,
CompActionState state,
@@ -928,6 +950,7 @@ setDisplayOption(CompDisplay * display, char *name, CompOptionValue * value)
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_HORZ:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_VERT:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED:
+ case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_FULLSCREEN:
case COMP_DISPLAY_OPTION_RAISE_WINDOW:
case COMP_DISPLAY_OPTION_ACTIVATE_WINDOW:
@@ -2189,6 +2212,9 @@ static void addScreenActions(CompDisplay * d, CompScreen * s)
&d->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED].
value.action);
addScreenAction(s,
+ &d->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED].
+ value.action);
+ addScreenAction(s,
&d->
opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_FULLSCREEN].
value.action);
@@ -2337,6 +2363,10 @@ static void compDisplaySetBindingFuncs(CompDisplay * display)
o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED];
o->value.action.initiate = shade;
o->value.action.terminate = 0;
+
+ o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED];
+ o->value.action.initiate = toggleRedirect;
+ o->value.action.terminate = 0;
}
static CompRequestFlag *addRequestFlag(CompDisplay * d, char *request)
diff --git a/beryl-core/src/display_options.c b/beryl-core/src/display_options.c
index 12e2bdc..0ed5a88 100644
--- a/beryl-core/src/display_options.c
+++ b/beryl-core/src/display_options.c
@@ -94,6 +94,9 @@
#define TOGGLE_WINDOW_SHADING_KEY_DEFAULT "s"
#define TOGGLE_WINDOW_SHADING_MODIFIERS_DEFAULT (CompAltMask | ControlMask)
+#define TOGGLE_WINDOW_REDIRECTING_KEY_DEFAULT "Escape"
+#define TOGGLE_WINDOW_REDIRECTING_MODIFIERS_DEFAULT (CompAltMask)
+
#define TOGGLE_WINDOW_MAXIMIZED_KEY_DEFAULT "F10"
#define TOGGLE_WINDOW_MAXIMIZED_MODIFIERS_DEFAULT CompSuperMask
@@ -820,6 +823,24 @@ void compDisplayInitOptions(CompDisplay * display, char **plugin, int nPlugin)
o->value.action.key.keysym =
XStringToKeysym(TOGGLE_WINDOW_SHADING_KEY_DEFAULT);
+ o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED];
+ o->advanced = False;
+ o->name = "toggle_window_redirected";
+ o->group = N_("Bindings");
+ o->subGroup = N_("Toggle Window Redirected");
+ o->displayHints = "";
+ o->shortDesc = N_("Toggle Window Redirected");
+ o->longDesc = N_("Toggle active window redirected");
+ o->type = CompOptionTypeAction;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.key.modifiers = TOGGLE_WINDOW_REDIRECTING_MODIFIERS_DEFAULT;
+ o->value.action.key.keysym =
+ XStringToKeysym(TOGGLE_WINDOW_REDIRECTING_KEY_DEFAULT);
+
o = &display->opt[COMP_DISPLAY_OPTION_DIM_DEAD];
o->advanced = True;
o->name = "dim_dead";
diff --git a/beryl-core/src/paint.c b/beryl-core/src/paint.c
index 1cd5016..83a86e0 100644
--- a/beryl-core/src/paint.c
+++ b/beryl-core/src/paint.c
@@ -1290,7 +1290,7 @@ drawWindow(CompWindow * w, const CompTransform *transform,
return TRUE;
}
- if (!w->texture->pixmap)
+ if (!w->texture->pixmap && w->redirected)
{
bindWindow(w);
if (!w->mapNum)
diff --git a/beryl-settings/src/beryl-settings.in b/beryl-settings/src/beryl-settings.in
index 98fe162..148cb77 100755
--- a/beryl-settings/src/beryl-settings.in
+++ b/beryl-settings/src/beryl-settings.in
@@ -1022,7 +1022,7 @@ def StatePopup(button,set):
pval.width_chars = 15
grab = gtk.Button("Grab")
grab.connect("clicked",PutXprop,pcombo,pval)
- if set.Setting.Name in ("opacity","brightness","saturation","opacityabs","brightnessabs","saturationabs"):
+ if set.Setting.Name in ("opacity","brightness","saturation"):
Adj = gtk.Adjustment(0,0,100,1)
bat = gtk.SpinButton(Adj,1,0)
valwid = gtk.HScale(Adj)