From 1cf610e216072fdb49d170d898bd4b7178ea3d2b Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 5 Jun 2003 22:18:27 +0000 Subject: [PATCH] glib/giochannel.h Remove bogus (Win32-only) declaration of 2003-06-05 Tor Lillqvist * glib/giochannel.h * glib/gmain.h: Remove bogus (Win32-only) declaration of g_main_poll_win32_msg_add(). No such function exists. * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for better warning messages. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-12 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ glib/giochannel.h | 11 ++++------- glib/gmain.c | 32 ++++++++++++++++++++++++++------ glib/gmain.h | 13 +------------ 9 files changed, 85 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index d29f204..4e76b62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-06-05 Tor Lillqvist + + * glib/giochannel.h + * glib/gmain.h: Remove bogus (Win32-only) declaration of + g_main_poll_win32_msg_add(). No such function exists. + + * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for + better warning messages. + 2003-06-04 Noah Levitt * glib/gunidecomp.h (combine): Fix typo (#114375). Also, make the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d29f204..4e76b62 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2003-06-05 Tor Lillqvist + + * glib/giochannel.h + * glib/gmain.h: Remove bogus (Win32-only) declaration of + g_main_poll_win32_msg_add(). No such function exists. + + * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for + better warning messages. + 2003-06-04 Noah Levitt * glib/gunidecomp.h (combine): Fix typo (#114375). Also, make the diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index d29f204..4e76b62 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2003-06-05 Tor Lillqvist + + * glib/giochannel.h + * glib/gmain.h: Remove bogus (Win32-only) declaration of + g_main_poll_win32_msg_add(). No such function exists. + + * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for + better warning messages. + 2003-06-04 Noah Levitt * glib/gunidecomp.h (combine): Fix typo (#114375). Also, make the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d29f204..4e76b62 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2003-06-05 Tor Lillqvist + + * glib/giochannel.h + * glib/gmain.h: Remove bogus (Win32-only) declaration of + g_main_poll_win32_msg_add(). No such function exists. + + * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for + better warning messages. + 2003-06-04 Noah Levitt * glib/gunidecomp.h (combine): Fix typo (#114375). Also, make the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d29f204..4e76b62 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2003-06-05 Tor Lillqvist + + * glib/giochannel.h + * glib/gmain.h: Remove bogus (Win32-only) declaration of + g_main_poll_win32_msg_add(). No such function exists. + + * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for + better warning messages. + 2003-06-04 Noah Levitt * glib/gunidecomp.h (combine): Fix typo (#114375). Also, make the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d29f204..4e76b62 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2003-06-05 Tor Lillqvist + + * glib/giochannel.h + * glib/gmain.h: Remove bogus (Win32-only) declaration of + g_main_poll_win32_msg_add(). No such function exists. + + * glib/gmain.c (g_poll) [Win32]: Use g_win32_error_message() for + better warning messages. + 2003-06-04 Noah Levitt * glib/gunidecomp.h (combine): Fix typo (#114375). Also, make the diff --git a/glib/giochannel.h b/glib/giochannel.h index d8da251..c09b3b6 100644 --- a/glib/giochannel.h +++ b/glib/giochannel.h @@ -296,6 +296,10 @@ GLIB_VAR GSourceFuncs g_io_watch_funcs; #ifdef G_OS_WIN32 +/* You can use this "pseudo file descriptor" in a GPollFD to add + * polling for Windows messages. GTK applications should not do that. + */ + #define G_WIN32_MSG_HANDLE 19981206 /* Use this to get a GPollFD from a GIOChannel, so that you can call @@ -315,13 +319,6 @@ gint g_io_channel_win32_poll (GPollFD *fds, gint n_fds, gint timeout_); -/* This is used to add polling for Windows messages. GDK (GTk+) programs - * should *not* use this. - */ -void g_main_poll_win32_msg_add (gint priority, - GPollFD *fd, - guint hwnd); - /* Create an IO channel for Windows messages for window handle hwnd. */ GIOChannel *g_io_channel_win32_new_messages (guint hwnd); diff --git a/glib/gmain.c b/glib/gmain.c index f8e2c34..4a66ee0 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -307,7 +307,11 @@ g_poll (GPollFD *fds, g_print ("WaitMessage\n"); #endif if (!WaitMessage ()) - g_warning (G_STRLOC ": WaitMessage() failed"); + { + gchar *emsg = g_win32_error_message (GetLastError ()); + g_warning (G_STRLOC ": WaitMessage() failed: %s", emsg); + g_free (emsg); + } ready = WAIT_OBJECT_0 + nhandles; } else if (timeout == 0) @@ -326,7 +330,9 @@ g_poll (GPollFD *fds, timer = SetTimer (NULL, 0, timeout, NULL); if (timer == 0) { - g_warning (G_STRLOC ": SetTimer() failed"); + gchar *emsg = g_win32_error_message (GetLastError ()); + g_warning (G_STRLOC ": SetTimer() failed: %s", emsg); + g_free (emsg); ready = WAIT_TIMEOUT; } else @@ -359,7 +365,11 @@ g_poll (GPollFD *fds, timeout, QS_ALLINPUT); if (ready == WAIT_FAILED) - g_warning (G_STRLOC ": MsgWaitForMultipleObjects() failed"); + { + gchar *emsg = g_win32_error_message (GetLastError ()); + g_warning (G_STRLOC ": MsgWaitForMultipleObjects() failed: %s", emsg); + g_free (emsg); + } } } } @@ -378,7 +388,11 @@ g_poll (GPollFD *fds, #endif ready = WaitForMultipleObjects (nhandles, handles, FALSE, timeout); if (ready == WAIT_FAILED) - g_warning (G_STRLOC ": WaitForMultipleObjects() failed"); + { + gchar *emsg = g_win32_error_message (GetLastError ()); + g_warning (G_STRLOC ": WaitForMultipleObjects() failed: %s", emsg); + g_free (emsg); + } } #ifdef G_MAIN_POLL_DEBUG @@ -2595,8 +2609,14 @@ g_main_context_poll (GMainContext *context, UNLOCK_CONTEXT (context); if ((*poll_func) (fds, n_fds, timeout) < 0 && errno != EINTR) - g_warning ("poll(2) failed due to: %s.", - g_strerror (errno)); + { +#ifndef G_OS_WIN32 + g_warning ("poll(2) failed due to: %s.", + g_strerror (errno)); +#else + /* If g_poll () returns -1, it has already called g_warning() */ +#endif + } #ifdef G_MAIN_POLL_DEBUG LOCK_CONTEXT (context); diff --git a/glib/gmain.h b/glib/gmain.h index 72f3ba9..5a224bc 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -100,8 +100,7 @@ struct _GSourceFuncs * WSAEventSelect to signal events when a SOCKET is readable). * * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to - * indicate polling for messages. These message queue GPollFDs should - * be added with the g_main_poll_win32_msg_add function. + * indicate polling for messages. * * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK * (GTK) programs, as GDK itself wants to read messages and convert them @@ -300,16 +299,6 @@ gboolean g_idle_remove_by_data (gpointer data); GLIB_VAR GSourceFuncs g_timeout_funcs; GLIB_VAR GSourceFuncs g_idle_funcs; -#ifdef G_OS_WIN32 - -/* This is used to add polling for Windows messages. GDK (GTK+) programs - * should *not* use this. - */ -void g_main_poll_win32_msg_add (gint priority, - GPollFD *fd, - guint hwnd); -#endif /* G_OS_WIN32 */ - G_END_DECLS #endif /* __G_MAIN_H__ */ -- 2.7.4