Bug 235719 - mozilla toplevel windows don't generate at-spi window: events.

Patch by Louie Zhao <Louie.Zhao@sun.com>
r=pkw@us.ibm.com, sr=Henry.Jia@sun.com, a=asa@mozilla.org
This commit is contained in:
pkw%us.ibm.com 2004-03-25 18:36:08 +00:00
Родитель 14f2cba95a
Коммит ea9d27915c
9 изменённых файлов: 165 добавлений и 0 удалений

Просмотреть файл

@ -417,6 +417,8 @@ interface nsIAccessible : nsISupports
enum { ROLE_SPLITBUTTON = 42U }; // ATK_ROLE_PUSH_BUTTON
enum { ROLE_IPADDRESS = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_NOTHING = 0U }; // ATK_ROLE_INVALID
// Represent top level window
enum { ROLE_FRAME = 22U }; // ATK_ROLE_FRAME
#else
// MSAA Roles - only one per nsIAccessible or IAccessible

Просмотреть файл

@ -136,4 +136,12 @@ interface nsIAccessibleEvent : nsISupports
const unsigned long EVENT_ATK_TABLE_COLUMN_DELETE = 0x0115;
const unsigned long EVENT_ATK_TABLE_COLUMN_REORDER = 0x0116;
const unsigned long EVENT_ATK_LINK_SELECTED = 0x0117;
const unsigned long EVENT_ATK_WINDOW_ACTIVATE = 0x0118;
const unsigned long EVENT_ATK_WINDOW_CREATE = 0x0119;
const unsigned long EVENT_ATK_WINDOW_DEACTIVATE = 0x0120;
const unsigned long EVENT_ATK_WINDOW_DESTROY = 0x0121;
const unsigned long EVENT_ATK_WINDOW_MAXIMIZE = 0x0122;
const unsigned long EVENT_ATK_WINDOW_MINIMIZE = 0x0123;
const unsigned long EVENT_ATK_WINDOW_RESIZE = 0x0124;
const unsigned long EVENT_ATK_WINDOW_RESTORE = 0x0125;
};

Просмотреть файл

@ -55,6 +55,18 @@
/* MaiAtkObject */
enum {
ACTIVATE,
CREATE,
DEACTIVATE,
DESTROY,
MAXIMIZE,
MINIMIZE,
RESIZE,
RESTORE,
LAST_SIGNAL
};
/**
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
*/
@ -73,6 +85,8 @@ struct MaiAtkObjectClass
AtkObjectClass parent_class;
};
static guint mai_atk_object_signals [LAST_SIGNAL] = { 0, };
#ifdef MAI_LOGGING
PRInt32 sMaiAtkObjCreated = 0;
PRInt32 sMaiAtkObjDeleted = 0;
@ -554,6 +568,72 @@ classInitCB(AtkObjectClass *aClass)
aClass->initialize = initializeCB;
gobject_class->finalize = finalizeCB;
mai_atk_object_signals [ACTIVATE] =
g_signal_new ("activate",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [CREATE] =
g_signal_new ("create",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [DEACTIVATE] =
g_signal_new ("deactivate",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [DESTROY] =
g_signal_new ("destroy",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [MAXIMIZE] =
g_signal_new ("maximize",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [MINIMIZE] =
g_signal_new ("minimize",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [RESIZE] =
g_signal_new ("resize",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [RESTORE] =
g_signal_new ("restore",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
void

Просмотреть файл

@ -230,6 +230,7 @@ mai_util_add_global_event_listener(GSignalEmissionHook listener,
rc = add_listener (listener, "MaiWindow",
split_string[1], event_type);
*/
rc = add_listener (listener, "MaiAtkObject", split_string[1], event_type);
}
else {
rc = add_listener (listener, split_string[1], split_string[2],

Просмотреть файл

@ -398,6 +398,20 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_WINDOW_ACTIVATE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_WINDOW_ACTIVATED\n"));
g_signal_emit(accWrap->GetAtkObject(),
g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT), 0);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_WINDOW_DEACTIVATE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_WINDOW_DEACTIVATED\n"));
g_signal_emit(accWrap->GetAtkObject(),
g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT), 0);
rv = NS_OK;
break;
default:
// Don't transfer others
MAI_LOG_DEBUG(("\n\nReceived an unknown event=0x%u\n", aEvent));

Просмотреть файл

@ -72,3 +72,9 @@ NS_IMETHODIMP nsRootAccessibleWrap::GetParent(nsIAccessible ** aParent)
}
return rv;
}
NS_IMETHODIMP nsRootAccessibleWrap::GetRole(PRUint32 *_retval)
{
*_retval = ROLE_FRAME;
return NS_OK;
}

Просмотреть файл

@ -57,6 +57,7 @@ public:
virtual ~nsRootAccessibleWrap();
NS_IMETHOD GetParent(nsIAccessible ** aParent);
NS_IMETHOD GetRole(PRUint32 *aRole);
};
#endif /* __NS_ROOT_ACCESSIBLE_WRAP_H__ */

Просмотреть файл

@ -62,6 +62,8 @@
#ifdef ACCESSIBILITY
#include "nsPIAccessNode.h"
#include "nsPIAccessible.h"
#include "nsIAccessibleEvent.h"
#include "prenv.h"
#include "stdlib.h"
static PRBool sAccessibilityChecked = PR_FALSE;
@ -3771,6 +3773,25 @@ nsWindow::CreateRootAccessible()
}
}
void
nsWindow::GetRootAccessible(nsIAccessible** aAccessible)
{
nsCOMPtr<nsIAccessible> docAcc, parentAcc;
DispatchAccessibleEvent(getter_AddRefs(docAcc));
PRUint32 role;
while (docAcc) {
docAcc->GetRole(&role);
if (role == nsIAccessible::ROLE_FRAME) {
*aAccessible = docAcc;
NS_ADDREF(*aAccessible);
break;
}
docAcc->GetParent(getter_AddRefs(parentAcc));
docAcc = parentAcc;
}
}
/**
* void
* nsWindow::DispatchAccessibleEvent
@ -3798,6 +3819,35 @@ nsWindow::DispatchAccessibleEvent(nsIAccessible** aAccessible)
return result;
}
void
nsWindow::DispatchActivateEvent(void)
{
nsCommonWidget::DispatchActivateEvent();
nsCOMPtr<nsIAccessible> rootAcc;
GetRootAccessible(getter_AddRefs(rootAcc));
nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(rootAcc));
if (privAcc) {
privAcc->FireToolkitEvent(
nsIAccessibleEvent::EVENT_ATK_WINDOW_ACTIVATE,
rootAcc, nsnull);
}
}
void
nsWindow::DispatchDeactivateEvent(void)
{
nsCommonWidget::DispatchDeactivateEvent();
nsCOMPtr<nsIAccessible> rootAcc;
GetRootAccessible(getter_AddRefs(rootAcc));
nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(rootAcc));
if (privAcc) {
privAcc->FireToolkitEvent(
nsIAccessibleEvent::EVENT_ATK_WINDOW_DEACTIVATE,
rootAcc, nsnull);
}
}
#endif /* #ifdef ACCESSIBILITY */
// nsChildWindow class

Просмотреть файл

@ -297,6 +297,9 @@ private:
#ifdef ACCESSIBILITY
nsCOMPtr<nsIAccessible> mRootAccessible;
void CreateRootAccessible();
void GetRootAccessible(nsIAccessible** aAccessible);
void DispatchActivateEvent(void);
void DispatchDeactivateEvent(void);
NS_IMETHOD_(PRBool) DispatchAccessibleEvent(nsIAccessible** aAccessible);
#endif