summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxsacha <xsacha@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-15 14:44:50 +0000
committerxsacha <xsacha@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-15 14:44:50 +0000
commit136ec2bce2f71a2911d5e9db74efec30cdbbee1f (patch)
tree0566e33f1a54b4377789872c7c6b8ee2c51753ac
parent2a8f1dbee99e1b5a786ecaad12641ea8170169ca (diff)
downloadmarex-dev-136ec2bce2f71a2911d5e9db74efec30cdbbee1f.tar.gz
marex-dev-136ec2bce2f71a2911d5e9db74efec30cdbbee1f.tar.bz2
beryl-core: Add keybinding for Always on Top and Sticky Window
git-svn-id: file:///beryl/trunk@4080 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-core/include/beryl.h32
-rw-r--r--beryl-core/src/display.c56
-rw-r--r--beryl-core/src/display_options.c38
3 files changed, 107 insertions, 19 deletions
diff --git a/beryl-core/include/beryl.h b/beryl-core/include/beryl.h
index a5e6a08..7103cd0 100644
--- a/beryl-core/include/beryl.h
+++ b/beryl-core/include/beryl.h
@@ -573,21 +573,23 @@ typedef int CompWatchFdHandle;
#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_HORZ 54
#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_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
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_AOT 57
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_STICKY 58
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED 59
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED 60
+#define COMP_DISPLAY_OPTION_RAISE_WINDOW 61
+#define COMP_DISPLAY_OPTION_ACTIVATE_WINDOW 62
+#define COMP_DISPLAY_OPTION_DIM_DEAD 63
+#define COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED 64
+#define COMP_DISPLAY_OPTION_EDGE_TRIGGERING_DELAY 65
+#define COMP_DISPLAY_OPTION_GENERATE_THUMBNAILS 66
+#define COMP_DISPLAY_OPTION_THUMBNAIL_SIZE 67
+#define COMP_DISPLAY_OPTION_THUMBNAIL_SMOOTH 68
+#define COMP_DISPLAY_OPTION_AUDIBLE_BELL 69
+#define COMP_DISPLAY_OPTION_MAP_ON_SHUTDOWN 70
+#define COMP_DISPLAY_OPTION_BIG_VIEWPORT_MANAGER 71
+#define COMP_DISPLAY_OPTION_FOCUS_ON_CLOSE_MODE 72
+#define COMP_DISPLAY_OPTION_NUM 73
typedef enum
{
diff --git a/beryl-core/src/display.c b/beryl-core/src/display.c
index 779742b..225c4ef 100644
--- a/beryl-core/src/display.c
+++ b/beryl-core/src/display.c
@@ -787,6 +787,46 @@ toggleMaximizedVertically(CompDisplay * d,
}
static Bool
+alwaysontop(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 && (w->actions & CompWindowStateAboveMask))
+ {
+ w->state ^= CompWindowStateAboveMask;
+ updateWindowAttributes(w, FALSE);
+ }
+
+ return TRUE;
+}
+
+static Bool
+sticky(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 && (w->actions & CompWindowStateStickyMask))
+ {
+ w->state ^= CompWindowStateStickyMask;
+ setWindowState(w->screen->display, w->state, w->id);
+ }
+
+ return TRUE;
+}
+
+static Bool
shade(CompDisplay * d,
CompAction * action,
CompActionState state, CompOption * option, int nOption)
@@ -949,6 +989,8 @@ setDisplayOption(CompDisplay * display, char *name, CompOptionValue * value)
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_HORZ:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_VERT:
+ case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_AOT:
+ case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_STICKY:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_REDIRECTED:
case COMP_DISPLAY_OPTION_TOGGLE_WINDOW_FULLSCREEN:
@@ -2209,6 +2251,12 @@ static void addScreenActions(CompDisplay * d, CompScreen * s)
[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_VERT].
value.action);
addScreenAction(s,
+ &d->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_AOT].
+ value.action);
+ addScreenAction(s,
+ &d->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_STICKY].
+ value.action);
+ addScreenAction(s,
&d->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED].
value.action);
addScreenAction(s,
@@ -2360,6 +2408,14 @@ static void compDisplaySetBindingFuncs(CompDisplay * display)
o->value.action.initiate = toggleMaximizedVertically;
o->value.action.terminate = 0;
+ o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_AOT];
+ o->value.action.initiate = alwaysontop;
+ o->value.action.terminate = 0;
+
+ o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_STICKY];
+ o->value.action.initiate = sticky;
+ o->value.action.terminate = 0;
+
o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED];
o->value.action.initiate = shade;
o->value.action.terminate = 0;
diff --git a/beryl-core/src/display_options.c b/beryl-core/src/display_options.c
index 0ed5a88..cc38306 100644
--- a/beryl-core/src/display_options.c
+++ b/beryl-core/src/display_options.c
@@ -805,6 +805,36 @@ void compDisplayInitOptions(CompDisplay * display, char **plugin, int nPlugin)
o->type = CompOptionTypeBool;
o->value.b = HIDE_SKIP_TASKBAR_WINDOWS_DEFAULT;
+ o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_AOT];
+ o->advanced = False;
+ o->name = "toggle_window_aot";
+ o->group = N_("Bindings");
+ o->subGroup = N_("Toggle Window Always on Top");
+ o->displayHints = "";
+ o->shortDesc = N_("Toggle Window Always on Top");
+ o->longDesc = N_("Toggle active window always on top");
+ 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 = CompBindingTypeNone;
+
+ o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_STICKY];
+ o->advanced = False;
+ o->name = "toggle_window_sticky";
+ o->group = N_("Bindings");
+ o->subGroup = N_("Toggle Window Sticky");
+ o->displayHints = "";
+ o->shortDesc = N_("Toggle Window Sticky");
+ o->longDesc = N_("Toggle active window sticky");
+ 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 = CompBindingTypeNone;
+
o = &display->opt[COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED];
o->advanced = False;
o->name = "toggle_window_shaded";
@@ -836,10 +866,10 @@ void compDisplayInitOptions(CompDisplay * display, char **plugin, int nPlugin)
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->value.action.type = CompBindingTypeNone;
+// 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;