Skip to content

Commit f950198

Browse files
committed
Merge pull request nwjs#439 from trevorlinton/transparency
Transparency Support in Mac OS X/Windows
2 parents c6d234d + b841142 commit f950198

File tree

113 files changed

+2976
-1030
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2976
-1030
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
.DS_Store
22
tests/node_modules
3+
tests/native_modules
4+
tests/tmp-nw
35
*.pyc
4-
6+
*~
7+
.*.sw?
8+
.project
9+
.pydevproject
10+
tags
11+
Thumbs.db

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ Jeroen Ransijn <jssrdesign@gmail.com>
1515
Ivo Georgiev <ivo@linvo.org>
1616
Krill Izotov <enykeev@gmail.com>
1717
Zhang Chaobin <zhchbin@gmail.com>
18+
Michael Morrison <mmorrison@wootalyzer.com>
19+
William Towe <willbur1984@gmail.com>
20+
Trevor Linton <trevor.linton@gmail.com>

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Introduction
1+
## Introduction
22

33
node-webkit is an app runtime based on `Chromium` and `node.js`. You can
44
write native apps in HTML and Javascript with node-webkit. It also lets you
@@ -9,29 +9,30 @@ It's created and developed in Intel Open Source Technology Center.
99

1010
[Introduction to node-webkit (slides)](https://speakerdeck.com/u/zcbenz/p/node-webkit-app-runtime-based-on-chromium-and-node-dot-js).
1111

12-
# Features
12+
## Features
1313

1414
* Apps written in modern HTML5, CSS3, JS and WebGL.
1515
* Complete support for [Node.js APIs](http://nodejs.org/api/) and all its [third party modules](https://npmjs.org).
1616
* Good performance: Node and WebKit runs in the same thread: Function calls are made straightforward; objects are in the same heap and can just reference each other;
1717
* Easy to package and distribute apps.
1818
* Available on Linux, Mac OSX and Windows
1919

20-
# Downloads
20+
## Downloads
2121

22-
[v0.3.7 release note](https://groups.google.com/d/msg/node-webkit/Ia0HHY8BWLA/kJWM6Hw6CwcJ)
22+
[v0.4.1 release note](https://groups.google.com/d/msg/node-webkit/1JgTNLOEpIs/e2e0FwH9TE4J)
2323

24-
Prebuilt binaries (v0.3.7 — Jan 6, 2013):
24+
Prebuilt binaries (v0.4.1 — Feb 1, 2013):
2525

26-
* Linux: [32bit](https://s3.amazonaws.com/node-webkit/v0.3.7/node-webkit-v0.3.7-linux-ia32.tar.gz) / [64bit](https://s3.amazonaws.com/node-webkit/v0.3.7/node-webkit-v0.3.7-linux-x64.tar.gz)
27-
* Windows: [win32](https://s3.amazonaws.com/node-webkit/v0.3.7/node-webkit-v0.3.7-win-ia32.zip)
28-
* Mac: [32bit](https://s3.amazonaws.com/node-webkit/v0.3.7/node-webkit-v0.3.7-osx-ia32.zip)
26+
* Linux: [32bit](https://s3.amazonaws.com/node-webkit/v0.4.1/node-webkit-v0.4.1-linux-ia32.tar.gz) / [64bit](https://s3.amazonaws.com/node-webkit/v0.4.1/node-webkit-v0.4.1-linux-x64.tar.gz)
27+
* Windows: [win32](https://s3.amazonaws.com/node-webkit/v0.4.1/node-webkit-v0.4.1-win-ia32.zip)
28+
* Mac: [32bit, 10.7+](https://s3.amazonaws.com/node-webkit/v0.4.1/node-webkit-v0.4.1-osx-ia32.zip)
2929

3030
[Looking for older versions?](https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions)
3131

32+
###Demos and real apps
3233
You may also be interested in [our demos repository](https://github.com/zcbenz/nw-sample-apps) and the [List of apps and companies using node-webkit](https://github.com/rogerwang/node-webkit/wiki/List-of-apps-and-companies-using-node-webkit).
3334

34-
# Quick Start
35+
## Quick Start
3536

3637
Create `index.html`:
3738

@@ -72,7 +73,7 @@ $ ./nw app.nw
7273

7374
Note: on Windows, you can drag the `app.nw` to `nw.exe` to open it.
7475

75-
# Documents
76+
## Documents
7677

7778
For more information on how to write/package/run apps, see:
7879

@@ -82,11 +83,11 @@ For more information on how to write/package/run apps, see:
8283

8384
And our [Wiki](https://github.com/rogerwang/node-webkit/wiki) for much more.
8485

85-
# Community
86+
## Community
8687

8788
We use [node-webkit group](http://groups.google.com/group/node-webkit) as
8889
our mailing list, subscribe via [node-webkit+subscribe@googlegroups.com](mailto:node-webkit+subscribe@googlegroups.com).
8990

90-
# License
91+
## License
9192

9293
`node-webkit`'s code uses the MIT license, see our `LICENSE` file.

nw.gypi

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'<(DEPTH)/content/content_resources.gyp:content_resources',
3131
'<(DEPTH)/ipc/ipc.gyp:ipc',
3232
'<(DEPTH)/media/media.gyp:media',
33-
'<(DEPTH)/net/net.gyp:net',
33+
'<(DEPTH)/net/net.gyp:net_with_v8',
3434
'<(DEPTH)/net/net.gyp:net_resources',
3535
'<(DEPTH)/skia/skia.gyp:skia',
3636
'<(DEPTH)/third_party/node/node.gyp:node',
@@ -129,6 +129,8 @@
129129
'src/api/window/window.h',
130130
'src/browser/app_controller_mac.h',
131131
'src/browser/app_controller_mac.mm',
132+
'src/browser/capture_page_helper.h',
133+
'src/browser/capture_page_helper.cc',
132134
'src/browser/file_select_helper.cc',
133135
'src/browser/file_select_helper.h',
134136
'src/browser/native_window.cc',
@@ -148,6 +150,9 @@
148150
'src/browser/shell_devtools_delegate.h',
149151
'src/browser/shell_download_manager_delegate.cc',
150152
'src/browser/shell_download_manager_delegate.h',
153+
'src/browser/shell_download_manager_delegate_win.cc',
154+
'src/browser/shell_download_manager_delegate_gtk.cc',
155+
'src/browser/shell_download_manager_delegate_mac.mm',
151156
'src/browser/shell_javascript_dialog_creator.cc',
152157
'src/browser/shell_javascript_dialog_creator.h',
153158
'src/browser/shell_javascript_dialog_gtk.cc',
@@ -175,6 +180,8 @@
175180
'src/geolocation/shell_access_token_store.h',
176181
'src/media/media_internals.cc',
177182
'src/media/media_internals.h',
183+
'src/media/media_capture_devices_dispatcher.cc',
184+
'src/media/media_capture_devices_dispatcher.h',
178185
'src/media/media_stream_devices_controller.cc',
179186
'src/media/media_stream_devices_controller.h',
180187
'src/net/clear_on_exit_policy.h',
@@ -196,8 +203,12 @@
196203
'src/paths_mac.mm',
197204
'src/renderer/autofill_agent.h',
198205
'src/renderer/autofill_agent.cc',
206+
'src/renderer/common/render_messages.cc',
207+
'src/renderer/common/render_messages.h',
199208
'src/renderer/prerenderer/prerenderer_client.cc',
200209
'src/renderer/prerenderer/prerenderer_client.h',
210+
'src/renderer/nw_render_view_observer.cc',
211+
'src/renderer/nw_render_view_observer.h',
201212
'src/renderer/shell_content_renderer_client.cc',
202213
'src/renderer/shell_content_renderer_client.h',
203214
'src/renderer/shell_render_process_observer.cc',
@@ -293,7 +304,7 @@
293304
'target_name': 'nw_pak',
294305
'type': 'none',
295306
'dependencies': [
296-
'<(DEPTH)/content/browser/debugger/devtools_resources.gyp:devtools_resources',
307+
'<(DEPTH)/content/browser/devtools/devtools_resources.gyp:devtools_resources',
297308
'<(DEPTH)/ui/ui.gyp:ui_resources',
298309
'nw_resources',
299310
],
@@ -394,17 +405,7 @@
394405
['OS=="win"', {
395406
'sources': [
396407
'src/shell.rc',
397-
'../../webkit/glue/resources/pan_east.cur',
398-
'../../webkit/glue/resources/pan_middle.cur',
399-
'../../webkit/glue/resources/pan_north.cur',
400-
'../../webkit/glue/resources/pan_north_east.cur',
401-
'../../webkit/glue/resources/pan_north_west.cur',
402-
'../../webkit/glue/resources/pan_south.cur',
403-
'../../webkit/glue/resources/pan_south_east.cur',
404-
'../../webkit/glue/resources/pan_south_west.cur',
405-
'../../webkit/glue/resources/pan_west.cur',
406-
407-
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
408+
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_unscaled_resources.rc',
408409
],
409410
'configurations': {
410411
'Debug_Base': {

src/api/app/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ App.filteredArgv = [
2828
/--no-toolbar/,
2929
/--url=.*/,
3030
/--remote-debugging-port=.*/,
31+
/--renderer-cmd-prefix.*/,
3132
];
3233

3334
App.prototype.quit = function() {

src/api/dispatcher.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,26 @@ void Dispatcher::OnEvent(int object_id,
8585
node::MakeCallback(objects_registry, "handleEvent", 3, argv);
8686
}
8787

88+
void Dispatcher::ZoomLevelChanged() {
89+
WebKit::WebView* web_view = render_view()->GetWebView();
90+
float zoom_level = web_view->zoomLevel();
91+
v8::Handle<v8::Value> v8win = web_view->mainFrame()->
92+
mainWorldScriptContext()->Global();
93+
v8::Handle<v8::Value> val = v8win->ToObject()->Get(v8::String::New("__nwWindowId"));
94+
95+
if (val->IsNull() || val->IsUndefined())
96+
return;
97+
98+
v8::Handle<v8::Value> registry =
99+
node::g_context->Global()->Get(v8::String::New("__nwObjectsRegistry"));
100+
if (registry->IsNull() || registry->IsUndefined())
101+
return;
102+
v8::Handle<v8::Object> objects_registry = registry->ToObject();
103+
104+
v8::Local<v8::Array> args = v8::Array::New();
105+
args->Set(0, v8::Number::New(zoom_level));
106+
v8::Handle<v8::Value> argv[] = {val, v8::String::New("zoom"), args };
107+
108+
node::MakeCallback(objects_registry, "handleEvent", 3, argv);
109+
}
88110
} // namespace api

src/api/dispatcher.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Dispatcher : public content::RenderViewObserver {
4343
// RenderViewObserver implementation.
4444
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
4545
virtual void DraggableRegionsChanged(WebKit::WebFrame* frame) OVERRIDE;
46+
virtual void ZoomLevelChanged() OVERRIDE;
4647

4748
void OnEvent(int object_id,
4849
std::string event,

src/api/dispatcher_host.cc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@
3232
#include "content/nw/src/api/shell/shell.h"
3333
#include "content/nw/src/api/tray/tray.h"
3434
#include "content/nw/src/api/window/window.h"
35+
#include "content/nw/src/common/shell_switches.h"
36+
#include "content/nw/src/shell_browser_context.h"
3537
#include "content/nw/src/nw_shell.h"
3638
#include "content/public/browser/render_process_host.h"
3739

3840
using content::WebContents;
41+
using content::ShellBrowserContext;
3942

4043
namespace api {
4144

@@ -198,24 +201,31 @@ void DispatcherHost::OnGetShellId(int* id) {
198201
void DispatcherHost::OnCreateShell(const std::string& url,
199202
const base::DictionaryValue& manifest,
200203
int* routing_id) {
201-
WebContents* base_web_contents =
204+
WebContents* base_web_contents =
202205
content::Shell::FromRenderViewHost(render_view_host())->web_contents();
203-
WebContents* web_contents = content::WebContentsImpl::CreateWithOpener(
204-
base_web_contents->GetBrowserContext(),
205-
base_web_contents->GetSiteInstance(),
206-
MSG_ROUTING_NONE,
207-
static_cast<content::WebContentsImpl*>(base_web_contents),
208-
static_cast<content::WebContentsImpl*>(base_web_contents));
209-
206+
ShellBrowserContext* browser_context =
207+
static_cast<ShellBrowserContext*>(base_web_contents->GetBrowserContext());
210208
scoped_ptr<base::DictionaryValue> new_manifest(manifest.DeepCopy());
209+
bool new_renderer = false;
210+
if (new_manifest->GetBoolean(switches::kmNewInstance,
211+
&new_renderer) && new_renderer)
212+
browser_context->set_pinning_renderer(false);
213+
214+
WebContents::CreateParams create_params(browser_context, NULL);
211215

216+
WebContents* web_contents = content::WebContentsImpl::CreateWithOpener(
217+
create_params,
218+
static_cast<content::WebContentsImpl*>(base_web_contents));
212219
new content::Shell(web_contents, new_manifest.get());
213220
web_contents->GetController().LoadURL(
214221
GURL(url),
215222
content::Referrer(),
216223
content::PAGE_TRANSITION_TYPED,
217224
std::string());
218225

226+
if (new_renderer)
227+
browser_context->set_pinning_renderer(true);
228+
219229
*routing_id = web_contents->GetRoutingID();
220230
}
221231

src/api/menu/menu.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ class NativeWindowGtk;
5151
namespace nw {
5252
class NativeWindowWin;
5353
}
54+
55+
namespace ui {
56+
57+
// A derived class to override |HasIcons| to prevent the |NativeMenuWin| from
58+
// being a owner-draw control.
59+
// Note: this method maybe confused when the menuitem has an icon. I always
60+
// return |false| here, and set the icon by using |SetMenuItemBitmaps|.
61+
class NwMenuModel : public SimpleMenuModel {
62+
public:
63+
NwMenuModel(Delegate* delegate);
64+
65+
// Overridden from MenuModel:
66+
virtual bool HasIcons() const OVERRIDE;
67+
};
68+
69+
} // namespace ui
70+
5471
#endif
5572

5673
namespace content {
@@ -92,15 +109,18 @@ class Menu : public Base {
92109
#elif defined(OS_WIN)
93110
friend class nw::NativeWindowWin;
94111

95-
void Rebuild();
112+
void Rebuild(const gfx::NativeMenu *parent_menu = NULL);
96113

97114
// Flag to indicate the menu has been modified since last show, so we should
98115
// rebuild the menu before next show.
99116
bool is_menu_modified_;
100117

101118
scoped_ptr<MenuDelegate> menu_delegate_;
102-
scoped_ptr<ui::SimpleMenuModel> menu_model_;
119+
scoped_ptr<ui::NwMenuModel> menu_model_;
103120
scoped_ptr<views::NativeMenuWin> menu_;
121+
122+
// A container for the handles of the icon bitmap.
123+
std::vector<HBITMAP> icon_bitmaps_;
104124
#endif
105125

106126
DISALLOW_COPY_AND_ASSIGN(Menu);

0 commit comments

Comments
 (0)