start and stop the history plugin
This commit is contained in:
parent
d38855a0a5
commit
474f689132
1 changed files with 13 additions and 3 deletions
|
@ -3,8 +3,11 @@
|
|||
#include "../../kernel/frame.h"
|
||||
#include "../../kernel/screen.h"
|
||||
#include "../../kernel/openbox.h"
|
||||
#include "history.h"
|
||||
#include <glib.h>
|
||||
|
||||
gboolean history = TRUE;
|
||||
|
||||
void place_random(Client *c)
|
||||
{
|
||||
int l, r, t, b;
|
||||
|
@ -18,8 +21,10 @@ void place_random(Client *c)
|
|||
r = area->x + area->width - c->frame->area.width;
|
||||
b = area->y + area->height - c->frame->area.height;
|
||||
|
||||
x = g_random_int_range(l, r + 1);
|
||||
y = g_random_int_range(t, b + 1);
|
||||
if (r > l) x = g_random_int_range(l, r + 1);
|
||||
else x = 0;
|
||||
if (b > t) y = g_random_int_range(t, b + 1);
|
||||
else y = 0;
|
||||
|
||||
frame_frame_gravity(c->frame, &x, &y); /* get where the client should be */
|
||||
client_configure(c, Corner_TopLeft, x, y, c->area.width, c->area.height,
|
||||
|
@ -32,15 +37,20 @@ void event(ObEvent *e, void *foo)
|
|||
|
||||
if (ob_state == State_Starting) return;
|
||||
|
||||
place_random(e->data.c.client);
|
||||
if (!place_history(e->data.c.client))
|
||||
place_random(e->data.c.client);
|
||||
}
|
||||
|
||||
void plugin_startup()
|
||||
{
|
||||
dispatch_register(Event_Client_New, (EventHandler)event, NULL);
|
||||
|
||||
history_startup();
|
||||
}
|
||||
|
||||
void plugin_shutdown()
|
||||
{
|
||||
dispatch_register(0, (EventHandler)event, NULL);
|
||||
|
||||
history_shutdown();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue