ephyr: Add -resizeable option
With this option passed, ephyr windows can be resized like normal windows on the fly, without the need of an explicit parent window. Signed-off-by: Daniel Martin <daniel.martin@secunet.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
		
							parent
							
								
									f9198e278b
								
							
						
					
					
						commit
						3aac7a59dc
					
				| 
						 | 
				
			
			@ -56,6 +56,7 @@ typedef struct _EphyrInputPrivate {
 | 
			
		|||
} EphyrKbdPrivate, EphyrPointerPrivate;
 | 
			
		||||
 | 
			
		||||
Bool EphyrWantGrayScale = 0;
 | 
			
		||||
Bool EphyrWantResize = 0;
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,7 @@
 | 
			
		|||
 | 
			
		||||
extern Window EphyrPreExistingHostWin;
 | 
			
		||||
extern Bool EphyrWantGrayScale;
 | 
			
		||||
extern Bool EphyrWantResize;
 | 
			
		||||
extern Bool kdHasPointer;
 | 
			
		||||
extern Bool kdHasKbd;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -116,6 +117,7 @@ ddxUseMsg(void)
 | 
			
		|||
    ErrorF("-host-cursor         Re-use exisiting X host server cursor\n");
 | 
			
		||||
    ErrorF("-fullscreen          Attempt to run Xephyr fullscreen\n");
 | 
			
		||||
    ErrorF("-grayscale           Simulate 8bit grayscale\n");
 | 
			
		||||
    ErrorF("-resizeable          Make Xephyr windows resizeable\n");
 | 
			
		||||
    ErrorF
 | 
			
		||||
        ("-fakexa              Simulate acceleration using software rendering\n");
 | 
			
		||||
    ErrorF("-verbosity <level>   Set log verbosity level\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -210,6 +212,10 @@ ddxProcessArgument(int argc, char **argv, int i)
 | 
			
		|||
        EphyrWantGrayScale = 1;
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
    else if (!strcmp(argv[i], "-resizeable")) {
 | 
			
		||||
        EphyrWantResize = 1;
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
    else if (!strcmp(argv[i], "-fakexa")) {
 | 
			
		||||
        ephyrFuncs.initAccel = ephyrDrawInit;
 | 
			
		||||
        ephyrFuncs.enableAccel = ephyrDrawEnable;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -117,6 +117,8 @@ extern EphyrKeySyms ephyrKeySyms;
 | 
			
		|||
 | 
			
		||||
extern int monitorResolution;
 | 
			
		||||
 | 
			
		||||
extern Bool EphyrWantResize;
 | 
			
		||||
 | 
			
		||||
char *ephyrResName = NULL;
 | 
			
		||||
int ephyrResNameFromCmd = 0;
 | 
			
		||||
char *ephyrTitle = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -697,7 +699,7 @@ hostx_screen_init(EphyrScreenInfo screen,
 | 
			
		|||
    XResizeWindow(HostX.dpy, host_screen->win, width, height);
 | 
			
		||||
 | 
			
		||||
    /* Ask the WM to keep our size static */
 | 
			
		||||
    if (host_screen->win_pre_existing == None) {
 | 
			
		||||
    if (host_screen->win_pre_existing == None && !EphyrWantResize) {
 | 
			
		||||
        size_hints = XAllocSizeHints();
 | 
			
		||||
        size_hints->max_width = size_hints->min_width = width;
 | 
			
		||||
        size_hints->max_height = size_hints->min_height = height;
 | 
			
		||||
| 
						 | 
				
			
			@ -1012,19 +1014,27 @@ hostx_get_event(EphyrHostXEvent * ev)
 | 
			
		|||
 | 
			
		||||
        case ConfigureNotify:
 | 
			
		||||
        {
 | 
			
		||||
            struct EphyrHostScreen *host_screen =
 | 
			
		||||
                host_screen_from_window(xev.xconfigure.window);
 | 
			
		||||
            struct EphyrHostScreen *host_screen;
 | 
			
		||||
 | 
			
		||||
            if (host_screen && host_screen->win_pre_existing != None) {
 | 
			
		||||
                ev->type = EPHYR_EV_CONFIGURE;
 | 
			
		||||
                ev->data.configure.width = xev.xconfigure.width;
 | 
			
		||||
                ev->data.configure.height = xev.xconfigure.height;
 | 
			
		||||
                ev->data.configure.window = xev.xconfigure.window;
 | 
			
		||||
                ev->data.configure.screen = host_screen->mynum;
 | 
			
		||||
                return 1;
 | 
			
		||||
            /* event compression as for Expose events, cause
 | 
			
		||||
             * we don't want to resize the framebuffer for
 | 
			
		||||
             * every single change */
 | 
			
		||||
            while (XCheckTypedWindowEvent(HostX.dpy, xev.xconfigure.window,
 | 
			
		||||
                                          ConfigureNotify, &xev));
 | 
			
		||||
            host_screen = host_screen_from_window(xev.xconfigure.window);
 | 
			
		||||
 | 
			
		||||
            if (!host_screen ||
 | 
			
		||||
                (host_screen->win_pre_existing == None && !EphyrWantResize)) {
 | 
			
		||||
                return 0;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return 0;
 | 
			
		||||
            ev->type = EPHYR_EV_CONFIGURE;
 | 
			
		||||
            ev->data.configure.width = xev.xconfigure.width;
 | 
			
		||||
            ev->data.configure.height = xev.xconfigure.height;
 | 
			
		||||
            ev->data.configure.window = xev.xconfigure.window;
 | 
			
		||||
            ev->data.configure.screen = host_screen->mynum;
 | 
			
		||||
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
        default:
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue