action_growtoedge,
setup_action_growtoedge_east
},
+ {
+ "vibrate",
+ action_vibrate,
+ NULL
+ },
{
NULL,
NULL,
{
ObClient *c = data->relative.any.c;
if (c)
- client_configure(c, OB_CORNER_TOPLEFT,
- c->area.x + data->relative.delta, c->area.y,
- c->area.width, c->area.height, TRUE, TRUE);
+ client_move(c, c->area.x + data->relative.delta, c->area.y);
}
void action_move_relative_vert(union ActionData *data)
{
ObClient *c = data->relative.any.c;
if (c)
- client_configure(c, OB_CORNER_TOPLEFT,
- c->area.x, c->area.y + data->relative.delta,
- c->area.width, c->area.height, TRUE, TRUE);
+ client_move(c, c->area.x, c->area.y + data->relative.delta);
}
void action_resize_relative_horz(union ActionData *data)
{
ObClient *c = data->relative.any.c;
if (c)
- client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
- c->area.width +
- data->relative.delta * c->size_inc.width,
- c->area.height, TRUE, TRUE);
+ client_resize(c,
+ c->area.width + data->relative.delta * c->size_inc.width,
+ c->area.height);
}
void action_resize_relative_vert(union ActionData *data)
{
ObClient *c = data->relative.any.c;
if (c && !c->shaded)
- client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
- c->area.width, c->area.height +
- data->relative.delta * c->size_inc.height,
- TRUE, TRUE);
+ client_resize(c, c->area.width, c->area.height +
+ data->relative.delta * c->size_inc.height);
}
void action_maximize_full(union ActionData *data)
g_assert_not_reached();
}
frame_frame_gravity(c->frame, &x, &y);
- client_configure(c, OB_CORNER_TOPLEFT,
- x, y, c->area.width, c->area.height, TRUE, TRUE);
+ client_move(c, x, y);
}
frame_frame_gravity(c->frame, &x, &y);
width -= c->frame->size.left + c->frame->size.right;
height -= c->frame->size.top + c->frame->size.bottom;
- client_configure(c, OB_CORNER_TOPLEFT, x, y, width, height, TRUE, TRUE);
+ client_move(c, x, y);
}
void action_send_to_layer(union ActionData *data)
{
screen_show_desktop(FALSE);
}
+
+void action_vibrate(union ActionData *data)
+{
+ ObClient *c = data->client.any.c;
+ gint x, y, thr, length, i;
+
+ if (!c) return;
+
+ x = c->frame->area.x;
+ y = c->frame->area.y;
+ thr = 120;
+ length = y + thr;
+ for (i = 0; i < 5; ++i) {
+ while (y < length) {
+ client_move(c, x, y);
+ y += 4;
+ x -= 1;
+ }
+ while (y >= length - thr) {
+ client_move(c, x, y);
+ y -= 4;
+ x += 1;
+ }
+ }
+}
void action_show_desktop(union ActionData *data);
/* Any */
void action_unshow_desktop(union ActionData *data);
+/* Client */
+void action_vibrate(union ActionData *data);
#endif
static void client_apply_startup_state(ObClient *self);
static void client_restore_session_state(ObClient *self);
static void client_restore_session_stacking(ObClient *self);
+static void client_act_urgent(ObClient *self);
void client_startup()
{
client_normal(self));
if (x != ox || y != oy)
- client_configure(self, OB_CORNER_TOPLEFT, x, y,
- self->area.width, self->area.height,
- TRUE, TRUE);
+ client_move(self, x, y);
}
client_showhide(self);
client_set_list();
}
+static void client_act_urgent(ObClient *self)
+{
+ GSList *it;
+
+ for (it = config_urgent_actions; it; it = g_slist_next(it)) {
+ ObAction *a = it->data;
+
+ a->data.any.c = self;
+ a->func(&a->data);
+ }
+}
+
static void client_restore_session_state(ObClient *self)
{
GList *it;
if (client_find_onscreen(self, &x, &y,
self->frame->area.width,
self->frame->area.height, rude)) {
- client_configure(self, OB_CORNER_TOPLEFT, x, y,
- self->area.width, self->area.height,
- TRUE, TRUE);
+ client_move(self, x, y);
}
}
ur ? "ON" : "OFF");
/* fire the urgent callback if we're mapped, otherwise, wait until
after we're mapped */
- if (self->frame) {
- /* XXX do shit */
- }
+ if (self->frame && self->urgent)
+ client_act_urgent(self);
}
}
client_shade(self, TRUE);
}
if (self->urgent)
- /* XXX do shit */;
+ client_act_urgent(self);
if (self->max_vert && self->max_horz) {
self->max_vert = self->max_horz = FALSE;
client_setup_decor_and_functions(self);
- client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE);
+ client_move_resize(self, x, y, w, h);
/* try focus us when we go into fullscreen mode */
client_focus(self);
/* figure out where the client should be going */
frame_frame_gravity(self->frame, &x, &y);
- client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE);
+ client_move_resize(self, x, y, w, h);
}
void client_shade(ObClient *self, gboolean shade)
/* Returns if the window is focused */
gboolean client_focused(ObClient *self);
+#define client_move(self, x, y) \
+ client_configure(self, OB_CORNER_TOPLEFT, x, y, \
+ self->area.width, self->area.height, \
+ TRUE, TRUE)
+#define client_resize(self, w, h) \
+ client_configure(self, OB_CORNER_TOPLEFT, self->area.x, self->area.y, \
+ w, h, TRUE, TRUE)
+#define client_move_resize(self, x, y, w, h) \
+ client_configure(self, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE)
+
#define client_configure(self, anchor, x, y, w, h, user, final) \
client_configure_full(self, anchor, x, y, w, h, user, final, FALSE)
gint config_resist_win;
gint config_resist_edge;
+GSList *config_urgent_actions;
+
/*
<keybind key="C-x">
config_resist_edge = parse_int(doc, n);
}
+static void parse_urgent(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ void *d)
+{
+ ObAction *action;
+ xmlNodePtr nact;
+
+ nact = parse_find_node("action", node->xmlChildrenNode);
+ while (nact) {
+ if ((action = action_parse(i, doc, nact))) {
+ /* validate that its okay for an urgent binding */
+ if (action->func == action_moveresize &&
+ action->data.moveresize.corner !=
+ prop_atoms.net_wm_moveresize_move_keyboard &&
+ action->data.moveresize.corner !=
+ prop_atoms.net_wm_moveresize_size_keyboard) {
+ action_free(action);
+ action = NULL;
+ }
+
+ if (action)
+ config_urgent_actions = g_slist_append(config_urgent_actions,
+ action);
+ }
+ nact = parse_find_node("action", nact->next);
+ }
+}
+
void config_startup(ObParseInst *i)
{
config_focus_new = TRUE;
config_menu_files = NULL;
parse_register(i, "menu", parse_menu, NULL);
+
+ parse_register(i, "urgent", parse_urgent, NULL);
}
void config_shutdown()
/*! User-specified menu files */
extern GSList *config_menu_files;
+/*! Actions to execute when a client sets its urgent flag */
+extern GSList *config_urgent_actions;
+
void config_startup(struct _ObParseInst *i);
void config_shutdown();
#include "openbox.h"
#include "resist.h"
#include "popup.h"
+#include "moveresize.h"
#include "config.h"
#include "render/render.h"
#include "render/theme.h"
popup_hide(popup);
if (moving) {
- client_configure(moveresize_client, OB_CORNER_TOPLEFT,
- (cancel ? start_cx : cur_x),
- (cancel ? start_cy : cur_y),
- start_cw, start_ch, TRUE, TRUE);
+ client_move(moveresize_client,
+ (cancel ? start_cx : cur_x),
+ (cancel ? start_cy : cur_y));
} else {
client_configure(moveresize_client, lockcorner,
moveresize_client->area.x,
/* get where the client should be */
frame_frame_gravity(moveresize_client->frame, &cur_x, &cur_y);
- client_configure(moveresize_client, OB_CORNER_TOPLEFT, cur_x, cur_y,
- start_cw, start_ch, TRUE, FALSE);
+ client_move(moveresize_client, cur_x, cur_y);
/* this would be better with a fixed width font ... XXX can do it better
if there are 2 text boxes */