From: LaƩrcio de Sousa Subject: Xephyr: enhance -screen option with window placement feature (WxH+X+Y) diff -up xorg-server-1.14.2/hw/kdrive/ephyr/ephyrinit.c.orig xorg-server-1.14.2/hw/kdrive/ephyr/ephyrinit.c --- xorg-server-1.14.2/hw/kdrive/ephyr/ephyrinit.c.orig 2013-08-21 14:24:22.736426522 -0300 +++ xorg-server-1.14.2/hw/kdrive/ephyr/ephyrinit.c 2013-08-21 14:24:54.779266128 -0300 @@ -142,6 +142,7 @@ processScreenArg(char *screen_size, char if (card) { KdScreenInfo *screen; unsigned long p_id = 0; + int x = 0, y = 0; screen = KdScreenInfoAdd(card); KdParseScreen(screen, screen_size); @@ -150,7 +151,8 @@ processScreenArg(char *screen_size, char p_id = strtol(parent_id, NULL, 0); } EPHYR_DBG("screen number:%d\n", screen->mynum); - hostx_add_screen(screen, p_id, screen->mynum); + hostx_use_geometry(screen_size, &x, &y); + hostx_add_screen(screen, x, y, p_id, screen->mynum); } else { ErrorF("No matching card found!\n"); diff -up xorg-server-1.14.2/hw/kdrive/ephyr/hostx.c.orig xorg-server-1.14.2/hw/kdrive/ephyr/hostx.c --- xorg-server-1.14.2/hw/kdrive/ephyr/hostx.c.orig 2013-08-21 14:24:22.737426454 -0300 +++ xorg-server-1.14.2/hw/kdrive/ephyr/hostx.c 2013-08-21 14:24:54.779266128 -0300 @@ -79,6 +79,7 @@ struct EphyrHostScreen { Window peer_win; /* Used for GL; should be at most one */ XImage *ximg; int win_width, win_height; + int win_x, win_y; int server_depth; unsigned char *fb_data; /* only used when host bpp != server bpp */ XShmSegmentInfo shminfo; @@ -182,7 +183,7 @@ hostx_want_screen_size(EphyrScreenInfo s } void -hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num) +hostx_add_screen(EphyrScreenInfo screen, int x, int y, unsigned long win_id, int screen_num) { int index = HostX.n_screens; @@ -192,6 +193,8 @@ hostx_add_screen(EphyrScreenInfo screen, memset(&HostX.screens[index], 0, sizeof(struct EphyrHostScreen)); HostX.screens[index].info = screen; + HostX.screens[index].win_x = x; + HostX.screens[index].win_y = y; HostX.screens[index].win_pre_existing = win_id; } @@ -262,6 +265,13 @@ hostx_want_preexisting_window(EphyrScree } void +hostx_use_geometry(char *geometry, int *x, int *y) +{ + unsigned int w, h; + XParseGeometry(geometry, x, y, &w, &h); +} + +void hostx_use_fullscreen(void) { HostX.use_fullscreen = True; @@ -698,7 +708,9 @@ hostx_screen_init(EphyrScreenInfo screen *bytes_per_line = host_screen->ximg->bytes_per_line; *bits_per_pixel = host_screen->ximg->bits_per_pixel; - XResizeWindow(HostX.dpy, host_screen->win, width, height); + XMoveResizeWindow(HostX.dpy, host_screen->win, + host_screen->win_x, host_screen->win_y, + width, height); /* Ask the WM to keep our size static */ if (host_screen->win_pre_existing == None) { diff -up xorg-server-1.14.2/hw/kdrive/ephyr/hostx.h.orig xorg-server-1.14.2/hw/kdrive/ephyr/hostx.h --- xorg-server-1.14.2/hw/kdrive/ephyr/hostx.h.orig 2013-08-21 14:24:22.737426454 -0300 +++ xorg-server-1.14.2/hw/kdrive/ephyr/hostx.h 2013-08-21 14:24:54.780266061 -0300 @@ -138,6 +138,9 @@ void hostx_use_host_cursor(void); void + hostx_use_geometry(char *geometry, int *x, int *y); + +void hostx_use_fullscreen(void); int @@ -162,7 +165,7 @@ int hostx_init(void); void - hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num); + hostx_add_screen(EphyrScreenInfo screen, int x, int y, unsigned long win_id, int screen_num); void hostx_set_display_name(char *name);