diff mbox series

[PATCH-for-9.1,v2,3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation

Message ID 20240318113140.88151-4-philmd@linaro.org
State New
Headers show
Series ui/display: Introduce API to change console orientation | expand

Commit Message

Philippe Mathieu-Daudé March 18, 2024, 11:31 a.m. UTC
Add the 'rotate_arcdegree' field to QemuGraphicConsole and
remove the use of the 'graphic_rotate' global.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 ui/console.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Akihiko Odaki March 19, 2024, 2:54 a.m. UTC | #1
On 2024/03/18 20:31, Philippe Mathieu-Daudé wrote:
> Add the 'rotate_arcdegree' field to QemuGraphicConsole and
> remove the use of the 'graphic_rotate' global.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>

> ---
>   ui/console.c | 15 +++++++++++----
>   1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/ui/console.c b/ui/console.c
> index 84aee76846..94624c37ae 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -37,7 +37,6 @@
>   #include "trace.h"
>   #include "exec/memory.h"
>   #include "qom/object.h"
> -#include "sysemu/sysemu.h"
>   
>   #include "console-priv.h"
>   
> @@ -51,6 +50,8 @@ typedef struct QemuGraphicConsole {
>   
>       QEMUCursor *cursor;
>       int cursor_x, cursor_y, cursor_on;
> +
> +    unsigned rotate_arcdegree;
>   } QemuGraphicConsole;
>   
>   typedef QemuConsoleClass QemuGraphicConsoleClass;
> @@ -210,17 +211,23 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
>   
>   void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
>   {
> -    graphic_rotate = arcdegree;
> +    QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
> +
> +    gc->rotate_arcdegree = arcdegree;
>   }
>   
>   bool qemu_console_is_rotated(QemuConsole *con)
>   {
> -    return graphic_rotate != 0;
> +    QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
> +
> +    return gc->rotate_arcdegree != 0;
>   }
>   
>   unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
>   {
> -    return graphic_rotate;
> +    QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
> +
> +    return gc->rotate_arcdegree;
>   }
>   
>   void graphic_hw_invalidate(QemuConsole *con)
diff mbox series

Patch

diff --git a/ui/console.c b/ui/console.c
index 84aee76846..94624c37ae 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -37,7 +37,6 @@ 
 #include "trace.h"
 #include "exec/memory.h"
 #include "qom/object.h"
-#include "sysemu/sysemu.h"
 
 #include "console-priv.h"
 
@@ -51,6 +50,8 @@  typedef struct QemuGraphicConsole {
 
     QEMUCursor *cursor;
     int cursor_x, cursor_y, cursor_on;
+
+    unsigned rotate_arcdegree;
 } QemuGraphicConsole;
 
 typedef QemuConsoleClass QemuGraphicConsoleClass;
@@ -210,17 +211,23 @@  void qemu_console_set_window_id(QemuConsole *con, int window_id)
 
 void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
 {
-    graphic_rotate = arcdegree;
+    QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
+
+    gc->rotate_arcdegree = arcdegree;
 }
 
 bool qemu_console_is_rotated(QemuConsole *con)
 {
-    return graphic_rotate != 0;
+    QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
+
+    return gc->rotate_arcdegree != 0;
 }
 
 unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
 {
-    return graphic_rotate;
+    QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
+
+    return gc->rotate_arcdegree;
 }
 
 void graphic_hw_invalidate(QemuConsole *con)