 +		return(NULL);
 +	}
 +
-+	if ( this->hidden->fd ) {
-+		close( this->hidden->fd );
-+                this->hidden->fd = 0;
-+	}
-+
 +	if ( this->hidden->buffer ) {
 +		redox_funmap( this->hidden->buffer );
 +		this->hidden->buffer = NULL;
 +	}
 +
-+	char path[4096];
-+	snprintf(path, 4096, "orbital:a/-1/-1/%d/%d/SDL", width, height);
-+	this->hidden->fd = open(path, O_RDWR);
-+	if ( this->hidden->fd <= 0 ) {
-+		this->hidden->fd = 0;
-+		SDL_SetError("Couldn't create window for requested mode");
-+		return(NULL);
++	if ( this->hidden->fd > 0 ) {
++		/* If the window already exists send a resize message to the display server */
++		char msg[4096];
++		int msg_len = snprintf(msg, 4096, "S,%d,%d", width, height);
++		int res = write(this->hidden->fd, msg, msg_len);
++		if ( res != msg_len ) {
++			close(this->hidden->fd);
++			this->hidden->fd = 0;
++			SDL_SetError("Couldn't write resize event");
++			return(NULL);
++		}
++	} else {
++		/* Otherwise create a new window */
++		char path[4096];
++		snprintf(path, 4096, "orbital:a%s/-1/-1/%d/%d/SDL", (flags & SDL_RESIZABLE) ? "r" : "", width, height);
++		this->hidden->fd = open(path, O_RDWR);
++		if ( this->hidden->fd <= 0 ) {
++			this->hidden->fd = 0;
++			SDL_SetError("Couldn't create window for requested mode");
++			return(NULL);
++		}
++		printf("%s at %d\n", path, this->hidden->fd);
 +	}
-+	printf("%s at %d\n", path, this->hidden->fd);
 +
 +	this->hidden->buffer = redox_fmap(this->hidden->fd, 0, width * height * (bpp / 8));
 +	if ( ! this->hidden->buffer ) {
 +		close(this->hidden->fd);
-+                this->hidden->fd = 0;
++		this->hidden->fd = 0;
 +		SDL_SetError("Couldn't map window for requested mode");
 +		return(NULL);
 +	}
 +
-+ 	printf("Setting mode %dx%d@%d\n", width, height, bpp);
-+
-+	SDL_memset(this->hidden->buffer, 0, width * height * (bpp / 8));
++ 	fprintf(stderr, "Setting mode %dx%d@%d\n", width, height, bpp);
 +
 +	/* Allocate the new pixel format for the screen */
++
 +	if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) {
 +		redox_funmap(this->hidden->buffer);
 +		this->hidden->buffer = NULL;
 +		close(this->hidden->fd);
-+                this->hidden->fd = 0;
++		this->hidden->fd = 0;
 +		SDL_SetError("Couldn't allocate new pixel format for requested mode");
 +		return(NULL);
 +	}
 +
 +	/* Set up the new mode framebuffer */
-+	current->flags = flags & SDL_FULLSCREEN;
++	current->flags = flags /*& SDL_FULLSCREEN*/;
 +	this->hidden->w = current->w = width;
 +	this->hidden->h = current->h = height;
 +	current->pitch = current->w * (bpp / 8);

         CheckDiskAudio
         CheckDummyAudio
         CheckDLOPEN
diff -rupN source_original/include/SDL_config.h.in source/include/SDL_config.h.in
--- source_original/include/SDL_config.h.in	2012-01-19 07:30:05.000000000 +0100
+++ source/include/SDL_config.h.in	2018-02-21 09:33:43.110276438 +0100
@@ -268,6 +268,7 @@
 #undef SDL_VIDEO_DRIVER_GGI
 #undef SDL_VIDEO_DRIVER_IPOD

+                SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
+                SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
+            }
+        } else if ( event.code == EVENT_RESIZE ) {
+            SDL_PrivateResize(event.a, event.b);
+        } else if ( event.code == EVENT_QUIT ) {
+            SDL_PrivateQuit();
+        }
