Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <unx/gtk/atkbridge.hxx>
21 : #include <unx/gtk/gtkframe.hxx>
22 :
23 : #include "atkfactory.hxx"
24 : #include "atkutil.hxx"
25 : #include "atkwindow.hxx"
26 : #include <stdio.h>
27 :
28 0 : bool InitAtkBridge(void)
29 : {
30 : #if !GTK_CHECK_VERSION(3,0,0)
31 0 : const char* pVersion = atk_get_toolkit_version();
32 0 : if( ! pVersion )
33 0 : return false;
34 :
35 : unsigned int major, minor, micro;
36 :
37 : /* check gail minimum version requirements */
38 0 : if( sscanf( pVersion, "%u.%u.%u", &major, &minor, µ) < 3 )
39 : {
40 : // g_warning( "unable to parse gail version number" );
41 0 : return false;
42 : }
43 :
44 0 : if( ( (major << 16) | (minor << 8) | micro ) < ( (1 << 16) | 8 << 8 | 6 ) )
45 : {
46 0 : g_warning( "libgail >= 1.8.6 required for accessibility support" );
47 0 : return false;
48 : }
49 :
50 : /* Initialize the AtkUtilityWrapper class */
51 0 : g_type_class_unref( g_type_class_ref( OOO_TYPE_ATK_UTIL ) );
52 :
53 : /* Initialize the GailWindow wrapper class */
54 0 : g_type_class_unref( g_type_class_ref( OOO_TYPE_WINDOW_WRAPPER ) );
55 :
56 : /* Register AtkObject wrapper factory */
57 0 : AtkRegistry * registry = atk_get_default_registry();
58 0 : if( registry )
59 0 : atk_registry_set_factory_type( registry, OOO_TYPE_FIXED, OOO_TYPE_WRAPPER_FACTORY );
60 : #endif
61 :
62 0 : return true;
63 : }
64 :
65 0 : void DeInitAtkBridge()
66 : {
67 : #if !GTK_CHECK_VERSION(3,0,0)
68 0 : restore_gail_window_vtable();
69 : #endif
70 0 : }
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|