add showDelay to dock

This commit is contained in:
Mikael Magnusson 2005-09-25 14:45:24 +00:00
parent c7a75a5ca8
commit e1665d70b5
5 changed files with 33 additions and 8 deletions

View file

@ -1,3 +1,6 @@
3.3:
* Add a showDelay option for the dock.
3.3-rc2:
* Fixed some typos and errors in rc.xsd
* Add the noStrut option to the dock (to allow maximizing windows over it),

View file

@ -35,6 +35,8 @@
Add fourCorners to resize context.
Sat Feb 12 01:57:16 UTC 2005 - mikachu(a)openbox.org
Add the group option to raise/lower stuff.
Sun Sep 25 14:44:21 UTC 2005 - mikachu(a)openbox.org
Add showDelay for the dock
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://openbox.org/"
@ -133,6 +135,7 @@
<xs:element name="floatingY" type="xs:integer"/>
<xs:element name="autoHide" type="ob:yesorno"/>
<xs:element name="hideDelay" type="xs:integer"/>
<xs:element name="showDelay" type="xs:integer"/>
<xs:element name="moveButton" type="ob:button"/>
<xs:element name="noStrut" type="ob:yesorno"/>
</xs:sequence>

View file

@ -57,6 +57,7 @@ gint config_dock_y;
ObOrientation config_dock_orient;
gboolean config_dock_hide;
guint config_dock_hide_delay;
guint config_dock_show_delay;
guint config_dock_app_move_button;
guint config_dock_app_move_modifiers;
@ -387,6 +388,8 @@ static void parse_dock(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
config_dock_hide = parse_bool(doc, n);
if ((n = parse_find_node("hideDelay", node)))
config_dock_hide_delay = parse_int(doc, n) * 1000;
if ((n = parse_find_node("showDelay", node)))
config_dock_show_delay = parse_int(doc, n) * 1000;
if ((n = parse_find_node("moveButton", node))) {
gchar *str = parse_string(doc, n);
guint b, s;
@ -585,6 +588,7 @@ void config_startup(ObParseInst *i)
config_dock_orient = OB_ORIENTATION_VERT;
config_dock_hide = FALSE;
config_dock_hide_delay = 300;
config_dock_show_delay = 300;
config_dock_app_move_button = 2; /* middle */
config_dock_app_move_modifiers = 0;

View file

@ -74,6 +74,8 @@ extern ObOrientation config_dock_orient;
extern gboolean config_dock_hide;
/*! The number of microseconds to wait before hiding the dock */
extern guint config_dock_hide_delay;
/*! The number of microseconds to wait before showing the dock */
extern guint config_dock_show_delay;
/*! The mouse button to be used to move dock apps */
extern guint config_dock_app_move_button;
/*! The modifiers to be used with the button to move dock apps */

View file

@ -597,17 +597,30 @@ static gboolean hide_timeout(gpointer data)
return FALSE; /* don't repeat */
}
static gboolean show_timeout(gpointer data)
{
/* hide */
dock->hidden = FALSE;
dock_configure();
return FALSE; /* don't repeat */
}
void dock_hide(gboolean hide)
{
if (!hide) {
/* show */
dock->hidden = FALSE;
dock_configure();
/* if was hiding, stop it */
ob_main_loop_timeout_remove(ob_main_loop, hide_timeout);
} else if (!dock->hidden && config_dock_hide) {
ob_main_loop_timeout_add(ob_main_loop, config_dock_hide_delay,
if (dock->hidden && config_dock_hide) {
ob_main_loop_timeout_add(ob_main_loop, config_dock_show_delay,
show_timeout, NULL, NULL);
} else if (!dock->hidden && config_dock_hide) {
ob_main_loop_timeout_remove(ob_main_loop, hide_timeout);
}
} else {
if (!dock->hidden && config_dock_hide) {
ob_main_loop_timeout_add(ob_main_loop, config_dock_hide_delay,
hide_timeout, NULL, NULL);
} else if (dock->hidden && config_dock_hide) {
ob_main_loop_timeout_remove(ob_main_loop, show_timeout);
}
}
}