mshtml: Moved hwnd and tooltip_hwnd to HTMLDocumentObj.

This commit is contained in:
Jacek Caban 2009-09-16 22:10:47 +02:00 committed by Alexandre Julliard
parent aadd0774db
commit fffc8c66fd
8 changed files with 58 additions and 56 deletions

View File

@ -1767,11 +1767,6 @@ static void destroy_htmldoc(HTMLDocument *This)
set_document_bscallback(This, NULL);
set_current_mon(This, NULL);
if(This->tooltips_hwnd)
DestroyWindow(This->tooltips_hwnd);
if(This->hwnd)
DestroyWindow(This->hwnd);
if(This->event_target)
release_event_target(This->event_target);
@ -1898,7 +1893,14 @@ static ULONG HTMLDocumentObj_Release(HTMLDocument *base)
IOleDocumentView_SetInPlaceSite(DOCVIEW(&This->basedoc), NULL);
if(This->undomgr)
IOleUndoManager_Release(This->undomgr);
if(This->tooltips_hwnd)
DestroyWindow(This->tooltips_hwnd);
if(This->hwnd)
DestroyWindow(This->hwnd);
destroy_htmldoc(&This->basedoc);
if(This->basedoc.nsdoc)
remove_mutation_observer(This->nscontainer, This->basedoc.nsdoc);
if(This->nscontainer)

View File

@ -252,7 +252,7 @@ static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
return S_OK;
}
MessageBoxW(This->doc_obj->basedoc.hwnd, message, wszTitle, MB_ICONWARNING);
MessageBoxW(This->doc_obj->hwnd, message, wszTitle, MB_ICONWARNING);
return S_OK;
}
@ -273,7 +273,7 @@ static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
return S_OK;
}
if(MessageBoxW(This->doc_obj->basedoc.hwnd, message, wszTitle,
if(MessageBoxW(This->doc_obj->hwnd, message, wszTitle,
MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
*confirmed = VARIANT_TRUE;
else *confirmed = VARIANT_FALSE;
@ -366,7 +366,7 @@ static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
arg.textdata = textdata;
DialogBoxParamW(hInst, MAKEINTRESOURCEW(ID_PROMPT_DIALOG),
This->doc_obj->basedoc.hwnd, prompt_dlgproc, (LPARAM)&arg);
This->doc_obj->hwnd, prompt_dlgproc, (LPARAM)&arg);
return S_OK;
}

View File

@ -289,9 +289,6 @@ struct HTMLDocument {
LPOLESTR url;
struct list bindings;
HWND hwnd;
HWND tooltips_hwnd;
DOCHOSTUIINFO hostinfo;
USERMODE usermode;
@ -354,6 +351,9 @@ struct HTMLDocumentObj {
IOleInPlaceUIWindow *ip_window;
IOleUndoManager *undomgr;
HWND hwnd;
HWND tooltips_hwnd;
};
typedef struct {
@ -584,8 +584,8 @@ void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
void notif_focus(HTMLDocumentObj*);
void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
void hide_tooltip(HTMLDocument*);
void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
void hide_tooltip(HTMLDocumentObj*);
HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
@ -705,7 +705,7 @@ void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
#define UPDATE_UI 0x0001
#define UPDATE_TITLE 0x0002
void update_doc(HTMLDocument *This, DWORD flags);
void update_doc(HTMLDocument*,DWORD);
void update_title(HTMLDocumentObj*);
/* editor */

View File

@ -1441,7 +1441,7 @@ static nsresult NSAPI nsEmbeddingSiteWindow_GetVisibility(nsIEmbeddingSiteWindow
TRACE("(%p)->(%p)\n", This, aVisibility);
*aVisibility = This->doc && This->doc->basedoc.hwnd && IsWindowVisible(This->doc->basedoc.hwnd);
*aVisibility = This->doc && This->doc->hwnd && IsWindowVisible(This->doc->hwnd);
return NS_OK;
}
@ -1523,7 +1523,7 @@ static nsresult NSAPI nsTooltipListener_OnShowTooltip(nsITooltipListener *iface,
NSContainer *This = NSTOOLTIP_THIS(iface);
if (This->doc)
show_tooltip(&This->doc->basedoc, aXCoord, aYCoord, aTipText);
show_tooltip(This->doc, aXCoord, aYCoord, aTipText);
return NS_OK;
}
@ -1533,7 +1533,7 @@ static nsresult NSAPI nsTooltipListener_OnHideTooltip(nsITooltipListener *iface)
NSContainer *This = NSTOOLTIP_THIS(iface);
if (This->doc)
hide_tooltip(&This->doc->basedoc);
hide_tooltip(This->doc);
return NS_OK;
}

View File

@ -80,7 +80,7 @@ static BOOL is_doc_child_focus(NSContainer *This)
if(!This->doc)
return FALSE;
for(hwnd = GetFocus(); hwnd && hwnd != This->doc->basedoc.doc_obj->basedoc.hwnd; hwnd = GetParent(hwnd));
for(hwnd = GetFocus(); hwnd && hwnd != This->doc->basedoc.doc_obj->hwnd; hwnd = GetParent(hwnd));
return hwnd != NULL;
}

View File

@ -912,7 +912,7 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch
menu = GetSubMenu(menu_res, dwID);
cmdid = TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
ppt->x, ppt->y, 0, This->basedoc.hwnd, NULL);
ppt->x, ppt->y, 0, This->hwnd, NULL);
DestroyMenu(menu_res);
if(cmdid)

View File

@ -73,7 +73,7 @@ static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *
return E_FAIL;
}
*phwnd = This->hwnd;
*phwnd = This->doc_obj->hwnd;
return S_OK;
}
@ -196,9 +196,9 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceOb
if(This->doc_obj->frame)
IOleInPlaceFrame_Release(This->doc_obj->frame);
if(This->hwnd) {
ShowWindow(This->hwnd, SW_HIDE);
SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
if(This->doc_obj->hwnd) {
ShowWindow(This->doc_obj->hwnd, SW_HIDE);
SetWindowPos(This->doc_obj->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
}
This->focus = FALSE;

View File

@ -46,7 +46,7 @@ static const WCHAR wszTooltipData[] = {'t','o','o','l','t','i','p','_','d','a','
static ATOM serverwnd_class = 0;
typedef struct {
HTMLDocument *doc;
HTMLDocumentObj *doc;
WNDPROC proc;
} tooltip_data;
@ -56,9 +56,9 @@ static void paint_document(HTMLDocumentObj *This)
RECT rect;
HDC hdc;
GetClientRect(This->basedoc.hwnd, &rect);
GetClientRect(This->hwnd, &rect);
hdc = BeginPaint(This->basedoc.hwnd, &ps);
hdc = BeginPaint(This->hwnd, &ps);
if(!(This->basedoc.hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER)))
DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_ADJUST);
@ -80,14 +80,14 @@ static void paint_document(HTMLDocumentObj *This)
DeleteObject(font);
}
EndPaint(This->basedoc.hwnd, &ps);
EndPaint(This->hwnd, &ps);
}
static void activate_gecko(NSContainer *This)
{
TRACE("(%p) %p\n", This, This->window);
SetParent(This->hwnd, This->doc->basedoc.hwnd);
SetParent(This->hwnd, This->doc->hwnd);
ShowWindow(This->hwnd, SW_SHOW);
nsIBaseWindow_SetVisibility(This->window, TRUE);
@ -97,8 +97,8 @@ static void activate_gecko(NSContainer *This)
void update_doc(HTMLDocument *This, DWORD flags)
{
if(!This->update && This->hwnd)
SetTimer(This->doc_obj->basedoc.hwnd, TIMER_ID, 100, NULL);
if(!This->update && This->doc_obj->hwnd)
SetTimer(This->doc_obj->hwnd, TIMER_ID, 100, NULL);
This->update |= flags;
}
@ -135,7 +135,7 @@ static LRESULT on_timer(HTMLDocumentObj *This)
{
TRACE("(%p) %x\n", This, This->basedoc.update);
KillTimer(This->basedoc.hwnd, TIMER_ID);
KillTimer(This->hwnd, TIMER_ID);
if(!This->basedoc.update)
return 0;
@ -181,12 +181,12 @@ void notif_focus(HTMLDocumentObj *This)
static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HTMLDocument *This;
HTMLDocumentObj *This;
static const WCHAR wszTHIS[] = {'T','H','I','S',0};
if(msg == WM_CREATE) {
This = *(HTMLDocument**)lParam;
This = *(HTMLDocumentObj**)lParam;
SetPropW(hwnd, wszTHIS, This);
}else {
This = GetPropW(hwnd, wszTHIS);
@ -197,25 +197,25 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
This->hwnd = hwnd;
break;
case WM_PAINT:
paint_document(This->doc_obj);
paint_document(This);
break;
case WM_SIZE:
TRACE("(%p)->(WM_SIZE)\n", This);
if(This->doc_obj->nscontainer) {
if(This->nscontainer) {
INT ew=0, eh=0;
if(!(This->doc_obj->basedoc.hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
if(!(This->basedoc.hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
ew = GetSystemMetrics(SM_CXEDGE);
eh = GetSystemMetrics(SM_CYEDGE);
}
SetWindowPos(This->doc_obj->nscontainer->hwnd, NULL, ew, eh,
SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
SWP_NOZORDER | SWP_NOACTIVATE);
}
break;
case WM_TIMER:
return on_timer(This->doc_obj);
return on_timer(This);
case WM_MOUSEACTIVATE:
return MA_ACTIVATE;
}
@ -276,10 +276,10 @@ static HRESULT activate_window(HTMLDocumentObj *This)
TRACE("got parent window %p\n", parent_hwnd);
if(This->basedoc.hwnd) {
if(GetParent(This->basedoc.hwnd) != parent_hwnd)
SetParent(This->basedoc.hwnd, parent_hwnd);
SetWindowPos(This->basedoc.hwnd, HWND_TOP,
if(This->hwnd) {
if(GetParent(This->hwnd) != parent_hwnd)
SetParent(This->hwnd, parent_hwnd);
SetWindowPos(This->hwnd, HWND_TOP,
posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
SWP_NOACTIVATE | SWP_SHOWWINDOW);
}else {
@ -288,17 +288,17 @@ static HRESULT activate_window(HTMLDocumentObj *This)
posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
parent_hwnd, NULL, hInst, This);
TRACE("Created window %p\n", This->basedoc.hwnd);
TRACE("Created window %p\n", This->hwnd);
SetWindowPos(This->basedoc.hwnd, NULL, 0, 0, 0, 0,
SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
RedrawWindow(This->basedoc.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
/* NOTE:
* Windows implementation calls:
* RegisterWindowMessage("MSWHEEL_ROLLMSG");
*/
SetTimer(This->basedoc.hwnd, TIMER_ID, 100, NULL);
SetTimer(This->hwnd, TIMER_ID, 100, NULL);
}
if(This->nscontainer)
@ -369,7 +369,7 @@ static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
}
static void create_tooltips_window(HTMLDocument *This)
static void create_tooltips_window(HTMLDocumentObj *This)
{
tooltip_data *data = heap_alloc(sizeof(*data));
@ -388,7 +388,7 @@ static void create_tooltips_window(HTMLDocument *This)
}
void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
void show_tooltip(HTMLDocumentObj *This, DWORD x, DWORD y, LPCWSTR text)
{
TTTOOLINFOW toolinfo = {
sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
@ -406,7 +406,7 @@ void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
}
void hide_tooltip(HTMLDocument *This)
void hide_tooltip(HTMLDocumentObj *This)
{
TTTOOLINFOW toolinfo = {
sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
@ -507,11 +507,11 @@ static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT pr
if(!prcView)
return E_INVALIDARG;
if(This->hwnd) {
GetClientRect(This->hwnd, &rect);
if(This->doc_obj->hwnd) {
GetClientRect(This->doc_obj->hwnd, &rect);
if(memcmp(prcView, &rect, sizeof(RECT))) {
InvalidateRect(This->hwnd,NULL,TRUE);
SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right,
InvalidateRect(This->doc_obj->hwnd, NULL, TRUE);
SetWindowPos(This->doc_obj->hwnd, NULL, prcView->left, prcView->top, prcView->right,
prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
}
}
@ -528,7 +528,7 @@ static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT pr
if(!prcView)
return E_INVALIDARG;
GetClientRect(This->hwnd, prcView);
GetClientRect(This->doc_obj->hwnd, prcView);
return S_OK;
}
@ -554,9 +554,9 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
return hres;
}
update_doc(This, UPDATE_UI);
ShowWindow(This->hwnd, SW_SHOW);
ShowWindow(This->doc_obj->hwnd, SW_SHOW);
}else {
ShowWindow(This->hwnd, SW_HIDE);
ShowWindow(This->doc_obj->hwnd, SW_HIDE);
if(This->doc_obj->ip_window) {
IOleInPlaceUIWindow_Release(This->doc_obj->ip_window);
This->doc_obj->ip_window = NULL;