summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-23 13:59:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-23 21:47:55 +0200
commit30d43a7ebac16848533ecd7e834201d566388a19 (patch)
tree1b976ae7ce72067ab46493ef79db5bfa6a55ffa6 /vcl
parenta4c83a91101f35d5b3fa646b42cf95a0d139f05c (diff)
forward more a11y stuff for native drawing area widget
Change-Id: Ic5529a73e317fb652944155fabc889b693447355 Reviewed-on: https://gerrit.libreoffice.org/54704 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/a11y/atkcomponent.cxx67
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.hxx1
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx1
4 files changed, 57 insertions, 14 deletions
diff --git a/vcl/unx/gtk/a11y/atkcomponent.cxx b/vcl/unx/gtk/a11y/atkcomponent.cxx
index c062e12e2415..7d8a4bdc5bba 100644
--- a/vcl/unx/gtk/a11y/atkcomponent.cxx
+++ b/vcl/unx/gtk/a11y/atkcomponent.cxx
@@ -18,23 +18,33 @@
*/
#include "atkwrapper.hxx"
-
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <gtk/gtk.h>
using namespace ::com::sun::star;
+AtkObjectWrapper* getObjectWrapper(AtkComponent *pComponent)
+{
+ AtkObjectWrapper *pWrap = nullptr;
+ if (ATK_IS_OBJECT_WRAPPER(pComponent))
+ pWrap = ATK_OBJECT_WRAPPER(pComponent);
+ else if (GTK_IS_DRAWING_AREA(pComponent)) //when using a GtkDrawingArea as a custom widget in welded gtk3
+ {
+ GtkWidget* pDrawingArea = GTK_WIDGET(pComponent);
+ AtkObject* pAtkObject = gtk_widget_get_accessible(pDrawingArea);
+ pWrap = ATK_IS_OBJECT_WRAPPER(pAtkObject) ? ATK_OBJECT_WRAPPER(pAtkObject) : nullptr;
+ }
+ return pWrap;
+}
+
/// @throws uno::RuntimeException
static css::uno::Reference<css::accessibility::XAccessibleComponent>
- getComponent( AtkComponent *pComponent )
+ getComponent(AtkObjectWrapper *pWrap)
{
- AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pComponent );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpComponent.is() )
- {
+ if (!pWrap->mpComponent.is())
pWrap->mpComponent.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
return pWrap->mpComponent;
}
@@ -60,10 +70,15 @@ extern "C" {
static gboolean
component_wrapper_grab_focus (AtkComponent *component)
{
+ AtkObjectWrapper* obj = getObjectWrapper(component);
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit a11y
+ if (obj && obj->mpOrig)
+ return atk_component_grab_focus(ATK_COMPONENT(obj->mpOrig));
+
try
{
css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
- = getComponent( component );
+ = getComponent(obj);
if( pComponent.is() )
{
pComponent->grabFocus();
@@ -86,10 +101,15 @@ component_wrapper_contains (AtkComponent *component,
gint y,
AtkCoordType coord_type)
{
+ AtkObjectWrapper* obj = getObjectWrapper(component);
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit a11y
+ if (obj && obj->mpOrig)
+ return atk_component_contains(ATK_COMPONENT(obj->mpOrig), x, y, coord_type);
+
try
{
css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
- = getComponent( component );
+ = getComponent(obj);
if( pComponent.is() )
return pComponent->containsPoint( translatePoint( pComponent, x, y, coord_type ) );
}
@@ -109,10 +129,15 @@ component_wrapper_ref_accessible_at_point (AtkComponent *component,
gint y,
AtkCoordType coord_type)
{
+ AtkObjectWrapper* obj = getObjectWrapper(component);
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit a11y
+ if (obj && obj->mpOrig)
+ return atk_component_ref_accessible_at_point(ATK_COMPONENT(obj->mpOrig), x, y, coord_type);
+
try
{
css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
- = getComponent( component );
+ = getComponent(obj);
if( pComponent.is() )
{
@@ -138,10 +163,18 @@ component_wrapper_get_position (AtkComponent *component,
gint *y,
AtkCoordType coord_type)
{
+ AtkObjectWrapper* obj = getObjectWrapper(component);
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit a11y
+ if (obj && obj->mpOrig)
+ {
+ atk_component_get_extents(ATK_COMPONENT(obj->mpOrig), x, y, nullptr, nullptr, coord_type);
+ return;
+ }
+
try
{
css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
- = getComponent( component );
+ = getComponent(obj);
if( pComponent.is() )
{
awt::Point aPos;
@@ -168,10 +201,18 @@ component_wrapper_get_size (AtkComponent *component,
gint *width,
gint *height)
{
+ AtkObjectWrapper* obj = getObjectWrapper(component);
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit a11y
+ if (obj && obj->mpOrig)
+ {
+ atk_component_get_extents(ATK_COMPONENT(obj->mpOrig), nullptr, nullptr, width, height, ATK_XY_WINDOW);
+ return;
+ }
+
try
{
css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
- = getComponent( component );
+ = getComponent(obj);
if( pComponent.is() )
{
awt::Size aSize = pComponent->getSize();
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index baae426bc6d1..dc61baab503b 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -469,7 +469,7 @@ wrapper_get_index_in_parent( AtkObject *atk_obj )
{
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
- //if we're a native GtkDrawingArea with custom a11y, use the default toolkit index in parent
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit a11y
if (obj->mpOrig)
return atk_object_get_index_in_parent(obj->mpOrig);
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index 0cb3f7b1c907..c45f0f9c839b 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -105,6 +105,7 @@ void valueIfaceInit(AtkValueIface *iface);
#define ATK_TYPE_OBJECT_WRAPPER atk_object_wrapper_get_type()
#define ATK_OBJECT_WRAPPER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_OBJECT_WRAPPER, AtkObjectWrapper))
+#define ATK_IS_OBJECT_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_OBJECT_WRAPPER))
static inline gchar *
OUStringToGChar(const OUString& rString )
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e558ccd37ceb..72c2097e911f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3825,6 +3825,7 @@ public:
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
m_pAccessible = atk_object_wrapper_new(m_xAccessible, gtk_widget_get_accessible(pParent), pDefaultAccessible);
+ g_object_ref(m_pAccessible);
}
return m_pAccessible;
}