OLD | NEW |
1 /* | 1 /* |
2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap
ple") in | 2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap
ple") in |
3 consideration of your agreement to the following terms, and your use, installat
ion, | 3 consideration of your agreement to the following terms, and your use, installat
ion, |
4 modification or redistribution of this Apple software constitutes acceptance of
these | 4 modification or redistribution of this Apple software constitutes acceptance of
these |
5 terms. If you do not agree with these terms, please do not use, install, modif
y or | 5 terms. If you do not agree with these terms, please do not use, install, modif
y or |
6 redistribute this Apple software. | 6 redistribute this Apple software. |
7 | 7 |
8 In consideration of your agreement to abide by the following terms, and subject
to these | 8 In consideration of your agreement to abide by the following terms, and subject
to these |
9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri
ghts in | 9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri
ghts in |
10 this original Apple software (the "Apple Software"), to use, reproduce, modify
and | 10 this original Apple software (the "Apple Software"), to use, reproduce, modify
and |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #else | 42 #else |
43 #define NPAPI | 43 #define NPAPI |
44 #endif | 44 #endif |
45 | 45 |
46 #if defined(__GNUC__) && __GNUC__ >= 4 | 46 #if defined(__GNUC__) && __GNUC__ >= 4 |
47 #define EXPORT __attribute__((visibility ("default"))) | 47 #define EXPORT __attribute__((visibility ("default"))) |
48 #else | 48 #else |
49 #define EXPORT | 49 #define EXPORT |
50 #endif | 50 #endif |
51 | 51 |
52 #if defined(OS_LINUX) | 52 #if defined(USE_X11) |
53 #include <X11/Xlib.h> | 53 #include <X11/Xlib.h> |
54 #endif | 54 #endif |
55 | 55 |
56 // Plugin entry points | 56 // Plugin entry points |
57 extern "C" { | 57 extern "C" { |
58 EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs | 58 EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs |
59 #if defined(OS_LINUX) | 59 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
60 , NPPluginFuncs *pluginFuncs | 60 , NPPluginFuncs *pluginFuncs |
61 #endif | 61 #endif |
62 ); | 62 ); |
63 EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); | 63 EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); |
64 EXPORT void NPAPI NP_Shutdown(void); | 64 EXPORT void NPAPI NP_Shutdown(void); |
65 | 65 |
66 #if defined(OS_LINUX) | 66 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
67 EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *v
alue); | 67 EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *v
alue); |
68 EXPORT const char* NPAPI NP_GetMIMEDescription(void); | 68 EXPORT const char* NPAPI NP_GetMIMEDescription(void); |
69 #endif | 69 #endif |
70 } | 70 } |
71 | 71 |
72 // Plugin entry points | 72 // Plugin entry points |
73 EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs | 73 EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs |
74 #if defined(OS_LINUX) | 74 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
75 , NPPluginFuncs *pluginFuncs | 75 , NPPluginFuncs *pluginFuncs |
76 #endif | 76 #endif |
77 ) | 77 ) |
78 { | 78 { |
79 browser = browserFuncs; | 79 browser = browserFuncs; |
80 #if defined(OS_LINUX) | 80 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
81 return NP_GetEntryPoints(pluginFuncs); | 81 return NP_GetEntryPoints(pluginFuncs); |
82 #else | 82 #else |
83 return NPERR_NO_ERROR; | 83 return NPERR_NO_ERROR; |
84 #endif | 84 #endif |
85 } | 85 } |
86 | 86 |
87 EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) | 87 EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) |
88 { | 88 { |
89 pluginFuncs->version = 11; | 89 pluginFuncs->version = 11; |
90 pluginFuncs->size = sizeof(pluginFuncs); | 90 pluginFuncs->size = sizeof(pluginFuncs); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 break; | 311 break; |
312 case WM_KILLFOCUS: | 312 case WM_KILLFOCUS: |
313 log(instance, "loseFocusEvent"); | 313 log(instance, "loseFocusEvent"); |
314 break; | 314 break; |
315 default: | 315 default: |
316 log(instance, "event %d", evt->event); | 316 log(instance, "event %d", evt->event); |
317 } | 317 } |
318 | 318 |
319 fflush(stdout); | 319 fflush(stdout); |
320 | 320 |
321 #elif defined(OS_LINUX) | 321 #elif defined(USE_X11) |
322 XEvent* evt = static_cast<XEvent*>(event); | 322 XEvent* evt = static_cast<XEvent*>(event); |
323 XButtonPressedEvent* bpress_evt = reinterpret_cast<XButtonPressedEvent*>(evt
); | 323 XButtonPressedEvent* bpress_evt = reinterpret_cast<XButtonPressedEvent*>(evt
); |
324 XButtonReleasedEvent* brelease_evt = reinterpret_cast<XButtonReleasedEvent*>
(evt); | 324 XButtonReleasedEvent* brelease_evt = reinterpret_cast<XButtonReleasedEvent*>
(evt); |
325 switch (evt->type) { | 325 switch (evt->type) { |
326 case ButtonPress: | 326 case ButtonPress: |
327 log(instance, "mouseDown at (%d, %d)", bpress_evt->x, bpress_evt->y)
; | 327 log(instance, "mouseDown at (%d, %d)", bpress_evt->x, bpress_evt->y)
; |
328 break; | 328 break; |
329 case ButtonRelease: | 329 case ButtonRelease: |
330 log(instance, "mouseUp at (%d, %d)", brelease_evt->x, brelease_evt->
y); | 330 log(instance, "mouseUp at (%d, %d)", brelease_evt->x, brelease_evt->
y); |
331 break; | 331 break; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 executeScript(obj, obj->onURLNotify); | 438 executeScript(obj, obj->onURLNotify); |
439 | 439 |
440 handleCallback(obj, url, reason, notifyData); | 440 handleCallback(obj, url, reason, notifyData); |
441 } | 441 } |
442 | 442 |
443 NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) | 443 NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) |
444 { | 444 { |
445 NPError err = NPERR_NO_ERROR; | 445 NPError err = NPERR_NO_ERROR; |
446 | 446 |
447 switch (variable) { | 447 switch (variable) { |
448 #if defined(OS_LINUX) | 448 #if defined(USE_X11) |
449 case NPPVpluginNameString: | 449 case NPPVpluginNameString: |
450 *((const char **)value) = "WebKit Test PlugIn"; | 450 *((const char **)value) = "WebKit Test PlugIn"; |
451 break; | 451 break; |
452 case NPPVpluginDescriptionString: | 452 case NPPVpluginDescriptionString: |
453 *((const char **)value) = "Simple Netscape plug-in that handles test
content for WebKit"; | 453 *((const char **)value) = "Simple Netscape plug-in that handles test
content for WebKit"; |
454 break; | 454 break; |
455 case NPPVpluginNeedsXEmbed: | 455 case NPPVpluginNeedsXEmbed: |
456 *((NPBool *)value) = TRUE; | 456 *((NPBool *)value) = TRUE; |
457 break; | 457 break; |
458 #endif | 458 #endif |
(...skipping 12 matching lines...) Expand all Loading... |
471 } | 471 } |
472 | 472 |
473 return err; | 473 return err; |
474 } | 474 } |
475 | 475 |
476 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) | 476 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) |
477 { | 477 { |
478 return NPERR_GENERIC_ERROR; | 478 return NPERR_GENERIC_ERROR; |
479 } | 479 } |
480 | 480 |
481 #if defined(OS_LINUX) | 481 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
482 EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *value
) | 482 EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *value
) |
483 { | 483 { |
484 return NPP_GetValue(instance, variable, value); | 484 return NPP_GetValue(instance, variable, value); |
485 } | 485 } |
486 | 486 |
487 EXPORT const char* NPAPI NP_GetMIMEDescription(void) { | 487 EXPORT const char* NPAPI NP_GetMIMEDescription(void) { |
488 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html | 488 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html |
489 // asserts that the number of mimetypes handled by plugins should be | 489 // asserts that the number of mimetypes handled by plugins should be |
490 // greater than the number of plugins. This isn't true if we're | 490 // greater than the number of plugins. This isn't true if we're |
491 // the only plugin and we only handle one mimetype, so specify | 491 // the only plugin and we only handle one mimetype, so specify |
492 // multiple mimetypes here. | 492 // multiple mimetypes here. |
493 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;" | 493 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;" |
494 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont
ent2"; | 494 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont
ent2"; |
495 } | 495 } |
496 #endif | 496 #endif |
OLD | NEW |