1999-11-18 20:05:24 -08:00
|
|
|
/*
|
2009-10-25 11:35:54 -07:00
|
|
|
* Copyright (C) 1997-2009, Michael Jennings
|
1999-08-17 18:12:47 -07:00
|
|
|
*
|
1999-11-18 20:05:24 -08:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
1999-08-17 18:12:47 -07:00
|
|
|
*
|
1999-11-18 20:05:24 -08:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
1999-08-17 18:12:47 -07:00
|
|
|
*
|
1999-11-18 20:05:24 -08:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1999-08-17 18:12:47 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ACTIONS_H_
|
|
|
|
#define _ACTIONS_H_
|
|
|
|
|
|
|
|
#include <X11/Xfuncproto.h>
|
|
|
|
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
|
2009-10-07 20:47:32 -07:00
|
|
|
#include <libast.h>
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
#include "events.h"
|
|
|
|
#include "menus.h"
|
|
|
|
|
|
|
|
/************ Macros and Definitions ************/
|
|
|
|
typedef enum {
|
2009-10-07 20:47:32 -07:00
|
|
|
ETERM_ACTION_NONE = 0,
|
|
|
|
ETERM_ACTION_STRING,
|
|
|
|
ETERM_ACTION_ECHO,
|
|
|
|
ETERM_ACTION_SCRIPT,
|
|
|
|
ETERM_ACTION_MENU
|
|
|
|
} SPIF_TYPE(eterm_action_type);
|
|
|
|
typedef SPIF_TYPE(obj) SPIF_TYPE(eterm_action_parameter);
|
|
|
|
typedef spif_func_t SPIF_TYPE(eterm_action_handler);
|
|
|
|
|
|
|
|
#define ETERM_KEYSYM_NONE (0UL)
|
|
|
|
|
|
|
|
#define ETERM_MOD_NONE (0UL)
|
|
|
|
#define ETERM_MOD_CTRL (1UL << 0)
|
|
|
|
#define ETERM_MOD_SHIFT (1UL << 1)
|
|
|
|
#define ETERM_MOD_LOCK (1UL << 2)
|
|
|
|
#define ETERM_MOD_META (1UL << 3)
|
|
|
|
#define ETERM_MOD_ALT (1UL << 4)
|
|
|
|
#define ETERM_MOD_MOD1 (1UL << 5)
|
|
|
|
#define ETERM_MOD_MOD2 (1UL << 6)
|
|
|
|
#define ETERM_MOD_MOD3 (1UL << 7)
|
|
|
|
#define ETERM_MOD_MOD4 (1UL << 8)
|
|
|
|
#define ETERM_MOD_MOD5 (1UL << 9)
|
|
|
|
#define ETERM_MOD_ANY (1UL << 10)
|
|
|
|
|
|
|
|
#define ETERM_BUTTON_NONE (0)
|
|
|
|
#define ETERM_BUTTON_ANY (0xff)
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
#define LOGICAL_XOR(a, b) !(((a) && (b)) || (!(a) && !(b)))
|
|
|
|
|
2009-10-07 20:47:32 -07:00
|
|
|
#define SHOW_MODS(m) ((m & ETERM_MOD_CTRL) ? 'C' : 'c'), ((m & ETERM_MOD_SHIFT) ? 'S' : 's'), ((m & ETERM_MOD_META) ? 'M' : 'm'), ((m & ETERM_MOD_ALT) ? 'A' : 'a')
|
Mon Jun 11 17:49:55 PDT 2001 Michael Jennings <mej@eterm.org>
Okay, first off, I removed 3 scaled backgrounds. See www.kainx.org or
my post to enlightenment-devel for details.
Second, I redid the default bindings for the mouse wheel. Basically,
the wheel alone will scroll by pages. Ctrl+wheel will scroll by pages
in groups of 5. Shift+wheel will scroll by a single line. If you
hold down the Alt key, the same combinations will work the same way,
but instead of scrolling within Eterm, they'll scroll the application
in the terminal (by sending PgUp/PgDn and up/down arrows). This works
in less, bash, and any other application which groks those keys.
I also added a --without-mousewheel option to configure that will turn
off the default scrollwheel bindings. Of course, you can always use
action bindings in the config file to bind/rebind these any way you
like.
While I was at it, I found and fixed a bug in the handling of the
Alt and Meta keys.
I added a scroll() function to the script stuff which allows you to
bind keys/buttons to scroll up and down. While I was at it, I added
comments to script.c for each function you can use.
And finally, the config file parser was moved to libast.
SVN revision: 4806
2001-06-11 18:04:45 -07:00
|
|
|
#define SHOW_X_MODS(m) ((m & ControlMask) ? 'C' : 'c'), ((m & ShiftMask) ? 'S' : 's'), ((m & MetaMask) ? 'M' : 'm'), ((m & AltMask) ? 'A' : 'a')
|
|
|
|
#define MOD_FMT "%c%c%c%c"
|
|
|
|
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-07 20:47:32 -07:00
|
|
|
|
|
|
|
/* Cast an arbitrary object pointer to a eterm_action. */
|
|
|
|
#define SPIF_ETERM_ACTION(obj) (SPIF_CAST(eterm_action) (obj))
|
|
|
|
|
|
|
|
/* Check to see if a pointer references a eterm_actioning object. */
|
|
|
|
#define SPIF_OBJ_IS_ETERM_ACTION(obj) (SPIF_OBJ_IS_TYPE(obj, eterm_action))
|
|
|
|
|
|
|
|
/* Check for NULL eterm_action object */
|
|
|
|
#define SPIF_ETERM_ACTION_ISNULL(s) SPIF_OBJ_ISNULL(SPIF_OBJ(s))
|
|
|
|
|
|
|
|
SPIF_DECL_OBJ(eterm_action) {
|
|
|
|
SPIF_DECL_PARENT_TYPE(obj);
|
|
|
|
SPIF_DECL_PROPERTY(eterm_action_type, type);
|
|
|
|
SPIF_DECL_PROPERTY(ushort, modifiers);
|
|
|
|
SPIF_DECL_PROPERTY(uchar, button);
|
|
|
|
SPIF_DECL_PROPERTY_C(KeySym, keysym);
|
|
|
|
SPIF_DECL_PROPERTY(eterm_action_handler, handler);
|
|
|
|
SPIF_DECL_PROPERTY(obj, parameter);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern spif_vector_t actions;
|
|
|
|
extern spif_class_t SPIF_CLASS_VAR(eterm_action);
|
|
|
|
extern spif_eterm_action_t spif_eterm_action_new(void);
|
|
|
|
extern spif_eterm_action_t spif_eterm_action_new_from_data(spif_eterm_action_type_t, spif_ushort_t,
|
|
|
|
spif_uchar_t, KeySym, spif_ptr_t);
|
|
|
|
extern spif_bool_t spif_eterm_action_del(spif_eterm_action_t);
|
|
|
|
extern spif_bool_t spif_eterm_action_init(spif_eterm_action_t);
|
|
|
|
extern spif_bool_t spif_eterm_action_init_from_data(spif_eterm_action_t, spif_eterm_action_type_t,
|
|
|
|
spif_ushort_t, spif_uchar_t, KeySym, spif_ptr_t);
|
|
|
|
extern spif_bool_t spif_eterm_action_done(spif_eterm_action_t);
|
|
|
|
extern spif_eterm_action_t spif_eterm_action_dup(spif_eterm_action_t);
|
|
|
|
extern spif_cmp_t spif_eterm_action_comp(spif_eterm_action_t, spif_eterm_action_t);
|
|
|
|
extern spif_str_t spif_eterm_action_show(spif_eterm_action_t, spif_charptr_t, spif_str_t, size_t);
|
|
|
|
extern spif_classname_t spif_eterm_action_type(spif_eterm_action_t);
|
|
|
|
SPIF_DECL_PROPERTY_FUNC(eterm_action, eterm_action_type, type);
|
|
|
|
SPIF_DECL_PROPERTY_FUNC(eterm_action, ushort, modifiers);
|
|
|
|
SPIF_DECL_PROPERTY_FUNC(eterm_action, uchar, button);
|
|
|
|
SPIF_DECL_PROPERTY_FUNC_C(eterm_action, KeySym, keysym);
|
|
|
|
SPIF_DECL_PROPERTY_FUNC(eterm_action, eterm_action_handler, handler);
|
|
|
|
SPIF_DECL_PROPERTY_FUNC(eterm_action, eterm_action_parameter, parameter);
|
|
|
|
|
|
|
|
extern spif_bool_t eterm_action_dispatch(event_t *ev);
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
#endif /* _ACTIONS_H_ */
|