All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon
@ 2013-03-30 14:21 Stefan Weil
  2013-04-02 20:21 ` Anthony Liguori
  2013-04-10 11:48 ` Jan Kiszka
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Weil @ 2013-03-30 14:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil, Anthony Liguori

The QEMU icon which is already used for SDL
is now also loaded by GTK.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 ui/gtk.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index a5a8156..c15023b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1363,6 +1363,7 @@ static const DisplayChangeListenerOps dcl_ops = {
 void gtk_display_init(DisplayState *ds)
 {
     GtkDisplayState *s = g_malloc0(sizeof(*s));
+    char *filename;
 
     gtk_init(NULL, NULL);
 
@@ -1394,6 +1395,18 @@ void gtk_display_init(DisplayState *ds)
 
     gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), s->drawing_area, gtk_label_new("VGA"));
 
+    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");
+    if (filename) {
+        GError *error = NULL;
+        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, &error);
+        if (pixbuf) {
+            gtk_window_set_icon(GTK_WINDOW(s->window), pixbuf);
+        } else {
+            g_error_free(error);
+        }
+        g_free(filename);
+    }
+
     gd_create_menus(s);
 
     gd_connect_signals(s);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon
  2013-03-30 14:21 [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon Stefan Weil
@ 2013-04-02 20:21 ` Anthony Liguori
  2013-04-10 11:48 ` Jan Kiszka
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2013-04-02 20:21 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: Anthony Liguori

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon
  2013-03-30 14:21 [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon Stefan Weil
  2013-04-02 20:21 ` Anthony Liguori
@ 2013-04-10 11:48 ` Jan Kiszka
  2013-04-11 19:46   ` Stefan Weil
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2013-04-10 11:48 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Anthony Liguori, qemu-devel

On 2013-03-30 15:21, Stefan Weil wrote:
> The QEMU icon which is already used for SDL
> is now also loaded by GTK.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  ui/gtk.c |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index a5a8156..c15023b 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -1363,6 +1363,7 @@ static const DisplayChangeListenerOps dcl_ops = {
>  void gtk_display_init(DisplayState *ds)
>  {
>      GtkDisplayState *s = g_malloc0(sizeof(*s));
> +    char *filename;
>  
>      gtk_init(NULL, NULL);
>  
> @@ -1394,6 +1395,18 @@ void gtk_display_init(DisplayState *ds)
>  
>      gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), s->drawing_area, gtk_label_new("VGA"));
>  
> +    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");
> +    if (filename) {
> +        GError *error = NULL;
> +        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, &error);
> +        if (pixbuf) {
> +            gtk_window_set_icon(GTK_WINDOW(s->window), pixbuf);
> +        } else {
> +            g_error_free(error);
> +        }
> +        g_free(filename);
> +    }
> +
>      gd_create_menus(s);
>  
>      gd_connect_signals(s);
> 

With gtk 2.22 I'm lacking transparency of that icon (it has a white
background). The icon is fine with SDL. Is that an issue of this
particular gtk version or actually a general problem with
gdk_pixbuf_new_from_file?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon
  2013-04-10 11:48 ` Jan Kiszka
@ 2013-04-11 19:46   ` Stefan Weil
  2013-04-12  6:55     ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2013-04-11 19:46 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Anthony Liguori, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]

Am 10.04.2013 13:48, schrieb Jan Kiszka:
> On 2013-03-30 15:21, Stefan Weil wrote:
>> The QEMU icon which is already used for SDL
>> is now also loaded by GTK.
>>
>> Signed-off-by: Stefan Weil<sw@weilnetz.de>
>> ---
>>   ui/gtk.c |   13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/ui/gtk.c b/ui/gtk.c
>> index a5a8156..c15023b 100644
>> --- a/ui/gtk.c
>> +++ b/ui/gtk.c
>> @@ -1363,6 +1363,7 @@ static const DisplayChangeListenerOps dcl_ops = {
>>   void gtk_display_init(DisplayState *ds)
>>   {
>>       GtkDisplayState *s = g_malloc0(sizeof(*s));
>> +    char *filename;
>>
>>       gtk_init(NULL, NULL);
>>
>> @@ -1394,6 +1395,18 @@ void gtk_display_init(DisplayState *ds)
>>
>>       gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), s->drawing_area, gtk_label_new("VGA"));
>>
>> +    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");
>> +    if (filename) {
>> +        GError *error = NULL;
>> +        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename,&error);
>> +        if (pixbuf) {
>> +            gtk_window_set_icon(GTK_WINDOW(s->window), pixbuf);
>> +        } else {
>> +            g_error_free(error);
>> +        }
>> +        g_free(filename);
>> +    }
>> +
>>       gd_create_menus(s);
>>
>>       gd_connect_signals(s);
>>
>
> With gtk 2.22 I'm lacking transparency of that icon (it has a white
> background). The icon is fine with SDL. Is that an issue of this
> particular gtk version or actually a general problem with
> gdk_pixbuf_new_from_file?
>
> Jan

I'm afraid that you won't get a transparent background as long
as the image format does not support transparency.

SDL only accepts BMP files and obviously translates the white background
to a transparent one.

I could have added a PNG icon for gtk, but did not do so because I
thought that the BMP file looked sufficiently good (better than the
default icon on my Debian hosts). There could be a GUI option
which allows setting an arbitrary icon file. It would allow users
to choose icons with transparency for gtk and also different icons
for multiple QEMU instances.

Stefan

PS. Try the appended qemu-icon.bmp. It won't work with SDL, but show
the desired result with gtk because it is not a BMP file, but a PNG
file with transparent background.



[-- Attachment #2: qemu-icon.bmp --]
[-- Type: image/bmp, Size: 576 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon
  2013-04-11 19:46   ` Stefan Weil
@ 2013-04-12  6:55     ` Jan Kiszka
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2013-04-12  6:55 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Anthony Liguori, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2566 bytes --]

On 2013-04-11 21:46, Stefan Weil wrote:
> Am 10.04.2013 13:48, schrieb Jan Kiszka:
>> On 2013-03-30 15:21, Stefan Weil wrote:
>>> The QEMU icon which is already used for SDL
>>> is now also loaded by GTK.
>>>
>>> Signed-off-by: Stefan Weil<sw@weilnetz.de>
>>> ---
>>>   ui/gtk.c |   13 +++++++++++++
>>>   1 file changed, 13 insertions(+)
>>>
>>> diff --git a/ui/gtk.c b/ui/gtk.c
>>> index a5a8156..c15023b 100644
>>> --- a/ui/gtk.c
>>> +++ b/ui/gtk.c
>>> @@ -1363,6 +1363,7 @@ static const DisplayChangeListenerOps dcl_ops = {
>>>   void gtk_display_init(DisplayState *ds)
>>>   {
>>>       GtkDisplayState *s = g_malloc0(sizeof(*s));
>>> +    char *filename;
>>>
>>>       gtk_init(NULL, NULL);
>>>
>>> @@ -1394,6 +1395,18 @@ void gtk_display_init(DisplayState *ds)
>>>
>>>       gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook),
>>> s->drawing_area, gtk_label_new("VGA"));
>>>
>>> +    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");
>>> +    if (filename) {
>>> +        GError *error = NULL;
>>> +        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename,&error);
>>> +        if (pixbuf) {
>>> +            gtk_window_set_icon(GTK_WINDOW(s->window), pixbuf);
>>> +        } else {
>>> +            g_error_free(error);
>>> +        }
>>> +        g_free(filename);
>>> +    }
>>> +
>>>       gd_create_menus(s);
>>>
>>>       gd_connect_signals(s);
>>>
>>
>> With gtk 2.22 I'm lacking transparency of that icon (it has a white
>> background). The icon is fine with SDL. Is that an issue of this
>> particular gtk version or actually a general problem with
>> gdk_pixbuf_new_from_file?
>>
>> Jan
> 
> I'm afraid that you won't get a transparent background as long
> as the image format does not support transparency.
> 
> SDL only accepts BMP files and obviously translates the white background
> to a transparent one.
> 
> I could have added a PNG icon for gtk, but did not do so because I
> thought that the BMP file looked sufficiently good (better than the
> default icon on my Debian hosts). There could be a GUI option
> which allows setting an arbitrary icon file. It would allow users
> to choose icons with transparency for gtk and also different icons
> for multiple QEMU instances.
> 
> Stefan
> 
> PS. Try the appended qemu-icon.bmp. It won't work with SDL, but show
> the desired result with gtk because it is not a BMP file, but a PNG
> file with transparent background.

Then why not use separate icons for both UIs (until SDL is removed)?

Jan



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-12  6:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-30 14:21 [Qemu-devel] [PATCH] ui/gtk: Set QEMU window icon Stefan Weil
2013-04-02 20:21 ` Anthony Liguori
2013-04-10 11:48 ` Jan Kiszka
2013-04-11 19:46   ` Stefan Weil
2013-04-12  6:55     ` Jan Kiszka

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.