diff options
author | Keith Packard <keithp@keithp.com> | 2015-09-01 18:50:55 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-09-02 14:31:33 -0700 |
commit | cfefe6738ff6d8cd303d00c15a57425aa6799eba (patch) | |
tree | dcc08e0977af266e1d88a12e38a7c0ec6c8777b2 | |
parent | 2b2c3bb0c8fc8fc09bb135f5ce3aeed037f09a8d (diff) |
Switch to the libXfont2 API (v2)new-font-api
This new libXfont API eliminates exposing internal X server symbols to
the font library, replacing those with a struct full of the entire API
needed to use that library.
v2: Use libXfont2 instead of libXfont_2
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | dix/dixfonts.c | 66 |
2 files changed, 58 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index 1f39331fb..08fef10c5 100644 --- a/configure.ac +++ b/configure.ac @@ -794,7 +794,7 @@ LIBEGL="egl" LIBGBM="gbm >= 10.2.0" LIBGL="gl >= 7.1.0" LIBXEXT="xext >= 1.0.99.4" -LIBXFONT="xfont >= 1.4.2" +LIBXFONT="xfont2 >= 2.0.0" LIBXI="xi >= 1.2.99.1" LIBXTST="xtst >= 1.0.99.2" LIBPCIACCESS="pciaccess >= 0.12.901" diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 300bf043a..3ed88ac55 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -65,6 +65,7 @@ Equipment Corporation. #include "closestr.h" #include "dixfont.h" #include "xace.h" +#include <X11/fonts/libxfont2.h> #ifdef XF86BIGFONT #include "xf86bigfontsrv.h" @@ -1804,22 +1805,76 @@ DeleteClientFontStuff(ClientPtr client) } } +static int +register_fpe_funcs(const font_fpe_funcs_rec *funcs) +{ + return RegisterFPEFunctions(funcs->name_func, + funcs->init_func, + funcs->free_func, + funcs->reset_func, + funcs->open_func, + funcs->close_func, + funcs->list_func, + funcs->start_lfwi_func, + funcs->next_lfwi_func, + funcs->wakeup_func, + funcs->client_died, + funcs->load_glyphs, + funcs->start_list_alias_func, + funcs->next_list_alias_func, + funcs->set_path_func); +} + +static unsigned long +get_server_generation(void) +{ + return serverGeneration; +} + +static void * +get_server_client(void) +{ + return serverClient; +} + +static const font_client_funcs_rec font_client_funcs = { + .version = FONT_CLIENT_FUNCS_VERSION, + .client_auth_generation = client_auth_generation, + .client_signal = ClientSignal, + .delete_font_client_id = DeleteFontClientID, + .verrorf = VErrorF, + .find_old_font = find_old_font, + .get_client_resolutions = GetClientResolutions, + .get_default_point_size = GetDefaultPointSize, + .get_new_font_client_id = GetNewFontClientID, + .get_time_in_millis = GetTimeInMillis, + .init_fs_handlers = init_fs_handlers, + .register_fpe_funcs = register_fpe_funcs, + .remove_fs_handlers = remove_fs_handlers, + .get_server_client = get_server_client, + .set_font_authorizations = set_font_authorizations, + .store_font_client_font = StoreFontClientFont, + .make_atom = MakeAtom, + .valid_atom = ValidAtom, + .name_for_atom = NameForAtom, + .get_server_generation = get_server_generation, +}; + void InitFonts(void) { patternCache = MakeFontPatternCache(); + font_register_client_funcs(&font_client_funcs); register_fpe_functions(); } -_X_EXPORT int GetDefaultPointSize(void) { return 120; } -_X_EXPORT FontResolutionPtr GetClientResolutions(int *num) { @@ -1852,7 +1907,6 @@ GetClientResolutions(int *num) * should be called (only once!) by each type of fpe when initialized */ -_X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func, InitFpeFunc init_func, @@ -1923,28 +1977,24 @@ find_old_font(XID id) return (FontPtr) pFont; } -_X_EXPORT Font GetNewFontClientID(void) { return FakeClientID(0); } -_X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id) { return AddResource(id, RT_NONE, (void *) pfont); } -_X_EXPORT void DeleteFontClientID(Font id) { FreeResource(id, RT_NONE); } -_X_EXPORT int client_auth_generation(ClientPtr client) { @@ -1954,7 +2004,6 @@ client_auth_generation(ClientPtr client) static int fs_handlers_installed = 0; static unsigned int last_server_gen; -_X_EXPORT int init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) { @@ -1973,7 +2022,6 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) return Successful; } -_X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bool all) |