Moved g_error, g_warning, g_message and g_print from gutils.c to new file
Mon May 11 21:11:54 1998 Owen Taylor <otaylor@gtk.org> * gutils.c gmessages.c: Moved g_error, g_warning, g_message and g_print from gutils.c to new file gmessages.c, to avoid having to include <unistd.h> in gutils.c which was causing problems for the g_strsignal implementation on FreeBSD boxes. Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkwindow.c (gtk_real_window_move_resize): Use the previously unused window->need_resize flag to mark if a window's descendents changed size while the window was not visible. In this case, when the window becomes visible, we reallocate everything, since we didn't keep track of what actually changed. (Fixes bug where changing the popdown strings of a combo to something of the same length caused them to blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Mon May 11 21:04:51 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
|
||||
previously unused window->need_resize flag to mark if a window's
|
||||
descendents changed size while the window was not visible. In this
|
||||
case, when the window becomes visible, we reallocate everything,
|
||||
since we didn't keep track of what actually changed.
|
||||
|
||||
(Fixes bug where changing the popdown strings of a
|
||||
combo to something of the same length caused them to
|
||||
blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
|
||||
|
||||
Tue May 12 02:17:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
[security audit by Alan Cox]
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
Mon May 11 21:11:54 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gutils.c gmessages.c: Moved g_error, g_warning, g_message and
|
||||
g_print from gutils.c to new file gmessages.c, to avoid having to
|
||||
include <unistd.h> in gutils.c which was causing problems for the
|
||||
g_strsignal implementation on FreeBSD boxes.
|
||||
|
||||
Mon May 11 07:22:36 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib.h: provide G_GNUC_FUNCTION and G_GNUC_PRETTY_FUNCTION to
|
||||
|
||||
@@ -11,6 +11,7 @@ libglib_la_SOURCES = \
|
||||
ghash.c \
|
||||
glist.c \
|
||||
gmem.c \
|
||||
gmessages.c \
|
||||
gprimes.c \
|
||||
gslist.c \
|
||||
gtimer.c \
|
||||
|
||||
@@ -258,3 +258,4 @@ stack_trace_sigchld (int signum)
|
||||
{
|
||||
stack_trace_done = 1;
|
||||
}
|
||||
|
||||
|
||||
180
glib/gmessages.c
Normal file
180
glib/gmessages.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/* GLIB - Library of useful routines for C programming
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "glib.h"
|
||||
|
||||
static GErrorFunc glib_error_func = NULL;
|
||||
static GWarningFunc glib_warning_func = NULL;
|
||||
static GPrintFunc glib_message_func = NULL;
|
||||
static GPrintFunc glib_print_func = NULL;
|
||||
|
||||
extern char* g_vsprintf (const gchar *fmt, va_list *args, va_list *args2);
|
||||
|
||||
void
|
||||
g_error (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
static gboolean errored = 0;
|
||||
|
||||
if (errored++)
|
||||
{
|
||||
write (2, "g_error: recursed!\n", 19);
|
||||
return;
|
||||
}
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_error_func)
|
||||
{
|
||||
(* glib_error_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use write() here because we might be out of memory */
|
||||
write (2, "\n** ERROR **: ", 14);
|
||||
write (2, buf, strlen(buf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
||||
void
|
||||
g_warning (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_warning_func)
|
||||
{
|
||||
(* glib_warning_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("\n** WARNING **: ", stderr);
|
||||
fputs (buf, stderr);
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_message (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_message_func)
|
||||
{
|
||||
(* glib_message_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("message: ", stdout);
|
||||
fputs (buf, stdout);
|
||||
fputc ('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_print (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_print_func)
|
||||
{
|
||||
(* glib_print_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs (buf, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
GErrorFunc
|
||||
g_set_error_handler (GErrorFunc func)
|
||||
{
|
||||
GErrorFunc old_error_func;
|
||||
|
||||
old_error_func = glib_error_func;
|
||||
glib_error_func = func;
|
||||
|
||||
return old_error_func;
|
||||
}
|
||||
|
||||
GWarningFunc
|
||||
g_set_warning_handler (GWarningFunc func)
|
||||
{
|
||||
GWarningFunc old_warning_func;
|
||||
|
||||
old_warning_func = glib_warning_func;
|
||||
glib_warning_func = func;
|
||||
|
||||
return old_warning_func;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_message_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old_message_func;
|
||||
|
||||
old_message_func = glib_message_func;
|
||||
glib_message_func = func;
|
||||
|
||||
return old_message_func;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_print_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old_print_func;
|
||||
|
||||
old_print_func = glib_print_func;
|
||||
glib_print_func = func;
|
||||
|
||||
return old_print_func;
|
||||
}
|
||||
|
||||
156
glib/gutils.c
156
glib/gutils.c
@@ -22,17 +22,9 @@
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <ctype.h> /* For tolower() */
|
||||
#include <unistd.h>
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
static GErrorFunc glib_error_func = NULL;
|
||||
static GWarningFunc glib_warning_func = NULL;
|
||||
static GPrintFunc glib_message_func = NULL;
|
||||
static GPrintFunc glib_print_func = NULL;
|
||||
|
||||
extern char* g_vsprintf (const gchar *fmt, va_list *args, va_list *args2);
|
||||
|
||||
gchar*
|
||||
g_strdup (const gchar *str)
|
||||
{
|
||||
@@ -671,154 +663,6 @@ g_strsignal (gint signum)
|
||||
return msg;
|
||||
}
|
||||
|
||||
void
|
||||
g_error (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
static gboolean errored = 0;
|
||||
|
||||
if (errored++)
|
||||
{
|
||||
write (2, "g_error: recursed!\n", 19);
|
||||
return;
|
||||
}
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_error_func)
|
||||
{
|
||||
(* glib_error_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use write() here because we might be out of memory */
|
||||
write (2, "\n** ERROR **: ", 14);
|
||||
write (2, buf, strlen(buf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
||||
void
|
||||
g_warning (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_warning_func)
|
||||
{
|
||||
(* glib_warning_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("\n** WARNING **: ", stderr);
|
||||
fputs (buf, stderr);
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_message (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_message_func)
|
||||
{
|
||||
(* glib_message_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("message: ", stdout);
|
||||
fputs (buf, stdout);
|
||||
fputc ('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_print (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (glib_print_func)
|
||||
{
|
||||
(* glib_print_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs (buf, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
GErrorFunc
|
||||
g_set_error_handler (GErrorFunc func)
|
||||
{
|
||||
GErrorFunc old_error_func;
|
||||
|
||||
old_error_func = glib_error_func;
|
||||
glib_error_func = func;
|
||||
|
||||
return old_error_func;
|
||||
}
|
||||
|
||||
GWarningFunc
|
||||
g_set_warning_handler (GWarningFunc func)
|
||||
{
|
||||
GWarningFunc old_warning_func;
|
||||
|
||||
old_warning_func = glib_warning_func;
|
||||
glib_warning_func = func;
|
||||
|
||||
return old_warning_func;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_message_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old_message_func;
|
||||
|
||||
old_message_func = glib_message_func;
|
||||
glib_message_func = func;
|
||||
|
||||
return old_message_func;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_print_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old_print_func;
|
||||
|
||||
old_print_func = glib_print_func;
|
||||
glib_print_func = func;
|
||||
|
||||
return old_print_func;
|
||||
}
|
||||
|
||||
gint
|
||||
g_snprintf (gchar *str,
|
||||
gulong n,
|
||||
|
||||
@@ -1025,11 +1025,9 @@ gtk_window_need_resize (GtkContainer *container)
|
||||
return return_val;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (container))
|
||||
{
|
||||
window->need_resize = TRUE;
|
||||
return_val = gtk_window_move_resize (GTK_WIDGET (window));
|
||||
window->need_resize = FALSE;
|
||||
}
|
||||
return_val = gtk_window_move_resize (GTK_WIDGET (window));
|
||||
else
|
||||
window->need_resize = TRUE;
|
||||
|
||||
return return_val;
|
||||
}
|
||||
@@ -1042,13 +1040,17 @@ gtk_real_window_move_resize (GtkWindow *window,
|
||||
gint height)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
gboolean needed_resize;
|
||||
|
||||
g_return_val_if_fail (window != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
|
||||
g_return_val_if_fail ((x != NULL) || (y != NULL), FALSE);
|
||||
|
||||
|
||||
widget = GTK_WIDGET (window);
|
||||
|
||||
needed_resize = window->need_resize;
|
||||
window->need_resize = FALSE;
|
||||
|
||||
if ((widget->requisition.width == 0) ||
|
||||
(widget->requisition.height == 0))
|
||||
{
|
||||
@@ -1088,6 +1090,21 @@ gtk_real_window_move_resize (GtkWindow *window,
|
||||
widget->requisition.width,
|
||||
widget->requisition.height);
|
||||
}
|
||||
else if (needed_resize)
|
||||
{
|
||||
/* The windows contents changed size while it was not
|
||||
* visible, so reallocate everything, since we didn't
|
||||
* keep track of what changed
|
||||
*/
|
||||
GtkAllocation allocation;
|
||||
|
||||
allocation.x = 0;
|
||||
allocation.y = 0;
|
||||
allocation.width = widget->requisition.width;
|
||||
allocation.height = widget->requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (widget, &allocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The window hasn't changed size but one of its children
|
||||
@@ -1173,7 +1190,7 @@ gtk_real_window_move_resize (GtkWindow *window,
|
||||
}
|
||||
g_slist_free (resize_containers);
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user