コード例 #1
0
ファイル: XImlib2Caption.cpp プロジェクト: mutek/Idesk
void XImlib2Caption::createWindow()
{
    XDesktopContainer * xContainer =
        dynamic_cast<XDesktopContainer *>(AbstractImage::container);

    DesktopConfig * dConfig =
		    dynamic_cast<DesktopConfig *>(XImlib2Image::config);

    XSetWindowAttributes attr;
    attr.override_redirect = True;
    attr.cursor = XCreateFontCursor(xContainer->getDisplay(), dConfig->getCursorOver());
    
    attr.event_mask = SubstructureRedirectMask |
                      SubstructureNotifyMask   |
                      ButtonPressMask          |
                      ButtonReleaseMask        |
                      PointerMotionMask        |
                      PropertyChangeMask       |
                      ExposureMask;

    XftTextExtentsUtf8( xContainer->getDisplay(), font, (XftChar8*)text.c_str(), text.length(), &fontInfo );

    // fix window extents so shadow text is not cut
    // TODO: fix window extents if shadow is negative:
    // Would have to edit x and y of the window
    width = fontInfo.width + FONTSHIFT;
    height = font->height;

    if (shadowOn)
    {
        width += shadowX > 0 ? shadowX : 0;
        height += shadowY > 0 ? shadowY : 0;
    }
    window = XCreateWindow( xContainer->getDisplay(),
                            xContainer->getRootWindow(),
                            0,
                            0,
                            width,
                            height,
                            0,
                            CopyFromParent,
                            CopyFromParent,
                            CopyFromParent,
			    CWOverrideRedirect|CWEventMask|CWCursor,
                            &attr );
}
コード例 #2
0
ファイル: XImlib2Image.cpp プロジェクト: fixxxer/idesk
void XImlib2Image::createWindow()
{	
    createPicture();

    DesktopConfig * dConfig =
		    dynamic_cast<DesktopConfig *>(config);
    

    XSetWindowAttributes attr;
    attr.background_pixmap = ParentRelative;
    attr.backing_store = Always;
    attr.override_redirect = True;
    attr.save_under = True;
    attr.cursor = XCreateFontCursor(display, dConfig->getCursorOver());
  
    attr.event_mask = SubstructureRedirectMask |
                      SubstructureNotifyMask   |
                      ButtonPressMask          |
                      ButtonReleaseMask        |
                      PointerMotionMask        |
                      EnterWindowMask          |
                      PropertyChangeMask       |
                      LeaveWindowMask           |
                      ExposureMask;
    
    window = XCreateWindow( display,
                            rootWindow,
                            0,
                            0,
                            width,
                            height,
                            0,
                            depth,
                            CopyFromParent,
                            CopyFromParent,
			    CWSaveUnder|CWBackPixmap|CWBackingStore|CWOverrideRedirect|CWEventMask| CWCursor,
                            &attr );  
    shapeWindow();
}