Skip to content

Commit

Permalink
Fix #256
Browse files Browse the repository at this point in the history
  • Loading branch information
milani committed Jan 7, 2013
1 parent 4f5d1a8 commit 839dd3d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/includes/cef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@

extern CefRefPtr<ClientHandler> g_handler;

#if defined(__WIN__)
DWMEFICA DwmExtendFrameIntoClientArea;
DWMEBBW DwmEnableBlurBehindWindow;
DWMWP DwmDefWindowProc;
HMODULE dwmapiDLL;
#endif


namespace appjs {

bool Cef::initialized_;
Expand Down
8 changes: 4 additions & 4 deletions src/includes/cef.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ typedef HRESULT (WINAPI *DWMEFICA)(HWND, MARGINS*);
typedef HRESULT (WINAPI *DWMEBBW)(HWND, BLURBEHIND*);
typedef BOOL (WINAPI *DWMWP)(HWND, UINT, WPARAM, LPARAM, LRESULT*);

static DWMEFICA DwmExtendFrameIntoClientArea = NULL;
static DWMEBBW DwmEnableBlurBehindWindow = NULL;
static DWMWP DwmDefWindowProc = NULL;
static HMODULE dwmapiDLL = NULL;
extern DWMEFICA DwmExtendFrameIntoClientAreaL;
extern DWMEBBW DwmEnableBlurBehindWindow;
extern DWMWP DwmDefWindowProc;
extern HMODULE dwmapiDLL;

#endif

Expand Down
2 changes: 1 addition & 1 deletion src/native_window/native_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class NativeWindow {

#if defined(__WIN__)
void SetStyle(long style, bool extended);
long GetStyle(bool extended);
long GetStyle(bool extended = false);

//static void SetAppIcon(NW_ICONSIZE size, wchar_t* path);
//void SetTitle(const wchar_t* title);
Expand Down
21 changes: 16 additions & 5 deletions src/native_window/native_window_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
#define MAX_LOADSTRING 100
#define SWP_STATECHANGED 0x8000

#if defined(__WIN__)
extern DWMEFICA DwmExtendFrameIntoClientArea;
extern DWMEBBW DwmEnableBlurBehindWindow;
extern DWMWP DwmDefWindowProc;
extern HMODULE dwmapiDLL;
#endif

extern CefRefPtr<ClientHandler> g_handler;

namespace appjs {
Expand Down Expand Up @@ -134,7 +141,9 @@ NativeWindow* NativeWindow::GetWindow(CefRefPtr<CefBrowser> browser){
void AddWebView(CefWindowHandle parent, RECT windowRect, char* url, Settings* settings) {
CefWindowInfo windowInfo;
windowInfo.SetAsChild(parent, windowRect);
windowInfo.SetTransparentPainting(true);
if(settings->getBoolean("alpha",false)) {
windowInfo.SetTransparentPainting(true);
}
g_handler->browserSettings_.web_security_disabled = settings->getBoolean("disableSecurity", false);
CefBrowser::CreateBrowser(windowInfo, static_cast<CefRefPtr<CefClient>>(g_handler), url, g_handler->browserSettings_);
}
Expand Down Expand Up @@ -181,7 +190,7 @@ void NativeWindow::Init(char* url, Settings* settings) {
style |= WS_EX_TOOLWINDOW;
style &= ~(WS_EX_APPWINDOW);
ShowWindow(handle_, SW_HIDE);
SetWindowLongPtr(handle_, GWL_EXSTYLE, style);
SetWindowLongPtr(handle_, GWL_EXSTYLE, style);
ShowWindow(handle_, SW_HIDE);
}

Expand All @@ -200,7 +209,6 @@ void NativeWindow::Init(char* url, Settings* settings) {

UpdateWindow(handle_);

Cef::Run();
};


Expand Down Expand Up @@ -362,17 +370,20 @@ bool NativeWindow::GetResizable() {

void NativeWindow::SetShowChrome(bool showChrome) {
show_chrome_ = showChrome;
long current = GetWindowLongPtr(handle_, GWL_STYLE);
long current = GetStyle();
NewStyle(handle_, GWL_STYLE, showChrome ? current | WS_CAPTION | WS_SIZEBOX : current & ~(WS_CAPTION | WS_SIZEBOX));
}

bool NativeWindow::GetShowChrome() {
long current = GetWindowLongPtr(handle_, GWL_STYLE);
long current = GetStyle();
return (current & WS_CAPTION) || (current & WS_SIZEBOX);
}

void NativeWindow::SetAlpha(bool alpha) {
alpha_ = alpha;
long current = GetStyle(TRUE);
SetStyle( alpha ? current | WS_EX_LAYERED | WS_EX_COMPOSITED : current & ~(WS_EX_LAYERED | WS_EX_COMPOSITED),TRUE);
BlurBehind(handle_, alpha);
SetNCWidth(handle_, alpha ? -1 : 0);
}

Expand Down

0 comments on commit 839dd3d

Please sign in to comment.