Skip to contentSkip to conversation

ui/gtk: New -display gtk option 'full-screen-on-monitor'.

PATCH Gerd Hoffmann 2 participants 4 messages Jun 23, 2021 – Jun 24, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 2 lines · Swee Aun

This lets user select monitor number to display QEMU in full screen with -display gtk,full-screen-on-monitor=<value>.

../../ui/gtk.c: In function 'gtk_display_init':
../../ui/gtk.c:2300:25: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'int64_t' {aka 'long long int'} [-Werror=format=]
2300 | warn_report("Failed to enable full screen on monitor %ld. "

      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
 2303 |                         opts->u.gtk.full_screen_on_monitor, monitor_n);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int64_t {aka long long int}

take care,
Gerd

#2 lore raw

Hi Gerd,
I am able to compile the code without error with my v3 patch. I don't see my patch showing up in https://patchew.org/QEMU/ , is it due to this compilation error?

I tried to change from %ld -> %lld but I encountered compilation error this time.

../ui/gtk.c: In function 'gtk_display_init':
../ui/gtk.c:2300:25: error: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int64_t' {aka 'long int'} [-Werror=format=]
2300 | warn_report("Failed to enable full screen on monitor %lld. "

      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
 2303 |                         opts->u.gtk.full_screen_on_monitor, monitor_n);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int64_t {aka long int}

cc1: all warnings being treated as errors

Suspect it is due to variants of host machine, I think I will change it to use PRId64 which is more generic for all platform like below. What you think? warn_report("Failed to enable full screen on monitor %" PRId64 ". "
"Current total number of monitors is %d, "
"please verify full-screen-on-monitor option value.",
opts->u.gtk.full_screen_on_monitor, monitor_n);

or you prefer casting ? This seems working as well. warn_report("Failed to enable full screen on monitor %lld . "
"Current total number of monitors is %d, " "please verify full-screen-on-monitor option value.", (long long)opts->u.gtk.full_screen_on_monitor, monitor_n);

Regards,
SweeAun

-----Original Message-----
From: Gerd Hoffmann <[email protected]>
Sent: Wednesday, June 23, 2021 8:34 PM
To: Khor, Swee Aun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Romli, Khairul Anuar <[email protected]>; Kasireddy, Vivek <[email protected]>; Mazlan, Hazwan Arif <[email protected]>; [email protected]
Subject: Re: [PATCH v3] ui/gtk: New -display gtk option 'full-screen-on-monitor'.

Quoted 2 lines · Swee Aun

This lets user select monitor number to display QEMU in full screen with -display gtk,full-screen-on-monitor=<value>.

../../ui/gtk.c: In function 'gtk_display_init':
../../ui/gtk.c:2300:25: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'int64_t' {aka 'long long int'} [-Werror=format=]
2300 | warn_report("Failed to enable full screen on monitor %ld. "

      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
 2303 |                         opts->u.gtk.full_screen_on_monitor, monitor_n);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int64_t {aka long long int}

take care,
Gerd

#3 lore raw
Quoted 8 lines · Swee Aun

Hi Gerd,
I am able to compile the code without error with my v3 patch. I don't see my patch showing up in https://patchew.org/QEMU/ , is it due to this compilation error?

I tried to change from %ld -> %lld but I encountered compilation error this time.

../ui/gtk.c: In function 'gtk_display_init':
../ui/gtk.c:2300:25: error: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int64_t' {aka 'long int'} [-Werror=format=]
2300 | warn_report("Failed to enable full screen on monitor %lld. "

Quoted 7 lines
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
 2303 |                         opts->u.gtk.full_screen_on_monitor, monitor_n);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int64_t {aka long int}

cc1: all warnings being treated as errors

stdint.h also has #defines for printing integers (PRI{x,d}{8,16,32,64}), they make sure the correct format string is used.

PRId64 would be the one for int64_t

take care,
Gerd

#4 lore raw

Thanks Gerd. I will submit another patch using PRId64 In warn_report.

Regards,
SweeAun

-----Original Message-----
From: Gerd Hoffmann <[email protected]>
Sent: Thursday, June 24, 2021 4:49 PM
To: Khor, Swee Aun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Romli, Khairul Anuar <[email protected]>; Kasireddy, Vivek <[email protected]>; Mazlan, Hazwan Arif <[email protected]>
Subject: Re: [PATCH v3] ui/gtk: New -display gtk option 'full-screen-on-monitor'.

Quoted 8 lines · Swee Aun

Hi Gerd,
I am able to compile the code without error with my v3 patch. I don't see my patch showing up in https://patchew.org/QEMU/ , is it due to this compilation error?

I tried to change from %ld -> %lld but I encountered compilation error this time.

../ui/gtk.c: In function 'gtk_display_init':
../ui/gtk.c:2300:25: error: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int64_t' {aka 'long int'} [-Werror=format=]
2300 | warn_report("Failed to enable full screen on monitor %lld. "

Quoted 7 lines
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
 2303 |                         opts->u.gtk.full_screen_on_monitor, monitor_n);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int64_t {aka long int}

cc1: all warnings being treated as errors

stdint.h also has #defines for printing integers (PRI{x,d}{8,16,32,64}), they make sure the correct format string is used.

PRId64 would be the one for int64_t

take care,
Gerd