Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-03-2008, 07:16 AM   #1
LQ Newbie
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
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.
Old 07-05-2008, 07:39 AM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint
Posts: 9,724

Rep: Reputation: 434Reputation: 434Reputation: 434Reputation: 434Reputation: 434
XReparentWindow is what you are looking for.
Old 07-06-2008, 01:04 AM   #3
LQ Newbie
Registered: Jun 2008
Posts: 4

Original Poster
Rep: Reputation: 0
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.
Old 07-07-2008, 07:11 AM   #4
LQ Newbie
Registered: Jun 2008
Posts: 4

Original Poster
Rep: Reputation: 0
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);


// event loop




merge, xlib

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a top level makefile rushadrenaline Mandriva 3 12-10-2007 11:16 PM
Running my own top level domain with BIND9 KneeLess Linux - Networking 4 03-26-2006 07:29 PM
Top Level Domain Names wwnexc Linux - Networking 3 03-12-2006 03:03 PM
Extract single frame snt Linux - Software 2 02-24-2006 03:07 PM
cdrom: dropping to single frame dma ithawtewrong SUSE / openSUSE 0 03-04-2005 01:31 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration