[openbox] Question about the dock and windows placement
Yoann Aubineau
yoann at yaubi.com
Mon May 10 18:08:20 EDT 2004
Miguel Bazdresch a dit :
> The problem now, of course, is that all apps maximize over the dock. I
> started to study the sources planning to add an action code-named
> "MaximizeButNotOverDock" but it will take time.
Hello Miguel and everyone,
A few months ago I used XFWM4, XFCE4's windows manager. I fell in love
with a feature which allowed me to set margins all around the screen.
When a window is maximized, such margins are kept free. The same occurs
when a window is automatically moved to one edge of the screen. I used
this feature to keep my panel (rox-panel actually) uncovered and also
because I think it "lighten" the screen when maximized windows don't
touch any edge.
So, I added this feature to openbox3 too a few days ago. Here is a quick
explaination on how it works :
- I added a new section in the config file :
<margin>
<useMargins>yes</useMargins>
<top>10</top>
<right>5</right>
<bottom>32</bottom>
<left>5</left>
</margin>
- The margin widths are substracted from the monitor's coordinates so
that every actions using the monitor's size behave correctly. However,
the _real_ monitor size still remains in the monitor[] array. The
modifications are only done in the area[] array.
- When using margins, maximized windows keep their bottom decoration.
I didn't want to post this patch so early as I didn't test it very long.
Moreover, I found two little bugs. Actually they are not really bugs,
just a mis-behaviour when switching dynamically from margin-yes to
margin-no. And also, I don't know if things go right with xinerama, I
only have one screen.
See the patch below. Hope it helps. I you set a 66 pixel width left
margin, it could keep your dock free while still floating. As for your
fullscreen xterm, I saw a "fullscreen" function in the code but I don't
know how it is activated ... maybe that's what you are looking for.
Cheers,
Yoann
----------------------------------------------------------------------------
diff -ur openbox-3.2/openbox/client.c openbox-3.2-margins/openbox/client.c
--- openbox-3.2/openbox/client.c 2004-03-31 08:40:06.000000000 +0100
+++ openbox-3.2-margins/openbox/client.c 2004-05-07
02:48:55.000000000 +0100
@@ -1251,8 +1251,8 @@
self->decorations &= ~OB_FRAME_DECOR_MAXIMIZE;
}
- /* kill the handle on fully maxed windows */
- if (self->max_vert && self->max_horz)
+ /* kill the handle on fully maxed windows, except when margins are
used */
+ if (self->max_vert && self->max_horz && !config_margin_use)
self->decorations &= ~OB_FRAME_DECOR_HANDLE;
/* finally, the user can have requested no decorations, which overrides
diff -ur openbox-3.2/openbox/config.c openbox-3.2-margins/openbox/config.c
--- openbox-3.2/openbox/config.c 2004-04-17 13:12:49.000000000 +0100
+++ openbox-3.2-margins/openbox/config.c 2004-05-07
01:01:13.000000000 +0100
@@ -70,6 +70,12 @@
GSList *config_menu_files;
+gboolean config_margin_use;
+gint config_margin_top;
+gint config_margin_right;
+gint config_margin_bottom;
+gint config_margin_left;
+
gint config_resist_win;
gint config_resist_edge;
@@ -412,6 +418,24 @@
}
}
+static void parse_margin(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ gpointer d)
+{
+ xmlNodePtr n;
+
+ node = node->children;
+ if ((n = parse_find_node("useMargins", node)))
+ config_margin_use = parse_bool(doc, n);
+ if ((n = parse_find_node("top", node)))
+ config_margin_top = parse_int(doc, n);
+ if ((n = parse_find_node("right", node)))
+ config_margin_right = parse_int(doc, n);
+ if ((n = parse_find_node("bottom", node)))
+ config_margin_bottom = parse_int(doc, n);
+ if ((n = parse_find_node("left", node)))
+ config_margin_left = parse_int(doc, n);
+}
+
static void parse_resistance(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
gpointer d)
{
@@ -587,6 +611,14 @@
parse_register(i, "mouse", parse_mouse, NULL);
+ config_margin_use = FALSE;
+ config_margin_top = 0;
+ config_margin_right = 0;
+ config_margin_bottom = 0;
+ config_margin_left = 0;
+
+ parse_register(i, "margin", parse_margin, NULL);
+
config_resist_win = 10;
config_resist_edge = 20;
diff -ur openbox-3.2/openbox/config.h openbox-3.2-margins/openbox/config.h
--- openbox-3.2/openbox/config.h 2004-03-21 20:06:40.000000000 +0000
+++ openbox-3.2-margins/openbox/config.h 2004-05-07
01:25:16.000000000 +0100
@@ -51,6 +51,18 @@
/*! where to show the popup, currently above the window or centered */
extern gint config_resize_popup_pos;
+/*! When true margins are kept free at the edges of the screen; decorations
+ are also drawn even when the windows are maximized */
+extern gboolean config_margin_use;
+/*! Top margin width */
+extern gint config_margin_top;
+/*! Right margin width */
+extern gint config_margin_right;
+/*! Bottom margin width */
+extern gint config_margin_bottom;
+/*! Left margin width */
+extern gint config_margin_left;
+
/*! The stacking layer the dock will reside in */
extern ObStackingLayer config_dock_layer;
/*! Is the dock floating */
diff -ur openbox-3.2/openbox/frame.c openbox-3.2-margins/openbox/frame.c
--- openbox-3.2/openbox/frame.c 2004-03-21 11:57:31.000000000 +0000
+++ openbox-3.2-margins/openbox/frame.c 2004-05-07
02:37:41.000000000 +0100
@@ -277,7 +277,7 @@
}
self->rbwidth = self->bwidth;
- if (self->max_horz)
+ if (self->max_horz && !config_margin_use)
self->bwidth = self->cbwidth_x = 0;
STRUT_SET(self->innersize,
@@ -285,8 +285,9 @@
self->cbwidth_y,
self->cbwidth_x,
self->cbwidth_y);
+
self->width = self->client->area.width + self->cbwidth_x * 2 -
- (self->max_horz ? self->rbwidth * 2 : 0);
+ (self->max_horz && !config_margin_use ? self->rbwidth * 2 : 0);
self->width = MAX(self->width, 1); /* no lower than 1 */
/* set border widths */
diff -ur openbox-3.2/openbox/screen.c openbox-3.2-margins/openbox/screen.c
--- openbox-3.2/openbox/screen.c 2004-04-06 18:58:54.000000000 +0100
+++ openbox-3.2-margins/openbox/screen.c 2004-05-07
02:10:24.000000000 +0100
@@ -998,6 +998,15 @@
/* calc the xinerama areas */
for (x = 0; x < screen_num_monitors; ++x) {
area[i][x] = monitor_area[x];
+
+ /* crop edge margins */
+ if (config_margin_use) {
+ area[i][x].x += config_margin_left;
+ area[i][x].y += config_margin_top;
+ area[i][x].width -= config_margin_left +
config_margin_right;
+ area[i][x].height -= config_margin_top +
config_margin_bottom;
+ }
+
if (x == 0) {
l = monitor_area[x].x;
t = monitor_area[x].y;
----------------------------------------------------------------------------
More information about the openbox
mailing list