Revert all commits for the Hooks feature to move it to a topic branch.
This reverts commitfd2f617be7
. This reverts commita47d0a5365
. This reverts commita1908e0767
. This reverts commitdc2e6f6bf7
. This reverts commit985e7dadf9
. This reverts commitdb781556d6
. This reverts commitfeec8f663f
.
This commit is contained in:
parent
fa0ae17adb
commit
c828154886
11 changed files with 2 additions and 259 deletions
|
@ -241,8 +241,6 @@ openbox_openbox_SOURCES = \
|
|||
openbox/grab.h \
|
||||
openbox/group.c \
|
||||
openbox/group.h \
|
||||
openbox/hooks.c \
|
||||
openbox/hooks.h \
|
||||
openbox/keyboard.c \
|
||||
openbox/keyboard.h \
|
||||
openbox/keytree.c \
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "focus.h"
|
||||
#include "stacking.h"
|
||||
#include "openbox.h"
|
||||
#include "hooks.h"
|
||||
#include "group.h"
|
||||
#include "config.h"
|
||||
#include "menuframe.h"
|
||||
|
@ -585,8 +584,6 @@ void client_manage(Window window, ObPrompt *prompt)
|
|||
|
||||
ob_debug("Managed window 0x%lx plate 0x%x (%s)",
|
||||
window, self->frame->window, self->class);
|
||||
|
||||
hooks_queue(OB_HOOK_WIN_NEW, self);
|
||||
}
|
||||
|
||||
ObClient *client_fake_manage(Window window)
|
||||
|
@ -661,9 +658,6 @@ void client_unmanage(ObClient *self)
|
|||
if (!self->prompt)
|
||||
XChangeSaveSet(obt_display, self->window, SetModeDelete);
|
||||
|
||||
/* this can't be queued to run later */
|
||||
hooks_run(OB_HOOK_WIN_CLOSE, self);
|
||||
|
||||
/* update the focus lists */
|
||||
focus_order_remove(self);
|
||||
if (client_focused(self)) {
|
||||
|
@ -2546,8 +2540,6 @@ gboolean client_show(ObClient *self)
|
|||
desktop!
|
||||
*/
|
||||
client_change_wm_state(self);
|
||||
|
||||
hooks_queue(OB_HOOK_WIN_VISIBLE, self);
|
||||
}
|
||||
return show;
|
||||
}
|
||||
|
@ -2586,8 +2578,6 @@ gboolean client_hide(ObClient *self)
|
|||
desktop!
|
||||
*/
|
||||
client_change_wm_state(self);
|
||||
|
||||
hooks_queue(OB_HOOK_WIN_INVISIBLE, self);
|
||||
}
|
||||
return hide;
|
||||
}
|
||||
|
@ -3181,9 +3171,6 @@ static void client_iconify_recursive(ObClient *self,
|
|||
frame_begin_iconify_animation(self->frame, iconic);
|
||||
/* do this after starting the animation so it doesn't flash */
|
||||
client_showhide(self);
|
||||
|
||||
hooks_queue((iconic ? OB_HOOK_WIN_ICONIC : OB_HOOK_WIN_UNICONIC),
|
||||
self);
|
||||
}
|
||||
|
||||
/* iconify all direct transients, and deiconify all transients
|
||||
|
@ -3271,8 +3258,6 @@ void client_maximize(ObClient *self, gboolean max, gint dir)
|
|||
|
||||
client_setup_decor_and_functions(self, FALSE);
|
||||
client_move_resize(self, x, y, w, h);
|
||||
|
||||
hooks_queue((max ? OB_HOOK_WIN_MAX : OB_HOOK_WIN_UNMAX), self);
|
||||
}
|
||||
|
||||
void client_shade(ObClient *self, gboolean shade)
|
||||
|
@ -3286,8 +3271,6 @@ void client_shade(ObClient *self, gboolean shade)
|
|||
client_change_wm_state(self); /* the window is being hidden/shown */
|
||||
/* resize the frame to just the titlebar */
|
||||
frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
|
||||
|
||||
hooks_queue((shade ? OB_HOOK_WIN_SHADE : OB_HOOK_WIN_UNSHADE), self);
|
||||
}
|
||||
|
||||
static void client_ping_event(ObClient *self, gboolean dead)
|
||||
|
@ -3499,9 +3482,6 @@ static void client_set_desktop_recursive(ObClient *self,
|
|||
/* the new desktop's geometry may be different, so we may need to
|
||||
resize, for example if we are maximized */
|
||||
client_reconfigure(self, FALSE);
|
||||
|
||||
if (old != self->desktop)
|
||||
hooks_queue(OB_HOOK_WIN_DESK_CHANGE, self);
|
||||
}
|
||||
|
||||
/* move all transients */
|
||||
|
@ -3928,9 +3908,6 @@ void client_set_undecorated(ObClient *self, gboolean undecorated)
|
|||
self->undecorated = undecorated;
|
||||
client_setup_decor_and_functions(self, TRUE);
|
||||
client_change_state(self); /* reflect this in the state hints */
|
||||
|
||||
hooks_queue((undecorated ?
|
||||
OB_HOOK_WIN_UNDECORATED : OB_HOOK_WIN_DECORATED), self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "mouse.h"
|
||||
#include "actions.h"
|
||||
#include "translate.h"
|
||||
#include "hooks.h"
|
||||
#include "client.h"
|
||||
#include "screen.h"
|
||||
#include "openbox.h"
|
||||
|
@ -345,47 +344,6 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d)
|
|||
}
|
||||
}
|
||||
|
||||
static void parse_hook(xmlNodePtr node, gpointer d)
|
||||
{
|
||||
gchar *name;
|
||||
ObHook hook;
|
||||
xmlNodePtr n;
|
||||
|
||||
|
||||
if (!obt_parse_attr_string(node, "name", &name)) {
|
||||
g_message(_("Hook in config file is missing a name"));
|
||||
return;
|
||||
}
|
||||
|
||||
hook = hooks_hook_from_name(name);
|
||||
if (!hook)
|
||||
g_message(_("Unknown hook \"%s\" in config file"), name);
|
||||
else {
|
||||
if ((n = obt_parse_find_node(node->children, "action")))
|
||||
while (n) {
|
||||
ObActionsAct *action;
|
||||
|
||||
action = actions_parse(n);
|
||||
if (action)
|
||||
hooks_add(hook, action);
|
||||
n = obt_parse_find_node(n->next, "action");
|
||||
}
|
||||
}
|
||||
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
static void parse_hooks(xmlNodePtr node, gpointer d)
|
||||
{
|
||||
xmlNodePtr n;
|
||||
|
||||
if ((n = obt_parse_find_node(node->children, "hook")))
|
||||
while (n) {
|
||||
parse_hook(n, NULL);
|
||||
n = obt_parse_find_node(n->next, "hook");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
<keybind key="C-x">
|
||||
|
@ -1039,8 +997,6 @@ void config_startup(ObtParseInst *i)
|
|||
|
||||
obt_parse_register(i, "menu", parse_menu, NULL);
|
||||
|
||||
obt_parse_register(i, "hooks", parse_hooks, NULL);
|
||||
|
||||
config_per_app_settings = NULL;
|
||||
|
||||
obt_parse_register(i, "applications", parse_per_app_settings, NULL);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "menuframe.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "hooks.h"
|
||||
#include "focus.h"
|
||||
#include "focus_cycle.h"
|
||||
#include "moveresize.h"
|
||||
|
@ -743,11 +742,6 @@ static void event_process(const XEvent *ec, gpointer data)
|
|||
e->type == MotionNotify)
|
||||
event_handle_user_input(client, e);
|
||||
|
||||
XFlush(obt_display);
|
||||
|
||||
/* run all the hooks at once */
|
||||
hooks_run_queue();
|
||||
|
||||
/* if something happens and it's not from an XEvent, then we don't know
|
||||
the time */
|
||||
event_curtime = CurrentTime;
|
||||
|
@ -1916,16 +1910,11 @@ static void event_handle_user_input(ObClient *client, XEvent *e)
|
|||
if (!client || !frame_iconify_animating(client->frame))
|
||||
mouse_event(client, e);
|
||||
} else
|
||||
keyboard_event(event_target_client(client), e);
|
||||
keyboard_event((focus_cycle_target ? focus_cycle_target :
|
||||
(client ? client : focus_client)), e);
|
||||
}
|
||||
}
|
||||
|
||||
ObClient* event_target_client(ObClient *client)
|
||||
{
|
||||
return (focus_cycle_target ? focus_cycle_target :
|
||||
(client ? client : focus_client));
|
||||
}
|
||||
|
||||
static void focus_delay_dest(gpointer data)
|
||||
{
|
||||
g_free(data);
|
||||
|
|
|
@ -64,8 +64,4 @@ gboolean event_time_after(guint32 t1, guint32 t2);
|
|||
|
||||
Time event_get_server_time(void);
|
||||
|
||||
/*! Given a possible target client, returns what the target client really
|
||||
should be for actions */
|
||||
struct _ObClient* event_target_client(struct _ObClient *client);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "focus_cycle.h"
|
||||
#include "screen.h"
|
||||
#include "keyboard.h"
|
||||
#include "hooks.h"
|
||||
#include "focus.h"
|
||||
#include "stacking.h"
|
||||
#include "obt/prop.h"
|
||||
|
@ -73,7 +72,6 @@ static void push_to_top(ObClient *client)
|
|||
void focus_set_client(ObClient *client)
|
||||
{
|
||||
Window active;
|
||||
ObClient *old;
|
||||
|
||||
ob_debug_type(OB_DEBUG_FOCUS,
|
||||
"focus_set_client 0x%lx", client ? client->window : 0);
|
||||
|
@ -89,7 +87,6 @@ void focus_set_client(ObClient *client)
|
|||
focus_cycle_stop(focus_client);
|
||||
focus_cycle_stop(client);
|
||||
|
||||
old = focus_client;
|
||||
focus_client = client;
|
||||
|
||||
if (client != NULL) {
|
||||
|
@ -104,9 +101,6 @@ void focus_set_client(ObClient *client)
|
|||
active = client ? client->window : None;
|
||||
OBT_PROP_SET32(obt_root(ob_screen), NET_ACTIVE_WINDOW, WINDOW, active);
|
||||
}
|
||||
|
||||
hooks_queue(OB_HOOK_WIN_UNFOCUS, old);
|
||||
hooks_queue(OB_HOOK_WIN_FOCUS, client);
|
||||
}
|
||||
|
||||
static ObClient* focus_fallback_target(gboolean allow_refocus,
|
||||
|
|
118
openbox/hooks.c
118
openbox/hooks.c
|
@ -1,118 +0,0 @@
|
|||
#include "hooks.h"
|
||||
#include "actions.h"
|
||||
#include "client.h"
|
||||
#include "focus.h"
|
||||
#include "debug.h"
|
||||
#include "obt/display.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static GSList *hooks[OB_NUM_HOOKS];
|
||||
static const gchar *names[OB_NUM_HOOKS];
|
||||
|
||||
typedef struct {
|
||||
ObHook hook;
|
||||
struct _ObClient *client;
|
||||
} ObHookQueue;
|
||||
|
||||
#define QUEUE_SIZE 20
|
||||
ObHookQueue run_queue[QUEUE_SIZE];
|
||||
gint queue_size;
|
||||
|
||||
void hooks_startup(gboolean reconfig)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < OB_NUM_HOOKS; ++i)
|
||||
hooks[i] = NULL;
|
||||
|
||||
queue_size = 0;
|
||||
|
||||
names[OB_HOOK_WIN_NEW] = "WindowNew";
|
||||
names[OB_HOOK_WIN_CLOSE] = "WindowClosed";
|
||||
names[OB_HOOK_WIN_VISIBLE] = "WindowVisible";
|
||||
names[OB_HOOK_WIN_INVISIBLE] = "WindowInvisible";
|
||||
names[OB_HOOK_WIN_ICONIC] = "WindowIconified";
|
||||
names[OB_HOOK_WIN_UNICONIC] = "WindowUniconified";
|
||||
names[OB_HOOK_WIN_MAX] = "WindowMaximized";
|
||||
names[OB_HOOK_WIN_UNMAX] = "WindowUnmaximized";
|
||||
names[OB_HOOK_WIN_SHADE] = "WindowShaded";
|
||||
names[OB_HOOK_WIN_UNSHADE] = "WindowUnshaded";
|
||||
names[OB_HOOK_WIN_FOCUS] = "WindowFocused";
|
||||
names[OB_HOOK_WIN_UNFOCUS] = "WindowUnfocused";
|
||||
names[OB_HOOK_WIN_DESK_CHANGE] = "WindowOnNewDesktop";
|
||||
names[OB_HOOK_WIN_DECORATED] = "WindowDecorated";
|
||||
names[OB_HOOK_WIN_UNDECORATED] = "WindowUndecorated";
|
||||
names[OB_HOOK_SCREEN_DESK_CHANGE] = "DesktopChanged";
|
||||
}
|
||||
|
||||
void hooks_shutdown(gboolean reconfig)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < OB_NUM_HOOKS; ++i)
|
||||
while (hooks[i]) {
|
||||
actions_act_unref(hooks[i]->data);
|
||||
hooks[i] = g_slist_delete_link(hooks[i], hooks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ObHook hooks_hook_from_name(const gchar *n)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 1; i < OB_NUM_HOOKS; ++i)
|
||||
if (!g_ascii_strcasecmp(n, names[i]))
|
||||
return (ObHook)i;
|
||||
return OB_HOOK_INVALID;
|
||||
}
|
||||
|
||||
void hooks_queue(ObHook hook, struct _ObClient *client)
|
||||
{
|
||||
ObHookQueue *q;
|
||||
|
||||
g_assert(hook < OB_NUM_HOOKS && hook > OB_HOOK_INVALID);
|
||||
|
||||
//ob_debug("Queing hook %s for client 0x%x", names[hook],
|
||||
// (client ? client->window : 0));
|
||||
q = &run_queue[queue_size++];
|
||||
q->hook = hook;
|
||||
q->client = client;
|
||||
|
||||
if (queue_size == QUEUE_SIZE)
|
||||
/* queue is full */
|
||||
hooks_run_queue();
|
||||
}
|
||||
|
||||
void hooks_run(ObHook hook, struct _ObClient *c)
|
||||
{
|
||||
hooks_queue(hook, c);
|
||||
hooks_run_queue();
|
||||
}
|
||||
|
||||
void hooks_add(ObHook hook, struct _ObActionsAct *act)
|
||||
{
|
||||
g_assert(hook < OB_NUM_HOOKS && hook > OB_HOOK_INVALID);
|
||||
|
||||
/* append so they are executed in the same order as they appear in the
|
||||
config file */
|
||||
hooks[hook] = g_slist_append(hooks[hook], act);
|
||||
}
|
||||
|
||||
void hooks_run_queue(void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < queue_size; ++i) {
|
||||
const ObHookQueue *q = &run_queue[i];
|
||||
|
||||
//ob_debug("Running hook %s for client 0x%x", names[q->hook],
|
||||
// (q->client ? q->client->window : 0));
|
||||
actions_run_acts(hooks[q->hook],
|
||||
OB_USER_ACTION_HOOK,
|
||||
0, -1, -1, 0,
|
||||
OB_FRAME_CONTEXT_NONE,
|
||||
q->client);
|
||||
}
|
||||
queue_size = 0;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef ob__hooks_h
|
||||
#define ob__hooks_h
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
struct _ObActionsAct;
|
||||
struct _ObClient;
|
||||
|
||||
typedef enum {
|
||||
OB_HOOK_INVALID,
|
||||
OB_HOOK_WIN_NEW,
|
||||
OB_HOOK_WIN_CLOSE,
|
||||
OB_HOOK_WIN_VISIBLE,
|
||||
OB_HOOK_WIN_INVISIBLE,
|
||||
OB_HOOK_WIN_ICONIC,
|
||||
OB_HOOK_WIN_UNICONIC,
|
||||
OB_HOOK_WIN_MAX,
|
||||
OB_HOOK_WIN_UNMAX,
|
||||
OB_HOOK_WIN_SHADE,
|
||||
OB_HOOK_WIN_UNSHADE,
|
||||
OB_HOOK_WIN_FOCUS,
|
||||
OB_HOOK_WIN_UNFOCUS,
|
||||
OB_HOOK_WIN_DESK_CHANGE,
|
||||
OB_HOOK_WIN_DECORATED,
|
||||
OB_HOOK_WIN_UNDECORATED,
|
||||
OB_HOOK_SCREEN_DESK_CHANGE,
|
||||
OB_NUM_HOOKS
|
||||
} ObHook;
|
||||
|
||||
void hooks_startup(gboolean reconfig);
|
||||
void hooks_shutdown(gboolean reconfig);
|
||||
|
||||
ObHook hooks_hook_from_name(const gchar *n);
|
||||
|
||||
void hooks_queue(ObHook hook, struct _ObClient *c);
|
||||
void hooks_run(ObHook hook, struct _ObClient *c);
|
||||
|
||||
void hooks_add(ObHook hook, struct _ObActionsAct *act);
|
||||
|
||||
void hooks_run_queue(void);
|
||||
|
||||
#endif
|
|
@ -108,7 +108,6 @@ typedef enum {
|
|||
OB_USER_ACTION_MOUSE_DOUBLE_CLICK,
|
||||
OB_USER_ACTION_MOUSE_MOTION,
|
||||
OB_USER_ACTION_MENU_SELECTION,
|
||||
OB_USER_ACTION_HOOK,
|
||||
OB_NUM_USER_ACTIONS
|
||||
} ObUserAction;
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "config.h"
|
||||
#include "ping.h"
|
||||
#include "prompt.h"
|
||||
#include "hooks.h"
|
||||
#include "gettext.h"
|
||||
#include "render/render.h"
|
||||
#include "render/theme.h"
|
||||
|
@ -235,7 +234,6 @@ gint main(gint argc, gchar **argv)
|
|||
|
||||
/* register all the available actions */
|
||||
actions_startup(reconfigure);
|
||||
hooks_startup(reconfigure);
|
||||
/* start up config which sets up with the parser */
|
||||
config_startup(i);
|
||||
|
||||
|
@ -401,7 +399,6 @@ gint main(gint argc, gchar **argv)
|
|||
sn_shutdown(reconfigure);
|
||||
event_shutdown(reconfigure);
|
||||
config_shutdown();
|
||||
hooks_shutdown(reconfigure);
|
||||
actions_shutdown(reconfigure);
|
||||
} while (reconfigure);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "event.h"
|
||||
#include "focus.h"
|
||||
#include "popup.h"
|
||||
#include "hooks.h"
|
||||
#include "render/render.h"
|
||||
#include "gettext.h"
|
||||
#include "obt/display.h"
|
||||
|
@ -719,8 +718,6 @@ void screen_set_desktop(guint num, gboolean dofocus)
|
|||
|
||||
if (event_curtime != CurrentTime)
|
||||
screen_desktop_user_time = event_curtime;
|
||||
|
||||
hooks_queue(OB_HOOK_SCREEN_DESK_CHANGE, NULL);
|
||||
}
|
||||
|
||||
void screen_add_desktop(gboolean current)
|
||||
|
|
Loading…
Reference in a new issue