Skip to content

Commit

Permalink
fix: auto hidding vertical menu bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinNovais committed Oct 7, 2024
1 parent e54dcdc commit 87947ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions io.github.kelvinnovais.Kasasa.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"--share=ipc",
"--socket=fallback-x11",
"--device=dri",
"--socket=wayland",
"--filesystem=xdg-pictures"
"--socket=wayland"
],
"cleanup": [
"/include",
Expand Down
13 changes: 12 additions & 1 deletion src/kasasa-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ resize_window (KasasaWindow *self)
self->nat_width = image_width * self->nat_height / image_height;
}

// If the vertical menu is NOT hiding, then the window width must have more 46 px
self->nat_width +=
(g_settings_get_boolean (self->settings, "auto-hide-menu")) ? 0 : 46;

resize_window_animated (self);
}

Expand Down Expand Up @@ -381,6 +385,13 @@ hide_vertical_menu_cb (gpointer user_data)
gtk_revealer_set_reveal_child (GTK_REVEALER (self->menu_revealer), FALSE);
}

static void
reveal_vertical_menu_cb (gpointer user_data)
{
KasasaWindow *self = KASASA_WINDOW (user_data);
gtk_revealer_set_reveal_child (GTK_REVEALER (self->menu_revealer), TRUE);
}

static void
hide_vertical_menu (KasasaWindow *self)
{
Expand Down Expand Up @@ -521,7 +532,7 @@ on_settings_updated (GSettings* settings,
{
self->auto_hide_menu = g_settings_get_boolean (self->settings, "auto-hide-menu");
if (self->auto_hide_menu == FALSE)
gtk_revealer_set_reveal_child (GTK_REVEALER (self->menu_revealer), TRUE);
g_timeout_add_seconds_once (2, reveal_vertical_menu_cb, self);
}
else if (g_strcmp0 (key, "change-opacity") == 0)
self->change_opacity = g_settings_get_boolean (self->settings, "change-opacity");
Expand Down

0 comments on commit 87947ad

Please sign in to comment.