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 :
27 3 : bool InitAtkBridge()
28 : {
29 : #if !GTK_CHECK_VERSION(3,0,0)
30 3 : const char* pVersion = atk_get_toolkit_version();
31 3 : if( ! pVersion )
32 3 : return false;
33 :
34 : unsigned int major, minor, micro;
35 :
36 : /* check gail minimum version requirements */
37 0 : if( sscanf( pVersion, "%u.%u.%u", &major, &minor, µ) < 3 )
38 : {
39 : // g_warning( "unable to parse gail version number" );
40 0 : return false;
41 : }
42 :
43 0 : if( ( (major << 16) | (minor << 8) | micro ) < ( (1 << 16) | 8 << 8 | 6 ) )
44 : {
45 0 : g_warning( "libgail >= 1.8.6 required for accessibility support" );
46 0 : return false;
47 : }
48 :
49 : /* Initialize the AtkUtilityWrapper class */
50 0 : g_type_class_unref( g_type_class_ref( OOO_TYPE_ATK_UTIL ) );
51 :
52 : /* Initialize the GailWindow wrapper class */
53 0 : g_type_class_unref( g_type_class_ref( OOO_TYPE_WINDOW_WRAPPER ) );
54 :
55 : /* Register AtkObject wrapper factory */
56 0 : AtkRegistry * registry = atk_get_default_registry();
57 0 : if( registry )
58 0 : atk_registry_set_factory_type( registry, OOO_TYPE_FIXED, OOO_TYPE_WRAPPER_FACTORY );
59 : #endif
60 :
61 0 : return true;
62 : }
63 :
64 1 : void DeInitAtkBridge()
65 : {
66 : #if !GTK_CHECK_VERSION(3,0,0)
67 1 : restore_gail_window_vtable();
68 : #endif
69 1 : }
70 :
71 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|