Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

NPP_SetWindow

 

« Gecko Plugin API Reference « Plug-in Side Plug-in API

Summary

Tells the plug-in when a window is created, moved, sized, or destroyed.

Syntax

#include <npapi.h>
 
NPError NPP_SetWindow(NPP instance, NPWindow *window);

Parameters

The function has the following parameters:

instance
Pointer to the current plug-in instance. Must be embedded or full-screen.
window
Pointer to the window into which the instance draws. The window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on Unix below).

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.

Description

The browser calls NPP_SetWindow after creating the instance to allow drawing to begin. Subsequent calls to NPP_SetWindow indicate changes in size or position; these calls pass the same NPWindow object each time, but with different values. If the window handle is set to null, the window is destroyed. In this case, the plug-in must not perform any additional graphics operations on the window and should free any associated resources.

The data structure passed in NPP_SetWindow is an NPWindow object, which contains the coordinates of the instance's area and various platform-specific data. This window is valid for the life of the instance, or until NPP_SetWindow is called again with a different value.

For windowed plug-ins on Windows and Unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. On Mac OS, this field points to an NP_Port structure. For windowless plug-ins, it is a platform-specific handle to a drawable.

Before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the previous window (if one existed) to account for any changes.

For windowless plugins, NPP_SetWindow is called with a clipRect of 0,0,0,0 to signal that the plugin is not visible.

NOTE: NPP_SetWindow is useful only for embedded (NP_EMBED) or full-screen (NP_FULL) plug-ins, which are drawn into windows. It is irrelevant for hidden plug-ins.

See Also

NPP_HandleEvent, NPWindow, NP_Port

Document Tags and Contributors

Tags: 
 Contributors to this page: teoli, gfritzsche, Mgjbot, Pmash
 Last updated by: gfritzsche,