Formating problem in XReparentWindow
I am using the following program to embed a client window in another window using Qt and X11 code.
I run the server program first and gets the window id of server using xwininfo(http://tronche.com/gui/x/xlib/window...entWindow.html).
upon getting the window id , i run the client program by passing window id as a command line arguments.
the problem is that the client window is embedding at the bottom , or at sides , or other but never from (0,0) geometry.
and having the background of parent .
how can i make the window to embed from 0,0 and should cover the size of its parent with auto size adjustable.
client code
Code:
using namespace std;
#include <iostream>
#include <QtWidgets>
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
unsigned long int WinId;
XSetWindowAttributes frame_attributes;
WinId = atoi(argv[1]);
cout<<"WinId :"<<WinId<<endl;
if(argc != 2){
cout<<"pass WinId as arguement"<<endl;
return 0;
}
Display *display = XOpenDisplay( 0 ); // 0 parameter for default values
frame_attributes.background_pixel = XWhitePixel(display, 0);
if ( display != NULL )
{
// Create the x11 window using XLib
Window w = XCreateWindow(display, DefaultRootWindow(display),
0, 0, 200, 300, 0,CopyFromParent, CopyFromParent, CopyFromParent, CWBackPixel, &frame_attributes);
XMapWindow(display, w);
XReparentWindow(display, w,WinId, 0, 0);
XFlush(display);
}
else
std::cout << "Error: Opening display" << std::endl ;
return app.exec();
}
server code:
Code:
MainWindow
::MainWindow(QWidget *parent
){
setCentralWidget(ServerWin);
setMinimumSize(800,700);
setAutoFillBackground(true);
}
MainWindow::~MainWindow()
{
}
Re: Formating problem in XReparentWindow
What if you pass the parent to XCreateWindow instead of reparenting?
Cheers,
_
Re: Formating problem in XReparentWindow
Quote:
Originally Posted by
anda_skoa
What if you pass the parent to XCreateWindow instead of reparenting?
Cheers,
_
Thats Good,
But i am not able to resize the client, does not the client resize when we maximize the parent?
one more thing is , if i have some layouts on my server window and each layout is having different image then the cilent is having all those layouts as background instead of having its own parents.
Re: Formating problem in XReparentWindow
Quote:
Originally Posted by
PstdEr
But i am not able to resize the client, does not the client resize when we maximize the parent?
I guess that since it is not a widget but just widget content, you'll have to resize it manually.
XResizeWindow in the resizeEvent() handler of the parent maybe.
Quote:
Originally Posted by
PstdEr
one more thing is , if i have some layouts on my server window and each layout is having different image then the cilent is having all those layouts as background instead of having its own parents.
No idea, sorry.
Cheers,
_