kdrive: add support to +X+Y syntax in -screen option parsing
This patch enhances current -screen option parsing for kdrive-based applications. It can parse strings like <WIDTH>x<HEIGHT>+<XOFFSET>+<YOFFSET>, storing X and Y offsets in KdScreenInfo instances. For negative values, this patch supports +-X+-Y (not -X-Y) syntax. It will allow e.g. proper Xephyr window placement for multiseat purposes. Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
		
							parent
							
								
									fe5018e056
								
							
						
					
					
						commit
						376f4de8ae
					
				|  | @ -300,6 +300,8 @@ KdParseScreen(KdScreenInfo * screen, const char *arg) | ||||||
|     screen->softCursor = kdSoftCursor; |     screen->softCursor = kdSoftCursor; | ||||||
|     screen->origin = kdOrigin; |     screen->origin = kdOrigin; | ||||||
|     screen->randr = RR_Rotate_0; |     screen->randr = RR_Rotate_0; | ||||||
|  |     screen->x = 0; | ||||||
|  |     screen->y = 0; | ||||||
|     screen->width = 0; |     screen->width = 0; | ||||||
|     screen->height = 0; |     screen->height = 0; | ||||||
|     screen->width_mm = 0; |     screen->width_mm = 0; | ||||||
|  | @ -313,7 +315,7 @@ KdParseScreen(KdScreenInfo * screen, const char *arg) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     for (i = 0; i < 2; i++) { |     for (i = 0; i < 2; i++) { | ||||||
|         arg = KdParseFindNext(arg, "x/@XY", save, &delim); |         arg = KdParseFindNext(arg, "x/+@XY", save, &delim); | ||||||
|         if (!save[0]) |         if (!save[0]) | ||||||
|             return; |             return; | ||||||
| 
 | 
 | ||||||
|  | @ -321,7 +323,7 @@ KdParseScreen(KdScreenInfo * screen, const char *arg) | ||||||
|         mm = 0; |         mm = 0; | ||||||
| 
 | 
 | ||||||
|         if (delim == '/') { |         if (delim == '/') { | ||||||
|             arg = KdParseFindNext(arg, "x@XY", save, &delim); |             arg = KdParseFindNext(arg, "x+@XY", save, &delim); | ||||||
|             if (!save[0]) |             if (!save[0]) | ||||||
|                 return; |                 return; | ||||||
|             mm = atoi(save); |             mm = atoi(save); | ||||||
|  | @ -335,7 +337,8 @@ KdParseScreen(KdScreenInfo * screen, const char *arg) | ||||||
|             screen->height = pixels; |             screen->height = pixels; | ||||||
|             screen->height_mm = mm; |             screen->height_mm = mm; | ||||||
|         } |         } | ||||||
|         if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y' && |         if (delim != 'x' && delim != '+' && delim != '@' && | ||||||
|  |             delim != 'X' && delim != 'Y' && | ||||||
|             (delim != '\0' || i == 0)) |             (delim != '\0' || i == 0)) | ||||||
|             return; |             return; | ||||||
|     } |     } | ||||||
|  | @ -346,6 +349,18 @@ KdParseScreen(KdScreenInfo * screen, const char *arg) | ||||||
|     kdSoftCursor = FALSE; |     kdSoftCursor = FALSE; | ||||||
|     kdSubpixelOrder = SubPixelUnknown; |     kdSubpixelOrder = SubPixelUnknown; | ||||||
| 
 | 
 | ||||||
|  |     if (delim == '+') { | ||||||
|  |         arg = KdParseFindNext(arg, "+@xXY", save, &delim); | ||||||
|  |         if (save[0]) | ||||||
|  |             screen->x = atoi(save); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if (delim == '+') { | ||||||
|  |         arg = KdParseFindNext(arg, "@xXY", save, &delim); | ||||||
|  |         if (save[0]) | ||||||
|  |             screen->y = atoi(save); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     if (delim == '@') { |     if (delim == '@') { | ||||||
|         arg = KdParseFindNext(arg, "xXY", save, &delim); |         arg = KdParseFindNext(arg, "xXY", save, &delim); | ||||||
|         if (save[0]) { |         if (save[0]) { | ||||||
|  | @ -425,7 +440,7 @@ KdUseMsg(void) | ||||||
| { | { | ||||||
|     ErrorF("\nTinyX Device Dependent Usage:\n"); |     ErrorF("\nTinyX Device Dependent Usage:\n"); | ||||||
|     ErrorF |     ErrorF | ||||||
|         ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]]  Specify screen characteristics\n"); |         ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][+[-]XOFFSET][+[-]YOFFSET][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]]  Specify screen characteristics\n"); | ||||||
|     ErrorF |     ErrorF | ||||||
|         ("-rgba rgb/bgr/vrgb/vbgr/none   Specify subpixel ordering for LCD panels\n"); |         ("-rgba rgb/bgr/vrgb/vbgr/none   Specify subpixel ordering for LCD panels\n"); | ||||||
|     ErrorF |     ErrorF | ||||||
|  |  | ||||||
|  | @ -89,6 +89,8 @@ typedef struct _KdScreenInfo { | ||||||
|     ScreenPtr pScreen; |     ScreenPtr pScreen; | ||||||
|     void *driver; |     void *driver; | ||||||
|     Rotation randr;             /* rotation and reflection */ |     Rotation randr;             /* rotation and reflection */ | ||||||
|  |     int x; | ||||||
|  |     int y; | ||||||
|     int width; |     int width; | ||||||
|     int height; |     int height; | ||||||
|     int rate; |     int rate; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue