Hack for correct native event processing

Create the hidden window
Added kmeleon-init event
import/tags/kmeleon75
boisso 8 years ago
parent 575cc7917e
commit f76d64821f
  1. 25
      k-meleon/KmAppInfo.cpp
  2. 5
      k-meleon/KmAppInfo.h
  3. 16
      k-meleon/MfcEmbed.cpp
  4. 4
      k-meleon/MfcEmbed.h

@ -22,8 +22,10 @@
#include "KmAppInfo.h"
#include "KMeleonConst.h"
#include "MfcEmbed.h"
#include "nsAppShellCID.h"
#include "nsIAppShellService.h"
NS_IMPL_ISUPPORTS(KmAppInfo, nsIXULAppInfo, nsIXULRuntime, nsIAppStartup)
NS_IMPL_ISUPPORTS(KmAppInfo, nsIXULAppInfo, nsIXULRuntime, nsIAppStartup, nsIAppStartup2)
/* readonly attribute ACString vendor; */
NS_IMETHODIMP KmAppInfo::GetVendor(nsACString & aVendor)
@ -68,7 +70,7 @@ NS_IMETHODIMP KmAppInfo::GetVersion(nsACString & aVersion)
}
}
aVersion = !ff ? NS_STRINGIFY(KMELEON_UVERSION) : MOZILLA_VERSION;
aVersion = MOZILLA_VERSION;
//aVersion = MOZILLA_VERSION;
return NS_OK;
}
@ -253,13 +255,17 @@ NS_IMETHODIMP KmAppInfo::GetIsOfficialBranding(bool *aIsOfficialBranding)
/* void createHiddenWindow (); */
NS_IMETHODIMP KmAppInfo::CreateHiddenWindow()
{
return NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIAppShellService> appShellService(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);
return appShellService->CreateHiddenWindow();
}
/* void destroyHiddenWindow (); */
NS_IMETHODIMP KmAppInfo::DestroyHiddenWindow()
{
return NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIAppShellService> appShellService(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);
return appShellService->DestroyHiddenWindow();
}
/* void run (); */
@ -370,4 +376,15 @@ NS_IMETHODIMP KmAppInfo::SetInterrupted(bool aInterrupted)
{
mInterrupted = aInterrupted;
return NS_OK;
}
NS_IMETHODIMP KmAppInfo::ProcessNativeEvent(void* aMsg)
{
MSG* msg = (MSG*)aMsg;
if (!AfxPreTranslateMessage(msg))
{
::TranslateMessage(msg);
::DispatchMessage(msg);
}
return NS_OK;
}

@ -20,12 +20,12 @@
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
#include "nsIAppStartup.h"
#include "nsIAppStartup2.h"
#define NS_KMAPPINFO_CID \
{0x76849bf1, 0x199d, 0x41a6, {0xaa, 0xe6, 0x87, 0x3f, 0xca, 0xf1, 0x23, 0xea}}
class KmAppInfo: public nsIXULAppInfo, public nsIXULRuntime, public nsIAppStartup
class KmAppInfo: public nsIXULAppInfo, public nsIXULRuntime, public nsIAppStartup2
{
bool mInterrupted;
public:
@ -34,6 +34,7 @@ public:
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
NS_DECL_NSIAPPSTARTUP
NS_DECL_NSIAPPSTARTUP2
};

@ -69,6 +69,8 @@
#include "nsIIOService.h"
#include "nsIWindowWatcher.h"
#include "nsIChromeRegistry.h"
#include "nsIAppStartup.h"
#include "nsToolkitCompsCID.h"
#include <locale.h>
static UINT WM_POSTEVENT = RegisterWindowMessage(_T("XPCOM_PostEvent"));
@ -542,6 +544,12 @@ BOOL CMfcEmbedApp::InitEmbedding(const char* profile)
}
XRE_NotifyProfile();
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
if (appStartup) {
appStartup->CreateHiddenWindow();
}
NS_LogTerm();
return TRUE;
}
@ -612,6 +620,8 @@ BOOL CMfcEmbedApp::InitInstance()
wc.lpszClassName = BROWSER_WINDOW_CLASS;
AfxRegisterClass( &wc );
//plugins.Load(GetFolder(RootFolder)+_T("\\kplugins\\jsbridge.dll"));
if (!InitEmbedding(profile))
return FALSE;
@ -658,6 +668,9 @@ BOOL CMfcEmbedApp::InitInstance()
favicons.Create(skin.GetUserWidth(),skin.GetUserWidth(),ILC_COLOR32|ILC_MASK,25,100);
#endif
InitializeMenusAccels();
nsCOMPtr<nsIObserverService> observerService(do_GetService("@mozilla.org/observer-service;1"));
observerService->NotifyObservers (nullptr, "kmeleon-init", nullptr);
// the hidden window will take care of creating the first
// browser window for us
@ -1767,7 +1780,7 @@ void CMfcEmbedApp::CheckProfileVersion()
}
}
}
/*
int CMfcEmbedApp::Run()
{
if (m_pMainWnd == NULL && AfxOleGetUserCtrl())
@ -1853,3 +1866,4 @@ BOOL CMfcEmbedApp::PumpMessage2(UINT filter)
}
return TRUE;
}
*/

@ -160,8 +160,8 @@ public:
BOOL m_bUnicode;
#endif
BOOL LoadLanguage();
virtual int Run();
virtual BOOL PumpMessage2(UINT filter = 0);
//virtual int Run();
//virtual BOOL PumpMessage2(UINT filter = 0);
//{{AFX_MSG(CMfcEmbedApp)
afx_msg void OnAppAbout();
afx_msg void OnNewBrowser();

Loading…
Cancel
Save