From ee2fea13b20644e45c77f12a8b6d6f55941c27c8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 31 Aug 2015 08:52:58 +0200 Subject: Bug 1205 - NEWT Security: Clear framebuffer after creation and before visibility (X11 Onscreen) X11Window.c: Adding CWBackPixel BlackPixel(..) resulting in an initial black window (zero). com.jogamp.opengl.test.junit.newt.TestWindows02NEWT shows the content w/ opaque background and transparent one. Note: To be able to receive a transparent background, one needs to utilize a compositor WM (e.g. KWin w/ effects enabled). Due to commit cf9e2f2cb8ead7efd7751dcbfaecb36ed06cf9d6 (Bug 1210) this works in pure NEWT mode w/o utilizing GLX. --- src/newt/native/X11Window.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/newt/native/X11Window.c') diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 5e0a32125..c798af8e9 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -858,25 +858,23 @@ JNIEXPORT jlongArray JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CreateWind pVisualQuery=NULL; } - attrMask = ( CWBackingStore | CWBackingPlanes | CWBackingPixel | CWBackPixmap | - CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask ) ; + attrMask = ( CWBackingStore | CWBackingPlanes | CWBackingPixel | + CWBackPixmap | CWBackPixel | CWBorderPixel | CWColormap | + CWOverrideRedirect | CWEventMask ) ; memset(&xswa, 0, sizeof(xswa)); - xswa.override_redirect = False; // use the window manager, always (default) - xswa.border_pixel = 0; - xswa.background_pixmap = None; xswa.backing_store=NotUseful; /* NotUseful, WhenMapped, Always */ xswa.backing_planes=0; /* planes to be preserved if possible */ xswa.backing_pixel=0; /* value to use in restoring planes */ + xswa.background_pixmap = None; + xswa.background_pixel = BlackPixel(dpy, scrn_idx); + xswa.border_pixel = 0; + xswa.colormap = XCreateColormap(dpy, windowParent, visual, AllocNone); + xswa.override_redirect = False; // use the window manager, always (default) xswa.event_mask = X11_MOUSE_EVENT_MASK; xswa.event_mask |= KeyPressMask | KeyReleaseMask ; xswa.event_mask |= FocusChangeMask | SubstructureNotifyMask | StructureNotifyMask | ExposureMask ; - xswa.colormap = XCreateColormap(dpy, - windowParent, - visual, - AllocNone); - { int _x = x, _y = y; // pos for CreateWindow, might be tweaked if( TST_FLAG_IS_AUTOPOSITION(flags) ) { @@ -900,6 +898,7 @@ JNIEXPORT jlongArray JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CreateWind NewtCommon_throwNewRuntimeException(env, "could not create Window, bail out!"); return 0; } + // XClearWindow(dpy, window); XSetWMProtocols(dpy, window, &wm_delete_atom, 1); // windowDeleteAtom javaWindow = createJavaWindowProperty(env, dpy, root, window, javaObjectAtom, windowDeleteAtom, obj, verbose); -- cgit v1.2.3