]>
Dogcows Code - chaz/openbox/blob - plugins/placement/placement.c
8a5d995a620735ad2ee33ef992cd76d792ad0e95
1 #include "../../kernel/dispatch.h"
2 #include "../../kernel/client.h"
3 #include "../../kernel/frame.h"
4 #include "../../kernel/screen.h"
5 #include "../../kernel/openbox.h"
9 gboolean history
= TRUE
;
11 static void place_random(Client
*c
)
17 area
= screen_area(c
->desktop
);
21 r
= area
->x
+ area
->width
- c
->frame
->area
.width
;
22 b
= area
->y
+ area
->height
- c
->frame
->area
.height
;
24 if (r
> l
) x
= g_random_int_range(l
, r
+ 1);
26 if (b
> t
) y
= g_random_int_range(t
, b
+ 1);
29 frame_frame_gravity(c
->frame
, &x
, &y
); /* get where the client should be */
30 client_configure(c
, Corner_TopLeft
, x
, y
, c
->area
.width
, c
->area
.height
,
34 static void event(ObEvent
*e
, void *foo
)
36 g_assert(e
->type
== Event_Client_New
);
38 if (ob_state
== State_Starting
) return;
40 /* requested a position */
41 if (e
->data
.c
.client
->positioned
) return;
43 if (!place_history(e
->data
.c
.client
))
44 place_random(e
->data
.c
.client
);
49 dispatch_register(Event_Client_New
, (EventHandler
)event
, NULL
);
54 void plugin_shutdown()
56 dispatch_register(0, (EventHandler
)event
, NULL
);
This page took 0.034395 seconds and 4 git commands to generate.