Reload keybindings on MappingNotify.

SVN revision: 38356
This commit is contained in:
Kim Woelders 2008-12-30 16:19:33 +00:00
parent 99e1576927
commit 4f71661dfe
5 changed files with 30 additions and 0 deletions

View File

@ -303,6 +303,7 @@ typedef struct {
int mask_alpha_threshold;
char enable_startup_id;
char use_render_for_scaling;
char bindings_reload;
unsigned int no_sync_mask;
} testing;

View File

@ -30,6 +30,7 @@
#include "ewins.h"
#include "file.h"
#include "grabs.h"
#include "timers.h"
#include <ctype.h>
typedef struct _actiontype {
@ -1102,6 +1103,22 @@ ActionclassesGlobalEvent(XEvent * ev)
return match;
}
static int
_ac_reload(void *data __UNUSED__)
{
AclassConfigLoadConfig("bindings.cfg");
return 0;
}
void
ActionclassesReload(void)
{
static Timer *ac_reload_timer;
TIMER_DEL(ac_reload_timer);
TIMER_ADD(ac_reload_timer, 0.2, _ac_reload, NULL);
}
/*
* Actions module
*/

View File

@ -47,6 +47,7 @@ Action *ActionclassGetAction(ActionClass * ac, int ix);
int ActionclassEvent(ActionClass * ac, XEvent * ev,
EWin * ewin);
int ActionclassesGlobalEvent(XEvent * ev);
void ActionclassesReload(void);
const char *ActionGetTooltipString(Action * aa);
int ActionGetAnybutton(Action * aa);

View File

@ -422,6 +422,11 @@ HandleEvent(XEvent * ev)
EUnregisterXwin(ev->xdestroywindow.window);
break;
#endif
case MappingNotify:
if (Conf.testing.bindings_reload)
ActionclassesReload();
break;
}
}
@ -998,6 +1003,11 @@ EventShow(const XEvent * ev)
ev->xclient.data.l[4]);
XFree(txt);
break;
case MappingNotify:
Eprintf("%s req=%d first=%d count=%d\n",
buf, ev->xmapping.request,
ev->xmapping.first_keycode, ev->xmapping.count);
break;
case EX_EVENT_SHAPE_NOTIFY:
#define se ((XShapeEvent *)ev)

View File

@ -202,6 +202,7 @@ static const CfgItem MiscCfgItems[] = {
CFG_ITEM_INT(Conf, testing.mask_alpha_threshold, 8),
CFG_ITEM_BOOL(Conf, testing.enable_startup_id, 1),
CFG_ITEM_BOOL(Conf, testing.use_render_for_scaling, 0),
CFG_ITEM_BOOL(Conf, testing.bindings_reload, 1),
CFG_ITEM_HEX(Conf, testing.no_sync_mask, 0),
CFG_ITEM_BOOL(Conf, autosave, 1),