* [Qemu-devel] [PATCH 1/2] gtk: drop gtk_widget_set_double_buffered call
@ 2014-10-23 15:25 Gerd Hoffmann
2014-10-23 15:25 ` [Qemu-devel] [PATCH 2/2] gtk: avoid gd_widget_reparent with gtk 3.14+ Gerd Hoffmann
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2014-10-23 15:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Dr. David Alan Gilbert, Anthony Liguori, Gerd Hoffmann
Dunno why it is here. Removing it seems to have no ill side effects.
It is depricated in 3.14+. In some cases it has no effect since 3.10
according to the docs:
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-double-buffered
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 342815b..5249820 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1703,7 +1703,6 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
GDK_LEAVE_NOTIFY_MASK |
GDK_SCROLL_MASK |
GDK_KEY_PRESS_MASK);
- gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE);
gtk_widget_set_can_focus(vc->gfx.drawing_area, TRUE);
vc->type = GD_VC_GFX;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] gtk: avoid gd_widget_reparent with gtk 3.14+
2014-10-23 15:25 [Qemu-devel] [PATCH 1/2] gtk: drop gtk_widget_set_double_buffered call Gerd Hoffmann
@ 2014-10-23 15:25 ` Gerd Hoffmann
2014-10-23 16:26 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2014-10-23 15:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Dr. David Alan Gilbert, Anthony Liguori, Gerd Hoffmann
gtk_widget_reparent is depricated in gtk 3.14. Unfortunaly the
gtk_widget_{ref,unref} functions needed to to the same manually
without having the widget destroyed while it has no parent are
pretty new. So there is no way around #ifdef'ing the code,
otherwise it breaks with older gtk versions,
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 5249820..1d071b9 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -437,6 +437,19 @@ static void gtk_release_modifiers(GtkDisplayState *s)
}
}
+static void gd_widget_reparent(GtkWidget *from, GtkWidget *to,
+ GtkWidget *widget)
+{
+#if GTK_CHECK_VERSION(3, 14, 0)
+ gtk_widget_ref(widget);
+ gtk_container_remove(GTK_CONTAINER(from), widget);
+ gtk_container_add(GTK_CONTAINER(to), widget);
+ gtk_widget_unref(widget);
+#else
+ gtk_widget_reparent(widget, to);
+#endif
+}
+
/** DisplayState Callbacks **/
static void gd_update(DisplayChangeListener *dcl,
@@ -1054,7 +1067,7 @@ static gboolean gd_tab_window_close(GtkWidget *widget, GdkEvent *event,
GtkDisplayState *s = vc->s;
gtk_widget_set_sensitive(vc->menu_item, true);
- gtk_widget_reparent(vc->tab_item, s->notebook);
+ gd_widget_reparent(vc->window, s->notebook, vc->tab_item);
gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(s->notebook),
vc->tab_item, vc->label);
gtk_widget_destroy(vc->window);
@@ -1089,7 +1102,7 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
if (!vc->window) {
gtk_widget_set_sensitive(vc->menu_item, false);
vc->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_reparent(vc->tab_item, vc->window);
+ gd_widget_reparent(s->notebook, vc->window, vc->tab_item);
g_signal_connect(vc->window, "delete-event",
G_CALLBACK(gd_tab_window_close), vc);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] gtk: avoid gd_widget_reparent with gtk 3.14+
2014-10-23 15:25 ` [Qemu-devel] [PATCH 2/2] gtk: avoid gd_widget_reparent with gtk 3.14+ Gerd Hoffmann
@ 2014-10-23 16:26 ` Paolo Bonzini
2014-10-23 16:31 ` Daniel P. Berrange
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2014-10-23 16:26 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel; +Cc: Dr. David Alan Gilbert, Anthony Liguori
On 10/23/2014 05:25 PM, Gerd Hoffmann wrote:
> gtk_widget_reparent is depricated in gtk 3.14. Unfortunaly the
> gtk_widget_{ref,unref} functions needed to to the same manually
> without having the widget destroyed while it has no parent are
> pretty new. So there is no way around #ifdef'ing the code,
> otherwise it breaks with older gtk versions,
I cannot find gtk_widget_ref/unref in
https://developer.gnome.org/gtk3/stable/GtkWidget.html. How do they
differ from g_object_ref(G_OBJECT(widget))?
Paolo
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> ui/gtk.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 5249820..1d071b9 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -437,6 +437,19 @@ static void gtk_release_modifiers(GtkDisplayState *s)
> }
> }
>
> +static void gd_widget_reparent(GtkWidget *from, GtkWidget *to,
> + GtkWidget *widget)
> +{
> +#if GTK_CHECK_VERSION(3, 14, 0)
> + gtk_widget_ref(widget);
> + gtk_container_remove(GTK_CONTAINER(from), widget);
> + gtk_container_add(GTK_CONTAINER(to), widget);
> + gtk_widget_unref(widget);
> +#else
> + gtk_widget_reparent(widget, to);
> +#endif
> +}
> +
> /** DisplayState Callbacks **/
>
> static void gd_update(DisplayChangeListener *dcl,
> @@ -1054,7 +1067,7 @@ static gboolean gd_tab_window_close(GtkWidget *widget, GdkEvent *event,
> GtkDisplayState *s = vc->s;
>
> gtk_widget_set_sensitive(vc->menu_item, true);
> - gtk_widget_reparent(vc->tab_item, s->notebook);
> + gd_widget_reparent(vc->window, s->notebook, vc->tab_item);
> gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(s->notebook),
> vc->tab_item, vc->label);
> gtk_widget_destroy(vc->window);
> @@ -1089,7 +1102,7 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
> if (!vc->window) {
> gtk_widget_set_sensitive(vc->menu_item, false);
> vc->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> - gtk_widget_reparent(vc->tab_item, vc->window);
> + gd_widget_reparent(s->notebook, vc->window, vc->tab_item);
>
> g_signal_connect(vc->window, "delete-event",
> G_CALLBACK(gd_tab_window_close), vc);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] gtk: avoid gd_widget_reparent with gtk 3.14+
2014-10-23 16:26 ` Paolo Bonzini
@ 2014-10-23 16:31 ` Daniel P. Berrange
0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2014-10-23 16:31 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, Anthony Liguori, Dr. David Alan Gilbert
On Thu, Oct 23, 2014 at 06:26:21PM +0200, Paolo Bonzini wrote:
>
>
> On 10/23/2014 05:25 PM, Gerd Hoffmann wrote:
> > gtk_widget_reparent is depricated in gtk 3.14. Unfortunaly the
> > gtk_widget_{ref,unref} functions needed to to the same manually
> > without having the widget destroyed while it has no parent are
> > pretty new. So there is no way around #ifdef'ing the code,
> > otherwise it breaks with older gtk versions,
>
> I cannot find gtk_widget_ref/unref in
> https://developer.gnome.org/gtk3/stable/GtkWidget.html. How do they
> differ from g_object_ref(G_OBJECT(widget))?
Indeed, it doesn't exist in GTK3 so I'm not sure how this built
successfully on GTK3 ! It was deprecated in favour of g_object_ref
from 2.12 and deleted in 3.x series.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-23 16:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 15:25 [Qemu-devel] [PATCH 1/2] gtk: drop gtk_widget_set_double_buffered call Gerd Hoffmann
2014-10-23 15:25 ` [Qemu-devel] [PATCH 2/2] gtk: avoid gd_widget_reparent with gtk 3.14+ Gerd Hoffmann
2014-10-23 16:26 ` Paolo Bonzini
2014-10-23 16:31 ` Daniel P. Berrange
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).