mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
wayland: Add request focus support via gtk_shell
A gtk_surface.present request was added to gtk_surface which takes timestamp from some input event, and uses that timestamp to figure out whether the window can be presented or not. If we don't have a timestamp, we should just give up instead of making up our own, otherwise we might steal someones focus. https://bugzilla.gnome.org/show_bug.cgi?id=763037
This commit is contained in:
parent
ed430dc00a
commit
8fb7f50028
@ -2093,6 +2093,19 @@ static void
|
|||||||
gdk_wayland_window_focus (GdkWindow *window,
|
gdk_wayland_window_focus (GdkWindow *window,
|
||||||
guint32 timestamp)
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
|
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||||
|
|
||||||
|
if (!impl->display_server.gtk_surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* We didn't have an event to fetch a time from, meaning we have nothing valid
|
||||||
|
* to send. This should rather be translated to a 'needs-attention' request or
|
||||||
|
* something.
|
||||||
|
*/
|
||||||
|
if (timestamp == GDK_CURRENT_TIME)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
|
|
||||||
<request name="set_modal"/>
|
<request name="set_modal"/>
|
||||||
<request name="unset_modal"/>
|
<request name="unset_modal"/>
|
||||||
|
|
||||||
|
<request name="present">
|
||||||
|
<arg name="time" type="uint"/>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
Reference in New Issue
Block a user