Allows locking windows so you can't move/resize/close/etc them by mistake.
It's probably better to check in client.c than the actions, just
testing if I want it at all for now.
openbox/actions/if.c \
openbox/actions/kill.c \
openbox/actions/layer.c \
+ openbox/actions/lock.c \
openbox/actions/lower.c \
openbox/actions/maximize.c \
openbox/actions/move.c \
event_end_ignore_all_enters(ignore_start);
}
}
+
+gboolean actions_client_locked(ObActionsData *data)
+{
+ ObClient *c = data->client;
+
+ return c && c->locked;
+}
/*! Function for actions to call when they are moving a client around */
void actions_client_move(ObActionsData *data, gboolean start);
+/*! May we do something to this client? */
+gboolean actions_client_locked(ObActionsData *data);
action_if_startup();
action_focustobottom_startup();
action_sendkeyevent_startup();
+ action_lock_startup();
}
void action_if_startup(void);
void action_focustobottom_startup(void);
void action_sendkeyevent_startup(void);
+void action_lock_startup(void);
#endif
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client) client_close(data->client);
+ if (!actions_client_locked(data))
+ client_close(data->client);
return FALSE;
}
/* Always return FALSE because its not interactive */
static gboolean run_func_on(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_set_undecorated(data->client, FALSE);
actions_client_move(data, FALSE);
/* Always return FALSE because its not interactive */
static gboolean run_func_off(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_set_undecorated(data->client, TRUE);
actions_client_move(data, FALSE);
/* Always return FALSE because its not interactive */
static gboolean run_func_toggle(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_set_undecorated(data->client, !data->client->undecorated);
actions_client_move(data, FALSE);
Options *o = options;
guint d;
-
-
switch (o->type) {
case LAST:
d = screen_last_desktop;
gboolean go = TRUE;
actions_client_move(data, TRUE);
- if (o->send && data->client && client_normal(data->client)) {
+ if (o->send && !actions_client_locked(data) &&
+ client_normal(data->client))
+ {
client_set_desktop(data->client, d, o->follow, FALSE);
go = o->follow;
}
gint half;
if (!data->client ||
+ actions_client_locked(data) ||
/* don't allow vertical resize if shaded */
((o->dir == OB_DIRECTION_NORTH || o->dir == OB_DIRECTION_SOUTH) &&
data->client->shaded))
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_iconify(data->client, !options, FALSE, FALSE);
actions_client_move(data, FALSE);
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client)
+ if (!actions_client_locked(data))
client_kill(data->client);
return FALSE;
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
ObClient *c = data->client;
actions_client_move(data, TRUE);
--- /dev/null
+#include "openbox/actions.h"
+#include "openbox/client.h"
+
+static gboolean run_func(ObActionsData *data, gpointer options);
+
+void action_lock_startup(void)
+{
+ actions_register("Lock", NULL, NULL, run_func,
+ NULL, NULL);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+ if (data->client)
+ data->client->locked = !data->client->locked;
+ return FALSE;
+}
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
stacking_lower(CLIENT_AS_WINDOW(data->client));
actions_client_move(data, FALSE);
static gboolean run_func_on(ObActionsData *data, gpointer options)
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_maximize(data->client, TRUE, o->dir);
actions_client_move(data, FALSE);
static gboolean run_func_off(ObActionsData *data, gpointer options)
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_maximize(data->client, FALSE, o->dir);
actions_client_move(data, FALSE);
static gboolean run_func_toggle(ObActionsData *data, gpointer options)
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
gboolean toggle;
actions_client_move(data, TRUE);
toggle = ((o->dir == HORZ && !data->client->max_horz) ||
#include "openbox/actions.h"
+#include "openbox/client.h"
#include "openbox/moveresize.h"
#include "obt/prop.h"
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (data->client && !(ObClient *)(data->client)->locked) {
guint32 corner;
corner = data->button != 0 ?
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
ObClient *c;
gint x, y, lw, lh, w, h;
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
Rect *area, *carea;
ObClient *c;
gint mon, cmon;
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
gint x, y;
client_find_move_directional(data->client, o->dir, &x, &y);
/* Always return FALSE because its not interactive */
static gboolean run_func_toggle(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_set_desktop(data->client,
data->client->desktop == DESKTOP_ALL ?
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
stacking_raise(CLIENT_AS_WINDOW(data->client));
actions_client_move(data, FALSE);
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
stacking_restack_request(data->client, NULL, Opposite);
actions_client_move(data, FALSE);
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
ObClient *c = data->client;
guint32 corner;
{
Options *o = options;
- if (data->client) {
+ if (!actions_client_locked(data)) {
ObClient *c = data->client;
gint x, y, ow, xoff, nw, oh, yoff, nh, lw, lh;
/* Always return FALSE because its not interactive */
static gboolean run_func_on(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_shade(data->client, TRUE);
actions_client_move(data, FALSE);
/* Always return FALSE because its not interactive */
static gboolean run_func_off(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_shade(data->client, FALSE);
actions_client_move(data, FALSE);
/* Always return FALSE because its not interactive */
static gboolean run_func_toggle(ObActionsData *data, gpointer options)
{
- if (data->client) {
+ if (!actions_client_locked(data)) {
actions_client_move(data, TRUE);
client_shade(data->client, !data->client->shaded);
actions_client_move(data, FALSE);
*/
guint functions;
+ /*! Prevent window from being accidentally acted upon */
+ gboolean locked;
+
/* The window's icon, in a variety of shapes and sizes */
RrImage *icon_set;
g_assert(c);
+ if (c->locked)
+ return;
+
if (!config_focus_under_mouse)
ignore_start = event_start_ignore_all_enters();
g_assert(c);
+ if (c->locked)
+ return;
+
if (!config_focus_under_mouse)
ignore_start = event_start_ignore_all_enters();
{
g_assert(c);
+ if (c->locked)
+ return;
+
client_set_desktop(c, e->id, FALSE, FALSE);
/* the client won't even be on the screen anymore, so hide the menu */
if (f)