* H. S. Teoh <[EMAIL PROTECTED]> [070630 20:06]:
> > Could you try the attached program, if it also causes the crash?
> > (Needs libx11-dev installed and compile with
> > gcc xfakewindow.c -o xfakewindow -lX11)
> [...]
> Did you forget the attachment?
Second attempt...
Hochachtungsvoll,
Bernhard R. Link
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
int main(int argc, char *argv[]) {
Display *display;
int screen;
Visual *visual;
Window w;
XSetWindowAttributes attributes = {
.background_pixel= 0,
.event_mask = KeyPressMask,
};
Status s;
char *names[] = { "Intel\302\256 Motherboards - Opera"};
XTextProperty text,tt;
XEvent event;
struct {
const char *name;
XICCEncodingStyle style;
char *list[2]; int nlist;
Atom atom;
} properties[] = {
{"WM_CLIENT_MACHINE", XStringStyle, {"crystal"}, 1},
{"WM_LOCALE_NAME", XStringStyle, {"en_US.UTF-8"},1},
{"WM_WINDOW_ROLE", XStringStyle, {"opera-mainwindow#1"},1},
{"OPERA_VERSION", XStringStyle, {"Opera 9.21"},1},
{"OPERA_USER", XStringStyle, {"1000"},1},
{"OPERA_PREFERENCE", XStringStyle, {"/home/hsteoh/.opera"},1},
{"_NET_WM_NAME", XUTF8StringStyle,
{"Intel\302\256 Motherboards - Opera"},
1}
};
XClassHint classhint = {"opera", "Opera"};
Atom _NET_WM_PID;
long pid = getpid();
int i;
display = XOpenDisplay(getenv("DISPLAY"));
if( display == NULL )
return 1;
screen = DefaultScreen(display);
visual = DefaultVisual(display,screen);
for( i = 0 ; i < sizeof(properties)/sizeof(properties[0]) ; i++ ) {
properties[i].atom = XInternAtom(display, properties[i].name, False);
}
_NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);
w = XCreateWindow(display, RootWindow(display,screen), 0, 0, 100, 100, 1,
DefaultDepth(display,screen), InputOutput,
visual, CWBackPixel|CWEventMask, &attributes);
s = Xutf8TextListToTextProperty(display, names, 1, XStringStyle, &text);
XSetClassHint(display, w, &classhint);
XSetWMName(display, w, &text);
for( i = 0 ; i < sizeof(properties)/sizeof(properties[0]) ; i++ ) {
properties[i].atom = XInternAtom(display, properties[i].name, False);
s = Xutf8TextListToTextProperty(display,
properties[i].list,
properties[i].nlist,
properties[i].style, &tt);
assert( s == 0 );
XSetTextProperty(display, w, &tt, properties[i].atom);
}
XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32,
PropModeReplace, (unsigned char*)&pid, 1);
XMapWindow(display, w);
XSync(display, False);
for( i = 0 ; i < 1000 ; i++ ) {
XSetWMName(display, w, &text);
XSync(display, False);
}
while( XNextEvent(display,&event) ) {
if( event.type == KeyPress )
break;
}
XUnmapWindow(display, w);
XDestroyWindow(display, w);
XSync(display, False);
return 0;
}