diff --git a/userspace/gui/compositor/compositor.c b/userspace/gui/compositor/compositor.c index cbac8cf2..3d25c0e1 100644 --- a/userspace/gui/compositor/compositor.c +++ b/userspace/gui/compositor/compositor.c @@ -1396,6 +1396,9 @@ static void window_tile(yutani_globals_t * yg, yutani_server_window_t * window, yutani_server_window_t * panel = yg->top_z; if (panel) { panel_h = panel->height; + if (panel->y < 1) { + panel_h += panel->y; /* We can move the panel up to "hide" it. */ + } } if (!window->tiled) { diff --git a/userspace/gui/core/panel.c b/userspace/gui/core/panel.c index 74af42d9..b5ab2d73 100644 --- a/userspace/gui/core/panel.c +++ b/userspace/gui/core/panel.c @@ -162,6 +162,26 @@ static int new_focused = -1; static int title_width = 0; +static void toggle_hide_panel(void) { + static int panel_hidden = 0; + + if (panel_hidden) { + /* Unhide the panel */ + for (int i = PANEL_HEIGHT-1; i >= 0; i--) { + yutani_window_move(yctx, panel, 0, -i); + usleep(10000); + } + panel_hidden = 0; + } else { + /* Hide the panel */ + for (int i = 1; i <= PANEL_HEIGHT-1; i++) { + yutani_window_move(yctx, panel, 0, -i); + usleep(10000); + } + panel_hidden = 1; + } +} + static sprite_t * icon_get(char * name); static void redraw_appmenu(int item); @@ -398,6 +418,13 @@ static void handle_key_event(struct yutani_msg_key_event * ke) { launch_application("terminal"); } + if ((ke->event.modifiers & KEY_MOD_LEFT_CTRL) && + (ke->event.keycode == KEY_F11) && + (ke->event.action == KEY_ACTION_DOWN)) { + fprintf(stderr, "[panel] Toggling visibility.\n"); + toggle_hide_panel(); + } + if ((was_tabbing) && (ke->event.keycode == 0 || ke->event.keycode == KEY_LEFT_ALT) && (ke->event.modifiers == 0) && (ke->event.action == KEY_ACTION_UP)) { @@ -990,6 +1017,8 @@ int main (int argc, char ** argv) { yutani_key_bind(yctx, '\t', KEY_MOD_LEFT_ALT, YUTANI_BIND_STEAL); yutani_key_bind(yctx, '\t', KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_SHIFT, YUTANI_BIND_STEAL); + yutani_key_bind(yctx, KEY_F11, KEY_MOD_LEFT_CTRL, YUTANI_BIND_STEAL); + /* This lets us receive all just-modifier key releases */ yutani_key_bind(yctx, KEY_LEFT_ALT, 0, YUTANI_BIND_PASSTHROUGH);