add the move action
This commit is contained in:
parent
bb0fd965c5
commit
d642be361f
12 changed files with 47 additions and 60 deletions
|
@ -158,10 +158,12 @@ openbox_openbox_SOURCES = \
|
||||||
openbox/actions/all.h \
|
openbox/actions/all.h \
|
||||||
openbox/actions/activate.c \
|
openbox/actions/activate.c \
|
||||||
openbox/actions/breakchroot.c \
|
openbox/actions/breakchroot.c \
|
||||||
|
openbox/actions/close.c \
|
||||||
openbox/actions/cyclewindows.c \
|
openbox/actions/cyclewindows.c \
|
||||||
openbox/actions/debug.c \
|
openbox/actions/debug.c \
|
||||||
openbox/actions/execute.c \
|
openbox/actions/execute.c \
|
||||||
openbox/actions/exit.c \
|
openbox/actions/exit.c \
|
||||||
|
openbox/actions/move.c \
|
||||||
openbox/actions/reconfigure.c \
|
openbox/actions/reconfigure.c \
|
||||||
openbox/actions/restart.c \
|
openbox/actions/restart.c \
|
||||||
openbox/actions/showdesktop.c \
|
openbox/actions/showdesktop.c \
|
||||||
|
|
|
@ -416,16 +416,6 @@ void setup_action_bottom_layer(ObAction **a, ObUserAction uact)
|
||||||
(*a)->data.layer.layer = -1;
|
(*a)->data.layer.layer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_action_move(ObAction **a, ObUserAction uact)
|
|
||||||
{
|
|
||||||
(*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS;
|
|
||||||
(*a)->data.moveresize.keyboard =
|
|
||||||
(uact == OB_USER_ACTION_NONE ||
|
|
||||||
uact == OB_USER_ACTION_KEYBOARD_KEY ||
|
|
||||||
uact == OB_USER_ACTION_MENU_SELECTION);
|
|
||||||
(*a)->data.moveresize.corner = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup_action_resize(ObAction **a, ObUserAction uact)
|
void setup_action_resize(ObAction **a, ObUserAction uact)
|
||||||
{
|
{
|
||||||
(*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS;
|
(*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS;
|
||||||
|
@ -498,11 +488,6 @@ ActionString actionstrings[] =
|
||||||
action_unfocus,
|
action_unfocus,
|
||||||
setup_client_action
|
setup_client_action
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"iconify",
|
|
||||||
action_iconify,
|
|
||||||
setup_client_action
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"focustobottom",
|
"focustobottom",
|
||||||
action_focus_order_to_bottom,
|
action_focus_order_to_bottom,
|
||||||
|
@ -523,11 +508,6 @@ ActionString actionstrings[] =
|
||||||
action_lower,
|
action_lower,
|
||||||
setup_client_action
|
setup_client_action
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"close",
|
|
||||||
action_close,
|
|
||||||
setup_client_action
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"kill",
|
"kill",
|
||||||
action_kill,
|
action_kill,
|
||||||
|
@ -723,11 +703,6 @@ ActionString actionstrings[] =
|
||||||
action_toggle_decorations,
|
action_toggle_decorations,
|
||||||
setup_client_action
|
setup_client_action
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"move",
|
|
||||||
action_move,
|
|
||||||
setup_action_move
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"resize",
|
"resize",
|
||||||
action_resize,
|
action_resize,
|
||||||
|
@ -1152,11 +1127,6 @@ void action_lower(union ActionData *data)
|
||||||
client_action_end(data, config_focus_under_mouse);
|
client_action_end(data, config_focus_under_mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_close(union ActionData *data)
|
|
||||||
{
|
|
||||||
client_close(data->client.any.c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void action_kill(union ActionData *data)
|
void action_kill(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_kill(data->client.any.c);
|
client_kill(data->client.any.c);
|
||||||
|
@ -1545,19 +1515,6 @@ static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch,
|
||||||
#undef d
|
#undef d
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_move(union ActionData *data)
|
|
||||||
{
|
|
||||||
ObClient *c = data->moveresize.any.c;
|
|
||||||
guint32 corner;
|
|
||||||
|
|
||||||
if (data->moveresize.keyboard)
|
|
||||||
corner = prop_atoms.net_wm_moveresize_move_keyboard;
|
|
||||||
else
|
|
||||||
corner = prop_atoms.net_wm_moveresize_move;
|
|
||||||
|
|
||||||
moveresize_start(c, data->any.x, data->any.y, data->any.button, corner);
|
|
||||||
}
|
|
||||||
|
|
||||||
void action_resize(union ActionData *data)
|
void action_resize(union ActionData *data)
|
||||||
{
|
{
|
||||||
ObClient *c = data->moveresize.any.c;
|
ObClient *c = data->moveresize.any.c;
|
||||||
|
|
|
@ -193,6 +193,7 @@ static void actions_setup_data(ObActionsData *data,
|
||||||
guint state,
|
guint state,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
|
gint button,
|
||||||
ObFrameContext con,
|
ObFrameContext con,
|
||||||
struct _ObClient *client)
|
struct _ObClient *client)
|
||||||
{
|
{
|
||||||
|
@ -200,6 +201,7 @@ static void actions_setup_data(ObActionsData *data,
|
||||||
data->state = state;
|
data->state = state;
|
||||||
data->x = x;
|
data->x = x;
|
||||||
data->y = y;
|
data->y = y;
|
||||||
|
data->button = button;
|
||||||
data->context = con;
|
data->context = con;
|
||||||
data->client = client;
|
data->client = client;
|
||||||
}
|
}
|
||||||
|
@ -209,6 +211,7 @@ void actions_run_acts(GSList *acts,
|
||||||
guint state,
|
guint state,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
|
gint button,
|
||||||
ObFrameContext con,
|
ObFrameContext con,
|
||||||
struct _ObClient *client)
|
struct _ObClient *client)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +230,7 @@ void actions_run_acts(GSList *acts,
|
||||||
ObActionsAct *act = it->data;
|
ObActionsAct *act = it->data;
|
||||||
gboolean ok = TRUE;
|
gboolean ok = TRUE;
|
||||||
|
|
||||||
actions_setup_data(&data, uact, state, x, y, con, client);
|
actions_setup_data(&data, uact, state, x, y, button, con, client);
|
||||||
|
|
||||||
if (actions_act_is_interactive(act) &&
|
if (actions_act_is_interactive(act) &&
|
||||||
(!interactive_act || interactive_act->def != act->def))
|
(!interactive_act || interactive_act->def != act->def))
|
||||||
|
|
|
@ -46,6 +46,7 @@ struct _ObActionsData {
|
||||||
guint state;
|
guint state;
|
||||||
gint x;
|
gint x;
|
||||||
gint y;
|
gint y;
|
||||||
|
gint button;
|
||||||
|
|
||||||
struct _ObClient *client;
|
struct _ObClient *client;
|
||||||
ObFrameContext context;
|
ObFrameContext context;
|
||||||
|
@ -81,6 +82,7 @@ void actions_run_acts(GSList *acts,
|
||||||
guint state,
|
guint state,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
|
gint button,
|
||||||
ObFrameContext con,
|
ObFrameContext con,
|
||||||
struct _ObClient *client);
|
struct _ObClient *client);
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
|
||||||
Options *o = options;
|
Options *o = options;
|
||||||
|
|
||||||
if (data->client) {
|
if (data->client) {
|
||||||
gboolean mouse = (data->uact == OB_USER_ACTION_MOUSE_PRESS ||
|
if (data->button == 0 || client_mouse_focusable(data->client) ||
|
||||||
data->uact == OB_USER_ACTION_MOUSE_RELEASE ||
|
|
||||||
data->uact == OB_USER_ACTION_MOUSE_CLICK ||
|
|
||||||
data->uact == OB_USER_ACTION_MOUSE_DOUBLE_CLICK ||
|
|
||||||
data->uact == OB_USER_ACTION_MOUSE_MOTION);
|
|
||||||
if (!mouse || client_mouse_focusable(data->client) ||
|
|
||||||
data->context != OB_FRAME_CONTEXT_CLIENT ||
|
data->context != OB_FRAME_CONTEXT_CLIENT ||
|
||||||
data->context != OB_FRAME_CONTEXT_FRAME)
|
data->context != OB_FRAME_CONTEXT_FRAME)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,4 +12,6 @@ void action_all_startup()
|
||||||
action_cyclewindows_startup();
|
action_cyclewindows_startup();
|
||||||
action_activate_startup();
|
action_activate_startup();
|
||||||
action_breakchroot_startup();
|
action_breakchroot_startup();
|
||||||
|
action_close_startup();
|
||||||
|
action_move_startup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,7 @@ void action_restart_startup();
|
||||||
void action_cyclewindows_startup();
|
void action_cyclewindows_startup();
|
||||||
void action_activate_startup();
|
void action_activate_startup();
|
||||||
void action_breakchroot_startup();
|
void action_breakchroot_startup();
|
||||||
|
void action_close_startup();
|
||||||
|
void action_move_startup();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
29
openbox/actions/move.c
Normal file
29
openbox/actions/move.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#include "openbox/actions.h"
|
||||||
|
#include "openbox/prop.h"
|
||||||
|
#include "openbox/moveresize.h"
|
||||||
|
|
||||||
|
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||||
|
|
||||||
|
void action_move_startup()
|
||||||
|
{
|
||||||
|
actions_register("Move",
|
||||||
|
NULL, NULL,
|
||||||
|
run_func,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Always return FALSE because its not interactive */
|
||||||
|
static gboolean run_func(ObActionsData *data, gpointer options)
|
||||||
|
{
|
||||||
|
if (data->client) {
|
||||||
|
guint32 corner;
|
||||||
|
|
||||||
|
corner = data->button != 0 ?
|
||||||
|
prop_atoms.net_wm_moveresize_move :
|
||||||
|
prop_atoms.net_wm_moveresize_move_keyboard;
|
||||||
|
|
||||||
|
moveresize_start(data->client, data->x, data->y, data->button, corner);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
#include "openbox/actions.h"
|
#include "openbox/actions.h"
|
||||||
|
#include "openbox/menu.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -49,13 +50,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
|
||||||
if (data->uact == OB_USER_ACTION_MENU_SELECTION) return FALSE;
|
if (data->uact == OB_USER_ACTION_MENU_SELECTION) return FALSE;
|
||||||
|
|
||||||
if (o->name) {
|
if (o->name) {
|
||||||
gboolean mouse = (data->uact == OB_USER_ACTION_MOUSE_PRESS ||
|
menu_show(o->name, data->x, data->y, data->button != 0, data->client);
|
||||||
data->uact == OB_USER_ACTION_MOUSE_RELEASE ||
|
|
||||||
data->uact == OB_USER_ACTION_MOUSE_CLICK ||
|
|
||||||
data->uact == OB_USER_ACTION_MOUSE_DOUBLE_CLICK ||
|
|
||||||
data->uact == OB_USER_ACTION_MOUSE_MOTION);
|
|
||||||
|
|
||||||
menu_show(o->name, data->x, data->y, mouse, data->client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -256,7 +256,7 @@ void keyboard_event(ObClient *client, const XEvent *e)
|
||||||
|
|
||||||
actions_run_acts(p->actions, OB_USER_ACTION_KEYBOARD_KEY,
|
actions_run_acts(p->actions, OB_USER_ACTION_KEYBOARD_KEY,
|
||||||
e->xkey.state, e->xkey.x_root, e->xkey.y_root,
|
e->xkey.state, e->xkey.x_root, e->xkey.y_root,
|
||||||
OB_FRAME_CONTEXT_NONE, client);
|
0, OB_FRAME_CONTEXT_NONE, client);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state)
|
||||||
func(entry, frame, client, state, data);
|
func(entry, frame, client, state, data);
|
||||||
else
|
else
|
||||||
actions_run_acts(acts, OB_USER_ACTION_MENU_SELECTION,
|
actions_run_acts(acts, OB_USER_ACTION_MENU_SELECTION,
|
||||||
state, -1, -1, OB_FRAME_CONTEXT_NONE, client);
|
state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
|
||||||
if (it == NULL) return FALSE;
|
if (it == NULL) return FALSE;
|
||||||
|
|
||||||
actions_run_acts(b->actions[a], mouse_action_to_user_action(a),
|
actions_run_acts(b->actions[a], mouse_action_to_user_action(a),
|
||||||
state, x, y, context, c);
|
state, x, y, button, context, c);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue