Skip to content

Commit

Permalink
platform: Bump libwpe requirement to 1.14
Browse files Browse the repository at this point in the history
Bump required libwpe version to 1.14.0, which allows dropping
conditional compilation for setting target refresh rates. Always
building the code reduces the testing matrix, and version 1.14.0 is
over a year old so the change should not pose any issue for packagers.
  • Loading branch information
aperezdc committed Mar 27, 2024
1 parent b6c5fa2 commit ecf0d3a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion meson.build
Expand Up @@ -143,7 +143,7 @@ if cog_launcher_system_bus
)
endif

wpe_dep = dependency('wpe-1.0')
wpe_dep = dependency('wpe-1.0', version: '>=1.14.0')
manette_dep = dependency('manette-0.2', version: '>=0.2.4', required: false)

subdir('core')
Expand Down
10 changes: 0 additions & 10 deletions platform/drm/cog-platform-drm.c
Expand Up @@ -36,12 +36,6 @@
(LIBINPUT_VER_MAJOR == (a) && (LIBINPUT_VER_MINOR == (b)) && (LIBINPUT_VER_MICRO >= (c))))
#endif /* !LIBINPUT_CHECK_VERSION */

#if defined(WPE_CHECK_VERSION)
# define HAVE_REFRESH_RATE_HANDLING WPE_CHECK_VERSION(1, 13, 2)
#else
# define HAVE_REFRESH_RATE_HANDLING 0
#endif

#if !defined(EGL_EXT_platform_base)
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
#endif
Expand Down Expand Up @@ -1533,14 +1527,12 @@ cog_drm_platform_get_view_backend(CogPlatform *platform, WebKitWebView *related_
return wk_view_backend;
}

#if HAVE_REFRESH_RATE_HANDLING
static gboolean
set_target_refresh_rate(gpointer user_data)
{
wpe_view_backend_set_target_refresh_rate(wpe_view_data.backend, drm_data.refresh * 1000);
return G_SOURCE_REMOVE;
}
#endif /* HAVE_REFRESH_RATE_HANDLING */

static void
cog_drm_platform_init_web_view(CogPlatform *platform, WebKitWebView *view)
Expand All @@ -1549,9 +1541,7 @@ cog_drm_platform_init_web_view(CogPlatform *platform, WebKitWebView *view)

wpe_view_backend_dispatch_set_device_scale_factor(wpe_view_data.backend, drm_data.device_scale);

#if HAVE_REFRESH_RATE_HANDLING
g_idle_add(G_SOURCE_FUNC(set_target_refresh_rate), &wpe_view_data);
#endif /* HAVE_REFRESH_RATE_HANDLING */
}

static void
Expand Down
10 changes: 0 additions & 10 deletions platform/gtk4/cog-platform-gtk4.c
Expand Up @@ -25,12 +25,6 @@
#define DEFAULT_WIDTH 1280
#define DEFAULT_HEIGHT 720

#if defined(WPE_CHECK_VERSION)
# define HAVE_REFRESH_RATE_HANDLING WPE_CHECK_VERSION(1, 13, 2)
#else
# define HAVE_REFRESH_RATE_HANDLING 0
#endif

struct _CogGtk4PlatformClass {
CogPlatformClass parent_class;
};
Expand Down Expand Up @@ -158,15 +152,13 @@ setup_shader(struct platform_window* window, GError** error)
return true;
}

#if HAVE_REFRESH_RATE_HANDLING
static void
enter_monitor(GdkSurface *surface, GdkMonitor *monitor, gpointer user_data)
{
struct platform_window *win = user_data;
wpe_view_backend_set_target_refresh_rate(wpe_view_backend_exportable_fdo_get_view_backend(win->exportable),
gdk_monitor_get_refresh_rate(monitor));
}
#endif /* HAVE_REFRESH_RATE_HANDLING */

static void
realize(GtkWidget *widget, gpointer user_data)
Expand All @@ -179,10 +171,8 @@ realize(GtkWidget *widget, gpointer user_data)
g_application_quit(g_application_get_default());
}

#if HAVE_REFRESH_RATE_HANDLING
g_signal_connect(gtk_native_get_surface(gtk_widget_get_native(win->gtk_window)), "enter-monitor",
G_CALLBACK(enter_monitor), user_data);
#endif /* HAVE_REFRESH_RATE_HANDLING */
}

static gboolean
Expand Down
6 changes: 0 additions & 6 deletions platform/wayland/cog-utils-wl.h
Expand Up @@ -26,12 +26,6 @@ G_BEGIN_DECLS
#define DEFAULT_HEIGHT 768
#define DEFAULT_WIDTH 1024

#if defined(WPE_CHECK_VERSION)
# define HAVE_REFRESH_RATE_HANDLING WPE_CHECK_VERSION(1, 13, 2)
#else
# define HAVE_REFRESH_RATE_HANDLING 0
#endif

typedef struct _CogWlAxis CogWlAxis;
typedef struct _CogWlDisplay CogWlDisplay;
typedef struct _CogWlKeyboard CogWlKeyboard;
Expand Down
2 changes: 0 additions & 2 deletions platform/wayland/cog-viewport-wl.c
Expand Up @@ -127,9 +127,7 @@ surface_on_enter(void *data, struct wl_surface *surface, struct wl_output *outpu
for (unsigned i = 0; i < cog_viewport_get_n_views(COG_VIEWPORT(viewport)); i++) {
struct wpe_view_backend *backend = cog_view_get_backend(cog_viewport_get_nth_view(COG_VIEWPORT(viewport), i));

#if HAVE_REFRESH_RATE_HANDLING
wpe_view_backend_set_target_refresh_rate(backend, display->current_output->refresh);
#endif /* HAVE_REFRESH_RATE_HANDLING */

#ifdef WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION
if (can_set_surface_scale)
Expand Down

0 comments on commit ecf0d3a

Please sign in to comment.