[vlc-commits] XCB: add support for background color attribute
Cheng Sun
git at videolan.org
Sat Jan 21 23:12:16 CET 2012
npapi-vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Mon Jan 16 18:14:14 2012 +0000| [fc459c33ce130dd91148463ee4e5cfd6ac2d1fd8] | committer: Cheng Sun
XCB: add support for background color attribute
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=fc459c33ce130dd91148463ee4e5cfd6ac2d1fd8
---
npapi/vlcplugin_xcb.cpp | 19 ++++++++++++++-----
npapi/vlcplugin_xcb.h | 2 ++
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/npapi/vlcplugin_xcb.cpp b/npapi/vlcplugin_xcb.cpp
index 3d1e68c..76e4c12 100644
--- a/npapi/vlcplugin_xcb.cpp
+++ b/npapi/vlcplugin_xcb.cpp
@@ -83,7 +83,6 @@ bool VlcPluginXcb::create_windows()
xcb_atom_t xembed_info_atom = xcb_intern_atom_reply(conn, cookie, NULL)->atom;
/* create windows */
- /* TODO: respect get_bg_color() */
const uint32_t parent_values[] = {0x0FFFFF};
parent = xcb_generate_id(conn);
xcb_create_window(conn, XCB_COPY_FROM_PARENT, parent, socket,
@@ -94,7 +93,19 @@ bool VlcPluginXcb::create_windows()
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, parent,
xembed_info_atom, xembed_info_atom,
32, 2, (void *) xembed_info_buf);
- const uint32_t video_values[] = {screen->black_pixel, 0x0FFFFF};
+
+ colormap = screen->default_colormap;
+ uint8_t r = 0, g = 0, b = 0;
+ HTMLColor2RGB(get_bg_color().c_str(), &r, &g, &b);
+ xcb_alloc_color_reply_t *reply = xcb_alloc_color_reply(conn,
+ xcb_alloc_color(conn, colormap,
+ (uint16_t) r << 8,
+ (uint16_t) g << 8,
+ (uint16_t) b << 8), NULL);
+ colorpixel = reply->pixel;
+ free(reply);
+
+ const uint32_t video_values[] = {colorpixel, 0x0FFFFF};
video = xcb_generate_id(conn);
xcb_create_window(conn, 0, video, parent,
0, 0, 1, 1, 0,
@@ -129,9 +140,7 @@ bool VlcPluginXcb::resize_windows()
bool VlcPluginXcb::destroy_windows()
{
- /* destroy x window */
xcb_destroy_window(conn, parent);
-
- /* close connection */
+ xcb_free_colors(conn, colormap, 0, 1, &colorpixel);
xcb_disconnect(conn);
}
diff --git a/npapi/vlcplugin_xcb.h b/npapi/vlcplugin_xcb.h
index b70ccbf..9bae89c 100644
--- a/npapi/vlcplugin_xcb.h
+++ b/npapi/vlcplugin_xcb.h
@@ -57,6 +57,8 @@ public:
unsigned int i_width, i_height;
xcb_connection_t *conn;
xcb_window_t parent, video;
+ xcb_colormap_t colormap;
+ uint32_t colorpixel;
pthread_t thread;
More information about the vlc-commits
mailing list