aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-02-23 17:06:10 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-02-23 17:06:10 -0300
commita96a1767830c63209bb5a4b6bb37e4c35e634253 (patch)
treeb69e22caef88e299e9ea02ba9bbc39b522c1bf68
parent8cb208b65403c7ec306315b437d1a8def8720728 (diff)
downloadkvmx-a96a1767830c63209bb5a4b6bb37e4c35e634253.tar.gz
kvmx-a96a1767830c63209bb5a4b6bb37e4c35e634253.tar.bz2
Feat: add toggle-menubar patches for recent spice-gtk versions
-rw-r--r--share/patches/spice-gtk/toggle-menubar-0.39.patch65
-rw-r--r--share/patches/spice-gtk/toggle-menubar-0.42.patch65
2 files changed, 130 insertions, 0 deletions
diff --git a/share/patches/spice-gtk/toggle-menubar-0.39.patch b/share/patches/spice-gtk/toggle-menubar-0.39.patch
new file mode 100644
index 0000000..da9f309
--- /dev/null
+++ b/share/patches/spice-gtk/toggle-menubar-0.39.patch
@@ -0,0 +1,65 @@
+--- spice-gtk-0.39/tools/spicy.c 2021-12-07 21:09:07.062520158 -0300
++++ spice-gtk-0.39.test/tools/spicy.c 2022-01-02 13:14:11.718519721 -0300
+@@ -463,6 +463,15 @@
+ g_key_file_set_boolean(keyfile, "ui", "statusbar", state);
+ }
+
++static void menu_cb_menubar(GtkToggleAction *action, gpointer data)
++{
++ SpiceWindow *win = data;
++ gboolean state = gtk_toggle_action_get_active(action);
++
++ gtk_widget_set_visible(win->menubar, state);
++ g_key_file_set_boolean(keyfile, "ui", "menubar", state);
++}
++
+ static void menu_cb_about(GtkAction *action, void *data)
+ {
+ char *comments = "gtk test client app for the\n"
+@@ -512,10 +521,14 @@
+ gboolean state;
+ GtkAction *toggle;
+
+- gtk_widget_show(win->menubar);
++ toggle = gtk_action_group_get_action(win->ag, "Menubar");
++ state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
++ gtk_widget_set_visible(win->menubar, state);
++
+ toggle = gtk_action_group_get_action(win->ag, "Toolbar");
+ state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
+ gtk_widget_set_visible(win->toolbar, state);
++
+ toggle = gtk_action_group_get_action(win->ag, "Statusbar");
+ state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
+ gtk_widget_set_visible(win->statusbar, state);
+@@ -673,6 +686,10 @@
+ }
+ g_clear_error(&error);
+
++ state = g_key_file_get_boolean(keyfile, "ui", "menubar", &error);
++ if (error == NULL)
++ gtk_widget_set_visible(win->menubar, state);
++ g_clear_error(&error);
+
+ state = g_key_file_get_boolean(keyfile, "ui", "toolbar", &error);
+ if (error == NULL)
+@@ -846,6 +863,11 @@
+ .name = "Toolbar",
+ .label = "Toolbar",
+ .callback = G_CALLBACK(menu_cb_toolbar),
++ },{
++ .name = "Menubar",
++ .label = "Menubar",
++ .callback = G_CALLBACK(menu_cb_menubar),
++ .accelerator = "<shift>F6",
+ }
+ };
+
+@@ -920,6 +942,7 @@
+ " <menuitem action='Fullscreen'/>\n"
+ " <menuitem action='Toolbar'/>\n"
+ " <menuitem action='Statusbar'/>\n"
++" <menuitem action='Menubar'/>\n"
+ " </menu>\n"
+ " <menu action='InputMenu'>\n"
+ #ifdef USE_SMARTCARD
diff --git a/share/patches/spice-gtk/toggle-menubar-0.42.patch b/share/patches/spice-gtk/toggle-menubar-0.42.patch
new file mode 100644
index 0000000..da9f309
--- /dev/null
+++ b/share/patches/spice-gtk/toggle-menubar-0.42.patch
@@ -0,0 +1,65 @@
+--- spice-gtk-0.39/tools/spicy.c 2021-12-07 21:09:07.062520158 -0300
++++ spice-gtk-0.39.test/tools/spicy.c 2022-01-02 13:14:11.718519721 -0300
+@@ -463,6 +463,15 @@
+ g_key_file_set_boolean(keyfile, "ui", "statusbar", state);
+ }
+
++static void menu_cb_menubar(GtkToggleAction *action, gpointer data)
++{
++ SpiceWindow *win = data;
++ gboolean state = gtk_toggle_action_get_active(action);
++
++ gtk_widget_set_visible(win->menubar, state);
++ g_key_file_set_boolean(keyfile, "ui", "menubar", state);
++}
++
+ static void menu_cb_about(GtkAction *action, void *data)
+ {
+ char *comments = "gtk test client app for the\n"
+@@ -512,10 +521,14 @@
+ gboolean state;
+ GtkAction *toggle;
+
+- gtk_widget_show(win->menubar);
++ toggle = gtk_action_group_get_action(win->ag, "Menubar");
++ state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
++ gtk_widget_set_visible(win->menubar, state);
++
+ toggle = gtk_action_group_get_action(win->ag, "Toolbar");
+ state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
+ gtk_widget_set_visible(win->toolbar, state);
++
+ toggle = gtk_action_group_get_action(win->ag, "Statusbar");
+ state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
+ gtk_widget_set_visible(win->statusbar, state);
+@@ -673,6 +686,10 @@
+ }
+ g_clear_error(&error);
+
++ state = g_key_file_get_boolean(keyfile, "ui", "menubar", &error);
++ if (error == NULL)
++ gtk_widget_set_visible(win->menubar, state);
++ g_clear_error(&error);
+
+ state = g_key_file_get_boolean(keyfile, "ui", "toolbar", &error);
+ if (error == NULL)
+@@ -846,6 +863,11 @@
+ .name = "Toolbar",
+ .label = "Toolbar",
+ .callback = G_CALLBACK(menu_cb_toolbar),
++ },{
++ .name = "Menubar",
++ .label = "Menubar",
++ .callback = G_CALLBACK(menu_cb_menubar),
++ .accelerator = "<shift>F6",
+ }
+ };
+
+@@ -920,6 +942,7 @@
+ " <menuitem action='Fullscreen'/>\n"
+ " <menuitem action='Toolbar'/>\n"
+ " <menuitem action='Statusbar'/>\n"
++" <menuitem action='Menubar'/>\n"
+ " </menu>\n"
+ " <menu action='InputMenu'>\n"
+ #ifdef USE_SMARTCARD