Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtk4: set focused activity state based on window::is-active #725

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions platform/gtk4/cog-platform-gtk4.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,17 @@ on_fullscreen_change(GtkWidget* window, GParamSpec* pspec, gpointer user_data)
dispatch_wpe_fullscreen_event(win);
}

static void
on_is_active_change(GtkWidget *window, GParamSpec *pspec, gpointer user_data)
{
struct platform_window *win = user_data;
struct wpe_view_backend *backend = webkit_web_view_backend_get_wpe_backend(win->view_backend);
if (gtk_window_is_active(GTK_WINDOW(window)))
wpe_view_backend_add_activity_state(backend, wpe_view_activity_state_focused);
else
wpe_view_backend_remove_activity_state(backend, wpe_view_activity_state_focused);
}

static void
on_quit(GtkWidget* widget, gpointer data)
{
Expand Down Expand Up @@ -562,6 +573,7 @@ setup_window(struct platform_window* window)
g_signal_connect(window->gl_drawing_area, "notify::scale-factor", G_CALLBACK(scale_factor_change), window);

g_signal_connect(window->gtk_window, "notify::fullscreened", G_CALLBACK(on_fullscreen_change), window);
g_signal_connect(window->gtk_window, "notify::is-active", G_CALLBACK(on_is_active_change), window);

GtkGesture* press = gtk_gesture_click_new();
gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(press), GDK_BUTTON_PRIMARY);
Expand Down
Loading