diff options
author | Karl Tomlinson <bugs.freedesktop@karlt.net> | 2008-08-16 20:03:23 +0300 |
---|---|---|
committer | Pekka Lampila <pekka.lampila@iki.fi> | 2008-08-16 20:03:23 +0300 |
commit | 373931a2f30088951659d3fb011ef9e6a09e9a36 (patch) | |
tree | 835ebc3174b6b8c846c97733971258c6ab25b604 | |
parent | 4d7a91b16640944f5580ee05a49ade2dbc9d7f6e (diff) |
draw to the visual from the NPWindow
Currently the swfdec plugin draws with the visual from the browser toplevel
window which is not necessarily appropriate for the Drawable of windowless
plugins. This can result in "BadMatch (invalid parameter attributes)" when the
depths differ or colour confusion if the depths are the same but color masks
differ.
Once this Mozilla bug is fixed, its test case can serve as a test case for this
bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=445250
Even without non-unit opacity, it's possible there may be some
Xserver/application configurations where the visual on the toplevel window
differs from that used within Mozilla, which is gdk_rgb_get_colormap(), or
other browser.
Fixes bug #16717
-rw-r--r-- | src/plugin.c | 3 | ||||
-rw-r--r-- | src/plugin_x11.c | 14 | ||||
-rw-r--r-- | src/plugin_x11.h | 3 | ||||
-rw-r--r-- | src/swfmoz_player.c | 3 | ||||
-rw-r--r-- | src/swfmoz_player.h | 4 |
5 files changed, 16 insertions, 11 deletions
diff --git a/src/plugin.c b/src/plugin.c index 598ef24..677ddf8 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -396,7 +396,8 @@ plugin_set_window (NPP instance, NPWindow *window) if (window) { plugin_x11_setup_windowed (instance->pdata, (Window) window->window, - window->x, window->y, window->width, window->height); + window->x, window->y, window->width, window->height, + ((NPSetWindowCallbackStruct *)window->ws_info)->visual); } else { plugin_x11_teardown (instance->pdata); } diff --git a/src/plugin_x11.c b/src/plugin_x11.c index 22775e1..2f6b3f5 100644 --- a/src/plugin_x11.c +++ b/src/plugin_x11.c @@ -51,7 +51,7 @@ plugin_x11_handle_event (SwfmozPlayer *mozplay, XEvent *event) GdkRectangle rect = { expose->x, expose->y, expose->width, expose->height }; GdkRegion *region = gdk_region_rectangle (&rect); cairo_surface_t *surface = cairo_xlib_surface_create (expose->display, - expose->drawable, GDK_VISUAL_XVISUAL (gdk_drawable_get_visual (mozplay->target)), + expose->drawable, mozplay->target_visual, expose->x + expose->width, expose->y + expose->height); cairo_t *cr = cairo_create (surface); swfmoz_player_render (mozplay, cr, region); @@ -129,7 +129,7 @@ plugin_x11_handle_event (SwfmozPlayer *mozplay, XEvent *event) XConfigureEvent *conf = (XConfigureEvent *) event; if (!mozplay->windowless) - swfmoz_player_set_target (mozplay, mozplay->target, 0, 0, conf->width, conf->height); + swfmoz_player_set_target (mozplay, mozplay->target, 0, 0, conf->width, conf->height, mozplay->target_visual); break; } default: @@ -147,7 +147,7 @@ plugin_x11_filter_event (GdkXEvent *gdkxevent, GdkEvent *unused, gpointer player void plugin_x11_setup_windowed (SwfmozPlayer *player, Window xwindow, - int x, int y, int width, int height) + int x, int y, int width, int height, Visual *visual) { if (player->windowless) { if (player->target == NULL) { @@ -157,9 +157,9 @@ plugin_x11_setup_windowed (SwfmozPlayer *player, Window xwindow, g_printerr ("cannot set window given for setup (id %lu)\n", xwindow); return; } - swfmoz_player_set_target (player, window, x, y, width, height); + swfmoz_player_set_target (player, window, x, y, width, height, visual); } else { - swfmoz_player_set_target (player, player->target, x, y, width, height); + swfmoz_player_set_target (player, player->target, x, y, width, height, visual); } } else { if (player->target == NULL) { @@ -186,7 +186,7 @@ plugin_x11_setup_windowed (SwfmozPlayer *player, Window xwindow, window = gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y); gdk_window_add_filter (window, plugin_x11_filter_event, player); gdk_window_show (window); - swfmoz_player_set_target (player, window, 0, 0, width, height); + swfmoz_player_set_target (player, window, 0, 0, width, height, visual); } else { gdk_window_move_resize (player->target, 0, 0, width, height); } @@ -199,5 +199,5 @@ plugin_x11_teardown (SwfmozPlayer *player) if (player->target) { gdk_window_remove_filter (player->target, plugin_x11_filter_event, player); } - swfmoz_player_set_target (player, NULL, 0, 0, 0, 0); + swfmoz_player_set_target (player, NULL, 0, 0, 0, 0, NULL); } diff --git a/src/plugin_x11.h b/src/plugin_x11.h index b07c677..dfd39e0 100644 --- a/src/plugin_x11.h +++ b/src/plugin_x11.h @@ -32,7 +32,8 @@ void plugin_x11_setup_windowed (SwfmozPlayer * player, int x, int y, int width, - int height); + int height, + Visual * visual); void plugin_x11_teardown (SwfmozPlayer * player); void plugin_x11_handle_event (SwfmozPlayer * player, XEvent * event); diff --git a/src/swfmoz_player.c b/src/swfmoz_player.c index 03746c4..05f7fca 100644 --- a/src/swfmoz_player.c +++ b/src/swfmoz_player.c @@ -654,7 +654,7 @@ swfmoz_player_add_loader (SwfmozPlayer *player, SwfmozLoader *loader) void swfmoz_player_set_target (SwfmozPlayer *player, GdkWindow *target, - int x, int y, int width, int height) + int x, int y, int width, int height, Visual *visual) { g_return_if_fail (SWFMOZ_IS_PLAYER (player)); g_return_if_fail (target == NULL || GDK_IS_WINDOW (target)); @@ -689,6 +689,7 @@ swfmoz_player_set_target (SwfmozPlayer *player, GdkWindow *target, player->target_rect.y = y; player->target_rect.width = width; player->target_rect.height = height; + player->target_visual = visual; swfdec_player_set_size (SWFDEC_PLAYER (player), width, height); } diff --git a/src/swfmoz_player.h b/src/swfmoz_player.h index bd747a9..c838d7d 100644 --- a/src/swfmoz_player.h +++ b/src/swfmoz_player.h @@ -57,6 +57,7 @@ struct _SwfmozPlayer { gboolean opaque; /* TRUE if the player should not allow translucency */ GdkWindow * target; /* what we draw to */ GdkRectangle target_rect; /* area in target that this plugin occupies */ + Visual * target_visual; /* visual for drawing */ GSource * repaint_source; /* set when repaint is necessary */ GdkRegion * repaint; /* area to repaint or NULL if none */ @@ -89,7 +90,8 @@ void swfmoz_player_set_target (SwfmozPlayer * player, int x, int y, int width, - int height); + int height, + Visual * visual); void swfmoz_player_set_allow_popups (SwfmozPlayer * player, gboolean allow); void swfmoz_player_render (SwfmozPlayer * player, |