LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Merging top-level windows into a single frame using Xlib (https://www.linuxquestions.org/questions/programming-9/merging-top-level-windows-into-a-single-frame-using-xlib-653313/)

aravind137 07-03-2008 06:16 AM

Merging top-level windows into a single frame using Xlib
 
I have an X Windows application which has 2 top-level windows - one large and the other small SDL window.I need to make this smaller window fixed at a particular position relative to the large window and the smaller window should not behave like a window anymore. It must be a single unit after this merging. It is like how a window manager adds a frame around an application window.

The small window is an SDL video window and as such cannot be created as the child of the other (using XCreateSimpleWindow etc).
How is this done using Xlib? Can you please show a code snippet.

jlliagre 07-05-2008 06:39 AM

XReparentWindow is what you are looking for.

aravind137 07-06-2008 12:04 AM

Thank you, I will try that and get back.
Should I also set override_redirect to make the WM ignore the video window?

Thanks again.

aravind137 07-07-2008 06:11 AM

I used XReparentWindow() to embed the video window inside the other top-level window. Though the video plays at the position expected, a shadow window still appears at the top left corner of the root window and the taskbar button for this window is seen on the taskbar(root window).

Why do the shadow and taskbar button appear on the root window? How to remove the shadow? As you may guess, I am new to X-programming.
Please help.

I am showing below the main flow of the code used.



extern Window g_wnd; // top-level Rdesktop window

extern int g_width; // Rdesktop window width

extern int g_height; // Rdesktop window height
{
SDL_Surface *screen;
SMPEG *mpeg;
Window sdlwin;

g_display = XOpenDisplay(NULL);
// Initialize SDL
...


// Create the MPEG stream
if((fd = tcp_open(client_addr, client_port)) != 0)
mpeg = SMPEG_new_descr(fd, &info, use_audio);

screen = SDL_SetVideoMode(width, height, video_bpp, video_flags);

sdlwin = GetSDLWindow();

// Embed the video window inside TS window

XReparentWindow(g_display, sdlwin, g_wnd,

(g_width - width) / 2,

(g_height - height) / 2);

SMPEG_setdisplay(mpeg, screen, NULL, update);

SMPEG_scaleXY(mpeg, screen->w, screen->h);

SMPEG_play(mpeg);


// event loop

...



}


All times are GMT -5. The time now is 02:54 PM.