diff --git a/man/lxpanelctl.1 b/man/lxpanelctl.1 index d3a5dee2..08c10ddd 100644 --- a/man/lxpanelctl.1 +++ b/man/lxpanelctl.1 @@ -47,6 +47,11 @@ is a program that controls lxpanel\&. Show the system menu\&. .RE .PP +\fBshow\fR +.RS 4 +Show the panel in autohide mode\&. +.RE +.PP \fBrun\fR .RS 4 Show the run dialog\&. diff --git a/src/lxpanelctl.c b/src/lxpanelctl.c index d0334d1f..7ff728e0 100644 --- a/src/lxpanelctl.c +++ b/src/lxpanelctl.c @@ -39,6 +39,7 @@ static const char usage[] = "Usage: lxpanelctl \n\n" "Available commands:\n" "menu\t\t\tshow system menu\n" + "show\t\t\tshow panel if hidden\n" "run\t\t\tshow run dialog\n" "config\t\t\tshow configuration dialog\n" "restart\t\t\trestart lxpanel\n" @@ -49,6 +50,8 @@ static int get_cmd( const char* cmd ) { if( ! strcmp( cmd, "menu") ) return LXPANEL_CMD_SYS_MENU; + if( ! strcmp( cmd, "show") ) + return LXPANEL_CMD_SHOW_PANEL; else if( ! strcmp( cmd, "run") ) return LXPANEL_CMD_RUN; else if( ! strcmp( cmd, "config") ) diff --git a/src/lxpanelctl.h b/src/lxpanelctl.h index 0ca1e71b..f3870fd0 100644 --- a/src/lxpanelctl.h +++ b/src/lxpanelctl.h @@ -29,6 +29,7 @@ typedef enum { LXPANEL_CMD_NONE, LXPANEL_CMD_SYS_MENU, + LXPANEL_CMD_SHOW_PANEL, LXPANEL_CMD_RUN, LXPANEL_CMD_CONFIG, LXPANEL_CMD_RESTART, diff --git a/src/main.c b/src/main.c index d55a66bd..35faa901 100644 --- a/src/main.c +++ b/src/main.c @@ -114,6 +114,16 @@ static void process_client_msg ( XClientMessageEvent* ev ) break; } #endif + case LXPANEL_CMD_SHOW_PANEL: + GSList* l; + for( l = all_panels; l; l = l->next ) + { + LXPanel* p = (LXPanel*)l->data; + + if (p->priv->box != NULL) + ah_show_panel(p); + } + break; case LXPANEL_CMD_RUN: gtk_run(); break; diff --git a/src/panel.c b/src/panel.c index 45188dbe..ed83dcc3 100644 --- a/src/panel.c +++ b/src/panel.c @@ -929,6 +929,7 @@ static void _panel_update_background(LXPanel * p, gboolean enforce) #define GAP 2 #define PERIOD 300 +#define SHOW_PERIOD 3000 typedef enum { @@ -966,6 +967,9 @@ mouse_watch(LXPanel *panel) if (p->move_state != PANEL_MOVE_STOP) /* prevent autohide when dragging is on */ return TRUE; + if (p->hide_timeout != 0) + /* Wait for hidden timeout */ + return TRUE; if (cw == 1) cw = 0; if (ch == 1) ch = 0; @@ -1075,6 +1079,17 @@ static void ah_state_set(LXPanel *panel, PanelAHState ah_state) RET(); } +/* Show panel if it is hidden */ +void ah_show_panel(LXPanel *p) +{ + ENTER; + if (!p->priv->visible) { + ah_state_set(p, AH_STATE_VISIBLE); + p->priv->hide_timeout = g_timeout_add(SHOW_PERIOD, ah_state_hide_timeout, p); + } + RET(); +} + /* starts autohide behaviour */ static void ah_start(LXPanel *p) { diff --git a/src/panel.h.in b/src/panel.h.in index cf0f4924..d54f620f 100644 --- a/src/panel.h.in +++ b/src/panel.h.in @@ -135,6 +135,14 @@ extern void lxpanel_draw_label_text_with_color(LXPanel * p, GtkWidget * label, c */ void lxpanel_config_save(LXPanel *p); /* defined in configurator.c */ +/** + * ah_show_panel + * @p: a panel instance + * + * Under autohide mode, Show panel @p if it is hidden. + */ +void ah_show_panel(LXPanel *p); + /* Accessors APIs for Panel* */ extern GtkOrientation panel_get_orientation(LXPanel *panel); extern gint panel_get_icon_size(LXPanel *panel);