This is a multi-part message in MIME format.
--------------95308EA3D5044CE908CD189B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
attached is a patch to make a window “frameless” (patch to SDL-1.1.7).
It works for Windows and (finally) Linux by setting a flag
SDL_NOWINTITLE (similar to the SDL_RESIZABLE flag). The demo testalpha.c
gets patched to demonstrate this through the ‘-notitle’ command line
setting.
Ciao
Andreas–
| Andreas Schiffler aschiffler at home.com |
| Senior Systems Engineer - Deskplayer Inc., Buffalo |
| 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada |
| +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |
--------------95308EA3D5044CE908CD189B
Content-Type: text/plain; charset=us-ascii;
name="SDL-1.1.7-nowintitle.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename=“SDL-1.1.7-nowintitle.patch”
diff -rbd -U 5 SDL-1.1.7/include/SDL_video.h SDL-1.1.7-patched/include/SDL_video.h
— SDL-1.1.7/include/SDL_video.h Thu Dec 14 13:40:09 2000
+++ SDL-1.1.7-patched/include/SDL_video.h Fri Feb 2 14:21:43 2001
@@ -133,10 +133,11 @@
#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode /
#define SDL_FULLSCREEN 0x80000000 / Surface is a full screen display /
#define SDL_OPENGL 0x00000002 / Create an OpenGL rendering context /
#define SDL_OPENGLBLIT 0x0000000A / Create an OpenGL rendering context and use it for blitting /
#define SDL_RESIZABLE 0x00000010 / This video mode may be resized /
+#define SDL_NOWINTITLE 0x00000020 / No title and frame for window /
/ Used internally (read-only) /
#define SDL_HWACCEL 0x00000100 / Blit uses hardware acceleration /
#define SDL_SRCCOLORKEY 0x00001000 / Blit uses a source color key /
#define SDL_RLEACCELOK 0x00002000 / Private flag /
#define SDL_RLEACCEL 0x00004000 / Colorkey blit is RLE accelerated */
diff -rbd -U 5 SDL-1.1.7/src/video/windib/SDL_dibevents.c SDL-1.1.7-patched/src/video/windib/SDL_dibevents.c
— SDL-1.1.7/src/video/windib/SDL_dibevents.c Sat Dec 9 21:16:21 2000
+++ SDL-1.1.7-patched/src/video/windib/SDL_dibevents.c Fri Feb 2 14:21:43 2001
@@ -300,16 +300,17 @@
return(keysym);
}
int DIB_CreateWindow(_THIS)
{
- DWORD style;
SDL_RegisterApp(“SDL_app”, CS_BYTEALIGNCLIENT, 0);
if ( SDL_windowid ) {
SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
} else {
-
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
-
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
-
style=GetWindowLong(SDL_Window, GWL_STYLE);
-
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, style, 0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL); if ( SDL_Window == NULL ) { SDL_SetError("Couldn't create window"); return(-1); }
diff -rbd -U 5 SDL-1.1.7/src/video/windib/SDL_dibvideo.c SDL-1.1.7-patched/src/video/windib/SDL_dibvideo.c
— SDL-1.1.7/src/video/windib/SDL_dibvideo.c Wed Dec 13 03:24:19 2000
+++ SDL-1.1.7-patched/src/video/windib/SDL_dibvideo.c Fri Feb 2 14:21:43 2001
@@ -492,11 +492,15 @@
style = (WS_POPUP|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_MAXIMIZE);
} else {
if ( (prev_flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
ChangeDisplaySettings(NULL, 0);
}
-
if ( (video->flags & SDL_NOWINTITLE) == SDL_NOWINTITLE ) {
-
style = WS_POPUP;
-
} else { style = (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX);
-
} if ( flags & SDL_RESIZABLE ) { style |= WS_THICKFRAME|WS_MAXIMIZEBOX; video->flags |= SDL_RESIZABLE; if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE; }
diff -rbd -U 5 SDL-1.1.7/src/video/windx5/SDL_dx5events.c SDL-1.1.7-patched/src/video/windx5/SDL_dx5events.c
— SDL-1.1.7/src/video/windx5/SDL_dx5events.c Sat Dec 9 21:16:21 2000
+++ SDL-1.1.7-patched/src/video/windx5/SDL_dx5events.c Fri Feb 2 14:21:43 2001
@@ -744,10 +744,11 @@
}
int DX5_CreateWindow(_THIS)
{
int i;
-
DWORD style;
/* Clear out DirectInput variables in case we fail /
for ( i=0; i<MAX_INPUTS; ++i ) {
SDL_DIdev[i] = NULL;
SDL_DIevt[i] = NULL;
@@ -757,12 +758,12 @@
/ Create the SDL window */
SDL_RegisterApp(“SDL_app”, CS_BYTEALIGNCLIENT, 0);
if ( SDL_windowid ) {
SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
} else {
-
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
-
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
-
style = GetWindowLong(SDL_Window, GWL_STYLE);
-
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, style, 0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL); if ( SDL_Window == NULL ) { SDL_SetError("Couldn't create window"); return(-1); }
diff -rbd -U 5 SDL-1.1.7/src/video/windx5/SDL_dx5video.c SDL-1.1.7-patched/src/video/windx5/SDL_dx5video.c
— SDL-1.1.7/src/video/windx5/SDL_dx5video.c Fri Jan 5 13:01:11 2001
+++ SDL-1.1.7-patched/src/video/windx5/SDL_dx5video.c Fri Feb 2 14:21:43 2001
@@ -998,12 +998,17 @@
style = GetWindowLong(SDL_Window, GWL_STYLE);
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
style &= ~windowstyle;
style |= directstyle;
} else {
-
if ( (flags & SDL_NOWINTITLE) == SDL_NOWINTITLE ) {
-
style &= ~windowstyle;
-
style |= directstyle;
-
} else { style &= ~directstyle; style |= windowstyle;
-
} if ( flags & SDL_RESIZABLE ) { style |= WS_THICKFRAME|WS_MAXIMIZEBOX; }
}
SetWindowLong(SDL_Window, GWL_STYLE, style);
diff -rbd -U 5 SDL-1.1.7/src/video/x11/SDL_x11video.c SDL-1.1.7-patched/src/video/x11/SDL_x11video.c
— SDL-1.1.7/src/video/x11/SDL_x11video.c Wed Dec 13 00:26:25 2000
+++ SDL-1.1.7-patched/src/video/x11/SDL_x11video.c Fri Feb 2 14:54:30 2001
@@ -337,10 +337,12 @@
}/* Allow the window to be deleted by the window manager */
WM_DELETE_WINDOW = XInternAtom(SDL_Display, “WM_DELETE_WINDOW”, False);
XSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1);
}
static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
char *display;
@@ -537,10 +539,33 @@
XSync(SDL_Display, True);
}
XSetWMNormalHints(SDL_Display, WMwindow, hints);
XFree(hints);
}
+
- /* Setup WM hints for frameless window */
- if (flags & SDL_NOWINTITLE) {
-
/* Set TransientFor hint - gets used by some WM */
-
{
-
Window parent;
-
parent=XRootWindow (SDL_Display, 0);
-
XSetTransientForHint (SDL_Display, WMwindow, parent);
-
}
-
/* Set Motif WM hints to get rid of border - gets honored by most modern WM */
-
{
-
static Atom mhints_atom = None;
-
MotifWmHints mhints;
-
mhints_atom = XInternAtom (SDL_Display, _XA_MOTIF_WM_HINTS, False);
-
mhints.flags = MWM_HINTS_DECORATIONS;
-
mhints.decorations = 0;
-
XChangeProperty (SDL_Display, WMwindow,
-
mhints_atom, mhints_atom, 32, PropModeReplace,
-
(unsigned char *)&mhints, sizeof (MotifWmHints)/sizeof (long));
-
}
-
}
}
static int X11_CreateWindow(_THIS, SDL_Surface *screen,
int w, int h, int bpp, Uint32 flags)
{
@@ -749,10 +774,12 @@
#endif
} else {
screen->flags &= ~SDL_FULLSCREEN;
}
}
+
+
return(0);
}
static int X11_ResizeWindow(_THIS,
SDL_Surface screen, int w, int h, Uint32 flags)
diff -rbd -U 5 SDL-1.1.7/src/video/x11/SDL_x11video.h SDL-1.1.7-patched/src/video/x11/SDL_x11video.h
— SDL-1.1.7/src/video/x11/SDL_x11video.h Tue Dec 12 21:06:35 2000
+++ SDL-1.1.7-patched/src/video/x11/SDL_x11video.h Fri Feb 2 14:34:47 2001
@@ -182,6 +182,18 @@
/ Some versions of XFree86 have bugs - detect if this is one of them */
#define BUGGY_XFREE86(condition, buggy_version)
((strcmp(ServerVendor(SDL_Display), “The XFree86 Project, Inc”) == 0) &&
(VendorRelease(SDL_Display) condition buggy_version))
+/* Definitions required for frameless window setup */
+
+typedef struct {
- unsigned long flags;
- unsigned long functions;
- unsigned long decorations;
- long input_mode;
- unsigned long status;
+} MotifWmHints;
+#define _XA_MOTIF_WM_HINTS “_MOTIF_WM_HINTS”
+#define MWM_HINTS_DECORATIONS (1L << 1)
#endif /* _SDL_x11video_h */
diff -rbd -U 5 SDL-1.1.7/test/testalpha.c SDL-1.1.7-patched/test/testalpha.c
— SDL-1.1.7/test/testalpha.c Sun Oct 22 23:45:11 2000
+++ SDL-1.1.7-patched/test/testalpha.c Fri Feb 2 14:21:43 2001
@@ -304,10 +304,13 @@
–argc;
if ( strcmp(argv[argc-1], “-bpp”) == 0 ) {
video_bpp = atoi(argv[argc]);
–argc;
} else
-
if ( strcmp(argv[argc], "-notitle") == 0 ) {
-
videoflags |= SDL_NOWINTITLE;
-
} else if ( strcmp(argv[argc], "-hw") == 0 ) { videoflags |= SDL_HWSURFACE; } else if ( strcmp(argv[argc], "-warp") == 0 ) { videoflags |= SDL_HWPALETTE;
--------------95308EA3D5044CE908CD189B–