summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/dev/ppb_fullscreen_dev.h19
-rw-r--r--ppapi/cpp/dev/fullscreen_dev.cc14
-rw-r--r--ppapi/cpp/dev/fullscreen_dev.h8
-rw-r--r--ppapi/proxy/ppapi_messages_internal.h4
-rw-r--r--ppapi/proxy/ppb_fullscreen_proxy.cc22
-rw-r--r--ppapi/proxy/ppb_fullscreen_proxy.h4
6 files changed, 57 insertions, 14 deletions
diff --git a/ppapi/c/dev/ppb_fullscreen_dev.h b/ppapi/c/dev/ppb_fullscreen_dev.h
index ebf2ade..ed91ed1 100644
--- a/ppapi/c/dev/ppb_fullscreen_dev.h
+++ b/ppapi/c/dev/ppb_fullscreen_dev.h
@@ -7,9 +7,10 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_stdint.h"
-#define PPB_FULLSCREEN_DEV_INTERFACE "PPB_Fullscreen(Dev);0.3"
+#define PPB_FULLSCREEN_DEV_INTERFACE "PPB_Fullscreen(Dev);0.4"
// Use this interface to change a plugin instance to fullscreen mode.
struct PPB_Fullscreen_Dev {
@@ -18,11 +19,19 @@ struct PPB_Fullscreen_Dev {
// Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on
// success, PP_FALSE on failure.
- // When in fullscreen mode, the plugin will be transparently scaled to the
- // size of the screen. It will not receive a ViewChanged event, and doesn't
- // need to rebind the graphics context. The pending flushes will execute
- // normally, to the new fullscreen window.
+ // This unbinds the current Graphics2D or Surface3D. Pending flushes and
+ // swapbuffers will execute as if the resource was off-screen. The transition
+ // is asynchronous. During the transition, IsFullscreen will return PP_False,
+ // and no Graphics2D or Surface3D can be bound. The transition ends at the
+ // next DidChangeView.
+ // Note: when switching to and from fullscreen, Context3D and Surface3D
+ // resources need to be re-created. This is a current limitation that will be
+ // lifted in a later revision.
PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen);
+
+ // Gets the size of the screen. When going fullscreen, the instance will be
+ // resized to that size.
+ PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size);
};
#endif /* PPAPI_C_DEV_PPB_FULLSCREEN_DEV_H_ */
diff --git a/ppapi/cpp/dev/fullscreen_dev.cc b/ppapi/cpp/dev/fullscreen_dev.cc
index e68b296..11bb09a 100644
--- a/ppapi/cpp/dev/fullscreen_dev.cc
+++ b/ppapi/cpp/dev/fullscreen_dev.cc
@@ -9,6 +9,7 @@
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/size.h"
namespace pp {
@@ -21,7 +22,7 @@ template <> const char* interface_name<PPB_Fullscreen_Dev>() {
} // namespace
Fullscreen_Dev::Fullscreen_Dev(Instance* instance)
- : associated_instance_(instance) {
+ : instance_(instance) {
}
Fullscreen_Dev::~Fullscreen_Dev() {
@@ -30,14 +31,21 @@ Fullscreen_Dev::~Fullscreen_Dev() {
bool Fullscreen_Dev::IsFullscreen() {
return has_interface<PPB_Fullscreen_Dev>() &&
get_interface<PPB_Fullscreen_Dev>()->IsFullscreen(
- associated_instance_->pp_instance());
+ instance_->pp_instance());
}
bool Fullscreen_Dev::SetFullscreen(bool fullscreen) {
if (!has_interface<PPB_Fullscreen_Dev>())
return false;
return PPBoolToBool(get_interface<PPB_Fullscreen_Dev>()->SetFullscreen(
- associated_instance_->pp_instance(), BoolToPPBool(fullscreen)));
+ instance_->pp_instance(), BoolToPPBool(fullscreen)));
+}
+
+bool Fullscreen_Dev::GetScreenSize(Size* size) {
+ if (!has_interface<PPB_Fullscreen_Dev>())
+ return false;
+ return PPBoolToBool(get_interface<PPB_Fullscreen_Dev>()->GetScreenSize(
+ instance_->pp_instance(), &size->pp_size()));
}
} // namespace pp
diff --git a/ppapi/cpp/dev/fullscreen_dev.h b/ppapi/cpp/dev/fullscreen_dev.h
index 1050faf..9a11031 100644
--- a/ppapi/cpp/dev/fullscreen_dev.h
+++ b/ppapi/cpp/dev/fullscreen_dev.h
@@ -5,13 +5,10 @@
#ifndef PPAPI_CPP_DEV_FULLSCREEN_DEV_H_
#define PPAPI_CPP_DEV_FULLSCREEN_DEV_H_
-#include <string>
-
-#include "ppapi/c/dev/ppb_fullscreen_dev.h"
-
namespace pp {
class Instance;
+class Size;
class Fullscreen_Dev {
public:
@@ -21,9 +18,10 @@ class Fullscreen_Dev {
// PPB_Fullscreen_Dev methods.
bool IsFullscreen();
bool SetFullscreen(bool fullscreen);
+ bool GetScreenSize(Size* size);
private:
- Instance* associated_instance_;
+ Instance* instance_;
};
} // namespace pp
diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h
index 7ad4551..129502a 100644
--- a/ppapi/proxy/ppapi_messages_internal.h
+++ b/ppapi/proxy/ppapi_messages_internal.h
@@ -456,6 +456,10 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFullscreen_SetFullscreen,
PP_Instance /* instance */,
PP_Bool /* fullscreen */,
PP_Bool /* result */)
+IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBFullscreen_GetScreenSize,
+ PP_Instance /* instance */,
+ PP_Bool /* result */,
+ PP_Size /* size */)
// PPB_Graphics2D.
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create,
diff --git a/ppapi/proxy/ppb_fullscreen_proxy.cc b/ppapi/proxy/ppb_fullscreen_proxy.cc
index 19c9ead..12848bb 100644
--- a/ppapi/proxy/ppb_fullscreen_proxy.cc
+++ b/ppapi/proxy/ppb_fullscreen_proxy.cc
@@ -35,9 +35,21 @@ PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
return result;
}
+PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return PP_FALSE;
+
+ PP_Bool result = PP_FALSE;
+ dispatcher->Send(new PpapiHostMsg_PPBFullscreen_GetScreenSize(
+ INTERFACE_ID_PPB_FULLSCREEN, instance, &result, size));
+ return result;
+}
+
const PPB_Fullscreen_Dev fullscreen_interface = {
&IsFullscreen,
- &SetFullscreen
+ &SetFullscreen,
+ &GetScreenSize
};
InterfaceProxy* CreateFullscreenProxy(Dispatcher* dispatcher,
@@ -74,6 +86,8 @@ bool PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnMsgIsFullscreen)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_SetFullscreen,
OnMsgSetFullscreen)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_GetScreenSize,
+ OnMsgGetScreenSize)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
// TODO(brettw): handle bad messages!
@@ -91,5 +105,11 @@ void PPB_Fullscreen_Proxy::OnMsgSetFullscreen(PP_Instance instance,
*result = ppb_fullscreen_target()->SetFullscreen(instance, fullscreen);
}
+void PPB_Fullscreen_Proxy::OnMsgGetScreenSize(PP_Instance instance,
+ PP_Bool* result,
+ PP_Size* size) {
+ *result = ppb_fullscreen_target()->GetScreenSize(instance, size);
+}
+
} // namespace proxy
} // namespace pp
diff --git a/ppapi/proxy/ppb_fullscreen_proxy.h b/ppapi/proxy/ppb_fullscreen_proxy.h
index d68965a..0efc189 100644
--- a/ppapi/proxy/ppb_fullscreen_proxy.h
+++ b/ppapi/proxy/ppb_fullscreen_proxy.h
@@ -7,6 +7,7 @@
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/interface_proxy.h"
@@ -36,6 +37,9 @@ class PPB_Fullscreen_Proxy : public InterfaceProxy {
void OnMsgSetFullscreen(PP_Instance instance,
PP_Bool fullscreen,
PP_Bool* result);
+ void OnMsgGetScreenSize(PP_Instance instance,
+ PP_Bool* result,
+ PP_Size* size);
};
} // namespace proxy