Commit Graph

28 Commits

Author SHA1 Message Date
Bilal Elmoussaoui
7c67084055 Relicense as LGPLv2.1+ 2023-06-01 12:04:35 +01:00
Bilal Elmoussaoui
b23bdcffd7 In certain cases, you might want to control the VM size when running
QEMU instead of having libmks handling that when resizing the widget

This also would allow having an option for auto-scaling that would
scale the texture to fit the widget size
2023-05-31 20:13:06 +01:00
Christian Hergert
6a024f0e5d Merge branch 'bilelmoussaoui/reconfigure' into 'main'
display: Reconfigure screen when size change

See merge request chergert/libmks!13
2023-05-17 20:11:49 +00:00
Bilal Elmoussaoui
a804f766f9 display: Reconfigure screen when size change
Otherwise the VM would have no idea about the size of the target widget.
To do so, we introduce a ScreenResizer object that remembers the previous
screen attributes as well the next attributes to configure.
Taking care of scheduling resize operations and avoids submitting
the same attributes twice.
2023-05-10 00:32:35 +02:00
Bilal Elmoussaoui
b4fade7fe1 cleanup: Drop useless conditions 2023-04-13 15:04:40 +02:00
Bilal Elmoussaoui
5783b6a8ce display: Grab focus on MksDisplayPicture 2023-04-03 22:17:31 +02:00
Christian Hergert
edd88dcec3 util: add simple tracing macros 2023-02-27 20:23:25 -08:00
Christian Hergert
04e2bf0b00 lib: don't propagate when creating inhibitor 2023-02-17 16:30:46 -08:00
Christian Hergert
459cb173b0 lib: add MksDisplay:ungrab-trigger
This allows setting a customizable trigger which may be used to ungrab
the display. Currently, the default is ctrl+alt+g and the only thing that
will be released is the shortcut inhibition.
2023-02-17 15:50:02 -08:00
Christian Hergert
1a4bcb8c31 lib: release inhibitor with dispose 2023-02-17 15:38:06 -08:00
Christian Hergert
3794f43ee1 lib: acquire inhibitor on first mouse-press
This will allow us to receive input like Super for the activities overview
while the widget is active.

We still need a way to release the grab, but that will come soon.
2023-02-17 15:34:36 -08:00
Christian Hergert
d0909732f4 lib: add MksDisplayPicture
This is a child widget to the MksDisplay which contains just the paintable
region of the remote screen. Doing so allows us to avoid having to handle
crossing events carefully for things like cursors.

Instead, now the MksDisplay calculates the area for the picture and
allocates it there. The MksDisplayPicture will always snapshot the
paintable using the full area it has been allocated.

Event processing can also largely move into the Picture widget which
simplifies bounds checking.
2023-02-17 11:40:47 -08:00
Christian Hergert
5657997f4a lib: set controller to capture phase
Just so we don't chance it and loose events to GTK.
2023-02-15 19:22:57 -08:00
Christian Hergert
d533773cf7 lib: fix absolute x,y mouse position 2023-02-15 18:02:51 -08:00
Christian Hergert
a57f55e24c lib: remove "none" initial cursor
We don't always get a cursor from the peer at startup. So ignore it until
we get a cursor delivered.
2023-02-15 18:00:29 -08:00
Christian Hergert
7d7ccea630 lib: allow shrinking display 2023-02-15 17:52:48 -08:00
Christian Hergert
62f084b0b4 lib: robustness fixes for mouse movement 2023-02-15 17:52:40 -08:00
Christian Hergert
0a7c1ff21c lib: use mouse-set from peer to update local position
We may need to tweak this for relative mouse positions if we find we dont
get reliable information from the peer. But this is a start, which I see
we get back from Qemu at least when we're in -enable-kvm mode.
2023-02-15 12:16:47 -08:00
Christian Hergert
5c52047800 lib: set cursor from guest provided texture data 2023-02-15 12:02:03 -08:00
Christian Hergert
8dd08014b1 lib: set "none" for cursor in display
We have a remote cursor to deal with.
2023-02-15 11:34:38 -08:00
Christian Hergert
3d89b77ed2 lib: ensure display widget is focusable
Otherwise we won't get keyboard input.
2023-02-15 11:34:17 -08:00
Christian Hergert
7c63e051fd lib: use legacy event controller
Now that we are doing our own paintable management, we can more easily
transition to doing our own event management with the Legacy event
controller (which, despite the name, really just allows us to get more
direct GdkEvent for processing).

Additionally, this adds support for scroll events to the guest.
2023-02-15 10:38:24 -08:00
Christian Hergert
2286183747 lib: export paintable properties
This is mostly useful so that we can see things within the inspector at
runtime in case we need to debug what backends are used.
2023-02-15 07:01:32 -08:00
Christian Hergert
a8505e1245 lib: remove use of GtkPicture
We want a bit more control over things than we can get with GtkPicture so
do the snapshot/measure internally. This allows us to know where the
picture is to be allocated so that we can translate pointer events to the
location within the console.
2023-02-15 06:47:10 -08:00
Christian Hergert
6c5829d949 lib: make clicks and motion work
We need to handle a mouse that is not absolute positioned (the default it
seems) and this does that (crudely for the moment until we have some sort
of grab management).

Additionally, click events are propagated to the Qemu instance as well.
2023-02-14 14:19:12 -08:00
Christian Hergert
beb7299d25 lib: add basic input controllers to MksDisplay
Still plenty to do on the motion bits, but at least basic key controller
events propagate now.
2023-02-14 13:34:45 -08:00
Christian Hergert
6beaf8b925 lib: encapsulate GtkPicture within MksDisplay
We don't need to do this manually now that we have GtkPicture working
correctly with content-fit. We still want to maintain our own widget to
manage things like grabs and all that though.
2023-02-14 11:18:48 -08:00
Christian Hergert
d20dcd2674 lib: start on MksDisplay widget 2023-02-13 21:53:57 -08:00