Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2022-11-08 03:36:45 +0300
committerBartosz Taudul <wolf@nereid.pl>2022-11-08 03:36:45 +0300
commit53d54092b08f6352392afcbe5ef2705a0c19efb5 (patch)
tree547207508690e622eaa8764a556651b4004e14eb
parenta7ba5dd9df4f52efa9ae575edcc3f90cb211968b (diff)
Implement attention requests.
-rw-r--r--profiler/src/BackendWayland.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/profiler/src/BackendWayland.cpp b/profiler/src/BackendWayland.cpp
index c58ad726..74336693 100644
--- a/profiler/src/BackendWayland.cpp
+++ b/profiler/src/BackendWayland.cpp
@@ -13,6 +13,7 @@
#include <wayland-cursor.h>
#include <wayland-egl.h>
+#include "wayland/xdg-activation.h"
#include "wayland/xdg-shell.h"
#include "Backend.hpp"
@@ -37,6 +38,8 @@ static struct wl_pointer* s_pointer;
static struct wl_cursor_theme* s_cursorTheme;
static struct wl_surface* s_cursorSurf;
static int32_t s_cursorX, s_cursorY;
+static struct xdg_activation_v1* s_activation;
+static struct xdg_activation_token_v1* s_actToken;
static bool s_running = true;
static int s_w, s_h;
@@ -182,6 +185,10 @@ static void RegistryGlobalCb( void*, struct wl_registry* reg, uint32_t name, con
s_seat = (wl_seat*)wl_registry_bind( reg, name, &wl_seat_interface, 7 );
wl_seat_add_listener( s_seat, &seatListener, nullptr );
}
+ else if( strcmp( interface, xdg_activation_v1_interface.name ) == 0 )
+ {
+ s_activation = (xdg_activation_v1*)wl_registry_bind( reg, name, &xdg_activation_v1_interface, 1 );
+ }
}
constexpr struct wl_registry_listener registryListener = {
@@ -307,6 +314,8 @@ Backend::Backend( const char* title, std::function<void()> redraw, RunQueue* mai
Backend::~Backend()
{
+ if( s_actToken ) xdg_activation_token_v1_destroy( s_actToken );
+ if( s_activation ) xdg_activation_v1_destroy( s_activation );
if( s_pointer ) wl_pointer_destroy( s_pointer );
eglMakeCurrent( s_eglDpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
eglDestroySurface( s_eglDpy, s_eglSurf );
@@ -339,8 +348,27 @@ void Backend::Run()
}
}
+
+static void TokenDone( void*, xdg_activation_token_v1* token, const char* str )
+{
+ xdg_activation_v1_activate( s_activation, str, s_surf );
+ xdg_activation_token_v1_destroy( token );
+ s_actToken = nullptr;
+}
+
+constexpr struct xdg_activation_token_v1_listener tokenListener = {
+ .done = TokenDone
+};
+
+
void Backend::Attention()
{
+ if( !s_activation ) return;
+ if( s_actToken ) return;
+ s_actToken = xdg_activation_v1_get_activation_token( s_activation );
+ xdg_activation_token_v1_set_surface( s_actToken, s_surf );
+ xdg_activation_token_v1_commit( s_actToken );
+ xdg_activation_token_v1_add_listener( s_actToken, &tokenListener, nullptr );
}
void Backend::NewFrame( int& w, int& h )