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();
}
using namespace std;
#include <iostream>
#include <QtWidgets>
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
QApplication app(argc, 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();
}
To copy to clipboard, switch view to plain text mode
MainWindow
::MainWindow(QWidget *parent
){
setCentralWidget(ServerWin);
setMinimumSize(800,700);
setAutoFillBackground(true);
}
MainWindow::~MainWindow()
{
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QWidget *ServerWin = new QWidget;
setCentralWidget(ServerWin);
setMinimumSize(800,700);
setPalette(QPalette(QColor(0,255,0,255)));
setAutoFillBackground(true);
}
MainWindow::~MainWindow()
{
}
To copy to clipboard, switch view to plain text mode
Bookmarks