LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-03-2008, 06:16 AM   #1
aravind137
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, 06:39 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
XReparentWindow is what you are looking for.
 
Old 07-06-2008, 12:04 AM   #3
aravind137
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, 06:11 AM   #4
aravind137
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);

SMPEG_play(mpeg);


// event loop

...



}
 
  


Reply

Tags
merge, xlib



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 10:16 PM
Running my own top level domain with BIND9 KneeLess Linux - Networking 4 03-26-2006 06:29 PM
Top Level Domain Names wwnexc Linux - Networking 3 03-12-2006 02:03 PM
Extract single frame snt Linux - Software 2 02-24-2006 02:07 PM
cdrom: dropping to single frame dma ithawtewrong SUSE / openSUSE 0 03-04-2005 12:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:24 AM.

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