mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-27 10:24:41 +01:00
Remove compat code for pre-2.32 glib
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
359fc9a6f2
commit
083520cea6
5 changed files with 16 additions and 44 deletions
2
README
2
README
|
@ -6,7 +6,7 @@ girara user interface library and several document libraries.
|
|||
Requirements
|
||||
------------
|
||||
gtk3
|
||||
glib (>= 2.28)
|
||||
glib (>= 2.32)
|
||||
girara (>= 0.2.4)
|
||||
sqlite3 (optional, >= 3.5.9)
|
||||
check (for tests)
|
||||
|
|
|
@ -22,7 +22,7 @@ GIRARA_MIN_VERSION = 0.2.4
|
|||
GIRARA_PKG_CONFIG_NAME = girara-gtk3
|
||||
# glib
|
||||
GLIB_VERSION_CHECK ?= 1
|
||||
GLIB_MIN_VERSION = 2.28
|
||||
GLIB_MIN_VERSION = 2.32
|
||||
GLIB_PKG_CONFIG_NAME = glib-2.0
|
||||
# GTK
|
||||
GTK_VERSION_CHECK ?= 1
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#ifndef GLIB_COMPAT_H
|
||||
#define GLIB_COMPAT_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
/* GStaticMutex is deprecated starting with glib 2.32 and got replaced with
|
||||
* GMutex */
|
||||
#if GLIB_CHECK_VERSION(2, 32, 0)
|
||||
#define mutex GMutex
|
||||
#define mutex_init(m) g_mutex_init((m))
|
||||
#define mutex_lock(m) g_mutex_lock((m))
|
||||
#define mutex_unlock(m) g_mutex_unlock((m))
|
||||
#define mutex_free(m) g_mutex_clear((m))
|
||||
#else
|
||||
#define mutex GStaticMutex
|
||||
#define mutex_init(m) g_static_mutex_init((m))
|
||||
#define mutex_lock(m) g_static_mutex_lock((m))
|
||||
#define mutex_unlock(m) g_static_mutex_unlock((m))
|
||||
#define mutex_free(m) g_static_mutex_free((m))
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -28,9 +28,6 @@ main(int argc, char* argv[])
|
|||
textdomain(GETTEXT_PACKAGE);
|
||||
|
||||
/* init gtk */
|
||||
#if !GLIB_CHECK_VERSION(2, 31, 0)
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
#if !GTK_CHECK_VERSION(3, 6, 0)
|
||||
gdk_threads_init();
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <string.h>
|
||||
#include <girara/datastructures.h>
|
||||
#include <girara/utils.h>
|
||||
#include "glib-compat.h"
|
||||
|
||||
#include "render.h"
|
||||
#include "adjustment.h"
|
||||
|
@ -34,7 +33,7 @@ static bool page_cache_is_full(ZathuraRenderer* renderer, bool* result);
|
|||
/* private data for ZathuraRenderer */
|
||||
typedef struct private_s {
|
||||
GThreadPool* pool; /**< Pool of threads */
|
||||
mutex mutex; /**< Render lock */
|
||||
GMutex mutex; /**< Render lock */
|
||||
volatile bool about_to_close; /**< Render thread is to be freed */
|
||||
|
||||
/**
|
||||
|
@ -68,7 +67,7 @@ typedef struct request_private_s {
|
|||
zathura_page_t* page;
|
||||
gint64 last_view_time;
|
||||
girara_list_t* active_jobs;
|
||||
mutex jobs_mutex;
|
||||
GMutex jobs_mutex;
|
||||
} request_private_t;
|
||||
|
||||
#define GET_PRIVATE(obj) \
|
||||
|
@ -103,7 +102,7 @@ zathura_renderer_init(ZathuraRenderer* renderer)
|
|||
priv->pool = g_thread_pool_new(render_job, renderer, 1, TRUE, NULL);
|
||||
priv->about_to_close = false;
|
||||
g_thread_pool_set_sort_function(priv->pool, render_thread_sort, NULL);
|
||||
mutex_init(&priv->mutex);
|
||||
g_mutex_init(&priv->mutex);
|
||||
|
||||
/* recolor */
|
||||
priv->recolor.enabled = false;
|
||||
|
@ -161,7 +160,7 @@ renderer_finalize(GObject* object)
|
|||
if (priv->pool != NULL) {
|
||||
g_thread_pool_free(priv->pool, TRUE, TRUE);
|
||||
}
|
||||
mutex_free(&(priv->mutex));
|
||||
g_mutex_free(&(priv->mutex));
|
||||
|
||||
free(priv->page_cache.cache);
|
||||
girara_list_free(priv->requests);
|
||||
|
@ -265,7 +264,7 @@ zathura_render_request_new(ZathuraRenderer* renderer, zathura_page_t* page)
|
|||
priv->renderer = g_object_ref(renderer);
|
||||
priv->page = page;
|
||||
priv->active_jobs = girara_list_new();
|
||||
mutex_init(&priv->jobs_mutex);
|
||||
g_mutex_init(&priv->jobs_mutex);
|
||||
|
||||
/* register the request with the renderer */
|
||||
renderer_register_request(renderer, request);
|
||||
|
@ -299,7 +298,7 @@ render_request_finalize(GObject* object)
|
|||
girara_error("This should not happen!");
|
||||
}
|
||||
girara_list_free(priv->active_jobs);
|
||||
mutex_free(&priv->jobs_mutex);
|
||||
g_mutex_free(&priv->jobs_mutex);
|
||||
|
||||
G_OBJECT_CLASS(zathura_render_request_parent_class)->finalize(object);
|
||||
}
|
||||
|
@ -407,7 +406,7 @@ zathura_renderer_lock(ZathuraRenderer* renderer)
|
|||
g_return_if_fail(ZATHURA_IS_RENDERER(renderer));
|
||||
|
||||
private_t* priv = GET_PRIVATE(renderer);
|
||||
mutex_lock(&priv->mutex);
|
||||
g_mutex_lock(&priv->mutex);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -416,7 +415,7 @@ zathura_renderer_unlock(ZathuraRenderer* renderer)
|
|||
g_return_if_fail(ZATHURA_IS_RENDERER(renderer));
|
||||
|
||||
private_t* priv = GET_PRIVATE(renderer);
|
||||
mutex_unlock(&priv->mutex);
|
||||
g_mutex_unlock(&priv->mutex);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -435,7 +434,7 @@ zathura_render_request(ZathuraRenderRequest* request, gint64 last_view_time)
|
|||
g_return_if_fail(ZATHURA_IS_RENDER_REQUEST(request));
|
||||
|
||||
request_private_t* request_priv = REQUEST_GET_PRIVATE(request);
|
||||
mutex_lock(&request_priv->jobs_mutex);
|
||||
g_mutex_lock(&request_priv->jobs_mutex);
|
||||
|
||||
bool unfinished_jobs = false;
|
||||
/* check if there are any active jobs left */
|
||||
|
@ -462,7 +461,7 @@ zathura_render_request(ZathuraRenderRequest* request, gint64 last_view_time)
|
|||
g_thread_pool_push(priv->pool, job, NULL);
|
||||
}
|
||||
|
||||
mutex_unlock(&request_priv->jobs_mutex);
|
||||
g_mutex_unlock(&request_priv->jobs_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -471,11 +470,11 @@ zathura_render_request_abort(ZathuraRenderRequest* request)
|
|||
g_return_if_fail(ZATHURA_IS_RENDER_REQUEST(request));
|
||||
|
||||
request_private_t* request_priv = REQUEST_GET_PRIVATE(request);
|
||||
mutex_lock(&request_priv->jobs_mutex);
|
||||
g_mutex_lock(&request_priv->jobs_mutex);
|
||||
GIRARA_LIST_FOREACH(request_priv->active_jobs, render_job_t*, iter, job)
|
||||
job->aborted = true;
|
||||
GIRARA_LIST_FOREACH_END(request_priv->active_jobs, render_job_t*, iter, job);
|
||||
mutex_unlock(&request_priv->jobs_mutex);
|
||||
g_mutex_unlock(&request_priv->jobs_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -494,9 +493,9 @@ remove_job_and_free(render_job_t* job)
|
|||
{
|
||||
request_private_t* request_priv = REQUEST_GET_PRIVATE(job->request);
|
||||
|
||||
mutex_lock(&request_priv->jobs_mutex);
|
||||
g_mutex_lock(&request_priv->jobs_mutex);
|
||||
girara_list_remove(request_priv->active_jobs, job);
|
||||
mutex_unlock(&request_priv->jobs_mutex);
|
||||
g_mutex_unlock(&request_priv->jobs_mutex);
|
||||
|
||||
g_object_unref(job->request);
|
||||
g_free(job);
|
||||
|
|
Loading…
Add table
Reference in a new issue