Re: [GnomeMeeting-devel-list] Win32 fullscreen
- From: Michael Rickmann <mrickma gwdg de>
- To: GnomeMeeting development mailing list <gnomemeeting-devel-list gnome org>
- Subject: Re: [GnomeMeeting-devel-list] Win32 fullscreen
- Date: Thu, 23 Mar 2006 13:44:24 +0100
Hello everybody,
I found out why returning from fullscreen in win32-Ekiga is/was still a
hazard: A Windows window is not only owned by the process but also by the
thread which has created it. A different thread can change the Show
properties of that window but cannot destroy it.
gm_main_window_update_video in src/gui/main.cpp is used by two threads, at a
different frequency though. When SDL_Init+SDL_SetVideoMode is executed by one
thread and SDL_Quit by the other, SDL shuts down, but Windows forbids to
destroy the SDL_app window. Why can I reliably remove that window by
disconnecting ? I have not found the reason yet in the code. I suspect that
both threads terminate and Windows in due corse destroys the window owned by
one them.
I have attached two patches which try to circumvent this circumstance without
changing the code too much. The first one is minimal, the second does the
same but uses the WinMain function in SDLmain.a. For me they fix the hung
SDL_app Window. But they do not address the problem which arises from the
SDL_app Window being destroyed at presumed thread termination. If the calling
state changes to stanby during fullscreen the window is destroyed, SDL_Quit
is called but during the following calls SDL cannot open the fullscreen
window again.
From a user's point of view this behaviour is tolerable, I think. When
programming, however, I still try to find sort of a housekeeping thread in
Ekiga which could do the SDL_Inits+SDL_SetVideoMode and SDL_Quits and let the
others do the drawing. I have not been long enough with Ekiga to be really
aquainted with its design. Any hints are welcome.
Regards
Michael Rickmann
diff -ur ekiga.orig/src/gui/main.cpp ekiga/src/gui/main.cpp
--- ekiga.orig/src/gui/main.cpp 2006-03-19 16:03:48.000000000 +0100
+++ ekiga/src/gui/main.cpp 2006-03-22 14:57:43.000000000 +0100
@@ -143,6 +143,9 @@
#ifdef HAS_SDL
SDL_Surface *screen;
+ #ifdef WIN32
+ DWORD sdls_threadid;
+ #endif
#endif
};
@@ -1634,7 +1637,11 @@
mw->screen = SDL_SetVideoMode (gdk_screen_get_width (defaultscreen), gdk_screen_get_height (defaultscreen), 0,
SDL_SWSURFACE | SDL_HWSURFACE |
SDL_ANYFORMAT);
+#ifndef WIN32
SDL_WM_ToggleFullScreen (mw->screen);
+#else
+ mw->sdls_threadid = GetCurrentThreadId();
+#endif
SDL_ShowCursor (SDL_DISABLE);
}
}
@@ -1684,7 +1691,14 @@
g_return_if_fail (mw != NULL);
+#ifndef WIN32
SDL_Quit ();
+#else
+ if (mw->sdls_threadid == GetCurrentThreadId()) {
+ SDL_Quit ();
+ mw->sdls_threadid = 0;
+ }
+#endif
mw->screen = NULL;
}
Nur in ekiga/src/gui: main.cpp~.
diff -ur ekiga.orig/src/gui/main.cpp ekiga/src/gui/main.cpp
--- ekiga.orig/src/gui/main.cpp 2006-03-19 16:03:48.000000000 +0100
+++ ekiga/src/gui/main.cpp 2006-03-23 09:35:06.000000000 +0100
@@ -143,6 +143,9 @@
#ifdef HAS_SDL
SDL_Surface *screen;
+ #ifdef WIN32
+ DWORD sdls_threadid;
+ #endif
#endif
};
@@ -1630,11 +1633,21 @@
defaultscreen = gdk_screen_get_default ();
+#ifndef WIN32
SDL_Init (SDL_INIT_VIDEO);
+#else
+ SDL_InitSubSystem (SDL_INIT_VIDEO);
+ mw->sdls_threadid = GetCurrentThreadId();
+#endif
mw->screen = SDL_SetVideoMode (gdk_screen_get_width (defaultscreen), gdk_screen_get_height (defaultscreen), 0,
SDL_SWSURFACE | SDL_HWSURFACE |
+#if 0 // change to #ifdef WIN32
+ SDL_FULLSCREEN |
+#endif
SDL_ANYFORMAT);
+#ifndef WIN32
SDL_WM_ToggleFullScreen (mw->screen);
+#endif
SDL_ShowCursor (SDL_DISABLE);
}
}
@@ -1684,7 +1697,14 @@
g_return_if_fail (mw != NULL);
- SDL_Quit ();
+#ifndef WIN32
+ SDL_Quit();
+#else
+ if (mw->sdls_threadid == GetCurrentThreadId()) {
+ SDL_QuitSubSystem (SDL_INIT_VIDEO);
+ mw->sdls_threadid = 0;
+ }
+#endif
mw->screen = NULL;
}
@@ -4397,13 +4417,19 @@
/* The main () */
int
-main (int argc,
- char ** argv,
- char ** envp)
+#if defined(WIN32) && defined(HAS_SDL)
+main (int argc, char ** argv)
+#else
+main (int argc, char ** argv, char ** envp)
+#endif
{
GMManager *endpoint = NULL;
+#if defined(WIN32) && defined(HAS_SDL)
+ PProcess::PreInitialise (argc, argv, NULL);
+#else
PProcess::PreInitialise (argc, argv, envp);
+#endif
GtkWidget *main_window = NULL;
GtkWidget *druid_window = NULL;
@@ -4591,7 +4617,7 @@
}
-#ifdef WIN32
+#if defined(WIN32) && !defined(HAS_SDL)
int
APIENTRY WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]