2003-09-17 07:44:49 +00:00
|
|
|
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
|
2003-09-17 07:32:52 +00:00
|
|
|
|
|
|
|
action.h for the Openbox window manager
|
2006-08-22 16:44:18 +00:00
|
|
|
Copyright (c) 2006 Mikael Magnusson
|
2007-04-23 17:56:35 +00:00
|
|
|
Copyright (c) 2003-2007 Dana Jansens
|
2003-09-17 07:32:52 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
See the COPYING file for a copy of the GNU General Public License.
|
|
|
|
*/
|
|
|
|
|
2003-03-18 08:39:28 +00:00
|
|
|
#ifndef __action_h
|
|
|
|
#define __action_h
|
|
|
|
|
2003-07-10 17:03:05 +00:00
|
|
|
#include "misc.h"
|
2003-09-07 19:03:20 +00:00
|
|
|
#include "frame.h"
|
2003-05-24 21:47:06 +00:00
|
|
|
#include "parser/parse.h"
|
2003-03-18 08:39:28 +00:00
|
|
|
|
2003-09-07 19:03:20 +00:00
|
|
|
struct _ObClient;
|
|
|
|
|
2003-08-12 07:26:16 +00:00
|
|
|
typedef struct _ObAction ObAction;
|
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
/* These have to all have a Client* at the top even if they don't use it, so
|
|
|
|
that I can set it blindly later on. So every function will have a Client*
|
|
|
|
available (possibly NULL though) if it wants it.
|
|
|
|
*/
|
|
|
|
|
2003-09-24 18:20:49 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
OB_CLIENT_ACTION_NO,
|
|
|
|
OB_CLIENT_ACTION_OPTIONAL,
|
|
|
|
OB_CLIENT_ACTION_ALWAYS
|
|
|
|
} ObClientActionReq;
|
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
struct AnyAction {
|
2003-09-24 18:20:49 +00:00
|
|
|
ObClientActionReq client_action;
|
2003-07-10 17:03:05 +00:00
|
|
|
struct _ObClient *c;
|
2003-09-21 19:38:57 +00:00
|
|
|
ObFrameContext context;
|
2003-08-30 16:58:30 +00:00
|
|
|
gboolean interactive;
|
2003-09-07 19:03:20 +00:00
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
gint button;
|
2007-03-11 04:44:15 +00:00
|
|
|
Time time;
|
2003-08-30 16:58:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct InteractiveAction {
|
|
|
|
struct AnyAction any;
|
|
|
|
gboolean final;
|
|
|
|
gboolean cancel;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
2003-08-31 18:54:26 +00:00
|
|
|
struct InterDirectionalAction{
|
|
|
|
struct InteractiveAction inter;
|
|
|
|
ObDirection direction;
|
2003-09-26 20:04:29 +00:00
|
|
|
gboolean dialog;
|
2007-04-23 22:40:33 +00:00
|
|
|
gboolean dock_windows;
|
2003-08-31 18:54:26 +00:00
|
|
|
};
|
|
|
|
|
2003-05-21 03:58:32 +00:00
|
|
|
struct DirectionalAction{
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-07-10 06:18:47 +00:00
|
|
|
ObDirection direction;
|
2006-10-31 03:33:21 +00:00
|
|
|
gboolean hang;
|
2003-05-19 03:52:25 +00:00
|
|
|
};
|
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
struct Execute {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-10-15 03:59:35 +00:00
|
|
|
gchar *path;
|
2007-03-11 15:41:47 +00:00
|
|
|
gboolean startupnotify;
|
|
|
|
gchar *name;
|
|
|
|
gchar *icon_name;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ClientAction {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
2003-08-14 05:53:32 +00:00
|
|
|
struct Activate {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-08-14 05:53:32 +00:00
|
|
|
gboolean here; /* bring it to the current desktop */
|
|
|
|
};
|
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
struct MoveResizeRelative {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2006-08-02 16:36:40 +00:00
|
|
|
gint deltax;
|
|
|
|
gint deltay;
|
|
|
|
gint deltaxl;
|
|
|
|
gint deltayu;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
2003-03-29 21:18:20 +00:00
|
|
|
struct SendToDesktop {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-03-29 21:18:20 +00:00
|
|
|
guint desk;
|
|
|
|
gboolean follow;
|
|
|
|
};
|
|
|
|
|
2003-05-24 09:11:42 +00:00
|
|
|
struct SendToDesktopDirection {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct InteractiveAction inter;
|
2003-08-12 07:26:16 +00:00
|
|
|
ObDirection dir;
|
2003-03-19 04:16:19 +00:00
|
|
|
gboolean wrap;
|
2003-08-12 07:26:16 +00:00
|
|
|
gboolean linear;
|
2003-08-28 05:43:05 +00:00
|
|
|
gboolean follow;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Desktop {
|
2003-09-26 07:41:32 +00:00
|
|
|
struct InteractiveAction inter;
|
2003-03-19 04:16:19 +00:00
|
|
|
guint desk;
|
|
|
|
};
|
|
|
|
|
2003-05-22 02:22:43 +00:00
|
|
|
struct Layer {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-10-15 03:59:35 +00:00
|
|
|
gint layer; /* < 0 = below, 0 = normal, > 0 = above */
|
2003-05-22 02:22:43 +00:00
|
|
|
};
|
|
|
|
|
2003-05-24 09:11:42 +00:00
|
|
|
struct DesktopDirection {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct InteractiveAction inter;
|
2003-08-12 07:26:16 +00:00
|
|
|
ObDirection dir;
|
2003-03-19 04:16:19 +00:00
|
|
|
gboolean wrap;
|
2003-08-12 07:26:16 +00:00
|
|
|
gboolean linear;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
2003-04-17 05:28:35 +00:00
|
|
|
struct MoveResize {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-09-07 19:03:20 +00:00
|
|
|
gboolean move;
|
|
|
|
gboolean keyboard;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
2003-03-29 03:18:11 +00:00
|
|
|
struct ShowMenu {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct AnyAction any;
|
2003-10-15 03:59:35 +00:00
|
|
|
gchar *name;
|
2003-04-05 20:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CycleWindows {
|
2003-08-30 16:58:30 +00:00
|
|
|
struct InteractiveAction inter;
|
2003-04-05 20:27:03 +00:00
|
|
|
gboolean linear;
|
|
|
|
gboolean forward;
|
2003-09-26 20:04:29 +00:00
|
|
|
gboolean dialog;
|
2007-04-23 22:40:33 +00:00
|
|
|
gboolean dock_windows;
|
2003-03-29 03:18:11 +00:00
|
|
|
};
|
|
|
|
|
2005-02-08 04:33:54 +00:00
|
|
|
struct Stacking {
|
|
|
|
struct AnyAction any;
|
|
|
|
};
|
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
union ActionData {
|
|
|
|
struct AnyAction any;
|
2003-08-30 16:58:30 +00:00
|
|
|
struct InteractiveAction inter;
|
2003-08-31 18:54:26 +00:00
|
|
|
struct InterDirectionalAction interdiraction;
|
2003-05-21 03:58:32 +00:00
|
|
|
struct DirectionalAction diraction;
|
2003-03-19 04:16:19 +00:00
|
|
|
struct Execute execute;
|
|
|
|
struct ClientAction client;
|
2003-08-14 05:53:32 +00:00
|
|
|
struct Activate activate;
|
2003-03-19 04:16:19 +00:00
|
|
|
struct MoveResizeRelative relative;
|
2003-03-29 21:18:20 +00:00
|
|
|
struct SendToDesktop sendto;
|
2003-05-24 09:11:42 +00:00
|
|
|
struct SendToDesktopDirection sendtodir;
|
2003-03-19 04:16:19 +00:00
|
|
|
struct Desktop desktop;
|
2003-05-24 09:11:42 +00:00
|
|
|
struct DesktopDirection desktopdir;
|
2003-04-17 05:28:35 +00:00
|
|
|
struct MoveResize moveresize;
|
2003-04-15 18:29:55 +00:00
|
|
|
struct ShowMenu showmenu;
|
2003-04-05 20:27:03 +00:00
|
|
|
struct CycleWindows cycle;
|
2003-05-22 02:22:43 +00:00
|
|
|
struct Layer layer;
|
2005-02-08 04:33:54 +00:00
|
|
|
struct Stacking stacking;
|
2003-03-19 04:16:19 +00:00
|
|
|
};
|
|
|
|
|
2003-08-12 07:26:16 +00:00
|
|
|
struct _ObAction {
|
2003-09-26 16:47:12 +00:00
|
|
|
guint ref;
|
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
/* The func member acts like an enum to tell which one of the structs in
|
|
|
|
the data union are valid.
|
|
|
|
*/
|
|
|
|
void (*func)(union ActionData *data);
|
|
|
|
union ActionData data;
|
2003-08-12 07:26:16 +00:00
|
|
|
};
|
2003-03-18 08:39:28 +00:00
|
|
|
|
2003-03-26 12:53:04 +00:00
|
|
|
/* Creates a new Action from the name of the action
|
|
|
|
A few action types need data set after making this call still. Check if
|
|
|
|
the returned action's "func" is one of these.
|
|
|
|
action_execute - the path needs to be set
|
|
|
|
action_restart - the path can optionally be set
|
|
|
|
action_desktop - the destination desktop needs to be set
|
2003-09-07 19:03:20 +00:00
|
|
|
action_send_to_desktop - the destination desktop needs to be set
|
2003-03-26 13:14:50 +00:00
|
|
|
action_move_relative_horz - the delta
|
|
|
|
action_move_relative_vert - the delta
|
|
|
|
action_resize_relative_horz - the delta
|
|
|
|
action_resize_relative_vert - the delta
|
2006-08-02 20:54:16 +00:00
|
|
|
action_move_relative - the deltas
|
|
|
|
action_resize_relative - the deltas
|
2003-03-26 12:53:04 +00:00
|
|
|
*/
|
2003-05-19 03:52:25 +00:00
|
|
|
|
2003-09-26 17:29:33 +00:00
|
|
|
ObAction* action_from_string(const gchar *name, ObUserAction uact);
|
|
|
|
ObAction* action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
2003-09-07 19:03:20 +00:00
|
|
|
ObUserAction uact);
|
2003-09-26 16:47:12 +00:00
|
|
|
void action_ref(ObAction *a);
|
|
|
|
void action_unref(ObAction *a);
|
2003-03-19 04:16:19 +00:00
|
|
|
|
2003-09-26 17:29:33 +00:00
|
|
|
ObAction* action_copy(const ObAction *a);
|
|
|
|
|
2003-09-19 17:40:26 +00:00
|
|
|
/*! Executes a list of actions.
|
2003-09-07 19:03:20 +00:00
|
|
|
@param c The client associated with the action. Can be NULL.
|
|
|
|
@param state The keyboard modifiers state at the time the user action occured
|
|
|
|
@param button The mouse button used to execute the action.
|
|
|
|
@param x The x coord at which the user action occured.
|
|
|
|
@param y The y coord at which the user action occured.
|
|
|
|
@param cancel If the action is cancelling an interactive action. This only
|
|
|
|
affects interactive actions, but should generally always be FALSE.
|
|
|
|
@param done If the action is completing an interactive action. This only
|
|
|
|
affects interactive actions, but should generally always be FALSE.
|
|
|
|
*/
|
2003-09-21 19:38:57 +00:00
|
|
|
void action_run_list(GSList *acts, struct _ObClient *c, ObFrameContext context,
|
2007-03-25 15:16:00 +00:00
|
|
|
guint state, guint button, gint x, gint y, Time time,
|
2003-09-07 19:03:20 +00:00
|
|
|
gboolean cancel, gboolean done);
|
|
|
|
|
2007-03-11 04:44:15 +00:00
|
|
|
#define action_run_mouse(a, c, n, s, b, x, y, t) \
|
|
|
|
action_run_list(a, c, n, s, b, x, y, t, FALSE, FALSE)
|
2003-09-07 19:03:20 +00:00
|
|
|
|
2007-03-11 04:44:15 +00:00
|
|
|
#define action_run_interactive(a, c, s, t, n, d) \
|
|
|
|
action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, t, n, d)
|
2003-09-07 19:03:20 +00:00
|
|
|
|
2007-03-11 04:44:15 +00:00
|
|
|
#define action_run_key(a, c, s, x, y, t) \
|
2007-03-25 15:16:00 +00:00
|
|
|
action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, t, FALSE, FALSE)
|
2003-09-07 19:03:20 +00:00
|
|
|
|
2007-03-11 04:44:15 +00:00
|
|
|
#define action_run(a, c, s, t) \
|
|
|
|
action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, t, FALSE, FALSE)
|
2003-09-07 19:03:20 +00:00
|
|
|
|
2007-03-11 04:44:15 +00:00
|
|
|
void action_run_string(const gchar *name, struct _ObClient *c, Time time);
|
2003-09-26 18:02:39 +00:00
|
|
|
|
2003-03-19 04:16:19 +00:00
|
|
|
/* Execute */
|
|
|
|
void action_execute(union ActionData *data);
|
2003-08-14 05:53:32 +00:00
|
|
|
/* ActivateAction */
|
2003-08-14 05:34:51 +00:00
|
|
|
void action_activate(union ActionData *data);
|
2003-03-19 04:16:19 +00:00
|
|
|
/* ClientAction */
|
2003-03-19 06:01:06 +00:00
|
|
|
void action_focus(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_unfocus(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-03-19 04:16:19 +00:00
|
|
|
void action_iconify(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2005-03-11 21:49:54 +00:00
|
|
|
void action_focus_order_to_bottom(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-08-20 23:02:26 +00:00
|
|
|
void action_raiselower(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-03-19 04:16:19 +00:00
|
|
|
void action_raise(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_lower(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_close(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-03-22 06:58:38 +00:00
|
|
|
void action_kill(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-03-19 04:16:19 +00:00
|
|
|
void action_shade(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-03-29 00:58:50 +00:00
|
|
|
void action_shadelower(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_unshaderaise(union ActionData *data);
|
|
|
|
/* ClientAction */
|
2003-03-19 04:16:19 +00:00
|
|
|
void action_unshade(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_shade(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_omnipresent(union ActionData *data);
|
|
|
|
/* MoveResizeRelative */
|
2003-03-26 13:13:45 +00:00
|
|
|
void action_move_relative_horz(union ActionData *data);
|
2003-03-19 04:16:19 +00:00
|
|
|
/* MoveResizeRelative */
|
2003-03-26 13:13:45 +00:00
|
|
|
void action_move_relative_vert(union ActionData *data);
|
2006-08-02 20:54:16 +00:00
|
|
|
/* MoveResizeRelative */
|
|
|
|
void action_move_relative(union ActionData *data);
|
|
|
|
/* MoveResizeRelative */
|
|
|
|
void action_resize_relative(union ActionData *data);
|
2005-01-31 19:04:18 +00:00
|
|
|
/* ClientAction */
|
|
|
|
void action_move_to_center(union ActionData *data);
|
2003-03-26 13:13:45 +00:00
|
|
|
/* MoveResizeRelative */
|
|
|
|
void action_resize_relative_horz(union ActionData *data);
|
|
|
|
/* MoveResizeRelative */
|
|
|
|
void action_resize_relative_vert(union ActionData *data);
|
2003-03-19 04:16:19 +00:00
|
|
|
/* ClientAction */
|
|
|
|
void action_maximize_full(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_unmaximize_full(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_maximize_full(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_maximize_horz(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_unmaximize_horz(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_maximize_horz(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_maximize_vert(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_unmaximize_vert(union ActionData *data);
|
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_maximize_vert(union ActionData *data);
|
2004-08-17 21:33:55 +00:00
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_fullscreen(union ActionData *data);
|
2003-03-29 21:18:20 +00:00
|
|
|
/* SendToDesktop */
|
2003-03-19 04:16:19 +00:00
|
|
|
void action_send_to_desktop(union ActionData *data);
|
2003-05-24 09:11:42 +00:00
|
|
|
/* SendToDesktopDirection */
|
2003-08-12 07:26:16 +00:00
|
|
|
void action_send_to_desktop_dir(union ActionData *data);
|
2003-03-19 04:16:19 +00:00
|
|
|
/* Desktop */
|
|
|
|
void action_desktop(union ActionData *data);
|
2003-05-24 09:11:42 +00:00
|
|
|
/* DesktopDirection */
|
2003-08-12 07:26:16 +00:00
|
|
|
void action_desktop_dir(union ActionData *data);
|
2003-08-31 20:06:42 +00:00
|
|
|
/* Any */
|
|
|
|
void action_desktop_last(union ActionData *data);
|
2003-03-19 04:16:19 +00:00
|
|
|
/* ClientAction */
|
|
|
|
void action_toggle_decorations(union ActionData *data);
|
2003-04-17 05:28:35 +00:00
|
|
|
/* MoveResize */
|
|
|
|
void action_moveresize(union ActionData *data);
|
2003-09-03 18:11:39 +00:00
|
|
|
/* Any */
|
|
|
|
void action_reconfigure(union ActionData *data);
|
2003-03-24 00:01:55 +00:00
|
|
|
/* Execute */
|
|
|
|
void action_restart(union ActionData *data);
|
|
|
|
/* Any */
|
|
|
|
void action_exit(union ActionData *data);
|
2003-03-29 03:18:11 +00:00
|
|
|
/* ShowMenu */
|
|
|
|
void action_showmenu(union ActionData *data);
|
2003-04-05 20:27:03 +00:00
|
|
|
/* CycleWindows */
|
|
|
|
void action_cycle_windows(union ActionData *data);
|
2003-08-31 18:54:26 +00:00
|
|
|
/* InterDirectionalAction */
|
2003-05-19 03:52:25 +00:00
|
|
|
void action_directional_focus(union ActionData *data);
|
2003-05-22 02:22:43 +00:00
|
|
|
/* DirectionalAction */
|
2003-05-21 03:58:32 +00:00
|
|
|
void action_movetoedge(union ActionData *data);
|
2003-08-12 08:46:21 +00:00
|
|
|
/* DirectionalAction */
|
|
|
|
void action_growtoedge(union ActionData *data);
|
2003-05-22 02:22:43 +00:00
|
|
|
/* Layer */
|
|
|
|
void action_send_to_layer(union ActionData *data);
|
|
|
|
/* Layer */
|
|
|
|
void action_toggle_layer(union ActionData *data);
|
2003-05-24 09:22:19 +00:00
|
|
|
/* Any */
|
2004-03-27 15:25:39 +00:00
|
|
|
void action_toggle_dockautohide(union ActionData *data);
|
|
|
|
/* Any */
|
2003-05-24 09:22:19 +00:00
|
|
|
void action_toggle_show_desktop(union ActionData *data);
|
|
|
|
/* Any */
|
|
|
|
void action_show_desktop(union ActionData *data);
|
|
|
|
/* Any */
|
|
|
|
void action_unshow_desktop(union ActionData *data);
|
|
|
|
|
2003-03-18 08:39:28 +00:00
|
|
|
#endif
|