Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8b3086a5
Commit
8b3086a5
authored
Jun 22, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 25, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Move keypress event listener to separated object.
parent
6490dadb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
160 additions
and
8 deletions
+160
-8
Makefile.in
dlls/mshtml/Makefile.in
+1
-0
mshtml_private.h
dlls/mshtml/mshtml_private.h
+8
-0
nsembed.c
dlls/mshtml/nsembed.c
+3
-8
nsevents.c
dlls/mshtml/nsevents.c
+148
-0
No files found.
dlls/mshtml/Makefile.in
View file @
8b3086a5
...
...
@@ -30,6 +30,7 @@ C_SRCS = \
main.c
\
navigate.c
\
nsembed.c
\
nsevents.c
\
nsio.c
\
nsservice.c
\
olecmd.c
\
...
...
dlls/mshtml/mshtml_private.h
View file @
8b3086a5
...
...
@@ -126,6 +126,11 @@ struct HTMLDocument {
HTMLDOMNode
*
nodes
;
};
typedef
struct
{
const
nsIDOMEventListenerVtbl
*
lpDOMEventListenerVtbl
;
NSContainer
*
This
;
}
nsEventListener
;
struct
NSContainer
{
const
nsIWebBrowserChromeVtbl
*
lpWebBrowserChromeVtbl
;
const
nsIContextMenuListenerVtbl
*
lpContextMenuListenerVtbl
;
...
...
@@ -137,6 +142,8 @@ struct NSContainer {
const
nsISupportsWeakReferenceVtbl
*
lpSupportsWeakReferenceVtbl
;
const
nsIDOMEventListenerVtbl
*
lpDOMEventListenerVtbl
;
nsEventListener
keypress_listener
;
nsIWebBrowser
*
webbrowser
;
nsIWebNavigation
*
navigation
;
nsIBaseWindow
*
window
;
...
...
@@ -350,6 +357,7 @@ void nsAString_Finish(nsAString*);
nsIInputStream
*
create_nsstream
(
const
char
*
,
PRInt32
);
nsICommandParams
*
create_nscommand_params
(
void
);
void
nsnode_to_nsstring
(
nsIDOMNode
*
,
nsAString
*
);
void
init_nsevents
(
NSContainer
*
);
BSCallback
*
create_bscallback
(
IMoniker
*
);
HRESULT
start_binding
(
BSCallback
*
);
...
...
dlls/mshtml/nsembed.c
View file @
8b3086a5
...
...
@@ -1627,16 +1627,9 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
nsres
=
nsIDOMWindow_QueryInterface
(
dom_window
,
&
IID_nsIDOMEventTarget
,
(
void
**
)
&
target
);
nsIDOMWindow_Release
(
dom_window
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsAString
keypress_str
,
load_str
;
static
const
PRUnichar
wsz_keypress
[]
=
{
'k'
,
'e'
,
'y'
,
'p'
,
'r'
,
'e'
,
's'
,
's'
,
0
};
nsAString
load_str
;
static
const
PRUnichar
wsz_load
[]
=
{
'l'
,
'o'
,
'a'
,
'd'
,
0
};
nsAString_Init
(
&
keypress_str
,
wsz_keypress
);
nsres
=
nsIDOMEventTarget_AddEventListener
(
target
,
&
keypress_str
,
NSEVENTLIST
(
ret
),
FALSE
);
nsAString_Finish
(
&
keypress_str
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"AddEventTarget failed: %08x
\n
"
,
nsres
);
nsAString_Init
(
&
load_str
,
wsz_load
);
nsres
=
nsIDOMEventTarget_AddEventListener
(
target
,
&
load_str
,
NSEVENTLIST
(
ret
),
TRUE
);
nsAString_Finish
(
&
load_str
);
...
...
@@ -1651,6 +1644,8 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
ERR
(
"GetContentDOMWindow failed: %08x
\n
"
,
nsres
);
}
init_nsevents
(
ret
);
nsres
=
nsIWebBrowser_QueryInterface
(
ret
->
webbrowser
,
&
IID_nsIScrollable
,
(
void
**
)
&
scrollable
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsres
=
nsIScrollable_SetDefaultScrollbarPreferences
(
scrollable
,
...
...
dlls/mshtml/nsevents.c
0 → 100644
View file @
8b3086a5
/*
* Copyright 2007 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "mshtml_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
#define NSEVENTLIST_THIS(iface) DEFINE_THIS(nsEventListener, DOMEventListener, iface)
static
nsresult
NSAPI
nsDOMEventListener_QueryInterface
(
nsIDOMEventListener
*
iface
,
nsIIDRef
riid
,
nsQIResult
result
)
{
nsEventListener
*
This
=
NSEVENTLIST_THIS
(
iface
);
*
result
=
NULL
;
if
(
IsEqualGUID
(
&
IID_nsISupports
,
riid
))
{
TRACE
(
"(%p)->(IID_nsISupports, %p)
\n
"
,
This
,
result
);
*
result
=
NSEVENTLIST
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_nsIDOMEventListener
,
riid
))
{
TRACE
(
"(%p)->(IID_nsIDOMEventListener %p)
\n
"
,
This
,
result
);
*
result
=
NSEVENTLIST
(
This
);
}
if
(
*
result
)
{
nsIWebBrowserChrome_AddRef
(
NSEVENTLIST
(
This
));
return
NS_OK
;
}
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
result
);
return
NS_NOINTERFACE
;
}
static
nsrefcnt
NSAPI
nsDOMEventListener_AddRef
(
nsIDOMEventListener
*
iface
)
{
NSContainer
*
This
=
NSEVENTLIST_THIS
(
iface
)
->
This
;
return
nsIWebBrowserChrome_AddRef
(
NSWBCHROME
(
This
));
}
static
nsrefcnt
NSAPI
nsDOMEventListener_Release
(
nsIDOMEventListener
*
iface
)
{
NSContainer
*
This
=
NSEVENTLIST_THIS
(
iface
)
->
This
;
return
nsIWebBrowserChrome_Release
(
NSWBCHROME
(
This
));
}
static
nsresult
NSAPI
handle_keypress
(
nsIDOMEventListener
*
iface
,
nsIDOMEvent
*
event
)
{
NSContainer
*
This
=
NSEVENTLIST_THIS
(
iface
)
->
This
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
event
);
update_doc
(
This
->
doc
,
UPDATE_UI
);
if
(
This
->
doc
->
usermode
==
EDITMODE
)
handle_edit_event
(
This
->
doc
,
event
);
return
NS_OK
;
}
#undef NSEVENTLIST_THIS
#define EVENTLISTENER_VTBL(handler) \
{ \
nsDOMEventListener_QueryInterface, \
nsDOMEventListener_AddRef, \
nsDOMEventListener_Release, \
handler, \
};
static
const
nsIDOMEventListenerVtbl
keypress_vtbl
=
EVENTLISTENER_VTBL
(
handle_keypress
);
static
void
init_event
(
nsIDOMEventTarget
*
target
,
const
PRUnichar
*
type
,
nsIDOMEventListener
*
listener
,
BOOL
capture
)
{
nsAString
type_str
;
nsresult
nsres
;
nsAString_Init
(
&
type_str
,
type
);
nsres
=
nsIDOMEventTarget_AddEventListener
(
target
,
&
type_str
,
listener
,
capture
);
nsAString_Finish
(
&
type_str
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"AddEventTarget failed: %08x
\n
"
,
nsres
);
}
static
void
init_listener
(
nsEventListener
*
This
,
NSContainer
*
container
,
const
nsIDOMEventListenerVtbl
*
vtbl
)
{
This
->
lpDOMEventListenerVtbl
=
vtbl
;
This
->
This
=
container
;
}
void
init_nsevents
(
NSContainer
*
This
)
{
nsIDOMWindow
*
dom_window
;
nsIDOMEventTarget
*
target
;
nsresult
nsres
;
static
const
PRUnichar
wsz_keypress
[]
=
{
'k'
,
'e'
,
'y'
,
'p'
,
'r'
,
'e'
,
's'
,
's'
,
0
};
init_listener
(
&
This
->
keypress_listener
,
This
,
&
keypress_vtbl
);
nsres
=
nsIWebBrowser_GetContentDOMWindow
(
This
->
webbrowser
,
&
dom_window
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetContentDOMWindow failed: %08x
\n
"
,
nsres
);
return
;
}
nsres
=
nsIDOMWindow_QueryInterface
(
dom_window
,
&
IID_nsIDOMEventTarget
,
(
void
**
)
&
target
);
nsIDOMWindow_Release
(
dom_window
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMEventTarget interface: %08x
\n
"
,
nsres
);
return
;
}
init_event
(
target
,
wsz_keypress
,
NSEVENTLIST
(
&
This
->
keypress_listener
),
FALSE
);
nsIDOMEventTarget_Release
(
target
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment