diff -ruN openbox-3.0-beta2.orig/data/rc.xml openbox-3.0-beta2/data/rc.xml
--- openbox-3.0-beta2.orig/data/rc.xml 2003-09-08 11:53:54.000000000 -0500
+++ openbox-3.0-beta2/data/rc.xml 2003-09-09 16:03:45.000000000 -0500
@@ -18,6 +18,10 @@
0
+
+ undermouse
+
+
thebear
NLIMC
diff -ruN openbox-3.0-beta2.orig/openbox/config.c openbox-3.0-beta2/openbox/config.c
--- openbox-3.0-beta2.orig/openbox/config.c 2003-09-07 22:14:34.000000000 -0500
+++ openbox-3.0-beta2/openbox/config.c 2003-09-09 16:05:46.000000000 -0500
@@ -12,6 +12,8 @@
gboolean config_focus_last_on_desktop;
guint config_focus_delay;
+gboolean config_place_umouse;
+
char *config_theme;
gchar *config_title_layout;
@@ -328,6 +330,17 @@
config_resist_edge = parse_int(doc, n);
}
+static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ void *d)
+{
+ xmlNodePtr n;
+
+ node = node->children;
+ if ((n = parse_find_node("scheme", node)))
+ if (parse_contains("undermouse", doc, n))
+ config_place_umouse = TRUE;
+}
+
void config_startup(ObParseInst *i)
{
config_focus_new = TRUE;
@@ -338,6 +351,10 @@
parse_register(i, "focus", parse_focus, NULL);
+ config_place_umouse = FALSE;
+
+ parse_register(i, "placement", parse_placement, NULL);
+
config_theme = NULL;
config_title_layout = g_strdup("NLIMC");
diff -ruN openbox-3.0-beta2.orig/openbox/config.h openbox-3.0-beta2/openbox/config.h
--- openbox-3.0-beta2.orig/openbox/config.h 2003-09-07 22:14:41.000000000 -0500
+++ openbox-3.0-beta2/openbox/config.h 2003-09-09 16:06:03.000000000 -0500
@@ -18,6 +18,8 @@
extern gboolean config_focus_last_on_desktop;
/*! Timeout for focusing windows on focus follows mouse, in milliseconds */
extern guint config_focus_delay;
+/*! Use undermouse placement */
+extern gboolean config_place_umouse;
/*! When true windows' contents are refreshed while they are resized; otherwise
they are not updated until the resize is complete */
diff -ruN openbox-3.0-beta2.orig/openbox/place.c openbox-3.0-beta2/openbox/place.c
--- openbox-3.0-beta2.orig/openbox/place.c 2003-08-29 01:35:58.000000000 -0500
+++ openbox-3.0-beta2/openbox/place.c 2003-09-09 16:18:12.000000000 -0500
@@ -1,3 +1,4 @@
+#include "config.h"
#include "client.h"
#include "group.h"
#include "screen.h"
@@ -37,6 +38,46 @@
return NULL;
}
+/* Attempts to recreate the Ob2 Placement Under Mouse method. */
+static gboolean place_umouse(ObClient *client, gint *x, gint *y)
+{
+ int px, py, width, height;
+ Rect *area;
+
+ if(config_place_umouse == FALSE)
+ return FALSE;
+
+ area = pick_head(client);
+ if (!area)
+ area = screen_area_monitor(client->desktop,
+ g_random_int_range(0, screen_num_monitors));
+
+ screen_pointer_pos (&px, &py);
+
+ if (client->frame != NULL) {
+ width = client->frame->area.width;
+ height = client->frame->area.height;
+ } else {
+ width = client->area.width;
+ height = client->area.height;
+ }
+
+ px -= width / 2;
+ py -= height / 2;
+
+ if (px < area->x) px = area->x;
+ if (py < area->y) py = area->y;
+ if (px + width > area->x + area->width)
+ px = area->x + area->width - width;
+ if (py + height > area->y + area->height)
+ py = area->y + area->height - height;
+
+ *x = px;
+ *y = py;
+
+ return TRUE;
+}
+
static gboolean place_random(ObClient *client, gint *x, gint *y)
{
int l, r, t, b;
@@ -130,6 +171,8 @@
return;
if (place_dialog(client, x, y))
return;
+ if (place_umouse(client, x, y))
+ return;
if (place_random(client, x, y))
return;
g_assert_not_reached(); /* the last one better succeed */