What WM and tried another?
On Dienstag, 25. Dezember 2012 13:37:20 CEST, kaifeng.zhu wrote: > Hello, > > I'm not sure that is the correct mailing list to ask this question, but I > didn't find an answer anywhere on the web. > > I have a laptop running Ubuntu 11.04 connected to an external Dell monitor. > When I was calling XRRGetOutputPrimary, it returned me the primary monitor > is 0. My code snippet is simple: > static void test1() > { > Display *dpy = XOpenDisplay(NULL); > int screen_count = ScreenCount(dpy); > int screen = DefaultScreen(dpy); > Window root = RootWindow(dpy, screen); > RROutput primary = XRRGetOutputPrimary(dpy, root); > printf("Primary = %ld\n", primary); > } > > That seems not a big trouble so I just run command 'xrandr --output LVDS1 > --primary' to set the primary monitor. But after that when I'm trying to > create a window to maximize the window to both my monitors, it failed. The > window only occupy part of the external monitor, with the window size > equals to the size of the laptop owned monitor (my external monitor has > higher resolution than my laptop owned monitor). > static void test2() > { > Display *dpy = XOpenDisplay(NULL); > const Atom _NET_WM_FULLSCREEN_MONITORS = XInternAtom(dpy, > "_NET_WM_FULLSCREEN_MONITORS", False); > const Atom _NET_WM_STATE = XInternAtom(dpy, "_NET_WM_STATE", False); > const Atom _NET_WM_STATE_FULLSCREEN = XInternAtom(dpy, > "_NET_WM_STATE_FULLSCREEN", False); > > XSetWindowAttributes attrs; > attrs.event_mask = StructureNotifyMask | PropertyChangeMask; > Window wnd = XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0, 100, 100, > 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask | > CWBorderPixel, &attrs); > > XMapWindow(dpy, wnd); > > { > XClientMessageEvent ev; > memset(&ev, 0, sizeof(ev)); > > ev.type = ClientMessage; > ev.window = wnd; > ev.message_type = _NET_WM_STATE; > ev.format = 32; > ev.data.l[0] = 1; > ev.data.l[1] = _NET_WM_STATE_FULLSCREEN; > ev.data.l[2] = 0; > ev.data.l[3] = 1; > ev.data.l[4] = 0; > > XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureNotifyMask | > SubstructureRedirectMask, (XEvent*)&ev); > } > > { > XClientMessageEvent ev; > memset(&ev, 0, sizeof(ev)); > > int snumber = 0; > XineramaScreenInfo *sinfo = XineramaQueryScreens(dpy, &snumber); > int top = 0, bottom = 0, left = 0, right = 0; > for (int i=1; i<snumber; ++i) > { > if (sinfo[i].x_org < sinfo[left].x_org) > left = i; > if (sinfo[i].y_org < sinfo[top].y_org) > top = i; > if (sinfo[i].x_org + sinfo[i].width > sinfo[right].x_org + > sinfo[right].width) > right = i; > if (sinfo[i].y_org + sinfo[i].height > sinfo[bottom].y_org > + sinfo[bottom].height) > bottom = i; > } > printf("top = %d, bottom = %d, left = %d, right = %d\n", > top, bottom, left, right); > > ev.type = ClientMessage; > ev.window = wnd; > ev.message_type = _NET_WM_FULLSCREEN_MONITORS; > ev.format = 32; > ev.data.l[0] = top; > ev.data.l[1] = bottom; > ev.data.l[2] = left; > ev.data.l[3] = right; > ev.data.l[4] = 1; > > XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureNotifyMask | > SubstructureRedirectMask, (XEvent*)&ev); > } > > XSync(dpy, False); > sleep(10); > > { > int black = BlackPixel(dpy, DefaultScreen(dpy)); > int white = WhitePixel(dpy, DefaultScreen(dpy)); > GC gc = XCreateGC(dpy, wnd, 0, NULL); > XSetForeground(dpy, gc, white); > XFillRectangle(dpy, wnd, gc, 0, 0, 4000, 1200); > XFlush(dpy); > } > > sleep(10); > } > > > Are my steps wrong to create full screen window span to multiple monitors? > Any help or pointers will be greatly appreciated. > > Best Regards, > Kaifeng > > > > _______________________________________________ > xorg@lists.x.org: X.Org support > Archives: http://lists.freedesktop.org/archives/xorg > Info: http://lists.x.org/mailman/listinfo/xorg > Your subscription address: thomas.luebk...@gmx.net > > _______________________________________________ xorg@lists.x.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: http://lists.x.org/mailman/listinfo/xorg Your subscription address: arch...@mail-archive.com