Removed, because that's what a NULL comparison function means. And it

Tue Apr  7 19:36:48 1998  Owen Taylor  <owt1@cornell.edu>

	* gutils.c (g_direct_compare): Removed, because that's what
	a NULL comparison function means. And it wasn't 64 bit safe.

Tue Apr  7 19:14:03 1998  Owen Taylor  <owt1@cornell.edu>

	* gdk/gdkpixmap.c: Added maximum field widths to prevent
	possible '%s' scanf overflows. Replaced scanf("%c")
	with getc(), Don't interpret /*/ as a full comment. Use
	g_realloc/g_new.

	* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
	tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
	instead of (GTK_WIDGET_FLAGS(widget) & FLAG)

	* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
	SunOS, because getcwd() hangs up in a wait4().
	(Found by David Monniaux <monniaux@clipper.ens.fr>)

	- Check device/inode/mtime not just inode/mtime, when
	caching scanned directories.
	(From: scottk@ig.utexas.edu (Scott Kempf))

	* gdk/gdkpixmap.c: Check for 0 width/height when
	creating pixmaps.

	* gtk/*.c: Global substitution of recently introduced
	"MAX (0," for allocations to "MAX (1,", since
	creating a backing pixmap with a zero width or height
	fails.

	* gdk/gdkwindow.c (gdk_window_new): Don't set all the
	WM properties for child windows. Don't set the base
	size, since the value we set will be taken as a minimum
	size.
This commit is contained in:
Owen Taylor 1998-04-07 23:59:25 +00:00 committed by Owen Taylor
parent 13de9dc34f
commit 1c77b5f926
38 changed files with 445 additions and 170 deletions

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

View File

@ -1,3 +1,35 @@
Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkpixmap.c: Added maximum field widths to prevent
possible '%s' scanf overflows. Replaced scanf("%c")
with getc(), Don't interpret /*/ as a full comment. Use
g_realloc/g_new.
* gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
* gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
SunOS, because getcwd() hangs up in a wait4().
(Found by David Monniaux <monniaux@clipper.ens.fr>)
- Check device/inode/mtime not just inode/mtime, when
caching scanned directories.
(From: scottk@ig.utexas.edu (Scott Kempf))
* gdk/gdkpixmap.c: Check for 0 width/height when
creating pixmaps.
* gtk/*.c: Global substitution of recently introduced
"MAX (0," for allocations to "MAX (1,", since
creating a backing pixmap with a zero width or height
fails.
* gdk/gdkwindow.c (gdk_window_new): Don't set all the
WM properties for child windows. Don't set the base
size, since the value we set will be taken as a minimum
size.
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org> Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for * gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for

19
TODO
View File

@ -99,6 +99,9 @@ TODO AFTER GTK 1.0
* Entry should have a password mode (and it should show stars * Entry should have a password mode (and it should show stars
for user feedback). for user feedback).
* Entry should allow set_usize to work better, and should compute
a different width when a maximum length is used.
* More dialogs: Print, GtkFontSelector, maybe others... * More dialogs: Print, GtkFontSelector, maybe others...
* Multiple document interface (MDI)? * Multiple document interface (MDI)?
@ -191,13 +194,13 @@ TODO AFTER GTK 1.0
aaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb aaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
as: as:
| Maximum column | Maximum column
aaaaaaaaaaa bbbbbbbbbbb| aaaaaaaaaaa bbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbb| bbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbb | bbbbbbbbb |
Instead of: Instead of:
| |
aaaaaaaaaaa | aaaaaaaaaaa |
bbbbbbbbbbbbbbbbbbbbbbb| bbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbb | bbbbbbbbbbbbbbbbbbbb |
@ -212,6 +215,8 @@ TODO AFTER GTK 1.0
- Really big font (150 pt), plus lots of editing caused segfault - Really big font (150 pt), plus lots of editing caused segfault
- "changed" emitted when doing deletes on empty Text widget.
? Allow moving the separator for paned widgets by dragging ? Allow moving the separator for paned widgets by dragging
it directly instead of using the handle. it directly instead of using the handle.
@ -257,3 +262,13 @@ TODO AFTER GTK 1.0
Fix: Only send GDK_EVENT_CONFIGURE when the window is resized, Fix: Only send GDK_EVENT_CONFIGURE when the window is resized,
create a new event type for toplevel motion. (GDK_EVENT_REPOSITION?) create a new event type for toplevel motion. (GDK_EVENT_REPOSITION?)
and eliminate the resize count in GtkWindow. and eliminate the resize count in GtkWindow.
* Generic ScrolledWindow interface, which provide automatic scrollbar
capability to Viewport, Text, and CList widgets.
GTK_POLICY_NEVER for scrolled windows.
* Consider caching more state in GdkWindowPrivate. Currently,
every widget realization involves a XGetGeometry and a
XGetWindowAttributes. And every GdkWindow destruction
involves a XQueryTree.

View File

@ -44,6 +44,7 @@ gdk_pixmap_new (GdkWindow *window,
GdkWindowPrivate *window_private; GdkWindowPrivate *window_private;
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL); g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
@ -87,6 +88,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
GdkWindowPrivate *window_private; GdkWindowPrivate *window_private;
g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
@ -135,6 +137,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
g_return_val_if_fail (fg != NULL, NULL); g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL); g_return_val_if_fail (bg != NULL, NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL); g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
@ -179,13 +182,13 @@ gdk_pixmap_seek_string (FILE *infile,
while (!feof (infile)) while (!feof (infile))
{ {
fscanf (infile, "%s", instr); fscanf (infile, "%1023s", instr);
if (skip_comments == TRUE && strcmp (instr, "/*") == 0) if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
{ {
fscanf (infile, "%s", instr); fscanf (infile, "%1023s", instr);
while (!feof (infile) && strcmp (instr, "*/") != 0) while (!feof (infile) && strcmp (instr, "*/") != 0)
fscanf (infile, "%s", instr); fscanf (infile, "%1023s", instr);
fscanf(infile, "%s", instr); fscanf(infile, "%1023s", instr);
} }
if (strcmp (instr, str)==0) if (strcmp (instr, str)==0)
return TRUE; return TRUE;
@ -198,29 +201,31 @@ gint
gdk_pixmap_seek_char (FILE *infile, gdk_pixmap_seek_char (FILE *infile,
gchar c) gchar c)
{ {
gchar b, oldb; gint b, oldb;
while (!feof (infile)) while ((b = getc(infile)) != EOF)
{ {
fscanf(infile, "%c", &b);
if (c != b && b == '/') if (c != b && b == '/')
{ {
fscanf (infile, "%c", &b); b = getc (infile);
if (b == '*') if (b == EOF)
{ return FALSE;
oldb = b; else if (b == '*') /* we have a comment */
while (!feof (infile) && !(oldb == '*' && b == '/')) {
{ b = -1;
oldb = b; do
fscanf (infile, "%c", &b); {
} oldb = b;
fscanf (infile, "%c", &b); b = getc (infile);
} if (b == EOF)
return FALSE;
}
while (!(oldb == '*' && b == '/'));
}
} }
if (c == b) else if (c == b)
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
@ -229,31 +234,28 @@ gdk_pixmap_read_string (FILE *infile,
gchar **buffer, gchar **buffer,
guint *buffer_size) guint *buffer_size)
{ {
gchar c; gint c;
guint cnt = 0; guint cnt = 0;
if ((*buffer) == NULL) if ((*buffer) == NULL)
{ {
(*buffer_size) = 10 * sizeof (gchar); (*buffer_size) = 10 * sizeof (gchar);
(*buffer) = (gchar *) malloc (*buffer_size); (*buffer) = g_new(gchar, *buffer_size);
} }
do do
fscanf (infile, "%c", &c); c = getc (infile);
while (!feof (infile) && c != '"'); while (c != EOF && c != '"');
if (c != '"') if (c != '"')
return FALSE; return FALSE;
while (!feof (infile)) while ((c = getc(infile)) != EOF)
{ {
fscanf (infile, "%c", &c);
if (cnt == (*buffer_size)) if (cnt == (*buffer_size))
{ {
(*buffer_size) *= 2; (*buffer_size) *= 2;
(*buffer) = (gchar *) realloc ((*buffer), *buffer_size); (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); }
}
if (c != '"') if (c != '"')
(*buffer)[cnt++] = c; (*buffer)[cnt++] = c;
@ -329,7 +331,7 @@ gdk_pixmap_extract_color (gchar *buffer)
while (finished == FALSE) while (finished == FALSE)
{ {
sscanf (ptr, "%s", temp); sscanf (ptr, "%127s", temp);
if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 || if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0) strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)

View File

@ -355,6 +355,10 @@ gdk_window_new (GdkWindow *parent,
gdk_window_ref (window); gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window); gdk_xid_table_insert (&private->xwindow, window);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
switch (private->window_type) switch (private->window_type)
{ {
case GDK_WINDOW_DIALOG: case GDK_WINDOW_DIALOG:
@ -368,26 +372,31 @@ gdk_window_new (GdkWindow *parent,
(colormap != gdk_colormap_get_system ()) && (colormap != gdk_colormap_get_system ()) &&
(colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window)))) (colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
{ {
g_print ("adding colormap window\n"); GDK_NOTE (MISC, g_print ("adding colormap window\n"));
gdk_window_add_colormap_windows (window); gdk_window_add_colormap_windows (window);
} }
break;
return window;
default: default:
break;
return window;
} }
size_hints.flags = PSize | PBaseSize; size_hints.flags = PSize;
size_hints.width = private->width; size_hints.width = private->width;
size_hints.height = private->height; size_hints.height = private->height;
size_hints.base_width = private->width;
size_hints.base_height = private->height;
wm_hints.flags = InputHint | StateHint | WindowGroupHint; wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window; wm_hints.window_group = gdk_leader_window;
wm_hints.input = True; wm_hints.input = True;
wm_hints.initial_state = NormalState; wm_hints.initial_state = NormalState;
/* FIXME: Is there any point in doing this? Do any WM's pay
* attention to PSize, and even if they do, is this the
* correct value???
*/
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints); XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints); XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
if (attributes_mask & GDK_WA_TITLE) if (attributes_mask & GDK_WA_TITLE)
@ -409,9 +418,6 @@ gdk_window_new (GdkWindow *parent,
XFree (class_hint); XFree (class_hint);
} }
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
return window; return window;
} }

View File

@ -44,6 +44,7 @@ gdk_pixmap_new (GdkWindow *window,
GdkWindowPrivate *window_private; GdkWindowPrivate *window_private;
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL); g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
@ -87,6 +88,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
GdkWindowPrivate *window_private; GdkWindowPrivate *window_private;
g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
@ -135,6 +137,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
g_return_val_if_fail (fg != NULL, NULL); g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL); g_return_val_if_fail (bg != NULL, NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL); g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
@ -179,13 +182,13 @@ gdk_pixmap_seek_string (FILE *infile,
while (!feof (infile)) while (!feof (infile))
{ {
fscanf (infile, "%s", instr); fscanf (infile, "%1023s", instr);
if (skip_comments == TRUE && strcmp (instr, "/*") == 0) if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
{ {
fscanf (infile, "%s", instr); fscanf (infile, "%1023s", instr);
while (!feof (infile) && strcmp (instr, "*/") != 0) while (!feof (infile) && strcmp (instr, "*/") != 0)
fscanf (infile, "%s", instr); fscanf (infile, "%1023s", instr);
fscanf(infile, "%s", instr); fscanf(infile, "%1023s", instr);
} }
if (strcmp (instr, str)==0) if (strcmp (instr, str)==0)
return TRUE; return TRUE;
@ -198,29 +201,31 @@ gint
gdk_pixmap_seek_char (FILE *infile, gdk_pixmap_seek_char (FILE *infile,
gchar c) gchar c)
{ {
gchar b, oldb; gint b, oldb;
while (!feof (infile)) while ((b = getc(infile)) != EOF)
{ {
fscanf(infile, "%c", &b);
if (c != b && b == '/') if (c != b && b == '/')
{ {
fscanf (infile, "%c", &b); b = getc (infile);
if (b == '*') if (b == EOF)
{ return FALSE;
oldb = b; else if (b == '*') /* we have a comment */
while (!feof (infile) && !(oldb == '*' && b == '/')) {
{ b = -1;
oldb = b; do
fscanf (infile, "%c", &b); {
} oldb = b;
fscanf (infile, "%c", &b); b = getc (infile);
} if (b == EOF)
return FALSE;
}
while (!(oldb == '*' && b == '/'));
}
} }
if (c == b) else if (c == b)
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
@ -229,31 +234,28 @@ gdk_pixmap_read_string (FILE *infile,
gchar **buffer, gchar **buffer,
guint *buffer_size) guint *buffer_size)
{ {
gchar c; gint c;
guint cnt = 0; guint cnt = 0;
if ((*buffer) == NULL) if ((*buffer) == NULL)
{ {
(*buffer_size) = 10 * sizeof (gchar); (*buffer_size) = 10 * sizeof (gchar);
(*buffer) = (gchar *) malloc (*buffer_size); (*buffer) = g_new(gchar, *buffer_size);
} }
do do
fscanf (infile, "%c", &c); c = getc (infile);
while (!feof (infile) && c != '"'); while (c != EOF && c != '"');
if (c != '"') if (c != '"')
return FALSE; return FALSE;
while (!feof (infile)) while ((c = getc(infile)) != EOF)
{ {
fscanf (infile, "%c", &c);
if (cnt == (*buffer_size)) if (cnt == (*buffer_size))
{ {
(*buffer_size) *= 2; (*buffer_size) *= 2;
(*buffer) = (gchar *) realloc ((*buffer), *buffer_size); (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); }
}
if (c != '"') if (c != '"')
(*buffer)[cnt++] = c; (*buffer)[cnt++] = c;
@ -329,7 +331,7 @@ gdk_pixmap_extract_color (gchar *buffer)
while (finished == FALSE) while (finished == FALSE)
{ {
sscanf (ptr, "%s", temp); sscanf (ptr, "%127s", temp);
if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 || if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0) strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)

View File

@ -355,6 +355,10 @@ gdk_window_new (GdkWindow *parent,
gdk_window_ref (window); gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window); gdk_xid_table_insert (&private->xwindow, window);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
switch (private->window_type) switch (private->window_type)
{ {
case GDK_WINDOW_DIALOG: case GDK_WINDOW_DIALOG:
@ -368,26 +372,31 @@ gdk_window_new (GdkWindow *parent,
(colormap != gdk_colormap_get_system ()) && (colormap != gdk_colormap_get_system ()) &&
(colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window)))) (colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
{ {
g_print ("adding colormap window\n"); GDK_NOTE (MISC, g_print ("adding colormap window\n"));
gdk_window_add_colormap_windows (window); gdk_window_add_colormap_windows (window);
} }
break;
return window;
default: default:
break;
return window;
} }
size_hints.flags = PSize | PBaseSize; size_hints.flags = PSize;
size_hints.width = private->width; size_hints.width = private->width;
size_hints.height = private->height; size_hints.height = private->height;
size_hints.base_width = private->width;
size_hints.base_height = private->height;
wm_hints.flags = InputHint | StateHint | WindowGroupHint; wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window; wm_hints.window_group = gdk_leader_window;
wm_hints.input = True; wm_hints.input = True;
wm_hints.initial_state = NormalState; wm_hints.initial_state = NormalState;
/* FIXME: Is there any point in doing this? Do any WM's pay
* attention to PSize, and even if they do, is this the
* correct value???
*/
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints); XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints); XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
if (attributes_mask & GDK_WA_TITLE) if (attributes_mask & GDK_WA_TITLE)
@ -409,9 +418,6 @@ gdk_window_new (GdkWindow *parent,
XFree (class_hint); XFree (class_hint);
} }
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
return window; return window;
} }

View File

@ -1,3 +1,8 @@
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
* gutils.c (g_direct_compare): Removed, because that's what
a NULL comparison function means. And it wasn't 64 bit safe.
Mon Apr 6 18:43:25 1998 Tim Janik <timj@gtk.org> Mon Apr 6 18:43:25 1998 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_get_token_ll): fixed a bug that caused floats * gscanner.c (g_scanner_get_token_ll): fixed a bug that caused floats

View File

@ -912,11 +912,6 @@ g_parse_debug_string (const gchar *string,
guint guint
g_direct_hash(gpointer key) g_direct_hash(gpointer key)
{ {
return (guint)key; return (guint)key;
} }
gint
g_direct_compare(gpointer a, gpointer b)
{
return (gint)b - (gint)a;
}

View File

@ -316,8 +316,8 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget,
/* make sure we don't allocate a negative width or height, /* make sure we don't allocate a negative width or height,
* since that will be cast to a (very big) guint16 */ * since that will be cast to a (very big) guint16 */
width = MAX (0, width); width = MAX (1, width);
height = MAX (0, height); height = MAX (1, height);
if (ratio * height > width) if (ratio * height > width)
{ {

View File

@ -421,9 +421,9 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness); child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness);
child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness); child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness);
child_allocation.width = MAX (0, widget->allocation.width - child_allocation.x * 2 - child_allocation.width = MAX (1, widget->allocation.width - child_allocation.x * 2 -
border_width * 2); border_width * 2);
child_allocation.height = MAX (0, widget->allocation.height - child_allocation.y * 2 - child_allocation.height = MAX (1, widget->allocation.height - child_allocation.y * 2 -
border_width * 2); border_width * 2);
if (GTK_WIDGET_CAN_DEFAULT (button)) if (GTK_WIDGET_CAN_DEFAULT (button))
@ -432,9 +432,9 @@ gtk_button_size_allocate (GtkWidget *widget,
DEFAULT_LEFT_POS); DEFAULT_LEFT_POS);
child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness + child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness +
DEFAULT_TOP_POS); DEFAULT_TOP_POS);
child_allocation.width = MAX (0, child_allocation.width - child_allocation.width = MAX (1, child_allocation.width -
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING)); (GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
child_allocation.height = MAX (0, child_allocation.height - child_allocation.height = MAX (1, child_allocation.height -
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING)); (GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
} }

View File

@ -249,9 +249,9 @@ gtk_check_button_size_allocate (GtkWidget *widget,
CHECK_BUTTON_CLASS (widget)->indicator_size + CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1); CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1);
child_allocation.y = GTK_CONTAINER (widget)->border_width + 1; child_allocation.y = GTK_CONTAINER (widget)->border_width + 1;
child_allocation.width = MAX (0, allocation->width - child_allocation.x - child_allocation.width = MAX (1, allocation->width - child_allocation.x -
GTK_CONTAINER (widget)->border_width - 1); GTK_CONTAINER (widget)->border_width - 1);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2); child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
gtk_widget_size_allocate (button->child, &child_allocation); gtk_widget_size_allocate (button->child, &child_allocation);
} }

View File

@ -2244,18 +2244,18 @@ gtk_clist_size_allocate (GtkWidget * widget,
* border width */ * border width */
clist->internal_allocation.x = 0; clist->internal_allocation.x = 0;
clist->internal_allocation.y = 0; clist->internal_allocation.y = 0;
clist->internal_allocation.width = MAX (0, allocation->width - clist->internal_allocation.width = MAX (1, allocation->width -
GTK_CONTAINER (widget)->border_width * 2); GTK_CONTAINER (widget)->border_width * 2);
clist->internal_allocation.height = MAX (0, allocation->height - clist->internal_allocation.height = MAX (1, allocation->height -
GTK_CONTAINER (widget)->border_width * 2); GTK_CONTAINER (widget)->border_width * 2);
/* allocate clist window assuming no scrollbars */ /* allocate clist window assuming no scrollbars */
clist_allocation.x = clist->internal_allocation.x + widget->style->klass->xthickness; clist_allocation.x = clist->internal_allocation.x + widget->style->klass->xthickness;
clist_allocation.y = clist->internal_allocation.y + widget->style->klass->ythickness + clist_allocation.y = clist->internal_allocation.y + widget->style->klass->ythickness +
clist->column_title_area.height; clist->column_title_area.height;
clist_allocation.width = MAX (0, clist->internal_allocation.width - clist_allocation.width = MAX (1, clist->internal_allocation.width -
(2 * widget->style->klass->xthickness)); (2 * widget->style->klass->xthickness));
clist_allocation.height = MAX (0, clist->internal_allocation.height - clist_allocation.height = MAX (1, clist->internal_allocation.height -
(2 * widget->style->klass->ythickness) - (2 * widget->style->klass->ythickness) -
clist->column_title_area.height); clist->column_title_area.height);
@ -2277,7 +2277,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
if (!vscrollbar_vis) if (!vscrollbar_vis)
{ {
vscrollbar_vis = 1; vscrollbar_vis = 1;
clist_allocation.width = MAX (0, clist_allocation.width - clist_allocation.width = MAX (1, clist_allocation.width -
(clist->vscrollbar->requisition.width + (clist->vscrollbar->requisition.width +
SCROLLBAR_SPACING (clist))); SCROLLBAR_SPACING (clist)));
} }
@ -2293,7 +2293,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
if (!hscrollbar_vis) if (!hscrollbar_vis)
{ {
hscrollbar_vis = 1; hscrollbar_vis = 1;
clist_allocation.height = MAX (0, clist_allocation.height - clist_allocation.height = MAX (1, clist_allocation.height -
(clist->hscrollbar->requisition.height + (clist->hscrollbar->requisition.height +
SCROLLBAR_SPACING (clist))); SCROLLBAR_SPACING (clist)));
} }
@ -2345,7 +2345,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
clist->vscrollbar->requisition.width; clist->vscrollbar->requisition.width;
child_allocation.y = clist->internal_allocation.y; child_allocation.y = clist->internal_allocation.y;
child_allocation.width = clist->vscrollbar->requisition.width; child_allocation.width = clist->vscrollbar->requisition.width;
child_allocation.height = MAX (0, clist->internal_allocation.height - child_allocation.height = MAX (1, clist->internal_allocation.height -
(hscrollbar_vis ? (clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist)) : 0)); (hscrollbar_vis ? (clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist)) : 0));
gtk_widget_size_allocate (clist->vscrollbar, &child_allocation); gtk_widget_size_allocate (clist->vscrollbar, &child_allocation);
@ -2365,7 +2365,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
child_allocation.y = clist->internal_allocation.y + child_allocation.y = clist->internal_allocation.y +
clist->internal_allocation.height - clist->internal_allocation.height -
clist->hscrollbar->requisition.height; clist->hscrollbar->requisition.height;
child_allocation.width = MAX (0, clist->internal_allocation.width - child_allocation.width = MAX (1, clist->internal_allocation.width -
(vscrollbar_vis ? (clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist)) : 0)); (vscrollbar_vis ? (clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist)) : 0));
child_allocation.height = clist->hscrollbar->requisition.height; child_allocation.height = clist->hscrollbar->requisition.height;

View File

@ -93,6 +93,7 @@ struct _CompletionDirSent
{ {
ino_t inode; ino_t inode;
time_t mtime; time_t mtime;
dev_t device;
gint entry_count; gint entry_count;
gchar *name_buffer; /* memory segment containing names of all entries */ gchar *name_buffer; /* memory segment containing names of all entries */
@ -1504,7 +1505,14 @@ cmpl_init_state (void)
new_state = g_new (CompletionState, 1); new_state = g_new (CompletionState, 1);
/* We don't use getcwd() on SUNOS, because, it does a popen("pwd")
* and, if that wasn't bad enough, hangs in doing so.
*/
#if defined(sun) && !defined(__SVR4)
if (!getwd (getcwd_buf))
#else
if (!getcwd (getcwd_buf, MAXPATHLEN)) if (!getcwd (getcwd_buf, MAXPATHLEN))
#endif
{ {
cmpl_errno = errno; cmpl_errno = errno;
return NULL; return NULL;
@ -1856,6 +1864,7 @@ open_new_dir(gchar* dir_name, struct stat* sbuf)
sent = g_new(CompletionDirSent, 1); sent = g_new(CompletionDirSent, 1);
sent->mtime = sbuf->st_mtime; sent->mtime = sbuf->st_mtime;
sent->inode = sbuf->st_ino; sent->inode = sbuf->st_ino;
sent->device = sbuf->st_dev;
path_buf_len = strlen(dir_name); path_buf_len = strlen(dir_name);
@ -1953,7 +1962,8 @@ open_dir(gchar* dir_name, CompletionState* cmpl_state)
sent = cdsl->data; sent = cdsl->data;
if(sent->inode == sbuf.st_ino && if(sent->inode == sbuf.st_ino &&
sent->mtime == sbuf.st_mtime) sent->mtime == sbuf.st_mtime &&
sent->device == sbuf.st_dev)
return attach_dir(sent, dir_name, cmpl_state); return attach_dir(sent, dir_name, cmpl_state);
cdsl = cdsl->next; cdsl = cdsl->next;
@ -2108,7 +2118,11 @@ find_parent_dir_fullname(gchar* dirname)
gchar buffer[MAXPATHLEN]; gchar buffer[MAXPATHLEN];
gchar buffer2[MAXPATHLEN]; gchar buffer2[MAXPATHLEN];
#if defined(sun) && !defined(__SVR4)
if(!getwd(buffer))
#else
if(!getcwd(buffer, MAXPATHLEN)) if(!getcwd(buffer, MAXPATHLEN))
#endif
{ {
cmpl_errno = errno; cmpl_errno = errno;
return NULL; return NULL;
@ -2120,7 +2134,11 @@ find_parent_dir_fullname(gchar* dirname)
return NULL; return NULL;
} }
#if defined(sun) && !defined(__SVR4)
if(!getwd(buffer2))
#else
if(!getcwd(buffer2, MAXPATHLEN)) if(!getcwd(buffer2, MAXPATHLEN))
#endif
{ {
chdir(buffer); chdir(buffer);
cmpl_errno = errno; cmpl_errno = errno;

View File

@ -493,7 +493,7 @@ gtk_frame_size_allocate (GtkWidget *widget,
child_allocation.y = (GTK_CONTAINER (frame)->border_width + child_allocation.y = (GTK_CONTAINER (frame)->border_width +
MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness)); MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness));
child_allocation.height = MAX (0, (allocation->height - child_allocation.y - child_allocation.height = MAX (1, (allocation->height - child_allocation.y -
GTK_CONTAINER (frame)->border_width - GTK_CONTAINER (frame)->border_width -
GTK_WIDGET (frame)->style->klass->ythickness)); GTK_WIDGET (frame)->style->klass->ythickness));

View File

@ -514,8 +514,8 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
} }
else else
{ {
child_allocation.width = MAX (0, widget->allocation.width - 2 * border_width); child_allocation.width = MAX (1, widget->allocation.width - 2 * border_width);
child_allocation.height = MAX (0, widget->allocation.height - 2 * border_width); child_allocation.height = MAX (1, widget->allocation.height - 2 * border_width);
if (hb->handle_position == GTK_POS_LEFT || if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT) hb->handle_position == GTK_POS_RIGHT)

View File

@ -198,7 +198,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
x = allocation->x + GTK_CONTAINER (box)->border_width; x = allocation->x + GTK_CONTAINER (box)->border_width;
child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width; child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
child_allocation.height = MAX (0, allocation->height - GTK_CONTAINER (box)->border_width * 2); child_allocation.height = MAX (1, allocation->height - GTK_CONTAINER (box)->border_width * 2);
children = box->children; children = box->children;
while (children) while (children)
@ -236,7 +236,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
if (child->fill) if (child->fill)
{ {
child_allocation.width = MAX (0, child_width - child->padding * 2); child_allocation.width = MAX (1, child_width - child->padding * 2);
child_allocation.x = x + child->padding; child_allocation.x = x + child->padding;
} }
else else
@ -289,7 +289,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
if (child->fill) if (child->fill)
{ {
child_allocation.width = MAX (0, child_width - child->padding * 2); child_allocation.width = MAX (1, child_width - child->padding * 2);
child_allocation.x = x + child->padding - child_width; child_allocation.x = x + child->padding - child_width;
} }
else else

View File

@ -177,7 +177,7 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height); paned->groove_rectangle.height);
} }
child1_allocation.height = child2_allocation.height = MAX (0, allocation->height - border_width * 2); child1_allocation.height = child2_allocation.height = MAX (1, allocation->height - border_width * 2);
child1_allocation.width = paned->child1_size; child1_allocation.width = paned->child1_size;
child1_allocation.x = border_width; child1_allocation.x = border_width;
child1_allocation.y = child2_allocation.y = border_width; child1_allocation.y = child2_allocation.y = border_width;
@ -189,7 +189,7 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height = allocation->height; paned->groove_rectangle.height = allocation->height;
child2_allocation.x = paned->groove_rectangle.x + paned->gutter_size / 2 + 1; child2_allocation.x = paned->groove_rectangle.x + paned->gutter_size / 2 + 1;
child2_allocation.width = MAX (0, allocation->width child2_allocation.width = MAX (1, allocation->width
- child2_allocation.x - border_width); - child2_allocation.x - border_width);
/* Now allocate the childen, making sure, when resizing not to /* Now allocate the childen, making sure, when resizing not to

View File

@ -789,7 +789,7 @@ gtk_list_size_allocate (GtkWidget *widget,
{ {
child_allocation.x = GTK_CONTAINER (list)->border_width; child_allocation.x = GTK_CONTAINER (list)->border_width;
child_allocation.y = GTK_CONTAINER (list)->border_width; child_allocation.y = GTK_CONTAINER (list)->border_width;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2); child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
children = list->children; children = list->children;

View File

@ -641,7 +641,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
widget->style->klass->xthickness); widget->style->klass->xthickness);
child_allocation.y = (GTK_CONTAINER (menu)->border_width + child_allocation.y = (GTK_CONTAINER (menu)->border_width +
widget->style->klass->ythickness); widget->style->klass->ythickness);
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2); child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
children = menu_shell->children; children = menu_shell->children;
while (children) while (children)

View File

@ -206,7 +206,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width + child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
widget->style->klass->ythickness + widget->style->klass->ythickness +
BORDER_SPACING); BORDER_SPACING);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2); child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
children = menu_shell->children; children = menu_shell->children;
while (children) while (children)

View File

@ -395,8 +395,8 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
widget->style->klass->xthickness + widget->style->klass->xthickness +
BORDER_SPACING); BORDER_SPACING);
child_allocation.y = GTK_CONTAINER (widget)->border_width; child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2); child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2); child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size; child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
child_allocation.width -= (GTK_MENU_ITEM (widget)->toggle_size + child_allocation.width -= (GTK_MENU_ITEM (widget)->toggle_size +
GTK_MENU_ITEM (widget)->accelerator_size); GTK_MENU_ITEM (widget)->accelerator_size);

View File

@ -1162,16 +1162,16 @@ gtk_notebook_size_allocate (GtkWidget *widget,
{ {
child_allocation.x = GTK_CONTAINER (widget)->border_width; child_allocation.x = GTK_CONTAINER (widget)->border_width;
child_allocation.y = GTK_CONTAINER (widget)->border_width; child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2); child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2); child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
if (notebook->show_tabs || notebook->show_border) if (notebook->show_tabs || notebook->show_border)
{ {
child_allocation.x += widget->style->klass->xthickness; child_allocation.x += widget->style->klass->xthickness;
child_allocation.y += widget->style->klass->ythickness; child_allocation.y += widget->style->klass->ythickness;
child_allocation.width = MAX (0, child_allocation.width = MAX (1,
child_allocation.width - widget->style->klass->xthickness * 2); child_allocation.width - widget->style->klass->xthickness * 2);
child_allocation.height = MAX (0, child_allocation.height = MAX (1,
child_allocation.height - widget->style->klass->ythickness * 2); child_allocation.height - widget->style->klass->ythickness * 2);
if (notebook->show_tabs && notebook->children) if (notebook->show_tabs && notebook->children)
@ -1181,13 +1181,13 @@ gtk_notebook_size_allocate (GtkWidget *widget,
case GTK_POS_TOP: case GTK_POS_TOP:
child_allocation.y += notebook->cur_page->requisition.height; child_allocation.y += notebook->cur_page->requisition.height;
case GTK_POS_BOTTOM: case GTK_POS_BOTTOM:
child_allocation.height = MAX (0, child_allocation.height = MAX (1,
child_allocation.height - notebook->cur_page->requisition.height); child_allocation.height - notebook->cur_page->requisition.height);
break; break;
case GTK_POS_LEFT: case GTK_POS_LEFT:
child_allocation.x += notebook->cur_page->requisition.width; child_allocation.x += notebook->cur_page->requisition.width;
case GTK_POS_RIGHT: case GTK_POS_RIGHT:
child_allocation.width = MAX (0, child_allocation.width = MAX (1,
child_allocation.width - notebook->cur_page->requisition.width); child_allocation.width - notebook->cur_page->requisition.width);
break; break;
} }

View File

@ -45,13 +45,13 @@ enum
/* Macros for extracting a widgets private_flags from GtkWidget. /* Macros for extracting a widgets private_flags from GtkWidget.
*/ */
#define GTK_PRIVATE_FLAGS(wid) (GTK_WIDGET (wid)->private_flags) #define GTK_PRIVATE_FLAGS(wid) (GTK_WIDGET (wid)->private_flags)
#define GTK_WIDGET_USER_STYLE(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_USER_STYLE) #define GTK_WIDGET_USER_STYLE(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_USER_STYLE) != 0)
#define GTK_WIDGET_REDRAW_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_REDRAW_PENDING) #define GTK_WIDGET_REDRAW_PENDING(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_REDRAW_PENDING) != 0)
#define GTK_CONTAINER_RESIZE_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_PENDING) #define GTK_CONTAINER_RESIZE_PENDING(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_PENDING) != 0)
#define GTK_WIDGET_RESIZE_NEEDED(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_NEEDED) #define GTK_WIDGET_RESIZE_NEEDED(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_NEEDED) != 0)
#define GTK_WIDGET_LEAVE_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_LEAVE_PENDING) #define GTK_WIDGET_LEAVE_PENDING(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_LEAVE_PENDING) != 0)
#define GTK_WIDGET_HAS_SHAPE_MASK(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_SHAPE_MASK) #define GTK_WIDGET_HAS_SHAPE_MASK(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_SHAPE_MASK) != 0)
#define GTK_WIDGET_IN_REPARENT(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_IN_REPARENT) #define GTK_WIDGET_IN_REPARENT(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_IN_REPARENT) != 0)
/* Macros for setting and clearing private widget flags. /* Macros for setting and clearing private widget flags.
* we use a preprocessor string concatenation here for a clear * we use a preprocessor string concatenation here for a clear

View File

@ -493,14 +493,14 @@ gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
allocation->x = GTK_CONTAINER (widget)->border_width; allocation->x = GTK_CONTAINER (widget)->border_width;
allocation->y = GTK_CONTAINER (widget)->border_width; allocation->y = GTK_CONTAINER (widget)->border_width;
allocation->width = MAX (0, widget->allocation.width - allocation->x * 2); allocation->width = MAX (1, widget->allocation.width - allocation->x * 2);
allocation->height = MAX (0, widget->allocation.height - allocation->y * 2); allocation->height = MAX (1, widget->allocation.height - allocation->y * 2);
if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar)) if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
allocation->width = MAX (0, allocation->width = MAX (1,
allocation->width - (scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window))); allocation->width - (scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window)));
if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar)) if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
allocation->height = MAX (0, allocation->height = MAX (1,
allocation->height - (scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window))); allocation->height - (scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window)));
} }

View File

@ -977,7 +977,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (col = 0; col < table->ncols; col++) for (col = 0; col < table->ncols; col++)
{ {
extra = width / (table->ncols - col); extra = width / (table->ncols - col);
table->cols[col].allocation = MAX (0, extra); table->cols[col].allocation = MAX (1, extra);
width -= extra; width -= extra;
} }
} }
@ -1026,7 +1026,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->cols[col].shrink) if (table->cols[col].shrink)
{ {
extra = width / nshrink; extra = width / nshrink;
table->cols[col].allocation = MAX (0, table->cols[col].allocation - extra); table->cols[col].allocation = MAX (1, table->cols[col].allocation - extra);
width -= extra; width -= extra;
nshrink -= 1; nshrink -= 1;
@ -1055,7 +1055,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (row = 0; row < table->nrows; row++) for (row = 0; row < table->nrows; row++)
{ {
extra = height / (table->nrows - row); extra = height / (table->nrows - row);
table->rows[row].allocation = MAX (0, extra); table->rows[row].allocation = MAX (1, extra);
height -= extra; height -= extra;
} }
} }
@ -1104,7 +1104,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->rows[row].shrink) if (table->rows[row].shrink)
{ {
extra = height / nshrink; extra = height / nshrink;
table->rows[row].allocation = MAX (0, table->rows[row].allocation - extra); table->rows[row].allocation = MAX (1, table->rows[row].allocation - extra);
height -= extra; height -= extra;
nshrink -= 1; nshrink -= 1;
@ -1165,7 +1165,7 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
if (child->xfill) if (child->xfill)
{ {
allocation.width = MAX (0, max_width - child->xpadding * 2); allocation.width = MAX (1, max_width - child->xpadding * 2);
allocation.x = x + (max_width - allocation.width) / 2; allocation.x = x + (max_width - allocation.width) / 2;
} }
else else
@ -1176,7 +1176,7 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
if (child->yfill) if (child->yfill)
{ {
allocation.height = MAX (0, max_height - child->ypadding * 2); allocation.height = MAX (1, max_height - child->ypadding * 2);
allocation.y = y + (max_height - allocation.height) / 2; allocation.y = y + (max_height - allocation.height) / 2;
} }
else else

View File

@ -928,7 +928,7 @@ gtk_tree_size_allocate (GtkWidget *widget,
{ {
child_allocation.x = GTK_CONTAINER (tree)->border_width; child_allocation.x = GTK_CONTAINER (tree)->border_width;
child_allocation.y = GTK_CONTAINER (tree)->border_width; child_allocation.y = GTK_CONTAINER (tree)->border_width;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2); child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
children = tree->children; children = tree->children;

View File

@ -551,11 +551,11 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (item->pixmaps_box, &child_allocation); gtk_widget_size_allocate (item->pixmaps_box, &child_allocation);
child_allocation.y = GTK_CONTAINER (widget)->border_width; child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2); child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
child_allocation.x += item->pixmaps_box->requisition.width+DEFAULT_DELTA; child_allocation.x += item->pixmaps_box->requisition.width+DEFAULT_DELTA;
child_allocation.width = child_allocation.width =
MAX (0, allocation->width - (child_allocation.x + border_width)); MAX (1, allocation->width - (child_allocation.x + border_width));
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (bin->child, &child_allocation);
} }

View File

@ -198,7 +198,7 @@ gtk_vbox_size_allocate (GtkWidget *widget,
y = allocation->y + GTK_CONTAINER (box)->border_width; y = allocation->y + GTK_CONTAINER (box)->border_width;
child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width; child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width;
child_allocation.width = MAX (0, allocation->width - GTK_CONTAINER (box)->border_width * 2); child_allocation.width = MAX (1, allocation->width - GTK_CONTAINER (box)->border_width * 2);
children = box->children; children = box->children;
while (children) while (children)
@ -236,7 +236,7 @@ gtk_vbox_size_allocate (GtkWidget *widget,
if (child->fill) if (child->fill)
{ {
child_allocation.height = MAX (0, child_height - child->padding * 2); child_allocation.height = MAX (1, child_height - child->padding * 2);
child_allocation.y = y + child->padding; child_allocation.y = y + child->padding;
} }
else else
@ -289,7 +289,7 @@ gtk_vbox_size_allocate (GtkWidget *widget,
if (child->fill) if (child->fill)
{ {
child_allocation.height = MAX (0, child_height - child->padding * 2); child_allocation.height = MAX (1, child_height - child->padding * 2);
child_allocation.y = y + child->padding - child_height; child_allocation.y = y + child->padding - child_height;
} }
else else

View File

@ -535,8 +535,8 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness; child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
} }
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2 - border_width * 2); child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2 - border_width * 2);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2 - border_width * 2); child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2 - border_width * 2);
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
{ {

View File

@ -177,7 +177,7 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height); paned->groove_rectangle.height);
} }
child1_allocation.width = child2_allocation.width = MAX (0, allocation->width - border_width * 2); child1_allocation.width = child2_allocation.width = MAX (1, allocation->width - border_width * 2);
child1_allocation.height = paned->child1_size; child1_allocation.height = paned->child1_size;
child1_allocation.x = child2_allocation.x = border_width; child1_allocation.x = child2_allocation.x = border_width;
child1_allocation.y = border_width; child1_allocation.y = border_width;
@ -189,7 +189,7 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.width = allocation->width; paned->groove_rectangle.width = allocation->width;
child2_allocation.y = paned->groove_rectangle.y + paned->gutter_size / 2 + 1; child2_allocation.y = paned->groove_rectangle.y + paned->gutter_size / 2 + 1;
child2_allocation.height = MAX (0, allocation->height child2_allocation.height = MAX (1, allocation->height
- child2_allocation.y - border_width); - child2_allocation.y - border_width);
/* Now allocate the childen, making sure, when resizing not to /* Now allocate the childen, making sure, when resizing not to

View File

@ -70,23 +70,23 @@ enum
/* Macros for extracting the widget flags from GtkWidget. /* Macros for extracting the widget flags from GtkWidget.
*/ */
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid)) #define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
#define GTK_WIDGET_TOPLEVEL(wid) (GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) #define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
#define GTK_WIDGET_NO_WINDOW(wid) (GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) #define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
#define GTK_WIDGET_REALIZED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) #define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
#define GTK_WIDGET_MAPPED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) #define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
#define GTK_WIDGET_VISIBLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) #define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
#define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid)) #define GTK_WIDGET_DRAWABLE(wid) ((GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid)) != 0)
#define GTK_WIDGET_SENSITIVE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) #define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
#define GTK_WIDGET_PARENT_SENSITIVE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) #define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
#define GTK_WIDGET_IS_SENSITIVE(wid) ((GTK_WIDGET_SENSITIVE (wid) && \ #define GTK_WIDGET_IS_SENSITIVE(wid) (((GTK_WIDGET_SENSITIVE (wid) && \
GTK_WIDGET_PARENT_SENSITIVE (wid)) != 0) GTK_WIDGET_PARENT_SENSITIVE (wid)) != 0) != 0)
#define GTK_WIDGET_CAN_FOCUS(wid) (GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) #define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
#define GTK_WIDGET_HAS_FOCUS(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) #define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
#define GTK_WIDGET_CAN_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) #define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
#define GTK_WIDGET_HAS_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) #define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
#define GTK_WIDGET_HAS_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) #define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
#define GTK_WIDGET_BASIC(wid) (GTK_WIDGET_FLAGS (wid) & GTK_BASIC) #define GTK_WIDGET_BASIC(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_BASIC) != 0)
#define GTK_WIDGET_RC_STYLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) #define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
/* Macros for setting and clearing widget flags. /* Macros for setting and clearing widget flags.
*/ */

View File

@ -1283,6 +1283,7 @@ gtk_window_set_hints (GtkWidget *widget,
GtkWidgetAuxInfo *aux_info; GtkWidgetAuxInfo *aux_info;
gint flags; gint flags;
gint ux, uy; gint ux, uy;
gint min_width, min_height;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WINDOW (widget)); g_return_if_fail (GTK_IS_WINDOW (widget));
@ -1303,6 +1304,7 @@ gtk_window_set_hints (GtkWidget *widget,
uy = aux_info->y; uy = aux_info->y;
flags |= GDK_HINT_POS; flags |= GDK_HINT_POS;
} }
if (!window->allow_shrink) if (!window->allow_shrink)
flags |= GDK_HINT_MIN_SIZE; flags |= GDK_HINT_MIN_SIZE;
if (!window->allow_grow) if (!window->allow_grow)