X11: option to use RAIL with local borders
authorJay Sorg <jay.sorg@gmail.com>
Tue, 31 Jul 2012 20:51:43 +0000 (13:51 -0700)
committerJay Sorg <jay.sorg@gmail.com>
Tue, 31 Jul 2012 20:51:43 +0000 (13:51 -0700)
client/X11/xf_event.c
client/X11/xf_window.c

index f8ac783..6ed0d7e 100644 (file)
@@ -526,8 +526,19 @@ boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app)
                        (uint32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom,
                        xfw->width, xfw->height, event->xconfigure.send_event);
 
-               if (app && ! event->xconfigure.send_event)
-                       xf_rail_adjust_position(xfi, window);
+               if (app && xfw->decorations)
+               {
+                       xf_rail_adjust_position(xfi, window);
+                       window->windowOffsetX = xfw->left;
+                       window->windowOffsetY = xfw->top;
+                       window->windowWidth = xfw->right - xfw->left;
+                       window->windowHeight = xfw->bottom - xfw->top;
+               }
+               else
+               {
+                       if (app && ! event->xconfigure.send_event)
+                               xf_rail_adjust_position(xfi, window);
+               }
         }
 
         return True;
index ca56933..bf67bd1 100644 (file)
@@ -260,6 +260,19 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_st
 
 }
 
+int xf_MapWindow(Display* dis, Window wnd)
+{
+       XEvent xevent;
+
+       XMapWindow(dis, wnd);
+       do
+       {
+               XMaskEvent(dis, VisibilityChangeMask, &xevent);
+       }
+       while (xevent.type != VisibilityNotify);
+       return 0;
+}
+
 xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, boolean decorations)
 {
        xfWindow* window;
@@ -309,7 +322,7 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
                                PropModeReplace, (uint8*) xf_icon_prop, ARRAY_SIZE(xf_icon_prop));
 
                XSelectInput(xfi->display, window->handle, input_mask);
-               XMapWindow(xfi->display, window->handle);
+               xf_MapWindow(xfi->display, window->handle);
        }
 
        XStoreName(xfi->display, window->handle, name);
@@ -391,7 +404,12 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
        XClassHint* class_hints;
        int input_mask;
 
-       window->decorations = false;
+       /* this window need decorations */
+       if (wnd->extendedStyle & WS_EX_APPWINDOW)
+               window->decorations = true;
+       else
+               window->decorations = false;
+
        window->fullscreen = false;
        window->window = wnd;
        window->local_move.state = LMS_NOT_ACTIVE;
@@ -436,7 +454,7 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
                 ColormapChangeMask | OwnerGrabButtonMask;
 
        XSelectInput(xfi->display, window->handle, input_mask);
-       XMapWindow(xfi->display, window->handle);
+       xf_MapWindow(xfi->display, window->handle);
 
        memset(&gcv, 0, sizeof(gcv));
        window->gc = XCreateGC(xfi->display, window->handle, GCGraphicsExposures, &gcv);
@@ -659,7 +677,11 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n
        }
 
 #ifdef WITH_XEXT
-       XShapeCombineRectangles(xfi->display, window->handle, ShapeBounding, 0, 0, xrects, nrects, ShapeSet, 0);
+       if (window->decorations == false)
+       {
+               XShapeCombineRectangles(xfi->display, window->handle, ShapeBounding, 0, 0, xrects,
+                               nrects, ShapeSet, 0);
+       }
 #endif
 
        xfree(xrects);