Skip to content

Instantly share code, notes, and snippets.

@mmatyas
Created May 26, 2015 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmatyas/e1e2f06e97f43c4e4198 to your computer and use it in GitHub Desktop.
Save mmatyas/e1e2f06e97f43c4e4198 to your computer and use it in GitHub Desktop.
Glutin colormap
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 0c3700b..a14eeff 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -421,10 +421,18 @@ impl Window {
builder.parent as ffi::Window
};
+ // creating the color map
+ let cmap = unsafe {
+ let cmap = ffi::XCreateColormap(display, parent,
+ visual_infos.visual as *mut _, ffi::AllocNone);
+ // TODO: error checking?
+ cmap
+ };
+
// creating
let mut set_win_attr = {
let mut swa: ffi::XSetWindowAttributes = unsafe { mem::zeroed() };
- swa.colormap = 0;
+ swa.colormap = cmap;
swa.event_mask = ffi::ExposureMask | ffi::StructureNotifyMask |
ffi::VisibilityChangeMask | ffi::KeyPressMask | ffi::PointerMotionMask |
ffi::KeyReleaseMask | ffi::ButtonPressMask |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment