1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
diff -ur nspluginwrapper-1.3.0-clean/src/npw-player.c nspluginwrapper-1.3.0-xid/src/npw-player.c
--- nspluginwrapper-1.3.0-clean/src/npw-player.c 2009-12-05 00:02:45.540599262 -0500
+++ nspluginwrapper-1.3.0-xid/src/npw-player.c 2009-12-05 00:32:05.814668671 -0500
@@ -53,6 +53,7 @@
static gboolean g_verbose = FALSE;
static guint g_backend = BACKEND_GTK;
+static guint g_xid = 0;
static guint g_n_plugins = 0;
typedef struct _Plugin Plugin;
@@ -511,7 +512,7 @@
static inline NPIdentifier
pack_int_identifier (int32_t value)
{
-
+
return GUINT_TO_POINTER ((((uint32_t)value) << 1) | NP_IDENTIFIER_INT);
}
@@ -1638,7 +1639,7 @@
continue;
StreamInstance *pstream;
-
+
CURL *handle = msg->easy_handle;
if (curl_easy_getinfo (handle, CURLINFO_PRIVATE, &pstream) == CURLE_OK)
{
@@ -2213,6 +2214,7 @@
g_print ("Options:\n");
g_print (" -v|--verbose enable verbose mode\n");
g_print (" -f|--fullscreen start in fullscreen mode\n");
+ g_print (" --xid N embed in window with xid N\n");
g_print ("\n");
g_print ("Common attributes include:\n");
@@ -2490,6 +2492,14 @@
is_fullscreen = FALSE;
else if (strcmp (arg, "--fullscreen") == 0)
is_fullscreen = TRUE;
+ else if (strcmp (arg, "--xid") == 0)
+ {
+ if (++i < argc)
+ {
+ g_xid = atoi(argv[i]);
+ npw_printf ("attaching to xid %d\n", g_xid);
+ }
+ }
else if (strcmp (arg, "--plugin") == 0)
{
if (plugin_desc)
@@ -2581,7 +2591,34 @@
g_timeout_add (100, (GSourceFunc)player_app_run, app);
- if (TRUE)
+ if (g_xid)
+ {
+ GtkWidget *window = gtk_plug_new ((GdkNativeWindow)g_xid);
+ if ((app->window = window) == NULL)
+ g_error ("could not create plug widget - bad xid?");
+
+ gtk_widget_set_size_request (window, display_width, display_height);
+ gtk_widget_show (window);
+
+ /* Ensure focus window is this window not gtk's proxy for non XEMBED case */
+ XWindowAttributes xattrs;
+ XGetWindowAttributes (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (window->window), &xattrs);
+ XSelectInput (GDK_DISPLAY (),
+ GDK_WINDOW_XWINDOW (window->window),
+ xattrs.your_event_mask | SubstructureNotifyMask);
+ gdk_window_add_filter (window->window, on_window_filter_cb, app);
+ XSync (GDK_DISPLAY (), False);
+
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (on_window_destroy_cb), NULL);
+ g_signal_connect (window, "key-press-event",
+ G_CALLBACK (on_key_press_event_cb), app);
+ g_signal_connect (window, "configure-event",
+ G_CALLBACK (on_configure_event_cb), app);
+ g_signal_connect (window, "window-state-event",
+ G_CALLBACK (on_window_state_event_cb), app);
+ }
+ else
{
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if ((app->window = window) == NULL)
|