зеркало из https://github.com/mozilla/gecko-dev.git
Added support for a reply from the StartComposition message. Necessary for XIM support on UNIX.
This commit is contained in:
Родитель
7e5e37e98e
Коммит
97b0bd802c
|
@ -6,3 +6,4 @@ nsIEventStateManager.h
|
||||||
nsIPrivateDOMEvent.h
|
nsIPrivateDOMEvent.h
|
||||||
nsIPrivateTextEvent.h
|
nsIPrivateTextEvent.h
|
||||||
nsIPrivateTextRange.h
|
nsIPrivateTextRange.h
|
||||||
|
nsIPrivateCompositionEvent.h
|
||||||
|
|
|
@ -30,6 +30,7 @@ EXPORTS = \
|
||||||
nsIPrivateDOMEvent.h \
|
nsIPrivateDOMEvent.h \
|
||||||
nsIPrivateTextEvent.h \
|
nsIPrivateTextEvent.h \
|
||||||
nsIPrivateTextRange.h \
|
nsIPrivateTextRange.h \
|
||||||
|
nsIPrivateCompositionEvent.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||||
|
|
|
@ -24,6 +24,7 @@ EXPORTS = \
|
||||||
nsIPrivateDOMEvent.h \
|
nsIPrivateDOMEvent.h \
|
||||||
nsIPrivateTextEvent.h \
|
nsIPrivateTextEvent.h \
|
||||||
nsIPrivateTextRange.h \
|
nsIPrivateTextRange.h \
|
||||||
|
nsIPrivateCompositionEvent.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MODULE=raptor
|
MODULE=raptor
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Netscape Public License
|
||||||
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||||
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||||
|
* http://www.mozilla.org/NPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* NPL.
|
||||||
|
*
|
||||||
|
* The Initial Developer of this code under the NPL is Netscape
|
||||||
|
* Communications Corporation. Portions created by Netscape are
|
||||||
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
|
* Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef nsIPrivateCompositionEvent_h__
|
||||||
|
#define nsIPrivateCompositionEvent_h__
|
||||||
|
|
||||||
|
#include "nsGUIEvent.h"
|
||||||
|
#include "nsISupports.h"
|
||||||
|
|
||||||
|
// {ECF6BEF1-5F0C-11d3-9EB3-0060089FE59B}
|
||||||
|
#define NS_IPRIVATECOMPOSITIONEVENT_IID \
|
||||||
|
{ 0xecf6bef1, 0x5f0c, 0x11d3, \
|
||||||
|
{ 0x9e, 0xb3, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b }}
|
||||||
|
|
||||||
|
class nsIPrivateCompositionEvent : public nsISupports {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATECOMPOSITIONEVENT_IID; return iid; }
|
||||||
|
|
||||||
|
NS_IMETHOD GetCompositionReply(struct nsTextEventReply** aReply) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // nsIPrivateCompositionEvent_h__
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsPrivateTextRange.h"
|
#include "nsPrivateTextRange.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIPrivateCompositionEvent.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||||
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
||||||
|
@ -38,6 +39,7 @@ static NS_DEFINE_IID(kIDOMNSUIEventIID, NS_IDOMNSUIEVENT_IID);
|
||||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||||
static NS_DEFINE_IID(kIPrivateTextEventIID, NS_IPRIVATETEXTEVENT_IID);
|
static NS_DEFINE_IID(kIPrivateTextEventIID, NS_IPRIVATETEXTEVENT_IID);
|
||||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||||
|
static NS_DEFINE_IID(kIPrivateCompositionEventIID,NS_IPRIVATECOMPOSITIONEVENT_IID);
|
||||||
|
|
||||||
static char* mEventNames[] = {
|
static char* mEventNames[] = {
|
||||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||||
|
@ -128,6 +130,11 @@ nsresult nsDOMEvent::QueryInterface(const nsIID& aIID,
|
||||||
AddRef();
|
AddRef();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
if (aIID.Equals(kIPrivateCompositionEventIID)) {
|
||||||
|
*aInstancePtrResult = (void*)((nsIPrivateCompositionEvent*)this);
|
||||||
|
AddRef();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,6 +276,17 @@ NS_METHOD nsDOMEvent::GetEventReply(nsTextEventReply** aReply)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_METHOD nsDOMEvent::GetCompositionReply(nsTextEventReply** aReply)
|
||||||
|
{
|
||||||
|
if (mEvent->message==NS_COMPOSITION_START) {
|
||||||
|
*aReply = &(((nsCompositionEvent*)mEvent)->theReply);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX)
|
NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX)
|
||||||
{
|
{
|
||||||
// pinkerton -- i don't understand how we can assume that mEvent
|
// pinkerton -- i don't understand how we can assume that mEvent
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nsIDOMNSUIEvent.h"
|
#include "nsIDOMNSUIEvent.h"
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
|
#include "nsIPrivateCompositionEvent.h"
|
||||||
#include "nsIPrivateTextEvent.h"
|
#include "nsIPrivateTextEvent.h"
|
||||||
#include "nsIPrivateTextRange.h"
|
#include "nsIPrivateTextRange.h"
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ class nsIContent;
|
||||||
|
|
||||||
class nsIDOMRenderingContext;
|
class nsIDOMRenderingContext;
|
||||||
|
|
||||||
class nsDOMEvent : public nsIDOMUIEvent, public nsIDOMNSUIEvent, public nsIPrivateDOMEvent, public nsIPrivateTextEvent {
|
class nsDOMEvent : public nsIDOMUIEvent, public nsIDOMNSUIEvent, public nsIPrivateDOMEvent, public nsIPrivateTextEvent, public nsIPrivateCompositionEvent {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
||||||
|
@ -135,6 +136,8 @@ public:
|
||||||
NS_IMETHOD GetInputRange(nsIPrivateTextRangeList** aInputRange);
|
NS_IMETHOD GetInputRange(nsIPrivateTextRangeList** aInputRange);
|
||||||
NS_IMETHOD GetEventReply(nsTextEventReply** aReply);
|
NS_IMETHOD GetEventReply(nsTextEventReply** aReply);
|
||||||
|
|
||||||
|
// nsIPrivateCompositionEvent interface
|
||||||
|
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ nsEditor::DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)
|
||||||
// created of IMETextTxn's.
|
// created of IMETextTxn's.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEditor::BeginComposition(void)
|
nsEditor::BeginComposition(nsTextEventReply* aReply)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_tague
|
#ifdef DEBUG_tague
|
||||||
printf("nsEditor::StartComposition\n");
|
printf("nsEditor::StartComposition\n");
|
||||||
|
@ -1113,10 +1113,16 @@ nsEditor::BeginComposition(void)
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsCOMPtr<nsIDOMSelection> selection;
|
nsCOMPtr<nsIDOMSelection> selection;
|
||||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText;
|
nsCOMPtr<nsIDOMCharacterData> nodeAsText;
|
||||||
|
nsCOMPtr<nsICaret> caretP;
|
||||||
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
||||||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
result = ps->GetCaret(getter_AddRefs(caretP));
|
||||||
|
if (NS_SUCCEEDED(result) && caretP) {
|
||||||
|
if (aReply) {
|
||||||
|
caretP->GetWindowRelativeCoordinates(aReply->mCursorPosition,aReply->mCursorIsCollapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
result = ps->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection));
|
result = ps->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection));
|
||||||
if ((NS_SUCCEEDED(result)) && selection)
|
if ((NS_SUCCEEDED(result)) && selection)
|
||||||
{
|
{
|
||||||
|
@ -3879,7 +3885,7 @@ nsEditor::CreateTxnForIMEText(const nsString & aStringToInsert,
|
||||||
nsresult result;
|
nsresult result;
|
||||||
|
|
||||||
if (mIMETextNode==nsnull)
|
if (mIMETextNode==nsnull)
|
||||||
BeginComposition();
|
BeginComposition(nsnull);
|
||||||
|
|
||||||
result = TransactionFactory::GetNewTransaction(IMETextTxn::GetCID(), (EditTxn **)aTxn);
|
result = TransactionFactory::GetNewTransaction(IMETextTxn::GetCID(), (EditTxn **)aTxn);
|
||||||
if (nsnull!=*aTxn) {
|
if (nsnull!=*aTxn) {
|
||||||
|
|
|
@ -193,7 +193,7 @@ public:
|
||||||
|
|
||||||
/* ------------ nsIEditorIMESupport methods -------------- */
|
/* ------------ nsIEditorIMESupport methods -------------- */
|
||||||
|
|
||||||
NS_IMETHOD BeginComposition(void);
|
NS_IMETHOD BeginComposition(nsTextEventReply* aReply);
|
||||||
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
|
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
|
||||||
NS_IMETHOD EndComposition(void);
|
NS_IMETHOD EndComposition(void);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "nsIDOMUIEvent.h"
|
#include "nsIDOMUIEvent.h"
|
||||||
#include "nsIDOMNSUIEvent.h"
|
#include "nsIDOMNSUIEvent.h"
|
||||||
#include "nsIPrivateTextEvent.h"
|
#include "nsIPrivateTextEvent.h"
|
||||||
|
#include "nsIPrivateCompositionEvent.h"
|
||||||
#include "nsIEditorMailSupport.h"
|
#include "nsIEditorMailSupport.h"
|
||||||
#include "nsIDocumentEncoder.h"
|
#include "nsIDocumentEncoder.h"
|
||||||
|
|
||||||
|
@ -1489,7 +1490,15 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor)
|
||||||
nsresult
|
nsresult
|
||||||
nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
|
nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
|
||||||
{
|
{
|
||||||
return mEditor->BeginComposition();
|
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
|
||||||
|
nsTextEventReply* eventReply;
|
||||||
|
|
||||||
|
if (!pCompositionEvent) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsresult rv = pCompositionEvent->GetCompositionReply(&eventReply);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
return mEditor->BeginComposition(eventReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ nsEditor::DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)
|
||||||
// created of IMETextTxn's.
|
// created of IMETextTxn's.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEditor::BeginComposition(void)
|
nsEditor::BeginComposition(nsTextEventReply* aReply)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_tague
|
#ifdef DEBUG_tague
|
||||||
printf("nsEditor::StartComposition\n");
|
printf("nsEditor::StartComposition\n");
|
||||||
|
@ -1113,10 +1113,16 @@ nsEditor::BeginComposition(void)
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsCOMPtr<nsIDOMSelection> selection;
|
nsCOMPtr<nsIDOMSelection> selection;
|
||||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText;
|
nsCOMPtr<nsIDOMCharacterData> nodeAsText;
|
||||||
|
nsCOMPtr<nsICaret> caretP;
|
||||||
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
||||||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
result = ps->GetCaret(getter_AddRefs(caretP));
|
||||||
|
if (NS_SUCCEEDED(result) && caretP) {
|
||||||
|
if (aReply) {
|
||||||
|
caretP->GetWindowRelativeCoordinates(aReply->mCursorPosition,aReply->mCursorIsCollapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
result = ps->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection));
|
result = ps->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection));
|
||||||
if ((NS_SUCCEEDED(result)) && selection)
|
if ((NS_SUCCEEDED(result)) && selection)
|
||||||
{
|
{
|
||||||
|
@ -3879,7 +3885,7 @@ nsEditor::CreateTxnForIMEText(const nsString & aStringToInsert,
|
||||||
nsresult result;
|
nsresult result;
|
||||||
|
|
||||||
if (mIMETextNode==nsnull)
|
if (mIMETextNode==nsnull)
|
||||||
BeginComposition();
|
BeginComposition(nsnull);
|
||||||
|
|
||||||
result = TransactionFactory::GetNewTransaction(IMETextTxn::GetCID(), (EditTxn **)aTxn);
|
result = TransactionFactory::GetNewTransaction(IMETextTxn::GetCID(), (EditTxn **)aTxn);
|
||||||
if (nsnull!=*aTxn) {
|
if (nsnull!=*aTxn) {
|
||||||
|
|
|
@ -193,7 +193,7 @@ public:
|
||||||
|
|
||||||
/* ------------ nsIEditorIMESupport methods -------------- */
|
/* ------------ nsIEditorIMESupport methods -------------- */
|
||||||
|
|
||||||
NS_IMETHOD BeginComposition(void);
|
NS_IMETHOD BeginComposition(nsTextEventReply* aReply);
|
||||||
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
|
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
|
||||||
NS_IMETHOD EndComposition(void);
|
NS_IMETHOD EndComposition(void);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "nsIDOMUIEvent.h"
|
#include "nsIDOMUIEvent.h"
|
||||||
#include "nsIDOMNSUIEvent.h"
|
#include "nsIDOMNSUIEvent.h"
|
||||||
#include "nsIPrivateTextEvent.h"
|
#include "nsIPrivateTextEvent.h"
|
||||||
|
#include "nsIPrivateCompositionEvent.h"
|
||||||
#include "nsIEditorMailSupport.h"
|
#include "nsIEditorMailSupport.h"
|
||||||
#include "nsIDocumentEncoder.h"
|
#include "nsIDocumentEncoder.h"
|
||||||
|
|
||||||
|
@ -1489,7 +1490,15 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor)
|
||||||
nsresult
|
nsresult
|
||||||
nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
|
nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
|
||||||
{
|
{
|
||||||
return mEditor->BeginComposition();
|
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
|
||||||
|
nsTextEventReply* eventReply;
|
||||||
|
|
||||||
|
if (!pCompositionEvent) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsresult rv = pCompositionEvent->GetCompositionReply(&eventReply);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
return mEditor->BeginComposition(eventReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -36,10 +36,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BeginComposition() Handles the start of inline input composition.
|
* BeginComposition(nsTextEventReply* aReply) Handles the start of inline input composition.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NS_IMETHOD BeginComposition(void) = 0;
|
NS_IMETHOD BeginComposition(nsTextEventReply *aReply) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SetCompositionString() Sets the inline input composition string.
|
* SetCompositionString() Sets the inline input composition string.
|
||||||
|
|
|
@ -6,3 +6,4 @@ nsIEventStateManager.h
|
||||||
nsIPrivateDOMEvent.h
|
nsIPrivateDOMEvent.h
|
||||||
nsIPrivateTextEvent.h
|
nsIPrivateTextEvent.h
|
||||||
nsIPrivateTextRange.h
|
nsIPrivateTextRange.h
|
||||||
|
nsIPrivateCompositionEvent.h
|
||||||
|
|
|
@ -30,6 +30,7 @@ EXPORTS = \
|
||||||
nsIPrivateDOMEvent.h \
|
nsIPrivateDOMEvent.h \
|
||||||
nsIPrivateTextEvent.h \
|
nsIPrivateTextEvent.h \
|
||||||
nsIPrivateTextRange.h \
|
nsIPrivateTextRange.h \
|
||||||
|
nsIPrivateCompositionEvent.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||||
|
|
|
@ -24,6 +24,7 @@ EXPORTS = \
|
||||||
nsIPrivateDOMEvent.h \
|
nsIPrivateDOMEvent.h \
|
||||||
nsIPrivateTextEvent.h \
|
nsIPrivateTextEvent.h \
|
||||||
nsIPrivateTextRange.h \
|
nsIPrivateTextRange.h \
|
||||||
|
nsIPrivateCompositionEvent.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MODULE=raptor
|
MODULE=raptor
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Netscape Public License
|
||||||
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||||
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||||
|
* http://www.mozilla.org/NPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* NPL.
|
||||||
|
*
|
||||||
|
* The Initial Developer of this code under the NPL is Netscape
|
||||||
|
* Communications Corporation. Portions created by Netscape are
|
||||||
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
|
* Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef nsIPrivateCompositionEvent_h__
|
||||||
|
#define nsIPrivateCompositionEvent_h__
|
||||||
|
|
||||||
|
#include "nsGUIEvent.h"
|
||||||
|
#include "nsISupports.h"
|
||||||
|
|
||||||
|
// {ECF6BEF1-5F0C-11d3-9EB3-0060089FE59B}
|
||||||
|
#define NS_IPRIVATECOMPOSITIONEVENT_IID \
|
||||||
|
{ 0xecf6bef1, 0x5f0c, 0x11d3, \
|
||||||
|
{ 0x9e, 0xb3, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b }}
|
||||||
|
|
||||||
|
class nsIPrivateCompositionEvent : public nsISupports {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATECOMPOSITIONEVENT_IID; return iid; }
|
||||||
|
|
||||||
|
NS_IMETHOD GetCompositionReply(struct nsTextEventReply** aReply) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // nsIPrivateCompositionEvent_h__
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsPrivateTextRange.h"
|
#include "nsPrivateTextRange.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIPrivateCompositionEvent.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||||
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
||||||
|
@ -38,6 +39,7 @@ static NS_DEFINE_IID(kIDOMNSUIEventIID, NS_IDOMNSUIEVENT_IID);
|
||||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||||
static NS_DEFINE_IID(kIPrivateTextEventIID, NS_IPRIVATETEXTEVENT_IID);
|
static NS_DEFINE_IID(kIPrivateTextEventIID, NS_IPRIVATETEXTEVENT_IID);
|
||||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||||
|
static NS_DEFINE_IID(kIPrivateCompositionEventIID,NS_IPRIVATECOMPOSITIONEVENT_IID);
|
||||||
|
|
||||||
static char* mEventNames[] = {
|
static char* mEventNames[] = {
|
||||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||||
|
@ -128,6 +130,11 @@ nsresult nsDOMEvent::QueryInterface(const nsIID& aIID,
|
||||||
AddRef();
|
AddRef();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
if (aIID.Equals(kIPrivateCompositionEventIID)) {
|
||||||
|
*aInstancePtrResult = (void*)((nsIPrivateCompositionEvent*)this);
|
||||||
|
AddRef();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,6 +276,17 @@ NS_METHOD nsDOMEvent::GetEventReply(nsTextEventReply** aReply)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_METHOD nsDOMEvent::GetCompositionReply(nsTextEventReply** aReply)
|
||||||
|
{
|
||||||
|
if (mEvent->message==NS_COMPOSITION_START) {
|
||||||
|
*aReply = &(((nsCompositionEvent*)mEvent)->theReply);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX)
|
NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX)
|
||||||
{
|
{
|
||||||
// pinkerton -- i don't understand how we can assume that mEvent
|
// pinkerton -- i don't understand how we can assume that mEvent
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nsIDOMNSUIEvent.h"
|
#include "nsIDOMNSUIEvent.h"
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
|
#include "nsIPrivateCompositionEvent.h"
|
||||||
#include "nsIPrivateTextEvent.h"
|
#include "nsIPrivateTextEvent.h"
|
||||||
#include "nsIPrivateTextRange.h"
|
#include "nsIPrivateTextRange.h"
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ class nsIContent;
|
||||||
|
|
||||||
class nsIDOMRenderingContext;
|
class nsIDOMRenderingContext;
|
||||||
|
|
||||||
class nsDOMEvent : public nsIDOMUIEvent, public nsIDOMNSUIEvent, public nsIPrivateDOMEvent, public nsIPrivateTextEvent {
|
class nsDOMEvent : public nsIDOMUIEvent, public nsIDOMNSUIEvent, public nsIPrivateDOMEvent, public nsIPrivateTextEvent, public nsIPrivateCompositionEvent {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
||||||
|
@ -135,6 +136,8 @@ public:
|
||||||
NS_IMETHOD GetInputRange(nsIPrivateTextRangeList** aInputRange);
|
NS_IMETHOD GetInputRange(nsIPrivateTextRangeList** aInputRange);
|
||||||
NS_IMETHOD GetEventReply(nsTextEventReply** aReply);
|
NS_IMETHOD GetEventReply(nsTextEventReply** aReply);
|
||||||
|
|
||||||
|
// nsIPrivateCompositionEvent interface
|
||||||
|
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -1585,9 +1585,13 @@ NS_IMETHODIMP nsViewManager :: DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &
|
||||||
if (aEvent->message==NS_TEXT_EVENT) {
|
if (aEvent->message==NS_TEXT_EVENT) {
|
||||||
((nsTextEvent*)aEvent)->theReply.mCursorPosition.x=NSTwipsToIntPixels(((nsTextEvent*)aEvent)->theReply.mCursorPosition.x, t2p);
|
((nsTextEvent*)aEvent)->theReply.mCursorPosition.x=NSTwipsToIntPixels(((nsTextEvent*)aEvent)->theReply.mCursorPosition.x, t2p);
|
||||||
((nsTextEvent*)aEvent)->theReply.mCursorPosition.y=NSTwipsToIntPixels(((nsTextEvent*)aEvent)->theReply.mCursorPosition.y, t2p);
|
((nsTextEvent*)aEvent)->theReply.mCursorPosition.y=NSTwipsToIntPixels(((nsTextEvent*)aEvent)->theReply.mCursorPosition.y, t2p);
|
||||||
}
|
}
|
||||||
}
|
if (aEvent->message==NS_COMPOSITION_START) {
|
||||||
|
((nsCompositionEvent*)aEvent)->theReply.mCursorPosition.x=NSTwipsToIntPixels(((nsCompositionEvent*)aEvent)->theReply.mCursorPosition.x,t2p);
|
||||||
|
((nsCompositionEvent*)aEvent)->theReply.mCursorPosition.y=NSTwipsToIntPixels(((nsCompositionEvent*)aEvent)->theReply.mCursorPosition.y,t2p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,7 @@ struct nsTextEvent : public nsInputEvent {
|
||||||
|
|
||||||
struct nsCompositionEvent : public nsInputEvent {
|
struct nsCompositionEvent : public nsInputEvent {
|
||||||
PRUint32 compositionMessage;
|
PRUint32 compositionMessage;
|
||||||
|
nsTextEventReply theReply;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2680,16 +2680,9 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||||
if (hIMEContext==NULL) {
|
if (hIMEContext==NULL) {
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
HandleStartComposition(hIMEContext);
|
||||||
compForm.dwStyle = CFS_POINT;
|
|
||||||
compForm.ptCurrentPos.x = 100;
|
|
||||||
compForm.ptCurrentPos.y = 100;
|
|
||||||
|
|
||||||
// ::ImmSetCompositionWindow(hIMEContext,&compForm); don't do this! it's bad.
|
|
||||||
::ImmReleaseContext(mWnd,hIMEContext);
|
|
||||||
|
|
||||||
HandleStartComposition();
|
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
|
::ImmReleaseContext(mWnd,hIMEContext);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2779,7 +2772,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
HandleTextEvent(hIMEContext);
|
HandleTextEvent(hIMEContext);
|
||||||
HandleEndComposition();
|
HandleEndComposition();
|
||||||
HandleStartComposition();
|
HandleStartComposition(hIMEContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
::ImmReleaseContext(mWnd,hIMEContext);
|
::ImmReleaseContext(mWnd,hIMEContext);
|
||||||
|
@ -3533,10 +3526,11 @@ nsWindow::HandleTextEvent(HIMC hIMEContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsWindow::HandleStartComposition(void)
|
nsWindow::HandleStartComposition(HIMC hIMEContext)
|
||||||
{
|
{
|
||||||
nsCompositionEvent event;
|
nsCompositionEvent event;
|
||||||
nsPoint point;
|
nsPoint point;
|
||||||
|
CANDIDATEFORM candForm;
|
||||||
|
|
||||||
point.x = 0;
|
point.x = 0;
|
||||||
point.y = 0;
|
point.y = 0;
|
||||||
|
@ -3545,6 +3539,18 @@ nsWindow::HandleStartComposition(void)
|
||||||
event.eventStructType = NS_COMPOSITION_START;
|
event.eventStructType = NS_COMPOSITION_START;
|
||||||
event.compositionMessage = NS_COMPOSITION_START;
|
event.compositionMessage = NS_COMPOSITION_START;
|
||||||
(void)DispatchWindowEvent(&event);
|
(void)DispatchWindowEvent(&event);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Post process event
|
||||||
|
//
|
||||||
|
candForm.dwIndex = 0;
|
||||||
|
candForm.dwStyle = CFS_CANDIDATEPOS;
|
||||||
|
candForm.ptCurrentPos.x = event.theReply.mCursorPosition.x + IME_X_OFFSET;
|
||||||
|
candForm.ptCurrentPos.y = event.theReply.mCursorPosition.y + IME_Y_OFFSET;
|
||||||
|
#ifdef DEBUG_tague
|
||||||
|
printf("Candidate window position: x=%d, y=%d\n",candForm.ptCurrentPos.x,candForm.ptCurrentPos.y);
|
||||||
|
#endif
|
||||||
|
::ImmSetCandidateWindow(hIMEContext,&candForm);
|
||||||
NS_RELEASE(event.widget);
|
NS_RELEASE(event.widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ protected:
|
||||||
|
|
||||||
void GetNonClientBounds(nsRect &aRect);
|
void GetNonClientBounds(nsRect &aRect);
|
||||||
void HandleTextEvent(HIMC hIMEContext);
|
void HandleTextEvent(HIMC hIMEContext);
|
||||||
void HandleStartComposition(void);
|
void HandleStartComposition(HIMC hIMEContext);
|
||||||
void HandleEndComposition(void);
|
void HandleEndComposition(void);
|
||||||
void MapDBCSAtrributeArrayToUnicodeOffsets(PRUint32* textRangeListLengthResult, nsTextRangeArray* textRangeListResult);
|
void MapDBCSAtrributeArrayToUnicodeOffsets(PRUint32* textRangeListLengthResult, nsTextRangeArray* textRangeListResult);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче