Skip to content

Commit 2eba962

Browse files
committed
Merge pull request nwjs#2550 from jtg-gg/screen-rebase
Screen Geometry - rebase
2 parents b1a2cae + aa8da8a commit 2eba962

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

nw.gypi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@
149149
'src/api/dispatcher_bindings_mac.mm',
150150
'src/api/dispatcher_host.cc',
151151
'src/api/dispatcher_host.h',
152-
# 'src/api/event/event.h',
153-
# 'src/api/event/event.cc',
154-
# 'src/api/screen/screen.h',
155-
# 'src/api/screen/screen.cc',
152+
'src/api/event/event.h',
153+
'src/api/event/event.cc',
154+
'src/api/screen/screen.h',
155+
'src/api/screen/screen.cc',
156156
'src/api/window_bindings.cc',
157157
'src/api/window_bindings.h',
158158
'src/api/menu/menu.cc',

src/api/dispatcher_host.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void DispatcherHost::OnAllocateObject(int object_id,
161161
} else if (type == "Shortcut") {
162162
objects_registry_.AddWithID(new Shortcut(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
163163
} else if (type == "Screen") {
164-
//FIXME: objects_registry_.AddWithID(new EventListener(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
164+
objects_registry_.AddWithID(new EventListener(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
165165
} else {
166166
LOG(ERROR) << "Allocate an object of unknown type: " << type;
167167
objects_registry_.AddWithID(new Base(object_id, weak_ptr_factory_.GetWeakPtr(), option), object_id);
@@ -253,7 +253,7 @@ void DispatcherHost::OnCallStaticMethodSync(
253253
nwapi::App::Call(shell, method, arguments, result);
254254
return;
255255
} else if (type == "Screen") {
256-
//FIXME: nwapi::Screen::Call(this, method, arguments, result);
256+
nwapi::Screen::Call(this, method, arguments, result);
257257
return;
258258
}
259259

src/api/screen/screen.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ std::string DisplayToJSON(const gfx::Display& display) {
4646

4747
ret << ",\"scaleFactor\":" << display.device_scale_factor();
4848
ret << ",\"isBuiltIn\":" << (display.IsInternal() ? "true" : "false");
49+
ret << ",\"rotation\":" << display.RotationAsDegree();
50+
ret << ",\"touchSupport\":" << display.touch_support();
4951
ret << "}";
5052

5153
return ret.str();
@@ -57,9 +59,10 @@ class JavaScriptDisplayObserver : BaseEvent, public gfx::DisplayObserver {
5759
gfx::Screen* screen_;
5860

5961
// Called when the |display|'s bound has changed.
60-
virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE {
62+
virtual void OnDisplayMetricsChanged(const gfx::Display& display, uint32_t changed_metrics) OVERRIDE {
6163
base::ListValue arguments;
6264
arguments.AppendString(DisplayToJSON(display));
65+
arguments.AppendInteger(changed_metrics);
6366
object_->dispatcher_host()->SendEvent(object_, "displayBoundsChanged", arguments);
6467
}
6568

0 commit comments

Comments
 (0)