* [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3
@ 2014-03-19 23:36 Cole Robinson
2014-10-06 10:17 ` [Qemu-devel] [Bug 1294898] " ManDay
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Cole Robinson @ 2014-03-19 23:36 UTC (permalink / raw)
To: qemu-devel
Public bug reported:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the fullscreen
accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
** Affects: qemu
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1294898
Title:
gtk: menubar visible in fullscreen mode with gtk3
Status in QEMU:
New
Bug description:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the
fullscreen accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1294898/+subscriptions
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [Bug 1294898] Re: gtk: menubar visible in fullscreen mode with gtk3
2014-03-19 23:36 [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3 Cole Robinson
@ 2014-10-06 10:17 ` ManDay
2014-10-09 17:38 ` Cole Robinson
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ManDay @ 2014-10-06 10:17 UTC (permalink / raw)
To: qemu-devel
For what it's worth, Gerd replied on the list that
> Patch trades one bug for another. Hiding the menu bar also kills the
> accelerator keys, which is especially problematic for the fullscreen
> hotkey as there is no way out of fullscreen mode then.
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1294898
Title:
gtk: menubar visible in fullscreen mode with gtk3
Status in QEMU:
New
Bug description:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the
fullscreen accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1294898/+subscriptions
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [Bug 1294898] Re: gtk: menubar visible in fullscreen mode with gtk3
2014-03-19 23:36 [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3 Cole Robinson
2014-10-06 10:17 ` [Qemu-devel] [Bug 1294898] " ManDay
@ 2014-10-09 17:38 ` Cole Robinson
2015-06-18 21:30 ` Tristan Muntsinger
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Cole Robinson @ 2014-10-09 17:38 UTC (permalink / raw)
To: qemu-devel
Mailing list discussion:
https://lists.gnu.org/archive/html/qemu-devel/2014-10/msg00510.html
When Gerd made the comment quoted above, he hadn't read the full report.
If someone wants to flesh out my patch bits and send it to qemu-devel it
will be easier to follow up there.
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1294898
Title:
gtk: menubar visible in fullscreen mode with gtk3
Status in QEMU:
New
Bug description:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the
fullscreen accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1294898/+subscriptions
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [Bug 1294898] Re: gtk: menubar visible in fullscreen mode with gtk3
2014-03-19 23:36 [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3 Cole Robinson
2014-10-06 10:17 ` [Qemu-devel] [Bug 1294898] " ManDay
2014-10-09 17:38 ` Cole Robinson
@ 2015-06-18 21:30 ` Tristan Muntsinger
2015-06-18 21:31 ` Launchpad Bug Tracker
2016-06-23 9:07 ` T. Huth
4 siblings, 0 replies; 6+ messages in thread
From: Tristan Muntsinger @ 2015-06-18 21:30 UTC (permalink / raw)
To: qemu-devel
** Also affects: ubuntu-gnome3-desktop (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1294898
Title:
gtk: menubar visible in fullscreen mode with gtk3
Status in QEMU:
New
Status in ubuntu-gnome3-desktop package in Ubuntu:
Confirmed
Bug description:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the
fullscreen accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1294898/+subscriptions
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [Bug 1294898] Re: gtk: menubar visible in fullscreen mode with gtk3
2014-03-19 23:36 [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3 Cole Robinson
` (2 preceding siblings ...)
2015-06-18 21:30 ` Tristan Muntsinger
@ 2015-06-18 21:31 ` Launchpad Bug Tracker
2016-06-23 9:07 ` T. Huth
4 siblings, 0 replies; 6+ messages in thread
From: Launchpad Bug Tracker @ 2015-06-18 21:31 UTC (permalink / raw)
To: qemu-devel
Status changed to 'Confirmed' because the bug affects multiple users.
** Changed in: ubuntu-gnome3-desktop (Ubuntu)
Status: New => Confirmed
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1294898
Title:
gtk: menubar visible in fullscreen mode with gtk3
Status in QEMU:
New
Status in ubuntu-gnome3-desktop package in Ubuntu:
Confirmed
Bug description:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the
fullscreen accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1294898/+subscriptions
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [Bug 1294898] Re: gtk: menubar visible in fullscreen mode with gtk3
2014-03-19 23:36 [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3 Cole Robinson
` (3 preceding siblings ...)
2015-06-18 21:31 ` Launchpad Bug Tracker
@ 2016-06-23 9:07 ` T. Huth
4 siblings, 0 replies; 6+ messages in thread
From: T. Huth @ 2016-06-23 9:07 UTC (permalink / raw)
To: qemu-devel
Patch has been included upstream here:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=b0f3182064c4943b91d
** Changed in: qemu
Status: New => Fix Released
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1294898
Title:
gtk: menubar visible in fullscreen mode with gtk3
Status in QEMU:
Fix Released
Status in ubuntu-gnome3-desktop package in Ubuntu:
Confirmed
Bug description:
Using the gtk UI, compiled with gtk3, the menu bar is fully visible in
full screen mode. On gtk2 it's hidden. The set_size_request call isn't
abided on gtk3 it seems.
Simple fix is:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..7b3bd3d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -805,7 +805,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
if (!s->full_screen) {
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
- gtk_widget_set_size_request(s->menu_bar, 0, 0);
+ gtk_widget_hide(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area, -1, -1);
gtk_window_fullscreen(GTK_WINDOW(s->window));
if (gd_on_vga(s)) {
@@ -815,7 +815,7 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
} else {
gtk_window_unfullscreen(GTK_WINDOW(s->window));
gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
- gtk_widget_set_size_request(s->menu_bar, -1, -1);
+ gtk_widget_show(s->menu_bar);
gtk_widget_set_size_request(s->drawing_area,
surface_width(s->ds),
surface_height(s->ds));
The problem with that is that hiding the menu bar means all its associated accelerators are no longer usable, so there's way to exit fullscreen mode. That's kind of a problem :)
We can install the accelerators on the window, but make sure the menu
item still shows the accelerator short cut. Example with the
fullscreen accelerator:
diff --git a/ui/gtk.c b/ui/gtk.c
index 66e886f..fbce2b0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -799,7 +799,7 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
}
}
-static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+static void gd_do_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -828,6 +828,11 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(s, FALSE);
}
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+ gd_do_full_screen(opaque);
+}
+
static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1304,10 +1309,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
- gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
- "<QEMU>/View/Full Screen");
- gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
- HOTKEY_MODIFIERS);
+ gtk_accel_group_connect(accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
+ g_cclosure_new_swap(G_CALLBACK(gd_do_full_screen), s, NULL));
+ gtk_accel_label_set_accel(
+ GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))),
+ GDK_KEY_f, HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item);
separator = gtk_separator_menu_item_new();
However gtk_accel_label_set_accel, which shows the accel key sequence in the menu, is gtk 3.8+ :/ So older versions wouldn't have any visual indication of the shortcuts. Maybe that's not a problem, SDL didn't have any indication of shortcuts either.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1294898/+subscriptions
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-23 9:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 23:36 [Qemu-devel] [Bug 1294898] [NEW] gtk: menubar visible in fullscreen mode with gtk3 Cole Robinson
2014-10-06 10:17 ` [Qemu-devel] [Bug 1294898] " ManDay
2014-10-09 17:38 ` Cole Robinson
2015-06-18 21:30 ` Tristan Muntsinger
2015-06-18 21:31 ` Launchpad Bug Tracker
2016-06-23 9:07 ` T. Huth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.